From 8bd2d39dfe7c92dd5346b9ef6347ac0065b443fe Mon Sep 17 00:00:00 2001 From: pelya Date: Wed, 13 Oct 2010 17:23:09 +0300 Subject: [PATCH] Added xerces and lua libraries --- project/jni/Application.mk | 5 +- project/jni/lua/Android.mk | 20 + project/jni/lua/COPYRIGHT | 34 + project/jni/lua/HISTORY | 183 + project/jni/lua/INSTALL | 99 + project/jni/lua/Makefile | 128 + project/jni/lua/README | 37 + project/jni/lua/src/lapi.c | 1087 ++ project/jni/lua/src/lapi.h | 16 + project/jni/lua/src/lauxlib.c | 652 ++ project/jni/lua/src/lauxlib.h | 174 + project/jni/lua/src/lbaselib.c | 653 ++ project/jni/lua/src/lcode.c | 839 ++ project/jni/lua/src/lcode.h | 76 + project/jni/lua/src/ldblib.c | 397 + project/jni/lua/src/ldebug.c | 638 ++ project/jni/lua/src/ldebug.h | 33 + project/jni/lua/src/ldo.c | 518 + project/jni/lua/src/ldo.h | 57 + project/jni/lua/src/ldump.c | 164 + project/jni/lua/src/lfunc.c | 174 + project/jni/lua/src/lfunc.h | 34 + project/jni/lua/src/lgc.c | 711 ++ project/jni/lua/src/lgc.h | 110 + project/jni/lua/src/linit.c | 38 + project/jni/lua/src/liolib.c | 553 + project/jni/lua/src/llex.c | 465 + project/jni/lua/src/llex.h | 81 + project/jni/lua/src/llimits.h | 128 + project/jni/lua/src/lmathlib.c | 263 + project/jni/lua/src/lmem.c | 86 + project/jni/lua/src/lmem.h | 49 + project/jni/lua/src/loadlib.c | 666 ++ project/jni/lua/src/lobject.c | 214 + project/jni/lua/src/lobject.h | 381 + project/jni/lua/src/lopcodes.c | 102 + project/jni/lua/src/lopcodes.h | 268 + project/jni/lua/src/loslib.c | 243 + project/jni/lua/src/lparser.c | 1339 +++ project/jni/lua/src/lparser.h | 82 + project/jni/lua/src/lstate.c | 214 + project/jni/lua/src/lstate.h | 169 + project/jni/lua/src/lstring.c | 111 + project/jni/lua/src/lstring.h | 31 + project/jni/lua/src/lstrlib.c | 869 ++ project/jni/lua/src/ltable.c | 588 + project/jni/lua/src/ltable.h | 40 + project/jni/lua/src/ltablib.c | 287 + project/jni/lua/src/ltm.c | 75 + project/jni/lua/src/ltm.h | 54 + project/jni/lua/src/lua.h | 388 + project/jni/lua/src/luaconf.h | 765 ++ project/jni/lua/src/lualib.h | 53 + project/jni/lua/src/lundump.c | 227 + project/jni/lua/src/lundump.h | 36 + project/jni/lua/src/lvm.c | 763 ++ project/jni/lua/src/lvm.h | 36 + project/jni/lua/src/lzio.c | 82 + project/jni/lua/src/lzio.h | 67 + project/jni/lua/src/print.c | 227 + project/jni/lua/src/tolua++.h | 186 + project/jni/lua/src/tolua_event.c | 536 + project/jni/lua/src/tolua_event.h | 24 + project/jni/lua/src/tolua_is.c | 621 ++ project/jni/lua/src/tolua_map.c | 704 ++ project/jni/lua/src/tolua_push.c | 171 + project/jni/lua/src/tolua_to.c | 133 + project/jni/xerces/Android.mk | 18 + project/jni/xerces/CREDITS | 144 + project/jni/xerces/INSTALL | 2 + project/jni/xerces/KEYS | 226 + project/jni/xerces/LICENSE | 202 + project/jni/xerces/NOTICE | 10 + project/jni/xerces/README | 2 + project/jni/xerces/config.h | 489 + project/jni/xerces/config.h.in | 488 + project/jni/xerces/config.h.old | 489 + project/jni/xerces/iconv/iconv.h | 22 + project/jni/xerces/src/Makefile | 4980 +++++++++ project/jni/xerces/src/Makefile.am | 1160 ++ project/jni/xerces/src/Makefile.in | 4980 +++++++++ project/jni/xerces/src/stricmp.c | 40 + project/jni/xerces/src/stricmp.h | 35 + project/jni/xerces/src/strnicmp.c | 39 + project/jni/xerces/src/strnicmp.h | 37 + project/jni/xerces/src/towlower.c | 30 + project/jni/xerces/src/towlower.h | 35 + project/jni/xerces/src/towupper.c | 30 + project/jni/xerces/src/towupper.h | 35 + .../xercesc/NLS/EN_US/XMLErrList_EN_US.Xml | 846 ++ .../jni/xerces/src/xercesc/NLS/XMLErrList.dtd | 36 + project/jni/xerces/src/xercesc/dom/DOM.hpp | 87 + .../jni/xerces/src/xercesc/dom/DOMAttr.hpp | 176 + .../src/xercesc/dom/DOMCDATASection.hpp | 104 + .../src/xercesc/dom/DOMCharacterData.hpp | 215 + .../jni/xerces/src/xercesc/dom/DOMComment.hpp | 76 + .../src/xercesc/dom/DOMConfiguration.hpp | 454 + .../xerces/src/xercesc/dom/DOMDocument.hpp | 819 ++ .../src/xercesc/dom/DOMDocumentFragment.hpp | 108 + .../src/xercesc/dom/DOMDocumentRange.hpp | 95 + .../src/xercesc/dom/DOMDocumentTraversal.hpp | 155 + .../src/xercesc/dom/DOMDocumentType.hpp | 160 + .../jni/xerces/src/xercesc/dom/DOMElement.hpp | 528 + .../jni/xerces/src/xercesc/dom/DOMEntity.hpp | 170 + .../src/xercesc/dom/DOMEntityReference.hpp | 96 + .../jni/xerces/src/xercesc/dom/DOMError.hpp | 173 + .../src/xercesc/dom/DOMErrorHandler.hpp | 107 + .../xerces/src/xercesc/dom/DOMException.cpp | 84 + .../xerces/src/xercesc/dom/DOMException.hpp | 257 + .../src/xercesc/dom/DOMImplementation.hpp | 249 + .../src/xercesc/dom/DOMImplementationLS.hpp | 183 + .../src/xercesc/dom/DOMImplementationList.hpp | 124 + .../xercesc/dom/DOMImplementationRegistry.hpp | 101 + .../xercesc/dom/DOMImplementationSource.hpp | 112 + .../xerces/src/xercesc/dom/DOMLSException.cpp | 49 + .../xerces/src/xercesc/dom/DOMLSException.hpp | 123 + .../jni/xerces/src/xercesc/dom/DOMLSInput.hpp | 274 + .../xerces/src/xercesc/dom/DOMLSOutput.hpp | 169 + .../xerces/src/xercesc/dom/DOMLSParser.hpp | 766 ++ .../src/xercesc/dom/DOMLSParserFilter.hpp | 164 + .../src/xercesc/dom/DOMLSResourceResolver.hpp | 143 + .../src/xercesc/dom/DOMLSSerializer.hpp | 547 + .../src/xercesc/dom/DOMLSSerializerFilter.hpp | 107 + .../jni/xerces/src/xercesc/dom/DOMLocator.hpp | 135 + .../src/xercesc/dom/DOMMemoryManager.hpp | 160 + .../src/xercesc/dom/DOMNamedNodeMap.hpp | 245 + .../jni/xerces/src/xercesc/dom/DOMNode.hpp | 922 ++ .../xerces/src/xercesc/dom/DOMNodeFilter.hpp | 221 + .../src/xercesc/dom/DOMNodeIterator.hpp | 196 + .../xerces/src/xercesc/dom/DOMNodeList.hpp | 112 + .../xerces/src/xercesc/dom/DOMNotation.hpp | 114 + .../src/xercesc/dom/DOMPSVITypeInfo.hpp | 118 + .../xercesc/dom/DOMProcessingInstruction.hpp | 121 + .../jni/xerces/src/xercesc/dom/DOMRange.hpp | 530 + .../src/xercesc/dom/DOMRangeException.cpp | 52 + .../src/xercesc/dom/DOMRangeException.hpp | 114 + .../xerces/src/xercesc/dom/DOMStringList.hpp | 131 + .../jni/xerces/src/xercesc/dom/DOMText.hpp | 182 + .../xerces/src/xercesc/dom/DOMTreeWalker.hpp | 276 + .../xerces/src/xercesc/dom/DOMTypeInfo.hpp | 196 + .../src/xercesc/dom/DOMUserDataHandler.hpp | 140 + .../src/xercesc/dom/DOMXPathEvaluator.hpp | 180 + .../src/xercesc/dom/DOMXPathException.cpp | 52 + .../src/xercesc/dom/DOMXPathException.hpp | 105 + .../src/xercesc/dom/DOMXPathExpression.hpp | 129 + .../src/xercesc/dom/DOMXPathNSResolver.hpp | 130 + .../src/xercesc/dom/DOMXPathNamespace.hpp | 115 + .../xerces/src/xercesc/dom/DOMXPathResult.hpp | 351 + .../jni/xerces/src/xercesc/dom/StDOMNode.hpp | 95 + .../src/xercesc/dom/impl/DOMAttrImpl.cpp | 362 + .../src/xercesc/dom/impl/DOMAttrImpl.hpp | 137 + .../src/xercesc/dom/impl/DOMAttrMapImpl.cpp | 494 + .../src/xercesc/dom/impl/DOMAttrMapImpl.hpp | 125 + .../src/xercesc/dom/impl/DOMAttrNSImpl.cpp | 247 + .../src/xercesc/dom/impl/DOMAttrNSImpl.hpp | 85 + .../xercesc/dom/impl/DOMCDATASectionImpl.cpp | 316 + .../xercesc/dom/impl/DOMCDATASectionImpl.hpp | 98 + .../xerces/src/xercesc/dom/impl/DOMCasts.hpp | 146 + .../xercesc/dom/impl/DOMCharacterDataImpl.cpp | 318 + .../xercesc/dom/impl/DOMCharacterDataImpl.hpp | 89 + .../src/xercesc/dom/impl/DOMChildNode.cpp | 78 + .../src/xercesc/dom/impl/DOMChildNode.hpp | 72 + .../src/xercesc/dom/impl/DOMCommentImpl.cpp | 189 + .../src/xercesc/dom/impl/DOMCommentImpl.hpp | 84 + .../xercesc/dom/impl/DOMConfigurationImpl.cpp | 271 + .../xercesc/dom/impl/DOMConfigurationImpl.hpp | 150 + .../xercesc/dom/impl/DOMDeepNodeListImpl.cpp | 219 + .../xercesc/dom/impl/DOMDeepNodeListImpl.hpp | 80 + .../xercesc/dom/impl/DOMDeepNodeListPool.c | 428 + .../xercesc/dom/impl/DOMDeepNodeListPool.hpp | 200 + .../dom/impl/DOMDocumentFragmentImpl.cpp | 137 + .../dom/impl/DOMDocumentFragmentImpl.hpp | 69 + .../src/xercesc/dom/impl/DOMDocumentImpl.cpp | 1509 +++ .../src/xercesc/dom/impl/DOMDocumentImpl.hpp | 507 + .../xercesc/dom/impl/DOMDocumentTypeImpl.cpp | 555 + .../xercesc/dom/impl/DOMDocumentTypeImpl.hpp | 107 + .../src/xercesc/dom/impl/DOMElementImpl.cpp | 880 ++ .../src/xercesc/dom/impl/DOMElementImpl.hpp | 143 + .../src/xercesc/dom/impl/DOMElementNSImpl.cpp | 264 + .../src/xercesc/dom/impl/DOMElementNSImpl.hpp | 95 + .../src/xercesc/dom/impl/DOMEntityImpl.cpp | 295 + .../src/xercesc/dom/impl/DOMEntityImpl.hpp | 107 + .../dom/impl/DOMEntityReferenceImpl.cpp | 223 + .../dom/impl/DOMEntityReferenceImpl.hpp | 79 + .../src/xercesc/dom/impl/DOMErrorImpl.cpp | 90 + .../src/xercesc/dom/impl/DOMErrorImpl.hpp | 188 + .../dom/impl/DOMImplementationImpl.cpp | 291 + .../dom/impl/DOMImplementationImpl.hpp | 102 + .../dom/impl/DOMImplementationListImpl.cpp | 59 + .../dom/impl/DOMImplementationListImpl.hpp | 56 + .../dom/impl/DOMImplementationRegistry.cpp | 117 + .../src/xercesc/dom/impl/DOMLSInputImpl.cpp | 95 + .../src/xercesc/dom/impl/DOMLSInputImpl.hpp | 134 + .../src/xercesc/dom/impl/DOMLSOutputImpl.cpp | 66 + .../src/xercesc/dom/impl/DOMLSOutputImpl.hpp | 92 + .../xercesc/dom/impl/DOMLSSerializerImpl.cpp | 1721 +++ .../xercesc/dom/impl/DOMLSSerializerImpl.hpp | 232 + .../src/xercesc/dom/impl/DOMLocatorImpl.cpp | 60 + .../src/xercesc/dom/impl/DOMLocatorImpl.hpp | 187 + .../xercesc/dom/impl/DOMNamedNodeMapImpl.cpp | 340 + .../xercesc/dom/impl/DOMNamedNodeMapImpl.hpp | 80 + .../src/xercesc/dom/impl/DOMNodeIDMap.cpp | 230 + .../src/xercesc/dom/impl/DOMNodeIDMap.hpp | 86 + .../src/xercesc/dom/impl/DOMNodeImpl.cpp | 1028 ++ .../src/xercesc/dom/impl/DOMNodeImpl.hpp | 382 + .../xercesc/dom/impl/DOMNodeIteratorImpl.cpp | 365 + .../xercesc/dom/impl/DOMNodeIteratorImpl.hpp | 122 + .../src/xercesc/dom/impl/DOMNodeListImpl.cpp | 72 + .../src/xercesc/dom/impl/DOMNodeListImpl.hpp | 73 + .../src/xercesc/dom/impl/DOMNodeVector.cpp | 123 + .../src/xercesc/dom/impl/DOMNodeVector.hpp | 88 + .../src/xercesc/dom/impl/DOMNormalizer.cpp | 500 + .../src/xercesc/dom/impl/DOMNormalizer.hpp | 166 + .../src/xercesc/dom/impl/DOMNotationImpl.cpp | 179 + .../src/xercesc/dom/impl/DOMNotationImpl.hpp | 93 + .../src/xercesc/dom/impl/DOMParentNode.cpp | 464 + .../src/xercesc/dom/impl/DOMParentNode.hpp | 114 + .../dom/impl/DOMProcessingInstructionImpl.cpp | 215 + .../dom/impl/DOMProcessingInstructionImpl.hpp | 92 + .../src/xercesc/dom/impl/DOMRangeImpl.cpp | 2115 ++++ .../src/xercesc/dom/impl/DOMRangeImpl.hpp | 176 + .../xercesc/dom/impl/DOMStringListImpl.cpp | 64 + .../xercesc/dom/impl/DOMStringListImpl.hpp | 56 + .../src/xercesc/dom/impl/DOMStringPool.cpp | 62 + .../src/xercesc/dom/impl/DOMStringPool.hpp | 211 + .../src/xercesc/dom/impl/DOMTextImpl.cpp | 326 + .../src/xercesc/dom/impl/DOMTextImpl.hpp | 103 + .../xercesc/dom/impl/DOMTreeWalkerImpl.cpp | 484 + .../xercesc/dom/impl/DOMTreeWalkerImpl.hpp | 168 + .../src/xercesc/dom/impl/DOMTypeInfoImpl.cpp | 186 + .../src/xercesc/dom/impl/DOMTypeInfoImpl.hpp | 106 + .../dom/impl/DOMXPathExpressionImpl.cpp | 216 + .../dom/impl/DOMXPathExpressionImpl.hpp | 69 + .../dom/impl/DOMXPathNSResolverImpl.cpp | 109 + .../dom/impl/DOMXPathNSResolverImpl.hpp | 58 + .../xercesc/dom/impl/DOMXPathResultImpl.cpp | 138 + .../xercesc/dom/impl/DOMXPathResultImpl.hpp | 66 + .../src/xercesc/dom/impl/XSDElementNSImpl.cpp | 63 + .../src/xercesc/dom/impl/XSDElementNSImpl.hpp | 71 + .../src/xercesc/framework/BinOutputStream.cpp | 45 + .../src/xercesc/framework/BinOutputStream.hpp | 65 + .../framework/LocalFileFormatTarget.cpp | 149 + .../framework/LocalFileFormatTarget.hpp | 99 + .../framework/LocalFileInputSource.cpp | 172 + .../framework/LocalFileInputSource.hpp | 152 + .../xercesc/framework/MemBufFormatTarget.cpp | 105 + .../xercesc/framework/MemBufFormatTarget.hpp | 136 + .../xercesc/framework/MemBufInputSource.cpp | 94 + .../xercesc/framework/MemBufInputSource.hpp | 230 + .../src/xercesc/framework/MemoryManager.hpp | 125 + .../xercesc/framework/StdInInputSource.cpp | 52 + .../xercesc/framework/StdInInputSource.hpp | 108 + .../xercesc/framework/StdOutFormatTarget.cpp | 51 + .../xercesc/framework/StdOutFormatTarget.hpp | 57 + .../src/xercesc/framework/URLInputSource.cpp | 100 + .../src/xercesc/framework/URLInputSource.hpp | 236 + .../xercesc/framework/ValidationContext.hpp | 139 + .../xercesc/framework/Wrapper4DOMLSInput.cpp | 160 + .../xercesc/framework/Wrapper4DOMLSInput.hpp | 230 + .../xercesc/framework/Wrapper4InputSource.cpp | 121 + .../xercesc/framework/Wrapper4InputSource.hpp | 290 + .../src/xercesc/framework/XMLAttDef.cpp | 220 + .../src/xercesc/framework/XMLAttDef.hpp | 539 + .../src/xercesc/framework/XMLAttDefList.cpp | 42 + .../src/xercesc/framework/XMLAttDefList.hpp | 171 + .../xerces/src/xercesc/framework/XMLAttr.cpp | 172 + .../xerces/src/xercesc/framework/XMLAttr.hpp | 501 + .../src/xercesc/framework/XMLBuffer.cpp | 86 + .../src/xercesc/framework/XMLBuffer.hpp | 281 + .../src/xercesc/framework/XMLBufferMgr.cpp | 114 + .../src/xercesc/framework/XMLBufferMgr.hpp | 212 + .../src/xercesc/framework/XMLContentModel.cpp | 38 + .../src/xercesc/framework/XMLContentModel.hpp | 145 + .../xercesc/framework/XMLDTDDescription.cpp | 54 + .../xercesc/framework/XMLDTDDescription.hpp | 103 + .../xercesc/framework/XMLDocumentHandler.hpp | 283 + .../src/xercesc/framework/XMLElementDecl.cpp | 170 + .../src/xercesc/framework/XMLElementDecl.hpp | 552 + .../src/xercesc/framework/XMLEntityDecl.cpp | 200 + .../src/xercesc/framework/XMLEntityDecl.hpp | 512 + .../xercesc/framework/XMLEntityHandler.hpp | 157 + .../src/xercesc/framework/XMLErrorCodes.hpp | 351 + .../xercesc/framework/XMLErrorReporter.hpp | 162 + .../src/xercesc/framework/XMLFormatter.cpp | 705 ++ .../src/xercesc/framework/XMLFormatter.hpp | 538 + .../framework/XMLGrammarDescription.cpp | 51 + .../framework/XMLGrammarDescription.hpp | 105 + .../src/xercesc/framework/XMLGrammarPool.hpp | 322 + .../xercesc/framework/XMLGrammarPoolImpl.cpp | 364 + .../xercesc/framework/XMLGrammarPoolImpl.hpp | 279 + .../src/xercesc/framework/XMLNotationDecl.cpp | 140 + .../src/xercesc/framework/XMLNotationDecl.hpp | 231 + .../src/xercesc/framework/XMLPScanToken.hpp | 151 + .../src/xercesc/framework/XMLRecognizer.cpp | 270 + .../src/xercesc/framework/XMLRecognizer.hpp | 138 + .../src/xercesc/framework/XMLRefInfo.cpp | 60 + .../src/xercesc/framework/XMLRefInfo.hpp | 181 + .../framework/XMLSchemaDescription.cpp | 53 + .../framework/XMLSchemaDescription.hpp | 178 + .../src/xercesc/framework/XMLValidator.cpp | 296 + .../src/xercesc/framework/XMLValidator.hpp | 426 + .../xercesc/framework/XMLValidityCodes.hpp | 147 + .../xercesc/framework/psvi/PSVIAttribute.cpp | 71 + .../xercesc/framework/psvi/PSVIAttribute.hpp | 179 + .../framework/psvi/PSVIAttributeList.cpp | 110 + .../framework/psvi/PSVIAttributeList.hpp | 215 + .../xercesc/framework/psvi/PSVIElement.cpp | 93 + .../xercesc/framework/psvi/PSVIElement.hpp | 174 + .../xercesc/framework/psvi/PSVIHandler.hpp | 148 + .../src/xercesc/framework/psvi/PSVIItem.cpp | 145 + .../src/xercesc/framework/psvi/PSVIItem.hpp | 309 + .../xercesc/framework/psvi/XSAnnotation.cpp | 190 + .../xercesc/framework/psvi/XSAnnotation.hpp | 195 + .../framework/psvi/XSAttributeDeclaration.cpp | 112 + .../framework/psvi/XSAttributeDeclaration.hpp | 210 + .../psvi/XSAttributeGroupDefinition.cpp | 76 + .../psvi/XSAttributeGroupDefinition.hpp | 167 + .../xercesc/framework/psvi/XSAttributeUse.cpp | 61 + .../xercesc/framework/psvi/XSAttributeUse.hpp | 156 + .../psvi/XSComplexTypeDefinition.cpp | 207 + .../psvi/XSComplexTypeDefinition.hpp | 294 + .../xercesc/framework/psvi/XSConstants.hpp | 196 + .../framework/psvi/XSElementDeclaration.cpp | 163 + .../framework/psvi/XSElementDeclaration.hpp | 307 + .../src/xercesc/framework/psvi/XSFacet.cpp | 49 + .../src/xercesc/framework/psvi/XSFacet.hpp | 151 + .../framework/psvi/XSIDCDefinition.cpp | 122 + .../framework/psvi/XSIDCDefinition.hpp | 190 + .../src/xercesc/framework/psvi/XSModel.cpp | 799 ++ .../src/xercesc/framework/psvi/XSModel.hpp | 338 + .../xercesc/framework/psvi/XSModelGroup.cpp | 50 + .../xercesc/framework/psvi/XSModelGroup.hpp | 156 + .../framework/psvi/XSModelGroupDefinition.cpp | 83 + .../framework/psvi/XSModelGroupDefinition.hpp | 150 + .../framework/psvi/XSMultiValueFacet.cpp | 64 + .../framework/psvi/XSMultiValueFacet.hpp | 152 + .../src/xercesc/framework/psvi/XSNamedMap.c | 124 + .../src/xercesc/framework/psvi/XSNamedMap.hpp | 138 + .../framework/psvi/XSNamespaceItem.cpp | 218 + .../framework/psvi/XSNamespaceItem.hpp | 245 + .../framework/psvi/XSNotationDeclaration.cpp | 83 + .../framework/psvi/XSNotationDeclaration.hpp | 154 + .../src/xercesc/framework/psvi/XSObject.cpp | 76 + .../src/xercesc/framework/psvi/XSObject.hpp | 152 + .../src/xercesc/framework/psvi/XSParticle.cpp | 81 + .../src/xercesc/framework/psvi/XSParticle.hpp | 198 + .../framework/psvi/XSSimpleTypeDefinition.cpp | 249 + .../framework/psvi/XSSimpleTypeDefinition.hpp | 458 + .../framework/psvi/XSTypeDefinition.cpp | 74 + .../framework/psvi/XSTypeDefinition.hpp | 214 + .../src/xercesc/framework/psvi/XSValue.cpp | 1689 +++ .../src/xercesc/framework/psvi/XSValue.hpp | 406 + .../src/xercesc/framework/psvi/XSWildcard.cpp | 181 + .../src/xercesc/framework/psvi/XSWildcard.hpp | 201 + .../xercesc/internal/BinFileOutputStream.cpp | 95 + .../xercesc/internal/BinFileOutputStream.hpp | 100 + .../xercesc/internal/BinMemOutputStream.cpp | 120 + .../xercesc/internal/BinMemOutputStream.hpp | 103 + .../src/xercesc/internal/CharTypeTables.hpp | 255 + .../src/xercesc/internal/DGXMLScanner.cpp | 3572 +++++++ .../src/xercesc/internal/DGXMLScanner.hpp | 192 + .../xerces/src/xercesc/internal/ElemStack.cpp | 891 ++ .../xerces/src/xercesc/internal/ElemStack.hpp | 592 ++ .../xercesc/internal/EndOfEntityException.hpp | 116 + .../src/xercesc/internal/IANAEncodings.hpp | 834 ++ .../src/xercesc/internal/IGXMLScanner.cpp | 3267 ++++++ .../src/xercesc/internal/IGXMLScanner.hpp | 308 + .../src/xercesc/internal/IGXMLScanner2.cpp | 3454 ++++++ .../xercesc/internal/MemoryManagerImpl.cpp | 57 + .../xercesc/internal/MemoryManagerImpl.hpp | 106 + .../xerces/src/xercesc/internal/ReaderMgr.cpp | 1120 ++ .../xerces/src/xercesc/internal/ReaderMgr.hpp | 447 + .../src/xercesc/internal/SGXMLScanner.cpp | 4932 +++++++++ .../src/xercesc/internal/SGXMLScanner.hpp | 307 + .../internal/ValidationContextImpl.cpp | 217 + .../internal/ValidationContextImpl.hpp | 173 + .../src/xercesc/internal/VecAttrListImpl.cpp | 159 + .../src/xercesc/internal/VecAttrListImpl.hpp | 96 + .../xercesc/internal/VecAttributesImpl.cpp | 249 + .../xercesc/internal/VecAttributesImpl.hpp | 117 + .../src/xercesc/internal/WFXMLScanner.cpp | 2055 ++++ .../src/xercesc/internal/WFXMLScanner.hpp | 153 + .../internal/XMLInternalErrorHandler.hpp | 139 + .../xerces/src/xercesc/internal/XMLReader.cpp | 1895 ++++ .../xerces/src/xercesc/internal/XMLReader.hpp | 790 ++ .../src/xercesc/internal/XMLScanner.cpp | 2398 +++++ .../src/xercesc/internal/XMLScanner.hpp | 1432 +++ .../xercesc/internal/XMLScannerResolver.cpp | 88 + .../xercesc/internal/XMLScannerResolver.hpp | 79 + .../src/xercesc/internal/XProtoType.cpp | 108 + .../src/xercesc/internal/XProtoType.hpp | 93 + .../src/xercesc/internal/XSAXMLScanner.cpp | 725 ++ .../src/xercesc/internal/XSAXMLScanner.hpp | 98 + .../src/xercesc/internal/XSObjectFactory.cpp | 1056 ++ .../src/xercesc/internal/XSObjectFactory.hpp | 237 + .../src/xercesc/internal/XSerializable.hpp | 117 + .../internal/XSerializationException.hpp | 34 + .../src/xercesc/internal/XSerializeEngine.cpp | 1158 ++ .../src/xercesc/internal/XSerializeEngine.hpp | 841 ++ .../xercesc/internal/XTemplateSerializer.cpp | 2322 ++++ .../xercesc/internal/XTemplateSerializer.hpp | 365 + .../src/xercesc/parsers/AbstractDOMParser.cpp | 1784 ++++ .../src/xercesc/parsers/AbstractDOMParser.hpp | 1900 ++++ .../src/xercesc/parsers/DOMLSParserImpl.cpp | 1379 +++ .../src/xercesc/parsers/DOMLSParserImpl.hpp | 715 ++ .../src/xercesc/parsers/SAX2XMLFilterImpl.cpp | 416 + .../src/xercesc/parsers/SAX2XMLFilterImpl.hpp | 1445 +++ .../src/xercesc/parsers/SAX2XMLReaderImpl.cpp | 1625 +++ .../src/xercesc/parsers/SAX2XMLReaderImpl.hpp | 1749 +++ .../xerces/src/xercesc/parsers/SAXParser.cpp | 1351 +++ .../xerces/src/xercesc/parsers/SAXParser.hpp | 2204 ++++ .../src/xercesc/parsers/XercesDOMParser.cpp | 349 + .../src/xercesc/parsers/XercesDOMParser.hpp | 696 ++ .../xerces/src/xercesc/sax/AttributeList.hpp | 229 + .../jni/xerces/src/xercesc/sax/DTDHandler.hpp | 159 + .../src/xercesc/sax/DocumentHandler.hpp | 283 + project/jni/xerces/src/xercesc/sax/Dummy.cpp | 36 + .../xerces/src/xercesc/sax/EntityResolver.hpp | 165 + .../xerces/src/xercesc/sax/ErrorHandler.hpp | 168 + .../xerces/src/xercesc/sax/HandlerBase.hpp | 466 + .../xerces/src/xercesc/sax/InputSource.cpp | 133 + .../xerces/src/xercesc/sax/InputSource.hpp | 337 + .../jni/xerces/src/xercesc/sax/Locator.hpp | 125 + project/jni/xerces/src/xercesc/sax/Parser.hpp | 245 + .../xerces/src/xercesc/sax/SAXException.cpp | 74 + .../xerces/src/xercesc/sax/SAXException.hpp | 230 + .../src/xercesc/sax/SAXParseException.cpp | 125 + .../src/xercesc/sax/SAXParseException.hpp | 185 + .../xerces/src/xercesc/sax2/Attributes.hpp | 313 + .../src/xercesc/sax2/ContentHandler.hpp | 340 + .../xerces/src/xercesc/sax2/DeclHandler.hpp | 163 + .../src/xercesc/sax2/DefaultHandler.hpp | 806 ++ .../src/xercesc/sax2/LexicalHandler.hpp | 172 + .../xerces/src/xercesc/sax2/SAX2XMLFilter.hpp | 82 + .../xerces/src/xercesc/sax2/SAX2XMLReader.hpp | 893 ++ .../src/xercesc/sax2/XMLReaderFactory.hpp | 71 + .../jni/xerces/src/xercesc/sax2/sax2Dummy.cpp | 30 + .../util/ArrayIndexOutOfBoundsException.hpp | 33 + .../jni/xerces/src/xercesc/util/Base64.cpp | 636 ++ .../jni/xerces/src/xercesc/util/Base64.hpp | 266 + .../xerces/src/xercesc/util/BaseRefVectorOf.c | 344 + .../src/xercesc/util/BaseRefVectorOf.hpp | 158 + .../src/xercesc/util/BinFileInputStream.cpp | 110 + .../src/xercesc/util/BinFileInputStream.hpp | 107 + .../src/xercesc/util/BinInputStream.cpp | 45 + .../src/xercesc/util/BinInputStream.hpp | 87 + .../src/xercesc/util/BinMemInputStream.cpp | 98 + .../src/xercesc/util/BinMemInputStream.hpp | 134 + .../jni/xerces/src/xercesc/util/BitOps.hpp | 67 + .../jni/xerces/src/xercesc/util/BitSet.cpp | 270 + .../jni/xerces/src/xercesc/util/BitSet.hpp | 107 + .../xerces/src/xercesc/util/CountedPointer.c | 107 + .../src/xercesc/util/CountedPointer.hpp | 69 + .../src/xercesc/util/DefaultPanicHandler.cpp | 40 + .../src/xercesc/util/DefaultPanicHandler.hpp | 80 + .../src/xercesc/util/EmptyStackException.hpp | 34 + .../src/xercesc/util/EncodingValidator.cpp | 96 + .../src/xercesc/util/EncodingValidator.hpp | 85 + .../util/FileManagers/PosixFileMgr.cpp | 229 + .../util/FileManagers/PosixFileMgr.hpp | 60 + .../jni/xerces/src/xercesc/util/FlagJanitor.c | 62 + .../xerces/src/xercesc/util/FlagJanitor.hpp | 73 + .../xerces/src/xercesc/util/Hash2KeysSetOf.c | 591 + .../src/xercesc/util/Hash2KeysSetOf.hpp | 223 + .../jni/xerces/src/xercesc/util/Hashers.hpp | 95 + .../xerces/src/xercesc/util/HeaderDummy.cpp | 40 + .../jni/xerces/src/xercesc/util/HexBin.cpp | 138 + .../jni/xerces/src/xercesc/util/HexBin.hpp | 128 + .../xerces/src/xercesc/util/IOException.hpp | 34 + .../xercesc/util/IllegalArgumentException.hpp | 34 + .../src/xercesc/util/InvalidCastException.hpp | 34 + project/jni/xerces/src/xercesc/util/Janitor.c | 248 + .../jni/xerces/src/xercesc/util/Janitor.hpp | 166 + .../xerces/src/xercesc/util/KVStringPair.cpp | 126 + .../xerces/src/xercesc/util/KVStringPair.hpp | 223 + .../jni/xerces/src/xercesc/util/KeyRefPair.c | 113 + .../xerces/src/xercesc/util/KeyRefPair.hpp | 81 + .../xerces/src/xercesc/util/KeyValuePair.c | 104 + .../xerces/src/xercesc/util/KeyValuePair.hpp | 81 + .../jni/xerces/src/xercesc/util/LogicalPath.c | 275 + .../MsgLoaders/InMemory/InMemMsgLoader.cpp | 177 + .../MsgLoaders/InMemory/InMemMsgLoader.hpp | 101 + .../InMemory/XercesMessages_en_US.hpp | 1501 +++ .../util/MutexManagers/NoThreadMutexMgr.cpp | 69 + .../util/MutexManagers/NoThreadMutexMgr.hpp | 51 + .../util/MutexManagers/PosixMutexMgr.cpp | 113 + .../util/MutexManagers/PosixMutexMgr.hpp | 47 + .../jni/xerces/src/xercesc/util/Mutexes.cpp | 87 + .../jni/xerces/src/xercesc/util/Mutexes.hpp | 108 + .../jni/xerces/src/xercesc/util/NameIdPool.c | 284 + .../xerces/src/xercesc/util/NameIdPool.hpp | 207 + .../NetAccessors/BinHTTPInputStreamCommon.cpp | 296 + .../NetAccessors/BinHTTPInputStreamCommon.hpp | 228 + .../xercesc/util/NoSuchElementException.hpp | 34 + .../src/xercesc/util/NullPointerException.hpp | 35 + .../xercesc/util/NumberFormatException.hpp | 34 + .../src/xercesc/util/OutOfMemoryException.hpp | 96 + .../jni/xerces/src/xercesc/util/PSVIUni.cpp | 971 ++ .../jni/xerces/src/xercesc/util/PSVIUni.hpp | 239 + .../xerces/src/xercesc/util/PanicHandler.cpp | 70 + .../xerces/src/xercesc/util/PanicHandler.hpp | 112 + .../src/xercesc/util/ParseException.hpp | 34 + .../xerces/src/xercesc/util/PlatformUtils.cpp | 1092 ++ .../xerces/src/xercesc/util/PlatformUtils.hpp | 839 ++ project/jni/xerces/src/xercesc/util/QName.cpp | 426 + project/jni/xerces/src/xercesc/util/QName.hpp | 217 + .../jni/xerces/src/xercesc/util/RefArrayOf.c | 269 + .../xerces/src/xercesc/util/RefArrayOf.hpp | 150 + .../src/xercesc/util/RefArrayVectorOf.c | 122 + .../src/xercesc/util/RefArrayVectorOf.hpp | 70 + .../src/xercesc/util/RefHash2KeysTableOf.c | 692 ++ .../src/xercesc/util/RefHash2KeysTableOf.hpp | 258 + .../src/xercesc/util/RefHash3KeysIdPool.c | 572 + .../src/xercesc/util/RefHash3KeysIdPool.hpp | 279 + .../xerces/src/xercesc/util/RefHashTableOf.c | 663 ++ .../src/xercesc/util/RefHashTableOf.hpp | 255 + .../jni/xerces/src/xercesc/util/RefStackOf.c | 160 + .../xerces/src/xercesc/util/RefStackOf.hpp | 152 + .../jni/xerces/src/xercesc/util/RefVectorOf.c | 54 + .../xerces/src/xercesc/util/RefVectorOf.hpp | 62 + .../src/xercesc/util/RuntimeException.hpp | 35 + .../xercesc/util/SchemaDateTimeException.hpp | 35 + .../src/xercesc/util/SecurityManager.hpp | 116 + .../xerces/src/xercesc/util/StringPool.cpp | 191 + .../xerces/src/xercesc/util/StringPool.hpp | 175 + .../xercesc/util/SynchronizedStringPool.cpp | 129 + .../xercesc/util/SynchronizedStringPool.hpp | 86 + .../xerces/src/xercesc/util/TransENameMap.c | 81 + .../xerces/src/xercesc/util/TransENameMap.hpp | 166 + .../xerces/src/xercesc/util/TransService.cpp | 736 ++ .../xerces/src/xercesc/util/TransService.hpp | 708 ++ .../IconvGNU/IconvGNUTransService.cpp | 1140 ++ .../IconvGNU/IconvGNUTransService.hpp | 359 + .../src/xercesc/util/TranscodingException.hpp | 34 + .../xercesc/util/UTFDataFormatException.hpp | 35 + .../xercesc/util/UnexpectedEOFException.hpp | 34 + .../util/UnsupportedEncodingException.hpp | 34 + .../xerces/src/xercesc/util/ValueArrayOf.c | 252 + .../xerces/src/xercesc/util/ValueArrayOf.hpp | 150 + .../src/xercesc/util/ValueHashTableOf.c | 489 + .../src/xercesc/util/ValueHashTableOf.hpp | 229 + .../xerces/src/xercesc/util/ValueStackOf.c | 146 + .../xerces/src/xercesc/util/ValueStackOf.hpp | 155 + .../xerces/src/xercesc/util/ValueVectorOf.c | 295 + .../xerces/src/xercesc/util/ValueVectorOf.hpp | 162 + .../xercesc/util/XML256TableTranscoder.cpp | 218 + .../xercesc/util/XML256TableTranscoder.hpp | 146 + .../src/xercesc/util/XML88591Transcoder.cpp | 146 + .../src/xercesc/util/XML88591Transcoder.hpp | 93 + .../src/xercesc/util/XMLASCIITranscoder.cpp | 172 + .../src/xercesc/util/XMLASCIITranscoder.hpp | 93 + .../xercesc/util/XMLAbstractDoubleFloat.cpp | 693 ++ .../xercesc/util/XMLAbstractDoubleFloat.hpp | 221 + .../xerces/src/xercesc/util/XMLBigDecimal.cpp | 519 + .../xerces/src/xercesc/util/XMLBigDecimal.hpp | 206 + .../xerces/src/xercesc/util/XMLBigInteger.cpp | 402 + .../xerces/src/xercesc/util/XMLBigInteger.hpp | 175 + .../src/xercesc/util/XMLChTranscoder.cpp | 117 + .../src/xercesc/util/XMLChTranscoder.hpp | 90 + .../jni/xerces/src/xercesc/util/XMLChar.cpp | 9104 ++++++++++++++++ .../jni/xerces/src/xercesc/util/XMLChar.hpp | 442 + .../jni/xerces/src/xercesc/util/XMLDOMMsg.hpp | 104 + .../xerces/src/xercesc/util/XMLDateTime.cpp | 1901 ++++ .../xerces/src/xercesc/util/XMLDateTime.hpp | 366 + .../jni/xerces/src/xercesc/util/XMLDouble.cpp | 70 + .../jni/xerces/src/xercesc/util/XMLDouble.hpp | 99 + .../src/xercesc/util/XMLEBCDICTranscoder.cpp | 205 + .../src/xercesc/util/XMLEBCDICTranscoder.hpp | 73 + .../src/xercesc/util/XMLEntityResolver.hpp | 178 + .../xerces/src/xercesc/util/XMLEnumerator.hpp | 56 + .../xerces/src/xercesc/util/XMLExceptMsgs.hpp | 398 + .../xerces/src/xercesc/util/XMLException.cpp | 255 + .../xerces/src/xercesc/util/XMLException.hpp | 276 + .../xerces/src/xercesc/util/XMLFileMgr.hpp | 63 + .../jni/xerces/src/xercesc/util/XMLFloat.cpp | 100 + .../jni/xerces/src/xercesc/util/XMLFloat.hpp | 97 + .../src/xercesc/util/XMLIBM1047Transcoder.cpp | 205 + .../src/xercesc/util/XMLIBM1047Transcoder.hpp | 72 + .../src/xercesc/util/XMLIBM1140Transcoder.cpp | 206 + .../src/xercesc/util/XMLIBM1140Transcoder.hpp | 71 + .../src/xercesc/util/XMLInitializer.cpp | 122 + .../src/xercesc/util/XMLInitializer.hpp | 157 + .../xerces/src/xercesc/util/XMLInteger.hpp | 82 + .../xerces/src/xercesc/util/XMLMsgLoader.cpp | 104 + .../xerces/src/xercesc/util/XMLMsgLoader.hpp | 182 + .../xerces/src/xercesc/util/XMLMutexMgr.hpp | 50 + .../src/xercesc/util/XMLNetAccessor.hpp | 139 + .../jni/xerces/src/xercesc/util/XMLNumber.cpp | 93 + .../jni/xerces/src/xercesc/util/XMLNumber.hpp | 102 + .../xercesc/util/XMLResourceIdentifier.hpp | 214 + .../jni/xerces/src/xercesc/util/XMLString.cpp | 1992 ++++ .../jni/xerces/src/xercesc/util/XMLString.hpp | 1620 +++ .../src/xercesc/util/XMLStringTokenizer.cpp | 177 + .../src/xercesc/util/XMLStringTokenizer.hpp | 218 + .../src/xercesc/util/XMLUCS4Transcoder.cpp | 240 + .../src/xercesc/util/XMLUCS4Transcoder.hpp | 104 + .../jni/xerces/src/xercesc/util/XMLURL.cpp | 1490 +++ .../jni/xerces/src/xercesc/util/XMLURL.hpp | 292 + .../src/xercesc/util/XMLUTF16Transcoder.cpp | 197 + .../src/xercesc/util/XMLUTF16Transcoder.hpp | 105 + .../src/xercesc/util/XMLUTF8Transcoder.cpp | 556 + .../src/xercesc/util/XMLUTF8Transcoder.hpp | 118 + .../jni/xerces/src/xercesc/util/XMLUni.cpp | 1875 ++++ .../jni/xerces/src/xercesc/util/XMLUni.hpp | 332 + .../xerces/src/xercesc/util/XMLUniDefs.hpp | 154 + .../jni/xerces/src/xercesc/util/XMLUri.cpp | 2589 +++++ .../jni/xerces/src/xercesc/util/XMLUri.hpp | 663 ++ .../src/xercesc/util/XMLWin1252Transcoder.cpp | 197 + .../src/xercesc/util/XMLWin1252Transcoder.hpp | 63 + .../jni/xerces/src/xercesc/util/XMemory.cpp | 124 + .../jni/xerces/src/xercesc/util/XMemory.hpp | 144 + .../xerces/src/xercesc/util/XercesDefs.hpp | 173 + .../xerces/src/xercesc/util/XercesVersion.hpp | 219 + .../util/Xerces_autoconf_config.borland.hpp | 125 + .../xercesc/util/Xerces_autoconf_config.hpp | 139 + .../util/Xerces_autoconf_config.hpp.in | 138 + .../util/Xerces_autoconf_config.msvc.hpp | 148 + .../xercesc/util/regx/ASCIIRangeFactory.cpp | 160 + .../xercesc/util/regx/ASCIIRangeFactory.hpp | 66 + .../src/xercesc/util/regx/BMPattern.cpp | 214 + .../src/xercesc/util/regx/BMPattern.hpp | 157 + .../xercesc/util/regx/BlockRangeFactory.cpp | 369 + .../xercesc/util/regx/BlockRangeFactory.hpp | 66 + .../src/xercesc/util/regx/CharToken.cpp | 48 + .../src/xercesc/util/regx/CharToken.hpp | 88 + .../src/xercesc/util/regx/ClosureToken.cpp | 50 + .../src/xercesc/util/regx/ClosureToken.hpp | 114 + .../src/xercesc/util/regx/ConcatToken.cpp | 49 + .../src/xercesc/util/regx/ConcatToken.hpp | 81 + .../xerces/src/xercesc/util/regx/Match.cpp | 120 + .../xerces/src/xercesc/util/regx/Match.hpp | 163 + .../jni/xerces/src/xercesc/util/regx/Op.cpp | 216 + .../jni/xerces/src/xercesc/util/regx/Op.hpp | 306 + .../src/xercesc/util/regx/OpFactory.cpp | 143 + .../src/xercesc/util/regx/OpFactory.hpp | 116 + .../src/xercesc/util/regx/ParenToken.cpp | 50 + .../src/xercesc/util/regx/ParenToken.hpp | 87 + .../xercesc/util/regx/ParserForXMLSchema.cpp | 171 + .../xercesc/util/regx/ParserForXMLSchema.hpp | 86 + .../src/xercesc/util/regx/RangeFactory.cpp | 47 + .../src/xercesc/util/regx/RangeFactory.hpp | 89 + .../src/xercesc/util/regx/RangeToken.cpp | 874 ++ .../src/xercesc/util/regx/RangeToken.hpp | 146 + .../src/xercesc/util/regx/RangeTokenMap.cpp | 289 + .../src/xercesc/util/regx/RangeTokenMap.hpp | 232 + .../xercesc/util/regx/RegularExpression.cpp | 1645 +++ .../xercesc/util/regx/RegularExpression.hpp | 772 ++ .../xerces/src/xercesc/util/regx/RegxDefs.hpp | 239 + .../src/xercesc/util/regx/RegxParser.cpp | 868 ++ .../src/xercesc/util/regx/RegxParser.hpp | 284 + .../xerces/src/xercesc/util/regx/RegxUtil.cpp | 103 + .../xerces/src/xercesc/util/regx/RegxUtil.hpp | 109 + .../src/xercesc/util/regx/StringToken.cpp | 54 + .../src/xercesc/util/regx/StringToken.hpp | 100 + .../xerces/src/xercesc/util/regx/Token.cpp | 369 + .../xerces/src/xercesc/util/regx/Token.hpp | 262 + .../src/xercesc/util/regx/TokenFactory.cpp | 234 + .../src/xercesc/util/regx/TokenFactory.hpp | 134 + .../xerces/src/xercesc/util/regx/TokenInc.hpp | 43 + .../src/xercesc/util/regx/UniCharTable.hpp | 4131 +++++++ .../xercesc/util/regx/UnicodeRangeFactory.cpp | 278 + .../xercesc/util/regx/UnicodeRangeFactory.hpp | 88 + .../src/xercesc/util/regx/UnionToken.cpp | 149 + .../src/xercesc/util/regx/UnionToken.hpp | 91 + .../src/xercesc/util/regx/XMLRangeFactory.cpp | 254 + .../src/xercesc/util/regx/XMLRangeFactory.hpp | 66 + .../src/xercesc/util/regx/XMLUniCharacter.cpp | 57 + .../src/xercesc/util/regx/XMLUniCharacter.hpp | 101 + project/jni/xerces/src/xercesc/util/stamp-h2 | 1 + .../src/xercesc/validators/DTD/DTDAttDef.cpp | 106 + .../src/xercesc/validators/DTD/DTDAttDef.hpp | 141 + .../xercesc/validators/DTD/DTDAttDefList.cpp | 188 + .../xercesc/validators/DTD/DTDAttDefList.hpp | 161 + .../xercesc/validators/DTD/DTDElementDecl.cpp | 437 + .../xercesc/validators/DTD/DTDElementDecl.hpp | 247 + .../xercesc/validators/DTD/DTDEntityDecl.cpp | 54 + .../xercesc/validators/DTD/DTDEntityDecl.hpp | 204 + .../src/xercesc/validators/DTD/DTDGrammar.cpp | 263 + .../src/xercesc/validators/DTD/DTDGrammar.hpp | 391 + .../src/xercesc/validators/DTD/DTDScanner.cpp | 3886 +++++++ .../src/xercesc/validators/DTD/DTDScanner.hpp | 277 + .../xercesc/validators/DTD/DTDValidator.cpp | 657 ++ .../xercesc/validators/DTD/DTDValidator.hpp | 158 + .../xercesc/validators/DTD/DocTypeHandler.hpp | 145 + .../validators/DTD/XMLDTDDescriptionImpl.cpp | 133 + .../validators/DTD/XMLDTDDescriptionImpl.hpp | 108 + .../validators/common/AllContentModel.cpp | 378 + .../validators/common/AllContentModel.hpp | 177 + .../src/xercesc/validators/common/CMAny.cpp | 110 + .../src/xercesc/validators/common/CMAny.hpp | 99 + .../xercesc/validators/common/CMBinaryOp.cpp | 150 + .../xercesc/validators/common/CMBinaryOp.hpp | 92 + .../src/xercesc/validators/common/CMLeaf.hpp | 253 + .../src/xercesc/validators/common/CMNode.hpp | 193 + .../validators/common/CMRepeatingLeaf.hpp | 136 + .../xercesc/validators/common/CMStateSet.hpp | 627 ++ .../xercesc/validators/common/CMUnaryOp.cpp | 99 + .../xercesc/validators/common/CMUnaryOp.hpp | 88 + .../common/ContentLeafNameTypeVector.cpp | 132 + .../common/ContentLeafNameTypeVector.hpp | 119 + .../validators/common/ContentSpecNode.cpp | 323 + .../validators/common/ContentSpecNode.hpp | 467 + .../validators/common/DFAContentModel.cpp | 1685 +++ .../validators/common/DFAContentModel.hpp | 274 + .../src/xercesc/validators/common/Grammar.cpp | 84 + .../src/xercesc/validators/common/Grammar.hpp | 204 + .../validators/common/GrammarResolver.cpp | 445 + .../validators/common/GrammarResolver.hpp | 271 + .../validators/common/MixedContentModel.cpp | 429 + .../validators/common/MixedContentModel.hpp | 212 + .../validators/common/SimpleContentModel.cpp | 534 + .../validators/common/SimpleContentModel.hpp | 212 + .../AbstractNumericFacetValidator.cpp | 972 ++ .../AbstractNumericFacetValidator.hpp | 201 + .../datatype/AbstractNumericValidator.cpp | 181 + .../datatype/AbstractNumericValidator.hpp | 109 + .../datatype/AbstractStringValidator.cpp | 770 ++ .../datatype/AbstractStringValidator.hpp | 250 + .../AnySimpleTypeDatatypeValidator.cpp | 98 + .../AnySimpleTypeDatatypeValidator.hpp | 180 + .../datatype/AnyURIDatatypeValidator.cpp | 199 + .../datatype/AnyURIDatatypeValidator.hpp | 95 + .../Base64BinaryDatatypeValidator.cpp | 124 + .../Base64BinaryDatatypeValidator.hpp | 100 + .../datatype/BooleanDatatypeValidator.cpp | 212 + .../datatype/BooleanDatatypeValidator.hpp | 193 + .../validators/datatype/DatatypeValidator.cpp | 546 + .../validators/datatype/DatatypeValidator.hpp | 750 ++ .../datatype/DatatypeValidatorFactory.cpp | 900 ++ .../datatype/DatatypeValidatorFactory.hpp | 285 + .../datatype/DateDatatypeValidator.cpp | 140 + .../datatype/DateDatatypeValidator.hpp | 101 + .../datatype/DateTimeDatatypeValidator.cpp | 140 + .../datatype/DateTimeDatatypeValidator.hpp | 102 + .../validators/datatype/DateTimeValidator.cpp | 303 + .../validators/datatype/DateTimeValidator.hpp | 126 + .../datatype/DayDatatypeValidator.cpp | 107 + .../datatype/DayDatatypeValidator.hpp | 95 + .../datatype/DecimalDatatypeValidator.cpp | 615 ++ .../datatype/DecimalDatatypeValidator.hpp | 218 + .../datatype/DoubleDatatypeValidator.cpp | 256 + .../datatype/DoubleDatatypeValidator.hpp | 146 + .../datatype/DurationDatatypeValidator.cpp | 114 + .../datatype/DurationDatatypeValidator.hpp | 98 + .../datatype/ENTITYDatatypeValidator.cpp | 125 + .../datatype/ENTITYDatatypeValidator.hpp | 144 + .../datatype/FloatDatatypeValidator.cpp | 255 + .../datatype/FloatDatatypeValidator.hpp | 145 + .../datatype/HexBinaryDatatypeValidator.cpp | 101 + .../datatype/HexBinaryDatatypeValidator.hpp | 101 + .../datatype/IDDatatypeValidator.cpp | 123 + .../datatype/IDDatatypeValidator.hpp | 132 + .../datatype/IDREFDatatypeValidator.cpp | 125 + .../datatype/IDREFDatatypeValidator.hpp | 135 + .../InvalidDatatypeFacetException.hpp | 34 + .../InvalidDatatypeValueException.hpp | 34 + .../datatype/ListDatatypeValidator.cpp | 459 + .../datatype/ListDatatypeValidator.hpp | 226 + .../datatype/MonthDatatypeValidator.cpp | 108 + .../datatype/MonthDatatypeValidator.hpp | 95 + .../datatype/MonthDayDatatypeValidator.cpp | 108 + .../datatype/MonthDayDatatypeValidator.hpp | 95 + .../datatype/NCNameDatatypeValidator.cpp | 128 + .../datatype/NCNameDatatypeValidator.hpp | 152 + .../datatype/NOTATIONDatatypeValidator.cpp | 154 + .../datatype/NOTATIONDatatypeValidator.hpp | 103 + .../datatype/NameDatatypeValidator.cpp | 128 + .../datatype/NameDatatypeValidator.hpp | 151 + .../datatype/QNameDatatypeValidator.cpp | 272 + .../datatype/QNameDatatypeValidator.hpp | 106 + .../datatype/StringDatatypeValidator.cpp | 204 + .../datatype/StringDatatypeValidator.hpp | 114 + .../datatype/TimeDatatypeValidator.cpp | 140 + .../datatype/TimeDatatypeValidator.hpp | 104 + .../datatype/UnionDatatypeValidator.cpp | 465 + .../datatype/UnionDatatypeValidator.hpp | 320 + .../validators/datatype/XMLCanRepGroup.cpp | 44 + .../validators/datatype/XMLCanRepGroup.hpp | 75 + .../datatype/YearDatatypeValidator.cpp | 107 + .../datatype/YearDatatypeValidator.hpp | 95 + .../datatype/YearMonthDatatypeValidator.cpp | 108 + .../datatype/YearMonthDatatypeValidator.hpp | 95 + .../validators/schema/ComplexTypeInfo.cpp | 911 ++ .../validators/schema/ComplexTypeInfo.hpp | 531 + .../schema/GeneralAttributeCheck.cpp | 798 ++ .../schema/GeneralAttributeCheck.hpp | 258 + .../validators/schema/NamespaceScope.cpp | 317 + .../validators/schema/NamespaceScope.hpp | 169 + .../xercesc/validators/schema/PSVIDefs.hpp | 40 + .../validators/schema/SchemaAttDef.cpp | 178 + .../validators/schema/SchemaAttDef.hpp | 252 + .../validators/schema/SchemaAttDefList.cpp | 201 + .../validators/schema/SchemaAttDefList.hpp | 181 + .../validators/schema/SchemaElementDecl.cpp | 277 + .../validators/schema/SchemaElementDecl.hpp | 438 + .../validators/schema/SchemaGrammar.cpp | 369 + .../validators/schema/SchemaGrammar.hpp | 638 ++ .../xercesc/validators/schema/SchemaInfo.cpp | 251 + .../xercesc/validators/schema/SchemaInfo.hpp | 432 + .../validators/schema/SchemaSymbols.cpp | 1022 ++ .../validators/schema/SchemaSymbols.hpp | 254 + .../validators/schema/SchemaValidator.cpp | 2094 ++++ .../validators/schema/SchemaValidator.hpp | 443 + .../schema/SubstitutionGroupComparator.cpp | 210 + .../schema/SubstitutionGroupComparator.hpp | 126 + .../validators/schema/TraverseSchema.cpp | 9459 +++++++++++++++++ .../validators/schema/TraverseSchema.hpp | 925 ++ .../schema/XMLSchemaDescriptionImpl.cpp | 235 + .../schema/XMLSchemaDescriptionImpl.hpp | 185 + .../validators/schema/XSDDOMParser.cpp | 524 + .../validators/schema/XSDDOMParser.hpp | 322 + .../validators/schema/XSDErrorReporter.cpp | 179 + .../validators/schema/XSDErrorReporter.hpp | 115 + .../xercesc/validators/schema/XSDLocator.cpp | 57 + .../xercesc/validators/schema/XSDLocator.hpp | 141 + .../src/xercesc/validators/schema/XUtil.cpp | 125 + .../src/xercesc/validators/schema/XUtil.hpp | 71 + .../validators/schema/XercesAttGroupInfo.cpp | 182 + .../validators/schema/XercesAttGroupInfo.hpp | 257 + .../schema/XercesElementWildcard.cpp | 120 + .../schema/XercesElementWildcard.hpp | 81 + .../validators/schema/XercesGroupInfo.cpp | 141 + .../validators/schema/XercesGroupInfo.hpp | 204 + .../schema/identity/FieldActivator.cpp | 124 + .../schema/identity/FieldActivator.hpp | 141 + .../schema/identity/FieldValueMap.cpp | 127 + .../schema/identity/FieldValueMap.hpp | 198 + .../validators/schema/identity/IC_Field.cpp | 141 + .../validators/schema/identity/IC_Field.hpp | 152 + .../validators/schema/identity/IC_Key.cpp | 67 + .../validators/schema/identity/IC_Key.hpp | 80 + .../validators/schema/identity/IC_KeyRef.cpp | 79 + .../validators/schema/identity/IC_KeyRef.hpp | 92 + .../schema/identity/IC_Selector.cpp | 178 + .../schema/identity/IC_Selector.hpp | 155 + .../validators/schema/identity/IC_Unique.cpp | 68 + .../validators/schema/identity/IC_Unique.hpp | 84 + .../schema/identity/IdentityConstraint.cpp | 226 + .../schema/identity/IdentityConstraint.hpp | 223 + .../identity/IdentityConstraintHandler.cpp | 215 + .../identity/IdentityConstraintHandler.hpp | 159 + .../validators/schema/identity/ValueStore.cpp | 352 + .../validators/schema/identity/ValueStore.hpp | 146 + .../schema/identity/ValueStoreCache.cpp | 184 + .../schema/identity/ValueStoreCache.hpp | 172 + .../schema/identity/XPathException.hpp | 34 + .../schema/identity/XPathMatcher.cpp | 413 + .../schema/identity/XPathMatcher.hpp | 182 + .../schema/identity/XPathMatcherStack.cpp | 86 + .../schema/identity/XPathMatcherStack.hpp | 139 + .../schema/identity/XPathSymbols.cpp | 161 + .../schema/identity/XPathSymbols.hpp | 75 + .../schema/identity/XercesXPath.cpp | 1460 +++ .../schema/identity/XercesXPath.hpp | 499 + .../xinclude/XIncludeDOMDocumentProcessor.cpp | 80 + .../xinclude/XIncludeDOMDocumentProcessor.hpp | 58 + .../src/xercesc/xinclude/XIncludeLocation.cpp | 141 + .../src/xercesc/xinclude/XIncludeLocation.hpp | 89 + .../src/xercesc/xinclude/XIncludeUtils.cpp | 838 ++ .../src/xercesc/xinclude/XIncludeUtils.hpp | 267 + project/jni/xerces/version.incl | 22 + 861 files changed, 283907 insertions(+), 2 deletions(-) create mode 100644 project/jni/lua/Android.mk create mode 100644 project/jni/lua/COPYRIGHT create mode 100644 project/jni/lua/HISTORY create mode 100644 project/jni/lua/INSTALL create mode 100644 project/jni/lua/Makefile create mode 100644 project/jni/lua/README create mode 100644 project/jni/lua/src/lapi.c create mode 100644 project/jni/lua/src/lapi.h create mode 100644 project/jni/lua/src/lauxlib.c create mode 100644 project/jni/lua/src/lauxlib.h create mode 100644 project/jni/lua/src/lbaselib.c create mode 100644 project/jni/lua/src/lcode.c create mode 100644 project/jni/lua/src/lcode.h create mode 100644 project/jni/lua/src/ldblib.c create mode 100644 project/jni/lua/src/ldebug.c create mode 100644 project/jni/lua/src/ldebug.h create mode 100644 project/jni/lua/src/ldo.c create mode 100644 project/jni/lua/src/ldo.h create mode 100644 project/jni/lua/src/ldump.c create mode 100644 project/jni/lua/src/lfunc.c create mode 100644 project/jni/lua/src/lfunc.h create mode 100644 project/jni/lua/src/lgc.c create mode 100644 project/jni/lua/src/lgc.h create mode 100644 project/jni/lua/src/linit.c create mode 100644 project/jni/lua/src/liolib.c create mode 100644 project/jni/lua/src/llex.c create mode 100644 project/jni/lua/src/llex.h create mode 100644 project/jni/lua/src/llimits.h create mode 100644 project/jni/lua/src/lmathlib.c create mode 100644 project/jni/lua/src/lmem.c create mode 100644 project/jni/lua/src/lmem.h create mode 100644 project/jni/lua/src/loadlib.c create mode 100644 project/jni/lua/src/lobject.c create mode 100644 project/jni/lua/src/lobject.h create mode 100644 project/jni/lua/src/lopcodes.c create mode 100644 project/jni/lua/src/lopcodes.h create mode 100644 project/jni/lua/src/loslib.c create mode 100644 project/jni/lua/src/lparser.c create mode 100644 project/jni/lua/src/lparser.h create mode 100644 project/jni/lua/src/lstate.c create mode 100644 project/jni/lua/src/lstate.h create mode 100644 project/jni/lua/src/lstring.c create mode 100644 project/jni/lua/src/lstring.h create mode 100644 project/jni/lua/src/lstrlib.c create mode 100644 project/jni/lua/src/ltable.c create mode 100644 project/jni/lua/src/ltable.h create mode 100644 project/jni/lua/src/ltablib.c create mode 100644 project/jni/lua/src/ltm.c create mode 100644 project/jni/lua/src/ltm.h create mode 100644 project/jni/lua/src/lua.h create mode 100644 project/jni/lua/src/luaconf.h create mode 100644 project/jni/lua/src/lualib.h create mode 100644 project/jni/lua/src/lundump.c create mode 100644 project/jni/lua/src/lundump.h create mode 100644 project/jni/lua/src/lvm.c create mode 100644 project/jni/lua/src/lvm.h create mode 100644 project/jni/lua/src/lzio.c create mode 100644 project/jni/lua/src/lzio.h create mode 100644 project/jni/lua/src/print.c create mode 100644 project/jni/lua/src/tolua++.h create mode 100644 project/jni/lua/src/tolua_event.c create mode 100644 project/jni/lua/src/tolua_event.h create mode 100644 project/jni/lua/src/tolua_is.c create mode 100644 project/jni/lua/src/tolua_map.c create mode 100644 project/jni/lua/src/tolua_push.c create mode 100644 project/jni/lua/src/tolua_to.c create mode 100644 project/jni/xerces/Android.mk create mode 100644 project/jni/xerces/CREDITS create mode 100644 project/jni/xerces/INSTALL create mode 100644 project/jni/xerces/KEYS create mode 100644 project/jni/xerces/LICENSE create mode 100644 project/jni/xerces/NOTICE create mode 100644 project/jni/xerces/README create mode 100644 project/jni/xerces/config.h create mode 100644 project/jni/xerces/config.h.in create mode 100644 project/jni/xerces/config.h.old create mode 100644 project/jni/xerces/iconv/iconv.h create mode 100644 project/jni/xerces/src/Makefile create mode 100644 project/jni/xerces/src/Makefile.am create mode 100644 project/jni/xerces/src/Makefile.in create mode 100644 project/jni/xerces/src/stricmp.c create mode 100644 project/jni/xerces/src/stricmp.h create mode 100644 project/jni/xerces/src/strnicmp.c create mode 100644 project/jni/xerces/src/strnicmp.h create mode 100644 project/jni/xerces/src/towlower.c create mode 100644 project/jni/xerces/src/towlower.h create mode 100644 project/jni/xerces/src/towupper.c create mode 100644 project/jni/xerces/src/towupper.h create mode 100644 project/jni/xerces/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml create mode 100644 project/jni/xerces/src/xercesc/NLS/XMLErrList.dtd create mode 100644 project/jni/xerces/src/xercesc/dom/DOM.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMAttr.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMCDATASection.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMCharacterData.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMComment.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMConfiguration.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMDocument.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMDocumentFragment.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMDocumentRange.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMDocumentTraversal.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMDocumentType.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMElement.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMEntity.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMEntityReference.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMError.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMErrorHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMException.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMException.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMImplementation.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMImplementationLS.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMImplementationList.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMImplementationRegistry.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMImplementationSource.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSException.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSException.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSInput.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSOutput.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSParser.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSParserFilter.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSResourceResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSSerializer.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLSSerializerFilter.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMLocator.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMMemoryManager.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNamedNodeMap.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNode.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNodeFilter.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNodeIterator.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNodeList.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMNotation.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMPSVITypeInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMProcessingInstruction.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMRange.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMRangeException.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMRangeException.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMStringList.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMText.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMTreeWalker.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMTypeInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMUserDataHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathEvaluator.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathException.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathException.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathExpression.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathNSResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathNamespace.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/DOMXPathResult.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/StDOMNode.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCasts.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.c create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMImplementationRegistry.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeIDMap.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeIDMap.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeVector.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNodeVector.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/BinOutputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/BinOutputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/LocalFileInputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/LocalFileInputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/MemBufInputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/MemBufInputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/MemoryManager.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/StdInInputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/StdInInputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/URLInputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/URLInputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/ValidationContext.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttDef.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttDef.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttDefList.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttDefList.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttr.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLAttr.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLBuffer.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLBuffer.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLBufferMgr.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLBufferMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLContentModel.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLContentModel.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLDTDDescription.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLDTDDescription.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLDocumentHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLElementDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLElementDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLEntityDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLEntityDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLEntityHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLErrorCodes.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLErrorReporter.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLFormatter.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLFormatter.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLGrammarPool.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLNotationDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLNotationDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLPScanToken.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLRecognizer.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLRecognizer.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLRefInfo.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLRefInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/XMLValidityCodes.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSConstants.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSFacet.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSFacet.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModel.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModel.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.c create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSObject.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSObject.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSParticle.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSParticle.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSValue.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSValue.hpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.cpp create mode 100644 project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/BinFileOutputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/BinFileOutputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/BinMemOutputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/BinMemOutputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/CharTypeTables.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/DGXMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/DGXMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/ElemStack.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/ElemStack.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/EndOfEntityException.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/IANAEncodings.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/IGXMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/IGXMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/IGXMLScanner2.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/ReaderMgr.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/ReaderMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/SGXMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/SGXMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/ValidationContextImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/ValidationContextImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/VecAttrListImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/VecAttrListImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/VecAttributesImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/VecAttributesImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/WFXMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/WFXMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLInternalErrorHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLReader.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLReader.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLScannerResolver.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XMLScannerResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XProtoType.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XProtoType.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSAXMLScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSAXMLScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSObjectFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSObjectFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSerializable.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSerializationException.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSerializeEngine.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XSerializeEngine.hpp create mode 100644 project/jni/xerces/src/xercesc/internal/XTemplateSerializer.cpp create mode 100644 project/jni/xerces/src/xercesc/internal/XTemplateSerializer.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAXParser.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/SAXParser.hpp create mode 100644 project/jni/xerces/src/xercesc/parsers/XercesDOMParser.cpp create mode 100644 project/jni/xerces/src/xercesc/parsers/XercesDOMParser.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/AttributeList.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/DTDHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/DocumentHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/Dummy.cpp create mode 100644 project/jni/xerces/src/xercesc/sax/EntityResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/ErrorHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/HandlerBase.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/InputSource.cpp create mode 100644 project/jni/xerces/src/xercesc/sax/InputSource.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/Locator.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/Parser.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/SAXException.cpp create mode 100644 project/jni/xerces/src/xercesc/sax/SAXException.hpp create mode 100644 project/jni/xerces/src/xercesc/sax/SAXParseException.cpp create mode 100644 project/jni/xerces/src/xercesc/sax/SAXParseException.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/Attributes.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/ContentHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/DeclHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/DefaultHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/LexicalHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/SAX2XMLFilter.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/SAX2XMLReader.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/XMLReaderFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/sax2/sax2Dummy.cpp create mode 100644 project/jni/xerces/src/xercesc/util/ArrayIndexOutOfBoundsException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Base64.cpp create mode 100644 project/jni/xerces/src/xercesc/util/Base64.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BaseRefVectorOf.c create mode 100644 project/jni/xerces/src/xercesc/util/BaseRefVectorOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BinFileInputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/util/BinFileInputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BinInputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/util/BinInputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BinMemInputStream.cpp create mode 100644 project/jni/xerces/src/xercesc/util/BinMemInputStream.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BitOps.hpp create mode 100644 project/jni/xerces/src/xercesc/util/BitSet.cpp create mode 100644 project/jni/xerces/src/xercesc/util/BitSet.hpp create mode 100644 project/jni/xerces/src/xercesc/util/CountedPointer.c create mode 100644 project/jni/xerces/src/xercesc/util/CountedPointer.hpp create mode 100644 project/jni/xerces/src/xercesc/util/DefaultPanicHandler.cpp create mode 100644 project/jni/xerces/src/xercesc/util/DefaultPanicHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/util/EmptyStackException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/EncodingValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/util/EncodingValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.cpp create mode 100644 project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/util/FlagJanitor.c create mode 100644 project/jni/xerces/src/xercesc/util/FlagJanitor.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.c create mode 100644 project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Hashers.hpp create mode 100644 project/jni/xerces/src/xercesc/util/HeaderDummy.cpp create mode 100644 project/jni/xerces/src/xercesc/util/HexBin.cpp create mode 100644 project/jni/xerces/src/xercesc/util/HexBin.hpp create mode 100644 project/jni/xerces/src/xercesc/util/IOException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/IllegalArgumentException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/InvalidCastException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Janitor.c create mode 100644 project/jni/xerces/src/xercesc/util/Janitor.hpp create mode 100644 project/jni/xerces/src/xercesc/util/KVStringPair.cpp create mode 100644 project/jni/xerces/src/xercesc/util/KVStringPair.hpp create mode 100644 project/jni/xerces/src/xercesc/util/KeyRefPair.c create mode 100644 project/jni/xerces/src/xercesc/util/KeyRefPair.hpp create mode 100644 project/jni/xerces/src/xercesc/util/KeyValuePair.c create mode 100644 project/jni/xerces/src/xercesc/util/KeyValuePair.hpp create mode 100644 project/jni/xerces/src/xercesc/util/LogicalPath.c create mode 100644 project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp create mode 100644 project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp create mode 100644 project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp create mode 100644 project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.cpp create mode 100644 project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp create mode 100644 project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Mutexes.cpp create mode 100644 project/jni/xerces/src/xercesc/util/Mutexes.hpp create mode 100644 project/jni/xerces/src/xercesc/util/NameIdPool.c create mode 100644 project/jni/xerces/src/xercesc/util/NameIdPool.hpp create mode 100644 project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp create mode 100644 project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp create mode 100644 project/jni/xerces/src/xercesc/util/NoSuchElementException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/NullPointerException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/NumberFormatException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/OutOfMemoryException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/PSVIUni.cpp create mode 100644 project/jni/xerces/src/xercesc/util/PSVIUni.hpp create mode 100644 project/jni/xerces/src/xercesc/util/PanicHandler.cpp create mode 100644 project/jni/xerces/src/xercesc/util/PanicHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/util/ParseException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/PlatformUtils.cpp create mode 100644 project/jni/xerces/src/xercesc/util/PlatformUtils.hpp create mode 100644 project/jni/xerces/src/xercesc/util/QName.cpp create mode 100644 project/jni/xerces/src/xercesc/util/QName.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefArrayOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefArrayOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefArrayVectorOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefArrayVectorOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.c create mode 100644 project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefHashTableOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefHashTableOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefStackOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefStackOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RefVectorOf.c create mode 100644 project/jni/xerces/src/xercesc/util/RefVectorOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/RuntimeException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/SchemaDateTimeException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/SecurityManager.hpp create mode 100644 project/jni/xerces/src/xercesc/util/StringPool.cpp create mode 100644 project/jni/xerces/src/xercesc/util/StringPool.hpp create mode 100644 project/jni/xerces/src/xercesc/util/SynchronizedStringPool.cpp create mode 100644 project/jni/xerces/src/xercesc/util/SynchronizedStringPool.hpp create mode 100644 project/jni/xerces/src/xercesc/util/TransENameMap.c create mode 100644 project/jni/xerces/src/xercesc/util/TransENameMap.hpp create mode 100644 project/jni/xerces/src/xercesc/util/TransService.cpp create mode 100644 project/jni/xerces/src/xercesc/util/TransService.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp create mode 100644 project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp create mode 100644 project/jni/xerces/src/xercesc/util/TranscodingException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/UTFDataFormatException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/UnexpectedEOFException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/UnsupportedEncodingException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/ValueArrayOf.c create mode 100644 project/jni/xerces/src/xercesc/util/ValueArrayOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/ValueHashTableOf.c create mode 100644 project/jni/xerces/src/xercesc/util/ValueHashTableOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/ValueStackOf.c create mode 100644 project/jni/xerces/src/xercesc/util/ValueStackOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/ValueVectorOf.c create mode 100644 project/jni/xerces/src/xercesc/util/ValueVectorOf.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XML256TableTranscoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XML256TableTranscoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XML88591Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XML88591Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLBigDecimal.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLBigDecimal.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLBigInteger.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLBigInteger.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLChTranscoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLChTranscoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLChar.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLChar.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLDOMMsg.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLDateTime.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLDateTime.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLDouble.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLDouble.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLEntityResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLEnumerator.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLExceptMsgs.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLException.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLException.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLFileMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLFloat.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLFloat.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLInitializer.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLInitializer.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLInteger.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLMsgLoader.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLMsgLoader.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLMutexMgr.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLNetAccessor.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLNumber.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLNumber.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLResourceIdentifier.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLString.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLString.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLStringTokenizer.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLStringTokenizer.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLURL.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLURL.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUni.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUni.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUniDefs.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUri.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLUri.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XMemory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/XMemory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XercesDefs.hpp create mode 100644 project/jni/xerces/src/xercesc/util/XercesVersion.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.borland.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp create mode 100644 project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp.in create mode 100644 project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.msvc.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/BMPattern.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/BMPattern.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/CharToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/CharToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ClosureToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ClosureToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ConcatToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ConcatToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Match.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Match.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Op.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Op.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/OpFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/OpFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ParenToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ParenToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegularExpression.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegularExpression.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegxDefs.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegxParser.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegxParser.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegxUtil.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/RegxUtil.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/StringToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/StringToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Token.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/Token.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/TokenFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/TokenFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/TokenInc.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/UniCharTable.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/UnionToken.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/UnionToken.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.cpp create mode 100644 project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.hpp create mode 100644 project/jni/xerces/src/xercesc/util/stamp-h2 create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/DocTypeHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/AllContentModel.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/AllContentModel.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMAny.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMAny.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMLeaf.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMNode.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMRepeatingLeaf.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMStateSet.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/DFAContentModel.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/DFAContentModel.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/Grammar.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/Grammar.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/GrammarResolver.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/GrammarResolver.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/MixedContentModel.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/MixedContentModel.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeFacetException.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeValueException.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/PSVIDefs.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDLocator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XSDLocator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XUtil.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XUtil.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathException.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.hpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.cpp create mode 100644 project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.hpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.cpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.hpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.cpp create mode 100644 project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.hpp create mode 100644 project/jni/xerces/version.incl diff --git a/project/jni/Application.mk b/project/jni/Application.mk index f947b8721..9bcb5b1d2 100644 --- a/project/jni/Application.mk +++ b/project/jni/Application.mk @@ -1,10 +1,11 @@ APP_PROJECT_PATH := $(call my-dir)/.. -# Available libraries: mad sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx intl xml2 +# Available libraries: mad sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx intl xml2 lua +# Available static libraries (specified in AppLdflags as "-ljpeg"): jpeg png tremor freetype xerces # sdl_mixer depends on tremor and optionally mad # sdl_image depends on png and jpeg # sdl_ttf depends on freetype -APP_MODULES := application sdl-1.3 sdl_main stlport tremor png jpeg freetype sdl_mixer sdl_image +APP_MODULES := application sdl-1.2 sdl_main stlport tremor png jpeg freetype xerces sdl_mixer sdl_image sdl_ttf intl lua APP_ABI := armeabi diff --git a/project/jni/lua/Android.mk b/project/jni/lua/Android.mk new file mode 100644 index 000000000..c6304576a --- /dev/null +++ b/project/jni/lua/Android.mk @@ -0,0 +1,20 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := lua + +LOCAL_CFLAGS := -I$(LOCAL_PATH)/src + +LOCAL_CPP_EXTENSION := .cpp + +LOCAL_SRC_FILES := $(addprefix src/, $(notdir $(wildcard $(LOCAL_PATH)/src/*.c) $(wildcard $(LOCAL_PATH)/src/*.cpp))) + +LOCAL_STATIC_LIBRARIES := + +LOCAL_SHARED_LIBRARIES := + +LOCAL_LDLIBS := + +include $(BUILD_SHARED_LIBRARY) + diff --git a/project/jni/lua/COPYRIGHT b/project/jni/lua/COPYRIGHT new file mode 100644 index 000000000..3a53e741e --- /dev/null +++ b/project/jni/lua/COPYRIGHT @@ -0,0 +1,34 @@ +Lua License +----------- + +Lua is licensed under the terms of the MIT license reproduced below. +This means that Lua is free software and can be used for both academic +and commercial purposes at absolutely no cost. + +For details and rationale, see http://www.lua.org/license.html . + +=============================================================================== + +Copyright (C) 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +=============================================================================== + +(end of COPYRIGHT) diff --git a/project/jni/lua/HISTORY b/project/jni/lua/HISTORY new file mode 100644 index 000000000..ce0c95bc6 --- /dev/null +++ b/project/jni/lua/HISTORY @@ -0,0 +1,183 @@ +HISTORY for Lua 5.1 + +* Changes from version 5.0 to 5.1 + ------------------------------- + Language: + + new module system. + + new semantics for control variables of fors. + + new semantics for setn/getn. + + new syntax/semantics for varargs. + + new long strings and comments. + + new `mod' operator (`%') + + new length operator #t + + metatables for all types + API: + + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. + + user supplies memory allocator (lua_open becomes lua_newstate). + + luaopen_* functions must be called through Lua. + Implementation: + + new configuration scheme via luaconf.h. + + incremental garbage collection. + + better handling of end-of-line in the lexer. + + fully reentrant parser (new Lua function `load') + + better support for 64-bit machines. + + native loadlib support for Mac OS X. + + standard distribution in only one library (lualib.a merged into lua.a) + +* Changes from version 4.0 to 5.0 + ------------------------------- + Language: + + lexical scoping. + + Lua coroutines. + + standard libraries now packaged in tables. + + tags replaced by metatables and tag methods replaced by metamethods, + stored in metatables. + + proper tail calls. + + each function can have its own global table, which can be shared. + + new __newindex metamethod, called when we insert a new key into a table. + + new block comments: --[[ ... ]]. + + new generic for. + + new weak tables. + + new boolean type. + + new syntax "local function". + + (f()) returns the first value returned by f. + + {f()} fills a table with all values returned by f. + + \n ignored in [[\n . + + fixed and-or priorities. + + more general syntax for function definition (e.g. function a.x.y:f()...end). + + more general syntax for function calls (e.g. (print or write)(9)). + + new functions (time/date, tmpfile, unpack, require, load*, etc.). + API: + + chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer. + + introduced lightweight userdata, a simple "void*" without a metatable. + + new error handling protocol: the core no longer prints error messages; + all errors are reported to the caller on the stack. + + new lua_atpanic for host cleanup. + + new, signal-safe, hook scheme. + Implementation: + + new license: MIT. + + new, faster, register-based virtual machine. + + support for external multithreading and coroutines. + + new and consistent error message format. + + the core no longer needs "stdio.h" for anything (except for a single + use of sprintf to convert numbers to strings). + + lua.c now runs the environment variable LUA_INIT, if present. It can + be "@filename", to run a file, or the chunk itself. + + support for user extensions in lua.c. + sample implementation given for command line editing. + + new dynamic loading library, active by default on several platforms. + + safe garbage-collector metamethods. + + precompiled bytecodes checked for integrity (secure binary dostring). + + strings are fully aligned. + + position capture in string.find. + + read('*l') can read lines with embedded zeros. + +* Changes from version 3.2 to 4.0 + ------------------------------- + Language: + + new "break" and "for" statements (both numerical and for tables). + + uniform treatment of globals: globals are now stored in a Lua table. + + improved error messages. + + no more '$debug': full speed *and* full debug information. + + new read form: read(N) for next N bytes. + + general read patterns now deprecated. + (still available with -DCOMPAT_READPATTERNS.) + + all return values are passed as arguments for the last function + (old semantics still available with -DLUA_COMPAT_ARGRET) + + garbage collection tag methods for tables now deprecated. + + there is now only one tag method for order. + API: + + New API: fully re-entrant, simpler, and more efficient. + + New debug API. + Implementation: + + faster than ever: cleaner virtual machine and new hashing algorithm. + + non-recursive garbage-collector algorithm. + + reduced memory usage for programs with many strings. + + improved treatment for memory allocation errors. + + improved support for 16-bit machines (we hope). + + code now compiles unmodified as both ANSI C and C++. + + numbers in bases other than 10 are converted using strtoul. + + new -f option in Lua to support #! scripts. + + luac can now combine text and binaries. + +* Changes from version 3.1 to 3.2 + ------------------------------- + + redirected all output in Lua's core to _ERRORMESSAGE and _ALERT. + + increased limit on the number of constants and globals per function + (from 2^16 to 2^24). + + debugging info (lua_debug and hooks) moved into lua_state and new API + functions provided to get and set this info. + + new debug lib gives full debugging access within Lua. + + new table functions "foreachi", "sort", "tinsert", "tremove", "getn". + + new io functions "flush", "seek". + +* Changes from version 3.0 to 3.1 + ------------------------------- + + NEW FEATURE: anonymous functions with closures (via "upvalues"). + + new syntax: + - local variables in chunks. + - better scope control with DO block END. + - constructors can now be also written: { record-part; list-part }. + - more general syntax for function calls and lvalues, e.g.: + f(x).y=1 + o:f(x,y):g(z) + f"string" is sugar for f("string") + + strings may now contain arbitrary binary data (e.g., embedded zeros). + + major code re-organization and clean-up; reduced module interdependecies. + + no arbitrary limits on the total number of constants and globals. + + support for multiple global contexts. + + better syntax error messages. + + new traversal functions "foreach" and "foreachvar". + + the default for numbers is now double. + changing it to use floats or longs is easy. + + complete debug information stored in pre-compiled chunks. + + sample interpreter now prompts user when run interactively, and also + handles control-C interruptions gracefully. + +* Changes from version 2.5 to 3.0 + ------------------------------- + + NEW CONCEPT: "tag methods". + Tag methods replace fallbacks as the meta-mechanism for extending the + semantics of Lua. Whereas fallbacks had a global nature, tag methods + work on objects having the same tag (e.g., groups of tables). + Existing code that uses fallbacks should work without change. + + new, general syntax for constructors {[exp] = exp, ... }. + + support for handling variable number of arguments in functions (varargs). + + support for conditional compilation ($if ... $else ... $end). + + cleaner semantics in API simplifies host code. + + better support for writing libraries (auxlib.h). + + better type checking and error messages in the standard library. + + luac can now also undump. + +* Changes from version 2.4 to 2.5 + ------------------------------- + + io and string libraries are now based on pattern matching; + the old libraries are still available for compatibility + + dofile and dostring can now return values (via return statement) + + better support for 16- and 64-bit machines + + expanded documentation, with more examples + +* Changes from version 2.2 to 2.4 + ------------------------------- + + external compiler creates portable binary files that can be loaded faster + + interface for debugging and profiling + + new "getglobal" fallback + + new functions for handling references to Lua objects + + new functions in standard lib + + only one copy of each string is stored + + expanded documentation, with more examples + +* Changes from version 2.1 to 2.2 + ------------------------------- + + functions now may be declared with any "lvalue" as a name + + garbage collection of functions + + support for pipes + +* Changes from version 1.1 to 2.1 + ------------------------------- + + object-oriented support + + fallbacks + + simplified syntax for tables + + many internal improvements + +(end of HISTORY) diff --git a/project/jni/lua/INSTALL b/project/jni/lua/INSTALL new file mode 100644 index 000000000..17eb8aee8 --- /dev/null +++ b/project/jni/lua/INSTALL @@ -0,0 +1,99 @@ +INSTALL for Lua 5.1 + +* Building Lua + ------------ + Lua is built in the src directory, but the build process can be + controlled from the top-level Makefile. + + Building Lua on Unix systems should be very easy. First do "make" and + see if your platform is listed. If so, just do "make xxx", where xxx + is your platform name. The platforms currently supported are: + aix ansi bsd freebsd generic linux macosx mingw posix solaris + + If your platform is not listed, try the closest one or posix, generic, + ansi, in this order. + + See below for customization instructions and for instructions on how + to build with other Windows compilers. + + If you want to check that Lua has been built correctly, do "make test" + after building Lua. Also, have a look at the example programs in test. + +* Installing Lua + -------------- + Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in Makefile. You must + have the right permissions to install files. + + If you want to build and install Lua in one step, do "make xxx install", + where xxx is your platform name. + + If you want to install Lua locally, then do "make local". This will + create directories bin, include, lib, man, and install Lua there as + follows: + + bin: lua luac + include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp + lib: liblua.a + man/man1: lua.1 luac.1 + + These are the only directories you need for development. + + There are man pages for lua and luac, in both nroff and html, and a + reference manual in html in doc, some sample code in test, and some + useful stuff in etc. You don't need these directories for development. + + If you want to install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + + See below for instructions for Windows and other systems. + +* Customization + ------------- + Three things can be customized by editing a file: + - Where and how to install Lua -- edit Makefile. + - How to build Lua -- edit src/Makefile. + - Lua features -- edit src/luaconf.h. + + You don't actually need to edit the Makefiles because you may set the + relevant variables when invoking make. + + On the other hand, if you need to select some Lua features, you'll need + to edit src/luaconf.h. The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + + We strongly recommend that you enable dynamic loading. This is done + automatically for all platforms listed above that have this feature + (and also Windows). See src/luaconf.h and also src/Makefile. + +* Building Lua on Windows and other systems + ----------------------------------------- + If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + + library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c + lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c + ltable.c ltm.c lundump.c lvm.c lzio.c + lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c + ltablib.c lstrlib.c loadlib.c linit.c + + interpreter: library, lua.c + + compiler: library, luac.c print.c + + If you use Visual Studio .NET, you can use etc/luavs.bat in its + "Command Prompt". + + If all you want is to build the Lua interpreter, you may put all .c files + in a single project, except for luac.c and print.c. Or just use etc/all.c. + + To use Lua as a library in your own programs, you'll need to know how to + create and use libraries with your compiler. + + As mentioned above, you may edit luaconf.h to select some features before + building Lua. + +(end of INSTALL) diff --git a/project/jni/lua/Makefile b/project/jni/lua/Makefile new file mode 100644 index 000000000..6e78f66fa --- /dev/null +++ b/project/jni/lua/Makefile @@ -0,0 +1,128 @@ +# makefile for installing Lua +# see INSTALL for installation instructions +# see src/Makefile and src/luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +# Where to install. The installation starts in the src and doc directories, +# so take care if INSTALL_TOP is not an absolute path. +INSTALL_TOP= /usr/local +INSTALL_BIN= $(INSTALL_TOP)/bin +INSTALL_INC= $(INSTALL_TOP)/include +INSTALL_LIB= $(INSTALL_TOP)/lib +INSTALL_MAN= $(INSTALL_TOP)/man/man1 +# +# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc). +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +# How to install. If your install program does not support "-p", then you +# may have to run ranlib on the installed liblua.a (do "make ranlib"). +INSTALL= install -p +INSTALL_EXEC= $(INSTALL) -m 0755 +INSTALL_DATA= $(INSTALL) -m 0644 +# +# If you don't have install you can use cp instead. +# INSTALL= cp -p +# INSTALL_EXEC= $(INSTALL) +# INSTALL_DATA= $(INSTALL) + +# Utilities. +MKDIR= mkdir -p +RANLIB= ranlib + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +# Convenience platforms targets. +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +# What to install. +TO_BIN= lua luac +TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp +TO_LIB= liblua.a +TO_MAN= lua.1 luac.1 + +# Lua version and release. +V= 5.1 +R= 5.1.4 + +all: $(PLAT) + +$(PLATS) clean: + cd src && $(MAKE) $@ + +test: dummy + src/lua test/hello.lua + +install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) + +ranlib: + cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) + +local: + $(MAKE) install INSTALL_TOP=.. + +none: + @echo "Please do" + @echo " make PLATFORM" + @echo "where PLATFORM is one of these:" + @echo " $(PLATS)" + @echo "See INSTALL for complete instructions." + +# make may get confused with test/ and INSTALL in a case-insensitive OS +dummy: + +# echo config parameters +echo: + @echo "" + @echo "These are the parameters currently set in src/Makefile to build Lua $R:" + @echo "" + @cd src && $(MAKE) -s echo + @echo "" + @echo "These are the parameters currently set in Makefile to install Lua $R:" + @echo "" + @echo "PLAT = $(PLAT)" + @echo "INSTALL_TOP = $(INSTALL_TOP)" + @echo "INSTALL_BIN = $(INSTALL_BIN)" + @echo "INSTALL_INC = $(INSTALL_INC)" + @echo "INSTALL_LIB = $(INSTALL_LIB)" + @echo "INSTALL_MAN = $(INSTALL_MAN)" + @echo "INSTALL_LMOD = $(INSTALL_LMOD)" + @echo "INSTALL_CMOD = $(INSTALL_CMOD)" + @echo "INSTALL_EXEC = $(INSTALL_EXEC)" + @echo "INSTALL_DATA = $(INSTALL_DATA)" + @echo "" + @echo "See also src/luaconf.h ." + @echo "" + +# echo private config parameters +pecho: + @echo "V = $(V)" + @echo "R = $(R)" + @echo "TO_BIN = $(TO_BIN)" + @echo "TO_INC = $(TO_INC)" + @echo "TO_LIB = $(TO_LIB)" + @echo "TO_MAN = $(TO_MAN)" + +# echo config parameters as Lua code +# uncomment the last sed expression if you want nil instead of empty strings +lecho: + @echo "-- installation parameters for Lua $R" + @echo "VERSION = '$V'" + @echo "RELEASE = '$R'" + @$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/' + @echo "-- EOF" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho + +# (end of Makefile) diff --git a/project/jni/lua/README b/project/jni/lua/README new file mode 100644 index 000000000..11b4dff70 --- /dev/null +++ b/project/jni/lua/README @@ -0,0 +1,37 @@ +README for Lua 5.1 + +See INSTALL for installation instructions. +See HISTORY for a summary of changes since the last released version. + +* What is Lua? + ------------ + Lua is a powerful, light-weight programming language designed for extending + applications. Lua is also frequently used as a general-purpose, stand-alone + language. Lua is free software. + + For complete information, visit Lua's web site at http://www.lua.org/ . + For an executive summary, see http://www.lua.org/about.html . + + Lua has been used in many different projects around the world. + For a short list, see http://www.lua.org/uses.html . + +* Availability + ------------ + Lua is freely available for both academic and commercial purposes. + See COPYRIGHT and http://www.lua.org/license.html for details. + Lua can be downloaded at http://www.lua.org/download.html . + +* Installation + ------------ + Lua is implemented in pure ANSI C, and compiles unmodified in all known + platforms that have an ANSI C compiler. In most Unix-like platforms, simply + do "make" with a suitable target. See INSTALL for detailed instructions. + +* Origin + ------ + Lua is developed at Lua.org, a laboratory of the Department of Computer + Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro + in Brazil). + For more information about the authors, see http://www.lua.org/authors.html . + +(end of README) diff --git a/project/jni/lua/src/lapi.c b/project/jni/lua/src/lapi.c new file mode 100644 index 000000000..5d5145d2e --- /dev/null +++ b/project/jni/lua/src/lapi.c @@ -0,0 +1,1087 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + diff --git a/project/jni/lua/src/lapi.h b/project/jni/lua/src/lapi.h new file mode 100644 index 000000000..2c3fab244 --- /dev/null +++ b/project/jni/lua/src/lapi.h @@ -0,0 +1,16 @@ +/* +** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "lobject.h" + + +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); + +#endif diff --git a/project/jni/lua/src/lauxlib.c b/project/jni/lua/src/lauxlib.c new file mode 100644 index 000000000..10f14e2c0 --- /dev/null +++ b/project/jni/lua/src/lauxlib.c @@ -0,0 +1,652 @@ +/* +** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include +#include + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; ifunc, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/project/jni/lua/src/lauxlib.h b/project/jni/lua/src/lauxlib.h new file mode 100644 index 000000000..34258235d --- /dev/null +++ b/project/jni/lua/src/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/project/jni/lua/src/lbaselib.c b/project/jni/lua/src/lbaselib.c new file mode 100644 index 000000000..2a4c079d3 --- /dev/null +++ b/project/jni/lua/src/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include +#include +#include +#include + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/project/jni/lua/src/lcode.c b/project/jni/lua/src/lcode.c new file mode 100644 index 000000000..cff626b7f --- /dev/null +++ b/project/jni/lua/src/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/project/jni/lua/src/lcode.h b/project/jni/lua/src/lcode.h new file mode 100644 index 000000000..b941c6072 --- /dev/null +++ b/project/jni/lua/src/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/project/jni/lua/src/ldblib.c b/project/jni/lua/src/ldblib.c new file mode 100644 index 000000000..67de1222a --- /dev/null +++ b/project/jni/lua/src/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/project/jni/lua/src/ldebug.c b/project/jni/lua/src/ldebug.c new file mode 100644 index 000000000..50ad3d380 --- /dev/null +++ b/project/jni/lua/src/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; il.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/project/jni/lua/src/ldebug.h b/project/jni/lua/src/ldebug.h new file mode 100644 index 000000000..ba28a9724 --- /dev/null +++ b/project/jni/lua/src/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/project/jni/lua/src/ldo.c b/project/jni/lua/src/ldo.c new file mode 100644 index 000000000..8de05f728 --- /dev/null +++ b/project/jni/lua/src/ldo.c @@ -0,0 +1,518 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; itop - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; itop++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/project/jni/lua/src/ldo.h b/project/jni/lua/src/ldo.h new file mode 100644 index 000000000..98fddac59 --- /dev/null +++ b/project/jni/lua/src/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/project/jni/lua/src/ldump.c b/project/jni/lua/src/ldump.c new file mode 100644 index 000000000..c9d3d4870 --- /dev/null +++ b/project/jni/lua/src/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; ik[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; ip[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; ilocvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; iupvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/project/jni/lua/src/lfunc.c b/project/jni/lua/src/lfunc.c new file mode 100644 index 000000000..813e88f58 --- /dev/null +++ b/project/jni/lua/src/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/project/jni/lua/src/lfunc.h b/project/jni/lua/src/lfunc.h new file mode 100644 index 000000000..a68cf5151 --- /dev/null +++ b/project/jni/lua/src/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/project/jni/lua/src/lgc.c b/project/jni/lua/src/lgc.c new file mode 100644 index 000000000..d9e0b7829 --- /dev/null +++ b/project/jni/lua/src/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; isizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; isizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; isizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; isizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; ic.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; il.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; imt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/project/jni/lua/src/lgc.h b/project/jni/lua/src/lgc.h new file mode 100644 index 000000000..5a8dc605b --- /dev/null +++ b/project/jni/lua/src/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/project/jni/lua/src/linit.c b/project/jni/lua/src/linit.c new file mode 100644 index 000000000..c1f90dfab --- /dev/null +++ b/project/jni/lua/src/linit.c @@ -0,0 +1,38 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/project/jni/lua/src/liolib.c b/project/jni/lua/src/liolib.c new file mode 100644 index 000000000..e79ed1cb2 --- /dev/null +++ b/project/jni/lua/src/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/project/jni/lua/src/llex.c b/project/jni/lua/src/llex.c new file mode 100644 index 000000000..9f4f871ce --- /dev/null +++ b/project/jni/lua/src/llex.c @@ -0,0 +1,465 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "", "", "", "", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + char old = ls->decpoint; +#ifdef ANDROID + ls->decpoint = '.'; +#else + struct lconv *cv = localeconv(); + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); +#endif + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/project/jni/lua/src/llex.h b/project/jni/lua/src/llex.h new file mode 100644 index 000000000..a9201cee4 --- /dev/null +++ b/project/jni/lua/src/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/project/jni/lua/src/llimits.h b/project/jni/lua/src/llimits.h new file mode 100644 index 000000000..ca8dcb722 --- /dev/null +++ b/project/jni/lua/src/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/project/jni/lua/src/lmathlib.c b/project/jni/lua/src/lmathlib.c new file mode 100644 index 000000000..441fbf736 --- /dev/null +++ b/project/jni/lua/src/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include +#include + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/project/jni/lua/src/lmem.c b/project/jni/lua/src/lmem.c new file mode 100644 index 000000000..ae7d8c965 --- /dev/null +++ b/project/jni/lua/src/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/project/jni/lua/src/lmem.h b/project/jni/lua/src/lmem.h new file mode 100644 index 000000000..7c2dcb322 --- /dev/null +++ b/project/jni/lua/src/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/project/jni/lua/src/loadlib.c b/project/jni/lua/src/loadlib.c new file mode 100644 index 000000000..0d401eba1 --- /dev/null +++ b/project/jni/lua/src/loadlib.c @@ -0,0 +1,666 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include +#include + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/project/jni/lua/src/lobject.c b/project/jni/lua/src/lobject.c new file mode 100644 index 000000000..4ff50732a --- /dev/null +++ b/project/jni/lua/src/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include +#include + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/project/jni/lua/src/lobject.h b/project/jni/lua/src/lobject.h new file mode 100644 index 000000000..f1e447ef3 --- /dev/null +++ b/project/jni/lua/src/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/project/jni/lua/src/lopcodes.c b/project/jni/lua/src/lopcodes.c new file mode 100644 index 000000000..4cc745230 --- /dev/null +++ b/project/jni/lua/src/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/project/jni/lua/src/lopcodes.h b/project/jni/lua/src/lopcodes.h new file mode 100644 index 000000000..41224d6ee --- /dev/null +++ b/project/jni/lua/src/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)< C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) =) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/project/jni/lua/src/loslib.c b/project/jni/lua/src/loslib.c new file mode 100644 index 000000000..da06a572a --- /dev/null +++ b/project/jni/lua/src/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/project/jni/lua/src/lparser.c b/project/jni/lua/src/lparser.c new file mode 100644 index 000000000..1e2a9a88b --- /dev/null +++ b/project/jni/lua/src/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; inups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; if->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/project/jni/lua/src/lparser.h b/project/jni/lua/src/lparser.h new file mode 100644 index 000000000..18836afd1 --- /dev/null +++ b/project/jni/lua/src/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/project/jni/lua/src/lstate.c b/project/jni/lua/src/lstate.c new file mode 100644 index 000000000..4313b83a0 --- /dev/null +++ b/project/jni/lua/src/lstate.c @@ -0,0 +1,214 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; imt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/project/jni/lua/src/lstate.h b/project/jni/lua/src/lstate.h new file mode 100644 index 000000000..3bc575b6b --- /dev/null +++ b/project/jni/lua/src/lstate.h @@ -0,0 +1,169 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/project/jni/lua/src/lstring.c b/project/jni/lua/src/lstring.c new file mode 100644 index 000000000..49113151c --- /dev/null +++ b/project/jni/lua/src/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; isize; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/project/jni/lua/src/lstring.h b/project/jni/lua/src/lstring.h new file mode 100644 index 000000000..73a2ff8b3 --- /dev/null +++ b/project/jni/lua/src/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/project/jni/lua/src/lstrlib.c b/project/jni/lua/src/lstrlib.c new file mode 100644 index 000000000..1b4763d4e --- /dev/null +++ b/project/jni/lua/src/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (ssrc_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = ssrc_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/project/jni/lua/src/ltable.c b/project/jni/lua/src/ltable.c new file mode 100644 index 000000000..ec84f4fab --- /dev/null +++ b/project/jni/lua/src/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; ilsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/project/jni/lua/src/ltable.h b/project/jni/lua/src/ltable.h new file mode 100644 index 000000000..f5b9d5ead --- /dev/null +++ b/project/jni/lua/src/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/project/jni/lua/src/ltablib.c b/project/jni/lua/src/ltablib.c new file mode 100644 index 000000000..b6d9cb4ac --- /dev/null +++ b/project/jni/lua/src/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/project/jni/lua/src/ltm.h b/project/jni/lua/src/ltm.h new file mode 100644 index 000000000..64343b781 --- /dev/null +++ b/project/jni/lua/src/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/project/jni/lua/src/lua.h b/project/jni/lua/src/lua.h new file mode 100644 index 000000000..e4bdfd3b9 --- /dev/null +++ b/project/jni/lua/src/lua.h @@ -0,0 +1,388 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/project/jni/lua/src/luaconf.h b/project/jni/lua/src/luaconf.h new file mode 100644 index 000000000..0112a07e6 --- /dev/null +++ b/project/jni/lua/src/luaconf.h @@ -0,0 +1,765 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include +#include + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ +#ifdef ANDROID +#define LUA_USE_POSIX 1 +#endif + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include +#include +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/project/jni/lua/src/lualib.h b/project/jni/lua/src/lualib.h new file mode 100644 index 000000000..469417f67 --- /dev/null +++ b/project/jni/lua/src/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/project/jni/lua/src/lundump.c b/project/jni/lua/src/lundump.c new file mode 100644 index 000000000..8010a4579 --- /dev/null +++ b/project/jni/lua/src/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; ik[i]); + for (i=0; ik[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; ip[i]=NULL; + for (i=0; ip[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; + for (i=0; ilocvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; + for (i=0; iupvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/project/jni/lua/src/lundump.h b/project/jni/lua/src/lundump.h new file mode 100644 index 000000000..c80189dbf --- /dev/null +++ b/project/jni/lua/src/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/project/jni/lua/src/lvm.c b/project/jni/lua/src/lvm.c new file mode 100644 index 000000000..ee3256ab9 --- /dev/null +++ b/project/jni/lua/src/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/project/jni/lua/src/lvm.h b/project/jni/lua/src/lvm.h new file mode 100644 index 000000000..bfe4f5678 --- /dev/null +++ b/project/jni/lua/src/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/project/jni/lua/src/lzio.c b/project/jni/lua/src/lzio.c new file mode 100644 index 000000000..293edd59b --- /dev/null +++ b/project/jni/lua/src/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/project/jni/lua/src/lzio.h b/project/jni/lua/src/lzio.h new file mode 100644 index 000000000..51d695d8c --- /dev/null +++ b/project/jni/lua/src/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/project/jni/lua/src/print.c b/project/jni/lua/src/print.c new file mode 100644 index 000000000..e240cfc3c --- /dev/null +++ b/project/jni/lua/src/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; iupvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; ip[i],full); +} diff --git a/project/jni/lua/src/tolua++.h b/project/jni/lua/src/tolua++.h new file mode 100644 index 000000000..ed5344926 --- /dev/null +++ b/project/jni/lua/src/tolua++.h @@ -0,0 +1,186 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + + +#ifndef TOLUA_H +#define TOLUA_H + +#ifndef TOLUA_API +#define TOLUA_API extern +#endif + +#define TOLUA_VERSION "tolua++-1.0.92" + +#ifdef __cplusplus +extern "C" { +#endif + +#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) +#define tolua_iscppstring tolua_isstring + +#define tolua_iscppstringarray tolua_isstringarray +#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) + +#ifndef TEMPLATE_BIND + #define TEMPLATE_BIND(p) +#endif + +#define TOLUA_TEMPLATE_BIND(p) + +#define TOLUA_PROTECTED_DESTRUCTOR +#define TOLUA_PROPERTY_TYPE(p) + +typedef int lua_Object; + +#include "lua.h" +#include "lauxlib.h" + +struct tolua_Error +{ + int index; + int array; + const char* type; +}; +typedef struct tolua_Error tolua_Error; + +#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ + +TOLUA_API const char* tolua_typename (lua_State* L, int lo); +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); + +TOLUA_API void tolua_open (lua_State* L); + +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); +TOLUA_API int tolua_register_gc (lua_State* L, int lo); +TOLUA_API int tolua_default_collect (lua_State* tolua_S); + +TOLUA_API void tolua_usertype (lua_State* L, const char* type); +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); +TOLUA_API void tolua_endmodule (lua_State* L); +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); +TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); +TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); + +/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ +/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo); +TOLUA_API void tolua_pushboolean (lua_State* L, int value); +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); +TOLUA_API void tolua_pushstring (lua_State* L, const char* value); +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); +TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); + +TOLUA_API int class_gc_event (lua_State* L); + +#ifdef __cplusplus +static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { + + const char* s = tolua_tostring(L, narg, def); + return s?s:""; +}; + +static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { + + const char* s = tolua_tofieldstring(L, lo, index, def); + return s?s:""; +}; + +#else +#define tolua_tocppstring tolua_tostring +#define tolua_tofieldcppstring tolua_tofieldstring +#endif + +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); + +#ifndef Mtolua_new +#define Mtolua_new(EXP) new EXP +#endif + +#ifndef Mtolua_delete +#define Mtolua_delete(EXP) delete EXP +#endif + +#ifndef Mtolua_new_dim +#define Mtolua_new_dim(EXP, len) new EXP[len] +#endif + +#ifndef Mtolua_delete_dim +#define Mtolua_delete_dim(EXP) delete [] EXP +#endif + +#ifndef tolua_outside +#define tolua_outside +#endif + +#ifndef tolua_owned +#define tolua_owned +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/jni/lua/src/tolua_event.c b/project/jni/lua/src/tolua_event.c new file mode 100644 index 000000000..8258867b4 --- /dev/null +++ b/project/jni/lua/src/tolua_event.c @@ -0,0 +1,536 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include + +#include "tolua++.h" + +/* Store at ubox + * It stores, creating the corresponding table if needed, + * the pair key/value in the corresponding ubox table +*/ +static void storeatubox (lua_State* L, int lo) +{ + #ifdef LUA_VERSION_NUM + lua_getfenv(L, lo); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_setfenv(L, lo); /* stack: k,v,table */ + }; + lua_insert(L, -3); + lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */ + lua_pop(L, 1); + #else + /* stack: key value (to be stored) */ + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */ + lua_pushvalue(L,lo); + lua_rawget(L,-2); /* stack: k v ubox ubox[u] */ + if (!lua_istable(L,-1)) + { + lua_pop(L,1); /* stack: k v ubox */ + lua_newtable(L); /* stack: k v ubox table */ + lua_pushvalue(L,1); + lua_pushvalue(L,-2); /* stack: k v ubox table u table */ + lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */ + } + lua_insert(L,-4); /* put table before k */ + lua_pop(L,1); /* pop ubox */ + lua_rawset(L,-3); /* store at table */ + lua_pop(L,1); /* pop ubox[u] */ + #endif +} + +/* Module index function +*/ +static int module_index_event (lua_State* L) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-3); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_call(L,0,1); + return 1; + } + else if (lua_istable(L,-1)) + return 1; + } + /* call old index meta event */ + if (lua_getmetatable(L,1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + lua_pushvalue(L,1); + lua_pushvalue(L,2); + if (lua_isfunction(L,-1)) + { + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + lua_gettable(L,-3); + return 1; + } + } + lua_pushnil(L); + return 1; +} + +/* Module newindex function +*/ +static int module_newindex_event (lua_State* L) +{ + lua_pushstring(L,".set"); + lua_rawget(L,-4); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); /* only to be compatible with non-static vars */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + } + /* call old newindex meta event */ + if (lua_getmetatable(L,1) && lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__newindex"); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + } + } + lua_settop(L,3); + lua_rawset(L,-3); + return 0; +} + +/* Class index function + * If the object is a userdata (ie, an object), it searches the field in + * the alternative table stored in the corresponding "ubox" table. +*/ +static int class_index_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Access alternative table */ + #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */ + lua_getfenv(L,1); + if (!lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pushvalue(L, 2); /* key */ + lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */ + if (!lua_isnil(L, -1)) + return 1; + }; + #else + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */ + lua_pushvalue(L,1); + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */ + if (!lua_isnil(L,-1)) + return 1; + } + #endif + lua_settop(L,2); /* stack: obj key */ + /* Try metatables */ + lua_pushvalue(L,1); /* stack: obj key obj */ + while (lua_getmetatable(L,-1)) + { /* stack: obj key obj mt */ + lua_remove(L,-2); /* stack: obj key mt */ + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".geti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + } + else + { + lua_pushvalue(L,2); /* stack: obj key mt key */ + lua_rawget(L,-2); /* stack: obj key mt value */ + if (!lua_isnil(L,-1)) + return 1; + else + lua_pop(L,1); + /* try C/C++ variable */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); /* stack: obj key mt tget */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: obj key mt value */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + /* deal with array: create table to be returned and cache it in ubox */ + void* u = *((void**)lua_touserdata(L,1)); + lua_newtable(L); /* stack: obj key mt value table */ + lua_pushstring(L,".self"); + lua_pushlightuserdata(L,u); + lua_rawset(L,-3); /* store usertype in ".self" */ + lua_insert(L,-2); /* stack: obj key mt table value */ + lua_setmetatable(L,-2); /* set stored value as metatable */ + lua_pushvalue(L,-1); /* stack: obj key met table table */ + lua_pushvalue(L,2); /* stack: obj key mt table table key */ + lua_insert(L,-2); /* stack: obj key mt table key table */ + storeatubox(L,1); /* stack: obj key mt table */ + return 1; + } + } + } + lua_settop(L,3); + } + lua_pushnil(L); + return 1; + } + else if (t== LUA_TTABLE) + { + module_index_event(L); + return 1; + } + lua_pushnil(L); + return 1; +} + +/* Newindex function + * It first searches for a C/C++ varaible to be set. + * Then, it either stores it in the alternative ubox table (in the case it is + * an object) or in the own table (that represents the class or module). +*/ +static int class_newindex_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Try accessing a C/C++ variable to be set */ + lua_getmetatable(L,1); + while (lua_istable(L,-1)) /* stack: t k v mt */ + { + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".seti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + return 0; + } + } + else + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); /* stack: t k v mt tset */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: t k v mt tset func */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,3); + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* stack: t k v mt tset */ + } + lua_pop(L,1); /* stack: t k v mt */ + if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */ + lua_pushnil(L); + lua_remove(L,-2); /* stack: t k v mt */ + } + } + lua_settop(L,3); /* stack: t k v */ + + /* then, store as a new field */ + storeatubox(L,1); + } + else if (t== LUA_TTABLE) + { + module_newindex_event(L); + } + return 0; +} + +static int class_call_event(lua_State* L) { + + if (lua_istable(L, 1)) { + lua_pushstring(L, ".call"); + lua_rawget(L, 1); + if (lua_isfunction(L, -1)) { + + lua_insert(L, 1); + lua_call(L, lua_gettop(L)-1, 1); + + return 1; + }; + }; + tolua_error(L,"Attempt to call a non-callable object.",NULL); + return 0; +}; + +static int do_operator (lua_State* L, const char* op) +{ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,op); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + tolua_error(L,"Attempt to perform operation on an invalid operand",NULL); + return 0; +} + +static int class_add_event (lua_State* L) +{ + return do_operator(L,".add"); +} + +static int class_sub_event (lua_State* L) +{ + return do_operator(L,".sub"); +} + +static int class_mul_event (lua_State* L) +{ + return do_operator(L,".mul"); +} + +static int class_div_event (lua_State* L) +{ + return do_operator(L,".div"); +} + +static int class_lt_event (lua_State* L) +{ + return do_operator(L,".lt"); +} + +static int class_le_event (lua_State* L) +{ + return do_operator(L,".le"); +} + +static int class_eq_event (lua_State* L) +{ + /* copying code from do_operator here to return false when no operator is found */ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,".eq"); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + + lua_settop(L, 3); + lua_pushboolean(L, 0); + return 1; +} + +/* +static int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + fprintf(stderr, "collecting: looking at %p\n", u); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_call(L,1,0); + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-3); + } + lua_pop(L,2); + return 0; +} +*/ +TOLUA_API int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + int top; + /*fprintf(stderr, "collecting: looking at %p\n", u);*/ + /* + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + */ + lua_pushvalue(L, lua_upvalueindex(1)); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); /* stack: gc umt */ + lua_getmetatable(L,1); /* stack: gc umt mt */ + /*fprintf(stderr, "checking type\n");*/ + top = lua_gettop(L); + if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */ + { + /*fprintf(stderr, "Found type!\n");*/ + /* get gc function */ + lua_pushliteral(L,".collector"); + lua_rawget(L,-2); /* stack: gc umt mt collector */ + if (lua_isfunction(L,-1)) { + /*fprintf(stderr, "Found .collector!\n");*/ + } + else { + lua_pop(L,1); + /*fprintf(stderr, "Using default cleanup\n");*/ + lua_pushcfunction(L,tolua_default_collect); + } + + lua_pushvalue(L,1); /* stack: gc umt mt collector u */ + lua_call(L,1,0); + + lua_pushlightuserdata(L,u); /* stack: gc umt mt u */ + lua_pushnil(L); /* stack: gc umt mt u nil */ + lua_rawset(L,-5); /* stack: gc umt mt */ + } + lua_pop(L,3); + return 0; +} + + +/* Register module events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_moduleevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,module_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,module_newindex_event); + lua_rawset(L,-3); +} + +/* Check if the object on the top has a module metatable +*/ +TOLUA_API int tolua_ismodulemetatable (lua_State* L) +{ + int r = 0; + if (lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + r = (lua_tocfunction(L,-1) == module_index_event); + lua_pop(L,2); + } + return r; +} + +/* Register class events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_classevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,class_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,class_newindex_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__add"); + lua_pushcfunction(L,class_add_event); + lua_rawset(L,-3); + lua_pushstring(L,"__sub"); + lua_pushcfunction(L,class_sub_event); + lua_rawset(L,-3); + lua_pushstring(L,"__mul"); + lua_pushcfunction(L,class_mul_event); + lua_rawset(L,-3); + lua_pushstring(L,"__div"); + lua_pushcfunction(L,class_div_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__lt"); + lua_pushcfunction(L,class_lt_event); + lua_rawset(L,-3); + lua_pushstring(L,"__le"); + lua_pushcfunction(L,class_le_event); + lua_rawset(L,-3); + lua_pushstring(L,"__eq"); + lua_pushcfunction(L,class_eq_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__call"); + lua_pushcfunction(L,class_call_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushstring(L, "tolua_gc_event"); + lua_rawget(L, LUA_REGISTRYINDEX); + /*lua_pushcfunction(L,class_gc_event);*/ + lua_rawset(L,-3); +} + diff --git a/project/jni/lua/src/tolua_event.h b/project/jni/lua/src/tolua_event.h new file mode 100644 index 000000000..898f33dfc --- /dev/null +++ b/project/jni/lua/src/tolua_event.h @@ -0,0 +1,24 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#ifndef TOLUA_EVENT_H +#define TOLUA_EVENT_H + +#include "tolua++.h" + +TOLUA_API void tolua_moduleevents (lua_State* L); +TOLUA_API int tolua_ismodulemetatable (lua_State* L); +TOLUA_API void tolua_classevents (lua_State* L); + +#endif diff --git a/project/jni/lua/src/tolua_is.c b/project/jni/lua/src/tolua_is.c new file mode 100644 index 000000000..add337d19 --- /dev/null +++ b/project/jni/lua/src/tolua_is.c @@ -0,0 +1,621 @@ +/* tolua: functions to check types. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include +#include + +/* a fast check if a is b, without parameter validation + i.e. if b is equal to a or a superclass of a. */ +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index) +{ + int result; + if (lua_rawequal(L,mt_indexa,mt_indexb)) + result = 1; + else + { + if (super_index) { + lua_pushvalue(L, super_index); + } else { + lua_pushliteral(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + }; + lua_pushvalue(L,mt_indexa); /* stack: super mta */ + lua_rawget(L,-2); /* stack: super super[mta] */ + lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */ + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */ + lua_rawget(L,-2); /* stack: super super[mta] bool */ + result = lua_toboolean(L,-1); + lua_pop(L,3); + } + return result; +} + +/* Push and returns the corresponding object typename */ +TOLUA_API const char* tolua_typename (lua_State* L, int lo) +{ + int tag = lua_type(L,lo); + if (tag == LUA_TNONE) + lua_pushstring(L,"[no object]"); + else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE) + lua_pushstring(L,lua_typename(L,tag)); + else if (tag == LUA_TUSERDATA) + { + if (!lua_getmetatable(L,lo)) + lua_pushstring(L,lua_typename(L,tag)); + else + { + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"[undefined]"); + } + } + } + else /* is table */ + { + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"table"); + } + else + { + lua_pushstring(L,"class "); + lua_insert(L,-2); + lua_concat(L,2); + } + } + return lua_tostring(L,-1); +} + +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) +{ + if (msg[0] == '#') + { + const char* expected = err->type; + const char* provided = tolua_typename(L,err->index); + if (msg[1]=='f') + { + int narg = err->index; + if (err->array) + luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n", + msg+2,narg,provided,expected); + else + luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n", + msg+2,narg,provided,expected); + } + else if (msg[1]=='v') + { + if (err->array) + luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n", + msg+2,provided,expected); + else + luaL_error(L,"%s\n value is '%s'; '%s' expected.\n", + msg+2,provided,expected); + } + } + else + luaL_error(L,msg); +} + +/* the equivalent of lua_is* for usertable */ +static int lua_isusertable (lua_State* L, int lo, const const char* type) +{ + int r = 0; + if (lo < 0) lo = lua_gettop(L)+lo+1; + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */ + if (lua_isstring(L,-1)) + { + r = strcmp(lua_tostring(L,-1),type)==0; + if (!r) + { + /* try const */ + lua_pushstring(L,"const "); + lua_insert(L,-2); + lua_concat(L,2); + r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0; + } + } + lua_pop(L, 1); + return r; +} + +int push_table_instance(lua_State* L, int lo) { + + if (lua_istable(L, lo)) { + + lua_pushstring(L, ".c_instance"); + lua_gettable(L, lo); + if (lua_isuserdata(L, -1)) { + + lua_replace(L, lo); + return 1; + } else { + + lua_pop(L, 1); + return 0; + }; + } else { + return 0; + }; + + return 0; +}; + +/* the equivalent of lua_is* for usertype */ +static int lua_isusertype (lua_State* L, int lo, const char* type) +{ + if (!lua_isuserdata(L,lo)) { + if (!push_table_instance(L, lo)) { + return 0; + }; + }; + { + /* check if it is of the same type */ + int r; + const char *tn; + if (lua_getmetatable(L,lo)) /* if metatable? */ + { + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */ + tn = lua_tostring(L,-1); + r = tn && (strcmp(tn,type) == 0); + lua_pop(L, 1); + if (r) + return 1; + else + { + /* check if it is a specialized class */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get super */ + lua_getmetatable(L,lo); + lua_rawget(L,-2); /* get super[mt] */ + if (lua_istable(L,-1)) + { + int b; + lua_pushstring(L,type); + lua_rawget(L,-2); /* get super[mt][type] */ + b = lua_toboolean(L,-1); + lua_pop(L,3); + if (b) + return 1; + } + } + } + } + return 0; +} + +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err) +{ + if (lua_gettop(L)index = lo; + err->array = 0; + err->type = "[no object]"; + return 0; +} + +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "boolean"; + return 0; +} + +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "number"; + return 0; +} + +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "string"; + return 0; +} + +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "table"; + return 0; +} + +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = type; + return 0; +} + + +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "userdata"; + return 0; +} + +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) { + + if (lua_gettop(L)index = lo; + err->array = 0; + err->type = "value"; + return 1; +}; + +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def || abs(lo)<=lua_gettop(L)) /* any valid index */ + return 1; + err->index = lo; + err->array = 0; + err->type = "value"; + return 0; +} + +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = type; + return 0; +} + +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + return 1; +} + +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +#if 0 +int tolua_isbooleanfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isnumberfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isstringfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_istablefield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i+1); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); +} + +int tolua_isusertablefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_isusertable(L,-1,type) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = type; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isuserdatafield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isusertypefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + return 1; +} + +#endif diff --git a/project/jni/lua/src/tolua_map.c b/project/jni/lua/src/tolua_map.c new file mode 100644 index 000000000..d00e7069b --- /dev/null +++ b/project/jni/lua/src/tolua_map.c @@ -0,0 +1,704 @@ +/* tolua: functions to map features +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "tolua_event.h" +#include "lauxlib.h" + +#include +#include +#include +#include + + +/* Create metatable + * Create and register new metatable +*/ +static int tolua_newmetatable (lua_State* L, char* name) +{ + int r = luaL_newmetatable(L,name); + + #ifdef LUA_VERSION_NUM /* only lua 5.1 */ + if (r) { + lua_pushvalue(L, -1); + lua_pushstring(L, name); + lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */ + }; + #endif + + if (r) + tolua_classevents(L); /* set meta events */ + lua_pop(L,1); + return r; +} + +/* Map super classes + * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name' +*/ +static void mapsuper (lua_State* L, const char* name, const char* base) +{ + /* push registry.super */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + luaL_getmetatable(L,name); /* stack: super mt */ + lua_rawget(L,-2); /* stack: super table */ + if (lua_isnil(L,-1)) + { + /* create table */ + lua_pop(L,1); + lua_newtable(L); /* stack: super table */ + luaL_getmetatable(L,name); /* stack: super table mt */ + lua_pushvalue(L,-2); /* stack: super table mt table */ + lua_rawset(L,-4); /* stack: super table */ + } + + /* set base as super class */ + lua_pushstring(L,base); + lua_pushboolean(L,1); + lua_rawset(L,-3); /* stack: super table */ + + /* set all super class of base as super class of name */ + luaL_getmetatable(L,base); /* stack: super table base_mt */ + lua_rawget(L,-3); /* stack: super table base_table */ + if (lua_istable(L,-1)) + { + /* traverse base table */ + lua_pushnil(L); /* first key */ + while (lua_next(L,-2) != 0) + { + /* stack: ... base_table key value */ + lua_pushvalue(L,-2); /* stack: ... base_table key value key */ + lua_insert(L,-2); /* stack: ... base_table key key value */ + lua_rawset(L,-5); /* stack: ... base_table key */ + } + } + lua_pop(L,3); /* stack: */ +} + +/* creates a 'tolua_ubox' table for base clases, and +// expects the metatable and base metatable on the stack */ +static void set_ubox(lua_State* L) { + + /* mt basemt */ + if (!lua_isnil(L, -1)) { + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L,-2); + } else { + lua_pushnil(L); + }; + /* mt basemt base_ubox */ + if (!lua_isnil(L,-1)) { + lua_pushstring(L, "tolua_ubox"); + lua_insert(L, -2); + /* mt basemt key ubox */ + lua_rawset(L,-4); + /* (mt with ubox) basemt */ + } else { + /* mt basemt nil */ + lua_pop(L, 1); + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack:mt basemt string ubox */ + lua_rawset(L,-4); + }; + +}; + +/* Map inheritance + * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' +*/ +static void mapinheritance (lua_State* L, const char* name, const char* base) +{ + /* set metatable inheritance */ + luaL_getmetatable(L,name); + + if (base && *base) + luaL_getmetatable(L,base); + else { + + if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */ + lua_pop(L, 2); + return; + }; + luaL_getmetatable(L,"tolua_commonclass"); + }; + + set_ubox(L); + + lua_setmetatable(L,-2); + lua_pop(L,1); +} + +/* Object type +*/ +static int tolua_bnd_type (lua_State* L) +{ + tolua_typename(L,lua_gettop(L)); + return 1; +} + +/* Take ownership +*/ +static int tolua_bnd_takeownership (lua_State* L) +{ + int success = 0; + if (lua_isuserdata(L,1)) + { + if (lua_getmetatable(L,1)) /* if metatable? */ + { + lua_pop(L,1); /* clear metatable off stack */ + /* force garbage collection to avoid C to reuse a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + + success = tolua_register_gc(L,1); + } + } + lua_pushboolean(L,success!=0); + return 1; +} + +/* Release ownership +*/ +static int tolua_bnd_releaseownership (lua_State* L) +{ + int done = 0; + if (lua_isuserdata(L,1)) + { + void* u = *((void**)lua_touserdata(L,1)); + /* force garbage collection to avoid releasing a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + lua_getmetatable(L,1); + if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */ + { + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-5); + done = 1; + } + } + lua_pushboolean(L,done!=0); + return 1; +} + +/* Type casting +*/ +static int tolua_bnd_cast (lua_State* L) +{ + +/* // old code + void* v = tolua_tousertype(L,1,NULL); + const char* s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +*/ + + void* v; + const char* s; + if (lua_islightuserdata(L, 1)) { + v = tolua_touserdata(L, 1, NULL); + } else { + v = tolua_tousertype(L, 1, 0); + }; + + s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +} + +/* Inheritance +*/ +static int tolua_bnd_inherit (lua_State* L) { + + /* stack: lua object, c object */ + lua_pushstring(L, ".c_instance"); + lua_pushvalue(L, -2); + lua_rawset(L, -4); + /* l_obj[".c_instance"] = c_obj */ + + return 0; +}; + +#ifdef LUA_VERSION_NUM /* lua 5.1 */ +static int tolua_bnd_setpeer(lua_State* L) { + + /* stack: userdata, table */ + if (!lua_isuserdata(L, -2)) { + lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); + lua_error(L); + }; + + if (lua_isnil(L, -1)) { + + lua_pop(L, 1); + lua_pushvalue(L, TOLUA_NOPEER); + }; + lua_setfenv(L, -2); + + return 0; +}; + +static int tolua_bnd_getpeer(lua_State* L) { + + /* stack: userdata */ + lua_getfenv(L, -1); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_pushnil(L); + }; + return 1; +}; +#endif + +/* static int class_gc_event (lua_State* L); */ + +TOLUA_API void tolua_open (lua_State* L) +{ + int top = lua_gettop(L); + lua_pushstring(L,"tolua_opened"); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isboolean(L,-1)) + { + lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX); + + #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */ + /* create peer object table */ + lua_pushstring(L, "tolua_peers"); lua_newtable(L); + /* make weak key metatable for peers indexed by userdata object */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */ + lua_setmetatable(L, -2); /* stack: string peers */ + lua_rawset(L,LUA_REGISTRYINDEX); + #endif + + /* create object ptr -> udata mapping table */ + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack: string ubox */ + lua_rawset(L,LUA_REGISTRYINDEX); + + lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX); + lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX); + + /* create gc_event closure */ + lua_pushstring(L, "tolua_gc_event"); + lua_pushstring(L, "tolua_gc"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushstring(L, "tolua_super"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushcclosure(L, class_gc_event, 2); + lua_rawset(L, LUA_REGISTRYINDEX); + + tolua_newmetatable(L,"tolua_commonclass"); + + tolua_module(L,NULL,0); + tolua_beginmodule(L,NULL); + tolua_module(L,"tolua",0); + tolua_beginmodule(L,"tolua"); + tolua_function(L,"type",tolua_bnd_type); + tolua_function(L,"takeownership",tolua_bnd_takeownership); + tolua_function(L,"releaseownership",tolua_bnd_releaseownership); + tolua_function(L,"cast",tolua_bnd_cast); + tolua_function(L,"inherit", tolua_bnd_inherit); + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + tolua_function(L, "setpeer", tolua_bnd_setpeer); + tolua_function(L, "getpeer", tolua_bnd_getpeer); + #endif + + tolua_endmodule(L); + tolua_endmodule(L); + } + lua_settop(L,top); +} + +/* Copy a C object +*/ +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size) +{ + void* clone = (void*)malloc(size); + if (clone) + memcpy(clone,value,size); + else + tolua_error(L,"insuficient memory",NULL); + return clone; +} + +/* Default collect function +*/ +TOLUA_API int tolua_default_collect (lua_State* tolua_S) +{ + void* self = tolua_tousertype(tolua_S,1,0); + free(self); + return 0; +} + +/* Do clone +*/ +TOLUA_API int tolua_register_gc (lua_State* L, int lo) +{ + int success = 1; + void *value = *(void **)lua_touserdata(L,lo); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); + if (!lua_isnil(L,-1)) /* make sure that object is not already owned */ + success = 0; + else + { + lua_pushlightuserdata(L,value); + lua_getmetatable(L,lo); + lua_rawset(L,-4); + } + lua_pop(L,2); + return success; +} + +/* Register a usertype + * It creates the correspoding metatable in the registry, for both 'type' and 'const type'. + * It maps 'const type' as being also a 'type' +*/ +TOLUA_API void tolua_usertype (lua_State* L, const char* type) +{ + char ctype[128] = "const "; + strncat(ctype,type,120); + + /* create both metatables */ + if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type)) + mapsuper(L,type,ctype); /* 'type' is also a 'const type' */ +} + + +/* Begin module + * It pushes the module (or class) table on the stack +*/ +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) +{ + if (name) + { + lua_pushstring(L,name); + lua_rawget(L,-2); + } + else + lua_pushvalue(L,LUA_GLOBALSINDEX); +} + +/* End module + * It pops the module (or class) from the stack +*/ +TOLUA_API void tolua_endmodule (lua_State* L) +{ + lua_pop(L,1); +} + +/* Map module + * It creates a new module +*/ +#if 1 +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) /* check if module already exists */ + { + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); /* assing module into module */ + } + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */ + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + } + lua_pop(L,1); /* pop module */ +} +#else +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_newtable(L); + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + if (name) + lua_rawset(L,-3); /* assing module into module */ + else + lua_pop(L,1); /* pop global table */ +} +#endif + +static void push_collector(lua_State* L, const char* type, lua_CFunction col) { + + /* push collector function, but only if it's not NULL, or if there's no + collector already */ + if (!col) return; + luaL_getmetatable(L,type); + lua_pushstring(L,".collector"); + /* + if (!col) { + lua_pushvalue(L, -1); + lua_rawget(L, -3); + if (!lua_isnil(L, -1)) { + lua_pop(L, 3); + return; + }; + lua_pop(L, 1); + }; + // */ + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + lua_pop(L, 1); +}; + +/* Map C class + * It maps a C class, setting the appropriate inheritance and super classes. +*/ +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) +{ + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapinheritance(L,name,base); + mapinheritance(L,cname,name); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); + + lua_pushstring(L,lname); + + push_collector(L, name, col); + /* + luaL_getmetatable(L,name); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + */ + + luaL_getmetatable(L,name); + lua_rawset(L,-3); /* assign class metatable to module */ + + /* now we also need to store the collector table for the const + instances of the class */ + push_collector(L, cname, col); + /* + luaL_getmetatable(L,cname); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + lua_rawset(L,-3); + lua_pop(L,1); + */ + + +} + +/* Add base + * It adds additional base classes to a class (for multiple inheritance) + * (not for now) +TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) { + + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); +}; +*/ + +/* Map function + * It assigns a function into the current module (or class) +*/ +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) +{ + lua_pushstring(L,name); + lua_pushcfunction(L,func); + lua_rawset(L,-3); +} + +/* sets the __call event for the class (expects the class' main table on top) */ +/* never really worked :( +TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) { + + lua_getmetatable(L, -1); + //luaL_getmetatable(L, type); + lua_pushstring(L,"__call"); + lua_pushcfunction(L,func); + lua_rawset(L,-3); + lua_pop(L, 1); +}; +*/ + +/* Map constant number + * It assigns a constant number into the current module (or class) +*/ +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value) +{ + lua_pushstring(L,name); + tolua_pushnumber(L,value); + lua_rawset(L,-3); +} + + +/* Map variable + * It assigns a variable into the current module (or class) +*/ +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + /* get func */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,get); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ + + /* set func */ + if (set) + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .set table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".set"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,set); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .set table */ + } +} + +/* Access const array + * It reports an error when trying to write into a const array +*/ +static int const_array (lua_State* L) +{ + luaL_error(L,"value of const array cannot be changed"); + return 0; +} + +/* Map an array + * It assigns an array into the current module (or class) +*/ +TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + + lua_newtable(L); /* create array metatable */ + lua_pushvalue(L,-1); + lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,get); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,set?set:const_array); + lua_rawset(L,-3); + + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ +} + + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) { + + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0); + #else + lua_dobuffer(L, B, size, name); + #endif +}; + diff --git a/project/jni/lua/src/tolua_push.c b/project/jni/lua/src/tolua_push.c new file mode 100644 index 000000000..639414755 --- /dev/null +++ b/project/jni/lua/src/tolua_push.c @@ -0,0 +1,171 @@ +/* tolua: functions to push C values. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo) +{ + lua_pushvalue(L,lo); +} + +TOLUA_API void tolua_pushboolean (lua_State* L, int value) +{ + lua_pushboolean(L,value); +} + +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value) +{ + lua_pushnumber(L,value); +} + +TOLUA_API void tolua_pushstring (lua_State* L, const char* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushstring(L,value); +} + +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushlightuserdata(L,value); +} + +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) +{ + if (value == NULL) + lua_pushnil(L); + else + { + luaL_getmetatable(L, type); + lua_pushstring(L,"tolua_ubox"); + lua_rawget(L,-2); /* stack: mt ubox */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L, LUA_REGISTRYINDEX); + }; + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); /* stack: mt ubox ubox[u] */ + if (lua_isnil(L,-1)) + { + lua_pop(L,1); /* stack: mt ubox */ + lua_pushlightuserdata(L,value); + *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */ + lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */ + lua_insert(L,-4); /* stack: mt newud ubox u newud */ + lua_rawset(L,-3); /* stack: mt newud ubox */ + lua_pop(L,1); /* stack: mt newud */ + /*luaL_getmetatable(L,type);*/ + lua_pushvalue(L, -2); /* stack: mt newud mt */ + lua_setmetatable(L,-2); /* stack: mt newud */ + + #ifdef LUA_VERSION_NUM + lua_pushvalue(L, TOLUA_NOPEER); + lua_setfenv(L, -2); + #endif + } + else + { + /* check the need of updating the metatable to a more specialized class */ + lua_insert(L,-2); /* stack: mt ubox[u] ubox */ + lua_pop(L,1); /* stack: mt ubox[u] */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */ + lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */ + if (lua_istable(L,-1)) + { + lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */ + if (lua_toboolean(L,-1) == 1) /* if true */ + { + lua_pop(L,3); /* mt ubox[u]*/ + lua_remove(L, -2); + return; + } + } + /* type represents a more specilized type */ + /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ + lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ + lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ + lua_pop(L,3); /* stack: mt ubox[u] */ + } + lua_remove(L, -2); /* stack: ubox[u]*/ + } +} + +TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type) +{ + tolua_pushusertype(L,value,type); + tolua_register_gc(L,lua_gettop(L)); +} + +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushvalue(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushboolean(L,v); + lua_settable(L,lo); +} + + +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v) +{ + lua_pushnumber(L,index); + tolua_pushnumber(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v) +{ + lua_pushnumber(L,index); + tolua_pushstring(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v) +{ + lua_pushnumber(L,index); + tolua_pushuserdata(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + tolua_register_gc(L,lua_gettop(L)); + lua_settable(L,lo); +} + diff --git a/project/jni/lua/src/tolua_to.c b/project/jni/lua/src/tolua_to.c new file mode 100644 index 000000000..542ca67d1 --- /dev/null +++ b/project/jni/lua/src/tolua_to.c @@ -0,0 +1,133 @@ +/* tolua: funcitons to convert to C types +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" + +#include +#include + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) +{ + return lua_gettop(L) and append it to this file. + If you use gpg: gpg --export -a >>KEYS should do the trick + +Name User ID +Boris Kolpackov boris@kolpackov.net +Tinny Ng tng@apache.org +Gareth Reakes gareth@apache.org +Neil Graham neilg@apache.org + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.2.5 (GNU/Linux) + +mQGLBD7gyjQBDADjboRuWsUo7JXgicFS5DGpqIhhHqmzifDxI1Sb/xHk7WZfxsNG +YFp1c5NXCsMKx801UUCeiezam9iiWILSl7SOnTvE4LUPkMJSSB9gsekt8YCDnUFr +cYdohOKSZvZi5l9KGLwAmF7CXhRItVWzbEHPcFQvWpBqtl7UXbWu+j3RPMHocNH8 +I6ujnPCGhuaYYCsbUQzzlzVMw0mROm6vFKP2PcYmthXqS5eBLE2oNmUX06tn7U0i +5RjH34yLsaneXCwFJDeDc8RoYGvN8W4KR0uJp0i2BSop3dfkgYlxeB3NoqCh58Rk +jMrzJrhG3aetT2OIASNhsD80GT6phBvKLhPnBI/ifHxvUbKBkes5MlfMe/2TuHAq +op8iby2Kh54aW7TtUn8aWCZE0kWkOjYYXTH8wBPiTr/RBcdPNXkwofpLIDbV+JL4 +qxebeZ8/HxPYoE2yN4mAM765sIWiZyKQhf4VurOXjOO/zsaGiP54vdnDO2ZlwVuS +RaglWAZ2+SR79YUABim0KUJvcmlzIEtvbHBhY2tvdiA8Ym9yaXNAY29kZXN5bnRo +ZXNpcy5jb20+iQG0BBMBAgAeBQJC1WiIAhsDBgsJCAcDAgMVAgMDFgIBAh4BAheA +AAoJEMiAKQuuCE8dkCAMAJqV/8EzQphusvSblnI2LZFaFFLKlot8PUNrqZGEq4D2 +mrTQkrkOBVHzSSm/MGOuhSeknzSS6hgEb+L647oxPSQ/YVJ6C7JFkQqcp6gfrYj/ +AaCIhJkBccLIxkoNE5gaEZJvhd0WhDg0O0Xy7Jfsl0OQS9mvS5Prw69+ZRE0gFj/ +H6XCm7zxpoXtQhFT1QZL/WJEyUIbDQeGppwueHAockV30f6VU+Q+t5PPYDd2+9hf +i6hOrHo6Ldne0or1xid+b27uqCid2mCHZM6Q00cMlbupiDiFw0Pjd3pcK7bgFS6o +kiHpFieMNgwhVEzz+nqOLoxO8dWz190MPbiW7k2zH+4PWVW3+Qwjq5QAtl18PNRE +Lt7XgIT/5AI/ov5CoyVLA0w9I3iL1ChcbzPlHGz0eQgOKM79PikSjkvfAns757te +yyWtnfwJcajph2fmz2GTmBAdwVELskmZCqntxIpM3vVZqDl+Sn3JtPl5uNl7zgIl +JCjYv/trdjqRIHW9ty7s1rQlQm9yaXMgS29scGFja292IDxib3Jpc0Brb2xwYWNr +b3YubmV0PokBtwQTAQIAIQIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAUCQtVpVQIZ +AQAKCRDIgCkLrghPHWNODACJkRxgIhj6sbLk10nfC4c7DDLhO96HzaWl4W/f34RT +2ZcT9QMlT0rGim93HadI5160aTb3I8uxdsNKUpjZbFMl/6W6jb/rU5qVWPLIKgHG +THvskJchTylklhZWhc2/QTHMWZPF2ipr0v6djkIMtEkH1os6cevPvPNkXxFcQmBk +GxUgINYe+F5snRmXnR2Fbm56Xam9TWKNfrpNLY03s/S7iHmonLSw7qW5Ixjmrdeh +Snil6TxGhDU/AiRX/EEa5O/pqUwlm2E/6TvgQoeX1fEx0YjLevVWjoqASFg75INk +N8D6P10mT0LvgIAuK3Ppcd69No3RLufsJGgXjb8NIQyzltqH/S0qPeSBrrpisf/y +lV51RuIZBgYHRHl7xVG+KEJ5JLyLzfwebPmRyXiHkM1yz749tiyhV5JMcKsO3hOy +6nZtQRt1as5Dmm0dzhFHYLImqP8nQAblu6q7FRLJLcXLJl8NlOWVPttPcmuGaXc2 +NeYuUdtFi+hquk268CtpCJW5Aw0EPuDNnBAMAPa+/MHQ5JBkR+VoVU+9bVLb+RFq +lORX9Mtl7MwYBSQwOOv0KTMXVv/ucqh7A4cLQkK7QVD878C1kTYjupDdrAp7GDlN +vhzoE+ltuJaUYFDbviwH++vOMMR3DqkPvfcWxUbCGIFDWyHIqVUmGkOzzTIk62IT +gYNBvIhxqSh+r5LG0dNFYO+W5bd0FzftmP4AnfhMPDKM6OJsZ2ZrHR0t8EJnn4Pn +6/D1e02/1CUdlMM8gTSAXk4wF69TCsE9fvDq5jgLoud1I2RKLmhRDDxxmQUAjBir +aab32oeRzNgbU5RbtolHxfvDiRmHUDDqQavNT3HpElbeXj/J5/Jkh0LcpF1QsDUJ +pewVVX4ltMCnCATqUqqgx5UpnfEY1Dt5N3uuO5znQ5oznZHsLWx3qWegTJn7acta +/HlFUpSMaxteuXT/6EiE7lAzsGSWTcX8BpCHviDVPhQMy2AFzWSQlUItXyfkfX0B +SOgFypLjffx4+bms/DXJPYgwEhjFiTaATBeUOwADBQwAuPTkktfoMsI4lL4UYBr5 +afW1R6lHwMZeoH7Mspb82bC9Lqi5gU3wBu3RJwm1CswGMBys+o9J0eA7EDRPw8wM +e0THds93rhlABnvhkElbSD/ypsUsX+DRbjiVrV5gTwVRg+5Qmu754BUPrbt14awO +4yLWqV7NN2oOglZy2BTN1WTECOzODRVyxlb3AAL+KWoc0L2QzfRErY5t6ZbIYf2C ++8jXgf6iFl6eLDlecWcrHds/rl1A5w+MP1I+EjozMnjejEjUOuVyq4B80YmAquPL +6BB76CyjZnpJjvGLijVU4RrD1vduKlMsy4dh7gQaVTQ+SvrQktrFbEcTy2Gj/Jir +LVQagYPSqpcRwLvd0sOGxkipKqIjDi7v8huc+jGmUCFpBcMwJPndzNwuBmJUEGhp +QM0VeYHDugZ1+GWVrxDcjAsYKjwjm/qdjP/1el3a9rgMVYrmxHKobiuqYklIWtw6 +mp7gzdzwMwUNOX8hHCL21ojStlUs5BbzZQ8X8h8a7sX9iQGcBBgBAgAGBQI+4M2c +AAoJEMiAKQuuCE8d4LYL/iUOcqAT3enonrSOu9v8SGKqEc6z7H/5f0t7vZxREVqJ +PIEL/Lj5787NouhtZ+k7KBz4Ssu2lmOA63PUXtSllQx8mg/Jb2PUrjUVLCr22WqA +mr3zAQQ/14B5cLkhnpSID0oQL5UyP7dZ4beUWB3wYydp/hbOLl7+OrP+2EpIopYB +Mdk383GsnN2wWP9pEEDhJ1Lt7DsWuNV/ATZ9yWIvs82s8QiGvWfKbYSHvvzIKAET +UkPD7uWU3IdXgm9kuQQ7TNqX6q857PAC3SK+b+qepmyGDJtoeYS19WsxfqZr2Iot +i75/zy43w9bhbX17JNQynaMsAP4nG+HHzvnSEp8p0s38Cz5xi6xVb8fig6g3WFwn +6OdZakQ8sI+DyhsrdwlgSCNQTsi85X7Opv8Q+8EQwt+QBTF85O5RjO1Szacsedvl +RXSIWXj8vl8TJZ1VsEOBehdSjAjpUJMUHAoq9c69H5ynXzFrVwOWCwfAYcrFNsmX +hN0wyp3I8BVY5rjH33DQTA== +=ehLR +-----END PGP PUBLIC KEY BLOCK----- + + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.0.6 (MingW32) +Comment: For info see http://www.gnupg.org + +mQGiBDyHxtYRBACZ0tjwBxGJZgu/xVMwgCCUdzXcwMlt4xym2Vx0ZZ6bDJWDVlfa +U/BvSVrrGGgkuYt2fFOeboYIVqW5OsQKJX5a6eZbywkhiK9CehDoh0Ask0hTgyzf +C+kBldozpSv2adBeD4shv8E6mPFsAaA1N7wOIYE6dOuRJBAPIjeZ/ziFxwCg8kaX +r59ZEWL2dD4RISap5mGwyA0D/02DYwBN0V8iSqAi6gu1yYAccsz8kw573DRre0Rh +h8rgNUh5FA63MMDoifYKW1bcKWZkp9BfAE0Q6qwi7bfs/FOBHBCZpI47FYJ1n8yh +VRHA3MxayIqZQlETTNbLMPDJ2rtRs8NJZ7brXnJ2zOuDexzlS2vhKdeJP9gsrfXF +LYDeBACBYd6a1WRm5aZMvMpO16C925UbRmDBZ+TfWRtxPqRYSfVM+hkPKw5GObWJ +gL1GbF5bIS0C/Ddi7oegB77lGn8XNDTQT5e47SWkeboU+6fuSgsLLSgMfKivh++S +29kngiFIUsKnB4F102GwoAkpsO12Vhnsi9INaXVYLkZmhR3x07QwVGlubnkgTmcg +KFhlcmNlcy1DKysgY29tbWl0dGVyKSA8dG5nQGFwYWNoZS5vcmc+iFcEExECABcF +AjyHxtYFCwcKAwQDFQMCAxYCAQIXgAAKCRA+PBlAJOh0GSTcAJ9hqoz+wf70Dw84 +H2RX7ZEo1jhvggCg1QA//1Ur9XFxLUlFVnbppAMPl5S5AQ0EPIfG1xAEAOjBKfzF +4aZaY1biEUxZCk6PMofuXVE32XFrsm1Pn3AcYThtSEBQM76yXOx7d30IdA6yPSkF +rsd9gfB379KfQHAc5VnNZU1xE3rmmT7+s5rRPr0zoBCRtI/qCajFV1IczqmvlAHq +QJunztZNB3D2Uu4GGZ2sAQMFyPzBzNk3UODLAAMFBAC1KB5yJkbDhMPeT4ewFhow +Yy/VbQSPfYcbTjY/+JXZ6XKZUvZSq75S1id/9vgxMBljfruQKlYQ54P6yQqreWTt +IXtR9yQt0C5FVzl7lZKXZYZLJjKmEavqG7dtDNXtmVUWIx7JJwzSv/h6HyXlJZuw +Sj5q9RAV/QoRf6bHiNZzgYhGBBgRAgAGBQI8h8bXAAoJED48GUAk6HQZd54An1tZ +V9tsv1XZSRmh6SKUHkUn8ZNiAJwOO/uRRPfoeyAUbP+qfro53b+UQpkBogQ8h8bW +EQQAmdLY8AcRiWYLv8VTMIAglHc13MDJbeMcptlcdGWemwyVg1ZX2lPwb0la6xho +JLmLdnxTnm6GCFaluTrECiV+WunmW8sJIYivQnoQ6IdALJNIU4Ms3wvpAZXaM6Ur +9mnQXg+LIb/BOpjxbAGgNTe8DiGBOnTrkSQQDyI3mf84hccAoPJGl6+fWRFi9nQ+ +ESEmqeZhsMgNA/9Ng2MATdFfIkqgIuoLtcmAHHLM/JMOe9w0a3tEYYfK4DVIeRQO +tzDA6In2CltW3ClmZKfQXwBNEOqsIu237PxTgRwQmaSOOxWCdZ/MoVURwNzMWsiK +mUJRE0zWyzDwydq7UbPDSWe2615ydszrg3sc5Utr4SnXiT/YLK31xS2A3gQAgWHe +mtVkZuWmTLzKTtegvduVG0ZgwWfk31kbcT6kWEn1TPoZDysORjm1iYC9RmxeWyEt +Avw3Yu6HoAe+5Rp/FzQ00E+XuO0lpHm6FPun7koLCy0oDHyor4fvktvZJ4IhSFLC +pweBddNhsKAJKbDtdlYZ7IvSDWl1WC5GZoUd8dO0MFRpbm55IE5nIChYZXJjZXMt +QysrIGNvbW1pdHRlcikgPHRuZ0BhcGFjaGUub3JnPohXBBMRAgAXBQI8h8bWBQsH +CgMEAxUDAgMWAgECF4AACgkQPjwZQCTodBkk3ACfYaqM/sH+9A8POB9kV+2RKNY4 +b4IAoNUAP/9VK/VxcS1JRVZ26aQDD5eUuQENBDyHxtcQBADowSn8xeGmWmNW4hFM +WQpOjzKH7l1RN9lxa7JtT59wHGE4bUhAUDO+slzse3d9CHQOsj0pBa7HfYHwd+/S +n0BwHOVZzWVNcRN65pk+/rOa0T69M6AQkbSP6gmoxVdSHM6pr5QB6kCbp87WTQdw +9lLuBhmdrAEDBcj8wczZN1DgywADBQQAtSgeciZGw4TD3k+HsBYaMGMv1W0Ej32H +G042P/iV2elymVL2Uqu+UtYnf/b4MTAZY367kCpWEOeD+skKq3lk7SF7UfckLdAu +RVc5e5WSl2WGSyYyphGr6hu3bQzV7ZlVFiMeyScM0r/4eh8l5SWbsEo+avUQFf0K +EX+mx4jWc4GIRgQYEQIABgUCPIfG1wAKCRA+PBlAJOh0GXeeAJ9bWVfbbL9V2UkZ +oekilB5FJ/GTYgCcDjv7kUT36HsgFGz/qn66Od2/lEI= +=8B+D +-----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.0.6 (GNU/Linux) +Comment: For info see http://www.gnupg.org + +mQGiBD6IPYoRBADdZZVTi5dsdtKm9tbJu2PRTMnkgP61zYxT41O9oVoUDhkqKUd3 +Kv9Jm+0Kr5RWdega+m9Ew1zEIilywu08xf1Ne6YsXViZB0E+8D+ObLDSGVjm4fBW +G5HLeYnPnuivqsXNy71MVOiaM9IGLemvUPkIgteMBBP7dcNko8Ykea2I8wCg2O6J +tx2Uj3ZqtSyyC1GOiIBq81UEAM8XTQQm7k+Q2BjommfTHli97WdJrPD/BMCc9MOx +wFia80g3nGfrp9F9L2U5jBzOTHmthBSjeCTmIybh4iHz7TfLcj1zqtG+Q4BqrOV6 +/N6gKJivAJSLaqEECxyi8VmMnayg/WEe8eaF1QtPh7b3mO9QhZj839GPpHEpNlti +noqEA/wM+dx6cy/IcOuKVefon6KMsjJ0oWzBtUE+zWrmWN4oXUWY1C8zHBugqvKf +w3Yrse5IHRtvraqrc+37DfVKEP2DheL526zuTMLBNwQc36UeDcL8n1V+0K/Ay7Zs +O5/9lxwd9PhmL9E5n2tHbrXKCsMx1HaW1pjMj4BzL1cNo0LS0rQhR2FyZXRoIFJl +YWtlcyA8Z2FyZXRoQGFwYWNoZS5vcmc+iFcEExECABcFAj6IPYoFCwcKAwQDFQMC +AxYCAQIXgAAKCRAe3w93r4d3pnlSAJwPfmNsaTTRtTLXuhll1FG4kFtTvgCggYB0 +YhTzmMtD59n/ymg09SCHKC+IRgQQEQIABgUCPog+iwAKCRA7Ok8Kx55bak8bAJ9Y +73xLuFKBxlkqASo4j9GtRjFW0gCfcZhJzZAApR6Mixy9ei7ykb3adguIRgQQEQIA +BgUCPog/jAAKCRBqo+AVTsqIBUSGAJ4jfdTVDT0lhD9DfsZDX9pXPWKNBwCfaaWb +YXZ6aSHV0kaZDK7uj3kKQ7m5Ag0EPog9khAIAK5cD5+GcY2bZTfCeHzdbaOGXatl +IWr3z8A56L4xA1Mp2D/tpF1Cky1hpFu8SMmNiO4+OqbNF08iJK7p+0HIb7KU2+Fk +4rNumfVkAi+QMvfKyr78pvq2DCqsgyQdFmkFhEYOkgZvas52CRLKW/GGXh+xnQI7 +NvJuXu0+z130QcS9Q+f90NSrZWOzcHiz08LzvLnt5miLF0AxJGWwQj/4TzB+Xnwu +CS8QV2k81LiHH+qbbPi2+VyMD/dimYZE6Fti/ZziO1KJXcMxfN62/QiYw+ui7K9F +YXqiWY+RfXsX3QCfJdMhUtHXArVzMDF6UcDU76lMG1PBcD12zGfRL8iLoBcAAwUH +/3ro3uF9Mix2URdXxTfJn4vfDJ/hiAbhENTtCDU5M30lSI9JG5HamVsSMo0hrtJd +RaU7fLhbw/1IXn0tvbbeWmWZhDV5fYwuMKywwTvMWBmNZ7eBbZUlFlRyKYQqmrH7 +cMBUGbA2ePHpDwvAvgU/zIayvhx87cq3RcbcfJaGvPB8v1thPMek1QK/xyFZowO3 +SGSjS7yf1DoTR7cKAatE0bxfL4A6lRa7iWk6ZMgQ5XgQryPoSwqsAAdcjW7wZj+J +7wlDdkWaY5MMPLbmNgRCpbcw/L77x4Wp7u7Nc0vcy/Qc8bYiBmyaavIBwn5BEHWN +85SNootv8flkreqsEKJy8KCIRgQYEQIABgUCPog9kgAKCRAe3w93r4d3ptC8AJ9D +O5xVcnBvZRCv2nN6pr9Erm1NZgCgjWXqDC0aQj7rtZq0i9UUCn+/PFA= +=QJwD +-----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.2.2 (Cygwin) + +mQGiBDp4qeoRBAC0LNU4DKxiGD4WlaCZytDOlzEpUEJ2osubqdUSnexv/NzOA3Jy +ZaAsITi1kj8dQR/pqpFHEMeWsb1Xua33TtlPcCN3kFicjbTOo3jbilx4gUFeO9Oy +mcMeu/scYGan4erT++vXEAVd+qKCUzOymFqpDCa3xpqmeDuWxBUjqbCRFwCgt6w/ +dvC1VRG2bh7Ja09zfCPr4hkEAIYdq/2k3YYc0T1Fh8fKDRzsRsDYj+8BAGg8YmDy +wx04Nh6l3XmKt1DmR0U3ciH6rY3oWXB9oCzGoyr/ZvkakfknGsptBpVK0m9vVHVw +uHvIEZDdsX2l4Eplc/FovueZQadCj1R6zwTNvri7h0vTDg9Pk0+dRUcWHuoBhWvN ++hv3A/4mWImGrPsx6nq85TJWRJxqFeAnYiEqB69ns69S//+lqBRFWecTYu60dde/ +sHJ0mHDTP0u5FRUSj5BVufR5wLZH8+ieGNHl4Jei3VnN3voGhuGNpwGxLDTdXD3W +bMlOVx0H2R9+yqlDANLAfRS8GZb93I+riE0H1yMG5YgQC58+VLRUTmVpbCBHcmFo +YW0gKHRoaXMga2V5IGlzIHByaW1hcmlseSBmb3Igc2lnbmluZyBYZXJjZXMtSiBy +ZWxlYXNlcykgPG5laWxnQGNhLmlibS5jb20+iFcEExECABcFAjp4qeoFCwcKAwQD +FQMCAxYCAQIXgAAKCRCL9vl1lVl7BQNhAJ9nucE0TtlFxStFCepoV638ma/jQQCe +ILRbfFIo/pef/k551p2+wNqI/DyIRgQQEQIABgUCP6HMvgAKCRABBWa85BNjkiWe +AJ9Q0r6at4PhTAukVTIT1jFaIzJaoQCfQwzCjO54eu+zYLJyF4bOJ+i0eSOIRgQT +EQIABgUCP6K/ewAKCRCAzn5dyXJfO6jWAKCgr5/0+YchPX1LP975eEhAamZVGQCg +qnGt3A7/7LuKF18MjlpZWQOWvuOIRgQQEQIABgUCP61QjwAKCRCl/zLuaIOFDbEQ +AJ9CMksH+ujhz2QxiBSd81QtObxotgCgtwqHcr4sYZIhCYCcWp+LkihXgtS5BA0E +OnirwBAQAJDuhNBw4SXWZwW84XJclbDzrsftmuI7GeXVYtYQyJCWk4OX+fqR1xpq +td6IDLJl/Q/lvde42jxVMSTH2k0NfYsCh+5lIDQ54pYOiHZYQYx6ZhochZJTXxy9 +R+gs/vK/UT9f8SqdwY5BlOBTh14hJV33lxk5Ptk9li92NSiiLI3+9GB0bl6dLWnQ +PqFeaSvY962i7zgIhnaDOC43cDzwRlTA9zJsI92wYs+QC3LSm5e5falQ7GtQf4dZ +4oid+ayTOE4B9jMumLHn/YQPMzyNFWYQJkyohfninxm8+aPOAOmveF+K8FE0dQsX +agIjHSX/4cJFoWGnOdq8emkhlNQaoPIldpSQcNLIB0Psnc4RhKQ30tK5a1unTgex +mYLfFO8oLd439SKSaU1D00V0blf/e5cfFaJsRoQnPjG+jLu9l5cj7wkYH1XC7efy +QJ2tW8br+0ENn2Ap30Uy6C7fQshyATFPk0rSonfIpH0Gd7//b8DutYpY6/ySHoWM +muoqeqc1RdJc6qiJPj6OLrfzgLJrVt3Mj6GgCltsHXreRqMtwhRZ1xx5EZIDXGQ7 +/wnbDYgTU1NsY6VmBgZdkNOoCySg7Tf7NuJzLJ1Mlc2HBWhRBcrkwYhjGMsPIzK/ +2jVY9qTDecPNMZcscWTPQp6t7VzgzxEe8UJlDDtVMUY02QKw+0ELAAMFD/9mdmU/ +mEgwv9IxfNwisRW7jRQJjo4weUU6K9zkKZvRSg0tPLlyjTGtYKV4JTkeY++O38ie +cLJQOtBc5OikPbfhF2EMF7U+ATsd0hVvEVpCzsxcBr76Nt607Hcq7EeyL7GrvpaS +o5pTG89DFktB1xVji3X4ko+JI+uP5rva29y0o0KbjTReRqvdVUHHvnGgKu7UVmxW +AEAikEd2mQ5OYwqgO53VfL49akWR6Br30mymNw4oof1VqnPu0ZwN2WJkhM6fXA0N +k1+MsG8XZUe1hOX4pwFEmiv4R9htUhv3Hvl/HxY3oMRedHrkwLwEQQkW8UVJkS/u +6QZzeOplEG4s7ArmxEWqr3pBxXehvDvcpeWn8P+yhd8NgeZ7zDT1W+RT9iqIYvVv +UOYvEop32HJeJKeaZR1WUhTOxrHggCFQ8G6VEVeVmcJrcrvHI+9mbM+5oxt2NeGX +pf4eOErDxaFglvYSvXeX+IW3u7XQaxHs/D8v1fADzMi0xOIF7lxA7iyfNmfmb8NN +vej/F/Wj99od18agGy566pNYquu0VSV1nU4v2JRyZFkvtxjqZK+WVjZlMvbjaZPN +9IPWCtC7nKPOkpLdr1XoDrcIIZBldcOcGf/MdIaG5idzwIl3264vtCeIIDrGjxol +nQtO/wBr3R4e1BEksCNsHok+HoGfDvaKNTCWU4hGBBgRAgAGBQI6eKvAAAoJEIv2 ++XWVWXsFH1cAn3k4YjXAjj+xOnPXTckz7jMXwkZoAJ9+F70Jxv1uoUGzpBnFs4Cu +H39QDg== +=cl3K +-----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.2.4 (MingW32) + +mQGiBEAxJWARBACJ4GAREpL61NDClbabHkC6iPIQgX5B8uYkupPT7aKW0bdkB10z +M6mu6HSLHKm8mzpWK+Uzsvm+PLVWpumKh2CtdhqPskbnsn+kqL/bnYQcMMPG6ddC +WR8DwqT0NEIzHa6KhCom1WnSfwQxIP7mi+xGr+GHFbT17dXJM+eVSnlkqwCgqsoq +ZNMbMzJRJe0yAVp8khG0bgED/2Azm+oj88WMRIKSfuYvmCzOPHql6j94gCVUYsfu +Ygg37Y+ajPiLEL0YSn/fVlTdqQ6rNXPPwFnbxJpQeAKu7arppHmsRv0RrfbG4wpW +tmbLASrqYI3MpjcH8uHKSszv4Pdx81sk27O0VHtrtWowhk1Cale/IPUXe+a/9KXE +GQfOA/9THDQh+wj1JYx35rBideVcCgKwU83F4lcIKD0yaYH2zFlk3X6YmXEiglaP +CkYOcrJiJiNmbnXTwbASmed/xKy3d8ltvR0yJIctveZlZ2Qn4PAJbbSkBOpQ2uSF +39t0Ucu/9411JjkEGlR28pOxo83EKNOqs3NO0RTKxS+OA9IX0LQjUGVpWW9uZyBa +aGFuZyA8cGVpeW9uZ3pAY2EuaWJtLmNvbT6IXgQTEQIAHgUCQDElYAIbAwYLCQgH +AwIDFQIDAxYCAQIeAQIXgAAKCRDs6whVcdsjNe3qAJwKTZzF0Pi4gpEaYG8ejeFk +fd8uqACglgUrALCA7T0DENQrIfg37gX+ovu5AQ0EQDElYxAEANsUYxWjFKamG1A0 +K2ASNgp29IevQdk+YTRkqax8Zxv7tHWB6SOg65GJt6Oc2iwvJ+zV4d/B4KGEpL87 +GpbpeJTeT4HIRfaKrtO4T6bJ1Wr4gf/EhWi1NVXK0oOVAxyfSaIbkl+2Y8u0jfVO +Vgw//xuFGdx3IOjLNQSTbQ/w49V3AAMFA/4r8qJmfnerpK8xVQFDd/f9+j44rxQh +1RaXVKka1AxXTKdjyaDTze73RFX1AX3++FS9bMoqv0KamGFj/HMcGJP65ominoyu +Hmea9zMJSXLF/KlhQ2ZIF8sG/kci2RthmZVxvJ6oWH1wXscfjCIjFgWLqY29/sGF +smUlVt+wRiRQmIhJBBgRAgAJBQJAMSVjAhsMAAoJEOzrCFVx2yM1QjkAnjJl6YHS +HnUmiKj1nzOTMG+DlKq0AJ42j+nRdCDjdX6tK5/7cy5JnUe7bg== +=jqXV +-----END PGP PUBLIC KEY BLOCK----- diff --git a/project/jni/xerces/LICENSE b/project/jni/xerces/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/project/jni/xerces/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/project/jni/xerces/NOTICE b/project/jni/xerces/NOTICE new file mode 100644 index 000000000..46994eb87 --- /dev/null +++ b/project/jni/xerces/NOTICE @@ -0,0 +1,10 @@ + ========================================================================= + == NOTICE file corresponding to section 4(d) of the Apache License, == + == Version 2.0, in this case for the Apache Xerces distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Portions of this software were originally based on the following: + - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. diff --git a/project/jni/xerces/README b/project/jni/xerces/README new file mode 100644 index 000000000..17ffbc6d5 --- /dev/null +++ b/project/jni/xerces/README @@ -0,0 +1,2 @@ +See the doc/html/index.html for the description of the Xerces-C++ +project and other documentation. diff --git a/project/jni/xerces/config.h b/project/jni/xerces/config.h new file mode 100644 index 000000000..0ad23defe --- /dev/null +++ b/project/jni/xerces/config.h @@ -0,0 +1,489 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to specify no threading is used */ +/* #undef APP_NO_THREADS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ + +/* define if bool is a built-in type */ +#define HAVE_BOOL /**/ + +/* Define to 1 if you have the `catclose' function. */ +/* #undef HAVE_CATCLOSE */ + +/* Define to 1 if you have the `catgets' function. */ +/* #undef HAVE_CATGETS */ + +/* Define to 1 if you have the `catopen' function. */ +/* #undef HAVE_CATOPEN */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CORESERVICES_CORESERVICES_H */ + +/* Define to 1 if you have cpuid.h */ +/* #undef HAVE_CPUID_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `ftime' function. */ +#define HAVE_FTIME 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `iconv' function. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the `iconv_close' function. */ +#define HAVE_ICONV_CLOSE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ICONV_H 1 + +/* Define to 1 if you have the `iconv_open' function. */ +#define HAVE_ICONV_OPEN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LANGINFO_H */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localeconv' function. */ +/* #undef HAVE_LOCALECONV */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* define if the compiler implements L"widestring" */ +#define HAVE_LSTRING /**/ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if you have the `mblen' function. */ +/* #undef HAVE_MBLEN */ + +/* Define to 1 if you have the `mbrlen' function. */ +#define HAVE_MBRLEN 1 + +/* Define to 1 if you have the `mbsrtowcs' function. */ +#define HAVE_MBSRTOWCS 1 + +/* Define to 1 if you have the `mbstowcs' function. */ +/* #undef HAVE_MBSTOWCS */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES /**/ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `nl_langinfo' function. */ +/* #undef HAVE_NL_LANGINFO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NL_TYPES_H */ + +/* Define to 1 if you have the `pathconf' function. */ +#define HAVE_PATHCONF 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* define if the compiler supports ISO C++ standard library */ +/* #undef HAVE_STD_LIBS */ + +/* define if the compiler supports the std namespace */ +/* #undef HAVE_STD_NAMESPACE */ + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strnicmp' function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `towlower' function. */ +#define HAVE_TOWLOWER 1 + +/* Define to 1 if you have the `towupper' function. */ +#define HAVE_TOWUPPER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcsicmp' function. */ +/* #undef HAVE_WCSICMP */ + +/* Define to 1 if you have the `wcslwr' function. */ +/* #undef HAVE_WCSLWR */ + +/* Define to 1 if you have the `wcsnicmp' function. */ +/* #undef HAVE_WCSNICMP */ + +/* Define to 1 if you have the `wcsrtombs' function. */ +#define HAVE_WCSRTOMBS 1 + +/* Define to 1 if you have the `wcstombs' function. */ +/* #undef HAVE_WCSTOMBS */ + +/* Define to 1 if you have the `wcsupr' function. */ +/* #undef HAVE_WCSUPR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if the system has the type `_Bool'. */ +/* #undef HAVE__BOOL */ + +/* Define to 1 if you have to use const char* with iconv, to 0 if you must use + char*. */ +#define ICONV_USES_CONST_POINTER 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "xerces-c" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "xerces-c" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "xerces-c 3.1.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xerces-c" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.1.1" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 0 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "3.1.1" + +/* Define to true if autoconf is used in this configuration */ +#define XERCES_AUTOCONF 1 + +/* Define if namespaces is supported by the compiler */ +#define XERCES_HAS_CPP_NAMESPACE 1 + +/* Define to have SSE2 instruction support detected at runtime using __cpuid + */ +/* #undef XERCES_HAVE_CPUID_INTRINSIC */ + +/* Define to 1 if you have emmintrin.h */ +/* #undef XERCES_HAVE_EMMINTRIN_H */ + +/* Define to have SSE2 instruction support detected at runtime using + __get_cpuid */ +/* #undef XERCES_HAVE_GETCPUID */ + +/* Define to 1 if you have intrin.h */ +/* #undef XERCES_HAVE_INTRIN_H */ + +/* Define to 1 if we have inttypes.h */ +#define XERCES_HAVE_INTTYPES_H 1 + +/* Define to have SSE2 instruction used at runtime */ +/* #undef XERCES_HAVE_SSE2_INTRINSIC */ + +/* Define to 1 if we have sys/types.h */ +#define XERCES_HAVE_SYS_TYPES_H 1 + +/* Define to have Xerces_autoconf_config.hpp include wchar.h */ +/* #undef XERCES_INCLUDE_WCHAR_H */ + +/* Define if there is support for L"widestring" */ +#define XERCES_LSTRSUPPORT 1 + +/* Define if the isstream library can be included as */ +/* #undef XERCES_NEW_IOSTREAMS */ + +/* Define to have XMemory.hpp avoid declaring a matching operator delete for + the placement operator new */ +/* #undef XERCES_NO_MATCHING_DELETE_OPERATOR */ + +/* Define if there is no native bool support in this environment */ +/* #undef XERCES_NO_NATIVE_BOOL */ + +/* Define to use backslash as an extra path delimiter character */ +/* #undef XERCES_PATH_DELIMITER_BACKSLASH */ + +/* Define as the platform's export attribute */ +#define XERCES_PLATFORM_EXPORT + +/* Define as the platform's import attribute */ +#define XERCES_PLATFORM_IMPORT + +/* An appropriate signed 16 bit integer type */ +#define XERCES_S16BIT_INT int16_t + +/* An appropriate signed 32 bit integer type */ +#define XERCES_S32BIT_INT int32_t + +/* An appropriate signed 64 bit integer type */ +#define XERCES_S64BIT_INT int64_t + +/* Define as the appropriate size_t type */ +#define XERCES_SIZE_T size_t + +/* Define as the appropriate ssize_t type */ +#define XERCES_SSIZE_T ssize_t + +/* Define if the std namespace is supported */ +/* #undef XERCES_STD_NAMESPACE */ + +/* An appropriate unsigned 16 bit integer type */ +#define XERCES_U16BIT_INT uint16_t + +/* An appropriate unsigned 32 bit integer type */ +#define XERCES_U32BIT_INT uint32_t + +/* An appropriate unsigned 64 bit integer type */ +#define XERCES_U64BIT_INT uint64_t + +/* Define to use the POSIX file mgr */ +#define XERCES_USE_FILEMGR_POSIX 1 + +/* Define to use the Windows file mgr */ +/* #undef XERCES_USE_FILEMGR_WINDOWS */ + +/* Define to use the iconv-based MsgLoader */ +/* #define XERCES_USE_MSGLOADER_ICONV 1 */ + +/* Define to use the ICU-based MsgLoader */ +/* #undef XERCES_USE_MSGLOADER_ICU */ + +/* Define to use the InMemory MsgLoader */ +#define XERCES_USE_MSGLOADER_INMEMORY 1 + +/* Define to use the NoThread mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_NOTHREAD */ + +/* Define to use the POSIX mutex mgr */ +#define XERCES_USE_MUTEXMGR_POSIX 1 + +/* Define to use the Windows mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_WINDOWS */ + +/* Define to use the Mac OS X CFURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CFURL */ + +/* Define to use the CURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CURL */ + +/* Define to use the Sockets-based NetAccessor */ +/* #define XERCES_USE_NETACCESSOR_SOCKET 1 */ + +/* Define to use the WinSock NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_WINSOCK */ + +/* Define to use the GNU iconv transcoder */ +#define XERCES_USE_TRANSCODER_GNUICONV 1 + +/* Define to use the iconv transcoder */ +/* #undef XERCES_USE_TRANSCODER_ICONV */ + +/* Define to use the ICU-based transcoder */ +/* #undef XERCES_USE_TRANSCODER_ICU */ + +/* Define to use the Mac OS UnicodeConverter-based transcoder */ +/* #undef XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER */ + +/* Define to use the Windows transcoder */ +/* #undef XERCES_USE_TRANSCODER_WINDOWS */ + +/* Define to the 16 bit type used to represent Xerces UTF-16 characters */ +#define XERCES_XMLCH_T uint16_t + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +/* #undef volatile */ diff --git a/project/jni/xerces/config.h.in b/project/jni/xerces/config.h.in new file mode 100644 index 000000000..7dafbea46 --- /dev/null +++ b/project/jni/xerces/config.h.in @@ -0,0 +1,488 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to specify no threading is used */ +#undef APP_NO_THREADS + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_NAMESER_COMPAT_H + +/* define if bool is a built-in type */ +#undef HAVE_BOOL + +/* Define to 1 if you have the `catclose' function. */ +#undef HAVE_CATCLOSE + +/* Define to 1 if you have the `catgets' function. */ +#undef HAVE_CATGETS + +/* Define to 1 if you have the `catopen' function. */ +#undef HAVE_CATOPEN + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_CORESERVICES_CORESERVICES_H + +/* Define to 1 if you have cpuid.h */ +#undef HAVE_CPUID_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* Define to 1 if you have the `getaddrinfo' function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#undef HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the `gethostbyname' function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `iconv' function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the `iconv_close' function. */ +#undef HAVE_ICONV_CLOSE + +/* Define to 1 if you have the header file. */ +#undef HAVE_ICONV_H + +/* Define to 1 if you have the `iconv_open' function. */ +#undef HAVE_ICONV_OPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LANGINFO_H + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `localeconv' function. */ +#undef HAVE_LOCALECONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* define if the compiler implements L"widestring" */ +#undef HAVE_LSTRING + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_ENDIAN_H + +/* Define to 1 if you have the `mblen' function. */ +#undef HAVE_MBLEN + +/* Define to 1 if you have the `mbrlen' function. */ +#undef HAVE_MBRLEN + +/* Define to 1 if you have the `mbsrtowcs' function. */ +#undef HAVE_MBSRTOWCS + +/* Define to 1 if you have the `mbstowcs' function. */ +#undef HAVE_MBSTOWCS + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* define if the compiler implements namespaces */ +#undef HAVE_NAMESPACES + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the `nl_langinfo' function. */ +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define to 1 if you have the `pathconf' function. */ +#undef HAVE_PATHCONF + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* define if the compiler supports ISO C++ standard library */ +#undef HAVE_STD_LIBS + +/* define if the compiler supports the std namespace */ +#undef HAVE_STD_NAMESPACE + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `stricmp' function. */ +#undef HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strnicmp' function. */ +#undef HAVE_STRNICMP + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMEB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `towlower' function. */ +#undef HAVE_TOWLOWER + +/* Define to 1 if you have the `towupper' function. */ +#undef HAVE_TOWUPPER + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the `wcsicmp' function. */ +#undef HAVE_WCSICMP + +/* Define to 1 if you have the `wcslwr' function. */ +#undef HAVE_WCSLWR + +/* Define to 1 if you have the `wcsnicmp' function. */ +#undef HAVE_WCSNICMP + +/* Define to 1 if you have the `wcsrtombs' function. */ +#undef HAVE_WCSRTOMBS + +/* Define to 1 if you have the `wcstombs' function. */ +#undef HAVE_WCSTOMBS + +/* Define to 1 if you have the `wcsupr' function. */ +#undef HAVE_WCSUPR + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if you have to use const char* with iconv, to 0 if you must use + char*. */ +#undef ICONV_USES_CONST_POINTER + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `wchar_t', as computed by sizeof. */ +#undef SIZEOF_WCHAR_T + +/* The size of `__int64', as computed by sizeof. */ +#undef SIZEOF___INT64 + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to true if autoconf is used in this configuration */ +#undef XERCES_AUTOCONF + +/* Define if namespaces is supported by the compiler */ +#undef XERCES_HAS_CPP_NAMESPACE + +/* Define to have SSE2 instruction support detected at runtime using __cpuid + */ +#undef XERCES_HAVE_CPUID_INTRINSIC + +/* Define to 1 if you have emmintrin.h */ +#undef XERCES_HAVE_EMMINTRIN_H + +/* Define to have SSE2 instruction support detected at runtime using + __get_cpuid */ +#undef XERCES_HAVE_GETCPUID + +/* Define to 1 if you have intrin.h */ +#undef XERCES_HAVE_INTRIN_H + +/* Define to 1 if we have inttypes.h */ +#undef XERCES_HAVE_INTTYPES_H + +/* Define to have SSE2 instruction used at runtime */ +#undef XERCES_HAVE_SSE2_INTRINSIC + +/* Define to 1 if we have sys/types.h */ +#undef XERCES_HAVE_SYS_TYPES_H + +/* Define to have Xerces_autoconf_config.hpp include wchar.h */ +#undef XERCES_INCLUDE_WCHAR_H + +/* Define if there is support for L"widestring" */ +#undef XERCES_LSTRSUPPORT + +/* Define if the isstream library can be included as */ +#undef XERCES_NEW_IOSTREAMS + +/* Define to have XMemory.hpp avoid declaring a matching operator delete for + the placement operator new */ +#undef XERCES_NO_MATCHING_DELETE_OPERATOR + +/* Define if there is no native bool support in this environment */ +#undef XERCES_NO_NATIVE_BOOL + +/* Define to use backslash as an extra path delimiter character */ +#undef XERCES_PATH_DELIMITER_BACKSLASH + +/* Define as the platform's export attribute */ +#undef XERCES_PLATFORM_EXPORT + +/* Define as the platform's import attribute */ +#undef XERCES_PLATFORM_IMPORT + +/* An appropriate signed 16 bit integer type */ +#undef XERCES_S16BIT_INT + +/* An appropriate signed 32 bit integer type */ +#undef XERCES_S32BIT_INT + +/* An appropriate signed 64 bit integer type */ +#undef XERCES_S64BIT_INT + +/* Define as the appropriate size_t type */ +#undef XERCES_SIZE_T + +/* Define as the appropriate ssize_t type */ +#undef XERCES_SSIZE_T + +/* Define if the std namespace is supported */ +#undef XERCES_STD_NAMESPACE + +/* An appropriate unsigned 16 bit integer type */ +#undef XERCES_U16BIT_INT + +/* An appropriate unsigned 32 bit integer type */ +#undef XERCES_U32BIT_INT + +/* An appropriate unsigned 64 bit integer type */ +#undef XERCES_U64BIT_INT + +/* Define to use the POSIX file mgr */ +#undef XERCES_USE_FILEMGR_POSIX + +/* Define to use the Windows file mgr */ +#undef XERCES_USE_FILEMGR_WINDOWS + +/* Define to use the iconv-based MsgLoader */ +#undef XERCES_USE_MSGLOADER_ICONV + +/* Define to use the ICU-based MsgLoader */ +#undef XERCES_USE_MSGLOADER_ICU + +/* Define to use the InMemory MsgLoader */ +#undef XERCES_USE_MSGLOADER_INMEMORY + +/* Define to use the NoThread mutex mgr */ +#undef XERCES_USE_MUTEXMGR_NOTHREAD + +/* Define to use the POSIX mutex mgr */ +#undef XERCES_USE_MUTEXMGR_POSIX + +/* Define to use the Windows mutex mgr */ +#undef XERCES_USE_MUTEXMGR_WINDOWS + +/* Define to use the Mac OS X CFURL NetAccessor */ +#undef XERCES_USE_NETACCESSOR_CFURL + +/* Define to use the CURL NetAccessor */ +#undef XERCES_USE_NETACCESSOR_CURL + +/* Define to use the Sockets-based NetAccessor */ +#undef XERCES_USE_NETACCESSOR_SOCKET + +/* Define to use the WinSock NetAccessor */ +#undef XERCES_USE_NETACCESSOR_WINSOCK + +/* Define to use the GNU iconv transcoder */ +#undef XERCES_USE_TRANSCODER_GNUICONV + +/* Define to use the iconv transcoder */ +#undef XERCES_USE_TRANSCODER_ICONV + +/* Define to use the ICU-based transcoder */ +#undef XERCES_USE_TRANSCODER_ICU + +/* Define to use the Mac OS UnicodeConverter-based transcoder */ +#undef XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER + +/* Define to use the Windows transcoder */ +#undef XERCES_USE_TRANSCODER_WINDOWS + +/* Define to the 16 bit type used to represent Xerces UTF-16 characters */ +#undef XERCES_XMLCH_T + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile diff --git a/project/jni/xerces/config.h.old b/project/jni/xerces/config.h.old new file mode 100644 index 000000000..5953e907a --- /dev/null +++ b/project/jni/xerces/config.h.old @@ -0,0 +1,489 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to specify no threading is used */ +/* #undef APP_NO_THREADS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ + +/* define if bool is a built-in type */ +#define HAVE_BOOL /**/ + +/* Define to 1 if you have the `catclose' function. */ +/* #undef HAVE_CATCLOSE */ + +/* Define to 1 if you have the `catgets' function. */ +/* #undef HAVE_CATGETS */ + +/* Define to 1 if you have the `catopen' function. */ +/* #undef HAVE_CATOPEN */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CORESERVICES_CORESERVICES_H */ + +/* Define to 1 if you have cpuid.h */ +/* #undef HAVE_CPUID_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `ftime' function. */ +#define HAVE_FTIME 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `iconv' function. */ +/* #undef HAVE_ICONV */ + +/* Define to 1 if you have the `iconv_close' function. */ +/* #undef HAVE_ICONV_CLOSE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ICONV_H 1 + +/* Define to 1 if you have the `iconv_open' function. */ +/* #undef HAVE_ICONV_OPEN */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LANGINFO_H */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localeconv' function. */ +/* #undef HAVE_LOCALECONV */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* define if the compiler implements L"widestring" */ +#define HAVE_LSTRING /**/ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if you have the `mblen' function. */ +/* #undef HAVE_MBLEN */ + +/* Define to 1 if you have the `mbrlen' function. */ +#define HAVE_MBRLEN 1 + +/* Define to 1 if you have the `mbsrtowcs' function. */ +#define HAVE_MBSRTOWCS 1 + +/* Define to 1 if you have the `mbstowcs' function. */ +/* #undef HAVE_MBSTOWCS */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES /**/ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `nl_langinfo' function. */ +/* #undef HAVE_NL_LANGINFO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NL_TYPES_H */ + +/* Define to 1 if you have the `pathconf' function. */ +#define HAVE_PATHCONF 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* define if the compiler supports ISO C++ standard library */ +/* #undef HAVE_STD_LIBS */ + +/* define if the compiler supports the std namespace */ +/* #undef HAVE_STD_NAMESPACE */ + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strnicmp' function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `towlower' function. */ +#define HAVE_TOWLOWER 1 + +/* Define to 1 if you have the `towupper' function. */ +#define HAVE_TOWUPPER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcsicmp' function. */ +/* #undef HAVE_WCSICMP */ + +/* Define to 1 if you have the `wcslwr' function. */ +/* #undef HAVE_WCSLWR */ + +/* Define to 1 if you have the `wcsnicmp' function. */ +/* #undef HAVE_WCSNICMP */ + +/* Define to 1 if you have the `wcsrtombs' function. */ +#define HAVE_WCSRTOMBS 1 + +/* Define to 1 if you have the `wcstombs' function. */ +/* #undef HAVE_WCSTOMBS */ + +/* Define to 1 if you have the `wcsupr' function. */ +/* #undef HAVE_WCSUPR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if the system has the type `_Bool'. */ +/* #undef HAVE__BOOL */ + +/* Define to 1 if you have to use const char* with iconv, to 0 if you must use + char*. */ +#define ICONV_USES_CONST_POINTER 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "xerces-c" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "xerces-c" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "xerces-c 3.1.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xerces-c" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.1.1" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 0 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "3.1.1" + +/* Define to true if autoconf is used in this configuration */ +#define XERCES_AUTOCONF 1 + +/* Define if namespaces is supported by the compiler */ +#define XERCES_HAS_CPP_NAMESPACE 1 + +/* Define to have SSE2 instruction support detected at runtime using __cpuid + */ +/* #undef XERCES_HAVE_CPUID_INTRINSIC */ + +/* Define to 1 if you have emmintrin.h */ +/* #undef XERCES_HAVE_EMMINTRIN_H */ + +/* Define to have SSE2 instruction support detected at runtime using + __get_cpuid */ +/* #undef XERCES_HAVE_GETCPUID */ + +/* Define to 1 if you have intrin.h */ +/* #undef XERCES_HAVE_INTRIN_H */ + +/* Define to 1 if we have inttypes.h */ +#define XERCES_HAVE_INTTYPES_H 1 + +/* Define to have SSE2 instruction used at runtime */ +/* #undef XERCES_HAVE_SSE2_INTRINSIC */ + +/* Define to 1 if we have sys/types.h */ +#define XERCES_HAVE_SYS_TYPES_H 1 + +/* Define to have Xerces_autoconf_config.hpp include wchar.h */ +/* #undef XERCES_INCLUDE_WCHAR_H */ + +/* Define if there is support for L"widestring" */ +#define XERCES_LSTRSUPPORT 1 + +/* Define if the isstream library can be included as */ +/* #undef XERCES_NEW_IOSTREAMS */ + +/* Define to have XMemory.hpp avoid declaring a matching operator delete for + the placement operator new */ +/* #undef XERCES_NO_MATCHING_DELETE_OPERATOR */ + +/* Define if there is no native bool support in this environment */ +/* #undef XERCES_NO_NATIVE_BOOL */ + +/* Define to use backslash as an extra path delimiter character */ +/* #undef XERCES_PATH_DELIMITER_BACKSLASH */ + +/* Define as the platform's export attribute */ +#define XERCES_PLATFORM_EXPORT + +/* Define as the platform's import attribute */ +#define XERCES_PLATFORM_IMPORT + +/* An appropriate signed 16 bit integer type */ +#define XERCES_S16BIT_INT int16_t + +/* An appropriate signed 32 bit integer type */ +#define XERCES_S32BIT_INT int32_t + +/* An appropriate signed 64 bit integer type */ +#define XERCES_S64BIT_INT int64_t + +/* Define as the appropriate size_t type */ +#define XERCES_SIZE_T size_t + +/* Define as the appropriate ssize_t type */ +#define XERCES_SSIZE_T ssize_t + +/* Define if the std namespace is supported */ +/* #undef XERCES_STD_NAMESPACE */ + +/* An appropriate unsigned 16 bit integer type */ +#define XERCES_U16BIT_INT uint16_t + +/* An appropriate unsigned 32 bit integer type */ +#define XERCES_U32BIT_INT uint32_t + +/* An appropriate unsigned 64 bit integer type */ +#define XERCES_U64BIT_INT uint64_t + +/* Define to use the POSIX file mgr */ +#define XERCES_USE_FILEMGR_POSIX 1 + +/* Define to use the Windows file mgr */ +/* #undef XERCES_USE_FILEMGR_WINDOWS */ + +/* Define to use the iconv-based MsgLoader */ +/* #undef XERCES_USE_MSGLOADER_ICONV */ + +/* Define to use the ICU-based MsgLoader */ +/* #undef XERCES_USE_MSGLOADER_ICU */ + +/* Define to use the InMemory MsgLoader */ +#define XERCES_USE_MSGLOADER_INMEMORY 1 + +/* Define to use the NoThread mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_NOTHREAD */ + +/* Define to use the POSIX mutex mgr */ +#define XERCES_USE_MUTEXMGR_POSIX 1 + +/* Define to use the Windows mutex mgr */ +/* #undef XERCES_USE_MUTEXMGR_WINDOWS */ + +/* Define to use the Mac OS X CFURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CFURL */ + +/* Define to use the CURL NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_CURL */ + +/* Define to use the Sockets-based NetAccessor */ +#define XERCES_USE_NETACCESSOR_SOCKET 1 + +/* Define to use the WinSock NetAccessor */ +/* #undef XERCES_USE_NETACCESSOR_WINSOCK */ + +/* Define to use the GNU iconv transcoder */ +#define XERCES_USE_TRANSCODER_GNUICONV 1 + +/* Define to use the iconv transcoder */ +/* #undef XERCES_USE_TRANSCODER_ICONV */ + +/* Define to use the ICU-based transcoder */ +/* #undef XERCES_USE_TRANSCODER_ICU */ + +/* Define to use the Mac OS UnicodeConverter-based transcoder */ +/* #undef XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER */ + +/* Define to use the Windows transcoder */ +/* #undef XERCES_USE_TRANSCODER_WINDOWS */ + +/* Define to the 16 bit type used to represent Xerces UTF-16 characters */ +#define XERCES_XMLCH_T uint16_t + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +/* #undef volatile */ diff --git a/project/jni/xerces/iconv/iconv.h b/project/jni/xerces/iconv/iconv.h new file mode 100644 index 000000000..ffbe8eda2 --- /dev/null +++ b/project/jni/xerces/iconv/iconv.h @@ -0,0 +1,22 @@ +// SDL_iconv >> iconv wrapper dummy +#ifndef DUMMY_ICONV_H +#define DUMMY_ICONV_H + +#undef HAVE_ICONV +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define iconv_t SDL_iconv_t +#define iconv SDL_iconv +#define iconv_open SDL_iconv_open +#define iconv_close SDL_iconv_close + +#ifdef __cplusplus +} +#endif + +#define HAVE_ICONV 1 + +#endif diff --git a/project/jni/xerces/src/Makefile b/project/jni/xerces/src/Makefile new file mode 100644 index 000000000..93f8ce78a --- /dev/null +++ b/project/jni/xerces/src/Makefile @@ -0,0 +1,4980 @@ +# Makefile.in generated by automake 1.11 from Makefile.am. +# src/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +# +# 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: Makefile.am 883272 2009-11-23 08:17:49Z borisk $ +# + + + +pkgdatadir = $(datadir)/xerces-c +pkgincludedir = $(includedir)/xerces-c +pkglibdir = $(libdir)/xerces-c +pkglibexecdir = $(libexecdir)/xerces-c +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = i386-apple-darwin9.8.0 +host_triplet = arm-unknown-eabi + +# NetAccessors, conditionally built based on settings from configure +# +#am__append_1 = ${curl_sources} +#am__append_2 = ${curl_headers} +#am__append_3 = ${CURL_FLAGS} +am__append_4 = ${sockets_sources} +am__append_5 = ${sockets_headers} +#am__append_6 = ${cfurl_sources} +#am__append_7 = ${cfurl_headers} +#am__append_8 = ${winsock_sources} +#am__append_9 = ${winsock_headers} + +# Transcoders, conditionally built based on settings from configure +# +#am__append_10 = ${icu_sources} +#am__append_11 = ${icu_headers} +#am__append_12 = ${ICU_FLAGS} +am__append_13 = ${gnuiconv_sources} +am__append_14 = ${gnuiconv_headers} +#am__append_15 = ${iconv_sources} +#am__append_16 = ${iconv_headers} +#am__append_17 = ${macosunicodeconverter_sources} +#am__append_18 = ${macosunicodeconverter_headers} +#am__append_19 = ${wintrans_sources} +#am__append_20 = ${wintrans_headers} + +# MsgLoaders, conditionally built based on settings from configure +# +am__append_21 = ${msginmemory_sources} +am__append_22 = ${msginmemory_headers} +#am__append_23 = ${msgicu_sources} +#am__append_24 = ${msgicu_headers} +#am__append_25 = ${ICU_FLAGS} +#am__append_26 = xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt \ +#xercesc/util/MsgLoaders/ICU/resources/root.txt + +#am__append_27 = ${msgiconv_sources} +#am__append_28 = ${msgiconv_headers} +#am__append_29 = xercesc/util/MsgLoaders/MsgCatalog + +# Mutex Managers, conditionally built based on settings from configure +# +#am__append_30 = ${nothreadmmgr_sources} +#am__append_31 = ${nothreadmmgr_headers} +am__append_32 = ${posixmmgr_sources} +am__append_33 = ${posixmmgr_headers} +#am__append_34 = ${winmmgr_sources} +#am__append_35 = ${winmmgr_headers} + +# File Managers, conditionally built based on settings from configure +# +am__append_36 = ${posixfmgr_sources} +am__append_37 = ${posixfmgr_headers} +#am__append_38 = ${winfmgr_sources} +#am__append_39 = ${winfmgr_headers} +subdir = src +DIST_COMMON = $(am__nobase_libxerces_c_la_HEADERS_DIST) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in stricmp.c \ + strnicmp.c towlower.c towupper.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/cxx_have_bool.m4 \ + $(top_srcdir)/m4/cxx_have_lstring.m4 \ + $(top_srcdir)/m4/cxx_have_namespaces.m4 \ + $(top_srcdir)/m4/cxx_have_std_libs.m4 \ + $(top_srcdir)/m4/cxx_have_std_namespace.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/xerces_curl_prefix.m4 \ + $(top_srcdir)/m4/xerces_filemgr_selection.m4 \ + $(top_srcdir)/m4/xerces_icu_prefix.m4 \ + $(top_srcdir)/m4/xerces_int_types.m4 \ + $(top_srcdir)/m4/xerces_link_darwin_framework.m4 \ + $(top_srcdir)/m4/xerces_msgloader_selection.m4 \ + $(top_srcdir)/m4/xerces_mutexmgr_selection.m4 \ + $(top_srcdir)/m4/xerces_netaccessor_selection.m4 \ + $(top_srcdir)/m4/xerces_no_threads.m4 \ + $(top_srcdir)/m4/xerces_path_delimiters.m4 \ + $(top_srcdir)/m4/xerces_pretty_make.m4 \ + $(top_srcdir)/m4/xerces_transcoder_selection.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/xercesc/util/Xerces_autoconf_config.hpp +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" \ + "$(DESTDIR)$(libxerces_c_ladir)" \ + "$(DESTDIR)$(autoconfheadersdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libxerces_c_la_DEPENDENCIES = $(LTLIBOBJS) +am__libxerces_c_la_SOURCES_DIST = xercesc/util/Base64.cpp \ + xercesc/util/BinFileInputStream.cpp \ + xercesc/util/BinInputStream.cpp \ + xercesc/util/BinMemInputStream.cpp xercesc/util/BitSet.cpp \ + xercesc/util/DefaultPanicHandler.cpp \ + xercesc/util/EncodingValidator.cpp \ + xercesc/util/HeaderDummy.cpp xercesc/util/HexBin.cpp \ + xercesc/util/KVStringPair.cpp xercesc/util/Mutexes.cpp \ + xercesc/util/PanicHandler.cpp xercesc/util/PlatformUtils.cpp \ + xercesc/util/PSVIUni.cpp xercesc/util/QName.cpp \ + xercesc/util/regx/ASCIIRangeFactory.cpp \ + xercesc/util/regx/BlockRangeFactory.cpp \ + xercesc/util/regx/BMPattern.cpp \ + xercesc/util/regx/CharToken.cpp \ + xercesc/util/regx/ClosureToken.cpp \ + xercesc/util/regx/ConcatToken.cpp xercesc/util/regx/Match.cpp \ + xercesc/util/regx/Op.cpp xercesc/util/regx/OpFactory.cpp \ + xercesc/util/regx/ParenToken.cpp \ + xercesc/util/regx/ParserForXMLSchema.cpp \ + xercesc/util/regx/RangeFactory.cpp \ + xercesc/util/regx/RangeToken.cpp \ + xercesc/util/regx/RangeTokenMap.cpp \ + xercesc/util/regx/RegularExpression.cpp \ + xercesc/util/regx/RegxParser.cpp \ + xercesc/util/regx/RegxUtil.cpp \ + xercesc/util/regx/StringToken.cpp xercesc/util/regx/Token.cpp \ + xercesc/util/regx/TokenFactory.cpp \ + xercesc/util/regx/UnicodeRangeFactory.cpp \ + xercesc/util/regx/UnionToken.cpp \ + xercesc/util/regx/XMLRangeFactory.cpp \ + xercesc/util/regx/XMLUniCharacter.cpp \ + xercesc/util/StringPool.cpp \ + xercesc/util/SynchronizedStringPool.cpp \ + xercesc/util/TransService.cpp xercesc/util/XMemory.cpp \ + xercesc/util/XML256TableTranscoder.cpp \ + xercesc/util/XML88591Transcoder.cpp \ + xercesc/util/XMLAbstractDoubleFloat.cpp \ + xercesc/util/XMLASCIITranscoder.cpp \ + xercesc/util/XMLBigDecimal.cpp xercesc/util/XMLBigInteger.cpp \ + xercesc/util/XMLChar.cpp xercesc/util/XMLChTranscoder.cpp \ + xercesc/util/XMLDateTime.cpp xercesc/util/XMLDouble.cpp \ + xercesc/util/XMLEBCDICTranscoder.cpp \ + xercesc/util/XMLException.cpp xercesc/util/XMLFloat.cpp \ + xercesc/util/XMLIBM1047Transcoder.cpp \ + xercesc/util/XMLIBM1140Transcoder.cpp \ + xercesc/util/XMLInitializer.cpp xercesc/util/XMLMsgLoader.cpp \ + xercesc/util/XMLNumber.cpp xercesc/util/XMLString.cpp \ + xercesc/util/XMLStringTokenizer.cpp \ + xercesc/util/XMLUCS4Transcoder.cpp xercesc/util/XMLUni.cpp \ + xercesc/util/XMLUri.cpp xercesc/util/XMLURL.cpp \ + xercesc/util/XMLUTF16Transcoder.cpp \ + xercesc/util/XMLUTF8Transcoder.cpp \ + xercesc/util/XMLWin1252Transcoder.cpp \ + xercesc/dom/DOMException.cpp xercesc/dom/DOMLSException.cpp \ + xercesc/dom/DOMRangeException.cpp \ + xercesc/dom/DOMXPathException.cpp \ + xercesc/dom/impl/DOMAttrImpl.cpp \ + xercesc/dom/impl/DOMAttrMapImpl.cpp \ + xercesc/dom/impl/DOMAttrNSImpl.cpp \ + xercesc/dom/impl/DOMCDATASectionImpl.cpp \ + xercesc/dom/impl/DOMCharacterDataImpl.cpp \ + xercesc/dom/impl/DOMChildNode.cpp \ + xercesc/dom/impl/DOMCommentImpl.cpp \ + xercesc/dom/impl/DOMConfigurationImpl.cpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.cpp \ + xercesc/dom/impl/DOMDocumentFragmentImpl.cpp \ + xercesc/dom/impl/DOMDocumentImpl.cpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.cpp \ + xercesc/dom/impl/DOMElementImpl.cpp \ + xercesc/dom/impl/DOMElementNSImpl.cpp \ + xercesc/dom/impl/DOMEntityImpl.cpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.cpp \ + xercesc/dom/impl/DOMErrorImpl.cpp \ + xercesc/dom/impl/DOMImplementationImpl.cpp \ + xercesc/dom/impl/DOMImplementationListImpl.cpp \ + xercesc/dom/impl/DOMImplementationRegistry.cpp \ + xercesc/dom/impl/DOMLocatorImpl.cpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.cpp \ + xercesc/dom/impl/DOMNodeIDMap.cpp \ + xercesc/dom/impl/DOMNodeImpl.cpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.cpp \ + xercesc/dom/impl/DOMNodeListImpl.cpp \ + xercesc/dom/impl/DOMNodeVector.cpp \ + xercesc/dom/impl/DOMNormalizer.cpp \ + xercesc/dom/impl/DOMNotationImpl.cpp \ + xercesc/dom/impl/DOMParentNode.cpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.cpp \ + xercesc/dom/impl/DOMRangeImpl.cpp \ + xercesc/dom/impl/DOMStringListImpl.cpp \ + xercesc/dom/impl/DOMStringPool.cpp \ + xercesc/dom/impl/DOMTextImpl.cpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.cpp \ + xercesc/dom/impl/DOMTypeInfoImpl.cpp \ + xercesc/dom/impl/DOMLSSerializerImpl.cpp \ + xercesc/dom/impl/DOMLSInputImpl.cpp \ + xercesc/dom/impl/DOMLSOutputImpl.cpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.cpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.cpp \ + xercesc/dom/impl/DOMXPathResultImpl.cpp \ + xercesc/dom/impl/XSDElementNSImpl.cpp \ + xercesc/framework/BinOutputStream.cpp \ + xercesc/framework/LocalFileFormatTarget.cpp \ + xercesc/framework/LocalFileInputSource.cpp \ + xercesc/framework/MemBufFormatTarget.cpp \ + xercesc/framework/MemBufInputSource.cpp \ + xercesc/framework/psvi/PSVIAttribute.cpp \ + xercesc/framework/psvi/PSVIAttributeList.cpp \ + xercesc/framework/psvi/PSVIElement.cpp \ + xercesc/framework/psvi/PSVIItem.cpp \ + xercesc/framework/psvi/XSAnnotation.cpp \ + xercesc/framework/psvi/XSAttributeDeclaration.cpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.cpp \ + xercesc/framework/psvi/XSAttributeUse.cpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.cpp \ + xercesc/framework/psvi/XSElementDeclaration.cpp \ + xercesc/framework/psvi/XSFacet.cpp \ + xercesc/framework/psvi/XSIDCDefinition.cpp \ + xercesc/framework/psvi/XSModel.cpp \ + xercesc/framework/psvi/XSModelGroup.cpp \ + xercesc/framework/psvi/XSModelGroupDefinition.cpp \ + xercesc/framework/psvi/XSMultiValueFacet.cpp \ + xercesc/framework/psvi/XSNamespaceItem.cpp \ + xercesc/framework/psvi/XSNotationDeclaration.cpp \ + xercesc/framework/psvi/XSObject.cpp \ + xercesc/framework/psvi/XSParticle.cpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.cpp \ + xercesc/framework/psvi/XSTypeDefinition.cpp \ + xercesc/framework/psvi/XSValue.cpp \ + xercesc/framework/psvi/XSWildcard.cpp \ + xercesc/framework/StdInInputSource.cpp \ + xercesc/framework/StdOutFormatTarget.cpp \ + xercesc/framework/URLInputSource.cpp \ + xercesc/framework/Wrapper4DOMLSInput.cpp \ + xercesc/framework/Wrapper4InputSource.cpp \ + xercesc/framework/XMLAttDef.cpp \ + xercesc/framework/XMLAttDefList.cpp \ + xercesc/framework/XMLAttr.cpp xercesc/framework/XMLBuffer.cpp \ + xercesc/framework/XMLBufferMgr.cpp \ + xercesc/framework/XMLContentModel.cpp \ + xercesc/framework/XMLDTDDescription.cpp \ + xercesc/framework/XMLElementDecl.cpp \ + xercesc/framework/XMLEntityDecl.cpp \ + xercesc/framework/XMLFormatter.cpp \ + xercesc/framework/XMLGrammarDescription.cpp \ + xercesc/framework/XMLGrammarPoolImpl.cpp \ + xercesc/framework/XMLNotationDecl.cpp \ + xercesc/framework/XMLRecognizer.cpp \ + xercesc/framework/XMLRefInfo.cpp \ + xercesc/framework/XMLSchemaDescription.cpp \ + xercesc/framework/XMLValidator.cpp \ + xercesc/internal/BinFileOutputStream.cpp \ + xercesc/internal/BinMemOutputStream.cpp \ + xercesc/internal/DGXMLScanner.cpp \ + xercesc/internal/ElemStack.cpp \ + xercesc/internal/IGXMLScanner.cpp \ + xercesc/internal/IGXMLScanner2.cpp \ + xercesc/internal/MemoryManagerImpl.cpp \ + xercesc/internal/ReaderMgr.cpp \ + xercesc/internal/SGXMLScanner.cpp \ + xercesc/internal/ValidationContextImpl.cpp \ + xercesc/internal/VecAttributesImpl.cpp \ + xercesc/internal/VecAttrListImpl.cpp \ + xercesc/internal/WFXMLScanner.cpp \ + xercesc/internal/XMLReader.cpp xercesc/internal/XMLScanner.cpp \ + xercesc/internal/XMLScannerResolver.cpp \ + xercesc/internal/XProtoType.cpp \ + xercesc/internal/XSAXMLScanner.cpp \ + xercesc/internal/XSerializeEngine.cpp \ + xercesc/internal/XSObjectFactory.cpp \ + xercesc/internal/XTemplateSerializer.cpp \ + xercesc/parsers/AbstractDOMParser.cpp \ + xercesc/parsers/DOMLSParserImpl.cpp \ + xercesc/parsers/SAX2XMLFilterImpl.cpp \ + xercesc/parsers/SAX2XMLReaderImpl.cpp \ + xercesc/parsers/SAXParser.cpp \ + xercesc/parsers/XercesDOMParser.cpp xercesc/sax/Dummy.cpp \ + xercesc/sax/InputSource.cpp xercesc/sax/SAXException.cpp \ + xercesc/sax/SAXParseException.cpp xercesc/sax2/sax2Dummy.cpp \ + xercesc/validators/common/AllContentModel.cpp \ + xercesc/validators/common/CMAny.cpp \ + xercesc/validators/common/CMBinaryOp.cpp \ + xercesc/validators/common/CMUnaryOp.cpp \ + xercesc/validators/common/ContentLeafNameTypeVector.cpp \ + xercesc/validators/common/ContentSpecNode.cpp \ + xercesc/validators/common/DFAContentModel.cpp \ + xercesc/validators/common/Grammar.cpp \ + xercesc/validators/common/GrammarResolver.cpp \ + xercesc/validators/common/MixedContentModel.cpp \ + xercesc/validators/common/SimpleContentModel.cpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.cpp \ + xercesc/validators/datatype/AbstractNumericValidator.cpp \ + xercesc/validators/datatype/AbstractStringValidator.cpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.cpp \ + xercesc/validators/datatype/DateDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeValidator.cpp \ + xercesc/validators/datatype/DayDatatypeValidator.cpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.cpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.cpp \ + xercesc/validators/datatype/DurationDatatypeValidator.cpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.cpp \ + xercesc/validators/datatype/FloatDatatypeValidator.cpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/IDDatatypeValidator.cpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.cpp \ + xercesc/validators/datatype/ListDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.cpp \ + xercesc/validators/datatype/NameDatatypeValidator.cpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.cpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp \ + xercesc/validators/datatype/QNameDatatypeValidator.cpp \ + xercesc/validators/datatype/StringDatatypeValidator.cpp \ + xercesc/validators/datatype/TimeDatatypeValidator.cpp \ + xercesc/validators/datatype/UnionDatatypeValidator.cpp \ + xercesc/validators/datatype/XMLCanRepGroup.cpp \ + xercesc/validators/datatype/YearDatatypeValidator.cpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.cpp \ + xercesc/validators/DTD/DTDAttDef.cpp \ + xercesc/validators/DTD/DTDAttDefList.cpp \ + xercesc/validators/DTD/DTDElementDecl.cpp \ + xercesc/validators/DTD/DTDEntityDecl.cpp \ + xercesc/validators/DTD/DTDGrammar.cpp \ + xercesc/validators/DTD/DTDScanner.cpp \ + xercesc/validators/DTD/DTDValidator.cpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp \ + xercesc/validators/schema/ComplexTypeInfo.cpp \ + xercesc/validators/schema/GeneralAttributeCheck.cpp \ + xercesc/validators/schema/identity/FieldActivator.cpp \ + xercesc/validators/schema/identity/FieldValueMap.cpp \ + xercesc/validators/schema/identity/IC_Field.cpp \ + xercesc/validators/schema/identity/IC_Key.cpp \ + xercesc/validators/schema/identity/IC_KeyRef.cpp \ + xercesc/validators/schema/identity/IC_Selector.cpp \ + xercesc/validators/schema/identity/IC_Unique.cpp \ + xercesc/validators/schema/identity/IdentityConstraint.cpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.cpp \ + xercesc/validators/schema/identity/ValueStore.cpp \ + xercesc/validators/schema/identity/ValueStoreCache.cpp \ + xercesc/validators/schema/identity/XercesXPath.cpp \ + xercesc/validators/schema/identity/XPathMatcher.cpp \ + xercesc/validators/schema/identity/XPathMatcherStack.cpp \ + xercesc/validators/schema/identity/XPathSymbols.cpp \ + xercesc/validators/schema/NamespaceScope.cpp \ + xercesc/validators/schema/SchemaAttDef.cpp \ + xercesc/validators/schema/SchemaAttDefList.cpp \ + xercesc/validators/schema/SchemaElementDecl.cpp \ + xercesc/validators/schema/SchemaGrammar.cpp \ + xercesc/validators/schema/SchemaInfo.cpp \ + xercesc/validators/schema/SchemaSymbols.cpp \ + xercesc/validators/schema/SchemaValidator.cpp \ + xercesc/validators/schema/SubstitutionGroupComparator.cpp \ + xercesc/validators/schema/TraverseSchema.cpp \ + xercesc/validators/schema/XercesAttGroupInfo.cpp \ + xercesc/validators/schema/XercesElementWildcard.cpp \ + xercesc/validators/schema/XercesGroupInfo.cpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp \ + xercesc/validators/schema/XSDDOMParser.cpp \ + xercesc/validators/schema/XSDErrorReporter.cpp \ + xercesc/validators/schema/XSDLocator.cpp \ + xercesc/validators/schema/XUtil.cpp \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp \ + xercesc/xinclude/XIncludeLocation.cpp \ + xercesc/xinclude/XIncludeUtils.cpp \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.cpp \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp \ + xercesc/util/Transcoders/ICU/ICUTransService.cpp \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp \ + xercesc/util/Transcoders/Iconv/IconvTransService.cpp \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp \ + xercesc/util/Transcoders/Win32/Win32TransService.cpp \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp \ + xercesc/util/MutexManagers/NoThreadMutexMgr.cpp \ + xercesc/util/MutexManagers/PosixMutexMgr.cpp \ + xercesc/util/MutexManagers/WindowsMutexMgr.cpp \ + xercesc/util/FileManagers/PosixFileMgr.cpp \ + xercesc/util/FileManagers/WindowsFileMgr.cpp +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = xercesc/util/Base64.lo \ + xercesc/util/BinFileInputStream.lo \ + xercesc/util/BinInputStream.lo \ + xercesc/util/BinMemInputStream.lo xercesc/util/BitSet.lo \ + xercesc/util/DefaultPanicHandler.lo \ + xercesc/util/EncodingValidator.lo xercesc/util/HeaderDummy.lo \ + xercesc/util/HexBin.lo xercesc/util/KVStringPair.lo \ + xercesc/util/Mutexes.lo xercesc/util/PanicHandler.lo \ + xercesc/util/PlatformUtils.lo xercesc/util/PSVIUni.lo \ + xercesc/util/QName.lo xercesc/util/regx/ASCIIRangeFactory.lo \ + xercesc/util/regx/BlockRangeFactory.lo \ + xercesc/util/regx/BMPattern.lo xercesc/util/regx/CharToken.lo \ + xercesc/util/regx/ClosureToken.lo \ + xercesc/util/regx/ConcatToken.lo xercesc/util/regx/Match.lo \ + xercesc/util/regx/Op.lo xercesc/util/regx/OpFactory.lo \ + xercesc/util/regx/ParenToken.lo \ + xercesc/util/regx/ParserForXMLSchema.lo \ + xercesc/util/regx/RangeFactory.lo \ + xercesc/util/regx/RangeToken.lo \ + xercesc/util/regx/RangeTokenMap.lo \ + xercesc/util/regx/RegularExpression.lo \ + xercesc/util/regx/RegxParser.lo xercesc/util/regx/RegxUtil.lo \ + xercesc/util/regx/StringToken.lo xercesc/util/regx/Token.lo \ + xercesc/util/regx/TokenFactory.lo \ + xercesc/util/regx/UnicodeRangeFactory.lo \ + xercesc/util/regx/UnionToken.lo \ + xercesc/util/regx/XMLRangeFactory.lo \ + xercesc/util/regx/XMLUniCharacter.lo \ + xercesc/util/StringPool.lo \ + xercesc/util/SynchronizedStringPool.lo \ + xercesc/util/TransService.lo xercesc/util/XMemory.lo \ + xercesc/util/XML256TableTranscoder.lo \ + xercesc/util/XML88591Transcoder.lo \ + xercesc/util/XMLAbstractDoubleFloat.lo \ + xercesc/util/XMLASCIITranscoder.lo \ + xercesc/util/XMLBigDecimal.lo xercesc/util/XMLBigInteger.lo \ + xercesc/util/XMLChar.lo xercesc/util/XMLChTranscoder.lo \ + xercesc/util/XMLDateTime.lo xercesc/util/XMLDouble.lo \ + xercesc/util/XMLEBCDICTranscoder.lo \ + xercesc/util/XMLException.lo xercesc/util/XMLFloat.lo \ + xercesc/util/XMLIBM1047Transcoder.lo \ + xercesc/util/XMLIBM1140Transcoder.lo \ + xercesc/util/XMLInitializer.lo xercesc/util/XMLMsgLoader.lo \ + xercesc/util/XMLNumber.lo xercesc/util/XMLString.lo \ + xercesc/util/XMLStringTokenizer.lo \ + xercesc/util/XMLUCS4Transcoder.lo xercesc/util/XMLUni.lo \ + xercesc/util/XMLUri.lo xercesc/util/XMLURL.lo \ + xercesc/util/XMLUTF16Transcoder.lo \ + xercesc/util/XMLUTF8Transcoder.lo \ + xercesc/util/XMLWin1252Transcoder.lo +am__objects_2 = xercesc/dom/DOMException.lo \ + xercesc/dom/DOMLSException.lo xercesc/dom/DOMRangeException.lo \ + xercesc/dom/DOMXPathException.lo +am__objects_3 = xercesc/dom/impl/DOMAttrImpl.lo \ + xercesc/dom/impl/DOMAttrMapImpl.lo \ + xercesc/dom/impl/DOMAttrNSImpl.lo \ + xercesc/dom/impl/DOMCDATASectionImpl.lo \ + xercesc/dom/impl/DOMCharacterDataImpl.lo \ + xercesc/dom/impl/DOMChildNode.lo \ + xercesc/dom/impl/DOMCommentImpl.lo \ + xercesc/dom/impl/DOMConfigurationImpl.lo \ + xercesc/dom/impl/DOMDeepNodeListImpl.lo \ + xercesc/dom/impl/DOMDocumentFragmentImpl.lo \ + xercesc/dom/impl/DOMDocumentImpl.lo \ + xercesc/dom/impl/DOMDocumentTypeImpl.lo \ + xercesc/dom/impl/DOMElementImpl.lo \ + xercesc/dom/impl/DOMElementNSImpl.lo \ + xercesc/dom/impl/DOMEntityImpl.lo \ + xercesc/dom/impl/DOMEntityReferenceImpl.lo \ + xercesc/dom/impl/DOMErrorImpl.lo \ + xercesc/dom/impl/DOMImplementationImpl.lo \ + xercesc/dom/impl/DOMImplementationListImpl.lo \ + xercesc/dom/impl/DOMImplementationRegistry.lo \ + xercesc/dom/impl/DOMLocatorImpl.lo \ + xercesc/dom/impl/DOMNamedNodeMapImpl.lo \ + xercesc/dom/impl/DOMNodeIDMap.lo \ + xercesc/dom/impl/DOMNodeImpl.lo \ + xercesc/dom/impl/DOMNodeIteratorImpl.lo \ + xercesc/dom/impl/DOMNodeListImpl.lo \ + xercesc/dom/impl/DOMNodeVector.lo \ + xercesc/dom/impl/DOMNormalizer.lo \ + xercesc/dom/impl/DOMNotationImpl.lo \ + xercesc/dom/impl/DOMParentNode.lo \ + xercesc/dom/impl/DOMProcessingInstructionImpl.lo \ + xercesc/dom/impl/DOMRangeImpl.lo \ + xercesc/dom/impl/DOMStringListImpl.lo \ + xercesc/dom/impl/DOMStringPool.lo \ + xercesc/dom/impl/DOMTextImpl.lo \ + xercesc/dom/impl/DOMTreeWalkerImpl.lo \ + xercesc/dom/impl/DOMTypeInfoImpl.lo \ + xercesc/dom/impl/DOMLSSerializerImpl.lo \ + xercesc/dom/impl/DOMLSInputImpl.lo \ + xercesc/dom/impl/DOMLSOutputImpl.lo \ + xercesc/dom/impl/DOMXPathExpressionImpl.lo \ + xercesc/dom/impl/DOMXPathNSResolverImpl.lo \ + xercesc/dom/impl/DOMXPathResultImpl.lo \ + xercesc/dom/impl/XSDElementNSImpl.lo +am__objects_4 = xercesc/framework/BinOutputStream.lo \ + xercesc/framework/LocalFileFormatTarget.lo \ + xercesc/framework/LocalFileInputSource.lo \ + xercesc/framework/MemBufFormatTarget.lo \ + xercesc/framework/MemBufInputSource.lo \ + xercesc/framework/psvi/PSVIAttribute.lo \ + xercesc/framework/psvi/PSVIAttributeList.lo \ + xercesc/framework/psvi/PSVIElement.lo \ + xercesc/framework/psvi/PSVIItem.lo \ + xercesc/framework/psvi/XSAnnotation.lo \ + xercesc/framework/psvi/XSAttributeDeclaration.lo \ + xercesc/framework/psvi/XSAttributeGroupDefinition.lo \ + xercesc/framework/psvi/XSAttributeUse.lo \ + xercesc/framework/psvi/XSComplexTypeDefinition.lo \ + xercesc/framework/psvi/XSElementDeclaration.lo \ + xercesc/framework/psvi/XSFacet.lo \ + xercesc/framework/psvi/XSIDCDefinition.lo \ + xercesc/framework/psvi/XSModel.lo \ + xercesc/framework/psvi/XSModelGroup.lo \ + xercesc/framework/psvi/XSModelGroupDefinition.lo \ + xercesc/framework/psvi/XSMultiValueFacet.lo \ + xercesc/framework/psvi/XSNamespaceItem.lo \ + xercesc/framework/psvi/XSNotationDeclaration.lo \ + xercesc/framework/psvi/XSObject.lo \ + xercesc/framework/psvi/XSParticle.lo \ + xercesc/framework/psvi/XSSimpleTypeDefinition.lo \ + xercesc/framework/psvi/XSTypeDefinition.lo \ + xercesc/framework/psvi/XSValue.lo \ + xercesc/framework/psvi/XSWildcard.lo \ + xercesc/framework/StdInInputSource.lo \ + xercesc/framework/StdOutFormatTarget.lo \ + xercesc/framework/URLInputSource.lo \ + xercesc/framework/Wrapper4DOMLSInput.lo \ + xercesc/framework/Wrapper4InputSource.lo \ + xercesc/framework/XMLAttDef.lo \ + xercesc/framework/XMLAttDefList.lo \ + xercesc/framework/XMLAttr.lo xercesc/framework/XMLBuffer.lo \ + xercesc/framework/XMLBufferMgr.lo \ + xercesc/framework/XMLContentModel.lo \ + xercesc/framework/XMLDTDDescription.lo \ + xercesc/framework/XMLElementDecl.lo \ + xercesc/framework/XMLEntityDecl.lo \ + xercesc/framework/XMLFormatter.lo \ + xercesc/framework/XMLGrammarDescription.lo \ + xercesc/framework/XMLGrammarPoolImpl.lo \ + xercesc/framework/XMLNotationDecl.lo \ + xercesc/framework/XMLRecognizer.lo \ + xercesc/framework/XMLRefInfo.lo \ + xercesc/framework/XMLSchemaDescription.lo \ + xercesc/framework/XMLValidator.lo +am__objects_5 = xercesc/internal/BinFileOutputStream.lo \ + xercesc/internal/BinMemOutputStream.lo \ + xercesc/internal/DGXMLScanner.lo xercesc/internal/ElemStack.lo \ + xercesc/internal/IGXMLScanner.lo \ + xercesc/internal/IGXMLScanner2.lo \ + xercesc/internal/MemoryManagerImpl.lo \ + xercesc/internal/ReaderMgr.lo xercesc/internal/SGXMLScanner.lo \ + xercesc/internal/ValidationContextImpl.lo \ + xercesc/internal/VecAttributesImpl.lo \ + xercesc/internal/VecAttrListImpl.lo \ + xercesc/internal/WFXMLScanner.lo xercesc/internal/XMLReader.lo \ + xercesc/internal/XMLScanner.lo \ + xercesc/internal/XMLScannerResolver.lo \ + xercesc/internal/XProtoType.lo \ + xercesc/internal/XSAXMLScanner.lo \ + xercesc/internal/XSerializeEngine.lo \ + xercesc/internal/XSObjectFactory.lo \ + xercesc/internal/XTemplateSerializer.lo +am__objects_6 = xercesc/parsers/AbstractDOMParser.lo \ + xercesc/parsers/DOMLSParserImpl.lo \ + xercesc/parsers/SAX2XMLFilterImpl.lo \ + xercesc/parsers/SAX2XMLReaderImpl.lo \ + xercesc/parsers/SAXParser.lo \ + xercesc/parsers/XercesDOMParser.lo +am__objects_7 = xercesc/sax/Dummy.lo xercesc/sax/InputSource.lo \ + xercesc/sax/SAXException.lo xercesc/sax/SAXParseException.lo +am__objects_8 = xercesc/sax2/sax2Dummy.lo +am__objects_9 = xercesc/validators/common/AllContentModel.lo \ + xercesc/validators/common/CMAny.lo \ + xercesc/validators/common/CMBinaryOp.lo \ + xercesc/validators/common/CMUnaryOp.lo \ + xercesc/validators/common/ContentLeafNameTypeVector.lo \ + xercesc/validators/common/ContentSpecNode.lo \ + xercesc/validators/common/DFAContentModel.lo \ + xercesc/validators/common/Grammar.lo \ + xercesc/validators/common/GrammarResolver.lo \ + xercesc/validators/common/MixedContentModel.lo \ + xercesc/validators/common/SimpleContentModel.lo \ + xercesc/validators/datatype/AbstractNumericFacetValidator.lo \ + xercesc/validators/datatype/AbstractNumericValidator.lo \ + xercesc/validators/datatype/AbstractStringValidator.lo \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo \ + xercesc/validators/datatype/AnyURIDatatypeValidator.lo \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo \ + xercesc/validators/datatype/BooleanDatatypeValidator.lo \ + xercesc/validators/datatype/DatatypeValidator.lo \ + xercesc/validators/datatype/DatatypeValidatorFactory.lo \ + xercesc/validators/datatype/DateDatatypeValidator.lo \ + xercesc/validators/datatype/DateTimeDatatypeValidator.lo \ + xercesc/validators/datatype/DateTimeValidator.lo \ + xercesc/validators/datatype/DayDatatypeValidator.lo \ + xercesc/validators/datatype/DecimalDatatypeValidator.lo \ + xercesc/validators/datatype/DoubleDatatypeValidator.lo \ + xercesc/validators/datatype/DurationDatatypeValidator.lo \ + xercesc/validators/datatype/ENTITYDatatypeValidator.lo \ + xercesc/validators/datatype/FloatDatatypeValidator.lo \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.lo \ + xercesc/validators/datatype/IDDatatypeValidator.lo \ + xercesc/validators/datatype/IDREFDatatypeValidator.lo \ + xercesc/validators/datatype/ListDatatypeValidator.lo \ + xercesc/validators/datatype/MonthDatatypeValidator.lo \ + xercesc/validators/datatype/MonthDayDatatypeValidator.lo \ + xercesc/validators/datatype/NameDatatypeValidator.lo \ + xercesc/validators/datatype/NCNameDatatypeValidator.lo \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.lo \ + xercesc/validators/datatype/QNameDatatypeValidator.lo \ + xercesc/validators/datatype/StringDatatypeValidator.lo \ + xercesc/validators/datatype/TimeDatatypeValidator.lo \ + xercesc/validators/datatype/UnionDatatypeValidator.lo \ + xercesc/validators/datatype/XMLCanRepGroup.lo \ + xercesc/validators/datatype/YearDatatypeValidator.lo \ + xercesc/validators/datatype/YearMonthDatatypeValidator.lo \ + xercesc/validators/DTD/DTDAttDef.lo \ + xercesc/validators/DTD/DTDAttDefList.lo \ + xercesc/validators/DTD/DTDElementDecl.lo \ + xercesc/validators/DTD/DTDEntityDecl.lo \ + xercesc/validators/DTD/DTDGrammar.lo \ + xercesc/validators/DTD/DTDScanner.lo \ + xercesc/validators/DTD/DTDValidator.lo \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.lo \ + xercesc/validators/schema/ComplexTypeInfo.lo \ + xercesc/validators/schema/GeneralAttributeCheck.lo \ + xercesc/validators/schema/identity/FieldActivator.lo \ + xercesc/validators/schema/identity/FieldValueMap.lo \ + xercesc/validators/schema/identity/IC_Field.lo \ + xercesc/validators/schema/identity/IC_Key.lo \ + xercesc/validators/schema/identity/IC_KeyRef.lo \ + xercesc/validators/schema/identity/IC_Selector.lo \ + xercesc/validators/schema/identity/IC_Unique.lo \ + xercesc/validators/schema/identity/IdentityConstraint.lo \ + xercesc/validators/schema/identity/IdentityConstraintHandler.lo \ + xercesc/validators/schema/identity/ValueStore.lo \ + xercesc/validators/schema/identity/ValueStoreCache.lo \ + xercesc/validators/schema/identity/XercesXPath.lo \ + xercesc/validators/schema/identity/XPathMatcher.lo \ + xercesc/validators/schema/identity/XPathMatcherStack.lo \ + xercesc/validators/schema/identity/XPathSymbols.lo \ + xercesc/validators/schema/NamespaceScope.lo \ + xercesc/validators/schema/SchemaAttDef.lo \ + xercesc/validators/schema/SchemaAttDefList.lo \ + xercesc/validators/schema/SchemaElementDecl.lo \ + xercesc/validators/schema/SchemaGrammar.lo \ + xercesc/validators/schema/SchemaInfo.lo \ + xercesc/validators/schema/SchemaSymbols.lo \ + xercesc/validators/schema/SchemaValidator.lo \ + xercesc/validators/schema/SubstitutionGroupComparator.lo \ + xercesc/validators/schema/TraverseSchema.lo \ + xercesc/validators/schema/XercesAttGroupInfo.lo \ + xercesc/validators/schema/XercesElementWildcard.lo \ + xercesc/validators/schema/XercesGroupInfo.lo \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.lo \ + xercesc/validators/schema/XSDDOMParser.lo \ + xercesc/validators/schema/XSDErrorReporter.lo \ + xercesc/validators/schema/XSDLocator.lo \ + xercesc/validators/schema/XUtil.lo +am__objects_10 = xercesc/xinclude/XIncludeDOMDocumentProcessor.lo \ + xercesc/xinclude/XIncludeLocation.lo \ + xercesc/xinclude/XIncludeUtils.lo +am__objects_11 = xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo +#am__objects_12 = $(am__objects_11) +am__objects_13 = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo +am__objects_14 = \ + $(am__objects_13) +am__objects_15 = xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo +#am__objects_16 = $(am__objects_15) +am__objects_17 = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo +#am__objects_18 = \ +# $(am__objects_17) +am__objects_19 = xercesc/util/Transcoders/ICU/ICUTransService.lo +#am__objects_20 = $(am__objects_19) +am__objects_21 = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo +am__objects_22 = \ + $(am__objects_21) +am__objects_23 = xercesc/util/Transcoders/Iconv/IconvTransService.lo +#am__objects_24 = $(am__objects_23) +am__objects_25 = xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo +#am__objects_26 = $(am__objects_25) +am__objects_27 = xercesc/util/Transcoders/Win32/Win32TransService.lo +#am__objects_28 = \ +# $(am__objects_27) +am__objects_29 = xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo +am__objects_30 = \ + $(am__objects_29) +am__objects_31 = xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo +#am__objects_32 = $(am__objects_31) +am__objects_33 = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo +#am__objects_34 = $(am__objects_33) +am__objects_35 = xercesc/util/MutexManagers/NoThreadMutexMgr.lo +#am__objects_36 = $(am__objects_35) +am__objects_37 = xercesc/util/MutexManagers/PosixMutexMgr.lo +am__objects_38 = $(am__objects_37) +am__objects_39 = xercesc/util/MutexManagers/WindowsMutexMgr.lo +#am__objects_40 = $(am__objects_39) +am__objects_41 = xercesc/util/FileManagers/PosixFileMgr.lo +am__objects_42 = $(am__objects_41) +am__objects_43 = xercesc/util/FileManagers/WindowsFileMgr.lo +#am__objects_44 = $(am__objects_43) +am_libxerces_c_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) \ + $(am__objects_6) $(am__objects_7) $(am__objects_8) \ + $(am__objects_9) $(am__objects_10) $(am__objects_12) \ + $(am__objects_14) $(am__objects_16) $(am__objects_18) \ + $(am__objects_20) $(am__objects_22) $(am__objects_24) \ + $(am__objects_26) $(am__objects_28) $(am__objects_30) \ + $(am__objects_32) $(am__objects_34) $(am__objects_36) \ + $(am__objects_38) $(am__objects_40) $(am__objects_42) \ + $(am__objects_44) +am__objects_45 = xercesc_messages.lo root_res.lo +#nodist_libxerces_c_la_OBJECTS = \ +# $(am__objects_45) +libxerces_c_la_OBJECTS = $(am_libxerces_c_la_OBJECTS) \ + $(nodist_libxerces_c_la_OBJECTS) +libxerces_c_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libxerces_c_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I. -I$(top_builddir) -I$(top_builddir)/src/xercesc/util +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxerces_c_la_SOURCES) $(nodist_libxerces_c_la_SOURCES) +DIST_SOURCES = $(am__libxerces_c_la_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__nobase_libxerces_c_la_HEADERS_DIST = \ + xercesc/util/ArrayIndexOutOfBoundsException.hpp \ + xercesc/util/Base64.hpp xercesc/util/BaseRefVectorOf.hpp \ + xercesc/util/BaseRefVectorOf.c \ + xercesc/util/BinFileInputStream.hpp \ + xercesc/util/BinInputStream.hpp \ + xercesc/util/BinMemInputStream.hpp xercesc/util/BitOps.hpp \ + xercesc/util/BitSet.hpp xercesc/util/CountedPointer.hpp \ + xercesc/util/CountedPointer.c \ + xercesc/util/DefaultPanicHandler.hpp \ + xercesc/util/EmptyStackException.hpp \ + xercesc/util/EncodingValidator.hpp \ + xercesc/util/FlagJanitor.hpp xercesc/util/FlagJanitor.c \ + xercesc/util/Hashers.hpp xercesc/util/Hash2KeysSetOf.hpp \ + xercesc/util/Hash2KeysSetOf.c xercesc/util/HexBin.hpp \ + xercesc/util/IllegalArgumentException.hpp \ + xercesc/util/InvalidCastException.hpp \ + xercesc/util/IOException.hpp xercesc/util/Janitor.hpp \ + xercesc/util/Janitor.c xercesc/util/KeyRefPair.hpp \ + xercesc/util/KeyRefPair.c xercesc/util/KeyValuePair.hpp \ + xercesc/util/KeyValuePair.c xercesc/util/KVStringPair.hpp \ + xercesc/util/Mutexes.hpp xercesc/util/LogicalPath.c \ + xercesc/util/NameIdPool.hpp xercesc/util/NameIdPool.c \ + xercesc/util/NoSuchElementException.hpp \ + xercesc/util/NullPointerException.hpp \ + xercesc/util/NumberFormatException.hpp \ + xercesc/util/OutOfMemoryException.hpp \ + xercesc/util/PanicHandler.hpp xercesc/util/ParseException.hpp \ + xercesc/util/PlatformUtils.hpp xercesc/util/PSVIUni.hpp \ + xercesc/util/QName.hpp xercesc/util/RefArrayOf.hpp \ + xercesc/util/RefArrayOf.c xercesc/util/RefArrayVectorOf.hpp \ + xercesc/util/RefArrayVectorOf.c \ + xercesc/util/RefHash2KeysTableOf.hpp \ + xercesc/util/RefHash2KeysTableOf.c \ + xercesc/util/RefHash3KeysIdPool.hpp \ + xercesc/util/RefHash3KeysIdPool.c \ + xercesc/util/RefHashTableOf.hpp xercesc/util/RefHashTableOf.c \ + xercesc/util/RefStackOf.hpp xercesc/util/RefStackOf.c \ + xercesc/util/RefVectorOf.hpp xercesc/util/RefVectorOf.c \ + xercesc/util/regx/ASCIIRangeFactory.hpp \ + xercesc/util/regx/BlockRangeFactory.hpp \ + xercesc/util/regx/BMPattern.hpp \ + xercesc/util/regx/CharToken.hpp \ + xercesc/util/regx/ClosureToken.hpp \ + xercesc/util/regx/ConcatToken.hpp xercesc/util/regx/Match.hpp \ + xercesc/util/regx/Op.hpp xercesc/util/regx/OpFactory.hpp \ + xercesc/util/regx/ParenToken.hpp \ + xercesc/util/regx/ParserForXMLSchema.hpp \ + xercesc/util/regx/RangeFactory.hpp \ + xercesc/util/regx/RangeToken.hpp \ + xercesc/util/regx/RangeTokenMap.hpp \ + xercesc/util/regx/RegularExpression.hpp \ + xercesc/util/regx/RegxDefs.hpp \ + xercesc/util/regx/RegxParser.hpp \ + xercesc/util/regx/RegxUtil.hpp \ + xercesc/util/regx/StringToken.hpp xercesc/util/regx/Token.hpp \ + xercesc/util/regx/TokenFactory.hpp \ + xercesc/util/regx/TokenInc.hpp \ + xercesc/util/regx/UniCharTable.hpp \ + xercesc/util/regx/UnicodeRangeFactory.hpp \ + xercesc/util/regx/UnionToken.hpp \ + xercesc/util/regx/XMLRangeFactory.hpp \ + xercesc/util/regx/XMLUniCharacter.hpp \ + xercesc/util/RuntimeException.hpp \ + xercesc/util/SchemaDateTimeException.hpp \ + xercesc/util/SecurityManager.hpp xercesc/util/StringPool.hpp \ + xercesc/util/SynchronizedStringPool.hpp \ + xercesc/util/TranscodingException.hpp \ + xercesc/util/TransENameMap.hpp xercesc/util/TransENameMap.c \ + xercesc/util/TransService.hpp \ + xercesc/util/UnexpectedEOFException.hpp \ + xercesc/util/UnsupportedEncodingException.hpp \ + xercesc/util/UTFDataFormatException.hpp \ + xercesc/util/ValueArrayOf.hpp xercesc/util/ValueArrayOf.c \ + xercesc/util/ValueHashTableOf.hpp \ + xercesc/util/ValueHashTableOf.c xercesc/util/ValueStackOf.hpp \ + xercesc/util/ValueStackOf.c xercesc/util/ValueVectorOf.hpp \ + xercesc/util/ValueVectorOf.c xercesc/util/XercesDefs.hpp \ + xercesc/util/XercesVersion.hpp xercesc/util/XMemory.hpp \ + xercesc/util/XML256TableTranscoder.hpp \ + xercesc/util/XML88591Transcoder.hpp \ + xercesc/util/XMLAbstractDoubleFloat.hpp \ + xercesc/util/XMLASCIITranscoder.hpp \ + xercesc/util/XMLBigDecimal.hpp xercesc/util/XMLBigInteger.hpp \ + xercesc/util/XMLChar.hpp xercesc/util/XMLChTranscoder.hpp \ + xercesc/util/XMLDateTime.hpp xercesc/util/XMLDOMMsg.hpp \ + xercesc/util/XMLDouble.hpp \ + xercesc/util/XMLEBCDICTranscoder.hpp \ + xercesc/util/XMLEntityResolver.hpp \ + xercesc/util/XMLEnumerator.hpp xercesc/util/XMLException.hpp \ + xercesc/util/XMLExceptMsgs.hpp xercesc/util/XMLFileMgr.hpp \ + xercesc/util/XMLFloat.hpp \ + xercesc/util/XMLIBM1047Transcoder.hpp \ + xercesc/util/XMLIBM1140Transcoder.hpp \ + xercesc/util/XMLInitializer.hpp xercesc/util/XMLInteger.hpp \ + xercesc/util/XMLMutexMgr.hpp xercesc/util/XMLMsgLoader.hpp \ + xercesc/util/XMLNetAccessor.hpp xercesc/util/XMLNumber.hpp \ + xercesc/util/XMLResourceIdentifier.hpp \ + xercesc/util/XMLString.hpp xercesc/util/XMLStringTokenizer.hpp \ + xercesc/util/XMLUCS4Transcoder.hpp xercesc/util/XMLUni.hpp \ + xercesc/util/XMLUniDefs.hpp xercesc/util/XMLUri.hpp \ + xercesc/util/XMLURL.hpp xercesc/util/XMLUTF16Transcoder.hpp \ + xercesc/util/XMLUTF8Transcoder.hpp \ + xercesc/util/XMLWin1252Transcoder.hpp xercesc/dom/DOM.hpp \ + xercesc/dom/DOMAttr.hpp xercesc/dom/DOMCDATASection.hpp \ + xercesc/dom/DOMCharacterData.hpp xercesc/dom/DOMComment.hpp \ + xercesc/dom/DOMConfiguration.hpp xercesc/dom/DOMDocument.hpp \ + xercesc/dom/DOMDocumentFragment.hpp \ + xercesc/dom/DOMDocumentRange.hpp \ + xercesc/dom/DOMDocumentTraversal.hpp \ + xercesc/dom/DOMDocumentType.hpp xercesc/dom/DOMElement.hpp \ + xercesc/dom/DOMEntity.hpp xercesc/dom/DOMEntityReference.hpp \ + xercesc/dom/DOMError.hpp xercesc/dom/DOMErrorHandler.hpp \ + xercesc/dom/DOMException.hpp xercesc/dom/DOMImplementation.hpp \ + xercesc/dom/DOMImplementationList.hpp \ + xercesc/dom/DOMImplementationLS.hpp \ + xercesc/dom/DOMImplementationRegistry.hpp \ + xercesc/dom/DOMImplementationSource.hpp \ + xercesc/dom/DOMLocator.hpp xercesc/dom/DOMLSException.hpp \ + xercesc/dom/DOMLSInput.hpp xercesc/dom/DOMLSOutput.hpp \ + xercesc/dom/DOMLSParser.hpp xercesc/dom/DOMLSParserFilter.hpp \ + xercesc/dom/DOMLSResourceResolver.hpp \ + xercesc/dom/DOMLSSerializer.hpp \ + xercesc/dom/DOMLSSerializerFilter.hpp \ + xercesc/dom/DOMMemoryManager.hpp \ + xercesc/dom/DOMNamedNodeMap.hpp xercesc/dom/DOMNode.hpp \ + xercesc/dom/DOMNodeFilter.hpp xercesc/dom/DOMNodeIterator.hpp \ + xercesc/dom/DOMNodeList.hpp xercesc/dom/DOMNotation.hpp \ + xercesc/dom/DOMProcessingInstruction.hpp \ + xercesc/dom/DOMPSVITypeInfo.hpp xercesc/dom/DOMRange.hpp \ + xercesc/dom/DOMRangeException.hpp \ + xercesc/dom/DOMStringList.hpp xercesc/dom/DOMText.hpp \ + xercesc/dom/DOMTreeWalker.hpp xercesc/dom/DOMTypeInfo.hpp \ + xercesc/dom/DOMUserDataHandler.hpp \ + xercesc/dom/DOMXPathEvaluator.hpp \ + xercesc/dom/DOMXPathException.hpp \ + xercesc/dom/DOMXPathExpression.hpp \ + xercesc/dom/DOMXPathNamespace.hpp \ + xercesc/dom/DOMXPathNSResolver.hpp \ + xercesc/dom/DOMXPathResult.hpp xercesc/dom/StDOMNode.hpp \ + xercesc/dom/impl/DOMAttrImpl.hpp \ + xercesc/dom/impl/DOMAttrMapImpl.hpp \ + xercesc/dom/impl/DOMAttrNSImpl.hpp \ + xercesc/dom/impl/DOMCasts.hpp \ + xercesc/dom/impl/DOMCDATASectionImpl.hpp \ + xercesc/dom/impl/DOMCharacterDataImpl.hpp \ + xercesc/dom/impl/DOMChildNode.hpp \ + xercesc/dom/impl/DOMCommentImpl.hpp \ + xercesc/dom/impl/DOMConfigurationImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.c \ + xercesc/dom/impl/DOMDocumentFragmentImpl.hpp \ + xercesc/dom/impl/DOMDocumentImpl.hpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.hpp \ + xercesc/dom/impl/DOMElementImpl.hpp \ + xercesc/dom/impl/DOMElementNSImpl.hpp \ + xercesc/dom/impl/DOMEntityImpl.hpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.hpp \ + xercesc/dom/impl/DOMErrorImpl.hpp \ + xercesc/dom/impl/DOMImplementationImpl.hpp \ + xercesc/dom/impl/DOMImplementationListImpl.hpp \ + xercesc/dom/impl/DOMLocatorImpl.hpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.hpp \ + xercesc/dom/impl/DOMNodeIDMap.hpp \ + xercesc/dom/impl/DOMNodeImpl.hpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.hpp \ + xercesc/dom/impl/DOMNodeListImpl.hpp \ + xercesc/dom/impl/DOMNodeVector.hpp \ + xercesc/dom/impl/DOMNormalizer.hpp \ + xercesc/dom/impl/DOMNotationImpl.hpp \ + xercesc/dom/impl/DOMParentNode.hpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.hpp \ + xercesc/dom/impl/DOMRangeImpl.hpp \ + xercesc/dom/impl/DOMStringListImpl.hpp \ + xercesc/dom/impl/DOMStringPool.hpp \ + xercesc/dom/impl/DOMTextImpl.hpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.hpp \ + xercesc/dom/impl/DOMTypeInfoImpl.hpp \ + xercesc/dom/impl/DOMLSSerializerImpl.hpp \ + xercesc/dom/impl/DOMLSInputImpl.hpp \ + xercesc/dom/impl/DOMLSOutputImpl.hpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.hpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.hpp \ + xercesc/dom/impl/DOMXPathResultImpl.hpp \ + xercesc/dom/impl/XSDElementNSImpl.hpp \ + xercesc/framework/BinOutputStream.hpp \ + xercesc/framework/LocalFileFormatTarget.hpp \ + xercesc/framework/LocalFileInputSource.hpp \ + xercesc/framework/MemBufFormatTarget.hpp \ + xercesc/framework/MemBufInputSource.hpp \ + xercesc/framework/MemoryManager.hpp \ + xercesc/framework/psvi/PSVIAttribute.hpp \ + xercesc/framework/psvi/PSVIAttributeList.hpp \ + xercesc/framework/psvi/PSVIElement.hpp \ + xercesc/framework/psvi/PSVIHandler.hpp \ + xercesc/framework/psvi/PSVIItem.hpp \ + xercesc/framework/psvi/XSAnnotation.hpp \ + xercesc/framework/psvi/XSAttributeDeclaration.hpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.hpp \ + xercesc/framework/psvi/XSAttributeUse.hpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.hpp \ + xercesc/framework/psvi/XSConstants.hpp \ + xercesc/framework/psvi/XSElementDeclaration.hpp \ + xercesc/framework/psvi/XSFacet.hpp \ + xercesc/framework/psvi/XSIDCDefinition.hpp \ + xercesc/framework/psvi/XSModel.hpp \ + xercesc/framework/psvi/XSModelGroup.hpp \ + xercesc/framework/psvi/XSModelGroupDefinition.hpp \ + xercesc/framework/psvi/XSMultiValueFacet.hpp \ + xercesc/framework/psvi/XSNamedMap.hpp \ + xercesc/framework/psvi/XSNamedMap.c \ + xercesc/framework/psvi/XSNamespaceItem.hpp \ + xercesc/framework/psvi/XSNotationDeclaration.hpp \ + xercesc/framework/psvi/XSObject.hpp \ + xercesc/framework/psvi/XSParticle.hpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.hpp \ + xercesc/framework/psvi/XSTypeDefinition.hpp \ + xercesc/framework/psvi/XSValue.hpp \ + xercesc/framework/psvi/XSWildcard.hpp \ + xercesc/framework/StdInInputSource.hpp \ + xercesc/framework/StdOutFormatTarget.hpp \ + xercesc/framework/URLInputSource.hpp \ + xercesc/framework/ValidationContext.hpp \ + xercesc/framework/Wrapper4DOMLSInput.hpp \ + xercesc/framework/Wrapper4InputSource.hpp \ + xercesc/framework/XMLAttDef.hpp \ + xercesc/framework/XMLAttDefList.hpp \ + xercesc/framework/XMLAttr.hpp xercesc/framework/XMLBuffer.hpp \ + xercesc/framework/XMLBufferMgr.hpp \ + xercesc/framework/XMLContentModel.hpp \ + xercesc/framework/XMLDocumentHandler.hpp \ + xercesc/framework/XMLDTDDescription.hpp \ + xercesc/framework/XMLElementDecl.hpp \ + xercesc/framework/XMLEntityDecl.hpp \ + xercesc/framework/XMLEntityHandler.hpp \ + xercesc/framework/XMLErrorCodes.hpp \ + xercesc/framework/XMLErrorReporter.hpp \ + xercesc/framework/XMLFormatter.hpp \ + xercesc/framework/XMLGrammarDescription.hpp \ + xercesc/framework/XMLGrammarPool.hpp \ + xercesc/framework/XMLGrammarPoolImpl.hpp \ + xercesc/framework/XMLNotationDecl.hpp \ + xercesc/framework/XMLPScanToken.hpp \ + xercesc/framework/XMLRecognizer.hpp \ + xercesc/framework/XMLRefInfo.hpp \ + xercesc/framework/XMLSchemaDescription.hpp \ + xercesc/framework/XMLValidator.hpp \ + xercesc/framework/XMLValidityCodes.hpp \ + xercesc/internal/BinFileOutputStream.hpp \ + xercesc/internal/BinMemOutputStream.hpp \ + xercesc/internal/CharTypeTables.hpp \ + xercesc/internal/DGXMLScanner.hpp \ + xercesc/internal/ElemStack.hpp \ + xercesc/internal/EndOfEntityException.hpp \ + xercesc/internal/IANAEncodings.hpp \ + xercesc/internal/IGXMLScanner.hpp \ + xercesc/internal/MemoryManagerImpl.hpp \ + xercesc/internal/ReaderMgr.hpp \ + xercesc/internal/SGXMLScanner.hpp \ + xercesc/internal/ValidationContextImpl.hpp \ + xercesc/internal/VecAttributesImpl.hpp \ + xercesc/internal/VecAttrListImpl.hpp \ + xercesc/internal/WFXMLScanner.hpp \ + xercesc/internal/XMLInternalErrorHandler.hpp \ + xercesc/internal/XMLReader.hpp xercesc/internal/XMLScanner.hpp \ + xercesc/internal/XMLScannerResolver.hpp \ + xercesc/internal/XProtoType.hpp \ + xercesc/internal/XSAXMLScanner.hpp \ + xercesc/internal/XSerializable.hpp \ + xercesc/internal/XSerializationException.hpp \ + xercesc/internal/XSerializeEngine.hpp \ + xercesc/internal/XSObjectFactory.hpp \ + xercesc/internal/XTemplateSerializer.hpp \ + xercesc/parsers/AbstractDOMParser.hpp \ + xercesc/parsers/DOMLSParserImpl.hpp \ + xercesc/parsers/SAX2XMLFilterImpl.hpp \ + xercesc/parsers/SAX2XMLReaderImpl.hpp \ + xercesc/parsers/SAXParser.hpp \ + xercesc/parsers/XercesDOMParser.hpp \ + xercesc/sax/AttributeList.hpp xercesc/sax/DocumentHandler.hpp \ + xercesc/sax/DTDHandler.hpp xercesc/sax/EntityResolver.hpp \ + xercesc/sax/ErrorHandler.hpp xercesc/sax/HandlerBase.hpp \ + xercesc/sax/InputSource.hpp xercesc/sax/Locator.hpp \ + xercesc/sax/Parser.hpp xercesc/sax/SAXException.hpp \ + xercesc/sax/SAXParseException.hpp xercesc/sax2/Attributes.hpp \ + xercesc/sax2/ContentHandler.hpp xercesc/sax2/DeclHandler.hpp \ + xercesc/sax2/DefaultHandler.hpp \ + xercesc/sax2/LexicalHandler.hpp xercesc/sax2/SAX2XMLFilter.hpp \ + xercesc/sax2/SAX2XMLReader.hpp \ + xercesc/sax2/XMLReaderFactory.hpp \ + xercesc/validators/common/AllContentModel.hpp \ + xercesc/validators/common/CMAny.hpp \ + xercesc/validators/common/CMBinaryOp.hpp \ + xercesc/validators/common/CMLeaf.hpp \ + xercesc/validators/common/CMRepeatingLeaf.hpp \ + xercesc/validators/common/CMNode.hpp \ + xercesc/validators/common/CMStateSet.hpp \ + xercesc/validators/common/CMUnaryOp.hpp \ + xercesc/validators/common/ContentLeafNameTypeVector.hpp \ + xercesc/validators/common/ContentSpecNode.hpp \ + xercesc/validators/common/DFAContentModel.hpp \ + xercesc/validators/common/Grammar.hpp \ + xercesc/validators/common/GrammarResolver.hpp \ + xercesc/validators/common/MixedContentModel.hpp \ + xercesc/validators/common/SimpleContentModel.hpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.hpp \ + xercesc/validators/datatype/AbstractNumericValidator.hpp \ + xercesc/validators/datatype/AbstractStringValidator.hpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.hpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.hpp \ + xercesc/validators/datatype/DateDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeValidator.hpp \ + xercesc/validators/datatype/DayDatatypeValidator.hpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.hpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.hpp \ + xercesc/validators/datatype/DurationDatatypeValidator.hpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.hpp \ + xercesc/validators/datatype/FloatDatatypeValidator.hpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/IDDatatypeValidator.hpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.hpp \ + xercesc/validators/datatype/InvalidDatatypeFacetException.hpp \ + xercesc/validators/datatype/InvalidDatatypeValueException.hpp \ + xercesc/validators/datatype/ListDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.hpp \ + xercesc/validators/datatype/NameDatatypeValidator.hpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.hpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp \ + xercesc/validators/datatype/QNameDatatypeValidator.hpp \ + xercesc/validators/datatype/StringDatatypeValidator.hpp \ + xercesc/validators/datatype/TimeDatatypeValidator.hpp \ + xercesc/validators/datatype/UnionDatatypeValidator.hpp \ + xercesc/validators/datatype/XMLCanRepGroup.hpp \ + xercesc/validators/datatype/YearDatatypeValidator.hpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.hpp \ + xercesc/validators/DTD/DocTypeHandler.hpp \ + xercesc/validators/DTD/DTDAttDef.hpp \ + xercesc/validators/DTD/DTDAttDefList.hpp \ + xercesc/validators/DTD/DTDElementDecl.hpp \ + xercesc/validators/DTD/DTDEntityDecl.hpp \ + xercesc/validators/DTD/DTDGrammar.hpp \ + xercesc/validators/DTD/DTDScanner.hpp \ + xercesc/validators/DTD/DTDValidator.hpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp \ + xercesc/validators/schema/ComplexTypeInfo.hpp \ + xercesc/validators/schema/GeneralAttributeCheck.hpp \ + xercesc/validators/schema/identity/FieldActivator.hpp \ + xercesc/validators/schema/identity/FieldValueMap.hpp \ + xercesc/validators/schema/identity/IC_Field.hpp \ + xercesc/validators/schema/identity/IC_Key.hpp \ + xercesc/validators/schema/identity/IC_KeyRef.hpp \ + xercesc/validators/schema/identity/IC_Selector.hpp \ + xercesc/validators/schema/identity/IC_Unique.hpp \ + xercesc/validators/schema/identity/IdentityConstraint.hpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.hpp \ + xercesc/validators/schema/identity/ValueStore.hpp \ + xercesc/validators/schema/identity/ValueStoreCache.hpp \ + xercesc/validators/schema/identity/XercesXPath.hpp \ + xercesc/validators/schema/identity/XPathException.hpp \ + xercesc/validators/schema/identity/XPathMatcher.hpp \ + xercesc/validators/schema/identity/XPathMatcherStack.hpp \ + xercesc/validators/schema/identity/XPathSymbols.hpp \ + xercesc/validators/schema/NamespaceScope.hpp \ + xercesc/validators/schema/PSVIDefs.hpp \ + xercesc/validators/schema/SchemaAttDef.hpp \ + xercesc/validators/schema/SchemaAttDefList.hpp \ + xercesc/validators/schema/SchemaElementDecl.hpp \ + xercesc/validators/schema/SchemaGrammar.hpp \ + xercesc/validators/schema/SchemaInfo.hpp \ + xercesc/validators/schema/SchemaSymbols.hpp \ + xercesc/validators/schema/SchemaValidator.hpp \ + xercesc/validators/schema/SubstitutionGroupComparator.hpp \ + xercesc/validators/schema/TraverseSchema.hpp \ + xercesc/validators/schema/XercesAttGroupInfo.hpp \ + xercesc/validators/schema/XercesElementWildcard.hpp \ + xercesc/validators/schema/XercesGroupInfo.hpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp \ + xercesc/validators/schema/XSDDOMParser.hpp \ + xercesc/validators/schema/XSDErrorReporter.hpp \ + xercesc/validators/schema/XSDLocator.hpp \ + xercesc/validators/schema/XUtil.hpp \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp \ + xercesc/xinclude/XIncludeLocation.hpp \ + xercesc/xinclude/XIncludeUtils.hpp \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.hpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.hpp \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp \ + xercesc/util/Transcoders/ICU/ICUTransService.hpp \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp \ + xercesc/util/Transcoders/Iconv/IconvTransService.hpp \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp \ + xercesc/util/Transcoders/Win32/Win32TransService.hpp \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp \ + xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/XMLMsgCat_Ids.hpp \ + xercesc/util/MutexManagers/NoThreadMutexMgr.hpp \ + xercesc/util/MutexManagers/PosixMutexMgr.hpp \ + xercesc/util/MutexManagers/WindowsMutexMgr.hpp \ + xercesc/util/FileManagers/PosixFileMgr.hpp \ + xercesc/util/FileManagers/WindowsFileMgr.hpp +HEADERS = $(nobase_libxerces_c_la_HEADERS) \ + $(nodist_autoconfheaders_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = xercesc/util/MsgLoaders/MsgCatalog +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run aclocal-1.11 +AMTAR = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run tar +AR = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-ar +AS = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-as +AUTOCONF = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run autoconf +AUTOHEADER = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run autoheader +AUTOMAKE = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run automake-1.11 +AWK = gawk +BUILD_SHARED = no +BUILD_STATIC = yes +CC = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -I/Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/include -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -O2 -DNDEBUG -g -I/Users/michi/android/sdl_android/project/jni/application/../stlport/stlport -I/Users/michi/android/sdl_android/project/jni/application/../sdl/include -I/Users/michi/android/sdl_android/project/jni/application/../sdl_mixer -I/Users/michi/android/sdl_android/project/jni/application/../sdl_image -I/Users/michi/android/sdl_android/project/jni/application/../sdl_ttf -I/Users/michi/android/sdl_android/project/jni/application/../sdl_net -I/Users/michi/android/sdl_android/project/jni/application/../sdl_blitpool -I/Users/michi/android/sdl_android/project/jni/application/../sdl_gfx -I/Users/michi/android/sdl_android/project/jni/application/../png -I/Users/michi/android/sdl_android/project/jni/application/../jpeg -I/Users/michi/android/sdl_android/project/jni/application/../intl -I/Users/michi/android/sdl_android/project/jni/application/../freetype/include -I/Users/michi/android/sdl_android/project/jni/application/../xml2/include +CPP = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-cpp -I/Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/include -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -O2 -DNDEBUG -g -I/Users/michi/android/sdl_android/project/jni/application/../stlport/stlport -I/Users/michi/android/sdl_android/project/jni/application/../sdl/include -I/Users/michi/android/sdl_android/project/jni/application/../sdl_mixer -I/Users/michi/android/sdl_android/project/jni/application/../sdl_image -I/Users/michi/android/sdl_android/project/jni/application/../sdl_ttf -I/Users/michi/android/sdl_android/project/jni/application/../sdl_net -I/Users/michi/android/sdl_android/project/jni/application/../sdl_blitpool -I/Users/michi/android/sdl_android/project/jni/application/../sdl_gfx -I/Users/michi/android/sdl_android/project/jni/application/../png -I/Users/michi/android/sdl_android/project/jni/application/../jpeg -I/Users/michi/android/sdl_android/project/jni/application/../intl -I/Users/michi/android/sdl_android/project/jni/application/../freetype/include -I/Users/michi/android/sdl_android/project/jni/application/../xml2/include +CPPFLAGS = +CURL_FLAGS = -I/opt/local/include +CURL_LIBS = -L/opt/local/lib -lcurl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz +CURL_PRESENT = no +CXX = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ +CXXCPP = /lib/cpp +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -I/Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/include -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -O2 -DNDEBUG -g -I/Users/michi/android/sdl_android/project/jni/application/../stlport/stlport -I/Users/michi/android/sdl_android/project/jni/application/../sdl/include -I/Users/michi/android/sdl_android/project/jni/application/../sdl_mixer -I/Users/michi/android/sdl_android/project/jni/application/../sdl_image -I/Users/michi/android/sdl_android/project/jni/application/../sdl_ttf -I/Users/michi/android/sdl_android/project/jni/application/../sdl_net -I/Users/michi/android/sdl_android/project/jni/application/../sdl_blitpool -I/Users/michi/android/sdl_android/project/jni/application/../sdl_gfx -I/Users/michi/android/sdl_android/project/jni/application/../png -I/Users/michi/android/sdl_android/project/jni/application/../jpeg -I/Users/michi/android/sdl_android/project/jni/application/../intl -I/Users/michi/android/sdl_android/project/jni/application/../freetype/include -I/Users/michi/android/sdl_android/project/jni/application/../xml2/include +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H -DXERCES_BUILDING_LIBRARY +DEPDIR = .deps +DLLTOOL = dlltool +DSYMUTIL = +DUMPBIN = +ECHO_C = \c +ECHO_N = +ECHO_T = +EGREP = /usr/bin/grep -E +EXEEXT = +FGREP = /usr/bin/grep -F +GREP = /usr/bin/grep +ICU_BIN = +ICU_FLAGS = +ICU_LIBS = -licuuc -licudata +ICU_PRESENT = no +ICU_SBIN = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc +LDFLAGS = -nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic -Wl,--whole-archive -Wl,--no-whole-archive /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a /Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/lib/libc.so /Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/lib/libm.so -Wl,--no-undefined -Wl,-z,noexecstack -L/Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/lib -lGLESv1_CM -ldl -llog -lz -Wl,-rpath-link=/Users/michi/android/ndk-crystax/build/platforms/android-8/arch-arm/usr/lib -L/Users/michi/android/sdl_android/project/jni/application/../../obj/local/armeabi +LIBOBJS = ${LIBOBJDIR}stricmp$U.o ${LIBOBJDIR}strnicmp$U.o +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBOBJS = ${LIBOBJDIR}stricmp$U.lo ${LIBOBJDIR}strnicmp$U.lo +MAINT = # +MAKEINFO = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/missing --run makeinfo +MKDIR_P = ../config/install-sh -c -d +NM = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-nm +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = xerces-c +PACKAGE_BUGREPORT = +PACKAGE_NAME = xerces-c +PACKAGE_STRING = xerces-c 3.1.1 +PACKAGE_TARNAME = xerces-c +PACKAGE_URL = +PACKAGE_VERSION = 3.1.1 +PATH_SEPARATOR = : +PTHREAD_CC = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc +PTHREAD_CFLAGS = +PTHREAD_LIBS = +RANLIB = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-ranlib +SED = /opt/local/bin/gsed +SET_MAKE = +SHELL = /bin/sh +SHREXT = .so +STRIP = /Users/michi/android/ndk-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-strip +VERSION = 3.1.1 +abs_builddir = /Users/michi/android/sdl_android/project/jni/xerces/src +abs_srcdir = /Users/michi/android/sdl_android/project/jni/xerces/src +abs_top_builddir = /Users/michi/android/sdl_android/project/jni/xerces +abs_top_srcdir = /Users/michi/android/sdl_android/project/jni/xerces +ac_ct_CC = +ac_ct_CXX = +ac_ct_DUMPBIN = +acx_pthread_config = +am__include = include +am__leading_dot = . +am__quote = +am__tar = tar --format=ustar -chf - "$$tardir" +am__untar = tar -xf - +bindir = ${exec_prefix}/bin +build = i386-apple-darwin9.8.0 +build_alias = +build_cpu = i386 +build_os = darwin9.8.0 +build_vendor = apple +builddir = . +curl_config = /opt/local/bin/curl-config +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = arm-unknown-eabi +host_alias = arm-eabi +host_cpu = arm +host_os = eabi +host_vendor = unknown +htmldir = ${docdir} +icu_config = +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /Users/michi/android/sdl_android/project/jni/xerces/config/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +lt_ECHO = /bin/echo +mandir = ${datarootdir}/man +mkdir_p = $(top_builddir)/config/install-sh -c -d +oldincludedir = /usr/include +pdfdir = ${docdir} +pkgconfigdir = ${libdir}/pkgconfig +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +SUBDIRS = $(am__append_29) + +# +# +lib_LTLIBRARIES = libxerces-c.la + +# Use AM_* variables instead of per-target ones otherwise the +# make pretty-printing won't work. +# +AM_CPPFLAGS = $(am__append_3) $(am__append_12) $(am__append_25) +libxerces_c_la_LDFLAGS = -release ${INTERFACE_VER_D} + +# This sets {install}/include as target for the headers +libxerces_c_ladir = ${includedir} +libxerces_c_la_SOURCES = ${util_sources} ${dom_sources} \ + ${domimpl_sources} ${framework_sources} ${internal_sources} \ + ${parsers_sources} ${sax_sources} ${sax2_sources} \ + ${validators_sources} ${xinclude_sources} $(am__append_1) \ + $(am__append_4) $(am__append_6) $(am__append_8) \ + $(am__append_10) $(am__append_13) $(am__append_15) \ + $(am__append_17) $(am__append_19) $(am__append_21) \ + $(am__append_23) $(am__append_27) $(am__append_30) \ + $(am__append_32) $(am__append_34) $(am__append_36) \ + $(am__append_38) +nobase_libxerces_c_la_HEADERS = ${util_headers} ${dom_headers} \ + ${domimpl_headers} ${framework_headers} ${internal_headers} \ + ${parsers_headers} ${sax_headers} ${sax2_headers} \ + ${validators_headers} ${xinclude_headers} $(am__append_2) \ + $(am__append_5) $(am__append_7) $(am__append_9) \ + $(am__append_11) $(am__append_14) $(am__append_16) \ + $(am__append_18) $(am__append_20) $(am__append_22) \ + $(am__append_24) $(am__append_28) $(am__append_31) \ + $(am__append_33) $(am__append_35) $(am__append_37) \ + $(am__append_39) + +# Make sure autoconf-generated Xerces_autoconf_config.hpp ends up in a +# proper place when installed. +# +autoconfheadersdir = $(includedir)/xercesc/util +nodist_autoconfheaders_HEADERS = ${top_builddir}/src/xercesc/util/Xerces_autoconf_config.hpp + +# Compatibility library. +# +EXTRA_DIST = stricmp.h strnicmp.h towlower.h towupper.h \ + $(am__append_26) +libxerces_c_la_LIBADD = ${LTLIBOBJS} +#nodist_libxerces_c_la_SOURCES = ${msgicu_nodist_sources} + +# Resource shortname +#PKGNAME = xercesc_messages_${INTERFACE_VER_U} +#CLEANFILES = xercesc_messages.c root_res.c root.res +#BUILT_SOURCES = xercesc_messages.c root_res.c + +# +# Definition of sources/headers for each convenience library +# + +# +# A line like the following will generate a list of headers +# for a given directory: (must be issued from src directory) +# find xercesc/framework -name '*.hpp' -exec echo {} \\ ";" +# find xercesc/framework -name '*.cpp' -exec echo {} \\ ";" +# +dom_headers = \ + xercesc/dom/DOM.hpp \ + xercesc/dom/DOMAttr.hpp \ + xercesc/dom/DOMCDATASection.hpp \ + xercesc/dom/DOMCharacterData.hpp \ + xercesc/dom/DOMComment.hpp \ + xercesc/dom/DOMConfiguration.hpp \ + xercesc/dom/DOMDocument.hpp \ + xercesc/dom/DOMDocumentFragment.hpp \ + xercesc/dom/DOMDocumentRange.hpp \ + xercesc/dom/DOMDocumentTraversal.hpp \ + xercesc/dom/DOMDocumentType.hpp \ + xercesc/dom/DOMElement.hpp \ + xercesc/dom/DOMEntity.hpp \ + xercesc/dom/DOMEntityReference.hpp \ + xercesc/dom/DOMError.hpp \ + xercesc/dom/DOMErrorHandler.hpp \ + xercesc/dom/DOMException.hpp \ + xercesc/dom/DOMImplementation.hpp \ + xercesc/dom/DOMImplementationList.hpp \ + xercesc/dom/DOMImplementationLS.hpp \ + xercesc/dom/DOMImplementationRegistry.hpp \ + xercesc/dom/DOMImplementationSource.hpp \ + xercesc/dom/DOMLocator.hpp \ + xercesc/dom/DOMLSException.hpp \ + xercesc/dom/DOMLSInput.hpp \ + xercesc/dom/DOMLSOutput.hpp \ + xercesc/dom/DOMLSParser.hpp \ + xercesc/dom/DOMLSParserFilter.hpp \ + xercesc/dom/DOMLSResourceResolver.hpp \ + xercesc/dom/DOMLSSerializer.hpp \ + xercesc/dom/DOMLSSerializerFilter.hpp \ + xercesc/dom/DOMMemoryManager.hpp \ + xercesc/dom/DOMNamedNodeMap.hpp \ + xercesc/dom/DOMNode.hpp \ + xercesc/dom/DOMNodeFilter.hpp \ + xercesc/dom/DOMNodeIterator.hpp \ + xercesc/dom/DOMNodeList.hpp \ + xercesc/dom/DOMNotation.hpp \ + xercesc/dom/DOMProcessingInstruction.hpp \ + xercesc/dom/DOMPSVITypeInfo.hpp \ + xercesc/dom/DOMRange.hpp \ + xercesc/dom/DOMRangeException.hpp \ + xercesc/dom/DOMStringList.hpp \ + xercesc/dom/DOMText.hpp \ + xercesc/dom/DOMTreeWalker.hpp \ + xercesc/dom/DOMTypeInfo.hpp \ + xercesc/dom/DOMUserDataHandler.hpp \ + xercesc/dom/DOMXPathEvaluator.hpp \ + xercesc/dom/DOMXPathException.hpp \ + xercesc/dom/DOMXPathExpression.hpp \ + xercesc/dom/DOMXPathNamespace.hpp \ + xercesc/dom/DOMXPathNSResolver.hpp \ + xercesc/dom/DOMXPathResult.hpp \ + xercesc/dom/StDOMNode.hpp + +dom_sources = \ + xercesc/dom/DOMException.cpp \ + xercesc/dom/DOMLSException.cpp \ + xercesc/dom/DOMRangeException.cpp \ + xercesc/dom/DOMXPathException.cpp + +domimpl_headers = \ + xercesc/dom/impl/DOMAttrImpl.hpp \ + xercesc/dom/impl/DOMAttrMapImpl.hpp \ + xercesc/dom/impl/DOMAttrNSImpl.hpp \ + xercesc/dom/impl/DOMCasts.hpp \ + xercesc/dom/impl/DOMCDATASectionImpl.hpp \ + xercesc/dom/impl/DOMCharacterDataImpl.hpp \ + xercesc/dom/impl/DOMChildNode.hpp \ + xercesc/dom/impl/DOMCommentImpl.hpp \ + xercesc/dom/impl/DOMConfigurationImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.c \ + xercesc/dom/impl/DOMDocumentFragmentImpl.hpp \ + xercesc/dom/impl/DOMDocumentImpl.hpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.hpp \ + xercesc/dom/impl/DOMElementImpl.hpp \ + xercesc/dom/impl/DOMElementNSImpl.hpp \ + xercesc/dom/impl/DOMEntityImpl.hpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.hpp \ + xercesc/dom/impl/DOMErrorImpl.hpp \ + xercesc/dom/impl/DOMImplementationImpl.hpp \ + xercesc/dom/impl/DOMImplementationListImpl.hpp \ + xercesc/dom/impl/DOMLocatorImpl.hpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.hpp \ + xercesc/dom/impl/DOMNodeIDMap.hpp \ + xercesc/dom/impl/DOMNodeImpl.hpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.hpp \ + xercesc/dom/impl/DOMNodeListImpl.hpp \ + xercesc/dom/impl/DOMNodeVector.hpp \ + xercesc/dom/impl/DOMNormalizer.hpp \ + xercesc/dom/impl/DOMNotationImpl.hpp \ + xercesc/dom/impl/DOMParentNode.hpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.hpp \ + xercesc/dom/impl/DOMRangeImpl.hpp \ + xercesc/dom/impl/DOMStringListImpl.hpp \ + xercesc/dom/impl/DOMStringPool.hpp \ + xercesc/dom/impl/DOMTextImpl.hpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.hpp \ + xercesc/dom/impl/DOMTypeInfoImpl.hpp \ + xercesc/dom/impl/DOMLSSerializerImpl.hpp \ + xercesc/dom/impl/DOMLSInputImpl.hpp \ + xercesc/dom/impl/DOMLSOutputImpl.hpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.hpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.hpp \ + xercesc/dom/impl/DOMXPathResultImpl.hpp \ + xercesc/dom/impl/XSDElementNSImpl.hpp + +domimpl_sources = \ + xercesc/dom/impl/DOMAttrImpl.cpp \ + xercesc/dom/impl/DOMAttrMapImpl.cpp \ + xercesc/dom/impl/DOMAttrNSImpl.cpp \ + xercesc/dom/impl/DOMCDATASectionImpl.cpp \ + xercesc/dom/impl/DOMCharacterDataImpl.cpp \ + xercesc/dom/impl/DOMChildNode.cpp \ + xercesc/dom/impl/DOMCommentImpl.cpp \ + xercesc/dom/impl/DOMConfigurationImpl.cpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.cpp \ + xercesc/dom/impl/DOMDocumentFragmentImpl.cpp \ + xercesc/dom/impl/DOMDocumentImpl.cpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.cpp \ + xercesc/dom/impl/DOMElementImpl.cpp \ + xercesc/dom/impl/DOMElementNSImpl.cpp \ + xercesc/dom/impl/DOMEntityImpl.cpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.cpp \ + xercesc/dom/impl/DOMErrorImpl.cpp \ + xercesc/dom/impl/DOMImplementationImpl.cpp \ + xercesc/dom/impl/DOMImplementationListImpl.cpp \ + xercesc/dom/impl/DOMImplementationRegistry.cpp \ + xercesc/dom/impl/DOMLocatorImpl.cpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.cpp \ + xercesc/dom/impl/DOMNodeIDMap.cpp \ + xercesc/dom/impl/DOMNodeImpl.cpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.cpp \ + xercesc/dom/impl/DOMNodeListImpl.cpp \ + xercesc/dom/impl/DOMNodeVector.cpp \ + xercesc/dom/impl/DOMNormalizer.cpp \ + xercesc/dom/impl/DOMNotationImpl.cpp \ + xercesc/dom/impl/DOMParentNode.cpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.cpp \ + xercesc/dom/impl/DOMRangeImpl.cpp \ + xercesc/dom/impl/DOMStringListImpl.cpp \ + xercesc/dom/impl/DOMStringPool.cpp \ + xercesc/dom/impl/DOMTextImpl.cpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.cpp \ + xercesc/dom/impl/DOMTypeInfoImpl.cpp \ + xercesc/dom/impl/DOMLSSerializerImpl.cpp \ + xercesc/dom/impl/DOMLSInputImpl.cpp \ + xercesc/dom/impl/DOMLSOutputImpl.cpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.cpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.cpp \ + xercesc/dom/impl/DOMXPathResultImpl.cpp \ + xercesc/dom/impl/XSDElementNSImpl.cpp + +framework_headers = \ + xercesc/framework/BinOutputStream.hpp \ + xercesc/framework/LocalFileFormatTarget.hpp \ + xercesc/framework/LocalFileInputSource.hpp \ + xercesc/framework/MemBufFormatTarget.hpp \ + xercesc/framework/MemBufInputSource.hpp \ + xercesc/framework/MemoryManager.hpp \ + xercesc/framework/psvi/PSVIAttribute.hpp \ + xercesc/framework/psvi/PSVIAttributeList.hpp \ + xercesc/framework/psvi/PSVIElement.hpp \ + xercesc/framework/psvi/PSVIHandler.hpp \ + xercesc/framework/psvi/PSVIItem.hpp \ + xercesc/framework/psvi/XSAnnotation.hpp \ + xercesc/framework/psvi/XSAttributeDeclaration.hpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.hpp \ + xercesc/framework/psvi/XSAttributeUse.hpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.hpp \ + xercesc/framework/psvi/XSConstants.hpp \ + xercesc/framework/psvi/XSElementDeclaration.hpp \ + xercesc/framework/psvi/XSFacet.hpp \ + xercesc/framework/psvi/XSIDCDefinition.hpp \ + xercesc/framework/psvi/XSModel.hpp \ + xercesc/framework/psvi/XSModelGroup.hpp \ + xercesc/framework/psvi/XSModelGroupDefinition.hpp \ + xercesc/framework/psvi/XSMultiValueFacet.hpp \ + xercesc/framework/psvi/XSNamedMap.hpp \ + xercesc/framework/psvi/XSNamedMap.c \ + xercesc/framework/psvi/XSNamespaceItem.hpp \ + xercesc/framework/psvi/XSNotationDeclaration.hpp \ + xercesc/framework/psvi/XSObject.hpp \ + xercesc/framework/psvi/XSParticle.hpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.hpp \ + xercesc/framework/psvi/XSTypeDefinition.hpp \ + xercesc/framework/psvi/XSValue.hpp \ + xercesc/framework/psvi/XSWildcard.hpp \ + xercesc/framework/StdInInputSource.hpp \ + xercesc/framework/StdOutFormatTarget.hpp \ + xercesc/framework/URLInputSource.hpp \ + xercesc/framework/ValidationContext.hpp \ + xercesc/framework/Wrapper4DOMLSInput.hpp \ + xercesc/framework/Wrapper4InputSource.hpp \ + xercesc/framework/XMLAttDef.hpp \ + xercesc/framework/XMLAttDefList.hpp \ + xercesc/framework/XMLAttr.hpp \ + xercesc/framework/XMLBuffer.hpp \ + xercesc/framework/XMLBufferMgr.hpp \ + xercesc/framework/XMLContentModel.hpp \ + xercesc/framework/XMLDocumentHandler.hpp \ + xercesc/framework/XMLDTDDescription.hpp \ + xercesc/framework/XMLElementDecl.hpp \ + xercesc/framework/XMLEntityDecl.hpp \ + xercesc/framework/XMLEntityHandler.hpp \ + xercesc/framework/XMLErrorCodes.hpp \ + xercesc/framework/XMLErrorReporter.hpp \ + xercesc/framework/XMLFormatter.hpp \ + xercesc/framework/XMLGrammarDescription.hpp \ + xercesc/framework/XMLGrammarPool.hpp \ + xercesc/framework/XMLGrammarPoolImpl.hpp \ + xercesc/framework/XMLNotationDecl.hpp \ + xercesc/framework/XMLPScanToken.hpp \ + xercesc/framework/XMLRecognizer.hpp \ + xercesc/framework/XMLRefInfo.hpp \ + xercesc/framework/XMLSchemaDescription.hpp \ + xercesc/framework/XMLValidator.hpp \ + xercesc/framework/XMLValidityCodes.hpp + +framework_sources = \ + xercesc/framework/BinOutputStream.cpp \ + xercesc/framework/LocalFileFormatTarget.cpp \ + xercesc/framework/LocalFileInputSource.cpp \ + xercesc/framework/MemBufFormatTarget.cpp \ + xercesc/framework/MemBufInputSource.cpp \ + xercesc/framework/psvi/PSVIAttribute.cpp \ + xercesc/framework/psvi/PSVIAttributeList.cpp \ + xercesc/framework/psvi/PSVIElement.cpp \ + xercesc/framework/psvi/PSVIItem.cpp \ + xercesc/framework/psvi/XSAnnotation.cpp \ + xercesc/framework/psvi/XSAttributeDeclaration.cpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.cpp \ + xercesc/framework/psvi/XSAttributeUse.cpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.cpp \ + xercesc/framework/psvi/XSElementDeclaration.cpp \ + xercesc/framework/psvi/XSFacet.cpp \ + xercesc/framework/psvi/XSIDCDefinition.cpp \ + xercesc/framework/psvi/XSModel.cpp \ + xercesc/framework/psvi/XSModelGroup.cpp \ + xercesc/framework/psvi/XSModelGroupDefinition.cpp \ + xercesc/framework/psvi/XSMultiValueFacet.cpp \ + xercesc/framework/psvi/XSNamespaceItem.cpp \ + xercesc/framework/psvi/XSNotationDeclaration.cpp \ + xercesc/framework/psvi/XSObject.cpp \ + xercesc/framework/psvi/XSParticle.cpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.cpp \ + xercesc/framework/psvi/XSTypeDefinition.cpp \ + xercesc/framework/psvi/XSValue.cpp \ + xercesc/framework/psvi/XSWildcard.cpp \ + xercesc/framework/StdInInputSource.cpp \ + xercesc/framework/StdOutFormatTarget.cpp \ + xercesc/framework/URLInputSource.cpp \ + xercesc/framework/Wrapper4DOMLSInput.cpp \ + xercesc/framework/Wrapper4InputSource.cpp \ + xercesc/framework/XMLAttDef.cpp \ + xercesc/framework/XMLAttDefList.cpp \ + xercesc/framework/XMLAttr.cpp \ + xercesc/framework/XMLBuffer.cpp \ + xercesc/framework/XMLBufferMgr.cpp \ + xercesc/framework/XMLContentModel.cpp \ + xercesc/framework/XMLDTDDescription.cpp \ + xercesc/framework/XMLElementDecl.cpp \ + xercesc/framework/XMLEntityDecl.cpp \ + xercesc/framework/XMLFormatter.cpp \ + xercesc/framework/XMLGrammarDescription.cpp \ + xercesc/framework/XMLGrammarPoolImpl.cpp \ + xercesc/framework/XMLNotationDecl.cpp \ + xercesc/framework/XMLRecognizer.cpp \ + xercesc/framework/XMLRefInfo.cpp \ + xercesc/framework/XMLSchemaDescription.cpp \ + xercesc/framework/XMLValidator.cpp + +internal_headers = \ + xercesc/internal/BinFileOutputStream.hpp \ + xercesc/internal/BinMemOutputStream.hpp \ + xercesc/internal/CharTypeTables.hpp \ + xercesc/internal/DGXMLScanner.hpp \ + xercesc/internal/ElemStack.hpp \ + xercesc/internal/EndOfEntityException.hpp \ + xercesc/internal/IANAEncodings.hpp \ + xercesc/internal/IGXMLScanner.hpp \ + xercesc/internal/MemoryManagerImpl.hpp \ + xercesc/internal/ReaderMgr.hpp \ + xercesc/internal/SGXMLScanner.hpp \ + xercesc/internal/ValidationContextImpl.hpp \ + xercesc/internal/VecAttributesImpl.hpp \ + xercesc/internal/VecAttrListImpl.hpp \ + xercesc/internal/WFXMLScanner.hpp \ + xercesc/internal/XMLInternalErrorHandler.hpp \ + xercesc/internal/XMLReader.hpp \ + xercesc/internal/XMLScanner.hpp \ + xercesc/internal/XMLScannerResolver.hpp \ + xercesc/internal/XProtoType.hpp \ + xercesc/internal/XSAXMLScanner.hpp \ + xercesc/internal/XSerializable.hpp \ + xercesc/internal/XSerializationException.hpp \ + xercesc/internal/XSerializeEngine.hpp \ + xercesc/internal/XSObjectFactory.hpp \ + xercesc/internal/XTemplateSerializer.hpp + +internal_sources = \ + xercesc/internal/BinFileOutputStream.cpp \ + xercesc/internal/BinMemOutputStream.cpp \ + xercesc/internal/DGXMLScanner.cpp \ + xercesc/internal/ElemStack.cpp \ + xercesc/internal/IGXMLScanner.cpp \ + xercesc/internal/IGXMLScanner2.cpp \ + xercesc/internal/MemoryManagerImpl.cpp \ + xercesc/internal/ReaderMgr.cpp \ + xercesc/internal/SGXMLScanner.cpp \ + xercesc/internal/ValidationContextImpl.cpp \ + xercesc/internal/VecAttributesImpl.cpp \ + xercesc/internal/VecAttrListImpl.cpp \ + xercesc/internal/WFXMLScanner.cpp \ + xercesc/internal/XMLReader.cpp \ + xercesc/internal/XMLScanner.cpp \ + xercesc/internal/XMLScannerResolver.cpp \ + xercesc/internal/XProtoType.cpp \ + xercesc/internal/XSAXMLScanner.cpp \ + xercesc/internal/XSerializeEngine.cpp \ + xercesc/internal/XSObjectFactory.cpp \ + xercesc/internal/XTemplateSerializer.cpp + +parsers_headers = \ + xercesc/parsers/AbstractDOMParser.hpp \ + xercesc/parsers/DOMLSParserImpl.hpp \ + xercesc/parsers/SAX2XMLFilterImpl.hpp \ + xercesc/parsers/SAX2XMLReaderImpl.hpp \ + xercesc/parsers/SAXParser.hpp \ + xercesc/parsers/XercesDOMParser.hpp + +parsers_sources = \ + xercesc/parsers/AbstractDOMParser.cpp \ + xercesc/parsers/DOMLSParserImpl.cpp \ + xercesc/parsers/SAX2XMLFilterImpl.cpp \ + xercesc/parsers/SAX2XMLReaderImpl.cpp \ + xercesc/parsers/SAXParser.cpp \ + xercesc/parsers/XercesDOMParser.cpp + +sax_headers = \ + xercesc/sax/AttributeList.hpp \ + xercesc/sax/DocumentHandler.hpp \ + xercesc/sax/DTDHandler.hpp \ + xercesc/sax/EntityResolver.hpp \ + xercesc/sax/ErrorHandler.hpp \ + xercesc/sax/HandlerBase.hpp \ + xercesc/sax/InputSource.hpp \ + xercesc/sax/Locator.hpp \ + xercesc/sax/Parser.hpp \ + xercesc/sax/SAXException.hpp \ + xercesc/sax/SAXParseException.hpp + +sax_sources = \ + xercesc/sax/Dummy.cpp \ + xercesc/sax/InputSource.cpp \ + xercesc/sax/SAXException.cpp \ + xercesc/sax/SAXParseException.cpp + +sax2_headers = \ + xercesc/sax2/Attributes.hpp \ + xercesc/sax2/ContentHandler.hpp \ + xercesc/sax2/DeclHandler.hpp \ + xercesc/sax2/DefaultHandler.hpp \ + xercesc/sax2/LexicalHandler.hpp \ + xercesc/sax2/SAX2XMLFilter.hpp \ + xercesc/sax2/SAX2XMLReader.hpp \ + xercesc/sax2/XMLReaderFactory.hpp + +sax2_sources = \ + xercesc/sax2/sax2Dummy.cpp + +util_headers = \ + xercesc/util/ArrayIndexOutOfBoundsException.hpp \ + xercesc/util/Base64.hpp \ + xercesc/util/BaseRefVectorOf.hpp \ + xercesc/util/BaseRefVectorOf.c \ + xercesc/util/BinFileInputStream.hpp \ + xercesc/util/BinInputStream.hpp \ + xercesc/util/BinMemInputStream.hpp \ + xercesc/util/BitOps.hpp \ + xercesc/util/BitSet.hpp \ + xercesc/util/CountedPointer.hpp \ + xercesc/util/CountedPointer.c \ + xercesc/util/DefaultPanicHandler.hpp \ + xercesc/util/EmptyStackException.hpp \ + xercesc/util/EncodingValidator.hpp \ + xercesc/util/FlagJanitor.hpp \ + xercesc/util/FlagJanitor.c \ + xercesc/util/Hashers.hpp \ + xercesc/util/Hash2KeysSetOf.hpp \ + xercesc/util/Hash2KeysSetOf.c \ + xercesc/util/HexBin.hpp \ + xercesc/util/IllegalArgumentException.hpp \ + xercesc/util/InvalidCastException.hpp \ + xercesc/util/IOException.hpp \ + xercesc/util/Janitor.hpp \ + xercesc/util/Janitor.c \ + xercesc/util/KeyRefPair.hpp \ + xercesc/util/KeyRefPair.c \ + xercesc/util/KeyValuePair.hpp \ + xercesc/util/KeyValuePair.c \ + xercesc/util/KVStringPair.hpp \ + xercesc/util/Mutexes.hpp \ + xercesc/util/LogicalPath.c \ + xercesc/util/NameIdPool.hpp \ + xercesc/util/NameIdPool.c \ + xercesc/util/NoSuchElementException.hpp \ + xercesc/util/NullPointerException.hpp \ + xercesc/util/NumberFormatException.hpp \ + xercesc/util/OutOfMemoryException.hpp \ + xercesc/util/PanicHandler.hpp \ + xercesc/util/ParseException.hpp \ + xercesc/util/PlatformUtils.hpp \ + xercesc/util/PSVIUni.hpp \ + xercesc/util/QName.hpp \ + xercesc/util/RefArrayOf.hpp \ + xercesc/util/RefArrayOf.c \ + xercesc/util/RefArrayVectorOf.hpp \ + xercesc/util/RefArrayVectorOf.c \ + xercesc/util/RefHash2KeysTableOf.hpp \ + xercesc/util/RefHash2KeysTableOf.c \ + xercesc/util/RefHash3KeysIdPool.hpp \ + xercesc/util/RefHash3KeysIdPool.c \ + xercesc/util/RefHashTableOf.hpp \ + xercesc/util/RefHashTableOf.c \ + xercesc/util/RefStackOf.hpp \ + xercesc/util/RefStackOf.c \ + xercesc/util/RefVectorOf.hpp \ + xercesc/util/RefVectorOf.c \ + xercesc/util/regx/ASCIIRangeFactory.hpp \ + xercesc/util/regx/BlockRangeFactory.hpp \ + xercesc/util/regx/BMPattern.hpp \ + xercesc/util/regx/CharToken.hpp \ + xercesc/util/regx/ClosureToken.hpp \ + xercesc/util/regx/ConcatToken.hpp \ + xercesc/util/regx/Match.hpp \ + xercesc/util/regx/Op.hpp \ + xercesc/util/regx/OpFactory.hpp \ + xercesc/util/regx/ParenToken.hpp \ + xercesc/util/regx/ParserForXMLSchema.hpp \ + xercesc/util/regx/RangeFactory.hpp \ + xercesc/util/regx/RangeToken.hpp \ + xercesc/util/regx/RangeTokenMap.hpp \ + xercesc/util/regx/RegularExpression.hpp \ + xercesc/util/regx/RegxDefs.hpp \ + xercesc/util/regx/RegxParser.hpp \ + xercesc/util/regx/RegxUtil.hpp \ + xercesc/util/regx/StringToken.hpp \ + xercesc/util/regx/Token.hpp \ + xercesc/util/regx/TokenFactory.hpp \ + xercesc/util/regx/TokenInc.hpp \ + xercesc/util/regx/UniCharTable.hpp \ + xercesc/util/regx/UnicodeRangeFactory.hpp \ + xercesc/util/regx/UnionToken.hpp \ + xercesc/util/regx/XMLRangeFactory.hpp \ + xercesc/util/regx/XMLUniCharacter.hpp \ + xercesc/util/RuntimeException.hpp \ + xercesc/util/SchemaDateTimeException.hpp \ + xercesc/util/SecurityManager.hpp \ + xercesc/util/StringPool.hpp \ + xercesc/util/SynchronizedStringPool.hpp \ + xercesc/util/TranscodingException.hpp \ + xercesc/util/TransENameMap.hpp \ + xercesc/util/TransENameMap.c \ + xercesc/util/TransService.hpp \ + xercesc/util/UnexpectedEOFException.hpp \ + xercesc/util/UnsupportedEncodingException.hpp \ + xercesc/util/UTFDataFormatException.hpp \ + xercesc/util/ValueArrayOf.hpp \ + xercesc/util/ValueArrayOf.c \ + xercesc/util/ValueHashTableOf.hpp \ + xercesc/util/ValueHashTableOf.c \ + xercesc/util/ValueStackOf.hpp \ + xercesc/util/ValueStackOf.c \ + xercesc/util/ValueVectorOf.hpp \ + xercesc/util/ValueVectorOf.c \ + xercesc/util/XercesDefs.hpp \ + xercesc/util/XercesVersion.hpp \ + xercesc/util/XMemory.hpp \ + xercesc/util/XML256TableTranscoder.hpp \ + xercesc/util/XML88591Transcoder.hpp \ + xercesc/util/XMLAbstractDoubleFloat.hpp \ + xercesc/util/XMLASCIITranscoder.hpp \ + xercesc/util/XMLBigDecimal.hpp \ + xercesc/util/XMLBigInteger.hpp \ + xercesc/util/XMLChar.hpp \ + xercesc/util/XMLChTranscoder.hpp \ + xercesc/util/XMLDateTime.hpp \ + xercesc/util/XMLDOMMsg.hpp \ + xercesc/util/XMLDouble.hpp \ + xercesc/util/XMLEBCDICTranscoder.hpp \ + xercesc/util/XMLEntityResolver.hpp \ + xercesc/util/XMLEnumerator.hpp \ + xercesc/util/XMLException.hpp \ + xercesc/util/XMLExceptMsgs.hpp \ + xercesc/util/XMLFileMgr.hpp \ + xercesc/util/XMLFloat.hpp \ + xercesc/util/XMLIBM1047Transcoder.hpp \ + xercesc/util/XMLIBM1140Transcoder.hpp \ + xercesc/util/XMLInitializer.hpp \ + xercesc/util/XMLInteger.hpp \ + xercesc/util/XMLMutexMgr.hpp \ + xercesc/util/XMLMsgLoader.hpp \ + xercesc/util/XMLNetAccessor.hpp \ + xercesc/util/XMLNumber.hpp \ + xercesc/util/XMLResourceIdentifier.hpp \ + xercesc/util/XMLString.hpp \ + xercesc/util/XMLStringTokenizer.hpp \ + xercesc/util/XMLUCS4Transcoder.hpp \ + xercesc/util/XMLUni.hpp \ + xercesc/util/XMLUniDefs.hpp \ + xercesc/util/XMLUri.hpp \ + xercesc/util/XMLURL.hpp \ + xercesc/util/XMLUTF16Transcoder.hpp \ + xercesc/util/XMLUTF8Transcoder.hpp \ + xercesc/util/XMLWin1252Transcoder.hpp + +util_sources = \ + xercesc/util/Base64.cpp \ + xercesc/util/BinFileInputStream.cpp \ + xercesc/util/BinInputStream.cpp \ + xercesc/util/BinMemInputStream.cpp \ + xercesc/util/BitSet.cpp \ + xercesc/util/DefaultPanicHandler.cpp \ + xercesc/util/EncodingValidator.cpp \ + xercesc/util/HeaderDummy.cpp \ + xercesc/util/HexBin.cpp \ + xercesc/util/KVStringPair.cpp \ + xercesc/util/Mutexes.cpp \ + xercesc/util/PanicHandler.cpp \ + xercesc/util/PlatformUtils.cpp \ + xercesc/util/PSVIUni.cpp \ + xercesc/util/QName.cpp \ + xercesc/util/regx/ASCIIRangeFactory.cpp \ + xercesc/util/regx/BlockRangeFactory.cpp \ + xercesc/util/regx/BMPattern.cpp \ + xercesc/util/regx/CharToken.cpp \ + xercesc/util/regx/ClosureToken.cpp \ + xercesc/util/regx/ConcatToken.cpp \ + xercesc/util/regx/Match.cpp \ + xercesc/util/regx/Op.cpp \ + xercesc/util/regx/OpFactory.cpp \ + xercesc/util/regx/ParenToken.cpp \ + xercesc/util/regx/ParserForXMLSchema.cpp \ + xercesc/util/regx/RangeFactory.cpp \ + xercesc/util/regx/RangeToken.cpp \ + xercesc/util/regx/RangeTokenMap.cpp \ + xercesc/util/regx/RegularExpression.cpp \ + xercesc/util/regx/RegxParser.cpp \ + xercesc/util/regx/RegxUtil.cpp \ + xercesc/util/regx/StringToken.cpp \ + xercesc/util/regx/Token.cpp \ + xercesc/util/regx/TokenFactory.cpp \ + xercesc/util/regx/UnicodeRangeFactory.cpp \ + xercesc/util/regx/UnionToken.cpp \ + xercesc/util/regx/XMLRangeFactory.cpp \ + xercesc/util/regx/XMLUniCharacter.cpp \ + xercesc/util/StringPool.cpp \ + xercesc/util/SynchronizedStringPool.cpp \ + xercesc/util/TransService.cpp \ + xercesc/util/XMemory.cpp \ + xercesc/util/XML256TableTranscoder.cpp \ + xercesc/util/XML88591Transcoder.cpp \ + xercesc/util/XMLAbstractDoubleFloat.cpp \ + xercesc/util/XMLASCIITranscoder.cpp \ + xercesc/util/XMLBigDecimal.cpp \ + xercesc/util/XMLBigInteger.cpp \ + xercesc/util/XMLChar.cpp \ + xercesc/util/XMLChTranscoder.cpp \ + xercesc/util/XMLDateTime.cpp \ + xercesc/util/XMLDouble.cpp \ + xercesc/util/XMLEBCDICTranscoder.cpp \ + xercesc/util/XMLException.cpp \ + xercesc/util/XMLFloat.cpp \ + xercesc/util/XMLIBM1047Transcoder.cpp \ + xercesc/util/XMLIBM1140Transcoder.cpp \ + xercesc/util/XMLInitializer.cpp \ + xercesc/util/XMLMsgLoader.cpp \ + xercesc/util/XMLNumber.cpp \ + xercesc/util/XMLString.cpp \ + xercesc/util/XMLStringTokenizer.cpp \ + xercesc/util/XMLUCS4Transcoder.cpp \ + xercesc/util/XMLUni.cpp \ + xercesc/util/XMLUri.cpp \ + xercesc/util/XMLURL.cpp \ + xercesc/util/XMLUTF16Transcoder.cpp \ + xercesc/util/XMLUTF8Transcoder.cpp \ + xercesc/util/XMLWin1252Transcoder.cpp + +validators_headers = \ + xercesc/validators/common/AllContentModel.hpp \ + xercesc/validators/common/CMAny.hpp \ + xercesc/validators/common/CMBinaryOp.hpp \ + xercesc/validators/common/CMLeaf.hpp \ + xercesc/validators/common/CMRepeatingLeaf.hpp \ + xercesc/validators/common/CMNode.hpp \ + xercesc/validators/common/CMStateSet.hpp \ + xercesc/validators/common/CMUnaryOp.hpp \ + xercesc/validators/common/ContentLeafNameTypeVector.hpp \ + xercesc/validators/common/ContentSpecNode.hpp \ + xercesc/validators/common/DFAContentModel.hpp \ + xercesc/validators/common/Grammar.hpp \ + xercesc/validators/common/GrammarResolver.hpp \ + xercesc/validators/common/MixedContentModel.hpp \ + xercesc/validators/common/SimpleContentModel.hpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.hpp \ + xercesc/validators/datatype/AbstractNumericValidator.hpp \ + xercesc/validators/datatype/AbstractStringValidator.hpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.hpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.hpp \ + xercesc/validators/datatype/DateDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeValidator.hpp \ + xercesc/validators/datatype/DayDatatypeValidator.hpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.hpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.hpp \ + xercesc/validators/datatype/DurationDatatypeValidator.hpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.hpp \ + xercesc/validators/datatype/FloatDatatypeValidator.hpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/IDDatatypeValidator.hpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.hpp \ + xercesc/validators/datatype/InvalidDatatypeFacetException.hpp \ + xercesc/validators/datatype/InvalidDatatypeValueException.hpp \ + xercesc/validators/datatype/ListDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.hpp \ + xercesc/validators/datatype/NameDatatypeValidator.hpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.hpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp \ + xercesc/validators/datatype/QNameDatatypeValidator.hpp \ + xercesc/validators/datatype/StringDatatypeValidator.hpp \ + xercesc/validators/datatype/TimeDatatypeValidator.hpp \ + xercesc/validators/datatype/UnionDatatypeValidator.hpp \ + xercesc/validators/datatype/XMLCanRepGroup.hpp \ + xercesc/validators/datatype/YearDatatypeValidator.hpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.hpp \ + xercesc/validators/DTD/DocTypeHandler.hpp \ + xercesc/validators/DTD/DTDAttDef.hpp \ + xercesc/validators/DTD/DTDAttDefList.hpp \ + xercesc/validators/DTD/DTDElementDecl.hpp \ + xercesc/validators/DTD/DTDEntityDecl.hpp \ + xercesc/validators/DTD/DTDGrammar.hpp \ + xercesc/validators/DTD/DTDScanner.hpp \ + xercesc/validators/DTD/DTDValidator.hpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp \ + xercesc/validators/schema/ComplexTypeInfo.hpp \ + xercesc/validators/schema/GeneralAttributeCheck.hpp \ + xercesc/validators/schema/identity/FieldActivator.hpp \ + xercesc/validators/schema/identity/FieldValueMap.hpp \ + xercesc/validators/schema/identity/IC_Field.hpp \ + xercesc/validators/schema/identity/IC_Key.hpp \ + xercesc/validators/schema/identity/IC_KeyRef.hpp \ + xercesc/validators/schema/identity/IC_Selector.hpp \ + xercesc/validators/schema/identity/IC_Unique.hpp \ + xercesc/validators/schema/identity/IdentityConstraint.hpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.hpp \ + xercesc/validators/schema/identity/ValueStore.hpp \ + xercesc/validators/schema/identity/ValueStoreCache.hpp \ + xercesc/validators/schema/identity/XercesXPath.hpp \ + xercesc/validators/schema/identity/XPathException.hpp \ + xercesc/validators/schema/identity/XPathMatcher.hpp \ + xercesc/validators/schema/identity/XPathMatcherStack.hpp \ + xercesc/validators/schema/identity/XPathSymbols.hpp \ + xercesc/validators/schema/NamespaceScope.hpp \ + xercesc/validators/schema/PSVIDefs.hpp \ + xercesc/validators/schema/SchemaAttDef.hpp \ + xercesc/validators/schema/SchemaAttDefList.hpp \ + xercesc/validators/schema/SchemaElementDecl.hpp \ + xercesc/validators/schema/SchemaGrammar.hpp \ + xercesc/validators/schema/SchemaInfo.hpp \ + xercesc/validators/schema/SchemaSymbols.hpp \ + xercesc/validators/schema/SchemaValidator.hpp \ + xercesc/validators/schema/SubstitutionGroupComparator.hpp \ + xercesc/validators/schema/TraverseSchema.hpp \ + xercesc/validators/schema/XercesAttGroupInfo.hpp \ + xercesc/validators/schema/XercesElementWildcard.hpp \ + xercesc/validators/schema/XercesGroupInfo.hpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp \ + xercesc/validators/schema/XSDDOMParser.hpp \ + xercesc/validators/schema/XSDErrorReporter.hpp \ + xercesc/validators/schema/XSDLocator.hpp \ + xercesc/validators/schema/XUtil.hpp + +validators_sources = \ + xercesc/validators/common/AllContentModel.cpp \ + xercesc/validators/common/CMAny.cpp \ + xercesc/validators/common/CMBinaryOp.cpp \ + xercesc/validators/common/CMUnaryOp.cpp \ + xercesc/validators/common/ContentLeafNameTypeVector.cpp \ + xercesc/validators/common/ContentSpecNode.cpp \ + xercesc/validators/common/DFAContentModel.cpp \ + xercesc/validators/common/Grammar.cpp \ + xercesc/validators/common/GrammarResolver.cpp \ + xercesc/validators/common/MixedContentModel.cpp \ + xercesc/validators/common/SimpleContentModel.cpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.cpp \ + xercesc/validators/datatype/AbstractNumericValidator.cpp \ + xercesc/validators/datatype/AbstractStringValidator.cpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.cpp \ + xercesc/validators/datatype/DateDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeValidator.cpp \ + xercesc/validators/datatype/DayDatatypeValidator.cpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.cpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.cpp \ + xercesc/validators/datatype/DurationDatatypeValidator.cpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.cpp \ + xercesc/validators/datatype/FloatDatatypeValidator.cpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/IDDatatypeValidator.cpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.cpp \ + xercesc/validators/datatype/ListDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.cpp \ + xercesc/validators/datatype/NameDatatypeValidator.cpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.cpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp \ + xercesc/validators/datatype/QNameDatatypeValidator.cpp \ + xercesc/validators/datatype/StringDatatypeValidator.cpp \ + xercesc/validators/datatype/TimeDatatypeValidator.cpp \ + xercesc/validators/datatype/UnionDatatypeValidator.cpp \ + xercesc/validators/datatype/XMLCanRepGroup.cpp \ + xercesc/validators/datatype/YearDatatypeValidator.cpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.cpp \ + xercesc/validators/DTD/DTDAttDef.cpp \ + xercesc/validators/DTD/DTDAttDefList.cpp \ + xercesc/validators/DTD/DTDElementDecl.cpp \ + xercesc/validators/DTD/DTDEntityDecl.cpp \ + xercesc/validators/DTD/DTDGrammar.cpp \ + xercesc/validators/DTD/DTDScanner.cpp \ + xercesc/validators/DTD/DTDValidator.cpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp \ + xercesc/validators/schema/ComplexTypeInfo.cpp \ + xercesc/validators/schema/GeneralAttributeCheck.cpp \ + xercesc/validators/schema/identity/FieldActivator.cpp \ + xercesc/validators/schema/identity/FieldValueMap.cpp \ + xercesc/validators/schema/identity/IC_Field.cpp \ + xercesc/validators/schema/identity/IC_Key.cpp \ + xercesc/validators/schema/identity/IC_KeyRef.cpp \ + xercesc/validators/schema/identity/IC_Selector.cpp \ + xercesc/validators/schema/identity/IC_Unique.cpp \ + xercesc/validators/schema/identity/IdentityConstraint.cpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.cpp \ + xercesc/validators/schema/identity/ValueStore.cpp \ + xercesc/validators/schema/identity/ValueStoreCache.cpp \ + xercesc/validators/schema/identity/XercesXPath.cpp \ + xercesc/validators/schema/identity/XPathMatcher.cpp \ + xercesc/validators/schema/identity/XPathMatcherStack.cpp \ + xercesc/validators/schema/identity/XPathSymbols.cpp \ + xercesc/validators/schema/NamespaceScope.cpp \ + xercesc/validators/schema/SchemaAttDef.cpp \ + xercesc/validators/schema/SchemaAttDefList.cpp \ + xercesc/validators/schema/SchemaElementDecl.cpp \ + xercesc/validators/schema/SchemaGrammar.cpp \ + xercesc/validators/schema/SchemaInfo.cpp \ + xercesc/validators/schema/SchemaSymbols.cpp \ + xercesc/validators/schema/SchemaValidator.cpp \ + xercesc/validators/schema/SubstitutionGroupComparator.cpp \ + xercesc/validators/schema/TraverseSchema.cpp \ + xercesc/validators/schema/XercesAttGroupInfo.cpp \ + xercesc/validators/schema/XercesElementWildcard.cpp \ + xercesc/validators/schema/XercesGroupInfo.cpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp \ + xercesc/validators/schema/XSDDOMParser.cpp \ + xercesc/validators/schema/XSDErrorReporter.cpp \ + xercesc/validators/schema/XSDLocator.cpp \ + xercesc/validators/schema/XUtil.cpp + +xinclude_headers = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp \ + xercesc/xinclude/XIncludeLocation.hpp \ + xercesc/xinclude/XIncludeUtils.hpp + +xinclude_sources = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp \ + xercesc/xinclude/XIncludeLocation.cpp \ + xercesc/xinclude/XIncludeUtils.cpp + +icu_headers = \ + xercesc/util/Transcoders/ICU/ICUTransService.hpp + +icu_sources = \ + xercesc/util/Transcoders/ICU/ICUTransService.cpp + +gnuiconv_headers = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp + +gnuiconv_sources = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp + +iconv_headers = \ + xercesc/util/Transcoders/Iconv/IconvTransService.hpp + +iconv_sources = \ + xercesc/util/Transcoders/Iconv/IconvTransService.cpp + +macosunicodeconverter_headers = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp + +macosunicodeconverter_sources = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp + +wintrans_headers = \ + xercesc/util/Transcoders/Win32/Win32TransService.hpp + +wintrans_sources = \ + xercesc/util/Transcoders/Win32/Win32TransService.cpp + +curl_headers = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.hpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp + +curl_sources = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp + +sockets_headers = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +sockets_sources = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + +cfurl_headers = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.hpp + +cfurl_sources = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.cpp + +winsock_headers = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +winsock_sources = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + +msginmemory_headers = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp \ + xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp + +msginmemory_sources = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp + +msgicu_headers = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp + +msgicu_sources = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp + +msgicu_nodist_sources = \ + xercesc_messages.c \ + root_res.c + +msgiconv_headers = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/XMLMsgCat_Ids.hpp + +msgiconv_sources = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp + +posixfmgr_headers = \ + xercesc/util/FileManagers/PosixFileMgr.hpp + +posixfmgr_sources = \ + xercesc/util/FileManagers/PosixFileMgr.cpp + +winfmgr_headers = \ + xercesc/util/FileManagers/WindowsFileMgr.hpp + +winfmgr_sources = \ + xercesc/util/FileManagers/WindowsFileMgr.cpp + +nothreadmmgr_headers = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.hpp + +nothreadmmgr_sources = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.cpp + +posixmmgr_headers = \ + xercesc/util/MutexManagers/PosixMutexMgr.hpp + +posixmmgr_sources = \ + xercesc/util/MutexManagers/PosixMutexMgr.cpp + +winmmgr_headers = \ + xercesc/util/MutexManagers/WindowsMutexMgr.hpp + +winmmgr_sources = \ + xercesc/util/MutexManagers/WindowsMutexMgr.cpp + +PRETTY_MAKE = ${top_srcdir}/config/pretty-make +PRETTY_COMPILE = ${PRETTY_MAKE} Compiling +COMPILE = ${PRETTY_COMPILE} \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +LTCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CC --mode=compile \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +CXXCOMPILE = ${PRETTY_COMPILE} \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) + +LTCXXCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CXX --mode=compile \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +xercesc/util/$(am__dirstamp): + @$(MKDIR_P) xercesc/util + @: > xercesc/util/$(am__dirstamp) +xercesc/util/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/$(DEPDIR) + @: > xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Base64.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinFileInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinMemInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BitSet.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/DefaultPanicHandler.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/EncodingValidator.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/HeaderDummy.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/HexBin.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/KVStringPair.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Mutexes.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PanicHandler.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PlatformUtils.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PSVIUni.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/QName.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/regx + @: > xercesc/util/regx/$(am__dirstamp) +xercesc/util/regx/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/regx/$(DEPDIR) + @: > xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ASCIIRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/BlockRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/BMPattern.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/CharToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ClosureToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ConcatToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Match.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Op.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/OpFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ParenToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ParserForXMLSchema.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeTokenMap.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegularExpression.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegxParser.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegxUtil.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/StringToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Token.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/TokenFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/UnicodeRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/UnionToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/XMLRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/XMLUniCharacter.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/StringPool.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/SynchronizedStringPool.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/TransService.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMemory.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XML256TableTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XML88591Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLAbstractDoubleFloat.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLASCIITranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLBigDecimal.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLBigInteger.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLChar.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLChTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLDateTime.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLDouble.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLEBCDICTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLException.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLFloat.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLIBM1047Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLIBM1140Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLInitializer.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLMsgLoader.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLNumber.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLString.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLStringTokenizer.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUCS4Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUni.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUri.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLURL.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUTF16Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUTF8Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLWin1252Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom + @: > xercesc/dom/$(am__dirstamp) +xercesc/dom/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/$(DEPDIR) + @: > xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMLSException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMRangeException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMXPathException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/impl + @: > xercesc/dom/impl/$(am__dirstamp) +xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/impl/$(DEPDIR) + @: > xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrMapImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrNSImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCDATASectionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCharacterDataImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMChildNode.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCommentImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMConfigurationImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDeepNodeListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentFragmentImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentTypeImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMElementImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMElementNSImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMEntityImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMEntityReferenceImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMErrorImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationRegistry.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLocatorImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNamedNodeMapImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeIDMap.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeIteratorImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeListImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeVector.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNormalizer.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNotationImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMParentNode.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMProcessingInstructionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMRangeImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMStringListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMStringPool.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTextImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTreeWalkerImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTypeInfoImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSSerializerImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSInputImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSOutputImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathExpressionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathNSResolverImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathResultImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/XSDElementNSImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework + @: > xercesc/framework/$(am__dirstamp) +xercesc/framework/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/$(DEPDIR) + @: > xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/BinOutputStream.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/LocalFileFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/LocalFileInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/MemBufFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/MemBufInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/psvi + @: > xercesc/framework/psvi/$(am__dirstamp) +xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/psvi/$(DEPDIR) + @: > xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIAttribute.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIAttributeList.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIElement.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIItem.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAnnotation.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeGroupDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeUse.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSComplexTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSElementDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSFacet.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSIDCDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModel.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModelGroup.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModelGroupDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSMultiValueFacet.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSNamespaceItem.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSNotationDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSObject.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSParticle.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSSimpleTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSValue.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSWildcard.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/StdInInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/StdOutFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/URLInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/Wrapper4DOMLSInput.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/Wrapper4InputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttDef.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttDefList.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttr.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLBuffer.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLBufferMgr.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLContentModel.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLDTDDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLElementDecl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLEntityDecl.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLFormatter.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLGrammarDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLGrammarPoolImpl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLNotationDecl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLRecognizer.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLRefInfo.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLSchemaDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLValidator.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/$(am__dirstamp): + @$(MKDIR_P) xercesc/internal + @: > xercesc/internal/$(am__dirstamp) +xercesc/internal/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/internal/$(DEPDIR) + @: > xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/BinFileOutputStream.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/BinMemOutputStream.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/DGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ElemStack.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/IGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/IGXMLScanner2.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/MemoryManagerImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ReaderMgr.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/SGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ValidationContextImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/VecAttributesImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/VecAttrListImpl.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/WFXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLReader.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLScannerResolver.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XProtoType.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSAXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSerializeEngine.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSObjectFactory.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XTemplateSerializer.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/$(am__dirstamp): + @$(MKDIR_P) xercesc/parsers + @: > xercesc/parsers/$(am__dirstamp) +xercesc/parsers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/parsers/$(DEPDIR) + @: > xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/AbstractDOMParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/DOMLSParserImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAX2XMLFilterImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAX2XMLReaderImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAXParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/XercesDOMParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax + @: > xercesc/sax/$(am__dirstamp) +xercesc/sax/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax/$(DEPDIR) + @: > xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/Dummy.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/InputSource.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/SAXException.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/SAXParseException.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax2/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax2 + @: > xercesc/sax2/$(am__dirstamp) +xercesc/sax2/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax2/$(DEPDIR) + @: > xercesc/sax2/$(DEPDIR)/$(am__dirstamp) +xercesc/sax2/sax2Dummy.lo: xercesc/sax2/$(am__dirstamp) \ + xercesc/sax2/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/common + @: > xercesc/validators/common/$(am__dirstamp) +xercesc/validators/common/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/common/$(DEPDIR) + @: > xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/AllContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMAny.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMBinaryOp.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMUnaryOp.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/ContentLeafNameTypeVector.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/ContentSpecNode.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/DFAContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/Grammar.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/GrammarResolver.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/MixedContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/SimpleContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/datatype + @: > xercesc/validators/datatype/$(am__dirstamp) +xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/datatype/$(DEPDIR) + @: > xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractNumericFacetValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractNumericValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractStringValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AnyURIDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/BooleanDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DatatypeValidatorFactory.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateTimeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateTimeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DayDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DecimalDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DoubleDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DurationDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/ENTITYDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/FloatDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/HexBinaryDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/IDDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/IDREFDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/ListDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/MonthDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/MonthDayDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NCNameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NOTATIONDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/QNameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/StringDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/TimeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/UnionDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/XMLCanRepGroup.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/YearDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/YearMonthDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/DTD + @: > xercesc/validators/DTD/$(am__dirstamp) +xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/DTD/$(DEPDIR) + @: > xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDAttDef.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDAttDefList.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDElementDecl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDEntityDecl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDGrammar.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDScanner.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDValidator.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/XMLDTDDescriptionImpl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema + @: > xercesc/validators/schema/$(am__dirstamp) +xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/$(DEPDIR) + @: > xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/ComplexTypeInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/GeneralAttributeCheck.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/identity + @: > xercesc/validators/schema/identity/$(am__dirstamp) +xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/identity/$(DEPDIR) + @: > xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/FieldActivator.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/FieldValueMap.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Field.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Key.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_KeyRef.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Selector.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Unique.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IdentityConstraint.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IdentityConstraintHandler.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/ValueStore.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/ValueStoreCache.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XercesXPath.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathMatcher.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathMatcherStack.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathSymbols.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/NamespaceScope.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaAttDef.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaAttDefList.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaElementDecl.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaGrammar.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaSymbols.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaValidator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SubstitutionGroupComparator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/TraverseSchema.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesAttGroupInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesElementWildcard.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesGroupInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XMLSchemaDescriptionImpl.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDDOMParser.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDErrorReporter.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDLocator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XUtil.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/$(am__dirstamp): + @$(MKDIR_P) xercesc/xinclude + @: > xercesc/xinclude/$(am__dirstamp) +xercesc/xinclude/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/xinclude/$(DEPDIR) + @: > xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeDOMDocumentProcessor.lo: \ + xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeLocation.lo: \ + xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeUtils.lo: xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Curl + @: > xercesc/util/NetAccessors/Curl/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Curl/$(DEPDIR) + @: > xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo: \ + xercesc/util/NetAccessors/Curl/$(am__dirstamp) \ + xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo: \ + xercesc/util/NetAccessors/Curl/$(am__dirstamp) \ + xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Socket + @: > xercesc/util/NetAccessors/Socket/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Socket/$(DEPDIR) + @: > xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo: \ + xercesc/util/NetAccessors/Socket/$(am__dirstamp) \ + xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo: \ + xercesc/util/NetAccessors/Socket/$(am__dirstamp) \ + xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors + @: > xercesc/util/NetAccessors/$(am__dirstamp) +xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/$(DEPDIR) + @: > xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo: \ + xercesc/util/NetAccessors/$(am__dirstamp) \ + xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/MacOSURLAccessCF + @: > xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) + @: > xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo: \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo: \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/WinSock + @: > xercesc/util/NetAccessors/WinSock/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/WinSock/$(DEPDIR) + @: > xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo: \ + xercesc/util/NetAccessors/WinSock/$(am__dirstamp) \ + xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo: \ + xercesc/util/NetAccessors/WinSock/$(am__dirstamp) \ + xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/ICU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/ICU + @: > xercesc/util/Transcoders/ICU/$(am__dirstamp) +xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/ICU/$(DEPDIR) + @: > xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/ICU/ICUTransService.lo: \ + xercesc/util/Transcoders/ICU/$(am__dirstamp) \ + xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/IconvGNU + @: > xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) + @: > xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo: \ + xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) \ + xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Iconv + @: > xercesc/util/Transcoders/Iconv/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Iconv/$(DEPDIR) + @: > xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/IconvTransService.lo: \ + xercesc/util/Transcoders/Iconv/$(am__dirstamp) \ + xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/MacOSUnicodeConverter + @: > xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) + @: > xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo: xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) \ + xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Win32/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Win32 + @: > xercesc/util/Transcoders/Win32/$(am__dirstamp) +xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Win32/$(DEPDIR) + @: > xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Win32/Win32TransService.lo: \ + xercesc/util/Transcoders/Win32/$(am__dirstamp) \ + xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/InMemory + @: > xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) + @: > xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo: \ + xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) \ + xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/ICU + @: > xercesc/util/MsgLoaders/ICU/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/ICU/$(DEPDIR) + @: > xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo: \ + xercesc/util/MsgLoaders/ICU/$(am__dirstamp) \ + xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/MsgCatalog + @: > xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) + @: > xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo: \ + xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) \ + xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MutexManagers + @: > xercesc/util/MutexManagers/$(am__dirstamp) +xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MutexManagers/$(DEPDIR) + @: > xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/NoThreadMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/PosixMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/WindowsMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/FileManagers + @: > xercesc/util/FileManagers/$(am__dirstamp) +xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/FileManagers/$(DEPDIR) + @: > xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/PosixFileMgr.lo: \ + xercesc/util/FileManagers/$(am__dirstamp) \ + xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/WindowsFileMgr.lo: \ + xercesc/util/FileManagers/$(am__dirstamp) \ + xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +libxerces-c.la: $(libxerces_c_la_OBJECTS) $(libxerces_c_la_DEPENDENCIES) + $(libxerces_c_la_LINK) -rpath $(libdir) $(libxerces_c_la_OBJECTS) $(libxerces_c_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f xercesc/dom/DOMException.$(OBJEXT) + -rm -f xercesc/dom/DOMException.lo + -rm -f xercesc/dom/DOMLSException.$(OBJEXT) + -rm -f xercesc/dom/DOMLSException.lo + -rm -f xercesc/dom/DOMRangeException.$(OBJEXT) + -rm -f xercesc/dom/DOMRangeException.lo + -rm -f xercesc/dom/DOMXPathException.$(OBJEXT) + -rm -f xercesc/dom/DOMXPathException.lo + -rm -f xercesc/dom/impl/DOMAttrImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrImpl.lo + -rm -f xercesc/dom/impl/DOMAttrMapImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrMapImpl.lo + -rm -f xercesc/dom/impl/DOMAttrNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrNSImpl.lo + -rm -f xercesc/dom/impl/DOMCDATASectionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCDATASectionImpl.lo + -rm -f xercesc/dom/impl/DOMCharacterDataImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCharacterDataImpl.lo + -rm -f xercesc/dom/impl/DOMChildNode.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMChildNode.lo + -rm -f xercesc/dom/impl/DOMCommentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCommentImpl.lo + -rm -f xercesc/dom/impl/DOMConfigurationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMConfigurationImpl.lo + -rm -f xercesc/dom/impl/DOMDeepNodeListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDeepNodeListImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentFragmentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentFragmentImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentTypeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentTypeImpl.lo + -rm -f xercesc/dom/impl/DOMElementImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMElementImpl.lo + -rm -f xercesc/dom/impl/DOMElementNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMElementNSImpl.lo + -rm -f xercesc/dom/impl/DOMEntityImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMEntityImpl.lo + -rm -f xercesc/dom/impl/DOMEntityReferenceImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMEntityReferenceImpl.lo + -rm -f xercesc/dom/impl/DOMErrorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMErrorImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationListImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationRegistry.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationRegistry.lo + -rm -f xercesc/dom/impl/DOMLSInputImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSInputImpl.lo + -rm -f xercesc/dom/impl/DOMLSOutputImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSOutputImpl.lo + -rm -f xercesc/dom/impl/DOMLSSerializerImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSSerializerImpl.lo + -rm -f xercesc/dom/impl/DOMLocatorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLocatorImpl.lo + -rm -f xercesc/dom/impl/DOMNamedNodeMapImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNamedNodeMapImpl.lo + -rm -f xercesc/dom/impl/DOMNodeIDMap.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeIDMap.lo + -rm -f xercesc/dom/impl/DOMNodeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeImpl.lo + -rm -f xercesc/dom/impl/DOMNodeIteratorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeIteratorImpl.lo + -rm -f xercesc/dom/impl/DOMNodeListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeListImpl.lo + -rm -f xercesc/dom/impl/DOMNodeVector.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeVector.lo + -rm -f xercesc/dom/impl/DOMNormalizer.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNormalizer.lo + -rm -f xercesc/dom/impl/DOMNotationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNotationImpl.lo + -rm -f xercesc/dom/impl/DOMParentNode.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMParentNode.lo + -rm -f xercesc/dom/impl/DOMProcessingInstructionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMProcessingInstructionImpl.lo + -rm -f xercesc/dom/impl/DOMRangeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMRangeImpl.lo + -rm -f xercesc/dom/impl/DOMStringListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMStringListImpl.lo + -rm -f xercesc/dom/impl/DOMStringPool.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMStringPool.lo + -rm -f xercesc/dom/impl/DOMTextImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTextImpl.lo + -rm -f xercesc/dom/impl/DOMTreeWalkerImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTreeWalkerImpl.lo + -rm -f xercesc/dom/impl/DOMTypeInfoImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTypeInfoImpl.lo + -rm -f xercesc/dom/impl/DOMXPathExpressionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathExpressionImpl.lo + -rm -f xercesc/dom/impl/DOMXPathNSResolverImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathNSResolverImpl.lo + -rm -f xercesc/dom/impl/DOMXPathResultImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathResultImpl.lo + -rm -f xercesc/dom/impl/XSDElementNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/XSDElementNSImpl.lo + -rm -f xercesc/framework/BinOutputStream.$(OBJEXT) + -rm -f xercesc/framework/BinOutputStream.lo + -rm -f xercesc/framework/LocalFileFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/LocalFileFormatTarget.lo + -rm -f xercesc/framework/LocalFileInputSource.$(OBJEXT) + -rm -f xercesc/framework/LocalFileInputSource.lo + -rm -f xercesc/framework/MemBufFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/MemBufFormatTarget.lo + -rm -f xercesc/framework/MemBufInputSource.$(OBJEXT) + -rm -f xercesc/framework/MemBufInputSource.lo + -rm -f xercesc/framework/StdInInputSource.$(OBJEXT) + -rm -f xercesc/framework/StdInInputSource.lo + -rm -f xercesc/framework/StdOutFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/StdOutFormatTarget.lo + -rm -f xercesc/framework/URLInputSource.$(OBJEXT) + -rm -f xercesc/framework/URLInputSource.lo + -rm -f xercesc/framework/Wrapper4DOMLSInput.$(OBJEXT) + -rm -f xercesc/framework/Wrapper4DOMLSInput.lo + -rm -f xercesc/framework/Wrapper4InputSource.$(OBJEXT) + -rm -f xercesc/framework/Wrapper4InputSource.lo + -rm -f xercesc/framework/XMLAttDef.$(OBJEXT) + -rm -f xercesc/framework/XMLAttDef.lo + -rm -f xercesc/framework/XMLAttDefList.$(OBJEXT) + -rm -f xercesc/framework/XMLAttDefList.lo + -rm -f xercesc/framework/XMLAttr.$(OBJEXT) + -rm -f xercesc/framework/XMLAttr.lo + -rm -f xercesc/framework/XMLBuffer.$(OBJEXT) + -rm -f xercesc/framework/XMLBuffer.lo + -rm -f xercesc/framework/XMLBufferMgr.$(OBJEXT) + -rm -f xercesc/framework/XMLBufferMgr.lo + -rm -f xercesc/framework/XMLContentModel.$(OBJEXT) + -rm -f xercesc/framework/XMLContentModel.lo + -rm -f xercesc/framework/XMLDTDDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLDTDDescription.lo + -rm -f xercesc/framework/XMLElementDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLElementDecl.lo + -rm -f xercesc/framework/XMLEntityDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLEntityDecl.lo + -rm -f xercesc/framework/XMLFormatter.$(OBJEXT) + -rm -f xercesc/framework/XMLFormatter.lo + -rm -f xercesc/framework/XMLGrammarDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLGrammarDescription.lo + -rm -f xercesc/framework/XMLGrammarPoolImpl.$(OBJEXT) + -rm -f xercesc/framework/XMLGrammarPoolImpl.lo + -rm -f xercesc/framework/XMLNotationDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLNotationDecl.lo + -rm -f xercesc/framework/XMLRecognizer.$(OBJEXT) + -rm -f xercesc/framework/XMLRecognizer.lo + -rm -f xercesc/framework/XMLRefInfo.$(OBJEXT) + -rm -f xercesc/framework/XMLRefInfo.lo + -rm -f xercesc/framework/XMLSchemaDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLSchemaDescription.lo + -rm -f xercesc/framework/XMLValidator.$(OBJEXT) + -rm -f xercesc/framework/XMLValidator.lo + -rm -f xercesc/framework/psvi/PSVIAttribute.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIAttribute.lo + -rm -f xercesc/framework/psvi/PSVIAttributeList.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIAttributeList.lo + -rm -f xercesc/framework/psvi/PSVIElement.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIElement.lo + -rm -f xercesc/framework/psvi/PSVIItem.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIItem.lo + -rm -f xercesc/framework/psvi/XSAnnotation.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAnnotation.lo + -rm -f xercesc/framework/psvi/XSAttributeDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeDeclaration.lo + -rm -f xercesc/framework/psvi/XSAttributeGroupDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeGroupDefinition.lo + -rm -f xercesc/framework/psvi/XSAttributeUse.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeUse.lo + -rm -f xercesc/framework/psvi/XSComplexTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSComplexTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSElementDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSElementDeclaration.lo + -rm -f xercesc/framework/psvi/XSFacet.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSFacet.lo + -rm -f xercesc/framework/psvi/XSIDCDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSIDCDefinition.lo + -rm -f xercesc/framework/psvi/XSModel.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModel.lo + -rm -f xercesc/framework/psvi/XSModelGroup.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModelGroup.lo + -rm -f xercesc/framework/psvi/XSModelGroupDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModelGroupDefinition.lo + -rm -f xercesc/framework/psvi/XSMultiValueFacet.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSMultiValueFacet.lo + -rm -f xercesc/framework/psvi/XSNamespaceItem.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSNamespaceItem.lo + -rm -f xercesc/framework/psvi/XSNotationDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSNotationDeclaration.lo + -rm -f xercesc/framework/psvi/XSObject.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSObject.lo + -rm -f xercesc/framework/psvi/XSParticle.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSParticle.lo + -rm -f xercesc/framework/psvi/XSSimpleTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSSimpleTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSValue.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSValue.lo + -rm -f xercesc/framework/psvi/XSWildcard.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSWildcard.lo + -rm -f xercesc/internal/BinFileOutputStream.$(OBJEXT) + -rm -f xercesc/internal/BinFileOutputStream.lo + -rm -f xercesc/internal/BinMemOutputStream.$(OBJEXT) + -rm -f xercesc/internal/BinMemOutputStream.lo + -rm -f xercesc/internal/DGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/DGXMLScanner.lo + -rm -f xercesc/internal/ElemStack.$(OBJEXT) + -rm -f xercesc/internal/ElemStack.lo + -rm -f xercesc/internal/IGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/IGXMLScanner.lo + -rm -f xercesc/internal/IGXMLScanner2.$(OBJEXT) + -rm -f xercesc/internal/IGXMLScanner2.lo + -rm -f xercesc/internal/MemoryManagerImpl.$(OBJEXT) + -rm -f xercesc/internal/MemoryManagerImpl.lo + -rm -f xercesc/internal/ReaderMgr.$(OBJEXT) + -rm -f xercesc/internal/ReaderMgr.lo + -rm -f xercesc/internal/SGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/SGXMLScanner.lo + -rm -f xercesc/internal/ValidationContextImpl.$(OBJEXT) + -rm -f xercesc/internal/ValidationContextImpl.lo + -rm -f xercesc/internal/VecAttrListImpl.$(OBJEXT) + -rm -f xercesc/internal/VecAttrListImpl.lo + -rm -f xercesc/internal/VecAttributesImpl.$(OBJEXT) + -rm -f xercesc/internal/VecAttributesImpl.lo + -rm -f xercesc/internal/WFXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/WFXMLScanner.lo + -rm -f xercesc/internal/XMLReader.$(OBJEXT) + -rm -f xercesc/internal/XMLReader.lo + -rm -f xercesc/internal/XMLScanner.$(OBJEXT) + -rm -f xercesc/internal/XMLScanner.lo + -rm -f xercesc/internal/XMLScannerResolver.$(OBJEXT) + -rm -f xercesc/internal/XMLScannerResolver.lo + -rm -f xercesc/internal/XProtoType.$(OBJEXT) + -rm -f xercesc/internal/XProtoType.lo + -rm -f xercesc/internal/XSAXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/XSAXMLScanner.lo + -rm -f xercesc/internal/XSObjectFactory.$(OBJEXT) + -rm -f xercesc/internal/XSObjectFactory.lo + -rm -f xercesc/internal/XSerializeEngine.$(OBJEXT) + -rm -f xercesc/internal/XSerializeEngine.lo + -rm -f xercesc/internal/XTemplateSerializer.$(OBJEXT) + -rm -f xercesc/internal/XTemplateSerializer.lo + -rm -f xercesc/parsers/AbstractDOMParser.$(OBJEXT) + -rm -f xercesc/parsers/AbstractDOMParser.lo + -rm -f xercesc/parsers/DOMLSParserImpl.$(OBJEXT) + -rm -f xercesc/parsers/DOMLSParserImpl.lo + -rm -f xercesc/parsers/SAX2XMLFilterImpl.$(OBJEXT) + -rm -f xercesc/parsers/SAX2XMLFilterImpl.lo + -rm -f xercesc/parsers/SAX2XMLReaderImpl.$(OBJEXT) + -rm -f xercesc/parsers/SAX2XMLReaderImpl.lo + -rm -f xercesc/parsers/SAXParser.$(OBJEXT) + -rm -f xercesc/parsers/SAXParser.lo + -rm -f xercesc/parsers/XercesDOMParser.$(OBJEXT) + -rm -f xercesc/parsers/XercesDOMParser.lo + -rm -f xercesc/sax/Dummy.$(OBJEXT) + -rm -f xercesc/sax/Dummy.lo + -rm -f xercesc/sax/InputSource.$(OBJEXT) + -rm -f xercesc/sax/InputSource.lo + -rm -f xercesc/sax/SAXException.$(OBJEXT) + -rm -f xercesc/sax/SAXException.lo + -rm -f xercesc/sax/SAXParseException.$(OBJEXT) + -rm -f xercesc/sax/SAXParseException.lo + -rm -f xercesc/sax2/sax2Dummy.$(OBJEXT) + -rm -f xercesc/sax2/sax2Dummy.lo + -rm -f xercesc/util/Base64.$(OBJEXT) + -rm -f xercesc/util/Base64.lo + -rm -f xercesc/util/BinFileInputStream.$(OBJEXT) + -rm -f xercesc/util/BinFileInputStream.lo + -rm -f xercesc/util/BinInputStream.$(OBJEXT) + -rm -f xercesc/util/BinInputStream.lo + -rm -f xercesc/util/BinMemInputStream.$(OBJEXT) + -rm -f xercesc/util/BinMemInputStream.lo + -rm -f xercesc/util/BitSet.$(OBJEXT) + -rm -f xercesc/util/BitSet.lo + -rm -f xercesc/util/DefaultPanicHandler.$(OBJEXT) + -rm -f xercesc/util/DefaultPanicHandler.lo + -rm -f xercesc/util/EncodingValidator.$(OBJEXT) + -rm -f xercesc/util/EncodingValidator.lo + -rm -f xercesc/util/FileManagers/PosixFileMgr.$(OBJEXT) + -rm -f xercesc/util/FileManagers/PosixFileMgr.lo + -rm -f xercesc/util/FileManagers/WindowsFileMgr.$(OBJEXT) + -rm -f xercesc/util/FileManagers/WindowsFileMgr.lo + -rm -f xercesc/util/HeaderDummy.$(OBJEXT) + -rm -f xercesc/util/HeaderDummy.lo + -rm -f xercesc/util/HexBin.$(OBJEXT) + -rm -f xercesc/util/HexBin.lo + -rm -f xercesc/util/KVStringPair.$(OBJEXT) + -rm -f xercesc/util/KVStringPair.lo + -rm -f xercesc/util/MsgLoaders/ICU/ICUMsgLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo + -rm -f xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo + -rm -f xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo + -rm -f xercesc/util/MutexManagers/NoThreadMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/NoThreadMutexMgr.lo + -rm -f xercesc/util/MutexManagers/PosixMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/PosixMutexMgr.lo + -rm -f xercesc/util/MutexManagers/WindowsMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/WindowsMutexMgr.lo + -rm -f xercesc/util/Mutexes.$(OBJEXT) + -rm -f xercesc/util/Mutexes.lo + -rm -f xercesc/util/NetAccessors/BinHTTPInputStreamCommon.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo + -rm -f xercesc/util/NetAccessors/Curl/CurlNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo + -rm -f xercesc/util/NetAccessors/Curl/CurlURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo + -rm -f xercesc/util/NetAccessors/Socket/SocketNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo + -rm -f xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo + -rm -f xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo + -rm -f xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo + -rm -f xercesc/util/PSVIUni.$(OBJEXT) + -rm -f xercesc/util/PSVIUni.lo + -rm -f xercesc/util/PanicHandler.$(OBJEXT) + -rm -f xercesc/util/PanicHandler.lo + -rm -f xercesc/util/PlatformUtils.$(OBJEXT) + -rm -f xercesc/util/PlatformUtils.lo + -rm -f xercesc/util/QName.$(OBJEXT) + -rm -f xercesc/util/QName.lo + -rm -f xercesc/util/StringPool.$(OBJEXT) + -rm -f xercesc/util/StringPool.lo + -rm -f xercesc/util/SynchronizedStringPool.$(OBJEXT) + -rm -f xercesc/util/SynchronizedStringPool.lo + -rm -f xercesc/util/TransService.$(OBJEXT) + -rm -f xercesc/util/TransService.lo + -rm -f xercesc/util/Transcoders/ICU/ICUTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/ICU/ICUTransService.lo + -rm -f xercesc/util/Transcoders/Iconv/IconvTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/Iconv/IconvTransService.lo + -rm -f xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.$(OBJEXT) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo + -rm -f xercesc/util/Transcoders/Win32/Win32TransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/Win32/Win32TransService.lo + -rm -f xercesc/util/XML256TableTranscoder.$(OBJEXT) + -rm -f xercesc/util/XML256TableTranscoder.lo + -rm -f xercesc/util/XML88591Transcoder.$(OBJEXT) + -rm -f xercesc/util/XML88591Transcoder.lo + -rm -f xercesc/util/XMLASCIITranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLASCIITranscoder.lo + -rm -f xercesc/util/XMLAbstractDoubleFloat.$(OBJEXT) + -rm -f xercesc/util/XMLAbstractDoubleFloat.lo + -rm -f xercesc/util/XMLBigDecimal.$(OBJEXT) + -rm -f xercesc/util/XMLBigDecimal.lo + -rm -f xercesc/util/XMLBigInteger.$(OBJEXT) + -rm -f xercesc/util/XMLBigInteger.lo + -rm -f xercesc/util/XMLChTranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLChTranscoder.lo + -rm -f xercesc/util/XMLChar.$(OBJEXT) + -rm -f xercesc/util/XMLChar.lo + -rm -f xercesc/util/XMLDateTime.$(OBJEXT) + -rm -f xercesc/util/XMLDateTime.lo + -rm -f xercesc/util/XMLDouble.$(OBJEXT) + -rm -f xercesc/util/XMLDouble.lo + -rm -f xercesc/util/XMLEBCDICTranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLEBCDICTranscoder.lo + -rm -f xercesc/util/XMLException.$(OBJEXT) + -rm -f xercesc/util/XMLException.lo + -rm -f xercesc/util/XMLFloat.$(OBJEXT) + -rm -f xercesc/util/XMLFloat.lo + -rm -f xercesc/util/XMLIBM1047Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLIBM1047Transcoder.lo + -rm -f xercesc/util/XMLIBM1140Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLIBM1140Transcoder.lo + -rm -f xercesc/util/XMLInitializer.$(OBJEXT) + -rm -f xercesc/util/XMLInitializer.lo + -rm -f xercesc/util/XMLMsgLoader.$(OBJEXT) + -rm -f xercesc/util/XMLMsgLoader.lo + -rm -f xercesc/util/XMLNumber.$(OBJEXT) + -rm -f xercesc/util/XMLNumber.lo + -rm -f xercesc/util/XMLString.$(OBJEXT) + -rm -f xercesc/util/XMLString.lo + -rm -f xercesc/util/XMLStringTokenizer.$(OBJEXT) + -rm -f xercesc/util/XMLStringTokenizer.lo + -rm -f xercesc/util/XMLUCS4Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUCS4Transcoder.lo + -rm -f xercesc/util/XMLURL.$(OBJEXT) + -rm -f xercesc/util/XMLURL.lo + -rm -f xercesc/util/XMLUTF16Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUTF16Transcoder.lo + -rm -f xercesc/util/XMLUTF8Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUTF8Transcoder.lo + -rm -f xercesc/util/XMLUni.$(OBJEXT) + -rm -f xercesc/util/XMLUni.lo + -rm -f xercesc/util/XMLUri.$(OBJEXT) + -rm -f xercesc/util/XMLUri.lo + -rm -f xercesc/util/XMLWin1252Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLWin1252Transcoder.lo + -rm -f xercesc/util/XMemory.$(OBJEXT) + -rm -f xercesc/util/XMemory.lo + -rm -f xercesc/util/regx/ASCIIRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/ASCIIRangeFactory.lo + -rm -f xercesc/util/regx/BMPattern.$(OBJEXT) + -rm -f xercesc/util/regx/BMPattern.lo + -rm -f xercesc/util/regx/BlockRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/BlockRangeFactory.lo + -rm -f xercesc/util/regx/CharToken.$(OBJEXT) + -rm -f xercesc/util/regx/CharToken.lo + -rm -f xercesc/util/regx/ClosureToken.$(OBJEXT) + -rm -f xercesc/util/regx/ClosureToken.lo + -rm -f xercesc/util/regx/ConcatToken.$(OBJEXT) + -rm -f xercesc/util/regx/ConcatToken.lo + -rm -f xercesc/util/regx/Match.$(OBJEXT) + -rm -f xercesc/util/regx/Match.lo + -rm -f xercesc/util/regx/Op.$(OBJEXT) + -rm -f xercesc/util/regx/Op.lo + -rm -f xercesc/util/regx/OpFactory.$(OBJEXT) + -rm -f xercesc/util/regx/OpFactory.lo + -rm -f xercesc/util/regx/ParenToken.$(OBJEXT) + -rm -f xercesc/util/regx/ParenToken.lo + -rm -f xercesc/util/regx/ParserForXMLSchema.$(OBJEXT) + -rm -f xercesc/util/regx/ParserForXMLSchema.lo + -rm -f xercesc/util/regx/RangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/RangeFactory.lo + -rm -f xercesc/util/regx/RangeToken.$(OBJEXT) + -rm -f xercesc/util/regx/RangeToken.lo + -rm -f xercesc/util/regx/RangeTokenMap.$(OBJEXT) + -rm -f xercesc/util/regx/RangeTokenMap.lo + -rm -f xercesc/util/regx/RegularExpression.$(OBJEXT) + -rm -f xercesc/util/regx/RegularExpression.lo + -rm -f xercesc/util/regx/RegxParser.$(OBJEXT) + -rm -f xercesc/util/regx/RegxParser.lo + -rm -f xercesc/util/regx/RegxUtil.$(OBJEXT) + -rm -f xercesc/util/regx/RegxUtil.lo + -rm -f xercesc/util/regx/StringToken.$(OBJEXT) + -rm -f xercesc/util/regx/StringToken.lo + -rm -f xercesc/util/regx/Token.$(OBJEXT) + -rm -f xercesc/util/regx/Token.lo + -rm -f xercesc/util/regx/TokenFactory.$(OBJEXT) + -rm -f xercesc/util/regx/TokenFactory.lo + -rm -f xercesc/util/regx/UnicodeRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/UnicodeRangeFactory.lo + -rm -f xercesc/util/regx/UnionToken.$(OBJEXT) + -rm -f xercesc/util/regx/UnionToken.lo + -rm -f xercesc/util/regx/XMLRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/XMLRangeFactory.lo + -rm -f xercesc/util/regx/XMLUniCharacter.$(OBJEXT) + -rm -f xercesc/util/regx/XMLUniCharacter.lo + -rm -f xercesc/validators/DTD/DTDAttDef.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDAttDef.lo + -rm -f xercesc/validators/DTD/DTDAttDefList.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDAttDefList.lo + -rm -f xercesc/validators/DTD/DTDElementDecl.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDElementDecl.lo + -rm -f xercesc/validators/DTD/DTDEntityDecl.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDEntityDecl.lo + -rm -f xercesc/validators/DTD/DTDGrammar.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDGrammar.lo + -rm -f xercesc/validators/DTD/DTDScanner.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDScanner.lo + -rm -f xercesc/validators/DTD/DTDValidator.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDValidator.lo + -rm -f xercesc/validators/DTD/XMLDTDDescriptionImpl.$(OBJEXT) + -rm -f xercesc/validators/DTD/XMLDTDDescriptionImpl.lo + -rm -f xercesc/validators/common/AllContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/AllContentModel.lo + -rm -f xercesc/validators/common/CMAny.$(OBJEXT) + -rm -f xercesc/validators/common/CMAny.lo + -rm -f xercesc/validators/common/CMBinaryOp.$(OBJEXT) + -rm -f xercesc/validators/common/CMBinaryOp.lo + -rm -f xercesc/validators/common/CMUnaryOp.$(OBJEXT) + -rm -f xercesc/validators/common/CMUnaryOp.lo + -rm -f xercesc/validators/common/ContentLeafNameTypeVector.$(OBJEXT) + -rm -f xercesc/validators/common/ContentLeafNameTypeVector.lo + -rm -f xercesc/validators/common/ContentSpecNode.$(OBJEXT) + -rm -f xercesc/validators/common/ContentSpecNode.lo + -rm -f xercesc/validators/common/DFAContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/DFAContentModel.lo + -rm -f xercesc/validators/common/Grammar.$(OBJEXT) + -rm -f xercesc/validators/common/Grammar.lo + -rm -f xercesc/validators/common/GrammarResolver.$(OBJEXT) + -rm -f xercesc/validators/common/GrammarResolver.lo + -rm -f xercesc/validators/common/MixedContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/MixedContentModel.lo + -rm -f xercesc/validators/common/SimpleContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/SimpleContentModel.lo + -rm -f xercesc/validators/datatype/AbstractNumericFacetValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractNumericFacetValidator.lo + -rm -f xercesc/validators/datatype/AbstractNumericValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractNumericValidator.lo + -rm -f xercesc/validators/datatype/AbstractStringValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractStringValidator.lo + -rm -f xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/AnyURIDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AnyURIDatatypeValidator.lo + -rm -f xercesc/validators/datatype/Base64BinaryDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo + -rm -f xercesc/validators/datatype/BooleanDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/BooleanDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DatatypeValidator.lo + -rm -f xercesc/validators/datatype/DatatypeValidatorFactory.$(OBJEXT) + -rm -f xercesc/validators/datatype/DatatypeValidatorFactory.lo + -rm -f xercesc/validators/datatype/DateDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DateTimeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateTimeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DateTimeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateTimeValidator.lo + -rm -f xercesc/validators/datatype/DayDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DayDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DecimalDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DecimalDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DoubleDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DoubleDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DurationDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DurationDatatypeValidator.lo + -rm -f xercesc/validators/datatype/ENTITYDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/ENTITYDatatypeValidator.lo + -rm -f xercesc/validators/datatype/FloatDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/FloatDatatypeValidator.lo + -rm -f xercesc/validators/datatype/HexBinaryDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/HexBinaryDatatypeValidator.lo + -rm -f xercesc/validators/datatype/IDDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/IDDatatypeValidator.lo + -rm -f xercesc/validators/datatype/IDREFDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/IDREFDatatypeValidator.lo + -rm -f xercesc/validators/datatype/ListDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/ListDatatypeValidator.lo + -rm -f xercesc/validators/datatype/MonthDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/MonthDatatypeValidator.lo + -rm -f xercesc/validators/datatype/MonthDayDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/MonthDayDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NCNameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NCNameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NOTATIONDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NOTATIONDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/QNameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/QNameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/StringDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/StringDatatypeValidator.lo + -rm -f xercesc/validators/datatype/TimeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/TimeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/UnionDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/UnionDatatypeValidator.lo + -rm -f xercesc/validators/datatype/XMLCanRepGroup.$(OBJEXT) + -rm -f xercesc/validators/datatype/XMLCanRepGroup.lo + -rm -f xercesc/validators/datatype/YearDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/YearDatatypeValidator.lo + -rm -f xercesc/validators/datatype/YearMonthDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/YearMonthDatatypeValidator.lo + -rm -f xercesc/validators/schema/ComplexTypeInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/ComplexTypeInfo.lo + -rm -f xercesc/validators/schema/GeneralAttributeCheck.$(OBJEXT) + -rm -f xercesc/validators/schema/GeneralAttributeCheck.lo + -rm -f xercesc/validators/schema/NamespaceScope.$(OBJEXT) + -rm -f xercesc/validators/schema/NamespaceScope.lo + -rm -f xercesc/validators/schema/SchemaAttDef.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaAttDef.lo + -rm -f xercesc/validators/schema/SchemaAttDefList.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaAttDefList.lo + -rm -f xercesc/validators/schema/SchemaElementDecl.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaElementDecl.lo + -rm -f xercesc/validators/schema/SchemaGrammar.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaGrammar.lo + -rm -f xercesc/validators/schema/SchemaInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaInfo.lo + -rm -f xercesc/validators/schema/SchemaSymbols.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaSymbols.lo + -rm -f xercesc/validators/schema/SchemaValidator.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaValidator.lo + -rm -f xercesc/validators/schema/SubstitutionGroupComparator.$(OBJEXT) + -rm -f xercesc/validators/schema/SubstitutionGroupComparator.lo + -rm -f xercesc/validators/schema/TraverseSchema.$(OBJEXT) + -rm -f xercesc/validators/schema/TraverseSchema.lo + -rm -f xercesc/validators/schema/XMLSchemaDescriptionImpl.$(OBJEXT) + -rm -f xercesc/validators/schema/XMLSchemaDescriptionImpl.lo + -rm -f xercesc/validators/schema/XSDDOMParser.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDDOMParser.lo + -rm -f xercesc/validators/schema/XSDErrorReporter.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDErrorReporter.lo + -rm -f xercesc/validators/schema/XSDLocator.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDLocator.lo + -rm -f xercesc/validators/schema/XUtil.$(OBJEXT) + -rm -f xercesc/validators/schema/XUtil.lo + -rm -f xercesc/validators/schema/XercesAttGroupInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesAttGroupInfo.lo + -rm -f xercesc/validators/schema/XercesElementWildcard.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesElementWildcard.lo + -rm -f xercesc/validators/schema/XercesGroupInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesGroupInfo.lo + -rm -f xercesc/validators/schema/identity/FieldActivator.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/FieldActivator.lo + -rm -f xercesc/validators/schema/identity/FieldValueMap.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/FieldValueMap.lo + -rm -f xercesc/validators/schema/identity/IC_Field.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Field.lo + -rm -f xercesc/validators/schema/identity/IC_Key.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Key.lo + -rm -f xercesc/validators/schema/identity/IC_KeyRef.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_KeyRef.lo + -rm -f xercesc/validators/schema/identity/IC_Selector.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Selector.lo + -rm -f xercesc/validators/schema/identity/IC_Unique.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Unique.lo + -rm -f xercesc/validators/schema/identity/IdentityConstraint.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IdentityConstraint.lo + -rm -f xercesc/validators/schema/identity/IdentityConstraintHandler.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IdentityConstraintHandler.lo + -rm -f xercesc/validators/schema/identity/ValueStore.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/ValueStore.lo + -rm -f xercesc/validators/schema/identity/ValueStoreCache.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/ValueStoreCache.lo + -rm -f xercesc/validators/schema/identity/XPathMatcher.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathMatcher.lo + -rm -f xercesc/validators/schema/identity/XPathMatcherStack.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathMatcherStack.lo + -rm -f xercesc/validators/schema/identity/XPathSymbols.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathSymbols.lo + -rm -f xercesc/validators/schema/identity/XercesXPath.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XercesXPath.lo + -rm -f xercesc/xinclude/XIncludeDOMDocumentProcessor.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeDOMDocumentProcessor.lo + -rm -f xercesc/xinclude/XIncludeLocation.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeLocation.lo + -rm -f xercesc/xinclude/XIncludeUtils.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeUtils.lo + +distclean-compile: + -rm -f *.tab.c + +include $(DEPDIR)/stricmp.Plo +include $(DEPDIR)/strnicmp.Plo +include $(DEPDIR)/towlower.Plo +include $(DEPDIR)/towupper.Plo +include ./$(DEPDIR)/root_res.Plo +include ./$(DEPDIR)/xercesc_messages.Plo +include xercesc/dom/$(DEPDIR)/DOMException.Plo +include xercesc/dom/$(DEPDIR)/DOMLSException.Plo +include xercesc/dom/$(DEPDIR)/DOMRangeException.Plo +include xercesc/dom/$(DEPDIR)/DOMXPathException.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMAttrImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMAttrMapImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMAttrNSImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMCDATASectionImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMCharacterDataImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMChildNode.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMCommentImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMConfigurationImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMDeepNodeListImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMDocumentFragmentImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMDocumentImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMDocumentTypeImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMElementImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMElementNSImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMEntityImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMEntityReferenceImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMErrorImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMImplementationImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMImplementationListImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMImplementationRegistry.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMLSInputImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMLSOutputImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMLSSerializerImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMLocatorImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNamedNodeMapImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNodeIDMap.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNodeImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNodeIteratorImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNodeListImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNodeVector.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNormalizer.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMNotationImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMParentNode.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMProcessingInstructionImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMRangeImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMStringListImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMStringPool.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMTextImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMTreeWalkerImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMTypeInfoImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMXPathExpressionImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMXPathNSResolverImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/DOMXPathResultImpl.Plo +include xercesc/dom/impl/$(DEPDIR)/XSDElementNSImpl.Plo +include xercesc/framework/$(DEPDIR)/BinOutputStream.Plo +include xercesc/framework/$(DEPDIR)/LocalFileFormatTarget.Plo +include xercesc/framework/$(DEPDIR)/LocalFileInputSource.Plo +include xercesc/framework/$(DEPDIR)/MemBufFormatTarget.Plo +include xercesc/framework/$(DEPDIR)/MemBufInputSource.Plo +include xercesc/framework/$(DEPDIR)/StdInInputSource.Plo +include xercesc/framework/$(DEPDIR)/StdOutFormatTarget.Plo +include xercesc/framework/$(DEPDIR)/URLInputSource.Plo +include xercesc/framework/$(DEPDIR)/Wrapper4DOMLSInput.Plo +include xercesc/framework/$(DEPDIR)/Wrapper4InputSource.Plo +include xercesc/framework/$(DEPDIR)/XMLAttDef.Plo +include xercesc/framework/$(DEPDIR)/XMLAttDefList.Plo +include xercesc/framework/$(DEPDIR)/XMLAttr.Plo +include xercesc/framework/$(DEPDIR)/XMLBuffer.Plo +include xercesc/framework/$(DEPDIR)/XMLBufferMgr.Plo +include xercesc/framework/$(DEPDIR)/XMLContentModel.Plo +include xercesc/framework/$(DEPDIR)/XMLDTDDescription.Plo +include xercesc/framework/$(DEPDIR)/XMLElementDecl.Plo +include xercesc/framework/$(DEPDIR)/XMLEntityDecl.Plo +include xercesc/framework/$(DEPDIR)/XMLFormatter.Plo +include xercesc/framework/$(DEPDIR)/XMLGrammarDescription.Plo +include xercesc/framework/$(DEPDIR)/XMLGrammarPoolImpl.Plo +include xercesc/framework/$(DEPDIR)/XMLNotationDecl.Plo +include xercesc/framework/$(DEPDIR)/XMLRecognizer.Plo +include xercesc/framework/$(DEPDIR)/XMLRefInfo.Plo +include xercesc/framework/$(DEPDIR)/XMLSchemaDescription.Plo +include xercesc/framework/$(DEPDIR)/XMLValidator.Plo +include xercesc/framework/psvi/$(DEPDIR)/PSVIAttribute.Plo +include xercesc/framework/psvi/$(DEPDIR)/PSVIAttributeList.Plo +include xercesc/framework/psvi/$(DEPDIR)/PSVIElement.Plo +include xercesc/framework/psvi/$(DEPDIR)/PSVIItem.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSAnnotation.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSAttributeDeclaration.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSAttributeGroupDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSAttributeUse.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSComplexTypeDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSElementDeclaration.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSFacet.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSIDCDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSModel.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSModelGroup.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSModelGroupDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSMultiValueFacet.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSNamespaceItem.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSNotationDeclaration.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSObject.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSParticle.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSSimpleTypeDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSTypeDefinition.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSValue.Plo +include xercesc/framework/psvi/$(DEPDIR)/XSWildcard.Plo +include xercesc/internal/$(DEPDIR)/BinFileOutputStream.Plo +include xercesc/internal/$(DEPDIR)/BinMemOutputStream.Plo +include xercesc/internal/$(DEPDIR)/DGXMLScanner.Plo +include xercesc/internal/$(DEPDIR)/ElemStack.Plo +include xercesc/internal/$(DEPDIR)/IGXMLScanner.Plo +include xercesc/internal/$(DEPDIR)/IGXMLScanner2.Plo +include xercesc/internal/$(DEPDIR)/MemoryManagerImpl.Plo +include xercesc/internal/$(DEPDIR)/ReaderMgr.Plo +include xercesc/internal/$(DEPDIR)/SGXMLScanner.Plo +include xercesc/internal/$(DEPDIR)/ValidationContextImpl.Plo +include xercesc/internal/$(DEPDIR)/VecAttrListImpl.Plo +include xercesc/internal/$(DEPDIR)/VecAttributesImpl.Plo +include xercesc/internal/$(DEPDIR)/WFXMLScanner.Plo +include xercesc/internal/$(DEPDIR)/XMLReader.Plo +include xercesc/internal/$(DEPDIR)/XMLScanner.Plo +include xercesc/internal/$(DEPDIR)/XMLScannerResolver.Plo +include xercesc/internal/$(DEPDIR)/XProtoType.Plo +include xercesc/internal/$(DEPDIR)/XSAXMLScanner.Plo +include xercesc/internal/$(DEPDIR)/XSObjectFactory.Plo +include xercesc/internal/$(DEPDIR)/XSerializeEngine.Plo +include xercesc/internal/$(DEPDIR)/XTemplateSerializer.Plo +include xercesc/parsers/$(DEPDIR)/AbstractDOMParser.Plo +include xercesc/parsers/$(DEPDIR)/DOMLSParserImpl.Plo +include xercesc/parsers/$(DEPDIR)/SAX2XMLFilterImpl.Plo +include xercesc/parsers/$(DEPDIR)/SAX2XMLReaderImpl.Plo +include xercesc/parsers/$(DEPDIR)/SAXParser.Plo +include xercesc/parsers/$(DEPDIR)/XercesDOMParser.Plo +include xercesc/sax/$(DEPDIR)/Dummy.Plo +include xercesc/sax/$(DEPDIR)/InputSource.Plo +include xercesc/sax/$(DEPDIR)/SAXException.Plo +include xercesc/sax/$(DEPDIR)/SAXParseException.Plo +include xercesc/sax2/$(DEPDIR)/sax2Dummy.Plo +include xercesc/util/$(DEPDIR)/Base64.Plo +include xercesc/util/$(DEPDIR)/BinFileInputStream.Plo +include xercesc/util/$(DEPDIR)/BinInputStream.Plo +include xercesc/util/$(DEPDIR)/BinMemInputStream.Plo +include xercesc/util/$(DEPDIR)/BitSet.Plo +include xercesc/util/$(DEPDIR)/DefaultPanicHandler.Plo +include xercesc/util/$(DEPDIR)/EncodingValidator.Plo +include xercesc/util/$(DEPDIR)/HeaderDummy.Plo +include xercesc/util/$(DEPDIR)/HexBin.Plo +include xercesc/util/$(DEPDIR)/KVStringPair.Plo +include xercesc/util/$(DEPDIR)/Mutexes.Plo +include xercesc/util/$(DEPDIR)/PSVIUni.Plo +include xercesc/util/$(DEPDIR)/PanicHandler.Plo +include xercesc/util/$(DEPDIR)/PlatformUtils.Plo +include xercesc/util/$(DEPDIR)/QName.Plo +include xercesc/util/$(DEPDIR)/StringPool.Plo +include xercesc/util/$(DEPDIR)/SynchronizedStringPool.Plo +include xercesc/util/$(DEPDIR)/TransService.Plo +include xercesc/util/$(DEPDIR)/XML256TableTranscoder.Plo +include xercesc/util/$(DEPDIR)/XML88591Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLASCIITranscoder.Plo +include xercesc/util/$(DEPDIR)/XMLAbstractDoubleFloat.Plo +include xercesc/util/$(DEPDIR)/XMLBigDecimal.Plo +include xercesc/util/$(DEPDIR)/XMLBigInteger.Plo +include xercesc/util/$(DEPDIR)/XMLChTranscoder.Plo +include xercesc/util/$(DEPDIR)/XMLChar.Plo +include xercesc/util/$(DEPDIR)/XMLDateTime.Plo +include xercesc/util/$(DEPDIR)/XMLDouble.Plo +include xercesc/util/$(DEPDIR)/XMLEBCDICTranscoder.Plo +include xercesc/util/$(DEPDIR)/XMLException.Plo +include xercesc/util/$(DEPDIR)/XMLFloat.Plo +include xercesc/util/$(DEPDIR)/XMLIBM1047Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLIBM1140Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLInitializer.Plo +include xercesc/util/$(DEPDIR)/XMLMsgLoader.Plo +include xercesc/util/$(DEPDIR)/XMLNumber.Plo +include xercesc/util/$(DEPDIR)/XMLString.Plo +include xercesc/util/$(DEPDIR)/XMLStringTokenizer.Plo +include xercesc/util/$(DEPDIR)/XMLUCS4Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLURL.Plo +include xercesc/util/$(DEPDIR)/XMLUTF16Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLUTF8Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMLUni.Plo +include xercesc/util/$(DEPDIR)/XMLUri.Plo +include xercesc/util/$(DEPDIR)/XMLWin1252Transcoder.Plo +include xercesc/util/$(DEPDIR)/XMemory.Plo +include xercesc/util/FileManagers/$(DEPDIR)/PosixFileMgr.Plo +include xercesc/util/FileManagers/$(DEPDIR)/WindowsFileMgr.Plo +include xercesc/util/MsgLoaders/ICU/$(DEPDIR)/ICUMsgLoader.Plo +include xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/InMemMsgLoader.Plo +include xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/MsgCatalogLoader.Plo +include xercesc/util/MutexManagers/$(DEPDIR)/NoThreadMutexMgr.Plo +include xercesc/util/MutexManagers/$(DEPDIR)/PosixMutexMgr.Plo +include xercesc/util/MutexManagers/$(DEPDIR)/WindowsMutexMgr.Plo +include xercesc/util/NetAccessors/$(DEPDIR)/BinHTTPInputStreamCommon.Plo +include xercesc/util/NetAccessors/Curl/$(DEPDIR)/CurlNetAccessor.Plo +include xercesc/util/NetAccessors/Curl/$(DEPDIR)/CurlURLInputStream.Plo +include xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/MacOSURLAccessCF.Plo +include xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/URLAccessCFBinInputStream.Plo +include xercesc/util/NetAccessors/Socket/$(DEPDIR)/SocketNetAccessor.Plo +include xercesc/util/NetAccessors/Socket/$(DEPDIR)/UnixHTTPURLInputStream.Plo +include xercesc/util/NetAccessors/WinSock/$(DEPDIR)/BinHTTPURLInputStream.Plo +include xercesc/util/NetAccessors/WinSock/$(DEPDIR)/WinSockNetAccessor.Plo +include xercesc/util/Transcoders/ICU/$(DEPDIR)/ICUTransService.Plo +include xercesc/util/Transcoders/Iconv/$(DEPDIR)/IconvTransService.Plo +include xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/IconvGNUTransService.Plo +include xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/MacOSUnicodeConverter.Plo +include xercesc/util/Transcoders/Win32/$(DEPDIR)/Win32TransService.Plo +include xercesc/util/regx/$(DEPDIR)/ASCIIRangeFactory.Plo +include xercesc/util/regx/$(DEPDIR)/BMPattern.Plo +include xercesc/util/regx/$(DEPDIR)/BlockRangeFactory.Plo +include xercesc/util/regx/$(DEPDIR)/CharToken.Plo +include xercesc/util/regx/$(DEPDIR)/ClosureToken.Plo +include xercesc/util/regx/$(DEPDIR)/ConcatToken.Plo +include xercesc/util/regx/$(DEPDIR)/Match.Plo +include xercesc/util/regx/$(DEPDIR)/Op.Plo +include xercesc/util/regx/$(DEPDIR)/OpFactory.Plo +include xercesc/util/regx/$(DEPDIR)/ParenToken.Plo +include xercesc/util/regx/$(DEPDIR)/ParserForXMLSchema.Plo +include xercesc/util/regx/$(DEPDIR)/RangeFactory.Plo +include xercesc/util/regx/$(DEPDIR)/RangeToken.Plo +include xercesc/util/regx/$(DEPDIR)/RangeTokenMap.Plo +include xercesc/util/regx/$(DEPDIR)/RegularExpression.Plo +include xercesc/util/regx/$(DEPDIR)/RegxParser.Plo +include xercesc/util/regx/$(DEPDIR)/RegxUtil.Plo +include xercesc/util/regx/$(DEPDIR)/StringToken.Plo +include xercesc/util/regx/$(DEPDIR)/Token.Plo +include xercesc/util/regx/$(DEPDIR)/TokenFactory.Plo +include xercesc/util/regx/$(DEPDIR)/UnicodeRangeFactory.Plo +include xercesc/util/regx/$(DEPDIR)/UnionToken.Plo +include xercesc/util/regx/$(DEPDIR)/XMLRangeFactory.Plo +include xercesc/util/regx/$(DEPDIR)/XMLUniCharacter.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDAttDef.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDAttDefList.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDElementDecl.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDEntityDecl.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDGrammar.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDScanner.Plo +include xercesc/validators/DTD/$(DEPDIR)/DTDValidator.Plo +include xercesc/validators/DTD/$(DEPDIR)/XMLDTDDescriptionImpl.Plo +include xercesc/validators/common/$(DEPDIR)/AllContentModel.Plo +include xercesc/validators/common/$(DEPDIR)/CMAny.Plo +include xercesc/validators/common/$(DEPDIR)/CMBinaryOp.Plo +include xercesc/validators/common/$(DEPDIR)/CMUnaryOp.Plo +include xercesc/validators/common/$(DEPDIR)/ContentLeafNameTypeVector.Plo +include xercesc/validators/common/$(DEPDIR)/ContentSpecNode.Plo +include xercesc/validators/common/$(DEPDIR)/DFAContentModel.Plo +include xercesc/validators/common/$(DEPDIR)/Grammar.Plo +include xercesc/validators/common/$(DEPDIR)/GrammarResolver.Plo +include xercesc/validators/common/$(DEPDIR)/MixedContentModel.Plo +include xercesc/validators/common/$(DEPDIR)/SimpleContentModel.Plo +include xercesc/validators/datatype/$(DEPDIR)/AbstractNumericFacetValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/AbstractNumericValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/AbstractStringValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/AnySimpleTypeDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/AnyURIDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/Base64BinaryDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/BooleanDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DatatypeValidatorFactory.Plo +include xercesc/validators/datatype/$(DEPDIR)/DateDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DateTimeDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DateTimeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DayDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DecimalDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DoubleDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/DurationDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/ENTITYDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/FloatDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/HexBinaryDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/IDDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/IDREFDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/ListDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/MonthDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/MonthDayDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/NCNameDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/NOTATIONDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/NameDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/QNameDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/StringDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/TimeDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/UnionDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/XMLCanRepGroup.Plo +include xercesc/validators/datatype/$(DEPDIR)/YearDatatypeValidator.Plo +include xercesc/validators/datatype/$(DEPDIR)/YearMonthDatatypeValidator.Plo +include xercesc/validators/schema/$(DEPDIR)/ComplexTypeInfo.Plo +include xercesc/validators/schema/$(DEPDIR)/GeneralAttributeCheck.Plo +include xercesc/validators/schema/$(DEPDIR)/NamespaceScope.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaAttDef.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaAttDefList.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaElementDecl.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaGrammar.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaInfo.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaSymbols.Plo +include xercesc/validators/schema/$(DEPDIR)/SchemaValidator.Plo +include xercesc/validators/schema/$(DEPDIR)/SubstitutionGroupComparator.Plo +include xercesc/validators/schema/$(DEPDIR)/TraverseSchema.Plo +include xercesc/validators/schema/$(DEPDIR)/XMLSchemaDescriptionImpl.Plo +include xercesc/validators/schema/$(DEPDIR)/XSDDOMParser.Plo +include xercesc/validators/schema/$(DEPDIR)/XSDErrorReporter.Plo +include xercesc/validators/schema/$(DEPDIR)/XSDLocator.Plo +include xercesc/validators/schema/$(DEPDIR)/XUtil.Plo +include xercesc/validators/schema/$(DEPDIR)/XercesAttGroupInfo.Plo +include xercesc/validators/schema/$(DEPDIR)/XercesElementWildcard.Plo +include xercesc/validators/schema/$(DEPDIR)/XercesGroupInfo.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/FieldActivator.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/FieldValueMap.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IC_Field.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IC_Key.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IC_KeyRef.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IC_Selector.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IC_Unique.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IdentityConstraint.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/IdentityConstraintHandler.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/ValueStore.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/ValueStoreCache.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/XPathMatcher.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/XPathMatcherStack.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/XPathSymbols.Plo +include xercesc/validators/schema/identity/$(DEPDIR)/XercesXPath.Plo +include xercesc/xinclude/$(DEPDIR)/XIncludeDOMDocumentProcessor.Plo +include xercesc/xinclude/$(DEPDIR)/XIncludeLocation.Plo +include xercesc/xinclude/$(DEPDIR)/XIncludeUtils.Plo + +.c.o: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c -o $@ $< + +.c.obj: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ + $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +#.c.lo: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ + $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Plo +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +.cpp.o: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ + $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +#.cpp.lo: + depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ + $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Plo +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf xercesc/dom/.libs xercesc/dom/_libs + -rm -rf xercesc/dom/impl/.libs xercesc/dom/impl/_libs + -rm -rf xercesc/framework/.libs xercesc/framework/_libs + -rm -rf xercesc/framework/psvi/.libs xercesc/framework/psvi/_libs + -rm -rf xercesc/internal/.libs xercesc/internal/_libs + -rm -rf xercesc/parsers/.libs xercesc/parsers/_libs + -rm -rf xercesc/sax/.libs xercesc/sax/_libs + -rm -rf xercesc/sax2/.libs xercesc/sax2/_libs + -rm -rf xercesc/util/.libs xercesc/util/_libs + -rm -rf xercesc/util/FileManagers/.libs xercesc/util/FileManagers/_libs + -rm -rf xercesc/util/MsgLoaders/ICU/.libs xercesc/util/MsgLoaders/ICU/_libs + -rm -rf xercesc/util/MsgLoaders/InMemory/.libs xercesc/util/MsgLoaders/InMemory/_libs + -rm -rf xercesc/util/MsgLoaders/MsgCatalog/.libs xercesc/util/MsgLoaders/MsgCatalog/_libs + -rm -rf xercesc/util/MutexManagers/.libs xercesc/util/MutexManagers/_libs + -rm -rf xercesc/util/NetAccessors/.libs xercesc/util/NetAccessors/_libs + -rm -rf xercesc/util/NetAccessors/Curl/.libs xercesc/util/NetAccessors/Curl/_libs + -rm -rf xercesc/util/NetAccessors/MacOSURLAccessCF/.libs xercesc/util/NetAccessors/MacOSURLAccessCF/_libs + -rm -rf xercesc/util/NetAccessors/Socket/.libs xercesc/util/NetAccessors/Socket/_libs + -rm -rf xercesc/util/NetAccessors/WinSock/.libs xercesc/util/NetAccessors/WinSock/_libs + -rm -rf xercesc/util/Transcoders/ICU/.libs xercesc/util/Transcoders/ICU/_libs + -rm -rf xercesc/util/Transcoders/Iconv/.libs xercesc/util/Transcoders/Iconv/_libs + -rm -rf xercesc/util/Transcoders/IconvGNU/.libs xercesc/util/Transcoders/IconvGNU/_libs + -rm -rf xercesc/util/Transcoders/MacOSUnicodeConverter/.libs xercesc/util/Transcoders/MacOSUnicodeConverter/_libs + -rm -rf xercesc/util/Transcoders/Win32/.libs xercesc/util/Transcoders/Win32/_libs + -rm -rf xercesc/util/regx/.libs xercesc/util/regx/_libs + -rm -rf xercesc/validators/DTD/.libs xercesc/validators/DTD/_libs + -rm -rf xercesc/validators/common/.libs xercesc/validators/common/_libs + -rm -rf xercesc/validators/datatype/.libs xercesc/validators/datatype/_libs + -rm -rf xercesc/validators/schema/.libs xercesc/validators/schema/_libs + -rm -rf xercesc/validators/schema/identity/.libs xercesc/validators/schema/identity/_libs + -rm -rf xercesc/xinclude/.libs xercesc/xinclude/_libs +install-nobase_libxerces_c_laHEADERS: $(nobase_libxerces_c_la_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(libxerces_c_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libxerces_c_ladir)" + @list='$(nobase_libxerces_c_la_HEADERS)'; test -n "$(libxerces_c_ladir)" || list=; \ + $(am__nobase_list) | while read dir files; do \ + xfiles=; for file in $$files; do \ + if test -f "$$file"; then xfiles="$$xfiles $$file"; \ + else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ + test -z "$$xfiles" || { \ + test "x$$dir" = x. || { \ + echo "$(MKDIR_P) '$(DESTDIR)$(libxerces_c_ladir)/$$dir'"; \ + $(MKDIR_P) "$(DESTDIR)$(libxerces_c_ladir)/$$dir"; }; \ + echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(libxerces_c_ladir)/$$dir'"; \ + $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(libxerces_c_ladir)/$$dir" || exit $$?; }; \ + done + +uninstall-nobase_libxerces_c_laHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nobase_libxerces_c_la_HEADERS)'; test -n "$(libxerces_c_ladir)" || list=; \ + $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libxerces_c_ladir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libxerces_c_ladir)" && rm -f $$files +install-nodist_autoconfheadersHEADERS: $(nodist_autoconfheaders_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(autoconfheadersdir)" || $(MKDIR_P) "$(DESTDIR)$(autoconfheadersdir)" + @list='$(nodist_autoconfheaders_HEADERS)'; test -n "$(autoconfheadersdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(autoconfheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(autoconfheadersdir)" || exit $$?; \ + done + +uninstall-nodist_autoconfheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_autoconfheaders_HEADERS)'; test -n "$(autoconfheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(autoconfheadersdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(autoconfheadersdir)" && rm -f $$files + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libxerces_c_ladir)" "$(DESTDIR)$(autoconfheadersdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f xercesc/dom/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/dom/$(am__dirstamp) + -rm -f xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/dom/impl/$(am__dirstamp) + -rm -f xercesc/framework/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/framework/$(am__dirstamp) + -rm -f xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/framework/psvi/$(am__dirstamp) + -rm -f xercesc/internal/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/internal/$(am__dirstamp) + -rm -f xercesc/parsers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/parsers/$(am__dirstamp) + -rm -f xercesc/sax/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/sax/$(am__dirstamp) + -rm -f xercesc/sax2/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/sax2/$(am__dirstamp) + -rm -f xercesc/util/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/$(am__dirstamp) + -rm -f xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/FileManagers/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/ICU/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) + -rm -f xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MutexManagers/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Curl/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Socket/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/WinSock/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/ICU/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Iconv/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Win32/$(am__dirstamp) + -rm -f xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/regx/$(am__dirstamp) + -rm -f xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/DTD/$(am__dirstamp) + -rm -f xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/common/$(am__dirstamp) + -rm -f xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/datatype/$(am__dirstamp) + -rm -f xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/schema/$(am__dirstamp) + -rm -f xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/schema/identity/$(am__dirstamp) + -rm -f xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/xinclude/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) xercesc/dom/$(DEPDIR) xercesc/dom/impl/$(DEPDIR) xercesc/framework/$(DEPDIR) xercesc/framework/psvi/$(DEPDIR) xercesc/internal/$(DEPDIR) xercesc/parsers/$(DEPDIR) xercesc/sax/$(DEPDIR) xercesc/sax2/$(DEPDIR) xercesc/util/$(DEPDIR) xercesc/util/FileManagers/$(DEPDIR) xercesc/util/MsgLoaders/ICU/$(DEPDIR) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) xercesc/util/MutexManagers/$(DEPDIR) xercesc/util/NetAccessors/$(DEPDIR) xercesc/util/NetAccessors/Curl/$(DEPDIR) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) xercesc/util/NetAccessors/Socket/$(DEPDIR) xercesc/util/NetAccessors/WinSock/$(DEPDIR) xercesc/util/Transcoders/ICU/$(DEPDIR) xercesc/util/Transcoders/Iconv/$(DEPDIR) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) xercesc/util/Transcoders/Win32/$(DEPDIR) xercesc/util/regx/$(DEPDIR) xercesc/validators/DTD/$(DEPDIR) xercesc/validators/common/$(DEPDIR) xercesc/validators/datatype/$(DEPDIR) xercesc/validators/schema/$(DEPDIR) xercesc/validators/schema/identity/$(DEPDIR) xercesc/xinclude/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-nobase_libxerces_c_laHEADERS \ + install-nodist_autoconfheadersHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) xercesc/dom/$(DEPDIR) xercesc/dom/impl/$(DEPDIR) xercesc/framework/$(DEPDIR) xercesc/framework/psvi/$(DEPDIR) xercesc/internal/$(DEPDIR) xercesc/parsers/$(DEPDIR) xercesc/sax/$(DEPDIR) xercesc/sax2/$(DEPDIR) xercesc/util/$(DEPDIR) xercesc/util/FileManagers/$(DEPDIR) xercesc/util/MsgLoaders/ICU/$(DEPDIR) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) xercesc/util/MutexManagers/$(DEPDIR) xercesc/util/NetAccessors/$(DEPDIR) xercesc/util/NetAccessors/Curl/$(DEPDIR) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) xercesc/util/NetAccessors/Socket/$(DEPDIR) xercesc/util/NetAccessors/WinSock/$(DEPDIR) xercesc/util/Transcoders/ICU/$(DEPDIR) xercesc/util/Transcoders/Iconv/$(DEPDIR) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) xercesc/util/Transcoders/Win32/$(DEPDIR) xercesc/util/regx/$(DEPDIR) xercesc/validators/DTD/$(DEPDIR) xercesc/validators/common/$(DEPDIR) xercesc/validators/datatype/$(DEPDIR) xercesc/validators/schema/$(DEPDIR) xercesc/validators/schema/identity/$(DEPDIR) xercesc/xinclude/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES \ + uninstall-nobase_libxerces_c_laHEADERS \ + uninstall-nodist_autoconfheadersHEADERS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + ctags-recursive install install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nobase_libxerces_c_laHEADERS \ + install-nodist_autoconfheadersHEADERS install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-libLTLIBRARIES \ + uninstall-nobase_libxerces_c_laHEADERS \ + uninstall-nodist_autoconfheadersHEADERS + + +include ${top_srcdir}/version.incl +#xercesc_messages.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt +# ${ICU_SBIN}gencmn --name ${PKGNAME} -S ${PKGNAME}_dat.c -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt +# @mv ${PKGNAME}_dat.c xercesc_messages.c + +#root_res.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt +# ${ICU_BIN}genrb -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt +# ${ICU_SBIN}genccode --name ${PKGNAME} -d . root.res + +# Override generated rules to provide prettier make rules +# +# Warning: If Automake changes sufficiently, these rules may need to +# be regenerated from the (new) default output of Automake +# + +.c.lo: + @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ + if $(LTCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ + then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +# @source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +.cpp.lo: + @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ + if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ + then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +# @source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LTCXXCOMPILE) -c -o $@ $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/project/jni/xerces/src/Makefile.am b/project/jni/xerces/src/Makefile.am new file mode 100644 index 000000000..e6dc80e39 --- /dev/null +++ b/project/jni/xerces/src/Makefile.am @@ -0,0 +1,1160 @@ +# +# 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: Makefile.am 883272 2009-11-23 08:17:49Z borisk $ +# + +include ${top_srcdir}/version.incl + +DEFS += -DXERCES_BUILDING_LIBRARY +SUBDIRS = + +# +# +lib_LTLIBRARIES = libxerces-c.la + +# Use AM_* variables instead of per-target ones otherwise the +# make pretty-printing won't work. +# +AM_CPPFLAGS = + +libxerces_c_la_LDFLAGS = -release ${INTERFACE_VER_D} + +# This sets {install}/include as target for the headers +libxerces_c_ladir = ${includedir} + + +libxerces_c_la_SOURCES = ${util_sources} ${dom_sources} ${domimpl_sources} \ +${framework_sources} ${internal_sources} ${parsers_sources} ${sax_sources} \ +${sax2_sources} ${validators_sources} ${xinclude_sources} + +nobase_libxerces_c_la_HEADERS = ${util_headers} ${dom_headers} \ +${domimpl_headers} ${framework_headers} ${internal_headers} \ +${parsers_headers} ${sax_headers} ${sax2_headers} ${validators_headers} \ +${xinclude_headers} + +# Make sure autoconf-generated Xerces_autoconf_config.hpp ends up in a +# proper place when installed. +# +autoconfheadersdir = $(includedir)/xercesc/util +nodist_autoconfheaders_HEADERS = ${top_builddir}/src/xercesc/util/Xerces_autoconf_config.hpp + +# Compatibility library. +# +EXTRA_DIST = stricmp.h strnicmp.h towlower.h towupper.h +libxerces_c_la_LIBADD = ${LTLIBOBJS} + +# NetAccessors, conditionally built based on settings from configure +# +if XERCES_USE_NETACCESSOR_CURL +libxerces_c_la_SOURCES += ${curl_sources} +nobase_libxerces_c_la_HEADERS += ${curl_headers} +AM_CPPFLAGS += ${CURL_FLAGS} +endif + +if XERCES_USE_NETACCESSOR_SOCKET +libxerces_c_la_SOURCES += ${sockets_sources} +nobase_libxerces_c_la_HEADERS += ${sockets_headers} +endif + +if XERCES_USE_NETACCESSOR_CFURL +libxerces_c_la_SOURCES += ${cfurl_sources} +nobase_libxerces_c_la_HEADERS += ${cfurl_headers} +endif + +if XERCES_USE_NETACCESSOR_WINSOCK +libxerces_c_la_SOURCES += ${winsock_sources} +nobase_libxerces_c_la_HEADERS += ${winsock_headers} +endif + + +# Transcoders, conditionally built based on settings from configure +# +if XERCES_USE_TRANSCODER_ICU +libxerces_c_la_SOURCES += ${icu_sources} +nobase_libxerces_c_la_HEADERS += ${icu_headers} +AM_CPPFLAGS += ${ICU_FLAGS} +endif + +if XERCES_USE_TRANSCODER_GNUICONV +libxerces_c_la_SOURCES += ${gnuiconv_sources} +nobase_libxerces_c_la_HEADERS += ${gnuiconv_headers} +endif + +if XERCES_USE_TRANSCODER_ICONV +libxerces_c_la_SOURCES += ${iconv_sources} +nobase_libxerces_c_la_HEADERS += ${iconv_headers} +endif + +if XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER +libxerces_c_la_SOURCES += ${macosunicodeconverter_sources} +nobase_libxerces_c_la_HEADERS += ${macosunicodeconverter_headers} +endif + +if XERCES_USE_TRANSCODER_WINDOWS +libxerces_c_la_SOURCES += ${wintrans_sources} +nobase_libxerces_c_la_HEADERS += ${wintrans_headers} +endif + + +# MsgLoaders, conditionally built based on settings from configure +# +if XERCES_USE_MSGLOADER_INMEMORY +libxerces_c_la_SOURCES += ${msginmemory_sources} +nobase_libxerces_c_la_HEADERS += ${msginmemory_headers} +endif + +if XERCES_USE_MSGLOADER_ICU +libxerces_c_la_SOURCES += ${msgicu_sources} +nodist_libxerces_c_la_SOURCES = ${msgicu_nodist_sources} +nobase_libxerces_c_la_HEADERS += ${msgicu_headers} +AM_CPPFLAGS += ${ICU_FLAGS} + +EXTRA_DIST += xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt \ +xercesc/util/MsgLoaders/ICU/resources/root.txt + +# Resource shortname +PKGNAME=xercesc_messages_${INTERFACE_VER_U} + +CLEANFILES = xercesc_messages.c root_res.c root.res +BUILT_SOURCES = xercesc_messages.c root_res.c +xercesc_messages.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt + ${ICU_SBIN}gencmn --name ${PKGNAME} -S ${PKGNAME}_dat.c -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt + @mv ${PKGNAME}_dat.c xercesc_messages.c + +root_res.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt + ${ICU_BIN}genrb -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt + ${ICU_SBIN}genccode --name ${PKGNAME} -d . root.res + +endif + +if XERCES_USE_MSGLOADER_ICONV +libxerces_c_la_SOURCES += ${msgiconv_sources} +nobase_libxerces_c_la_HEADERS += ${msgiconv_headers} + +SUBDIRS += xercesc/util/MsgLoaders/MsgCatalog +endif + + +# Mutex Managers, conditionally built based on settings from configure +# +if XERCES_USE_MUTEXMGR_NOTHREAD +libxerces_c_la_SOURCES += ${nothreadmmgr_sources} +nobase_libxerces_c_la_HEADERS += ${nothreadmmgr_headers} +endif + +if XERCES_USE_MUTEXMGR_POSIX +libxerces_c_la_SOURCES += ${posixmmgr_sources} +nobase_libxerces_c_la_HEADERS += ${posixmmgr_headers} +endif + +if XERCES_USE_MUTEXMGR_WINDOWS +libxerces_c_la_SOURCES += ${winmmgr_sources} +nobase_libxerces_c_la_HEADERS += ${winmmgr_headers} +endif + + +# File Managers, conditionally built based on settings from configure +# +if XERCES_USE_FILEMGR_POSIX +libxerces_c_la_SOURCES += ${posixfmgr_sources} +nobase_libxerces_c_la_HEADERS += ${posixfmgr_headers} +endif + +if XERCES_USE_FILEMGR_WINDOWS +libxerces_c_la_SOURCES += ${winfmgr_sources} +nobase_libxerces_c_la_HEADERS += ${winfmgr_headers} +endif + +# +# Definition of sources/headers for each convenience library +# + +# +# A line like the following will generate a list of headers +# for a given directory: (must be issued from src directory) +# find xercesc/framework -name '*.hpp' -exec echo {} \\ ";" +# find xercesc/framework -name '*.cpp' -exec echo {} \\ ";" +# + +dom_headers = \ + xercesc/dom/DOM.hpp \ + xercesc/dom/DOMAttr.hpp \ + xercesc/dom/DOMCDATASection.hpp \ + xercesc/dom/DOMCharacterData.hpp \ + xercesc/dom/DOMComment.hpp \ + xercesc/dom/DOMConfiguration.hpp \ + xercesc/dom/DOMDocument.hpp \ + xercesc/dom/DOMDocumentFragment.hpp \ + xercesc/dom/DOMDocumentRange.hpp \ + xercesc/dom/DOMDocumentTraversal.hpp \ + xercesc/dom/DOMDocumentType.hpp \ + xercesc/dom/DOMElement.hpp \ + xercesc/dom/DOMEntity.hpp \ + xercesc/dom/DOMEntityReference.hpp \ + xercesc/dom/DOMError.hpp \ + xercesc/dom/DOMErrorHandler.hpp \ + xercesc/dom/DOMException.hpp \ + xercesc/dom/DOMImplementation.hpp \ + xercesc/dom/DOMImplementationList.hpp \ + xercesc/dom/DOMImplementationLS.hpp \ + xercesc/dom/DOMImplementationRegistry.hpp \ + xercesc/dom/DOMImplementationSource.hpp \ + xercesc/dom/DOMLocator.hpp \ + xercesc/dom/DOMLSException.hpp \ + xercesc/dom/DOMLSInput.hpp \ + xercesc/dom/DOMLSOutput.hpp \ + xercesc/dom/DOMLSParser.hpp \ + xercesc/dom/DOMLSParserFilter.hpp \ + xercesc/dom/DOMLSResourceResolver.hpp \ + xercesc/dom/DOMLSSerializer.hpp \ + xercesc/dom/DOMLSSerializerFilter.hpp \ + xercesc/dom/DOMMemoryManager.hpp \ + xercesc/dom/DOMNamedNodeMap.hpp \ + xercesc/dom/DOMNode.hpp \ + xercesc/dom/DOMNodeFilter.hpp \ + xercesc/dom/DOMNodeIterator.hpp \ + xercesc/dom/DOMNodeList.hpp \ + xercesc/dom/DOMNotation.hpp \ + xercesc/dom/DOMProcessingInstruction.hpp \ + xercesc/dom/DOMPSVITypeInfo.hpp \ + xercesc/dom/DOMRange.hpp \ + xercesc/dom/DOMRangeException.hpp \ + xercesc/dom/DOMStringList.hpp \ + xercesc/dom/DOMText.hpp \ + xercesc/dom/DOMTreeWalker.hpp \ + xercesc/dom/DOMTypeInfo.hpp \ + xercesc/dom/DOMUserDataHandler.hpp \ + xercesc/dom/DOMXPathEvaluator.hpp \ + xercesc/dom/DOMXPathException.hpp \ + xercesc/dom/DOMXPathExpression.hpp \ + xercesc/dom/DOMXPathNamespace.hpp \ + xercesc/dom/DOMXPathNSResolver.hpp \ + xercesc/dom/DOMXPathResult.hpp \ + xercesc/dom/StDOMNode.hpp + +dom_sources = \ + xercesc/dom/DOMException.cpp \ + xercesc/dom/DOMLSException.cpp \ + xercesc/dom/DOMRangeException.cpp \ + xercesc/dom/DOMXPathException.cpp + + +domimpl_headers = \ + xercesc/dom/impl/DOMAttrImpl.hpp \ + xercesc/dom/impl/DOMAttrMapImpl.hpp \ + xercesc/dom/impl/DOMAttrNSImpl.hpp \ + xercesc/dom/impl/DOMCasts.hpp \ + xercesc/dom/impl/DOMCDATASectionImpl.hpp \ + xercesc/dom/impl/DOMCharacterDataImpl.hpp \ + xercesc/dom/impl/DOMChildNode.hpp \ + xercesc/dom/impl/DOMCommentImpl.hpp \ + xercesc/dom/impl/DOMConfigurationImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.c \ + xercesc/dom/impl/DOMDocumentFragmentImpl.hpp \ + xercesc/dom/impl/DOMDocumentImpl.hpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.hpp \ + xercesc/dom/impl/DOMElementImpl.hpp \ + xercesc/dom/impl/DOMElementNSImpl.hpp \ + xercesc/dom/impl/DOMEntityImpl.hpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.hpp \ + xercesc/dom/impl/DOMErrorImpl.hpp \ + xercesc/dom/impl/DOMImplementationImpl.hpp \ + xercesc/dom/impl/DOMImplementationListImpl.hpp \ + xercesc/dom/impl/DOMLocatorImpl.hpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.hpp \ + xercesc/dom/impl/DOMNodeIDMap.hpp \ + xercesc/dom/impl/DOMNodeImpl.hpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.hpp \ + xercesc/dom/impl/DOMNodeListImpl.hpp \ + xercesc/dom/impl/DOMNodeVector.hpp \ + xercesc/dom/impl/DOMNormalizer.hpp \ + xercesc/dom/impl/DOMNotationImpl.hpp \ + xercesc/dom/impl/DOMParentNode.hpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.hpp \ + xercesc/dom/impl/DOMRangeImpl.hpp \ + xercesc/dom/impl/DOMStringListImpl.hpp \ + xercesc/dom/impl/DOMStringPool.hpp \ + xercesc/dom/impl/DOMTextImpl.hpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.hpp \ + xercesc/dom/impl/DOMTypeInfoImpl.hpp \ + xercesc/dom/impl/DOMLSSerializerImpl.hpp \ + xercesc/dom/impl/DOMLSInputImpl.hpp \ + xercesc/dom/impl/DOMLSOutputImpl.hpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.hpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.hpp \ + xercesc/dom/impl/DOMXPathResultImpl.hpp \ + xercesc/dom/impl/XSDElementNSImpl.hpp + +domimpl_sources = \ + xercesc/dom/impl/DOMAttrImpl.cpp \ + xercesc/dom/impl/DOMAttrMapImpl.cpp \ + xercesc/dom/impl/DOMAttrNSImpl.cpp \ + xercesc/dom/impl/DOMCDATASectionImpl.cpp \ + xercesc/dom/impl/DOMCharacterDataImpl.cpp \ + xercesc/dom/impl/DOMChildNode.cpp \ + xercesc/dom/impl/DOMCommentImpl.cpp \ + xercesc/dom/impl/DOMConfigurationImpl.cpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.cpp \ + xercesc/dom/impl/DOMDocumentFragmentImpl.cpp \ + xercesc/dom/impl/DOMDocumentImpl.cpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.cpp \ + xercesc/dom/impl/DOMElementImpl.cpp \ + xercesc/dom/impl/DOMElementNSImpl.cpp \ + xercesc/dom/impl/DOMEntityImpl.cpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.cpp \ + xercesc/dom/impl/DOMErrorImpl.cpp \ + xercesc/dom/impl/DOMImplementationImpl.cpp \ + xercesc/dom/impl/DOMImplementationListImpl.cpp \ + xercesc/dom/impl/DOMImplementationRegistry.cpp \ + xercesc/dom/impl/DOMLocatorImpl.cpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.cpp \ + xercesc/dom/impl/DOMNodeIDMap.cpp \ + xercesc/dom/impl/DOMNodeImpl.cpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.cpp \ + xercesc/dom/impl/DOMNodeListImpl.cpp \ + xercesc/dom/impl/DOMNodeVector.cpp \ + xercesc/dom/impl/DOMNormalizer.cpp \ + xercesc/dom/impl/DOMNotationImpl.cpp \ + xercesc/dom/impl/DOMParentNode.cpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.cpp \ + xercesc/dom/impl/DOMRangeImpl.cpp \ + xercesc/dom/impl/DOMStringListImpl.cpp \ + xercesc/dom/impl/DOMStringPool.cpp \ + xercesc/dom/impl/DOMTextImpl.cpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.cpp \ + xercesc/dom/impl/DOMTypeInfoImpl.cpp \ + xercesc/dom/impl/DOMLSSerializerImpl.cpp \ + xercesc/dom/impl/DOMLSInputImpl.cpp \ + xercesc/dom/impl/DOMLSOutputImpl.cpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.cpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.cpp \ + xercesc/dom/impl/DOMXPathResultImpl.cpp \ + xercesc/dom/impl/XSDElementNSImpl.cpp + + +framework_headers = \ + xercesc/framework/BinOutputStream.hpp \ + xercesc/framework/LocalFileFormatTarget.hpp \ + xercesc/framework/LocalFileInputSource.hpp \ + xercesc/framework/MemBufFormatTarget.hpp \ + xercesc/framework/MemBufInputSource.hpp \ + xercesc/framework/MemoryManager.hpp \ + xercesc/framework/psvi/PSVIAttribute.hpp \ + xercesc/framework/psvi/PSVIAttributeList.hpp \ + xercesc/framework/psvi/PSVIElement.hpp \ + xercesc/framework/psvi/PSVIHandler.hpp \ + xercesc/framework/psvi/PSVIItem.hpp \ + xercesc/framework/psvi/XSAnnotation.hpp \ + xercesc/framework/psvi/XSAttributeDeclaration.hpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.hpp \ + xercesc/framework/psvi/XSAttributeUse.hpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.hpp \ + xercesc/framework/psvi/XSConstants.hpp \ + xercesc/framework/psvi/XSElementDeclaration.hpp \ + xercesc/framework/psvi/XSFacet.hpp \ + xercesc/framework/psvi/XSIDCDefinition.hpp \ + xercesc/framework/psvi/XSModel.hpp \ + xercesc/framework/psvi/XSModelGroup.hpp \ + xercesc/framework/psvi/XSModelGroupDefinition.hpp \ + xercesc/framework/psvi/XSMultiValueFacet.hpp \ + xercesc/framework/psvi/XSNamedMap.hpp \ + xercesc/framework/psvi/XSNamedMap.c \ + xercesc/framework/psvi/XSNamespaceItem.hpp \ + xercesc/framework/psvi/XSNotationDeclaration.hpp \ + xercesc/framework/psvi/XSObject.hpp \ + xercesc/framework/psvi/XSParticle.hpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.hpp \ + xercesc/framework/psvi/XSTypeDefinition.hpp \ + xercesc/framework/psvi/XSValue.hpp \ + xercesc/framework/psvi/XSWildcard.hpp \ + xercesc/framework/StdInInputSource.hpp \ + xercesc/framework/StdOutFormatTarget.hpp \ + xercesc/framework/URLInputSource.hpp \ + xercesc/framework/ValidationContext.hpp \ + xercesc/framework/Wrapper4DOMLSInput.hpp \ + xercesc/framework/Wrapper4InputSource.hpp \ + xercesc/framework/XMLAttDef.hpp \ + xercesc/framework/XMLAttDefList.hpp \ + xercesc/framework/XMLAttr.hpp \ + xercesc/framework/XMLBuffer.hpp \ + xercesc/framework/XMLBufferMgr.hpp \ + xercesc/framework/XMLContentModel.hpp \ + xercesc/framework/XMLDocumentHandler.hpp \ + xercesc/framework/XMLDTDDescription.hpp \ + xercesc/framework/XMLElementDecl.hpp \ + xercesc/framework/XMLEntityDecl.hpp \ + xercesc/framework/XMLEntityHandler.hpp \ + xercesc/framework/XMLErrorCodes.hpp \ + xercesc/framework/XMLErrorReporter.hpp \ + xercesc/framework/XMLFormatter.hpp \ + xercesc/framework/XMLGrammarDescription.hpp \ + xercesc/framework/XMLGrammarPool.hpp \ + xercesc/framework/XMLGrammarPoolImpl.hpp \ + xercesc/framework/XMLNotationDecl.hpp \ + xercesc/framework/XMLPScanToken.hpp \ + xercesc/framework/XMLRecognizer.hpp \ + xercesc/framework/XMLRefInfo.hpp \ + xercesc/framework/XMLSchemaDescription.hpp \ + xercesc/framework/XMLValidator.hpp \ + xercesc/framework/XMLValidityCodes.hpp + +framework_sources = \ + xercesc/framework/BinOutputStream.cpp \ + xercesc/framework/LocalFileFormatTarget.cpp \ + xercesc/framework/LocalFileInputSource.cpp \ + xercesc/framework/MemBufFormatTarget.cpp \ + xercesc/framework/MemBufInputSource.cpp \ + xercesc/framework/psvi/PSVIAttribute.cpp \ + xercesc/framework/psvi/PSVIAttributeList.cpp \ + xercesc/framework/psvi/PSVIElement.cpp \ + xercesc/framework/psvi/PSVIItem.cpp \ + xercesc/framework/psvi/XSAnnotation.cpp \ + xercesc/framework/psvi/XSAttributeDeclaration.cpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.cpp \ + xercesc/framework/psvi/XSAttributeUse.cpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.cpp \ + xercesc/framework/psvi/XSElementDeclaration.cpp \ + xercesc/framework/psvi/XSFacet.cpp \ + xercesc/framework/psvi/XSIDCDefinition.cpp \ + xercesc/framework/psvi/XSModel.cpp \ + xercesc/framework/psvi/XSModelGroup.cpp \ + xercesc/framework/psvi/XSModelGroupDefinition.cpp \ + xercesc/framework/psvi/XSMultiValueFacet.cpp \ + xercesc/framework/psvi/XSNamespaceItem.cpp \ + xercesc/framework/psvi/XSNotationDeclaration.cpp \ + xercesc/framework/psvi/XSObject.cpp \ + xercesc/framework/psvi/XSParticle.cpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.cpp \ + xercesc/framework/psvi/XSTypeDefinition.cpp \ + xercesc/framework/psvi/XSValue.cpp \ + xercesc/framework/psvi/XSWildcard.cpp \ + xercesc/framework/StdInInputSource.cpp \ + xercesc/framework/StdOutFormatTarget.cpp \ + xercesc/framework/URLInputSource.cpp \ + xercesc/framework/Wrapper4DOMLSInput.cpp \ + xercesc/framework/Wrapper4InputSource.cpp \ + xercesc/framework/XMLAttDef.cpp \ + xercesc/framework/XMLAttDefList.cpp \ + xercesc/framework/XMLAttr.cpp \ + xercesc/framework/XMLBuffer.cpp \ + xercesc/framework/XMLBufferMgr.cpp \ + xercesc/framework/XMLContentModel.cpp \ + xercesc/framework/XMLDTDDescription.cpp \ + xercesc/framework/XMLElementDecl.cpp \ + xercesc/framework/XMLEntityDecl.cpp \ + xercesc/framework/XMLFormatter.cpp \ + xercesc/framework/XMLGrammarDescription.cpp \ + xercesc/framework/XMLGrammarPoolImpl.cpp \ + xercesc/framework/XMLNotationDecl.cpp \ + xercesc/framework/XMLRecognizer.cpp \ + xercesc/framework/XMLRefInfo.cpp \ + xercesc/framework/XMLSchemaDescription.cpp \ + xercesc/framework/XMLValidator.cpp + + +internal_headers = \ + xercesc/internal/BinFileOutputStream.hpp \ + xercesc/internal/BinMemOutputStream.hpp \ + xercesc/internal/CharTypeTables.hpp \ + xercesc/internal/DGXMLScanner.hpp \ + xercesc/internal/ElemStack.hpp \ + xercesc/internal/EndOfEntityException.hpp \ + xercesc/internal/IANAEncodings.hpp \ + xercesc/internal/IGXMLScanner.hpp \ + xercesc/internal/MemoryManagerImpl.hpp \ + xercesc/internal/ReaderMgr.hpp \ + xercesc/internal/SGXMLScanner.hpp \ + xercesc/internal/ValidationContextImpl.hpp \ + xercesc/internal/VecAttributesImpl.hpp \ + xercesc/internal/VecAttrListImpl.hpp \ + xercesc/internal/WFXMLScanner.hpp \ + xercesc/internal/XMLInternalErrorHandler.hpp \ + xercesc/internal/XMLReader.hpp \ + xercesc/internal/XMLScanner.hpp \ + xercesc/internal/XMLScannerResolver.hpp \ + xercesc/internal/XProtoType.hpp \ + xercesc/internal/XSAXMLScanner.hpp \ + xercesc/internal/XSerializable.hpp \ + xercesc/internal/XSerializationException.hpp \ + xercesc/internal/XSerializeEngine.hpp \ + xercesc/internal/XSObjectFactory.hpp \ + xercesc/internal/XTemplateSerializer.hpp + +internal_sources = \ + xercesc/internal/BinFileOutputStream.cpp \ + xercesc/internal/BinMemOutputStream.cpp \ + xercesc/internal/DGXMLScanner.cpp \ + xercesc/internal/ElemStack.cpp \ + xercesc/internal/IGXMLScanner.cpp \ + xercesc/internal/IGXMLScanner2.cpp \ + xercesc/internal/MemoryManagerImpl.cpp \ + xercesc/internal/ReaderMgr.cpp \ + xercesc/internal/SGXMLScanner.cpp \ + xercesc/internal/ValidationContextImpl.cpp \ + xercesc/internal/VecAttributesImpl.cpp \ + xercesc/internal/VecAttrListImpl.cpp \ + xercesc/internal/WFXMLScanner.cpp \ + xercesc/internal/XMLReader.cpp \ + xercesc/internal/XMLScanner.cpp \ + xercesc/internal/XMLScannerResolver.cpp \ + xercesc/internal/XProtoType.cpp \ + xercesc/internal/XSAXMLScanner.cpp \ + xercesc/internal/XSerializeEngine.cpp \ + xercesc/internal/XSObjectFactory.cpp \ + xercesc/internal/XTemplateSerializer.cpp + + +parsers_headers = \ + xercesc/parsers/AbstractDOMParser.hpp \ + xercesc/parsers/DOMLSParserImpl.hpp \ + xercesc/parsers/SAX2XMLFilterImpl.hpp \ + xercesc/parsers/SAX2XMLReaderImpl.hpp \ + xercesc/parsers/SAXParser.hpp \ + xercesc/parsers/XercesDOMParser.hpp + +parsers_sources = \ + xercesc/parsers/AbstractDOMParser.cpp \ + xercesc/parsers/DOMLSParserImpl.cpp \ + xercesc/parsers/SAX2XMLFilterImpl.cpp \ + xercesc/parsers/SAX2XMLReaderImpl.cpp \ + xercesc/parsers/SAXParser.cpp \ + xercesc/parsers/XercesDOMParser.cpp + + +sax_headers = \ + xercesc/sax/AttributeList.hpp \ + xercesc/sax/DocumentHandler.hpp \ + xercesc/sax/DTDHandler.hpp \ + xercesc/sax/EntityResolver.hpp \ + xercesc/sax/ErrorHandler.hpp \ + xercesc/sax/HandlerBase.hpp \ + xercesc/sax/InputSource.hpp \ + xercesc/sax/Locator.hpp \ + xercesc/sax/Parser.hpp \ + xercesc/sax/SAXException.hpp \ + xercesc/sax/SAXParseException.hpp + +sax_sources = \ + xercesc/sax/Dummy.cpp \ + xercesc/sax/InputSource.cpp \ + xercesc/sax/SAXException.cpp \ + xercesc/sax/SAXParseException.cpp + + +sax2_headers = \ + xercesc/sax2/Attributes.hpp \ + xercesc/sax2/ContentHandler.hpp \ + xercesc/sax2/DeclHandler.hpp \ + xercesc/sax2/DefaultHandler.hpp \ + xercesc/sax2/LexicalHandler.hpp \ + xercesc/sax2/SAX2XMLFilter.hpp \ + xercesc/sax2/SAX2XMLReader.hpp \ + xercesc/sax2/XMLReaderFactory.hpp + +sax2_sources = \ + xercesc/sax2/sax2Dummy.cpp + +util_headers = \ + xercesc/util/ArrayIndexOutOfBoundsException.hpp \ + xercesc/util/Base64.hpp \ + xercesc/util/BaseRefVectorOf.hpp \ + xercesc/util/BaseRefVectorOf.c \ + xercesc/util/BinFileInputStream.hpp \ + xercesc/util/BinInputStream.hpp \ + xercesc/util/BinMemInputStream.hpp \ + xercesc/util/BitOps.hpp \ + xercesc/util/BitSet.hpp \ + xercesc/util/CountedPointer.hpp \ + xercesc/util/CountedPointer.c \ + xercesc/util/DefaultPanicHandler.hpp \ + xercesc/util/EmptyStackException.hpp \ + xercesc/util/EncodingValidator.hpp \ + xercesc/util/FlagJanitor.hpp \ + xercesc/util/FlagJanitor.c \ + xercesc/util/Hashers.hpp \ + xercesc/util/Hash2KeysSetOf.hpp \ + xercesc/util/Hash2KeysSetOf.c \ + xercesc/util/HexBin.hpp \ + xercesc/util/IllegalArgumentException.hpp \ + xercesc/util/InvalidCastException.hpp \ + xercesc/util/IOException.hpp \ + xercesc/util/Janitor.hpp \ + xercesc/util/Janitor.c \ + xercesc/util/KeyRefPair.hpp \ + xercesc/util/KeyRefPair.c \ + xercesc/util/KeyValuePair.hpp \ + xercesc/util/KeyValuePair.c \ + xercesc/util/KVStringPair.hpp \ + xercesc/util/Mutexes.hpp \ + xercesc/util/LogicalPath.c \ + xercesc/util/NameIdPool.hpp \ + xercesc/util/NameIdPool.c \ + xercesc/util/NoSuchElementException.hpp \ + xercesc/util/NullPointerException.hpp \ + xercesc/util/NumberFormatException.hpp \ + xercesc/util/OutOfMemoryException.hpp \ + xercesc/util/PanicHandler.hpp \ + xercesc/util/ParseException.hpp \ + xercesc/util/PlatformUtils.hpp \ + xercesc/util/PSVIUni.hpp \ + xercesc/util/QName.hpp \ + xercesc/util/RefArrayOf.hpp \ + xercesc/util/RefArrayOf.c \ + xercesc/util/RefArrayVectorOf.hpp \ + xercesc/util/RefArrayVectorOf.c \ + xercesc/util/RefHash2KeysTableOf.hpp \ + xercesc/util/RefHash2KeysTableOf.c \ + xercesc/util/RefHash3KeysIdPool.hpp \ + xercesc/util/RefHash3KeysIdPool.c \ + xercesc/util/RefHashTableOf.hpp \ + xercesc/util/RefHashTableOf.c \ + xercesc/util/RefStackOf.hpp \ + xercesc/util/RefStackOf.c \ + xercesc/util/RefVectorOf.hpp \ + xercesc/util/RefVectorOf.c \ + xercesc/util/regx/ASCIIRangeFactory.hpp \ + xercesc/util/regx/BlockRangeFactory.hpp \ + xercesc/util/regx/BMPattern.hpp \ + xercesc/util/regx/CharToken.hpp \ + xercesc/util/regx/ClosureToken.hpp \ + xercesc/util/regx/ConcatToken.hpp \ + xercesc/util/regx/Match.hpp \ + xercesc/util/regx/Op.hpp \ + xercesc/util/regx/OpFactory.hpp \ + xercesc/util/regx/ParenToken.hpp \ + xercesc/util/regx/ParserForXMLSchema.hpp \ + xercesc/util/regx/RangeFactory.hpp \ + xercesc/util/regx/RangeToken.hpp \ + xercesc/util/regx/RangeTokenMap.hpp \ + xercesc/util/regx/RegularExpression.hpp \ + xercesc/util/regx/RegxDefs.hpp \ + xercesc/util/regx/RegxParser.hpp \ + xercesc/util/regx/RegxUtil.hpp \ + xercesc/util/regx/StringToken.hpp \ + xercesc/util/regx/Token.hpp \ + xercesc/util/regx/TokenFactory.hpp \ + xercesc/util/regx/TokenInc.hpp \ + xercesc/util/regx/UniCharTable.hpp \ + xercesc/util/regx/UnicodeRangeFactory.hpp \ + xercesc/util/regx/UnionToken.hpp \ + xercesc/util/regx/XMLRangeFactory.hpp \ + xercesc/util/regx/XMLUniCharacter.hpp \ + xercesc/util/RuntimeException.hpp \ + xercesc/util/SchemaDateTimeException.hpp \ + xercesc/util/SecurityManager.hpp \ + xercesc/util/StringPool.hpp \ + xercesc/util/SynchronizedStringPool.hpp \ + xercesc/util/TranscodingException.hpp \ + xercesc/util/TransENameMap.hpp \ + xercesc/util/TransENameMap.c \ + xercesc/util/TransService.hpp \ + xercesc/util/UnexpectedEOFException.hpp \ + xercesc/util/UnsupportedEncodingException.hpp \ + xercesc/util/UTFDataFormatException.hpp \ + xercesc/util/ValueArrayOf.hpp \ + xercesc/util/ValueArrayOf.c \ + xercesc/util/ValueHashTableOf.hpp \ + xercesc/util/ValueHashTableOf.c \ + xercesc/util/ValueStackOf.hpp \ + xercesc/util/ValueStackOf.c \ + xercesc/util/ValueVectorOf.hpp \ + xercesc/util/ValueVectorOf.c \ + xercesc/util/XercesDefs.hpp \ + xercesc/util/XercesVersion.hpp \ + xercesc/util/XMemory.hpp \ + xercesc/util/XML256TableTranscoder.hpp \ + xercesc/util/XML88591Transcoder.hpp \ + xercesc/util/XMLAbstractDoubleFloat.hpp \ + xercesc/util/XMLASCIITranscoder.hpp \ + xercesc/util/XMLBigDecimal.hpp \ + xercesc/util/XMLBigInteger.hpp \ + xercesc/util/XMLChar.hpp \ + xercesc/util/XMLChTranscoder.hpp \ + xercesc/util/XMLDateTime.hpp \ + xercesc/util/XMLDOMMsg.hpp \ + xercesc/util/XMLDouble.hpp \ + xercesc/util/XMLEBCDICTranscoder.hpp \ + xercesc/util/XMLEntityResolver.hpp \ + xercesc/util/XMLEnumerator.hpp \ + xercesc/util/XMLException.hpp \ + xercesc/util/XMLExceptMsgs.hpp \ + xercesc/util/XMLFileMgr.hpp \ + xercesc/util/XMLFloat.hpp \ + xercesc/util/XMLIBM1047Transcoder.hpp \ + xercesc/util/XMLIBM1140Transcoder.hpp \ + xercesc/util/XMLInitializer.hpp \ + xercesc/util/XMLInteger.hpp \ + xercesc/util/XMLMutexMgr.hpp \ + xercesc/util/XMLMsgLoader.hpp \ + xercesc/util/XMLNetAccessor.hpp \ + xercesc/util/XMLNumber.hpp \ + xercesc/util/XMLResourceIdentifier.hpp \ + xercesc/util/XMLString.hpp \ + xercesc/util/XMLStringTokenizer.hpp \ + xercesc/util/XMLUCS4Transcoder.hpp \ + xercesc/util/XMLUni.hpp \ + xercesc/util/XMLUniDefs.hpp \ + xercesc/util/XMLUri.hpp \ + xercesc/util/XMLURL.hpp \ + xercesc/util/XMLUTF16Transcoder.hpp \ + xercesc/util/XMLUTF8Transcoder.hpp \ + xercesc/util/XMLWin1252Transcoder.hpp + +util_sources = \ + xercesc/util/Base64.cpp \ + xercesc/util/BinFileInputStream.cpp \ + xercesc/util/BinInputStream.cpp \ + xercesc/util/BinMemInputStream.cpp \ + xercesc/util/BitSet.cpp \ + xercesc/util/DefaultPanicHandler.cpp \ + xercesc/util/EncodingValidator.cpp \ + xercesc/util/HeaderDummy.cpp \ + xercesc/util/HexBin.cpp \ + xercesc/util/KVStringPair.cpp \ + xercesc/util/Mutexes.cpp \ + xercesc/util/PanicHandler.cpp \ + xercesc/util/PlatformUtils.cpp \ + xercesc/util/PSVIUni.cpp \ + xercesc/util/QName.cpp \ + xercesc/util/regx/ASCIIRangeFactory.cpp \ + xercesc/util/regx/BlockRangeFactory.cpp \ + xercesc/util/regx/BMPattern.cpp \ + xercesc/util/regx/CharToken.cpp \ + xercesc/util/regx/ClosureToken.cpp \ + xercesc/util/regx/ConcatToken.cpp \ + xercesc/util/regx/Match.cpp \ + xercesc/util/regx/Op.cpp \ + xercesc/util/regx/OpFactory.cpp \ + xercesc/util/regx/ParenToken.cpp \ + xercesc/util/regx/ParserForXMLSchema.cpp \ + xercesc/util/regx/RangeFactory.cpp \ + xercesc/util/regx/RangeToken.cpp \ + xercesc/util/regx/RangeTokenMap.cpp \ + xercesc/util/regx/RegularExpression.cpp \ + xercesc/util/regx/RegxParser.cpp \ + xercesc/util/regx/RegxUtil.cpp \ + xercesc/util/regx/StringToken.cpp \ + xercesc/util/regx/Token.cpp \ + xercesc/util/regx/TokenFactory.cpp \ + xercesc/util/regx/UnicodeRangeFactory.cpp \ + xercesc/util/regx/UnionToken.cpp \ + xercesc/util/regx/XMLRangeFactory.cpp \ + xercesc/util/regx/XMLUniCharacter.cpp \ + xercesc/util/StringPool.cpp \ + xercesc/util/SynchronizedStringPool.cpp \ + xercesc/util/TransService.cpp \ + xercesc/util/XMemory.cpp \ + xercesc/util/XML256TableTranscoder.cpp \ + xercesc/util/XML88591Transcoder.cpp \ + xercesc/util/XMLAbstractDoubleFloat.cpp \ + xercesc/util/XMLASCIITranscoder.cpp \ + xercesc/util/XMLBigDecimal.cpp \ + xercesc/util/XMLBigInteger.cpp \ + xercesc/util/XMLChar.cpp \ + xercesc/util/XMLChTranscoder.cpp \ + xercesc/util/XMLDateTime.cpp \ + xercesc/util/XMLDouble.cpp \ + xercesc/util/XMLEBCDICTranscoder.cpp \ + xercesc/util/XMLException.cpp \ + xercesc/util/XMLFloat.cpp \ + xercesc/util/XMLIBM1047Transcoder.cpp \ + xercesc/util/XMLIBM1140Transcoder.cpp \ + xercesc/util/XMLInitializer.cpp \ + xercesc/util/XMLMsgLoader.cpp \ + xercesc/util/XMLNumber.cpp \ + xercesc/util/XMLString.cpp \ + xercesc/util/XMLStringTokenizer.cpp \ + xercesc/util/XMLUCS4Transcoder.cpp \ + xercesc/util/XMLUni.cpp \ + xercesc/util/XMLUri.cpp \ + xercesc/util/XMLURL.cpp \ + xercesc/util/XMLUTF16Transcoder.cpp \ + xercesc/util/XMLUTF8Transcoder.cpp \ + xercesc/util/XMLWin1252Transcoder.cpp + + +validators_headers = \ + xercesc/validators/common/AllContentModel.hpp \ + xercesc/validators/common/CMAny.hpp \ + xercesc/validators/common/CMBinaryOp.hpp \ + xercesc/validators/common/CMLeaf.hpp \ + xercesc/validators/common/CMRepeatingLeaf.hpp \ + xercesc/validators/common/CMNode.hpp \ + xercesc/validators/common/CMStateSet.hpp \ + xercesc/validators/common/CMUnaryOp.hpp \ + xercesc/validators/common/ContentLeafNameTypeVector.hpp \ + xercesc/validators/common/ContentSpecNode.hpp \ + xercesc/validators/common/DFAContentModel.hpp \ + xercesc/validators/common/Grammar.hpp \ + xercesc/validators/common/GrammarResolver.hpp \ + xercesc/validators/common/MixedContentModel.hpp \ + xercesc/validators/common/SimpleContentModel.hpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.hpp \ + xercesc/validators/datatype/AbstractNumericValidator.hpp \ + xercesc/validators/datatype/AbstractStringValidator.hpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.hpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.hpp \ + xercesc/validators/datatype/DateDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeValidator.hpp \ + xercesc/validators/datatype/DayDatatypeValidator.hpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.hpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.hpp \ + xercesc/validators/datatype/DurationDatatypeValidator.hpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.hpp \ + xercesc/validators/datatype/FloatDatatypeValidator.hpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/IDDatatypeValidator.hpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.hpp \ + xercesc/validators/datatype/InvalidDatatypeFacetException.hpp \ + xercesc/validators/datatype/InvalidDatatypeValueException.hpp \ + xercesc/validators/datatype/ListDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.hpp \ + xercesc/validators/datatype/NameDatatypeValidator.hpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.hpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp \ + xercesc/validators/datatype/QNameDatatypeValidator.hpp \ + xercesc/validators/datatype/StringDatatypeValidator.hpp \ + xercesc/validators/datatype/TimeDatatypeValidator.hpp \ + xercesc/validators/datatype/UnionDatatypeValidator.hpp \ + xercesc/validators/datatype/XMLCanRepGroup.hpp \ + xercesc/validators/datatype/YearDatatypeValidator.hpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.hpp \ + xercesc/validators/DTD/DocTypeHandler.hpp \ + xercesc/validators/DTD/DTDAttDef.hpp \ + xercesc/validators/DTD/DTDAttDefList.hpp \ + xercesc/validators/DTD/DTDElementDecl.hpp \ + xercesc/validators/DTD/DTDEntityDecl.hpp \ + xercesc/validators/DTD/DTDGrammar.hpp \ + xercesc/validators/DTD/DTDScanner.hpp \ + xercesc/validators/DTD/DTDValidator.hpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp \ + xercesc/validators/schema/ComplexTypeInfo.hpp \ + xercesc/validators/schema/GeneralAttributeCheck.hpp \ + xercesc/validators/schema/identity/FieldActivator.hpp \ + xercesc/validators/schema/identity/FieldValueMap.hpp \ + xercesc/validators/schema/identity/IC_Field.hpp \ + xercesc/validators/schema/identity/IC_Key.hpp \ + xercesc/validators/schema/identity/IC_KeyRef.hpp \ + xercesc/validators/schema/identity/IC_Selector.hpp \ + xercesc/validators/schema/identity/IC_Unique.hpp \ + xercesc/validators/schema/identity/IdentityConstraint.hpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.hpp \ + xercesc/validators/schema/identity/ValueStore.hpp \ + xercesc/validators/schema/identity/ValueStoreCache.hpp \ + xercesc/validators/schema/identity/XercesXPath.hpp \ + xercesc/validators/schema/identity/XPathException.hpp \ + xercesc/validators/schema/identity/XPathMatcher.hpp \ + xercesc/validators/schema/identity/XPathMatcherStack.hpp \ + xercesc/validators/schema/identity/XPathSymbols.hpp \ + xercesc/validators/schema/NamespaceScope.hpp \ + xercesc/validators/schema/PSVIDefs.hpp \ + xercesc/validators/schema/SchemaAttDef.hpp \ + xercesc/validators/schema/SchemaAttDefList.hpp \ + xercesc/validators/schema/SchemaElementDecl.hpp \ + xercesc/validators/schema/SchemaGrammar.hpp \ + xercesc/validators/schema/SchemaInfo.hpp \ + xercesc/validators/schema/SchemaSymbols.hpp \ + xercesc/validators/schema/SchemaValidator.hpp \ + xercesc/validators/schema/SubstitutionGroupComparator.hpp \ + xercesc/validators/schema/TraverseSchema.hpp \ + xercesc/validators/schema/XercesAttGroupInfo.hpp \ + xercesc/validators/schema/XercesElementWildcard.hpp \ + xercesc/validators/schema/XercesGroupInfo.hpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp \ + xercesc/validators/schema/XSDDOMParser.hpp \ + xercesc/validators/schema/XSDErrorReporter.hpp \ + xercesc/validators/schema/XSDLocator.hpp \ + xercesc/validators/schema/XUtil.hpp + +validators_sources = \ + xercesc/validators/common/AllContentModel.cpp \ + xercesc/validators/common/CMAny.cpp \ + xercesc/validators/common/CMBinaryOp.cpp \ + xercesc/validators/common/CMUnaryOp.cpp \ + xercesc/validators/common/ContentLeafNameTypeVector.cpp \ + xercesc/validators/common/ContentSpecNode.cpp \ + xercesc/validators/common/DFAContentModel.cpp \ + xercesc/validators/common/Grammar.cpp \ + xercesc/validators/common/GrammarResolver.cpp \ + xercesc/validators/common/MixedContentModel.cpp \ + xercesc/validators/common/SimpleContentModel.cpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.cpp \ + xercesc/validators/datatype/AbstractNumericValidator.cpp \ + xercesc/validators/datatype/AbstractStringValidator.cpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.cpp \ + xercesc/validators/datatype/DateDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeValidator.cpp \ + xercesc/validators/datatype/DayDatatypeValidator.cpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.cpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.cpp \ + xercesc/validators/datatype/DurationDatatypeValidator.cpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.cpp \ + xercesc/validators/datatype/FloatDatatypeValidator.cpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/IDDatatypeValidator.cpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.cpp \ + xercesc/validators/datatype/ListDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.cpp \ + xercesc/validators/datatype/NameDatatypeValidator.cpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.cpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp \ + xercesc/validators/datatype/QNameDatatypeValidator.cpp \ + xercesc/validators/datatype/StringDatatypeValidator.cpp \ + xercesc/validators/datatype/TimeDatatypeValidator.cpp \ + xercesc/validators/datatype/UnionDatatypeValidator.cpp \ + xercesc/validators/datatype/XMLCanRepGroup.cpp \ + xercesc/validators/datatype/YearDatatypeValidator.cpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.cpp \ + xercesc/validators/DTD/DTDAttDef.cpp \ + xercesc/validators/DTD/DTDAttDefList.cpp \ + xercesc/validators/DTD/DTDElementDecl.cpp \ + xercesc/validators/DTD/DTDEntityDecl.cpp \ + xercesc/validators/DTD/DTDGrammar.cpp \ + xercesc/validators/DTD/DTDScanner.cpp \ + xercesc/validators/DTD/DTDValidator.cpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp \ + xercesc/validators/schema/ComplexTypeInfo.cpp \ + xercesc/validators/schema/GeneralAttributeCheck.cpp \ + xercesc/validators/schema/identity/FieldActivator.cpp \ + xercesc/validators/schema/identity/FieldValueMap.cpp \ + xercesc/validators/schema/identity/IC_Field.cpp \ + xercesc/validators/schema/identity/IC_Key.cpp \ + xercesc/validators/schema/identity/IC_KeyRef.cpp \ + xercesc/validators/schema/identity/IC_Selector.cpp \ + xercesc/validators/schema/identity/IC_Unique.cpp \ + xercesc/validators/schema/identity/IdentityConstraint.cpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.cpp \ + xercesc/validators/schema/identity/ValueStore.cpp \ + xercesc/validators/schema/identity/ValueStoreCache.cpp \ + xercesc/validators/schema/identity/XercesXPath.cpp \ + xercesc/validators/schema/identity/XPathMatcher.cpp \ + xercesc/validators/schema/identity/XPathMatcherStack.cpp \ + xercesc/validators/schema/identity/XPathSymbols.cpp \ + xercesc/validators/schema/NamespaceScope.cpp \ + xercesc/validators/schema/SchemaAttDef.cpp \ + xercesc/validators/schema/SchemaAttDefList.cpp \ + xercesc/validators/schema/SchemaElementDecl.cpp \ + xercesc/validators/schema/SchemaGrammar.cpp \ + xercesc/validators/schema/SchemaInfo.cpp \ + xercesc/validators/schema/SchemaSymbols.cpp \ + xercesc/validators/schema/SchemaValidator.cpp \ + xercesc/validators/schema/SubstitutionGroupComparator.cpp \ + xercesc/validators/schema/TraverseSchema.cpp \ + xercesc/validators/schema/XercesAttGroupInfo.cpp \ + xercesc/validators/schema/XercesElementWildcard.cpp \ + xercesc/validators/schema/XercesGroupInfo.cpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp \ + xercesc/validators/schema/XSDDOMParser.cpp \ + xercesc/validators/schema/XSDErrorReporter.cpp \ + xercesc/validators/schema/XSDLocator.cpp \ + xercesc/validators/schema/XUtil.cpp + +xinclude_headers = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp \ + xercesc/xinclude/XIncludeLocation.hpp \ + xercesc/xinclude/XIncludeUtils.hpp + +xinclude_sources = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp \ + xercesc/xinclude/XIncludeLocation.cpp \ + xercesc/xinclude/XIncludeUtils.cpp + +icu_headers = \ + xercesc/util/Transcoders/ICU/ICUTransService.hpp + +icu_sources = \ + xercesc/util/Transcoders/ICU/ICUTransService.cpp + +gnuiconv_headers = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp + +gnuiconv_sources = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp + +iconv_headers = \ + xercesc/util/Transcoders/Iconv/IconvTransService.hpp + +iconv_sources = \ + xercesc/util/Transcoders/Iconv/IconvTransService.cpp + +macosunicodeconverter_headers = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp + +macosunicodeconverter_sources = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp + +wintrans_headers = \ + xercesc/util/Transcoders/Win32/Win32TransService.hpp + +wintrans_sources = \ + xercesc/util/Transcoders/Win32/Win32TransService.cpp + + +curl_headers = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.hpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp + +curl_sources = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp + +sockets_headers = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +sockets_sources = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + +cfurl_headers = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.hpp + +cfurl_sources = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.cpp + +winsock_headers = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +winsock_sources = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + + +msginmemory_headers = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp \ + xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp + +msginmemory_sources = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp + +msgicu_headers = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp + +msgicu_sources = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp + +msgicu_nodist_sources = \ + xercesc_messages.c \ + root_res.c + +msgiconv_headers = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/XMLMsgCat_Ids.hpp + +msgiconv_sources = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp + + +posixfmgr_headers = \ + xercesc/util/FileManagers/PosixFileMgr.hpp + +posixfmgr_sources = \ + xercesc/util/FileManagers/PosixFileMgr.cpp + +winfmgr_headers = \ + xercesc/util/FileManagers/WindowsFileMgr.hpp + +winfmgr_sources = \ + xercesc/util/FileManagers/WindowsFileMgr.cpp + + +nothreadmmgr_headers = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.hpp + +nothreadmmgr_sources = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.cpp + +posixmmgr_headers = \ + xercesc/util/MutexManagers/PosixMutexMgr.hpp + +posixmmgr_sources = \ + xercesc/util/MutexManagers/PosixMutexMgr.cpp + +winmmgr_headers = \ + xercesc/util/MutexManagers/WindowsMutexMgr.hpp + +winmmgr_sources = \ + xercesc/util/MutexManagers/WindowsMutexMgr.cpp + + +# Override generated rules to provide prettier make rules +# +# Warning: If Automake changes sufficiently, these rules may need to +# be regenerated from the (new) default output of Automake +# +if XERCES_PRETTY_MAKE + +.c.lo: +@am__fastdepCC_TRUE@ @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ @source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cpp.lo: +@am__fastdepCXX_TRUE@ @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ @source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +PRETTY_MAKE=${top_srcdir}/config/pretty-make +PRETTY_COMPILE=${PRETTY_MAKE} Compiling + +endif + +COMPILE = ${PRETTY_COMPILE} \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CC --mode=compile \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +CXXCOMPILE = ${PRETTY_COMPILE} \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CXX --mode=compile \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) diff --git a/project/jni/xerces/src/Makefile.in b/project/jni/xerces/src/Makefile.in new file mode 100644 index 000000000..7e93d41f6 --- /dev/null +++ b/project/jni/xerces/src/Makefile.in @@ -0,0 +1,4980 @@ +# Makefile.in generated by automake 1.11 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# 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: Makefile.am 883272 2009-11-23 08:17:49Z borisk $ +# + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ + +# NetAccessors, conditionally built based on settings from configure +# +@XERCES_USE_NETACCESSOR_CURL_TRUE@am__append_1 = ${curl_sources} +@XERCES_USE_NETACCESSOR_CURL_TRUE@am__append_2 = ${curl_headers} +@XERCES_USE_NETACCESSOR_CURL_TRUE@am__append_3 = ${CURL_FLAGS} +@XERCES_USE_NETACCESSOR_SOCKET_TRUE@am__append_4 = ${sockets_sources} +@XERCES_USE_NETACCESSOR_SOCKET_TRUE@am__append_5 = ${sockets_headers} +@XERCES_USE_NETACCESSOR_CFURL_TRUE@am__append_6 = ${cfurl_sources} +@XERCES_USE_NETACCESSOR_CFURL_TRUE@am__append_7 = ${cfurl_headers} +@XERCES_USE_NETACCESSOR_WINSOCK_TRUE@am__append_8 = ${winsock_sources} +@XERCES_USE_NETACCESSOR_WINSOCK_TRUE@am__append_9 = ${winsock_headers} + +# Transcoders, conditionally built based on settings from configure +# +@XERCES_USE_TRANSCODER_ICU_TRUE@am__append_10 = ${icu_sources} +@XERCES_USE_TRANSCODER_ICU_TRUE@am__append_11 = ${icu_headers} +@XERCES_USE_TRANSCODER_ICU_TRUE@am__append_12 = ${ICU_FLAGS} +@XERCES_USE_TRANSCODER_GNUICONV_TRUE@am__append_13 = ${gnuiconv_sources} +@XERCES_USE_TRANSCODER_GNUICONV_TRUE@am__append_14 = ${gnuiconv_headers} +@XERCES_USE_TRANSCODER_ICONV_TRUE@am__append_15 = ${iconv_sources} +@XERCES_USE_TRANSCODER_ICONV_TRUE@am__append_16 = ${iconv_headers} +@XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER_TRUE@am__append_17 = ${macosunicodeconverter_sources} +@XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER_TRUE@am__append_18 = ${macosunicodeconverter_headers} +@XERCES_USE_TRANSCODER_WINDOWS_TRUE@am__append_19 = ${wintrans_sources} +@XERCES_USE_TRANSCODER_WINDOWS_TRUE@am__append_20 = ${wintrans_headers} + +# MsgLoaders, conditionally built based on settings from configure +# +@XERCES_USE_MSGLOADER_INMEMORY_TRUE@am__append_21 = ${msginmemory_sources} +@XERCES_USE_MSGLOADER_INMEMORY_TRUE@am__append_22 = ${msginmemory_headers} +@XERCES_USE_MSGLOADER_ICU_TRUE@am__append_23 = ${msgicu_sources} +@XERCES_USE_MSGLOADER_ICU_TRUE@am__append_24 = ${msgicu_headers} +@XERCES_USE_MSGLOADER_ICU_TRUE@am__append_25 = ${ICU_FLAGS} +@XERCES_USE_MSGLOADER_ICU_TRUE@am__append_26 = xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt \ +@XERCES_USE_MSGLOADER_ICU_TRUE@xercesc/util/MsgLoaders/ICU/resources/root.txt + +@XERCES_USE_MSGLOADER_ICONV_TRUE@am__append_27 = ${msgiconv_sources} +@XERCES_USE_MSGLOADER_ICONV_TRUE@am__append_28 = ${msgiconv_headers} +@XERCES_USE_MSGLOADER_ICONV_TRUE@am__append_29 = xercesc/util/MsgLoaders/MsgCatalog + +# Mutex Managers, conditionally built based on settings from configure +# +@XERCES_USE_MUTEXMGR_NOTHREAD_TRUE@am__append_30 = ${nothreadmmgr_sources} +@XERCES_USE_MUTEXMGR_NOTHREAD_TRUE@am__append_31 = ${nothreadmmgr_headers} +@XERCES_USE_MUTEXMGR_POSIX_TRUE@am__append_32 = ${posixmmgr_sources} +@XERCES_USE_MUTEXMGR_POSIX_TRUE@am__append_33 = ${posixmmgr_headers} +@XERCES_USE_MUTEXMGR_WINDOWS_TRUE@am__append_34 = ${winmmgr_sources} +@XERCES_USE_MUTEXMGR_WINDOWS_TRUE@am__append_35 = ${winmmgr_headers} + +# File Managers, conditionally built based on settings from configure +# +@XERCES_USE_FILEMGR_POSIX_TRUE@am__append_36 = ${posixfmgr_sources} +@XERCES_USE_FILEMGR_POSIX_TRUE@am__append_37 = ${posixfmgr_headers} +@XERCES_USE_FILEMGR_WINDOWS_TRUE@am__append_38 = ${winfmgr_sources} +@XERCES_USE_FILEMGR_WINDOWS_TRUE@am__append_39 = ${winfmgr_headers} +subdir = src +DIST_COMMON = $(am__nobase_libxerces_c_la_HEADERS_DIST) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in stricmp.c \ + strnicmp.c towlower.c towupper.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/cxx_have_bool.m4 \ + $(top_srcdir)/m4/cxx_have_lstring.m4 \ + $(top_srcdir)/m4/cxx_have_namespaces.m4 \ + $(top_srcdir)/m4/cxx_have_std_libs.m4 \ + $(top_srcdir)/m4/cxx_have_std_namespace.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/xerces_curl_prefix.m4 \ + $(top_srcdir)/m4/xerces_filemgr_selection.m4 \ + $(top_srcdir)/m4/xerces_icu_prefix.m4 \ + $(top_srcdir)/m4/xerces_int_types.m4 \ + $(top_srcdir)/m4/xerces_link_darwin_framework.m4 \ + $(top_srcdir)/m4/xerces_msgloader_selection.m4 \ + $(top_srcdir)/m4/xerces_mutexmgr_selection.m4 \ + $(top_srcdir)/m4/xerces_netaccessor_selection.m4 \ + $(top_srcdir)/m4/xerces_no_threads.m4 \ + $(top_srcdir)/m4/xerces_path_delimiters.m4 \ + $(top_srcdir)/m4/xerces_pretty_make.m4 \ + $(top_srcdir)/m4/xerces_transcoder_selection.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/src/xercesc/util/Xerces_autoconf_config.hpp +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" \ + "$(DESTDIR)$(libxerces_c_ladir)" \ + "$(DESTDIR)$(autoconfheadersdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libxerces_c_la_DEPENDENCIES = $(LTLIBOBJS) +am__libxerces_c_la_SOURCES_DIST = xercesc/util/Base64.cpp \ + xercesc/util/BinFileInputStream.cpp \ + xercesc/util/BinInputStream.cpp \ + xercesc/util/BinMemInputStream.cpp xercesc/util/BitSet.cpp \ + xercesc/util/DefaultPanicHandler.cpp \ + xercesc/util/EncodingValidator.cpp \ + xercesc/util/HeaderDummy.cpp xercesc/util/HexBin.cpp \ + xercesc/util/KVStringPair.cpp xercesc/util/Mutexes.cpp \ + xercesc/util/PanicHandler.cpp xercesc/util/PlatformUtils.cpp \ + xercesc/util/PSVIUni.cpp xercesc/util/QName.cpp \ + xercesc/util/regx/ASCIIRangeFactory.cpp \ + xercesc/util/regx/BlockRangeFactory.cpp \ + xercesc/util/regx/BMPattern.cpp \ + xercesc/util/regx/CharToken.cpp \ + xercesc/util/regx/ClosureToken.cpp \ + xercesc/util/regx/ConcatToken.cpp xercesc/util/regx/Match.cpp \ + xercesc/util/regx/Op.cpp xercesc/util/regx/OpFactory.cpp \ + xercesc/util/regx/ParenToken.cpp \ + xercesc/util/regx/ParserForXMLSchema.cpp \ + xercesc/util/regx/RangeFactory.cpp \ + xercesc/util/regx/RangeToken.cpp \ + xercesc/util/regx/RangeTokenMap.cpp \ + xercesc/util/regx/RegularExpression.cpp \ + xercesc/util/regx/RegxParser.cpp \ + xercesc/util/regx/RegxUtil.cpp \ + xercesc/util/regx/StringToken.cpp xercesc/util/regx/Token.cpp \ + xercesc/util/regx/TokenFactory.cpp \ + xercesc/util/regx/UnicodeRangeFactory.cpp \ + xercesc/util/regx/UnionToken.cpp \ + xercesc/util/regx/XMLRangeFactory.cpp \ + xercesc/util/regx/XMLUniCharacter.cpp \ + xercesc/util/StringPool.cpp \ + xercesc/util/SynchronizedStringPool.cpp \ + xercesc/util/TransService.cpp xercesc/util/XMemory.cpp \ + xercesc/util/XML256TableTranscoder.cpp \ + xercesc/util/XML88591Transcoder.cpp \ + xercesc/util/XMLAbstractDoubleFloat.cpp \ + xercesc/util/XMLASCIITranscoder.cpp \ + xercesc/util/XMLBigDecimal.cpp xercesc/util/XMLBigInteger.cpp \ + xercesc/util/XMLChar.cpp xercesc/util/XMLChTranscoder.cpp \ + xercesc/util/XMLDateTime.cpp xercesc/util/XMLDouble.cpp \ + xercesc/util/XMLEBCDICTranscoder.cpp \ + xercesc/util/XMLException.cpp xercesc/util/XMLFloat.cpp \ + xercesc/util/XMLIBM1047Transcoder.cpp \ + xercesc/util/XMLIBM1140Transcoder.cpp \ + xercesc/util/XMLInitializer.cpp xercesc/util/XMLMsgLoader.cpp \ + xercesc/util/XMLNumber.cpp xercesc/util/XMLString.cpp \ + xercesc/util/XMLStringTokenizer.cpp \ + xercesc/util/XMLUCS4Transcoder.cpp xercesc/util/XMLUni.cpp \ + xercesc/util/XMLUri.cpp xercesc/util/XMLURL.cpp \ + xercesc/util/XMLUTF16Transcoder.cpp \ + xercesc/util/XMLUTF8Transcoder.cpp \ + xercesc/util/XMLWin1252Transcoder.cpp \ + xercesc/dom/DOMException.cpp xercesc/dom/DOMLSException.cpp \ + xercesc/dom/DOMRangeException.cpp \ + xercesc/dom/DOMXPathException.cpp \ + xercesc/dom/impl/DOMAttrImpl.cpp \ + xercesc/dom/impl/DOMAttrMapImpl.cpp \ + xercesc/dom/impl/DOMAttrNSImpl.cpp \ + xercesc/dom/impl/DOMCDATASectionImpl.cpp \ + xercesc/dom/impl/DOMCharacterDataImpl.cpp \ + xercesc/dom/impl/DOMChildNode.cpp \ + xercesc/dom/impl/DOMCommentImpl.cpp \ + xercesc/dom/impl/DOMConfigurationImpl.cpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.cpp \ + xercesc/dom/impl/DOMDocumentFragmentImpl.cpp \ + xercesc/dom/impl/DOMDocumentImpl.cpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.cpp \ + xercesc/dom/impl/DOMElementImpl.cpp \ + xercesc/dom/impl/DOMElementNSImpl.cpp \ + xercesc/dom/impl/DOMEntityImpl.cpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.cpp \ + xercesc/dom/impl/DOMErrorImpl.cpp \ + xercesc/dom/impl/DOMImplementationImpl.cpp \ + xercesc/dom/impl/DOMImplementationListImpl.cpp \ + xercesc/dom/impl/DOMImplementationRegistry.cpp \ + xercesc/dom/impl/DOMLocatorImpl.cpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.cpp \ + xercesc/dom/impl/DOMNodeIDMap.cpp \ + xercesc/dom/impl/DOMNodeImpl.cpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.cpp \ + xercesc/dom/impl/DOMNodeListImpl.cpp \ + xercesc/dom/impl/DOMNodeVector.cpp \ + xercesc/dom/impl/DOMNormalizer.cpp \ + xercesc/dom/impl/DOMNotationImpl.cpp \ + xercesc/dom/impl/DOMParentNode.cpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.cpp \ + xercesc/dom/impl/DOMRangeImpl.cpp \ + xercesc/dom/impl/DOMStringListImpl.cpp \ + xercesc/dom/impl/DOMStringPool.cpp \ + xercesc/dom/impl/DOMTextImpl.cpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.cpp \ + xercesc/dom/impl/DOMTypeInfoImpl.cpp \ + xercesc/dom/impl/DOMLSSerializerImpl.cpp \ + xercesc/dom/impl/DOMLSInputImpl.cpp \ + xercesc/dom/impl/DOMLSOutputImpl.cpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.cpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.cpp \ + xercesc/dom/impl/DOMXPathResultImpl.cpp \ + xercesc/dom/impl/XSDElementNSImpl.cpp \ + xercesc/framework/BinOutputStream.cpp \ + xercesc/framework/LocalFileFormatTarget.cpp \ + xercesc/framework/LocalFileInputSource.cpp \ + xercesc/framework/MemBufFormatTarget.cpp \ + xercesc/framework/MemBufInputSource.cpp \ + xercesc/framework/psvi/PSVIAttribute.cpp \ + xercesc/framework/psvi/PSVIAttributeList.cpp \ + xercesc/framework/psvi/PSVIElement.cpp \ + xercesc/framework/psvi/PSVIItem.cpp \ + xercesc/framework/psvi/XSAnnotation.cpp \ + xercesc/framework/psvi/XSAttributeDeclaration.cpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.cpp \ + xercesc/framework/psvi/XSAttributeUse.cpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.cpp \ + xercesc/framework/psvi/XSElementDeclaration.cpp \ + xercesc/framework/psvi/XSFacet.cpp \ + xercesc/framework/psvi/XSIDCDefinition.cpp \ + xercesc/framework/psvi/XSModel.cpp \ + xercesc/framework/psvi/XSModelGroup.cpp \ + xercesc/framework/psvi/XSModelGroupDefinition.cpp \ + xercesc/framework/psvi/XSMultiValueFacet.cpp \ + xercesc/framework/psvi/XSNamespaceItem.cpp \ + xercesc/framework/psvi/XSNotationDeclaration.cpp \ + xercesc/framework/psvi/XSObject.cpp \ + xercesc/framework/psvi/XSParticle.cpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.cpp \ + xercesc/framework/psvi/XSTypeDefinition.cpp \ + xercesc/framework/psvi/XSValue.cpp \ + xercesc/framework/psvi/XSWildcard.cpp \ + xercesc/framework/StdInInputSource.cpp \ + xercesc/framework/StdOutFormatTarget.cpp \ + xercesc/framework/URLInputSource.cpp \ + xercesc/framework/Wrapper4DOMLSInput.cpp \ + xercesc/framework/Wrapper4InputSource.cpp \ + xercesc/framework/XMLAttDef.cpp \ + xercesc/framework/XMLAttDefList.cpp \ + xercesc/framework/XMLAttr.cpp xercesc/framework/XMLBuffer.cpp \ + xercesc/framework/XMLBufferMgr.cpp \ + xercesc/framework/XMLContentModel.cpp \ + xercesc/framework/XMLDTDDescription.cpp \ + xercesc/framework/XMLElementDecl.cpp \ + xercesc/framework/XMLEntityDecl.cpp \ + xercesc/framework/XMLFormatter.cpp \ + xercesc/framework/XMLGrammarDescription.cpp \ + xercesc/framework/XMLGrammarPoolImpl.cpp \ + xercesc/framework/XMLNotationDecl.cpp \ + xercesc/framework/XMLRecognizer.cpp \ + xercesc/framework/XMLRefInfo.cpp \ + xercesc/framework/XMLSchemaDescription.cpp \ + xercesc/framework/XMLValidator.cpp \ + xercesc/internal/BinFileOutputStream.cpp \ + xercesc/internal/BinMemOutputStream.cpp \ + xercesc/internal/DGXMLScanner.cpp \ + xercesc/internal/ElemStack.cpp \ + xercesc/internal/IGXMLScanner.cpp \ + xercesc/internal/IGXMLScanner2.cpp \ + xercesc/internal/MemoryManagerImpl.cpp \ + xercesc/internal/ReaderMgr.cpp \ + xercesc/internal/SGXMLScanner.cpp \ + xercesc/internal/ValidationContextImpl.cpp \ + xercesc/internal/VecAttributesImpl.cpp \ + xercesc/internal/VecAttrListImpl.cpp \ + xercesc/internal/WFXMLScanner.cpp \ + xercesc/internal/XMLReader.cpp xercesc/internal/XMLScanner.cpp \ + xercesc/internal/XMLScannerResolver.cpp \ + xercesc/internal/XProtoType.cpp \ + xercesc/internal/XSAXMLScanner.cpp \ + xercesc/internal/XSerializeEngine.cpp \ + xercesc/internal/XSObjectFactory.cpp \ + xercesc/internal/XTemplateSerializer.cpp \ + xercesc/parsers/AbstractDOMParser.cpp \ + xercesc/parsers/DOMLSParserImpl.cpp \ + xercesc/parsers/SAX2XMLFilterImpl.cpp \ + xercesc/parsers/SAX2XMLReaderImpl.cpp \ + xercesc/parsers/SAXParser.cpp \ + xercesc/parsers/XercesDOMParser.cpp xercesc/sax/Dummy.cpp \ + xercesc/sax/InputSource.cpp xercesc/sax/SAXException.cpp \ + xercesc/sax/SAXParseException.cpp xercesc/sax2/sax2Dummy.cpp \ + xercesc/validators/common/AllContentModel.cpp \ + xercesc/validators/common/CMAny.cpp \ + xercesc/validators/common/CMBinaryOp.cpp \ + xercesc/validators/common/CMUnaryOp.cpp \ + xercesc/validators/common/ContentLeafNameTypeVector.cpp \ + xercesc/validators/common/ContentSpecNode.cpp \ + xercesc/validators/common/DFAContentModel.cpp \ + xercesc/validators/common/Grammar.cpp \ + xercesc/validators/common/GrammarResolver.cpp \ + xercesc/validators/common/MixedContentModel.cpp \ + xercesc/validators/common/SimpleContentModel.cpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.cpp \ + xercesc/validators/datatype/AbstractNumericValidator.cpp \ + xercesc/validators/datatype/AbstractStringValidator.cpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.cpp \ + xercesc/validators/datatype/DateDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeValidator.cpp \ + xercesc/validators/datatype/DayDatatypeValidator.cpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.cpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.cpp \ + xercesc/validators/datatype/DurationDatatypeValidator.cpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.cpp \ + xercesc/validators/datatype/FloatDatatypeValidator.cpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/IDDatatypeValidator.cpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.cpp \ + xercesc/validators/datatype/ListDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.cpp \ + xercesc/validators/datatype/NameDatatypeValidator.cpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.cpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp \ + xercesc/validators/datatype/QNameDatatypeValidator.cpp \ + xercesc/validators/datatype/StringDatatypeValidator.cpp \ + xercesc/validators/datatype/TimeDatatypeValidator.cpp \ + xercesc/validators/datatype/UnionDatatypeValidator.cpp \ + xercesc/validators/datatype/XMLCanRepGroup.cpp \ + xercesc/validators/datatype/YearDatatypeValidator.cpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.cpp \ + xercesc/validators/DTD/DTDAttDef.cpp \ + xercesc/validators/DTD/DTDAttDefList.cpp \ + xercesc/validators/DTD/DTDElementDecl.cpp \ + xercesc/validators/DTD/DTDEntityDecl.cpp \ + xercesc/validators/DTD/DTDGrammar.cpp \ + xercesc/validators/DTD/DTDScanner.cpp \ + xercesc/validators/DTD/DTDValidator.cpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp \ + xercesc/validators/schema/ComplexTypeInfo.cpp \ + xercesc/validators/schema/GeneralAttributeCheck.cpp \ + xercesc/validators/schema/identity/FieldActivator.cpp \ + xercesc/validators/schema/identity/FieldValueMap.cpp \ + xercesc/validators/schema/identity/IC_Field.cpp \ + xercesc/validators/schema/identity/IC_Key.cpp \ + xercesc/validators/schema/identity/IC_KeyRef.cpp \ + xercesc/validators/schema/identity/IC_Selector.cpp \ + xercesc/validators/schema/identity/IC_Unique.cpp \ + xercesc/validators/schema/identity/IdentityConstraint.cpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.cpp \ + xercesc/validators/schema/identity/ValueStore.cpp \ + xercesc/validators/schema/identity/ValueStoreCache.cpp \ + xercesc/validators/schema/identity/XercesXPath.cpp \ + xercesc/validators/schema/identity/XPathMatcher.cpp \ + xercesc/validators/schema/identity/XPathMatcherStack.cpp \ + xercesc/validators/schema/identity/XPathSymbols.cpp \ + xercesc/validators/schema/NamespaceScope.cpp \ + xercesc/validators/schema/SchemaAttDef.cpp \ + xercesc/validators/schema/SchemaAttDefList.cpp \ + xercesc/validators/schema/SchemaElementDecl.cpp \ + xercesc/validators/schema/SchemaGrammar.cpp \ + xercesc/validators/schema/SchemaInfo.cpp \ + xercesc/validators/schema/SchemaSymbols.cpp \ + xercesc/validators/schema/SchemaValidator.cpp \ + xercesc/validators/schema/SubstitutionGroupComparator.cpp \ + xercesc/validators/schema/TraverseSchema.cpp \ + xercesc/validators/schema/XercesAttGroupInfo.cpp \ + xercesc/validators/schema/XercesElementWildcard.cpp \ + xercesc/validators/schema/XercesGroupInfo.cpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp \ + xercesc/validators/schema/XSDDOMParser.cpp \ + xercesc/validators/schema/XSDErrorReporter.cpp \ + xercesc/validators/schema/XSDLocator.cpp \ + xercesc/validators/schema/XUtil.cpp \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp \ + xercesc/xinclude/XIncludeLocation.cpp \ + xercesc/xinclude/XIncludeUtils.cpp \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.cpp \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp \ + xercesc/util/Transcoders/ICU/ICUTransService.cpp \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp \ + xercesc/util/Transcoders/Iconv/IconvTransService.cpp \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp \ + xercesc/util/Transcoders/Win32/Win32TransService.cpp \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp \ + xercesc/util/MutexManagers/NoThreadMutexMgr.cpp \ + xercesc/util/MutexManagers/PosixMutexMgr.cpp \ + xercesc/util/MutexManagers/WindowsMutexMgr.cpp \ + xercesc/util/FileManagers/PosixFileMgr.cpp \ + xercesc/util/FileManagers/WindowsFileMgr.cpp +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = xercesc/util/Base64.lo \ + xercesc/util/BinFileInputStream.lo \ + xercesc/util/BinInputStream.lo \ + xercesc/util/BinMemInputStream.lo xercesc/util/BitSet.lo \ + xercesc/util/DefaultPanicHandler.lo \ + xercesc/util/EncodingValidator.lo xercesc/util/HeaderDummy.lo \ + xercesc/util/HexBin.lo xercesc/util/KVStringPair.lo \ + xercesc/util/Mutexes.lo xercesc/util/PanicHandler.lo \ + xercesc/util/PlatformUtils.lo xercesc/util/PSVIUni.lo \ + xercesc/util/QName.lo xercesc/util/regx/ASCIIRangeFactory.lo \ + xercesc/util/regx/BlockRangeFactory.lo \ + xercesc/util/regx/BMPattern.lo xercesc/util/regx/CharToken.lo \ + xercesc/util/regx/ClosureToken.lo \ + xercesc/util/regx/ConcatToken.lo xercesc/util/regx/Match.lo \ + xercesc/util/regx/Op.lo xercesc/util/regx/OpFactory.lo \ + xercesc/util/regx/ParenToken.lo \ + xercesc/util/regx/ParserForXMLSchema.lo \ + xercesc/util/regx/RangeFactory.lo \ + xercesc/util/regx/RangeToken.lo \ + xercesc/util/regx/RangeTokenMap.lo \ + xercesc/util/regx/RegularExpression.lo \ + xercesc/util/regx/RegxParser.lo xercesc/util/regx/RegxUtil.lo \ + xercesc/util/regx/StringToken.lo xercesc/util/regx/Token.lo \ + xercesc/util/regx/TokenFactory.lo \ + xercesc/util/regx/UnicodeRangeFactory.lo \ + xercesc/util/regx/UnionToken.lo \ + xercesc/util/regx/XMLRangeFactory.lo \ + xercesc/util/regx/XMLUniCharacter.lo \ + xercesc/util/StringPool.lo \ + xercesc/util/SynchronizedStringPool.lo \ + xercesc/util/TransService.lo xercesc/util/XMemory.lo \ + xercesc/util/XML256TableTranscoder.lo \ + xercesc/util/XML88591Transcoder.lo \ + xercesc/util/XMLAbstractDoubleFloat.lo \ + xercesc/util/XMLASCIITranscoder.lo \ + xercesc/util/XMLBigDecimal.lo xercesc/util/XMLBigInteger.lo \ + xercesc/util/XMLChar.lo xercesc/util/XMLChTranscoder.lo \ + xercesc/util/XMLDateTime.lo xercesc/util/XMLDouble.lo \ + xercesc/util/XMLEBCDICTranscoder.lo \ + xercesc/util/XMLException.lo xercesc/util/XMLFloat.lo \ + xercesc/util/XMLIBM1047Transcoder.lo \ + xercesc/util/XMLIBM1140Transcoder.lo \ + xercesc/util/XMLInitializer.lo xercesc/util/XMLMsgLoader.lo \ + xercesc/util/XMLNumber.lo xercesc/util/XMLString.lo \ + xercesc/util/XMLStringTokenizer.lo \ + xercesc/util/XMLUCS4Transcoder.lo xercesc/util/XMLUni.lo \ + xercesc/util/XMLUri.lo xercesc/util/XMLURL.lo \ + xercesc/util/XMLUTF16Transcoder.lo \ + xercesc/util/XMLUTF8Transcoder.lo \ + xercesc/util/XMLWin1252Transcoder.lo +am__objects_2 = xercesc/dom/DOMException.lo \ + xercesc/dom/DOMLSException.lo xercesc/dom/DOMRangeException.lo \ + xercesc/dom/DOMXPathException.lo +am__objects_3 = xercesc/dom/impl/DOMAttrImpl.lo \ + xercesc/dom/impl/DOMAttrMapImpl.lo \ + xercesc/dom/impl/DOMAttrNSImpl.lo \ + xercesc/dom/impl/DOMCDATASectionImpl.lo \ + xercesc/dom/impl/DOMCharacterDataImpl.lo \ + xercesc/dom/impl/DOMChildNode.lo \ + xercesc/dom/impl/DOMCommentImpl.lo \ + xercesc/dom/impl/DOMConfigurationImpl.lo \ + xercesc/dom/impl/DOMDeepNodeListImpl.lo \ + xercesc/dom/impl/DOMDocumentFragmentImpl.lo \ + xercesc/dom/impl/DOMDocumentImpl.lo \ + xercesc/dom/impl/DOMDocumentTypeImpl.lo \ + xercesc/dom/impl/DOMElementImpl.lo \ + xercesc/dom/impl/DOMElementNSImpl.lo \ + xercesc/dom/impl/DOMEntityImpl.lo \ + xercesc/dom/impl/DOMEntityReferenceImpl.lo \ + xercesc/dom/impl/DOMErrorImpl.lo \ + xercesc/dom/impl/DOMImplementationImpl.lo \ + xercesc/dom/impl/DOMImplementationListImpl.lo \ + xercesc/dom/impl/DOMImplementationRegistry.lo \ + xercesc/dom/impl/DOMLocatorImpl.lo \ + xercesc/dom/impl/DOMNamedNodeMapImpl.lo \ + xercesc/dom/impl/DOMNodeIDMap.lo \ + xercesc/dom/impl/DOMNodeImpl.lo \ + xercesc/dom/impl/DOMNodeIteratorImpl.lo \ + xercesc/dom/impl/DOMNodeListImpl.lo \ + xercesc/dom/impl/DOMNodeVector.lo \ + xercesc/dom/impl/DOMNormalizer.lo \ + xercesc/dom/impl/DOMNotationImpl.lo \ + xercesc/dom/impl/DOMParentNode.lo \ + xercesc/dom/impl/DOMProcessingInstructionImpl.lo \ + xercesc/dom/impl/DOMRangeImpl.lo \ + xercesc/dom/impl/DOMStringListImpl.lo \ + xercesc/dom/impl/DOMStringPool.lo \ + xercesc/dom/impl/DOMTextImpl.lo \ + xercesc/dom/impl/DOMTreeWalkerImpl.lo \ + xercesc/dom/impl/DOMTypeInfoImpl.lo \ + xercesc/dom/impl/DOMLSSerializerImpl.lo \ + xercesc/dom/impl/DOMLSInputImpl.lo \ + xercesc/dom/impl/DOMLSOutputImpl.lo \ + xercesc/dom/impl/DOMXPathExpressionImpl.lo \ + xercesc/dom/impl/DOMXPathNSResolverImpl.lo \ + xercesc/dom/impl/DOMXPathResultImpl.lo \ + xercesc/dom/impl/XSDElementNSImpl.lo +am__objects_4 = xercesc/framework/BinOutputStream.lo \ + xercesc/framework/LocalFileFormatTarget.lo \ + xercesc/framework/LocalFileInputSource.lo \ + xercesc/framework/MemBufFormatTarget.lo \ + xercesc/framework/MemBufInputSource.lo \ + xercesc/framework/psvi/PSVIAttribute.lo \ + xercesc/framework/psvi/PSVIAttributeList.lo \ + xercesc/framework/psvi/PSVIElement.lo \ + xercesc/framework/psvi/PSVIItem.lo \ + xercesc/framework/psvi/XSAnnotation.lo \ + xercesc/framework/psvi/XSAttributeDeclaration.lo \ + xercesc/framework/psvi/XSAttributeGroupDefinition.lo \ + xercesc/framework/psvi/XSAttributeUse.lo \ + xercesc/framework/psvi/XSComplexTypeDefinition.lo \ + xercesc/framework/psvi/XSElementDeclaration.lo \ + xercesc/framework/psvi/XSFacet.lo \ + xercesc/framework/psvi/XSIDCDefinition.lo \ + xercesc/framework/psvi/XSModel.lo \ + xercesc/framework/psvi/XSModelGroup.lo \ + xercesc/framework/psvi/XSModelGroupDefinition.lo \ + xercesc/framework/psvi/XSMultiValueFacet.lo \ + xercesc/framework/psvi/XSNamespaceItem.lo \ + xercesc/framework/psvi/XSNotationDeclaration.lo \ + xercesc/framework/psvi/XSObject.lo \ + xercesc/framework/psvi/XSParticle.lo \ + xercesc/framework/psvi/XSSimpleTypeDefinition.lo \ + xercesc/framework/psvi/XSTypeDefinition.lo \ + xercesc/framework/psvi/XSValue.lo \ + xercesc/framework/psvi/XSWildcard.lo \ + xercesc/framework/StdInInputSource.lo \ + xercesc/framework/StdOutFormatTarget.lo \ + xercesc/framework/URLInputSource.lo \ + xercesc/framework/Wrapper4DOMLSInput.lo \ + xercesc/framework/Wrapper4InputSource.lo \ + xercesc/framework/XMLAttDef.lo \ + xercesc/framework/XMLAttDefList.lo \ + xercesc/framework/XMLAttr.lo xercesc/framework/XMLBuffer.lo \ + xercesc/framework/XMLBufferMgr.lo \ + xercesc/framework/XMLContentModel.lo \ + xercesc/framework/XMLDTDDescription.lo \ + xercesc/framework/XMLElementDecl.lo \ + xercesc/framework/XMLEntityDecl.lo \ + xercesc/framework/XMLFormatter.lo \ + xercesc/framework/XMLGrammarDescription.lo \ + xercesc/framework/XMLGrammarPoolImpl.lo \ + xercesc/framework/XMLNotationDecl.lo \ + xercesc/framework/XMLRecognizer.lo \ + xercesc/framework/XMLRefInfo.lo \ + xercesc/framework/XMLSchemaDescription.lo \ + xercesc/framework/XMLValidator.lo +am__objects_5 = xercesc/internal/BinFileOutputStream.lo \ + xercesc/internal/BinMemOutputStream.lo \ + xercesc/internal/DGXMLScanner.lo xercesc/internal/ElemStack.lo \ + xercesc/internal/IGXMLScanner.lo \ + xercesc/internal/IGXMLScanner2.lo \ + xercesc/internal/MemoryManagerImpl.lo \ + xercesc/internal/ReaderMgr.lo xercesc/internal/SGXMLScanner.lo \ + xercesc/internal/ValidationContextImpl.lo \ + xercesc/internal/VecAttributesImpl.lo \ + xercesc/internal/VecAttrListImpl.lo \ + xercesc/internal/WFXMLScanner.lo xercesc/internal/XMLReader.lo \ + xercesc/internal/XMLScanner.lo \ + xercesc/internal/XMLScannerResolver.lo \ + xercesc/internal/XProtoType.lo \ + xercesc/internal/XSAXMLScanner.lo \ + xercesc/internal/XSerializeEngine.lo \ + xercesc/internal/XSObjectFactory.lo \ + xercesc/internal/XTemplateSerializer.lo +am__objects_6 = xercesc/parsers/AbstractDOMParser.lo \ + xercesc/parsers/DOMLSParserImpl.lo \ + xercesc/parsers/SAX2XMLFilterImpl.lo \ + xercesc/parsers/SAX2XMLReaderImpl.lo \ + xercesc/parsers/SAXParser.lo \ + xercesc/parsers/XercesDOMParser.lo +am__objects_7 = xercesc/sax/Dummy.lo xercesc/sax/InputSource.lo \ + xercesc/sax/SAXException.lo xercesc/sax/SAXParseException.lo +am__objects_8 = xercesc/sax2/sax2Dummy.lo +am__objects_9 = xercesc/validators/common/AllContentModel.lo \ + xercesc/validators/common/CMAny.lo \ + xercesc/validators/common/CMBinaryOp.lo \ + xercesc/validators/common/CMUnaryOp.lo \ + xercesc/validators/common/ContentLeafNameTypeVector.lo \ + xercesc/validators/common/ContentSpecNode.lo \ + xercesc/validators/common/DFAContentModel.lo \ + xercesc/validators/common/Grammar.lo \ + xercesc/validators/common/GrammarResolver.lo \ + xercesc/validators/common/MixedContentModel.lo \ + xercesc/validators/common/SimpleContentModel.lo \ + xercesc/validators/datatype/AbstractNumericFacetValidator.lo \ + xercesc/validators/datatype/AbstractNumericValidator.lo \ + xercesc/validators/datatype/AbstractStringValidator.lo \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo \ + xercesc/validators/datatype/AnyURIDatatypeValidator.lo \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo \ + xercesc/validators/datatype/BooleanDatatypeValidator.lo \ + xercesc/validators/datatype/DatatypeValidator.lo \ + xercesc/validators/datatype/DatatypeValidatorFactory.lo \ + xercesc/validators/datatype/DateDatatypeValidator.lo \ + xercesc/validators/datatype/DateTimeDatatypeValidator.lo \ + xercesc/validators/datatype/DateTimeValidator.lo \ + xercesc/validators/datatype/DayDatatypeValidator.lo \ + xercesc/validators/datatype/DecimalDatatypeValidator.lo \ + xercesc/validators/datatype/DoubleDatatypeValidator.lo \ + xercesc/validators/datatype/DurationDatatypeValidator.lo \ + xercesc/validators/datatype/ENTITYDatatypeValidator.lo \ + xercesc/validators/datatype/FloatDatatypeValidator.lo \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.lo \ + xercesc/validators/datatype/IDDatatypeValidator.lo \ + xercesc/validators/datatype/IDREFDatatypeValidator.lo \ + xercesc/validators/datatype/ListDatatypeValidator.lo \ + xercesc/validators/datatype/MonthDatatypeValidator.lo \ + xercesc/validators/datatype/MonthDayDatatypeValidator.lo \ + xercesc/validators/datatype/NameDatatypeValidator.lo \ + xercesc/validators/datatype/NCNameDatatypeValidator.lo \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.lo \ + xercesc/validators/datatype/QNameDatatypeValidator.lo \ + xercesc/validators/datatype/StringDatatypeValidator.lo \ + xercesc/validators/datatype/TimeDatatypeValidator.lo \ + xercesc/validators/datatype/UnionDatatypeValidator.lo \ + xercesc/validators/datatype/XMLCanRepGroup.lo \ + xercesc/validators/datatype/YearDatatypeValidator.lo \ + xercesc/validators/datatype/YearMonthDatatypeValidator.lo \ + xercesc/validators/DTD/DTDAttDef.lo \ + xercesc/validators/DTD/DTDAttDefList.lo \ + xercesc/validators/DTD/DTDElementDecl.lo \ + xercesc/validators/DTD/DTDEntityDecl.lo \ + xercesc/validators/DTD/DTDGrammar.lo \ + xercesc/validators/DTD/DTDScanner.lo \ + xercesc/validators/DTD/DTDValidator.lo \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.lo \ + xercesc/validators/schema/ComplexTypeInfo.lo \ + xercesc/validators/schema/GeneralAttributeCheck.lo \ + xercesc/validators/schema/identity/FieldActivator.lo \ + xercesc/validators/schema/identity/FieldValueMap.lo \ + xercesc/validators/schema/identity/IC_Field.lo \ + xercesc/validators/schema/identity/IC_Key.lo \ + xercesc/validators/schema/identity/IC_KeyRef.lo \ + xercesc/validators/schema/identity/IC_Selector.lo \ + xercesc/validators/schema/identity/IC_Unique.lo \ + xercesc/validators/schema/identity/IdentityConstraint.lo \ + xercesc/validators/schema/identity/IdentityConstraintHandler.lo \ + xercesc/validators/schema/identity/ValueStore.lo \ + xercesc/validators/schema/identity/ValueStoreCache.lo \ + xercesc/validators/schema/identity/XercesXPath.lo \ + xercesc/validators/schema/identity/XPathMatcher.lo \ + xercesc/validators/schema/identity/XPathMatcherStack.lo \ + xercesc/validators/schema/identity/XPathSymbols.lo \ + xercesc/validators/schema/NamespaceScope.lo \ + xercesc/validators/schema/SchemaAttDef.lo \ + xercesc/validators/schema/SchemaAttDefList.lo \ + xercesc/validators/schema/SchemaElementDecl.lo \ + xercesc/validators/schema/SchemaGrammar.lo \ + xercesc/validators/schema/SchemaInfo.lo \ + xercesc/validators/schema/SchemaSymbols.lo \ + xercesc/validators/schema/SchemaValidator.lo \ + xercesc/validators/schema/SubstitutionGroupComparator.lo \ + xercesc/validators/schema/TraverseSchema.lo \ + xercesc/validators/schema/XercesAttGroupInfo.lo \ + xercesc/validators/schema/XercesElementWildcard.lo \ + xercesc/validators/schema/XercesGroupInfo.lo \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.lo \ + xercesc/validators/schema/XSDDOMParser.lo \ + xercesc/validators/schema/XSDErrorReporter.lo \ + xercesc/validators/schema/XSDLocator.lo \ + xercesc/validators/schema/XUtil.lo +am__objects_10 = xercesc/xinclude/XIncludeDOMDocumentProcessor.lo \ + xercesc/xinclude/XIncludeLocation.lo \ + xercesc/xinclude/XIncludeUtils.lo +am__objects_11 = xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo +@XERCES_USE_NETACCESSOR_CURL_TRUE@am__objects_12 = $(am__objects_11) +am__objects_13 = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo +@XERCES_USE_NETACCESSOR_SOCKET_TRUE@am__objects_14 = \ +@XERCES_USE_NETACCESSOR_SOCKET_TRUE@ $(am__objects_13) +am__objects_15 = xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo +@XERCES_USE_NETACCESSOR_CFURL_TRUE@am__objects_16 = $(am__objects_15) +am__objects_17 = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo +@XERCES_USE_NETACCESSOR_WINSOCK_TRUE@am__objects_18 = \ +@XERCES_USE_NETACCESSOR_WINSOCK_TRUE@ $(am__objects_17) +am__objects_19 = xercesc/util/Transcoders/ICU/ICUTransService.lo +@XERCES_USE_TRANSCODER_ICU_TRUE@am__objects_20 = $(am__objects_19) +am__objects_21 = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo +@XERCES_USE_TRANSCODER_GNUICONV_TRUE@am__objects_22 = \ +@XERCES_USE_TRANSCODER_GNUICONV_TRUE@ $(am__objects_21) +am__objects_23 = xercesc/util/Transcoders/Iconv/IconvTransService.lo +@XERCES_USE_TRANSCODER_ICONV_TRUE@am__objects_24 = $(am__objects_23) +am__objects_25 = xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo +@XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER_TRUE@am__objects_26 = $(am__objects_25) +am__objects_27 = xercesc/util/Transcoders/Win32/Win32TransService.lo +@XERCES_USE_TRANSCODER_WINDOWS_TRUE@am__objects_28 = \ +@XERCES_USE_TRANSCODER_WINDOWS_TRUE@ $(am__objects_27) +am__objects_29 = xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo +@XERCES_USE_MSGLOADER_INMEMORY_TRUE@am__objects_30 = \ +@XERCES_USE_MSGLOADER_INMEMORY_TRUE@ $(am__objects_29) +am__objects_31 = xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo +@XERCES_USE_MSGLOADER_ICU_TRUE@am__objects_32 = $(am__objects_31) +am__objects_33 = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo +@XERCES_USE_MSGLOADER_ICONV_TRUE@am__objects_34 = $(am__objects_33) +am__objects_35 = xercesc/util/MutexManagers/NoThreadMutexMgr.lo +@XERCES_USE_MUTEXMGR_NOTHREAD_TRUE@am__objects_36 = $(am__objects_35) +am__objects_37 = xercesc/util/MutexManagers/PosixMutexMgr.lo +@XERCES_USE_MUTEXMGR_POSIX_TRUE@am__objects_38 = $(am__objects_37) +am__objects_39 = xercesc/util/MutexManagers/WindowsMutexMgr.lo +@XERCES_USE_MUTEXMGR_WINDOWS_TRUE@am__objects_40 = $(am__objects_39) +am__objects_41 = xercesc/util/FileManagers/PosixFileMgr.lo +@XERCES_USE_FILEMGR_POSIX_TRUE@am__objects_42 = $(am__objects_41) +am__objects_43 = xercesc/util/FileManagers/WindowsFileMgr.lo +@XERCES_USE_FILEMGR_WINDOWS_TRUE@am__objects_44 = $(am__objects_43) +am_libxerces_c_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) \ + $(am__objects_6) $(am__objects_7) $(am__objects_8) \ + $(am__objects_9) $(am__objects_10) $(am__objects_12) \ + $(am__objects_14) $(am__objects_16) $(am__objects_18) \ + $(am__objects_20) $(am__objects_22) $(am__objects_24) \ + $(am__objects_26) $(am__objects_28) $(am__objects_30) \ + $(am__objects_32) $(am__objects_34) $(am__objects_36) \ + $(am__objects_38) $(am__objects_40) $(am__objects_42) \ + $(am__objects_44) +am__objects_45 = xercesc_messages.lo root_res.lo +@XERCES_USE_MSGLOADER_ICU_TRUE@nodist_libxerces_c_la_OBJECTS = \ +@XERCES_USE_MSGLOADER_ICU_TRUE@ $(am__objects_45) +libxerces_c_la_OBJECTS = $(am_libxerces_c_la_OBJECTS) \ + $(nodist_libxerces_c_la_OBJECTS) +libxerces_c_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libxerces_c_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/src/xercesc/util +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxerces_c_la_SOURCES) $(nodist_libxerces_c_la_SOURCES) +DIST_SOURCES = $(am__libxerces_c_la_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__nobase_libxerces_c_la_HEADERS_DIST = \ + xercesc/util/ArrayIndexOutOfBoundsException.hpp \ + xercesc/util/Base64.hpp xercesc/util/BaseRefVectorOf.hpp \ + xercesc/util/BaseRefVectorOf.c \ + xercesc/util/BinFileInputStream.hpp \ + xercesc/util/BinInputStream.hpp \ + xercesc/util/BinMemInputStream.hpp xercesc/util/BitOps.hpp \ + xercesc/util/BitSet.hpp xercesc/util/CountedPointer.hpp \ + xercesc/util/CountedPointer.c \ + xercesc/util/DefaultPanicHandler.hpp \ + xercesc/util/EmptyStackException.hpp \ + xercesc/util/EncodingValidator.hpp \ + xercesc/util/FlagJanitor.hpp xercesc/util/FlagJanitor.c \ + xercesc/util/Hashers.hpp xercesc/util/Hash2KeysSetOf.hpp \ + xercesc/util/Hash2KeysSetOf.c xercesc/util/HexBin.hpp \ + xercesc/util/IllegalArgumentException.hpp \ + xercesc/util/InvalidCastException.hpp \ + xercesc/util/IOException.hpp xercesc/util/Janitor.hpp \ + xercesc/util/Janitor.c xercesc/util/KeyRefPair.hpp \ + xercesc/util/KeyRefPair.c xercesc/util/KeyValuePair.hpp \ + xercesc/util/KeyValuePair.c xercesc/util/KVStringPair.hpp \ + xercesc/util/Mutexes.hpp xercesc/util/LogicalPath.c \ + xercesc/util/NameIdPool.hpp xercesc/util/NameIdPool.c \ + xercesc/util/NoSuchElementException.hpp \ + xercesc/util/NullPointerException.hpp \ + xercesc/util/NumberFormatException.hpp \ + xercesc/util/OutOfMemoryException.hpp \ + xercesc/util/PanicHandler.hpp xercesc/util/ParseException.hpp \ + xercesc/util/PlatformUtils.hpp xercesc/util/PSVIUni.hpp \ + xercesc/util/QName.hpp xercesc/util/RefArrayOf.hpp \ + xercesc/util/RefArrayOf.c xercesc/util/RefArrayVectorOf.hpp \ + xercesc/util/RefArrayVectorOf.c \ + xercesc/util/RefHash2KeysTableOf.hpp \ + xercesc/util/RefHash2KeysTableOf.c \ + xercesc/util/RefHash3KeysIdPool.hpp \ + xercesc/util/RefHash3KeysIdPool.c \ + xercesc/util/RefHashTableOf.hpp xercesc/util/RefHashTableOf.c \ + xercesc/util/RefStackOf.hpp xercesc/util/RefStackOf.c \ + xercesc/util/RefVectorOf.hpp xercesc/util/RefVectorOf.c \ + xercesc/util/regx/ASCIIRangeFactory.hpp \ + xercesc/util/regx/BlockRangeFactory.hpp \ + xercesc/util/regx/BMPattern.hpp \ + xercesc/util/regx/CharToken.hpp \ + xercesc/util/regx/ClosureToken.hpp \ + xercesc/util/regx/ConcatToken.hpp xercesc/util/regx/Match.hpp \ + xercesc/util/regx/Op.hpp xercesc/util/regx/OpFactory.hpp \ + xercesc/util/regx/ParenToken.hpp \ + xercesc/util/regx/ParserForXMLSchema.hpp \ + xercesc/util/regx/RangeFactory.hpp \ + xercesc/util/regx/RangeToken.hpp \ + xercesc/util/regx/RangeTokenMap.hpp \ + xercesc/util/regx/RegularExpression.hpp \ + xercesc/util/regx/RegxDefs.hpp \ + xercesc/util/regx/RegxParser.hpp \ + xercesc/util/regx/RegxUtil.hpp \ + xercesc/util/regx/StringToken.hpp xercesc/util/regx/Token.hpp \ + xercesc/util/regx/TokenFactory.hpp \ + xercesc/util/regx/TokenInc.hpp \ + xercesc/util/regx/UniCharTable.hpp \ + xercesc/util/regx/UnicodeRangeFactory.hpp \ + xercesc/util/regx/UnionToken.hpp \ + xercesc/util/regx/XMLRangeFactory.hpp \ + xercesc/util/regx/XMLUniCharacter.hpp \ + xercesc/util/RuntimeException.hpp \ + xercesc/util/SchemaDateTimeException.hpp \ + xercesc/util/SecurityManager.hpp xercesc/util/StringPool.hpp \ + xercesc/util/SynchronizedStringPool.hpp \ + xercesc/util/TranscodingException.hpp \ + xercesc/util/TransENameMap.hpp xercesc/util/TransENameMap.c \ + xercesc/util/TransService.hpp \ + xercesc/util/UnexpectedEOFException.hpp \ + xercesc/util/UnsupportedEncodingException.hpp \ + xercesc/util/UTFDataFormatException.hpp \ + xercesc/util/ValueArrayOf.hpp xercesc/util/ValueArrayOf.c \ + xercesc/util/ValueHashTableOf.hpp \ + xercesc/util/ValueHashTableOf.c xercesc/util/ValueStackOf.hpp \ + xercesc/util/ValueStackOf.c xercesc/util/ValueVectorOf.hpp \ + xercesc/util/ValueVectorOf.c xercesc/util/XercesDefs.hpp \ + xercesc/util/XercesVersion.hpp xercesc/util/XMemory.hpp \ + xercesc/util/XML256TableTranscoder.hpp \ + xercesc/util/XML88591Transcoder.hpp \ + xercesc/util/XMLAbstractDoubleFloat.hpp \ + xercesc/util/XMLASCIITranscoder.hpp \ + xercesc/util/XMLBigDecimal.hpp xercesc/util/XMLBigInteger.hpp \ + xercesc/util/XMLChar.hpp xercesc/util/XMLChTranscoder.hpp \ + xercesc/util/XMLDateTime.hpp xercesc/util/XMLDOMMsg.hpp \ + xercesc/util/XMLDouble.hpp \ + xercesc/util/XMLEBCDICTranscoder.hpp \ + xercesc/util/XMLEntityResolver.hpp \ + xercesc/util/XMLEnumerator.hpp xercesc/util/XMLException.hpp \ + xercesc/util/XMLExceptMsgs.hpp xercesc/util/XMLFileMgr.hpp \ + xercesc/util/XMLFloat.hpp \ + xercesc/util/XMLIBM1047Transcoder.hpp \ + xercesc/util/XMLIBM1140Transcoder.hpp \ + xercesc/util/XMLInitializer.hpp xercesc/util/XMLInteger.hpp \ + xercesc/util/XMLMutexMgr.hpp xercesc/util/XMLMsgLoader.hpp \ + xercesc/util/XMLNetAccessor.hpp xercesc/util/XMLNumber.hpp \ + xercesc/util/XMLResourceIdentifier.hpp \ + xercesc/util/XMLString.hpp xercesc/util/XMLStringTokenizer.hpp \ + xercesc/util/XMLUCS4Transcoder.hpp xercesc/util/XMLUni.hpp \ + xercesc/util/XMLUniDefs.hpp xercesc/util/XMLUri.hpp \ + xercesc/util/XMLURL.hpp xercesc/util/XMLUTF16Transcoder.hpp \ + xercesc/util/XMLUTF8Transcoder.hpp \ + xercesc/util/XMLWin1252Transcoder.hpp xercesc/dom/DOM.hpp \ + xercesc/dom/DOMAttr.hpp xercesc/dom/DOMCDATASection.hpp \ + xercesc/dom/DOMCharacterData.hpp xercesc/dom/DOMComment.hpp \ + xercesc/dom/DOMConfiguration.hpp xercesc/dom/DOMDocument.hpp \ + xercesc/dom/DOMDocumentFragment.hpp \ + xercesc/dom/DOMDocumentRange.hpp \ + xercesc/dom/DOMDocumentTraversal.hpp \ + xercesc/dom/DOMDocumentType.hpp xercesc/dom/DOMElement.hpp \ + xercesc/dom/DOMEntity.hpp xercesc/dom/DOMEntityReference.hpp \ + xercesc/dom/DOMError.hpp xercesc/dom/DOMErrorHandler.hpp \ + xercesc/dom/DOMException.hpp xercesc/dom/DOMImplementation.hpp \ + xercesc/dom/DOMImplementationList.hpp \ + xercesc/dom/DOMImplementationLS.hpp \ + xercesc/dom/DOMImplementationRegistry.hpp \ + xercesc/dom/DOMImplementationSource.hpp \ + xercesc/dom/DOMLocator.hpp xercesc/dom/DOMLSException.hpp \ + xercesc/dom/DOMLSInput.hpp xercesc/dom/DOMLSOutput.hpp \ + xercesc/dom/DOMLSParser.hpp xercesc/dom/DOMLSParserFilter.hpp \ + xercesc/dom/DOMLSResourceResolver.hpp \ + xercesc/dom/DOMLSSerializer.hpp \ + xercesc/dom/DOMLSSerializerFilter.hpp \ + xercesc/dom/DOMMemoryManager.hpp \ + xercesc/dom/DOMNamedNodeMap.hpp xercesc/dom/DOMNode.hpp \ + xercesc/dom/DOMNodeFilter.hpp xercesc/dom/DOMNodeIterator.hpp \ + xercesc/dom/DOMNodeList.hpp xercesc/dom/DOMNotation.hpp \ + xercesc/dom/DOMProcessingInstruction.hpp \ + xercesc/dom/DOMPSVITypeInfo.hpp xercesc/dom/DOMRange.hpp \ + xercesc/dom/DOMRangeException.hpp \ + xercesc/dom/DOMStringList.hpp xercesc/dom/DOMText.hpp \ + xercesc/dom/DOMTreeWalker.hpp xercesc/dom/DOMTypeInfo.hpp \ + xercesc/dom/DOMUserDataHandler.hpp \ + xercesc/dom/DOMXPathEvaluator.hpp \ + xercesc/dom/DOMXPathException.hpp \ + xercesc/dom/DOMXPathExpression.hpp \ + xercesc/dom/DOMXPathNamespace.hpp \ + xercesc/dom/DOMXPathNSResolver.hpp \ + xercesc/dom/DOMXPathResult.hpp xercesc/dom/StDOMNode.hpp \ + xercesc/dom/impl/DOMAttrImpl.hpp \ + xercesc/dom/impl/DOMAttrMapImpl.hpp \ + xercesc/dom/impl/DOMAttrNSImpl.hpp \ + xercesc/dom/impl/DOMCasts.hpp \ + xercesc/dom/impl/DOMCDATASectionImpl.hpp \ + xercesc/dom/impl/DOMCharacterDataImpl.hpp \ + xercesc/dom/impl/DOMChildNode.hpp \ + xercesc/dom/impl/DOMCommentImpl.hpp \ + xercesc/dom/impl/DOMConfigurationImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.c \ + xercesc/dom/impl/DOMDocumentFragmentImpl.hpp \ + xercesc/dom/impl/DOMDocumentImpl.hpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.hpp \ + xercesc/dom/impl/DOMElementImpl.hpp \ + xercesc/dom/impl/DOMElementNSImpl.hpp \ + xercesc/dom/impl/DOMEntityImpl.hpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.hpp \ + xercesc/dom/impl/DOMErrorImpl.hpp \ + xercesc/dom/impl/DOMImplementationImpl.hpp \ + xercesc/dom/impl/DOMImplementationListImpl.hpp \ + xercesc/dom/impl/DOMLocatorImpl.hpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.hpp \ + xercesc/dom/impl/DOMNodeIDMap.hpp \ + xercesc/dom/impl/DOMNodeImpl.hpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.hpp \ + xercesc/dom/impl/DOMNodeListImpl.hpp \ + xercesc/dom/impl/DOMNodeVector.hpp \ + xercesc/dom/impl/DOMNormalizer.hpp \ + xercesc/dom/impl/DOMNotationImpl.hpp \ + xercesc/dom/impl/DOMParentNode.hpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.hpp \ + xercesc/dom/impl/DOMRangeImpl.hpp \ + xercesc/dom/impl/DOMStringListImpl.hpp \ + xercesc/dom/impl/DOMStringPool.hpp \ + xercesc/dom/impl/DOMTextImpl.hpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.hpp \ + xercesc/dom/impl/DOMTypeInfoImpl.hpp \ + xercesc/dom/impl/DOMLSSerializerImpl.hpp \ + xercesc/dom/impl/DOMLSInputImpl.hpp \ + xercesc/dom/impl/DOMLSOutputImpl.hpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.hpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.hpp \ + xercesc/dom/impl/DOMXPathResultImpl.hpp \ + xercesc/dom/impl/XSDElementNSImpl.hpp \ + xercesc/framework/BinOutputStream.hpp \ + xercesc/framework/LocalFileFormatTarget.hpp \ + xercesc/framework/LocalFileInputSource.hpp \ + xercesc/framework/MemBufFormatTarget.hpp \ + xercesc/framework/MemBufInputSource.hpp \ + xercesc/framework/MemoryManager.hpp \ + xercesc/framework/psvi/PSVIAttribute.hpp \ + xercesc/framework/psvi/PSVIAttributeList.hpp \ + xercesc/framework/psvi/PSVIElement.hpp \ + xercesc/framework/psvi/PSVIHandler.hpp \ + xercesc/framework/psvi/PSVIItem.hpp \ + xercesc/framework/psvi/XSAnnotation.hpp \ + xercesc/framework/psvi/XSAttributeDeclaration.hpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.hpp \ + xercesc/framework/psvi/XSAttributeUse.hpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.hpp \ + xercesc/framework/psvi/XSConstants.hpp \ + xercesc/framework/psvi/XSElementDeclaration.hpp \ + xercesc/framework/psvi/XSFacet.hpp \ + xercesc/framework/psvi/XSIDCDefinition.hpp \ + xercesc/framework/psvi/XSModel.hpp \ + xercesc/framework/psvi/XSModelGroup.hpp \ + xercesc/framework/psvi/XSModelGroupDefinition.hpp \ + xercesc/framework/psvi/XSMultiValueFacet.hpp \ + xercesc/framework/psvi/XSNamedMap.hpp \ + xercesc/framework/psvi/XSNamedMap.c \ + xercesc/framework/psvi/XSNamespaceItem.hpp \ + xercesc/framework/psvi/XSNotationDeclaration.hpp \ + xercesc/framework/psvi/XSObject.hpp \ + xercesc/framework/psvi/XSParticle.hpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.hpp \ + xercesc/framework/psvi/XSTypeDefinition.hpp \ + xercesc/framework/psvi/XSValue.hpp \ + xercesc/framework/psvi/XSWildcard.hpp \ + xercesc/framework/StdInInputSource.hpp \ + xercesc/framework/StdOutFormatTarget.hpp \ + xercesc/framework/URLInputSource.hpp \ + xercesc/framework/ValidationContext.hpp \ + xercesc/framework/Wrapper4DOMLSInput.hpp \ + xercesc/framework/Wrapper4InputSource.hpp \ + xercesc/framework/XMLAttDef.hpp \ + xercesc/framework/XMLAttDefList.hpp \ + xercesc/framework/XMLAttr.hpp xercesc/framework/XMLBuffer.hpp \ + xercesc/framework/XMLBufferMgr.hpp \ + xercesc/framework/XMLContentModel.hpp \ + xercesc/framework/XMLDocumentHandler.hpp \ + xercesc/framework/XMLDTDDescription.hpp \ + xercesc/framework/XMLElementDecl.hpp \ + xercesc/framework/XMLEntityDecl.hpp \ + xercesc/framework/XMLEntityHandler.hpp \ + xercesc/framework/XMLErrorCodes.hpp \ + xercesc/framework/XMLErrorReporter.hpp \ + xercesc/framework/XMLFormatter.hpp \ + xercesc/framework/XMLGrammarDescription.hpp \ + xercesc/framework/XMLGrammarPool.hpp \ + xercesc/framework/XMLGrammarPoolImpl.hpp \ + xercesc/framework/XMLNotationDecl.hpp \ + xercesc/framework/XMLPScanToken.hpp \ + xercesc/framework/XMLRecognizer.hpp \ + xercesc/framework/XMLRefInfo.hpp \ + xercesc/framework/XMLSchemaDescription.hpp \ + xercesc/framework/XMLValidator.hpp \ + xercesc/framework/XMLValidityCodes.hpp \ + xercesc/internal/BinFileOutputStream.hpp \ + xercesc/internal/BinMemOutputStream.hpp \ + xercesc/internal/CharTypeTables.hpp \ + xercesc/internal/DGXMLScanner.hpp \ + xercesc/internal/ElemStack.hpp \ + xercesc/internal/EndOfEntityException.hpp \ + xercesc/internal/IANAEncodings.hpp \ + xercesc/internal/IGXMLScanner.hpp \ + xercesc/internal/MemoryManagerImpl.hpp \ + xercesc/internal/ReaderMgr.hpp \ + xercesc/internal/SGXMLScanner.hpp \ + xercesc/internal/ValidationContextImpl.hpp \ + xercesc/internal/VecAttributesImpl.hpp \ + xercesc/internal/VecAttrListImpl.hpp \ + xercesc/internal/WFXMLScanner.hpp \ + xercesc/internal/XMLInternalErrorHandler.hpp \ + xercesc/internal/XMLReader.hpp xercesc/internal/XMLScanner.hpp \ + xercesc/internal/XMLScannerResolver.hpp \ + xercesc/internal/XProtoType.hpp \ + xercesc/internal/XSAXMLScanner.hpp \ + xercesc/internal/XSerializable.hpp \ + xercesc/internal/XSerializationException.hpp \ + xercesc/internal/XSerializeEngine.hpp \ + xercesc/internal/XSObjectFactory.hpp \ + xercesc/internal/XTemplateSerializer.hpp \ + xercesc/parsers/AbstractDOMParser.hpp \ + xercesc/parsers/DOMLSParserImpl.hpp \ + xercesc/parsers/SAX2XMLFilterImpl.hpp \ + xercesc/parsers/SAX2XMLReaderImpl.hpp \ + xercesc/parsers/SAXParser.hpp \ + xercesc/parsers/XercesDOMParser.hpp \ + xercesc/sax/AttributeList.hpp xercesc/sax/DocumentHandler.hpp \ + xercesc/sax/DTDHandler.hpp xercesc/sax/EntityResolver.hpp \ + xercesc/sax/ErrorHandler.hpp xercesc/sax/HandlerBase.hpp \ + xercesc/sax/InputSource.hpp xercesc/sax/Locator.hpp \ + xercesc/sax/Parser.hpp xercesc/sax/SAXException.hpp \ + xercesc/sax/SAXParseException.hpp xercesc/sax2/Attributes.hpp \ + xercesc/sax2/ContentHandler.hpp xercesc/sax2/DeclHandler.hpp \ + xercesc/sax2/DefaultHandler.hpp \ + xercesc/sax2/LexicalHandler.hpp xercesc/sax2/SAX2XMLFilter.hpp \ + xercesc/sax2/SAX2XMLReader.hpp \ + xercesc/sax2/XMLReaderFactory.hpp \ + xercesc/validators/common/AllContentModel.hpp \ + xercesc/validators/common/CMAny.hpp \ + xercesc/validators/common/CMBinaryOp.hpp \ + xercesc/validators/common/CMLeaf.hpp \ + xercesc/validators/common/CMRepeatingLeaf.hpp \ + xercesc/validators/common/CMNode.hpp \ + xercesc/validators/common/CMStateSet.hpp \ + xercesc/validators/common/CMUnaryOp.hpp \ + xercesc/validators/common/ContentLeafNameTypeVector.hpp \ + xercesc/validators/common/ContentSpecNode.hpp \ + xercesc/validators/common/DFAContentModel.hpp \ + xercesc/validators/common/Grammar.hpp \ + xercesc/validators/common/GrammarResolver.hpp \ + xercesc/validators/common/MixedContentModel.hpp \ + xercesc/validators/common/SimpleContentModel.hpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.hpp \ + xercesc/validators/datatype/AbstractNumericValidator.hpp \ + xercesc/validators/datatype/AbstractStringValidator.hpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.hpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.hpp \ + xercesc/validators/datatype/DateDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeValidator.hpp \ + xercesc/validators/datatype/DayDatatypeValidator.hpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.hpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.hpp \ + xercesc/validators/datatype/DurationDatatypeValidator.hpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.hpp \ + xercesc/validators/datatype/FloatDatatypeValidator.hpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/IDDatatypeValidator.hpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.hpp \ + xercesc/validators/datatype/InvalidDatatypeFacetException.hpp \ + xercesc/validators/datatype/InvalidDatatypeValueException.hpp \ + xercesc/validators/datatype/ListDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.hpp \ + xercesc/validators/datatype/NameDatatypeValidator.hpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.hpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp \ + xercesc/validators/datatype/QNameDatatypeValidator.hpp \ + xercesc/validators/datatype/StringDatatypeValidator.hpp \ + xercesc/validators/datatype/TimeDatatypeValidator.hpp \ + xercesc/validators/datatype/UnionDatatypeValidator.hpp \ + xercesc/validators/datatype/XMLCanRepGroup.hpp \ + xercesc/validators/datatype/YearDatatypeValidator.hpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.hpp \ + xercesc/validators/DTD/DocTypeHandler.hpp \ + xercesc/validators/DTD/DTDAttDef.hpp \ + xercesc/validators/DTD/DTDAttDefList.hpp \ + xercesc/validators/DTD/DTDElementDecl.hpp \ + xercesc/validators/DTD/DTDEntityDecl.hpp \ + xercesc/validators/DTD/DTDGrammar.hpp \ + xercesc/validators/DTD/DTDScanner.hpp \ + xercesc/validators/DTD/DTDValidator.hpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp \ + xercesc/validators/schema/ComplexTypeInfo.hpp \ + xercesc/validators/schema/GeneralAttributeCheck.hpp \ + xercesc/validators/schema/identity/FieldActivator.hpp \ + xercesc/validators/schema/identity/FieldValueMap.hpp \ + xercesc/validators/schema/identity/IC_Field.hpp \ + xercesc/validators/schema/identity/IC_Key.hpp \ + xercesc/validators/schema/identity/IC_KeyRef.hpp \ + xercesc/validators/schema/identity/IC_Selector.hpp \ + xercesc/validators/schema/identity/IC_Unique.hpp \ + xercesc/validators/schema/identity/IdentityConstraint.hpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.hpp \ + xercesc/validators/schema/identity/ValueStore.hpp \ + xercesc/validators/schema/identity/ValueStoreCache.hpp \ + xercesc/validators/schema/identity/XercesXPath.hpp \ + xercesc/validators/schema/identity/XPathException.hpp \ + xercesc/validators/schema/identity/XPathMatcher.hpp \ + xercesc/validators/schema/identity/XPathMatcherStack.hpp \ + xercesc/validators/schema/identity/XPathSymbols.hpp \ + xercesc/validators/schema/NamespaceScope.hpp \ + xercesc/validators/schema/PSVIDefs.hpp \ + xercesc/validators/schema/SchemaAttDef.hpp \ + xercesc/validators/schema/SchemaAttDefList.hpp \ + xercesc/validators/schema/SchemaElementDecl.hpp \ + xercesc/validators/schema/SchemaGrammar.hpp \ + xercesc/validators/schema/SchemaInfo.hpp \ + xercesc/validators/schema/SchemaSymbols.hpp \ + xercesc/validators/schema/SchemaValidator.hpp \ + xercesc/validators/schema/SubstitutionGroupComparator.hpp \ + xercesc/validators/schema/TraverseSchema.hpp \ + xercesc/validators/schema/XercesAttGroupInfo.hpp \ + xercesc/validators/schema/XercesElementWildcard.hpp \ + xercesc/validators/schema/XercesGroupInfo.hpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp \ + xercesc/validators/schema/XSDDOMParser.hpp \ + xercesc/validators/schema/XSDErrorReporter.hpp \ + xercesc/validators/schema/XSDLocator.hpp \ + xercesc/validators/schema/XUtil.hpp \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp \ + xercesc/xinclude/XIncludeLocation.hpp \ + xercesc/xinclude/XIncludeUtils.hpp \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.hpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.hpp \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp \ + xercesc/util/Transcoders/ICU/ICUTransService.hpp \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp \ + xercesc/util/Transcoders/Iconv/IconvTransService.hpp \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp \ + xercesc/util/Transcoders/Win32/Win32TransService.hpp \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp \ + xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/XMLMsgCat_Ids.hpp \ + xercesc/util/MutexManagers/NoThreadMutexMgr.hpp \ + xercesc/util/MutexManagers/PosixMutexMgr.hpp \ + xercesc/util/MutexManagers/WindowsMutexMgr.hpp \ + xercesc/util/FileManagers/PosixFileMgr.hpp \ + xercesc/util/FileManagers/WindowsFileMgr.hpp +HEADERS = $(nobase_libxerces_c_la_HEADERS) \ + $(nodist_autoconfheaders_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = xercesc/util/MsgLoaders/MsgCatalog +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_SHARED = @BUILD_SHARED@ +BUILD_STATIC = @BUILD_STATIC@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_FLAGS = @CURL_FLAGS@ +CURL_LIBS = @CURL_LIBS@ +CURL_PRESENT = @CURL_PRESENT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ -DXERCES_BUILDING_LIBRARY +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +ICU_BIN = @ICU_BIN@ +ICU_FLAGS = @ICU_FLAGS@ +ICU_LIBS = @ICU_LIBS@ +ICU_PRESENT = @ICU_PRESENT@ +ICU_SBIN = @ICU_SBIN@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SHREXT = @SHREXT@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +acx_pthread_config = @acx_pthread_config@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +curl_config = @curl_config@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +icu_config = @icu_config@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdir = @pkgconfigdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = $(am__append_29) + +# +# +lib_LTLIBRARIES = libxerces-c.la + +# Use AM_* variables instead of per-target ones otherwise the +# make pretty-printing won't work. +# +AM_CPPFLAGS = $(am__append_3) $(am__append_12) $(am__append_25) +libxerces_c_la_LDFLAGS = -release ${INTERFACE_VER_D} + +# This sets {install}/include as target for the headers +libxerces_c_ladir = ${includedir} +libxerces_c_la_SOURCES = ${util_sources} ${dom_sources} \ + ${domimpl_sources} ${framework_sources} ${internal_sources} \ + ${parsers_sources} ${sax_sources} ${sax2_sources} \ + ${validators_sources} ${xinclude_sources} $(am__append_1) \ + $(am__append_4) $(am__append_6) $(am__append_8) \ + $(am__append_10) $(am__append_13) $(am__append_15) \ + $(am__append_17) $(am__append_19) $(am__append_21) \ + $(am__append_23) $(am__append_27) $(am__append_30) \ + $(am__append_32) $(am__append_34) $(am__append_36) \ + $(am__append_38) +nobase_libxerces_c_la_HEADERS = ${util_headers} ${dom_headers} \ + ${domimpl_headers} ${framework_headers} ${internal_headers} \ + ${parsers_headers} ${sax_headers} ${sax2_headers} \ + ${validators_headers} ${xinclude_headers} $(am__append_2) \ + $(am__append_5) $(am__append_7) $(am__append_9) \ + $(am__append_11) $(am__append_14) $(am__append_16) \ + $(am__append_18) $(am__append_20) $(am__append_22) \ + $(am__append_24) $(am__append_28) $(am__append_31) \ + $(am__append_33) $(am__append_35) $(am__append_37) \ + $(am__append_39) + +# Make sure autoconf-generated Xerces_autoconf_config.hpp ends up in a +# proper place when installed. +# +autoconfheadersdir = $(includedir)/xercesc/util +nodist_autoconfheaders_HEADERS = ${top_builddir}/src/xercesc/util/Xerces_autoconf_config.hpp + +# Compatibility library. +# +EXTRA_DIST = stricmp.h strnicmp.h towlower.h towupper.h \ + $(am__append_26) +libxerces_c_la_LIBADD = ${LTLIBOBJS} +@XERCES_USE_MSGLOADER_ICU_TRUE@nodist_libxerces_c_la_SOURCES = ${msgicu_nodist_sources} + +# Resource shortname +@XERCES_USE_MSGLOADER_ICU_TRUE@PKGNAME = xercesc_messages_${INTERFACE_VER_U} +@XERCES_USE_MSGLOADER_ICU_TRUE@CLEANFILES = xercesc_messages.c root_res.c root.res +@XERCES_USE_MSGLOADER_ICU_TRUE@BUILT_SOURCES = xercesc_messages.c root_res.c + +# +# Definition of sources/headers for each convenience library +# + +# +# A line like the following will generate a list of headers +# for a given directory: (must be issued from src directory) +# find xercesc/framework -name '*.hpp' -exec echo {} \\ ";" +# find xercesc/framework -name '*.cpp' -exec echo {} \\ ";" +# +dom_headers = \ + xercesc/dom/DOM.hpp \ + xercesc/dom/DOMAttr.hpp \ + xercesc/dom/DOMCDATASection.hpp \ + xercesc/dom/DOMCharacterData.hpp \ + xercesc/dom/DOMComment.hpp \ + xercesc/dom/DOMConfiguration.hpp \ + xercesc/dom/DOMDocument.hpp \ + xercesc/dom/DOMDocumentFragment.hpp \ + xercesc/dom/DOMDocumentRange.hpp \ + xercesc/dom/DOMDocumentTraversal.hpp \ + xercesc/dom/DOMDocumentType.hpp \ + xercesc/dom/DOMElement.hpp \ + xercesc/dom/DOMEntity.hpp \ + xercesc/dom/DOMEntityReference.hpp \ + xercesc/dom/DOMError.hpp \ + xercesc/dom/DOMErrorHandler.hpp \ + xercesc/dom/DOMException.hpp \ + xercesc/dom/DOMImplementation.hpp \ + xercesc/dom/DOMImplementationList.hpp \ + xercesc/dom/DOMImplementationLS.hpp \ + xercesc/dom/DOMImplementationRegistry.hpp \ + xercesc/dom/DOMImplementationSource.hpp \ + xercesc/dom/DOMLocator.hpp \ + xercesc/dom/DOMLSException.hpp \ + xercesc/dom/DOMLSInput.hpp \ + xercesc/dom/DOMLSOutput.hpp \ + xercesc/dom/DOMLSParser.hpp \ + xercesc/dom/DOMLSParserFilter.hpp \ + xercesc/dom/DOMLSResourceResolver.hpp \ + xercesc/dom/DOMLSSerializer.hpp \ + xercesc/dom/DOMLSSerializerFilter.hpp \ + xercesc/dom/DOMMemoryManager.hpp \ + xercesc/dom/DOMNamedNodeMap.hpp \ + xercesc/dom/DOMNode.hpp \ + xercesc/dom/DOMNodeFilter.hpp \ + xercesc/dom/DOMNodeIterator.hpp \ + xercesc/dom/DOMNodeList.hpp \ + xercesc/dom/DOMNotation.hpp \ + xercesc/dom/DOMProcessingInstruction.hpp \ + xercesc/dom/DOMPSVITypeInfo.hpp \ + xercesc/dom/DOMRange.hpp \ + xercesc/dom/DOMRangeException.hpp \ + xercesc/dom/DOMStringList.hpp \ + xercesc/dom/DOMText.hpp \ + xercesc/dom/DOMTreeWalker.hpp \ + xercesc/dom/DOMTypeInfo.hpp \ + xercesc/dom/DOMUserDataHandler.hpp \ + xercesc/dom/DOMXPathEvaluator.hpp \ + xercesc/dom/DOMXPathException.hpp \ + xercesc/dom/DOMXPathExpression.hpp \ + xercesc/dom/DOMXPathNamespace.hpp \ + xercesc/dom/DOMXPathNSResolver.hpp \ + xercesc/dom/DOMXPathResult.hpp \ + xercesc/dom/StDOMNode.hpp + +dom_sources = \ + xercesc/dom/DOMException.cpp \ + xercesc/dom/DOMLSException.cpp \ + xercesc/dom/DOMRangeException.cpp \ + xercesc/dom/DOMXPathException.cpp + +domimpl_headers = \ + xercesc/dom/impl/DOMAttrImpl.hpp \ + xercesc/dom/impl/DOMAttrMapImpl.hpp \ + xercesc/dom/impl/DOMAttrNSImpl.hpp \ + xercesc/dom/impl/DOMCasts.hpp \ + xercesc/dom/impl/DOMCDATASectionImpl.hpp \ + xercesc/dom/impl/DOMCharacterDataImpl.hpp \ + xercesc/dom/impl/DOMChildNode.hpp \ + xercesc/dom/impl/DOMCommentImpl.hpp \ + xercesc/dom/impl/DOMConfigurationImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.hpp \ + xercesc/dom/impl/DOMDeepNodeListPool.c \ + xercesc/dom/impl/DOMDocumentFragmentImpl.hpp \ + xercesc/dom/impl/DOMDocumentImpl.hpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.hpp \ + xercesc/dom/impl/DOMElementImpl.hpp \ + xercesc/dom/impl/DOMElementNSImpl.hpp \ + xercesc/dom/impl/DOMEntityImpl.hpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.hpp \ + xercesc/dom/impl/DOMErrorImpl.hpp \ + xercesc/dom/impl/DOMImplementationImpl.hpp \ + xercesc/dom/impl/DOMImplementationListImpl.hpp \ + xercesc/dom/impl/DOMLocatorImpl.hpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.hpp \ + xercesc/dom/impl/DOMNodeIDMap.hpp \ + xercesc/dom/impl/DOMNodeImpl.hpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.hpp \ + xercesc/dom/impl/DOMNodeListImpl.hpp \ + xercesc/dom/impl/DOMNodeVector.hpp \ + xercesc/dom/impl/DOMNormalizer.hpp \ + xercesc/dom/impl/DOMNotationImpl.hpp \ + xercesc/dom/impl/DOMParentNode.hpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.hpp \ + xercesc/dom/impl/DOMRangeImpl.hpp \ + xercesc/dom/impl/DOMStringListImpl.hpp \ + xercesc/dom/impl/DOMStringPool.hpp \ + xercesc/dom/impl/DOMTextImpl.hpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.hpp \ + xercesc/dom/impl/DOMTypeInfoImpl.hpp \ + xercesc/dom/impl/DOMLSSerializerImpl.hpp \ + xercesc/dom/impl/DOMLSInputImpl.hpp \ + xercesc/dom/impl/DOMLSOutputImpl.hpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.hpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.hpp \ + xercesc/dom/impl/DOMXPathResultImpl.hpp \ + xercesc/dom/impl/XSDElementNSImpl.hpp + +domimpl_sources = \ + xercesc/dom/impl/DOMAttrImpl.cpp \ + xercesc/dom/impl/DOMAttrMapImpl.cpp \ + xercesc/dom/impl/DOMAttrNSImpl.cpp \ + xercesc/dom/impl/DOMCDATASectionImpl.cpp \ + xercesc/dom/impl/DOMCharacterDataImpl.cpp \ + xercesc/dom/impl/DOMChildNode.cpp \ + xercesc/dom/impl/DOMCommentImpl.cpp \ + xercesc/dom/impl/DOMConfigurationImpl.cpp \ + xercesc/dom/impl/DOMDeepNodeListImpl.cpp \ + xercesc/dom/impl/DOMDocumentFragmentImpl.cpp \ + xercesc/dom/impl/DOMDocumentImpl.cpp \ + xercesc/dom/impl/DOMDocumentTypeImpl.cpp \ + xercesc/dom/impl/DOMElementImpl.cpp \ + xercesc/dom/impl/DOMElementNSImpl.cpp \ + xercesc/dom/impl/DOMEntityImpl.cpp \ + xercesc/dom/impl/DOMEntityReferenceImpl.cpp \ + xercesc/dom/impl/DOMErrorImpl.cpp \ + xercesc/dom/impl/DOMImplementationImpl.cpp \ + xercesc/dom/impl/DOMImplementationListImpl.cpp \ + xercesc/dom/impl/DOMImplementationRegistry.cpp \ + xercesc/dom/impl/DOMLocatorImpl.cpp \ + xercesc/dom/impl/DOMNamedNodeMapImpl.cpp \ + xercesc/dom/impl/DOMNodeIDMap.cpp \ + xercesc/dom/impl/DOMNodeImpl.cpp \ + xercesc/dom/impl/DOMNodeIteratorImpl.cpp \ + xercesc/dom/impl/DOMNodeListImpl.cpp \ + xercesc/dom/impl/DOMNodeVector.cpp \ + xercesc/dom/impl/DOMNormalizer.cpp \ + xercesc/dom/impl/DOMNotationImpl.cpp \ + xercesc/dom/impl/DOMParentNode.cpp \ + xercesc/dom/impl/DOMProcessingInstructionImpl.cpp \ + xercesc/dom/impl/DOMRangeImpl.cpp \ + xercesc/dom/impl/DOMStringListImpl.cpp \ + xercesc/dom/impl/DOMStringPool.cpp \ + xercesc/dom/impl/DOMTextImpl.cpp \ + xercesc/dom/impl/DOMTreeWalkerImpl.cpp \ + xercesc/dom/impl/DOMTypeInfoImpl.cpp \ + xercesc/dom/impl/DOMLSSerializerImpl.cpp \ + xercesc/dom/impl/DOMLSInputImpl.cpp \ + xercesc/dom/impl/DOMLSOutputImpl.cpp \ + xercesc/dom/impl/DOMXPathExpressionImpl.cpp \ + xercesc/dom/impl/DOMXPathNSResolverImpl.cpp \ + xercesc/dom/impl/DOMXPathResultImpl.cpp \ + xercesc/dom/impl/XSDElementNSImpl.cpp + +framework_headers = \ + xercesc/framework/BinOutputStream.hpp \ + xercesc/framework/LocalFileFormatTarget.hpp \ + xercesc/framework/LocalFileInputSource.hpp \ + xercesc/framework/MemBufFormatTarget.hpp \ + xercesc/framework/MemBufInputSource.hpp \ + xercesc/framework/MemoryManager.hpp \ + xercesc/framework/psvi/PSVIAttribute.hpp \ + xercesc/framework/psvi/PSVIAttributeList.hpp \ + xercesc/framework/psvi/PSVIElement.hpp \ + xercesc/framework/psvi/PSVIHandler.hpp \ + xercesc/framework/psvi/PSVIItem.hpp \ + xercesc/framework/psvi/XSAnnotation.hpp \ + xercesc/framework/psvi/XSAttributeDeclaration.hpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.hpp \ + xercesc/framework/psvi/XSAttributeUse.hpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.hpp \ + xercesc/framework/psvi/XSConstants.hpp \ + xercesc/framework/psvi/XSElementDeclaration.hpp \ + xercesc/framework/psvi/XSFacet.hpp \ + xercesc/framework/psvi/XSIDCDefinition.hpp \ + xercesc/framework/psvi/XSModel.hpp \ + xercesc/framework/psvi/XSModelGroup.hpp \ + xercesc/framework/psvi/XSModelGroupDefinition.hpp \ + xercesc/framework/psvi/XSMultiValueFacet.hpp \ + xercesc/framework/psvi/XSNamedMap.hpp \ + xercesc/framework/psvi/XSNamedMap.c \ + xercesc/framework/psvi/XSNamespaceItem.hpp \ + xercesc/framework/psvi/XSNotationDeclaration.hpp \ + xercesc/framework/psvi/XSObject.hpp \ + xercesc/framework/psvi/XSParticle.hpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.hpp \ + xercesc/framework/psvi/XSTypeDefinition.hpp \ + xercesc/framework/psvi/XSValue.hpp \ + xercesc/framework/psvi/XSWildcard.hpp \ + xercesc/framework/StdInInputSource.hpp \ + xercesc/framework/StdOutFormatTarget.hpp \ + xercesc/framework/URLInputSource.hpp \ + xercesc/framework/ValidationContext.hpp \ + xercesc/framework/Wrapper4DOMLSInput.hpp \ + xercesc/framework/Wrapper4InputSource.hpp \ + xercesc/framework/XMLAttDef.hpp \ + xercesc/framework/XMLAttDefList.hpp \ + xercesc/framework/XMLAttr.hpp \ + xercesc/framework/XMLBuffer.hpp \ + xercesc/framework/XMLBufferMgr.hpp \ + xercesc/framework/XMLContentModel.hpp \ + xercesc/framework/XMLDocumentHandler.hpp \ + xercesc/framework/XMLDTDDescription.hpp \ + xercesc/framework/XMLElementDecl.hpp \ + xercesc/framework/XMLEntityDecl.hpp \ + xercesc/framework/XMLEntityHandler.hpp \ + xercesc/framework/XMLErrorCodes.hpp \ + xercesc/framework/XMLErrorReporter.hpp \ + xercesc/framework/XMLFormatter.hpp \ + xercesc/framework/XMLGrammarDescription.hpp \ + xercesc/framework/XMLGrammarPool.hpp \ + xercesc/framework/XMLGrammarPoolImpl.hpp \ + xercesc/framework/XMLNotationDecl.hpp \ + xercesc/framework/XMLPScanToken.hpp \ + xercesc/framework/XMLRecognizer.hpp \ + xercesc/framework/XMLRefInfo.hpp \ + xercesc/framework/XMLSchemaDescription.hpp \ + xercesc/framework/XMLValidator.hpp \ + xercesc/framework/XMLValidityCodes.hpp + +framework_sources = \ + xercesc/framework/BinOutputStream.cpp \ + xercesc/framework/LocalFileFormatTarget.cpp \ + xercesc/framework/LocalFileInputSource.cpp \ + xercesc/framework/MemBufFormatTarget.cpp \ + xercesc/framework/MemBufInputSource.cpp \ + xercesc/framework/psvi/PSVIAttribute.cpp \ + xercesc/framework/psvi/PSVIAttributeList.cpp \ + xercesc/framework/psvi/PSVIElement.cpp \ + xercesc/framework/psvi/PSVIItem.cpp \ + xercesc/framework/psvi/XSAnnotation.cpp \ + xercesc/framework/psvi/XSAttributeDeclaration.cpp \ + xercesc/framework/psvi/XSAttributeGroupDefinition.cpp \ + xercesc/framework/psvi/XSAttributeUse.cpp \ + xercesc/framework/psvi/XSComplexTypeDefinition.cpp \ + xercesc/framework/psvi/XSElementDeclaration.cpp \ + xercesc/framework/psvi/XSFacet.cpp \ + xercesc/framework/psvi/XSIDCDefinition.cpp \ + xercesc/framework/psvi/XSModel.cpp \ + xercesc/framework/psvi/XSModelGroup.cpp \ + xercesc/framework/psvi/XSModelGroupDefinition.cpp \ + xercesc/framework/psvi/XSMultiValueFacet.cpp \ + xercesc/framework/psvi/XSNamespaceItem.cpp \ + xercesc/framework/psvi/XSNotationDeclaration.cpp \ + xercesc/framework/psvi/XSObject.cpp \ + xercesc/framework/psvi/XSParticle.cpp \ + xercesc/framework/psvi/XSSimpleTypeDefinition.cpp \ + xercesc/framework/psvi/XSTypeDefinition.cpp \ + xercesc/framework/psvi/XSValue.cpp \ + xercesc/framework/psvi/XSWildcard.cpp \ + xercesc/framework/StdInInputSource.cpp \ + xercesc/framework/StdOutFormatTarget.cpp \ + xercesc/framework/URLInputSource.cpp \ + xercesc/framework/Wrapper4DOMLSInput.cpp \ + xercesc/framework/Wrapper4InputSource.cpp \ + xercesc/framework/XMLAttDef.cpp \ + xercesc/framework/XMLAttDefList.cpp \ + xercesc/framework/XMLAttr.cpp \ + xercesc/framework/XMLBuffer.cpp \ + xercesc/framework/XMLBufferMgr.cpp \ + xercesc/framework/XMLContentModel.cpp \ + xercesc/framework/XMLDTDDescription.cpp \ + xercesc/framework/XMLElementDecl.cpp \ + xercesc/framework/XMLEntityDecl.cpp \ + xercesc/framework/XMLFormatter.cpp \ + xercesc/framework/XMLGrammarDescription.cpp \ + xercesc/framework/XMLGrammarPoolImpl.cpp \ + xercesc/framework/XMLNotationDecl.cpp \ + xercesc/framework/XMLRecognizer.cpp \ + xercesc/framework/XMLRefInfo.cpp \ + xercesc/framework/XMLSchemaDescription.cpp \ + xercesc/framework/XMLValidator.cpp + +internal_headers = \ + xercesc/internal/BinFileOutputStream.hpp \ + xercesc/internal/BinMemOutputStream.hpp \ + xercesc/internal/CharTypeTables.hpp \ + xercesc/internal/DGXMLScanner.hpp \ + xercesc/internal/ElemStack.hpp \ + xercesc/internal/EndOfEntityException.hpp \ + xercesc/internal/IANAEncodings.hpp \ + xercesc/internal/IGXMLScanner.hpp \ + xercesc/internal/MemoryManagerImpl.hpp \ + xercesc/internal/ReaderMgr.hpp \ + xercesc/internal/SGXMLScanner.hpp \ + xercesc/internal/ValidationContextImpl.hpp \ + xercesc/internal/VecAttributesImpl.hpp \ + xercesc/internal/VecAttrListImpl.hpp \ + xercesc/internal/WFXMLScanner.hpp \ + xercesc/internal/XMLInternalErrorHandler.hpp \ + xercesc/internal/XMLReader.hpp \ + xercesc/internal/XMLScanner.hpp \ + xercesc/internal/XMLScannerResolver.hpp \ + xercesc/internal/XProtoType.hpp \ + xercesc/internal/XSAXMLScanner.hpp \ + xercesc/internal/XSerializable.hpp \ + xercesc/internal/XSerializationException.hpp \ + xercesc/internal/XSerializeEngine.hpp \ + xercesc/internal/XSObjectFactory.hpp \ + xercesc/internal/XTemplateSerializer.hpp + +internal_sources = \ + xercesc/internal/BinFileOutputStream.cpp \ + xercesc/internal/BinMemOutputStream.cpp \ + xercesc/internal/DGXMLScanner.cpp \ + xercesc/internal/ElemStack.cpp \ + xercesc/internal/IGXMLScanner.cpp \ + xercesc/internal/IGXMLScanner2.cpp \ + xercesc/internal/MemoryManagerImpl.cpp \ + xercesc/internal/ReaderMgr.cpp \ + xercesc/internal/SGXMLScanner.cpp \ + xercesc/internal/ValidationContextImpl.cpp \ + xercesc/internal/VecAttributesImpl.cpp \ + xercesc/internal/VecAttrListImpl.cpp \ + xercesc/internal/WFXMLScanner.cpp \ + xercesc/internal/XMLReader.cpp \ + xercesc/internal/XMLScanner.cpp \ + xercesc/internal/XMLScannerResolver.cpp \ + xercesc/internal/XProtoType.cpp \ + xercesc/internal/XSAXMLScanner.cpp \ + xercesc/internal/XSerializeEngine.cpp \ + xercesc/internal/XSObjectFactory.cpp \ + xercesc/internal/XTemplateSerializer.cpp + +parsers_headers = \ + xercesc/parsers/AbstractDOMParser.hpp \ + xercesc/parsers/DOMLSParserImpl.hpp \ + xercesc/parsers/SAX2XMLFilterImpl.hpp \ + xercesc/parsers/SAX2XMLReaderImpl.hpp \ + xercesc/parsers/SAXParser.hpp \ + xercesc/parsers/XercesDOMParser.hpp + +parsers_sources = \ + xercesc/parsers/AbstractDOMParser.cpp \ + xercesc/parsers/DOMLSParserImpl.cpp \ + xercesc/parsers/SAX2XMLFilterImpl.cpp \ + xercesc/parsers/SAX2XMLReaderImpl.cpp \ + xercesc/parsers/SAXParser.cpp \ + xercesc/parsers/XercesDOMParser.cpp + +sax_headers = \ + xercesc/sax/AttributeList.hpp \ + xercesc/sax/DocumentHandler.hpp \ + xercesc/sax/DTDHandler.hpp \ + xercesc/sax/EntityResolver.hpp \ + xercesc/sax/ErrorHandler.hpp \ + xercesc/sax/HandlerBase.hpp \ + xercesc/sax/InputSource.hpp \ + xercesc/sax/Locator.hpp \ + xercesc/sax/Parser.hpp \ + xercesc/sax/SAXException.hpp \ + xercesc/sax/SAXParseException.hpp + +sax_sources = \ + xercesc/sax/Dummy.cpp \ + xercesc/sax/InputSource.cpp \ + xercesc/sax/SAXException.cpp \ + xercesc/sax/SAXParseException.cpp + +sax2_headers = \ + xercesc/sax2/Attributes.hpp \ + xercesc/sax2/ContentHandler.hpp \ + xercesc/sax2/DeclHandler.hpp \ + xercesc/sax2/DefaultHandler.hpp \ + xercesc/sax2/LexicalHandler.hpp \ + xercesc/sax2/SAX2XMLFilter.hpp \ + xercesc/sax2/SAX2XMLReader.hpp \ + xercesc/sax2/XMLReaderFactory.hpp + +sax2_sources = \ + xercesc/sax2/sax2Dummy.cpp + +util_headers = \ + xercesc/util/ArrayIndexOutOfBoundsException.hpp \ + xercesc/util/Base64.hpp \ + xercesc/util/BaseRefVectorOf.hpp \ + xercesc/util/BaseRefVectorOf.c \ + xercesc/util/BinFileInputStream.hpp \ + xercesc/util/BinInputStream.hpp \ + xercesc/util/BinMemInputStream.hpp \ + xercesc/util/BitOps.hpp \ + xercesc/util/BitSet.hpp \ + xercesc/util/CountedPointer.hpp \ + xercesc/util/CountedPointer.c \ + xercesc/util/DefaultPanicHandler.hpp \ + xercesc/util/EmptyStackException.hpp \ + xercesc/util/EncodingValidator.hpp \ + xercesc/util/FlagJanitor.hpp \ + xercesc/util/FlagJanitor.c \ + xercesc/util/Hashers.hpp \ + xercesc/util/Hash2KeysSetOf.hpp \ + xercesc/util/Hash2KeysSetOf.c \ + xercesc/util/HexBin.hpp \ + xercesc/util/IllegalArgumentException.hpp \ + xercesc/util/InvalidCastException.hpp \ + xercesc/util/IOException.hpp \ + xercesc/util/Janitor.hpp \ + xercesc/util/Janitor.c \ + xercesc/util/KeyRefPair.hpp \ + xercesc/util/KeyRefPair.c \ + xercesc/util/KeyValuePair.hpp \ + xercesc/util/KeyValuePair.c \ + xercesc/util/KVStringPair.hpp \ + xercesc/util/Mutexes.hpp \ + xercesc/util/LogicalPath.c \ + xercesc/util/NameIdPool.hpp \ + xercesc/util/NameIdPool.c \ + xercesc/util/NoSuchElementException.hpp \ + xercesc/util/NullPointerException.hpp \ + xercesc/util/NumberFormatException.hpp \ + xercesc/util/OutOfMemoryException.hpp \ + xercesc/util/PanicHandler.hpp \ + xercesc/util/ParseException.hpp \ + xercesc/util/PlatformUtils.hpp \ + xercesc/util/PSVIUni.hpp \ + xercesc/util/QName.hpp \ + xercesc/util/RefArrayOf.hpp \ + xercesc/util/RefArrayOf.c \ + xercesc/util/RefArrayVectorOf.hpp \ + xercesc/util/RefArrayVectorOf.c \ + xercesc/util/RefHash2KeysTableOf.hpp \ + xercesc/util/RefHash2KeysTableOf.c \ + xercesc/util/RefHash3KeysIdPool.hpp \ + xercesc/util/RefHash3KeysIdPool.c \ + xercesc/util/RefHashTableOf.hpp \ + xercesc/util/RefHashTableOf.c \ + xercesc/util/RefStackOf.hpp \ + xercesc/util/RefStackOf.c \ + xercesc/util/RefVectorOf.hpp \ + xercesc/util/RefVectorOf.c \ + xercesc/util/regx/ASCIIRangeFactory.hpp \ + xercesc/util/regx/BlockRangeFactory.hpp \ + xercesc/util/regx/BMPattern.hpp \ + xercesc/util/regx/CharToken.hpp \ + xercesc/util/regx/ClosureToken.hpp \ + xercesc/util/regx/ConcatToken.hpp \ + xercesc/util/regx/Match.hpp \ + xercesc/util/regx/Op.hpp \ + xercesc/util/regx/OpFactory.hpp \ + xercesc/util/regx/ParenToken.hpp \ + xercesc/util/regx/ParserForXMLSchema.hpp \ + xercesc/util/regx/RangeFactory.hpp \ + xercesc/util/regx/RangeToken.hpp \ + xercesc/util/regx/RangeTokenMap.hpp \ + xercesc/util/regx/RegularExpression.hpp \ + xercesc/util/regx/RegxDefs.hpp \ + xercesc/util/regx/RegxParser.hpp \ + xercesc/util/regx/RegxUtil.hpp \ + xercesc/util/regx/StringToken.hpp \ + xercesc/util/regx/Token.hpp \ + xercesc/util/regx/TokenFactory.hpp \ + xercesc/util/regx/TokenInc.hpp \ + xercesc/util/regx/UniCharTable.hpp \ + xercesc/util/regx/UnicodeRangeFactory.hpp \ + xercesc/util/regx/UnionToken.hpp \ + xercesc/util/regx/XMLRangeFactory.hpp \ + xercesc/util/regx/XMLUniCharacter.hpp \ + xercesc/util/RuntimeException.hpp \ + xercesc/util/SchemaDateTimeException.hpp \ + xercesc/util/SecurityManager.hpp \ + xercesc/util/StringPool.hpp \ + xercesc/util/SynchronizedStringPool.hpp \ + xercesc/util/TranscodingException.hpp \ + xercesc/util/TransENameMap.hpp \ + xercesc/util/TransENameMap.c \ + xercesc/util/TransService.hpp \ + xercesc/util/UnexpectedEOFException.hpp \ + xercesc/util/UnsupportedEncodingException.hpp \ + xercesc/util/UTFDataFormatException.hpp \ + xercesc/util/ValueArrayOf.hpp \ + xercesc/util/ValueArrayOf.c \ + xercesc/util/ValueHashTableOf.hpp \ + xercesc/util/ValueHashTableOf.c \ + xercesc/util/ValueStackOf.hpp \ + xercesc/util/ValueStackOf.c \ + xercesc/util/ValueVectorOf.hpp \ + xercesc/util/ValueVectorOf.c \ + xercesc/util/XercesDefs.hpp \ + xercesc/util/XercesVersion.hpp \ + xercesc/util/XMemory.hpp \ + xercesc/util/XML256TableTranscoder.hpp \ + xercesc/util/XML88591Transcoder.hpp \ + xercesc/util/XMLAbstractDoubleFloat.hpp \ + xercesc/util/XMLASCIITranscoder.hpp \ + xercesc/util/XMLBigDecimal.hpp \ + xercesc/util/XMLBigInteger.hpp \ + xercesc/util/XMLChar.hpp \ + xercesc/util/XMLChTranscoder.hpp \ + xercesc/util/XMLDateTime.hpp \ + xercesc/util/XMLDOMMsg.hpp \ + xercesc/util/XMLDouble.hpp \ + xercesc/util/XMLEBCDICTranscoder.hpp \ + xercesc/util/XMLEntityResolver.hpp \ + xercesc/util/XMLEnumerator.hpp \ + xercesc/util/XMLException.hpp \ + xercesc/util/XMLExceptMsgs.hpp \ + xercesc/util/XMLFileMgr.hpp \ + xercesc/util/XMLFloat.hpp \ + xercesc/util/XMLIBM1047Transcoder.hpp \ + xercesc/util/XMLIBM1140Transcoder.hpp \ + xercesc/util/XMLInitializer.hpp \ + xercesc/util/XMLInteger.hpp \ + xercesc/util/XMLMutexMgr.hpp \ + xercesc/util/XMLMsgLoader.hpp \ + xercesc/util/XMLNetAccessor.hpp \ + xercesc/util/XMLNumber.hpp \ + xercesc/util/XMLResourceIdentifier.hpp \ + xercesc/util/XMLString.hpp \ + xercesc/util/XMLStringTokenizer.hpp \ + xercesc/util/XMLUCS4Transcoder.hpp \ + xercesc/util/XMLUni.hpp \ + xercesc/util/XMLUniDefs.hpp \ + xercesc/util/XMLUri.hpp \ + xercesc/util/XMLURL.hpp \ + xercesc/util/XMLUTF16Transcoder.hpp \ + xercesc/util/XMLUTF8Transcoder.hpp \ + xercesc/util/XMLWin1252Transcoder.hpp + +util_sources = \ + xercesc/util/Base64.cpp \ + xercesc/util/BinFileInputStream.cpp \ + xercesc/util/BinInputStream.cpp \ + xercesc/util/BinMemInputStream.cpp \ + xercesc/util/BitSet.cpp \ + xercesc/util/DefaultPanicHandler.cpp \ + xercesc/util/EncodingValidator.cpp \ + xercesc/util/HeaderDummy.cpp \ + xercesc/util/HexBin.cpp \ + xercesc/util/KVStringPair.cpp \ + xercesc/util/Mutexes.cpp \ + xercesc/util/PanicHandler.cpp \ + xercesc/util/PlatformUtils.cpp \ + xercesc/util/PSVIUni.cpp \ + xercesc/util/QName.cpp \ + xercesc/util/regx/ASCIIRangeFactory.cpp \ + xercesc/util/regx/BlockRangeFactory.cpp \ + xercesc/util/regx/BMPattern.cpp \ + xercesc/util/regx/CharToken.cpp \ + xercesc/util/regx/ClosureToken.cpp \ + xercesc/util/regx/ConcatToken.cpp \ + xercesc/util/regx/Match.cpp \ + xercesc/util/regx/Op.cpp \ + xercesc/util/regx/OpFactory.cpp \ + xercesc/util/regx/ParenToken.cpp \ + xercesc/util/regx/ParserForXMLSchema.cpp \ + xercesc/util/regx/RangeFactory.cpp \ + xercesc/util/regx/RangeToken.cpp \ + xercesc/util/regx/RangeTokenMap.cpp \ + xercesc/util/regx/RegularExpression.cpp \ + xercesc/util/regx/RegxParser.cpp \ + xercesc/util/regx/RegxUtil.cpp \ + xercesc/util/regx/StringToken.cpp \ + xercesc/util/regx/Token.cpp \ + xercesc/util/regx/TokenFactory.cpp \ + xercesc/util/regx/UnicodeRangeFactory.cpp \ + xercesc/util/regx/UnionToken.cpp \ + xercesc/util/regx/XMLRangeFactory.cpp \ + xercesc/util/regx/XMLUniCharacter.cpp \ + xercesc/util/StringPool.cpp \ + xercesc/util/SynchronizedStringPool.cpp \ + xercesc/util/TransService.cpp \ + xercesc/util/XMemory.cpp \ + xercesc/util/XML256TableTranscoder.cpp \ + xercesc/util/XML88591Transcoder.cpp \ + xercesc/util/XMLAbstractDoubleFloat.cpp \ + xercesc/util/XMLASCIITranscoder.cpp \ + xercesc/util/XMLBigDecimal.cpp \ + xercesc/util/XMLBigInteger.cpp \ + xercesc/util/XMLChar.cpp \ + xercesc/util/XMLChTranscoder.cpp \ + xercesc/util/XMLDateTime.cpp \ + xercesc/util/XMLDouble.cpp \ + xercesc/util/XMLEBCDICTranscoder.cpp \ + xercesc/util/XMLException.cpp \ + xercesc/util/XMLFloat.cpp \ + xercesc/util/XMLIBM1047Transcoder.cpp \ + xercesc/util/XMLIBM1140Transcoder.cpp \ + xercesc/util/XMLInitializer.cpp \ + xercesc/util/XMLMsgLoader.cpp \ + xercesc/util/XMLNumber.cpp \ + xercesc/util/XMLString.cpp \ + xercesc/util/XMLStringTokenizer.cpp \ + xercesc/util/XMLUCS4Transcoder.cpp \ + xercesc/util/XMLUni.cpp \ + xercesc/util/XMLUri.cpp \ + xercesc/util/XMLURL.cpp \ + xercesc/util/XMLUTF16Transcoder.cpp \ + xercesc/util/XMLUTF8Transcoder.cpp \ + xercesc/util/XMLWin1252Transcoder.cpp + +validators_headers = \ + xercesc/validators/common/AllContentModel.hpp \ + xercesc/validators/common/CMAny.hpp \ + xercesc/validators/common/CMBinaryOp.hpp \ + xercesc/validators/common/CMLeaf.hpp \ + xercesc/validators/common/CMRepeatingLeaf.hpp \ + xercesc/validators/common/CMNode.hpp \ + xercesc/validators/common/CMStateSet.hpp \ + xercesc/validators/common/CMUnaryOp.hpp \ + xercesc/validators/common/ContentLeafNameTypeVector.hpp \ + xercesc/validators/common/ContentSpecNode.hpp \ + xercesc/validators/common/DFAContentModel.hpp \ + xercesc/validators/common/Grammar.hpp \ + xercesc/validators/common/GrammarResolver.hpp \ + xercesc/validators/common/MixedContentModel.hpp \ + xercesc/validators/common/SimpleContentModel.hpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.hpp \ + xercesc/validators/datatype/AbstractNumericValidator.hpp \ + xercesc/validators/datatype/AbstractStringValidator.hpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.hpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidator.hpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.hpp \ + xercesc/validators/datatype/DateDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.hpp \ + xercesc/validators/datatype/DateTimeValidator.hpp \ + xercesc/validators/datatype/DayDatatypeValidator.hpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.hpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.hpp \ + xercesc/validators/datatype/DurationDatatypeValidator.hpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.hpp \ + xercesc/validators/datatype/FloatDatatypeValidator.hpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp \ + xercesc/validators/datatype/IDDatatypeValidator.hpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.hpp \ + xercesc/validators/datatype/InvalidDatatypeFacetException.hpp \ + xercesc/validators/datatype/InvalidDatatypeValueException.hpp \ + xercesc/validators/datatype/ListDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDatatypeValidator.hpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.hpp \ + xercesc/validators/datatype/NameDatatypeValidator.hpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.hpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp \ + xercesc/validators/datatype/QNameDatatypeValidator.hpp \ + xercesc/validators/datatype/StringDatatypeValidator.hpp \ + xercesc/validators/datatype/TimeDatatypeValidator.hpp \ + xercesc/validators/datatype/UnionDatatypeValidator.hpp \ + xercesc/validators/datatype/XMLCanRepGroup.hpp \ + xercesc/validators/datatype/YearDatatypeValidator.hpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.hpp \ + xercesc/validators/DTD/DocTypeHandler.hpp \ + xercesc/validators/DTD/DTDAttDef.hpp \ + xercesc/validators/DTD/DTDAttDefList.hpp \ + xercesc/validators/DTD/DTDElementDecl.hpp \ + xercesc/validators/DTD/DTDEntityDecl.hpp \ + xercesc/validators/DTD/DTDGrammar.hpp \ + xercesc/validators/DTD/DTDScanner.hpp \ + xercesc/validators/DTD/DTDValidator.hpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp \ + xercesc/validators/schema/ComplexTypeInfo.hpp \ + xercesc/validators/schema/GeneralAttributeCheck.hpp \ + xercesc/validators/schema/identity/FieldActivator.hpp \ + xercesc/validators/schema/identity/FieldValueMap.hpp \ + xercesc/validators/schema/identity/IC_Field.hpp \ + xercesc/validators/schema/identity/IC_Key.hpp \ + xercesc/validators/schema/identity/IC_KeyRef.hpp \ + xercesc/validators/schema/identity/IC_Selector.hpp \ + xercesc/validators/schema/identity/IC_Unique.hpp \ + xercesc/validators/schema/identity/IdentityConstraint.hpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.hpp \ + xercesc/validators/schema/identity/ValueStore.hpp \ + xercesc/validators/schema/identity/ValueStoreCache.hpp \ + xercesc/validators/schema/identity/XercesXPath.hpp \ + xercesc/validators/schema/identity/XPathException.hpp \ + xercesc/validators/schema/identity/XPathMatcher.hpp \ + xercesc/validators/schema/identity/XPathMatcherStack.hpp \ + xercesc/validators/schema/identity/XPathSymbols.hpp \ + xercesc/validators/schema/NamespaceScope.hpp \ + xercesc/validators/schema/PSVIDefs.hpp \ + xercesc/validators/schema/SchemaAttDef.hpp \ + xercesc/validators/schema/SchemaAttDefList.hpp \ + xercesc/validators/schema/SchemaElementDecl.hpp \ + xercesc/validators/schema/SchemaGrammar.hpp \ + xercesc/validators/schema/SchemaInfo.hpp \ + xercesc/validators/schema/SchemaSymbols.hpp \ + xercesc/validators/schema/SchemaValidator.hpp \ + xercesc/validators/schema/SubstitutionGroupComparator.hpp \ + xercesc/validators/schema/TraverseSchema.hpp \ + xercesc/validators/schema/XercesAttGroupInfo.hpp \ + xercesc/validators/schema/XercesElementWildcard.hpp \ + xercesc/validators/schema/XercesGroupInfo.hpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp \ + xercesc/validators/schema/XSDDOMParser.hpp \ + xercesc/validators/schema/XSDErrorReporter.hpp \ + xercesc/validators/schema/XSDLocator.hpp \ + xercesc/validators/schema/XUtil.hpp + +validators_sources = \ + xercesc/validators/common/AllContentModel.cpp \ + xercesc/validators/common/CMAny.cpp \ + xercesc/validators/common/CMBinaryOp.cpp \ + xercesc/validators/common/CMUnaryOp.cpp \ + xercesc/validators/common/ContentLeafNameTypeVector.cpp \ + xercesc/validators/common/ContentSpecNode.cpp \ + xercesc/validators/common/DFAContentModel.cpp \ + xercesc/validators/common/Grammar.cpp \ + xercesc/validators/common/GrammarResolver.cpp \ + xercesc/validators/common/MixedContentModel.cpp \ + xercesc/validators/common/SimpleContentModel.cpp \ + xercesc/validators/datatype/AbstractNumericFacetValidator.cpp \ + xercesc/validators/datatype/AbstractNumericValidator.cpp \ + xercesc/validators/datatype/AbstractStringValidator.cpp \ + xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp \ + xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \ + xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/BooleanDatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidator.cpp \ + xercesc/validators/datatype/DatatypeValidatorFactory.cpp \ + xercesc/validators/datatype/DateDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeDatatypeValidator.cpp \ + xercesc/validators/datatype/DateTimeValidator.cpp \ + xercesc/validators/datatype/DayDatatypeValidator.cpp \ + xercesc/validators/datatype/DecimalDatatypeValidator.cpp \ + xercesc/validators/datatype/DoubleDatatypeValidator.cpp \ + xercesc/validators/datatype/DurationDatatypeValidator.cpp \ + xercesc/validators/datatype/ENTITYDatatypeValidator.cpp \ + xercesc/validators/datatype/FloatDatatypeValidator.cpp \ + xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp \ + xercesc/validators/datatype/IDDatatypeValidator.cpp \ + xercesc/validators/datatype/IDREFDatatypeValidator.cpp \ + xercesc/validators/datatype/ListDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDatatypeValidator.cpp \ + xercesc/validators/datatype/MonthDayDatatypeValidator.cpp \ + xercesc/validators/datatype/NameDatatypeValidator.cpp \ + xercesc/validators/datatype/NCNameDatatypeValidator.cpp \ + xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp \ + xercesc/validators/datatype/QNameDatatypeValidator.cpp \ + xercesc/validators/datatype/StringDatatypeValidator.cpp \ + xercesc/validators/datatype/TimeDatatypeValidator.cpp \ + xercesc/validators/datatype/UnionDatatypeValidator.cpp \ + xercesc/validators/datatype/XMLCanRepGroup.cpp \ + xercesc/validators/datatype/YearDatatypeValidator.cpp \ + xercesc/validators/datatype/YearMonthDatatypeValidator.cpp \ + xercesc/validators/DTD/DTDAttDef.cpp \ + xercesc/validators/DTD/DTDAttDefList.cpp \ + xercesc/validators/DTD/DTDElementDecl.cpp \ + xercesc/validators/DTD/DTDEntityDecl.cpp \ + xercesc/validators/DTD/DTDGrammar.cpp \ + xercesc/validators/DTD/DTDScanner.cpp \ + xercesc/validators/DTD/DTDValidator.cpp \ + xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp \ + xercesc/validators/schema/ComplexTypeInfo.cpp \ + xercesc/validators/schema/GeneralAttributeCheck.cpp \ + xercesc/validators/schema/identity/FieldActivator.cpp \ + xercesc/validators/schema/identity/FieldValueMap.cpp \ + xercesc/validators/schema/identity/IC_Field.cpp \ + xercesc/validators/schema/identity/IC_Key.cpp \ + xercesc/validators/schema/identity/IC_KeyRef.cpp \ + xercesc/validators/schema/identity/IC_Selector.cpp \ + xercesc/validators/schema/identity/IC_Unique.cpp \ + xercesc/validators/schema/identity/IdentityConstraint.cpp \ + xercesc/validators/schema/identity/IdentityConstraintHandler.cpp \ + xercesc/validators/schema/identity/ValueStore.cpp \ + xercesc/validators/schema/identity/ValueStoreCache.cpp \ + xercesc/validators/schema/identity/XercesXPath.cpp \ + xercesc/validators/schema/identity/XPathMatcher.cpp \ + xercesc/validators/schema/identity/XPathMatcherStack.cpp \ + xercesc/validators/schema/identity/XPathSymbols.cpp \ + xercesc/validators/schema/NamespaceScope.cpp \ + xercesc/validators/schema/SchemaAttDef.cpp \ + xercesc/validators/schema/SchemaAttDefList.cpp \ + xercesc/validators/schema/SchemaElementDecl.cpp \ + xercesc/validators/schema/SchemaGrammar.cpp \ + xercesc/validators/schema/SchemaInfo.cpp \ + xercesc/validators/schema/SchemaSymbols.cpp \ + xercesc/validators/schema/SchemaValidator.cpp \ + xercesc/validators/schema/SubstitutionGroupComparator.cpp \ + xercesc/validators/schema/TraverseSchema.cpp \ + xercesc/validators/schema/XercesAttGroupInfo.cpp \ + xercesc/validators/schema/XercesElementWildcard.cpp \ + xercesc/validators/schema/XercesGroupInfo.cpp \ + xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp \ + xercesc/validators/schema/XSDDOMParser.cpp \ + xercesc/validators/schema/XSDErrorReporter.cpp \ + xercesc/validators/schema/XSDLocator.cpp \ + xercesc/validators/schema/XUtil.cpp + +xinclude_headers = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp \ + xercesc/xinclude/XIncludeLocation.hpp \ + xercesc/xinclude/XIncludeUtils.hpp + +xinclude_sources = \ + xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp \ + xercesc/xinclude/XIncludeLocation.cpp \ + xercesc/xinclude/XIncludeUtils.cpp + +icu_headers = \ + xercesc/util/Transcoders/ICU/ICUTransService.hpp + +icu_sources = \ + xercesc/util/Transcoders/ICU/ICUTransService.cpp + +gnuiconv_headers = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp + +gnuiconv_sources = \ + xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp + +iconv_headers = \ + xercesc/util/Transcoders/Iconv/IconvTransService.hpp + +iconv_sources = \ + xercesc/util/Transcoders/Iconv/IconvTransService.cpp + +macosunicodeconverter_headers = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp + +macosunicodeconverter_sources = \ + xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp + +wintrans_headers = \ + xercesc/util/Transcoders/Win32/Win32TransService.hpp + +wintrans_sources = \ + xercesc/util/Transcoders/Win32/Win32TransService.cpp + +curl_headers = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.hpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp + +curl_sources = \ + xercesc/util/NetAccessors/Curl/CurlNetAccessor.cpp \ + xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp + +sockets_headers = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +sockets_sources = \ + xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp \ + xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + +cfurl_headers = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.hpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.hpp + +cfurl_sources = \ + xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.cpp \ + xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.cpp + +winsock_headers = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp + +winsock_sources = \ + xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp \ + xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp \ + xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp + +msginmemory_headers = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp \ + xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp + +msginmemory_sources = \ + xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp + +msgicu_headers = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp + +msgicu_sources = \ + xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp + +msgicu_nodist_sources = \ + xercesc_messages.c \ + root_res.c + +msgiconv_headers = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp \ + xercesc/util/MsgLoaders/MsgCatalog/XMLMsgCat_Ids.hpp + +msgiconv_sources = \ + xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp + +posixfmgr_headers = \ + xercesc/util/FileManagers/PosixFileMgr.hpp + +posixfmgr_sources = \ + xercesc/util/FileManagers/PosixFileMgr.cpp + +winfmgr_headers = \ + xercesc/util/FileManagers/WindowsFileMgr.hpp + +winfmgr_sources = \ + xercesc/util/FileManagers/WindowsFileMgr.cpp + +nothreadmmgr_headers = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.hpp + +nothreadmmgr_sources = \ + xercesc/util/MutexManagers/NoThreadMutexMgr.cpp + +posixmmgr_headers = \ + xercesc/util/MutexManagers/PosixMutexMgr.hpp + +posixmmgr_sources = \ + xercesc/util/MutexManagers/PosixMutexMgr.cpp + +winmmgr_headers = \ + xercesc/util/MutexManagers/WindowsMutexMgr.hpp + +winmmgr_sources = \ + xercesc/util/MutexManagers/WindowsMutexMgr.cpp + +@XERCES_PRETTY_MAKE_TRUE@PRETTY_MAKE = ${top_srcdir}/config/pretty-make +@XERCES_PRETTY_MAKE_TRUE@PRETTY_COMPILE = ${PRETTY_MAKE} Compiling +COMPILE = ${PRETTY_COMPILE} \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +LTCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CC --mode=compile \ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +CXXCOMPILE = ${PRETTY_COMPILE} \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) + +LTCXXCOMPILE = ${PRETTY_COMPILE} \ + $(LIBTOOL) --quiet --tag=CXX --mode=compile \ + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +xercesc/util/$(am__dirstamp): + @$(MKDIR_P) xercesc/util + @: > xercesc/util/$(am__dirstamp) +xercesc/util/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/$(DEPDIR) + @: > xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Base64.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinFileInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BinMemInputStream.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/BitSet.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/DefaultPanicHandler.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/EncodingValidator.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/HeaderDummy.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/HexBin.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/KVStringPair.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Mutexes.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PanicHandler.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PlatformUtils.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/PSVIUni.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/QName.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/regx + @: > xercesc/util/regx/$(am__dirstamp) +xercesc/util/regx/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/regx/$(DEPDIR) + @: > xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ASCIIRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/BlockRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/BMPattern.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/CharToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ClosureToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ConcatToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Match.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Op.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/OpFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ParenToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/ParserForXMLSchema.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RangeTokenMap.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegularExpression.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegxParser.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/RegxUtil.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/StringToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/Token.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/TokenFactory.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/UnicodeRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/UnionToken.lo: xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/XMLRangeFactory.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/regx/XMLUniCharacter.lo: \ + xercesc/util/regx/$(am__dirstamp) \ + xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) +xercesc/util/StringPool.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/SynchronizedStringPool.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/TransService.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMemory.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XML256TableTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XML88591Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLAbstractDoubleFloat.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLASCIITranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLBigDecimal.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLBigInteger.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLChar.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLChTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLDateTime.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLDouble.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLEBCDICTranscoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLException.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLFloat.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLIBM1047Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLIBM1140Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLInitializer.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLMsgLoader.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLNumber.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLString.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLStringTokenizer.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUCS4Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUni.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUri.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLURL.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUTF16Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLUTF8Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/util/XMLWin1252Transcoder.lo: xercesc/util/$(am__dirstamp) \ + xercesc/util/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom + @: > xercesc/dom/$(am__dirstamp) +xercesc/dom/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/$(DEPDIR) + @: > xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMLSException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMRangeException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/DOMXPathException.lo: xercesc/dom/$(am__dirstamp) \ + xercesc/dom/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/impl + @: > xercesc/dom/impl/$(am__dirstamp) +xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/dom/impl/$(DEPDIR) + @: > xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrMapImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMAttrNSImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCDATASectionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCharacterDataImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMChildNode.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMCommentImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMConfigurationImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDeepNodeListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentFragmentImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMDocumentTypeImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMElementImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMElementNSImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMEntityImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMEntityReferenceImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMErrorImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMImplementationRegistry.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLocatorImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNamedNodeMapImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeIDMap.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeIteratorImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeListImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNodeVector.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNormalizer.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMNotationImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMParentNode.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMProcessingInstructionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMRangeImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMStringListImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMStringPool.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTextImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTreeWalkerImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMTypeInfoImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSSerializerImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSInputImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMLSOutputImpl.lo: xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathExpressionImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathNSResolverImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/DOMXPathResultImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/dom/impl/XSDElementNSImpl.lo: \ + xercesc/dom/impl/$(am__dirstamp) \ + xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework + @: > xercesc/framework/$(am__dirstamp) +xercesc/framework/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/$(DEPDIR) + @: > xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/BinOutputStream.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/LocalFileFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/LocalFileInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/MemBufFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/MemBufInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/psvi + @: > xercesc/framework/psvi/$(am__dirstamp) +xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/framework/psvi/$(DEPDIR) + @: > xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIAttribute.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIAttributeList.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIElement.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/PSVIItem.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAnnotation.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeGroupDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSAttributeUse.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSComplexTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSElementDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSFacet.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSIDCDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModel.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModelGroup.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSModelGroupDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSMultiValueFacet.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSNamespaceItem.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSNotationDeclaration.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSObject.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSParticle.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSSimpleTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSTypeDefinition.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSValue.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/psvi/XSWildcard.lo: \ + xercesc/framework/psvi/$(am__dirstamp) \ + xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/StdInInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/StdOutFormatTarget.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/URLInputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/Wrapper4DOMLSInput.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/Wrapper4InputSource.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttDef.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttDefList.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLAttr.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLBuffer.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLBufferMgr.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLContentModel.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLDTDDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLElementDecl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLEntityDecl.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLFormatter.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLGrammarDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLGrammarPoolImpl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLNotationDecl.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLRecognizer.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLRefInfo.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLSchemaDescription.lo: \ + xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/framework/XMLValidator.lo: xercesc/framework/$(am__dirstamp) \ + xercesc/framework/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/$(am__dirstamp): + @$(MKDIR_P) xercesc/internal + @: > xercesc/internal/$(am__dirstamp) +xercesc/internal/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/internal/$(DEPDIR) + @: > xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/BinFileOutputStream.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/BinMemOutputStream.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/DGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ElemStack.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/IGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/IGXMLScanner2.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/MemoryManagerImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ReaderMgr.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/SGXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/ValidationContextImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/VecAttributesImpl.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/VecAttrListImpl.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/WFXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLReader.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XMLScannerResolver.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XProtoType.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSAXMLScanner.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSerializeEngine.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XSObjectFactory.lo: xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/internal/XTemplateSerializer.lo: \ + xercesc/internal/$(am__dirstamp) \ + xercesc/internal/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/$(am__dirstamp): + @$(MKDIR_P) xercesc/parsers + @: > xercesc/parsers/$(am__dirstamp) +xercesc/parsers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/parsers/$(DEPDIR) + @: > xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/AbstractDOMParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/DOMLSParserImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAX2XMLFilterImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAX2XMLReaderImpl.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/SAXParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/parsers/XercesDOMParser.lo: xercesc/parsers/$(am__dirstamp) \ + xercesc/parsers/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax + @: > xercesc/sax/$(am__dirstamp) +xercesc/sax/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax/$(DEPDIR) + @: > xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/Dummy.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/InputSource.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/SAXException.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax/SAXParseException.lo: xercesc/sax/$(am__dirstamp) \ + xercesc/sax/$(DEPDIR)/$(am__dirstamp) +xercesc/sax2/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax2 + @: > xercesc/sax2/$(am__dirstamp) +xercesc/sax2/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/sax2/$(DEPDIR) + @: > xercesc/sax2/$(DEPDIR)/$(am__dirstamp) +xercesc/sax2/sax2Dummy.lo: xercesc/sax2/$(am__dirstamp) \ + xercesc/sax2/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/common + @: > xercesc/validators/common/$(am__dirstamp) +xercesc/validators/common/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/common/$(DEPDIR) + @: > xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/AllContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMAny.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMBinaryOp.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/CMUnaryOp.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/ContentLeafNameTypeVector.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/ContentSpecNode.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/DFAContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/Grammar.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/GrammarResolver.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/MixedContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/common/SimpleContentModel.lo: \ + xercesc/validators/common/$(am__dirstamp) \ + xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/datatype + @: > xercesc/validators/datatype/$(am__dirstamp) +xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/datatype/$(DEPDIR) + @: > xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractNumericFacetValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractNumericValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AbstractStringValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/AnyURIDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/BooleanDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DatatypeValidatorFactory.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateTimeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DateTimeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DayDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DecimalDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DoubleDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/DurationDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/ENTITYDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/FloatDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/HexBinaryDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/IDDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/IDREFDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/ListDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/MonthDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/MonthDayDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NCNameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/NOTATIONDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/QNameDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/StringDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/TimeDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/UnionDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/XMLCanRepGroup.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/YearDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/datatype/YearMonthDatatypeValidator.lo: \ + xercesc/validators/datatype/$(am__dirstamp) \ + xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/DTD + @: > xercesc/validators/DTD/$(am__dirstamp) +xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/DTD/$(DEPDIR) + @: > xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDAttDef.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDAttDefList.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDElementDecl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDEntityDecl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDGrammar.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDScanner.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/DTDValidator.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/DTD/XMLDTDDescriptionImpl.lo: \ + xercesc/validators/DTD/$(am__dirstamp) \ + xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema + @: > xercesc/validators/schema/$(am__dirstamp) +xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/$(DEPDIR) + @: > xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/ComplexTypeInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/GeneralAttributeCheck.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/identity + @: > xercesc/validators/schema/identity/$(am__dirstamp) +xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/validators/schema/identity/$(DEPDIR) + @: > xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/FieldActivator.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/FieldValueMap.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Field.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Key.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_KeyRef.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Selector.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IC_Unique.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IdentityConstraint.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/IdentityConstraintHandler.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/ValueStore.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/ValueStoreCache.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XercesXPath.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathMatcher.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathMatcherStack.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/identity/XPathSymbols.lo: \ + xercesc/validators/schema/identity/$(am__dirstamp) \ + xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/NamespaceScope.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaAttDef.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaAttDefList.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaElementDecl.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaGrammar.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaSymbols.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SchemaValidator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/SubstitutionGroupComparator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/TraverseSchema.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesAttGroupInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesElementWildcard.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XercesGroupInfo.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XMLSchemaDescriptionImpl.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDDOMParser.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDErrorReporter.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XSDLocator.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/validators/schema/XUtil.lo: \ + xercesc/validators/schema/$(am__dirstamp) \ + xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/$(am__dirstamp): + @$(MKDIR_P) xercesc/xinclude + @: > xercesc/xinclude/$(am__dirstamp) +xercesc/xinclude/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/xinclude/$(DEPDIR) + @: > xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeDOMDocumentProcessor.lo: \ + xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeLocation.lo: \ + xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/xinclude/XIncludeUtils.lo: xercesc/xinclude/$(am__dirstamp) \ + xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Curl + @: > xercesc/util/NetAccessors/Curl/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Curl/$(DEPDIR) + @: > xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo: \ + xercesc/util/NetAccessors/Curl/$(am__dirstamp) \ + xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo: \ + xercesc/util/NetAccessors/Curl/$(am__dirstamp) \ + xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Socket + @: > xercesc/util/NetAccessors/Socket/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/Socket/$(DEPDIR) + @: > xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo: \ + xercesc/util/NetAccessors/Socket/$(am__dirstamp) \ + xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo: \ + xercesc/util/NetAccessors/Socket/$(am__dirstamp) \ + xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors + @: > xercesc/util/NetAccessors/$(am__dirstamp) +xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/$(DEPDIR) + @: > xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo: \ + xercesc/util/NetAccessors/$(am__dirstamp) \ + xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/MacOSURLAccessCF + @: > xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) + @: > xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo: \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo: \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) \ + xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/WinSock + @: > xercesc/util/NetAccessors/WinSock/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/NetAccessors/WinSock/$(DEPDIR) + @: > xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo: \ + xercesc/util/NetAccessors/WinSock/$(am__dirstamp) \ + xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo: \ + xercesc/util/NetAccessors/WinSock/$(am__dirstamp) \ + xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/ICU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/ICU + @: > xercesc/util/Transcoders/ICU/$(am__dirstamp) +xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/ICU/$(DEPDIR) + @: > xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/ICU/ICUTransService.lo: \ + xercesc/util/Transcoders/ICU/$(am__dirstamp) \ + xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/IconvGNU + @: > xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) + @: > xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo: \ + xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) \ + xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Iconv + @: > xercesc/util/Transcoders/Iconv/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Iconv/$(DEPDIR) + @: > xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Iconv/IconvTransService.lo: \ + xercesc/util/Transcoders/Iconv/$(am__dirstamp) \ + xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/MacOSUnicodeConverter + @: > xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) + @: > xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo: xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) \ + xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Win32/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Win32 + @: > xercesc/util/Transcoders/Win32/$(am__dirstamp) +xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/Transcoders/Win32/$(DEPDIR) + @: > xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) +xercesc/util/Transcoders/Win32/Win32TransService.lo: \ + xercesc/util/Transcoders/Win32/$(am__dirstamp) \ + xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/InMemory + @: > xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) + @: > xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo: \ + xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) \ + xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/ICU + @: > xercesc/util/MsgLoaders/ICU/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/ICU/$(DEPDIR) + @: > xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo: \ + xercesc/util/MsgLoaders/ICU/$(am__dirstamp) \ + xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/MsgCatalog + @: > xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) + @: > xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo: \ + xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) \ + xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MutexManagers + @: > xercesc/util/MutexManagers/$(am__dirstamp) +xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/MutexManagers/$(DEPDIR) + @: > xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/NoThreadMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/PosixMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/MutexManagers/WindowsMutexMgr.lo: \ + xercesc/util/MutexManagers/$(am__dirstamp) \ + xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/FileManagers + @: > xercesc/util/FileManagers/$(am__dirstamp) +xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) xercesc/util/FileManagers/$(DEPDIR) + @: > xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/PosixFileMgr.lo: \ + xercesc/util/FileManagers/$(am__dirstamp) \ + xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +xercesc/util/FileManagers/WindowsFileMgr.lo: \ + xercesc/util/FileManagers/$(am__dirstamp) \ + xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) +libxerces-c.la: $(libxerces_c_la_OBJECTS) $(libxerces_c_la_DEPENDENCIES) + $(libxerces_c_la_LINK) -rpath $(libdir) $(libxerces_c_la_OBJECTS) $(libxerces_c_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f xercesc/dom/DOMException.$(OBJEXT) + -rm -f xercesc/dom/DOMException.lo + -rm -f xercesc/dom/DOMLSException.$(OBJEXT) + -rm -f xercesc/dom/DOMLSException.lo + -rm -f xercesc/dom/DOMRangeException.$(OBJEXT) + -rm -f xercesc/dom/DOMRangeException.lo + -rm -f xercesc/dom/DOMXPathException.$(OBJEXT) + -rm -f xercesc/dom/DOMXPathException.lo + -rm -f xercesc/dom/impl/DOMAttrImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrImpl.lo + -rm -f xercesc/dom/impl/DOMAttrMapImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrMapImpl.lo + -rm -f xercesc/dom/impl/DOMAttrNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMAttrNSImpl.lo + -rm -f xercesc/dom/impl/DOMCDATASectionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCDATASectionImpl.lo + -rm -f xercesc/dom/impl/DOMCharacterDataImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCharacterDataImpl.lo + -rm -f xercesc/dom/impl/DOMChildNode.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMChildNode.lo + -rm -f xercesc/dom/impl/DOMCommentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMCommentImpl.lo + -rm -f xercesc/dom/impl/DOMConfigurationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMConfigurationImpl.lo + -rm -f xercesc/dom/impl/DOMDeepNodeListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDeepNodeListImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentFragmentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentFragmentImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentImpl.lo + -rm -f xercesc/dom/impl/DOMDocumentTypeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMDocumentTypeImpl.lo + -rm -f xercesc/dom/impl/DOMElementImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMElementImpl.lo + -rm -f xercesc/dom/impl/DOMElementNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMElementNSImpl.lo + -rm -f xercesc/dom/impl/DOMEntityImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMEntityImpl.lo + -rm -f xercesc/dom/impl/DOMEntityReferenceImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMEntityReferenceImpl.lo + -rm -f xercesc/dom/impl/DOMErrorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMErrorImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationListImpl.lo + -rm -f xercesc/dom/impl/DOMImplementationRegistry.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMImplementationRegistry.lo + -rm -f xercesc/dom/impl/DOMLSInputImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSInputImpl.lo + -rm -f xercesc/dom/impl/DOMLSOutputImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSOutputImpl.lo + -rm -f xercesc/dom/impl/DOMLSSerializerImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLSSerializerImpl.lo + -rm -f xercesc/dom/impl/DOMLocatorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMLocatorImpl.lo + -rm -f xercesc/dom/impl/DOMNamedNodeMapImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNamedNodeMapImpl.lo + -rm -f xercesc/dom/impl/DOMNodeIDMap.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeIDMap.lo + -rm -f xercesc/dom/impl/DOMNodeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeImpl.lo + -rm -f xercesc/dom/impl/DOMNodeIteratorImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeIteratorImpl.lo + -rm -f xercesc/dom/impl/DOMNodeListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeListImpl.lo + -rm -f xercesc/dom/impl/DOMNodeVector.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNodeVector.lo + -rm -f xercesc/dom/impl/DOMNormalizer.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNormalizer.lo + -rm -f xercesc/dom/impl/DOMNotationImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMNotationImpl.lo + -rm -f xercesc/dom/impl/DOMParentNode.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMParentNode.lo + -rm -f xercesc/dom/impl/DOMProcessingInstructionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMProcessingInstructionImpl.lo + -rm -f xercesc/dom/impl/DOMRangeImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMRangeImpl.lo + -rm -f xercesc/dom/impl/DOMStringListImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMStringListImpl.lo + -rm -f xercesc/dom/impl/DOMStringPool.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMStringPool.lo + -rm -f xercesc/dom/impl/DOMTextImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTextImpl.lo + -rm -f xercesc/dom/impl/DOMTreeWalkerImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTreeWalkerImpl.lo + -rm -f xercesc/dom/impl/DOMTypeInfoImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMTypeInfoImpl.lo + -rm -f xercesc/dom/impl/DOMXPathExpressionImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathExpressionImpl.lo + -rm -f xercesc/dom/impl/DOMXPathNSResolverImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathNSResolverImpl.lo + -rm -f xercesc/dom/impl/DOMXPathResultImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/DOMXPathResultImpl.lo + -rm -f xercesc/dom/impl/XSDElementNSImpl.$(OBJEXT) + -rm -f xercesc/dom/impl/XSDElementNSImpl.lo + -rm -f xercesc/framework/BinOutputStream.$(OBJEXT) + -rm -f xercesc/framework/BinOutputStream.lo + -rm -f xercesc/framework/LocalFileFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/LocalFileFormatTarget.lo + -rm -f xercesc/framework/LocalFileInputSource.$(OBJEXT) + -rm -f xercesc/framework/LocalFileInputSource.lo + -rm -f xercesc/framework/MemBufFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/MemBufFormatTarget.lo + -rm -f xercesc/framework/MemBufInputSource.$(OBJEXT) + -rm -f xercesc/framework/MemBufInputSource.lo + -rm -f xercesc/framework/StdInInputSource.$(OBJEXT) + -rm -f xercesc/framework/StdInInputSource.lo + -rm -f xercesc/framework/StdOutFormatTarget.$(OBJEXT) + -rm -f xercesc/framework/StdOutFormatTarget.lo + -rm -f xercesc/framework/URLInputSource.$(OBJEXT) + -rm -f xercesc/framework/URLInputSource.lo + -rm -f xercesc/framework/Wrapper4DOMLSInput.$(OBJEXT) + -rm -f xercesc/framework/Wrapper4DOMLSInput.lo + -rm -f xercesc/framework/Wrapper4InputSource.$(OBJEXT) + -rm -f xercesc/framework/Wrapper4InputSource.lo + -rm -f xercesc/framework/XMLAttDef.$(OBJEXT) + -rm -f xercesc/framework/XMLAttDef.lo + -rm -f xercesc/framework/XMLAttDefList.$(OBJEXT) + -rm -f xercesc/framework/XMLAttDefList.lo + -rm -f xercesc/framework/XMLAttr.$(OBJEXT) + -rm -f xercesc/framework/XMLAttr.lo + -rm -f xercesc/framework/XMLBuffer.$(OBJEXT) + -rm -f xercesc/framework/XMLBuffer.lo + -rm -f xercesc/framework/XMLBufferMgr.$(OBJEXT) + -rm -f xercesc/framework/XMLBufferMgr.lo + -rm -f xercesc/framework/XMLContentModel.$(OBJEXT) + -rm -f xercesc/framework/XMLContentModel.lo + -rm -f xercesc/framework/XMLDTDDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLDTDDescription.lo + -rm -f xercesc/framework/XMLElementDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLElementDecl.lo + -rm -f xercesc/framework/XMLEntityDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLEntityDecl.lo + -rm -f xercesc/framework/XMLFormatter.$(OBJEXT) + -rm -f xercesc/framework/XMLFormatter.lo + -rm -f xercesc/framework/XMLGrammarDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLGrammarDescription.lo + -rm -f xercesc/framework/XMLGrammarPoolImpl.$(OBJEXT) + -rm -f xercesc/framework/XMLGrammarPoolImpl.lo + -rm -f xercesc/framework/XMLNotationDecl.$(OBJEXT) + -rm -f xercesc/framework/XMLNotationDecl.lo + -rm -f xercesc/framework/XMLRecognizer.$(OBJEXT) + -rm -f xercesc/framework/XMLRecognizer.lo + -rm -f xercesc/framework/XMLRefInfo.$(OBJEXT) + -rm -f xercesc/framework/XMLRefInfo.lo + -rm -f xercesc/framework/XMLSchemaDescription.$(OBJEXT) + -rm -f xercesc/framework/XMLSchemaDescription.lo + -rm -f xercesc/framework/XMLValidator.$(OBJEXT) + -rm -f xercesc/framework/XMLValidator.lo + -rm -f xercesc/framework/psvi/PSVIAttribute.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIAttribute.lo + -rm -f xercesc/framework/psvi/PSVIAttributeList.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIAttributeList.lo + -rm -f xercesc/framework/psvi/PSVIElement.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIElement.lo + -rm -f xercesc/framework/psvi/PSVIItem.$(OBJEXT) + -rm -f xercesc/framework/psvi/PSVIItem.lo + -rm -f xercesc/framework/psvi/XSAnnotation.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAnnotation.lo + -rm -f xercesc/framework/psvi/XSAttributeDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeDeclaration.lo + -rm -f xercesc/framework/psvi/XSAttributeGroupDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeGroupDefinition.lo + -rm -f xercesc/framework/psvi/XSAttributeUse.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSAttributeUse.lo + -rm -f xercesc/framework/psvi/XSComplexTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSComplexTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSElementDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSElementDeclaration.lo + -rm -f xercesc/framework/psvi/XSFacet.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSFacet.lo + -rm -f xercesc/framework/psvi/XSIDCDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSIDCDefinition.lo + -rm -f xercesc/framework/psvi/XSModel.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModel.lo + -rm -f xercesc/framework/psvi/XSModelGroup.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModelGroup.lo + -rm -f xercesc/framework/psvi/XSModelGroupDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSModelGroupDefinition.lo + -rm -f xercesc/framework/psvi/XSMultiValueFacet.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSMultiValueFacet.lo + -rm -f xercesc/framework/psvi/XSNamespaceItem.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSNamespaceItem.lo + -rm -f xercesc/framework/psvi/XSNotationDeclaration.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSNotationDeclaration.lo + -rm -f xercesc/framework/psvi/XSObject.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSObject.lo + -rm -f xercesc/framework/psvi/XSParticle.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSParticle.lo + -rm -f xercesc/framework/psvi/XSSimpleTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSSimpleTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSTypeDefinition.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSTypeDefinition.lo + -rm -f xercesc/framework/psvi/XSValue.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSValue.lo + -rm -f xercesc/framework/psvi/XSWildcard.$(OBJEXT) + -rm -f xercesc/framework/psvi/XSWildcard.lo + -rm -f xercesc/internal/BinFileOutputStream.$(OBJEXT) + -rm -f xercesc/internal/BinFileOutputStream.lo + -rm -f xercesc/internal/BinMemOutputStream.$(OBJEXT) + -rm -f xercesc/internal/BinMemOutputStream.lo + -rm -f xercesc/internal/DGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/DGXMLScanner.lo + -rm -f xercesc/internal/ElemStack.$(OBJEXT) + -rm -f xercesc/internal/ElemStack.lo + -rm -f xercesc/internal/IGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/IGXMLScanner.lo + -rm -f xercesc/internal/IGXMLScanner2.$(OBJEXT) + -rm -f xercesc/internal/IGXMLScanner2.lo + -rm -f xercesc/internal/MemoryManagerImpl.$(OBJEXT) + -rm -f xercesc/internal/MemoryManagerImpl.lo + -rm -f xercesc/internal/ReaderMgr.$(OBJEXT) + -rm -f xercesc/internal/ReaderMgr.lo + -rm -f xercesc/internal/SGXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/SGXMLScanner.lo + -rm -f xercesc/internal/ValidationContextImpl.$(OBJEXT) + -rm -f xercesc/internal/ValidationContextImpl.lo + -rm -f xercesc/internal/VecAttrListImpl.$(OBJEXT) + -rm -f xercesc/internal/VecAttrListImpl.lo + -rm -f xercesc/internal/VecAttributesImpl.$(OBJEXT) + -rm -f xercesc/internal/VecAttributesImpl.lo + -rm -f xercesc/internal/WFXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/WFXMLScanner.lo + -rm -f xercesc/internal/XMLReader.$(OBJEXT) + -rm -f xercesc/internal/XMLReader.lo + -rm -f xercesc/internal/XMLScanner.$(OBJEXT) + -rm -f xercesc/internal/XMLScanner.lo + -rm -f xercesc/internal/XMLScannerResolver.$(OBJEXT) + -rm -f xercesc/internal/XMLScannerResolver.lo + -rm -f xercesc/internal/XProtoType.$(OBJEXT) + -rm -f xercesc/internal/XProtoType.lo + -rm -f xercesc/internal/XSAXMLScanner.$(OBJEXT) + -rm -f xercesc/internal/XSAXMLScanner.lo + -rm -f xercesc/internal/XSObjectFactory.$(OBJEXT) + -rm -f xercesc/internal/XSObjectFactory.lo + -rm -f xercesc/internal/XSerializeEngine.$(OBJEXT) + -rm -f xercesc/internal/XSerializeEngine.lo + -rm -f xercesc/internal/XTemplateSerializer.$(OBJEXT) + -rm -f xercesc/internal/XTemplateSerializer.lo + -rm -f xercesc/parsers/AbstractDOMParser.$(OBJEXT) + -rm -f xercesc/parsers/AbstractDOMParser.lo + -rm -f xercesc/parsers/DOMLSParserImpl.$(OBJEXT) + -rm -f xercesc/parsers/DOMLSParserImpl.lo + -rm -f xercesc/parsers/SAX2XMLFilterImpl.$(OBJEXT) + -rm -f xercesc/parsers/SAX2XMLFilterImpl.lo + -rm -f xercesc/parsers/SAX2XMLReaderImpl.$(OBJEXT) + -rm -f xercesc/parsers/SAX2XMLReaderImpl.lo + -rm -f xercesc/parsers/SAXParser.$(OBJEXT) + -rm -f xercesc/parsers/SAXParser.lo + -rm -f xercesc/parsers/XercesDOMParser.$(OBJEXT) + -rm -f xercesc/parsers/XercesDOMParser.lo + -rm -f xercesc/sax/Dummy.$(OBJEXT) + -rm -f xercesc/sax/Dummy.lo + -rm -f xercesc/sax/InputSource.$(OBJEXT) + -rm -f xercesc/sax/InputSource.lo + -rm -f xercesc/sax/SAXException.$(OBJEXT) + -rm -f xercesc/sax/SAXException.lo + -rm -f xercesc/sax/SAXParseException.$(OBJEXT) + -rm -f xercesc/sax/SAXParseException.lo + -rm -f xercesc/sax2/sax2Dummy.$(OBJEXT) + -rm -f xercesc/sax2/sax2Dummy.lo + -rm -f xercesc/util/Base64.$(OBJEXT) + -rm -f xercesc/util/Base64.lo + -rm -f xercesc/util/BinFileInputStream.$(OBJEXT) + -rm -f xercesc/util/BinFileInputStream.lo + -rm -f xercesc/util/BinInputStream.$(OBJEXT) + -rm -f xercesc/util/BinInputStream.lo + -rm -f xercesc/util/BinMemInputStream.$(OBJEXT) + -rm -f xercesc/util/BinMemInputStream.lo + -rm -f xercesc/util/BitSet.$(OBJEXT) + -rm -f xercesc/util/BitSet.lo + -rm -f xercesc/util/DefaultPanicHandler.$(OBJEXT) + -rm -f xercesc/util/DefaultPanicHandler.lo + -rm -f xercesc/util/EncodingValidator.$(OBJEXT) + -rm -f xercesc/util/EncodingValidator.lo + -rm -f xercesc/util/FileManagers/PosixFileMgr.$(OBJEXT) + -rm -f xercesc/util/FileManagers/PosixFileMgr.lo + -rm -f xercesc/util/FileManagers/WindowsFileMgr.$(OBJEXT) + -rm -f xercesc/util/FileManagers/WindowsFileMgr.lo + -rm -f xercesc/util/HeaderDummy.$(OBJEXT) + -rm -f xercesc/util/HeaderDummy.lo + -rm -f xercesc/util/HexBin.$(OBJEXT) + -rm -f xercesc/util/HexBin.lo + -rm -f xercesc/util/KVStringPair.$(OBJEXT) + -rm -f xercesc/util/KVStringPair.lo + -rm -f xercesc/util/MsgLoaders/ICU/ICUMsgLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/ICU/ICUMsgLoader.lo + -rm -f xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.lo + -rm -f xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.$(OBJEXT) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.lo + -rm -f xercesc/util/MutexManagers/NoThreadMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/NoThreadMutexMgr.lo + -rm -f xercesc/util/MutexManagers/PosixMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/PosixMutexMgr.lo + -rm -f xercesc/util/MutexManagers/WindowsMutexMgr.$(OBJEXT) + -rm -f xercesc/util/MutexManagers/WindowsMutexMgr.lo + -rm -f xercesc/util/Mutexes.$(OBJEXT) + -rm -f xercesc/util/Mutexes.lo + -rm -f xercesc/util/NetAccessors/BinHTTPInputStreamCommon.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/BinHTTPInputStreamCommon.lo + -rm -f xercesc/util/NetAccessors/Curl/CurlNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Curl/CurlNetAccessor.lo + -rm -f xercesc/util/NetAccessors/Curl/CurlURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Curl/CurlURLInputStream.lo + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/MacOSURLAccessCF.lo + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/URLAccessCFBinInputStream.lo + -rm -f xercesc/util/NetAccessors/Socket/SocketNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Socket/SocketNetAccessor.lo + -rm -f xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.lo + -rm -f xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.lo + -rm -f xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.$(OBJEXT) + -rm -f xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.lo + -rm -f xercesc/util/PSVIUni.$(OBJEXT) + -rm -f xercesc/util/PSVIUni.lo + -rm -f xercesc/util/PanicHandler.$(OBJEXT) + -rm -f xercesc/util/PanicHandler.lo + -rm -f xercesc/util/PlatformUtils.$(OBJEXT) + -rm -f xercesc/util/PlatformUtils.lo + -rm -f xercesc/util/QName.$(OBJEXT) + -rm -f xercesc/util/QName.lo + -rm -f xercesc/util/StringPool.$(OBJEXT) + -rm -f xercesc/util/StringPool.lo + -rm -f xercesc/util/SynchronizedStringPool.$(OBJEXT) + -rm -f xercesc/util/SynchronizedStringPool.lo + -rm -f xercesc/util/TransService.$(OBJEXT) + -rm -f xercesc/util/TransService.lo + -rm -f xercesc/util/Transcoders/ICU/ICUTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/ICU/ICUTransService.lo + -rm -f xercesc/util/Transcoders/Iconv/IconvTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/Iconv/IconvTransService.lo + -rm -f xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.lo + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.$(OBJEXT) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.lo + -rm -f xercesc/util/Transcoders/Win32/Win32TransService.$(OBJEXT) + -rm -f xercesc/util/Transcoders/Win32/Win32TransService.lo + -rm -f xercesc/util/XML256TableTranscoder.$(OBJEXT) + -rm -f xercesc/util/XML256TableTranscoder.lo + -rm -f xercesc/util/XML88591Transcoder.$(OBJEXT) + -rm -f xercesc/util/XML88591Transcoder.lo + -rm -f xercesc/util/XMLASCIITranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLASCIITranscoder.lo + -rm -f xercesc/util/XMLAbstractDoubleFloat.$(OBJEXT) + -rm -f xercesc/util/XMLAbstractDoubleFloat.lo + -rm -f xercesc/util/XMLBigDecimal.$(OBJEXT) + -rm -f xercesc/util/XMLBigDecimal.lo + -rm -f xercesc/util/XMLBigInteger.$(OBJEXT) + -rm -f xercesc/util/XMLBigInteger.lo + -rm -f xercesc/util/XMLChTranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLChTranscoder.lo + -rm -f xercesc/util/XMLChar.$(OBJEXT) + -rm -f xercesc/util/XMLChar.lo + -rm -f xercesc/util/XMLDateTime.$(OBJEXT) + -rm -f xercesc/util/XMLDateTime.lo + -rm -f xercesc/util/XMLDouble.$(OBJEXT) + -rm -f xercesc/util/XMLDouble.lo + -rm -f xercesc/util/XMLEBCDICTranscoder.$(OBJEXT) + -rm -f xercesc/util/XMLEBCDICTranscoder.lo + -rm -f xercesc/util/XMLException.$(OBJEXT) + -rm -f xercesc/util/XMLException.lo + -rm -f xercesc/util/XMLFloat.$(OBJEXT) + -rm -f xercesc/util/XMLFloat.lo + -rm -f xercesc/util/XMLIBM1047Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLIBM1047Transcoder.lo + -rm -f xercesc/util/XMLIBM1140Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLIBM1140Transcoder.lo + -rm -f xercesc/util/XMLInitializer.$(OBJEXT) + -rm -f xercesc/util/XMLInitializer.lo + -rm -f xercesc/util/XMLMsgLoader.$(OBJEXT) + -rm -f xercesc/util/XMLMsgLoader.lo + -rm -f xercesc/util/XMLNumber.$(OBJEXT) + -rm -f xercesc/util/XMLNumber.lo + -rm -f xercesc/util/XMLString.$(OBJEXT) + -rm -f xercesc/util/XMLString.lo + -rm -f xercesc/util/XMLStringTokenizer.$(OBJEXT) + -rm -f xercesc/util/XMLStringTokenizer.lo + -rm -f xercesc/util/XMLUCS4Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUCS4Transcoder.lo + -rm -f xercesc/util/XMLURL.$(OBJEXT) + -rm -f xercesc/util/XMLURL.lo + -rm -f xercesc/util/XMLUTF16Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUTF16Transcoder.lo + -rm -f xercesc/util/XMLUTF8Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLUTF8Transcoder.lo + -rm -f xercesc/util/XMLUni.$(OBJEXT) + -rm -f xercesc/util/XMLUni.lo + -rm -f xercesc/util/XMLUri.$(OBJEXT) + -rm -f xercesc/util/XMLUri.lo + -rm -f xercesc/util/XMLWin1252Transcoder.$(OBJEXT) + -rm -f xercesc/util/XMLWin1252Transcoder.lo + -rm -f xercesc/util/XMemory.$(OBJEXT) + -rm -f xercesc/util/XMemory.lo + -rm -f xercesc/util/regx/ASCIIRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/ASCIIRangeFactory.lo + -rm -f xercesc/util/regx/BMPattern.$(OBJEXT) + -rm -f xercesc/util/regx/BMPattern.lo + -rm -f xercesc/util/regx/BlockRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/BlockRangeFactory.lo + -rm -f xercesc/util/regx/CharToken.$(OBJEXT) + -rm -f xercesc/util/regx/CharToken.lo + -rm -f xercesc/util/regx/ClosureToken.$(OBJEXT) + -rm -f xercesc/util/regx/ClosureToken.lo + -rm -f xercesc/util/regx/ConcatToken.$(OBJEXT) + -rm -f xercesc/util/regx/ConcatToken.lo + -rm -f xercesc/util/regx/Match.$(OBJEXT) + -rm -f xercesc/util/regx/Match.lo + -rm -f xercesc/util/regx/Op.$(OBJEXT) + -rm -f xercesc/util/regx/Op.lo + -rm -f xercesc/util/regx/OpFactory.$(OBJEXT) + -rm -f xercesc/util/regx/OpFactory.lo + -rm -f xercesc/util/regx/ParenToken.$(OBJEXT) + -rm -f xercesc/util/regx/ParenToken.lo + -rm -f xercesc/util/regx/ParserForXMLSchema.$(OBJEXT) + -rm -f xercesc/util/regx/ParserForXMLSchema.lo + -rm -f xercesc/util/regx/RangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/RangeFactory.lo + -rm -f xercesc/util/regx/RangeToken.$(OBJEXT) + -rm -f xercesc/util/regx/RangeToken.lo + -rm -f xercesc/util/regx/RangeTokenMap.$(OBJEXT) + -rm -f xercesc/util/regx/RangeTokenMap.lo + -rm -f xercesc/util/regx/RegularExpression.$(OBJEXT) + -rm -f xercesc/util/regx/RegularExpression.lo + -rm -f xercesc/util/regx/RegxParser.$(OBJEXT) + -rm -f xercesc/util/regx/RegxParser.lo + -rm -f xercesc/util/regx/RegxUtil.$(OBJEXT) + -rm -f xercesc/util/regx/RegxUtil.lo + -rm -f xercesc/util/regx/StringToken.$(OBJEXT) + -rm -f xercesc/util/regx/StringToken.lo + -rm -f xercesc/util/regx/Token.$(OBJEXT) + -rm -f xercesc/util/regx/Token.lo + -rm -f xercesc/util/regx/TokenFactory.$(OBJEXT) + -rm -f xercesc/util/regx/TokenFactory.lo + -rm -f xercesc/util/regx/UnicodeRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/UnicodeRangeFactory.lo + -rm -f xercesc/util/regx/UnionToken.$(OBJEXT) + -rm -f xercesc/util/regx/UnionToken.lo + -rm -f xercesc/util/regx/XMLRangeFactory.$(OBJEXT) + -rm -f xercesc/util/regx/XMLRangeFactory.lo + -rm -f xercesc/util/regx/XMLUniCharacter.$(OBJEXT) + -rm -f xercesc/util/regx/XMLUniCharacter.lo + -rm -f xercesc/validators/DTD/DTDAttDef.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDAttDef.lo + -rm -f xercesc/validators/DTD/DTDAttDefList.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDAttDefList.lo + -rm -f xercesc/validators/DTD/DTDElementDecl.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDElementDecl.lo + -rm -f xercesc/validators/DTD/DTDEntityDecl.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDEntityDecl.lo + -rm -f xercesc/validators/DTD/DTDGrammar.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDGrammar.lo + -rm -f xercesc/validators/DTD/DTDScanner.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDScanner.lo + -rm -f xercesc/validators/DTD/DTDValidator.$(OBJEXT) + -rm -f xercesc/validators/DTD/DTDValidator.lo + -rm -f xercesc/validators/DTD/XMLDTDDescriptionImpl.$(OBJEXT) + -rm -f xercesc/validators/DTD/XMLDTDDescriptionImpl.lo + -rm -f xercesc/validators/common/AllContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/AllContentModel.lo + -rm -f xercesc/validators/common/CMAny.$(OBJEXT) + -rm -f xercesc/validators/common/CMAny.lo + -rm -f xercesc/validators/common/CMBinaryOp.$(OBJEXT) + -rm -f xercesc/validators/common/CMBinaryOp.lo + -rm -f xercesc/validators/common/CMUnaryOp.$(OBJEXT) + -rm -f xercesc/validators/common/CMUnaryOp.lo + -rm -f xercesc/validators/common/ContentLeafNameTypeVector.$(OBJEXT) + -rm -f xercesc/validators/common/ContentLeafNameTypeVector.lo + -rm -f xercesc/validators/common/ContentSpecNode.$(OBJEXT) + -rm -f xercesc/validators/common/ContentSpecNode.lo + -rm -f xercesc/validators/common/DFAContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/DFAContentModel.lo + -rm -f xercesc/validators/common/Grammar.$(OBJEXT) + -rm -f xercesc/validators/common/Grammar.lo + -rm -f xercesc/validators/common/GrammarResolver.$(OBJEXT) + -rm -f xercesc/validators/common/GrammarResolver.lo + -rm -f xercesc/validators/common/MixedContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/MixedContentModel.lo + -rm -f xercesc/validators/common/SimpleContentModel.$(OBJEXT) + -rm -f xercesc/validators/common/SimpleContentModel.lo + -rm -f xercesc/validators/datatype/AbstractNumericFacetValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractNumericFacetValidator.lo + -rm -f xercesc/validators/datatype/AbstractNumericValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractNumericValidator.lo + -rm -f xercesc/validators/datatype/AbstractStringValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AbstractStringValidator.lo + -rm -f xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/AnyURIDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/AnyURIDatatypeValidator.lo + -rm -f xercesc/validators/datatype/Base64BinaryDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/Base64BinaryDatatypeValidator.lo + -rm -f xercesc/validators/datatype/BooleanDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/BooleanDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DatatypeValidator.lo + -rm -f xercesc/validators/datatype/DatatypeValidatorFactory.$(OBJEXT) + -rm -f xercesc/validators/datatype/DatatypeValidatorFactory.lo + -rm -f xercesc/validators/datatype/DateDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DateTimeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateTimeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DateTimeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DateTimeValidator.lo + -rm -f xercesc/validators/datatype/DayDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DayDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DecimalDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DecimalDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DoubleDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DoubleDatatypeValidator.lo + -rm -f xercesc/validators/datatype/DurationDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/DurationDatatypeValidator.lo + -rm -f xercesc/validators/datatype/ENTITYDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/ENTITYDatatypeValidator.lo + -rm -f xercesc/validators/datatype/FloatDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/FloatDatatypeValidator.lo + -rm -f xercesc/validators/datatype/HexBinaryDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/HexBinaryDatatypeValidator.lo + -rm -f xercesc/validators/datatype/IDDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/IDDatatypeValidator.lo + -rm -f xercesc/validators/datatype/IDREFDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/IDREFDatatypeValidator.lo + -rm -f xercesc/validators/datatype/ListDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/ListDatatypeValidator.lo + -rm -f xercesc/validators/datatype/MonthDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/MonthDatatypeValidator.lo + -rm -f xercesc/validators/datatype/MonthDayDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/MonthDayDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NCNameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NCNameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NOTATIONDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NOTATIONDatatypeValidator.lo + -rm -f xercesc/validators/datatype/NameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/NameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/QNameDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/QNameDatatypeValidator.lo + -rm -f xercesc/validators/datatype/StringDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/StringDatatypeValidator.lo + -rm -f xercesc/validators/datatype/TimeDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/TimeDatatypeValidator.lo + -rm -f xercesc/validators/datatype/UnionDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/UnionDatatypeValidator.lo + -rm -f xercesc/validators/datatype/XMLCanRepGroup.$(OBJEXT) + -rm -f xercesc/validators/datatype/XMLCanRepGroup.lo + -rm -f xercesc/validators/datatype/YearDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/YearDatatypeValidator.lo + -rm -f xercesc/validators/datatype/YearMonthDatatypeValidator.$(OBJEXT) + -rm -f xercesc/validators/datatype/YearMonthDatatypeValidator.lo + -rm -f xercesc/validators/schema/ComplexTypeInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/ComplexTypeInfo.lo + -rm -f xercesc/validators/schema/GeneralAttributeCheck.$(OBJEXT) + -rm -f xercesc/validators/schema/GeneralAttributeCheck.lo + -rm -f xercesc/validators/schema/NamespaceScope.$(OBJEXT) + -rm -f xercesc/validators/schema/NamespaceScope.lo + -rm -f xercesc/validators/schema/SchemaAttDef.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaAttDef.lo + -rm -f xercesc/validators/schema/SchemaAttDefList.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaAttDefList.lo + -rm -f xercesc/validators/schema/SchemaElementDecl.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaElementDecl.lo + -rm -f xercesc/validators/schema/SchemaGrammar.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaGrammar.lo + -rm -f xercesc/validators/schema/SchemaInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaInfo.lo + -rm -f xercesc/validators/schema/SchemaSymbols.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaSymbols.lo + -rm -f xercesc/validators/schema/SchemaValidator.$(OBJEXT) + -rm -f xercesc/validators/schema/SchemaValidator.lo + -rm -f xercesc/validators/schema/SubstitutionGroupComparator.$(OBJEXT) + -rm -f xercesc/validators/schema/SubstitutionGroupComparator.lo + -rm -f xercesc/validators/schema/TraverseSchema.$(OBJEXT) + -rm -f xercesc/validators/schema/TraverseSchema.lo + -rm -f xercesc/validators/schema/XMLSchemaDescriptionImpl.$(OBJEXT) + -rm -f xercesc/validators/schema/XMLSchemaDescriptionImpl.lo + -rm -f xercesc/validators/schema/XSDDOMParser.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDDOMParser.lo + -rm -f xercesc/validators/schema/XSDErrorReporter.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDErrorReporter.lo + -rm -f xercesc/validators/schema/XSDLocator.$(OBJEXT) + -rm -f xercesc/validators/schema/XSDLocator.lo + -rm -f xercesc/validators/schema/XUtil.$(OBJEXT) + -rm -f xercesc/validators/schema/XUtil.lo + -rm -f xercesc/validators/schema/XercesAttGroupInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesAttGroupInfo.lo + -rm -f xercesc/validators/schema/XercesElementWildcard.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesElementWildcard.lo + -rm -f xercesc/validators/schema/XercesGroupInfo.$(OBJEXT) + -rm -f xercesc/validators/schema/XercesGroupInfo.lo + -rm -f xercesc/validators/schema/identity/FieldActivator.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/FieldActivator.lo + -rm -f xercesc/validators/schema/identity/FieldValueMap.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/FieldValueMap.lo + -rm -f xercesc/validators/schema/identity/IC_Field.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Field.lo + -rm -f xercesc/validators/schema/identity/IC_Key.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Key.lo + -rm -f xercesc/validators/schema/identity/IC_KeyRef.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_KeyRef.lo + -rm -f xercesc/validators/schema/identity/IC_Selector.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Selector.lo + -rm -f xercesc/validators/schema/identity/IC_Unique.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IC_Unique.lo + -rm -f xercesc/validators/schema/identity/IdentityConstraint.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IdentityConstraint.lo + -rm -f xercesc/validators/schema/identity/IdentityConstraintHandler.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/IdentityConstraintHandler.lo + -rm -f xercesc/validators/schema/identity/ValueStore.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/ValueStore.lo + -rm -f xercesc/validators/schema/identity/ValueStoreCache.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/ValueStoreCache.lo + -rm -f xercesc/validators/schema/identity/XPathMatcher.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathMatcher.lo + -rm -f xercesc/validators/schema/identity/XPathMatcherStack.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathMatcherStack.lo + -rm -f xercesc/validators/schema/identity/XPathSymbols.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XPathSymbols.lo + -rm -f xercesc/validators/schema/identity/XercesXPath.$(OBJEXT) + -rm -f xercesc/validators/schema/identity/XercesXPath.lo + -rm -f xercesc/xinclude/XIncludeDOMDocumentProcessor.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeDOMDocumentProcessor.lo + -rm -f xercesc/xinclude/XIncludeLocation.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeLocation.lo + -rm -f xercesc/xinclude/XIncludeUtils.$(OBJEXT) + -rm -f xercesc/xinclude/XIncludeUtils.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stricmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strnicmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/towlower.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/towupper.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root_res.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xercesc_messages.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/$(DEPDIR)/DOMException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/$(DEPDIR)/DOMLSException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/$(DEPDIR)/DOMRangeException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/$(DEPDIR)/DOMXPathException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMAttrImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMAttrMapImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMAttrNSImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMCDATASectionImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMCharacterDataImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMChildNode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMCommentImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMConfigurationImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMDeepNodeListImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMDocumentFragmentImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMDocumentImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMDocumentTypeImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMElementImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMElementNSImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMEntityImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMEntityReferenceImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMErrorImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMImplementationImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMImplementationListImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMImplementationRegistry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMLSInputImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMLSOutputImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMLSSerializerImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMLocatorImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNamedNodeMapImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNodeIDMap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNodeImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNodeIteratorImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNodeListImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNodeVector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNormalizer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMNotationImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMParentNode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMProcessingInstructionImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMRangeImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMStringListImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMStringPool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMTextImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMTreeWalkerImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMTypeInfoImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMXPathExpressionImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMXPathNSResolverImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/DOMXPathResultImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/dom/impl/$(DEPDIR)/XSDElementNSImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/BinOutputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/LocalFileFormatTarget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/LocalFileInputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/MemBufFormatTarget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/MemBufInputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/StdInInputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/StdOutFormatTarget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/URLInputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/Wrapper4DOMLSInput.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/Wrapper4InputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLAttDef.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLAttDefList.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLAttr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLBuffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLBufferMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLContentModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLDTDDescription.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLElementDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLEntityDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLFormatter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLGrammarDescription.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLGrammarPoolImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLNotationDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLRecognizer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLRefInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLSchemaDescription.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/$(DEPDIR)/XMLValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/PSVIAttribute.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/PSVIAttributeList.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/PSVIElement.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/PSVIItem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSAnnotation.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSAttributeDeclaration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSAttributeGroupDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSAttributeUse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSComplexTypeDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSElementDeclaration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSFacet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSIDCDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSModelGroup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSModelGroupDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSMultiValueFacet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSNamespaceItem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSNotationDeclaration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSObject.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSParticle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSSimpleTypeDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSTypeDefinition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSValue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/framework/psvi/$(DEPDIR)/XSWildcard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/BinFileOutputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/BinMemOutputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/DGXMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/ElemStack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/IGXMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/IGXMLScanner2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/MemoryManagerImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/ReaderMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/SGXMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/ValidationContextImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/VecAttrListImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/VecAttributesImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/WFXMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XMLReader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XMLScannerResolver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XProtoType.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XSAXMLScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XSObjectFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XSerializeEngine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/internal/$(DEPDIR)/XTemplateSerializer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/AbstractDOMParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/DOMLSParserImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/SAX2XMLFilterImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/SAX2XMLReaderImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/SAXParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/parsers/$(DEPDIR)/XercesDOMParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/sax/$(DEPDIR)/Dummy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/sax/$(DEPDIR)/InputSource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/sax/$(DEPDIR)/SAXException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/sax/$(DEPDIR)/SAXParseException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/sax2/$(DEPDIR)/sax2Dummy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/Base64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/BinFileInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/BinInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/BinMemInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/BitSet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/DefaultPanicHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/EncodingValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/HeaderDummy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/HexBin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/KVStringPair.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/Mutexes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/PSVIUni.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/PanicHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/PlatformUtils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/QName.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/StringPool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/SynchronizedStringPool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/TransService.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XML256TableTranscoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XML88591Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLASCIITranscoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLAbstractDoubleFloat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLBigDecimal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLBigInteger.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLChTranscoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLChar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLDateTime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLDouble.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLEBCDICTranscoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLFloat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLIBM1047Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLIBM1140Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLInitializer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLMsgLoader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLNumber.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLString.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLStringTokenizer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLUCS4Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLURL.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLUTF16Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLUTF8Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLUni.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLUri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMLWin1252Transcoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/$(DEPDIR)/XMemory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/FileManagers/$(DEPDIR)/PosixFileMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/FileManagers/$(DEPDIR)/WindowsFileMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MsgLoaders/ICU/$(DEPDIR)/ICUMsgLoader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/InMemMsgLoader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/MsgCatalogLoader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MutexManagers/$(DEPDIR)/NoThreadMutexMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MutexManagers/$(DEPDIR)/PosixMutexMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/MutexManagers/$(DEPDIR)/WindowsMutexMgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/$(DEPDIR)/BinHTTPInputStreamCommon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/Curl/$(DEPDIR)/CurlNetAccessor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/Curl/$(DEPDIR)/CurlURLInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/MacOSURLAccessCF.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/URLAccessCFBinInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/Socket/$(DEPDIR)/SocketNetAccessor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/Socket/$(DEPDIR)/UnixHTTPURLInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/WinSock/$(DEPDIR)/BinHTTPURLInputStream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/NetAccessors/WinSock/$(DEPDIR)/WinSockNetAccessor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/Transcoders/ICU/$(DEPDIR)/ICUTransService.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/Transcoders/Iconv/$(DEPDIR)/IconvTransService.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/IconvGNUTransService.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/MacOSUnicodeConverter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/Transcoders/Win32/$(DEPDIR)/Win32TransService.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/ASCIIRangeFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/BMPattern.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/BlockRangeFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/CharToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/ClosureToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/ConcatToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/Match.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/Op.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/OpFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/ParenToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/ParserForXMLSchema.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RangeFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RangeToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RangeTokenMap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RegularExpression.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RegxParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/RegxUtil.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/StringToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/Token.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/TokenFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/UnicodeRangeFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/UnionToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/XMLRangeFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/util/regx/$(DEPDIR)/XMLUniCharacter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDAttDef.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDAttDefList.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDElementDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDEntityDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDGrammar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/DTDValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/DTD/$(DEPDIR)/XMLDTDDescriptionImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/AllContentModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/CMAny.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/CMBinaryOp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/CMUnaryOp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/ContentLeafNameTypeVector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/ContentSpecNode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/DFAContentModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/Grammar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/GrammarResolver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/MixedContentModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/common/$(DEPDIR)/SimpleContentModel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/AbstractNumericFacetValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/AbstractNumericValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/AbstractStringValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/AnySimpleTypeDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/AnyURIDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/Base64BinaryDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/BooleanDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DatatypeValidatorFactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DateDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DateTimeDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DateTimeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DayDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DecimalDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DoubleDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/DurationDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/ENTITYDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/FloatDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/HexBinaryDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/IDDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/IDREFDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/ListDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/MonthDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/MonthDayDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/NCNameDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/NOTATIONDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/NameDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/QNameDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/StringDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/TimeDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/UnionDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/XMLCanRepGroup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/YearDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/datatype/$(DEPDIR)/YearMonthDatatypeValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/ComplexTypeInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/GeneralAttributeCheck.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/NamespaceScope.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaAttDef.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaAttDefList.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaElementDecl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaGrammar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaSymbols.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SchemaValidator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/SubstitutionGroupComparator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/TraverseSchema.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XMLSchemaDescriptionImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XSDDOMParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XSDErrorReporter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XSDLocator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XUtil.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XercesAttGroupInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XercesElementWildcard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/$(DEPDIR)/XercesGroupInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/FieldActivator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/FieldValueMap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IC_Field.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IC_Key.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IC_KeyRef.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IC_Selector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IC_Unique.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IdentityConstraint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/IdentityConstraintHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/ValueStore.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/ValueStoreCache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/XPathMatcher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/XPathMatcherStack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/XPathSymbols.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/validators/schema/identity/$(DEPDIR)/XercesXPath.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/xinclude/$(DEPDIR)/XIncludeDOMDocumentProcessor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/xinclude/$(DEPDIR)/XIncludeLocation.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@xercesc/xinclude/$(DEPDIR)/XIncludeUtils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +@XERCES_PRETTY_MAKE_FALSE@.c.lo: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cpp.o: +@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +@XERCES_PRETTY_MAKE_FALSE@.cpp.lo: +@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf xercesc/dom/.libs xercesc/dom/_libs + -rm -rf xercesc/dom/impl/.libs xercesc/dom/impl/_libs + -rm -rf xercesc/framework/.libs xercesc/framework/_libs + -rm -rf xercesc/framework/psvi/.libs xercesc/framework/psvi/_libs + -rm -rf xercesc/internal/.libs xercesc/internal/_libs + -rm -rf xercesc/parsers/.libs xercesc/parsers/_libs + -rm -rf xercesc/sax/.libs xercesc/sax/_libs + -rm -rf xercesc/sax2/.libs xercesc/sax2/_libs + -rm -rf xercesc/util/.libs xercesc/util/_libs + -rm -rf xercesc/util/FileManagers/.libs xercesc/util/FileManagers/_libs + -rm -rf xercesc/util/MsgLoaders/ICU/.libs xercesc/util/MsgLoaders/ICU/_libs + -rm -rf xercesc/util/MsgLoaders/InMemory/.libs xercesc/util/MsgLoaders/InMemory/_libs + -rm -rf xercesc/util/MsgLoaders/MsgCatalog/.libs xercesc/util/MsgLoaders/MsgCatalog/_libs + -rm -rf xercesc/util/MutexManagers/.libs xercesc/util/MutexManagers/_libs + -rm -rf xercesc/util/NetAccessors/.libs xercesc/util/NetAccessors/_libs + -rm -rf xercesc/util/NetAccessors/Curl/.libs xercesc/util/NetAccessors/Curl/_libs + -rm -rf xercesc/util/NetAccessors/MacOSURLAccessCF/.libs xercesc/util/NetAccessors/MacOSURLAccessCF/_libs + -rm -rf xercesc/util/NetAccessors/Socket/.libs xercesc/util/NetAccessors/Socket/_libs + -rm -rf xercesc/util/NetAccessors/WinSock/.libs xercesc/util/NetAccessors/WinSock/_libs + -rm -rf xercesc/util/Transcoders/ICU/.libs xercesc/util/Transcoders/ICU/_libs + -rm -rf xercesc/util/Transcoders/Iconv/.libs xercesc/util/Transcoders/Iconv/_libs + -rm -rf xercesc/util/Transcoders/IconvGNU/.libs xercesc/util/Transcoders/IconvGNU/_libs + -rm -rf xercesc/util/Transcoders/MacOSUnicodeConverter/.libs xercesc/util/Transcoders/MacOSUnicodeConverter/_libs + -rm -rf xercesc/util/Transcoders/Win32/.libs xercesc/util/Transcoders/Win32/_libs + -rm -rf xercesc/util/regx/.libs xercesc/util/regx/_libs + -rm -rf xercesc/validators/DTD/.libs xercesc/validators/DTD/_libs + -rm -rf xercesc/validators/common/.libs xercesc/validators/common/_libs + -rm -rf xercesc/validators/datatype/.libs xercesc/validators/datatype/_libs + -rm -rf xercesc/validators/schema/.libs xercesc/validators/schema/_libs + -rm -rf xercesc/validators/schema/identity/.libs xercesc/validators/schema/identity/_libs + -rm -rf xercesc/xinclude/.libs xercesc/xinclude/_libs +install-nobase_libxerces_c_laHEADERS: $(nobase_libxerces_c_la_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(libxerces_c_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libxerces_c_ladir)" + @list='$(nobase_libxerces_c_la_HEADERS)'; test -n "$(libxerces_c_ladir)" || list=; \ + $(am__nobase_list) | while read dir files; do \ + xfiles=; for file in $$files; do \ + if test -f "$$file"; then xfiles="$$xfiles $$file"; \ + else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ + test -z "$$xfiles" || { \ + test "x$$dir" = x. || { \ + echo "$(MKDIR_P) '$(DESTDIR)$(libxerces_c_ladir)/$$dir'"; \ + $(MKDIR_P) "$(DESTDIR)$(libxerces_c_ladir)/$$dir"; }; \ + echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(libxerces_c_ladir)/$$dir'"; \ + $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(libxerces_c_ladir)/$$dir" || exit $$?; }; \ + done + +uninstall-nobase_libxerces_c_laHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nobase_libxerces_c_la_HEADERS)'; test -n "$(libxerces_c_ladir)" || list=; \ + $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libxerces_c_ladir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libxerces_c_ladir)" && rm -f $$files +install-nodist_autoconfheadersHEADERS: $(nodist_autoconfheaders_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(autoconfheadersdir)" || $(MKDIR_P) "$(DESTDIR)$(autoconfheadersdir)" + @list='$(nodist_autoconfheaders_HEADERS)'; test -n "$(autoconfheadersdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(autoconfheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(autoconfheadersdir)" || exit $$?; \ + done + +uninstall-nodist_autoconfheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_autoconfheaders_HEADERS)'; test -n "$(autoconfheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(autoconfheadersdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(autoconfheadersdir)" && rm -f $$files + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libxerces_c_ladir)" "$(DESTDIR)$(autoconfheadersdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f xercesc/dom/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/dom/$(am__dirstamp) + -rm -f xercesc/dom/impl/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/dom/impl/$(am__dirstamp) + -rm -f xercesc/framework/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/framework/$(am__dirstamp) + -rm -f xercesc/framework/psvi/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/framework/psvi/$(am__dirstamp) + -rm -f xercesc/internal/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/internal/$(am__dirstamp) + -rm -f xercesc/parsers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/parsers/$(am__dirstamp) + -rm -f xercesc/sax/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/sax/$(am__dirstamp) + -rm -f xercesc/sax2/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/sax2/$(am__dirstamp) + -rm -f xercesc/util/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/$(am__dirstamp) + -rm -f xercesc/util/FileManagers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/FileManagers/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/ICU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/ICU/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/InMemory/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/InMemory/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MsgLoaders/MsgCatalog/$(am__dirstamp) + -rm -f xercesc/util/MutexManagers/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/MutexManagers/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Curl/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Curl/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/MacOSURLAccessCF/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Socket/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/Socket/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/WinSock/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/NetAccessors/WinSock/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/ICU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/ICU/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Iconv/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Iconv/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/IconvGNU/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/IconvGNU/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/MacOSUnicodeConverter/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Win32/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/Transcoders/Win32/$(am__dirstamp) + -rm -f xercesc/util/regx/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/util/regx/$(am__dirstamp) + -rm -f xercesc/validators/DTD/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/DTD/$(am__dirstamp) + -rm -f xercesc/validators/common/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/common/$(am__dirstamp) + -rm -f xercesc/validators/datatype/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/datatype/$(am__dirstamp) + -rm -f xercesc/validators/schema/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/schema/$(am__dirstamp) + -rm -f xercesc/validators/schema/identity/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/validators/schema/identity/$(am__dirstamp) + -rm -f xercesc/xinclude/$(DEPDIR)/$(am__dirstamp) + -rm -f xercesc/xinclude/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) xercesc/dom/$(DEPDIR) xercesc/dom/impl/$(DEPDIR) xercesc/framework/$(DEPDIR) xercesc/framework/psvi/$(DEPDIR) xercesc/internal/$(DEPDIR) xercesc/parsers/$(DEPDIR) xercesc/sax/$(DEPDIR) xercesc/sax2/$(DEPDIR) xercesc/util/$(DEPDIR) xercesc/util/FileManagers/$(DEPDIR) xercesc/util/MsgLoaders/ICU/$(DEPDIR) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) xercesc/util/MutexManagers/$(DEPDIR) xercesc/util/NetAccessors/$(DEPDIR) xercesc/util/NetAccessors/Curl/$(DEPDIR) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) xercesc/util/NetAccessors/Socket/$(DEPDIR) xercesc/util/NetAccessors/WinSock/$(DEPDIR) xercesc/util/Transcoders/ICU/$(DEPDIR) xercesc/util/Transcoders/Iconv/$(DEPDIR) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) xercesc/util/Transcoders/Win32/$(DEPDIR) xercesc/util/regx/$(DEPDIR) xercesc/validators/DTD/$(DEPDIR) xercesc/validators/common/$(DEPDIR) xercesc/validators/datatype/$(DEPDIR) xercesc/validators/schema/$(DEPDIR) xercesc/validators/schema/identity/$(DEPDIR) xercesc/xinclude/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-nobase_libxerces_c_laHEADERS \ + install-nodist_autoconfheadersHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) xercesc/dom/$(DEPDIR) xercesc/dom/impl/$(DEPDIR) xercesc/framework/$(DEPDIR) xercesc/framework/psvi/$(DEPDIR) xercesc/internal/$(DEPDIR) xercesc/parsers/$(DEPDIR) xercesc/sax/$(DEPDIR) xercesc/sax2/$(DEPDIR) xercesc/util/$(DEPDIR) xercesc/util/FileManagers/$(DEPDIR) xercesc/util/MsgLoaders/ICU/$(DEPDIR) xercesc/util/MsgLoaders/InMemory/$(DEPDIR) xercesc/util/MsgLoaders/MsgCatalog/$(DEPDIR) xercesc/util/MutexManagers/$(DEPDIR) xercesc/util/NetAccessors/$(DEPDIR) xercesc/util/NetAccessors/Curl/$(DEPDIR) xercesc/util/NetAccessors/MacOSURLAccessCF/$(DEPDIR) xercesc/util/NetAccessors/Socket/$(DEPDIR) xercesc/util/NetAccessors/WinSock/$(DEPDIR) xercesc/util/Transcoders/ICU/$(DEPDIR) xercesc/util/Transcoders/Iconv/$(DEPDIR) xercesc/util/Transcoders/IconvGNU/$(DEPDIR) xercesc/util/Transcoders/MacOSUnicodeConverter/$(DEPDIR) xercesc/util/Transcoders/Win32/$(DEPDIR) xercesc/util/regx/$(DEPDIR) xercesc/validators/DTD/$(DEPDIR) xercesc/validators/common/$(DEPDIR) xercesc/validators/datatype/$(DEPDIR) xercesc/validators/schema/$(DEPDIR) xercesc/validators/schema/identity/$(DEPDIR) xercesc/xinclude/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES \ + uninstall-nobase_libxerces_c_laHEADERS \ + uninstall-nodist_autoconfheadersHEADERS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + ctags-recursive install install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nobase_libxerces_c_laHEADERS \ + install-nodist_autoconfheadersHEADERS install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-libLTLIBRARIES \ + uninstall-nobase_libxerces_c_laHEADERS \ + uninstall-nodist_autoconfheadersHEADERS + + +include ${top_srcdir}/version.incl +@XERCES_USE_MSGLOADER_ICU_TRUE@xercesc_messages.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt +@XERCES_USE_MSGLOADER_ICU_TRUE@ ${ICU_SBIN}gencmn --name ${PKGNAME} -S ${PKGNAME}_dat.c -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt +@XERCES_USE_MSGLOADER_ICU_TRUE@ @mv ${PKGNAME}_dat.c xercesc_messages.c + +@XERCES_USE_MSGLOADER_ICU_TRUE@root_res.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt +@XERCES_USE_MSGLOADER_ICU_TRUE@ ${ICU_BIN}genrb -d . ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt +@XERCES_USE_MSGLOADER_ICU_TRUE@ ${ICU_SBIN}genccode --name ${PKGNAME} -d . root.res + +# Override generated rules to provide prettier make rules +# +# Warning: If Automake changes sufficiently, these rules may need to +# be regenerated from the (new) default output of Automake +# + +@XERCES_PRETTY_MAKE_TRUE@.c.lo: +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCC_TRUE@ @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCC_TRUE@ then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +@XERCES_PRETTY_MAKE_TRUE@@AMDEP_TRUE@@am__fastdepCXX_FALSE@ @source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@XERCES_PRETTY_MAKE_TRUE@@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +@XERCES_PRETTY_MAKE_TRUE@.cpp.lo: +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCXX_TRUE@ @depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCXX_TRUE@ then $(am__mv) "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi +@XERCES_PRETTY_MAKE_TRUE@@AMDEP_TRUE@@am__fastdepCXX_FALSE@ @source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@XERCES_PRETTY_MAKE_TRUE@@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@XERCES_PRETTY_MAKE_TRUE@@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/project/jni/xerces/src/stricmp.c b/project/jni/xerces/src/stricmp.c new file mode 100644 index 000000000..33c028089 --- /dev/null +++ b/project/jni/xerces/src/stricmp.c @@ -0,0 +1,40 @@ +/* + * 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: stricmp.c 679398 2008-07-24 12:52:20Z borisk $ + */ + +#include "stricmp.h" +#include "config.h" + +#if HAVE_STRING_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif + +int stricmp(const char* str1, const char* str2) +{ +#if HAVE_STRCASECMP + return strcasecmp(str1, str2); +#else + #error Need implementation of stricmp compatibility function +#endif + +} diff --git a/project/jni/xerces/src/stricmp.h b/project/jni/xerces/src/stricmp.h new file mode 100644 index 000000000..205507c11 --- /dev/null +++ b/project/jni/xerces/src/stricmp.h @@ -0,0 +1,35 @@ +/* + * 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: stricmp.h 673966 2008-07-04 08:59:34Z borisk $ + */ + +#ifndef STRICMP_H +#define STRICMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern int stricmp(const char* str1, const char* str2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/jni/xerces/src/strnicmp.c b/project/jni/xerces/src/strnicmp.c new file mode 100644 index 000000000..f8b06b8cb --- /dev/null +++ b/project/jni/xerces/src/strnicmp.c @@ -0,0 +1,39 @@ +/* + * 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: strnicmp.c 679398 2008-07-24 12:52:20Z borisk $ + */ + +#include "strnicmp.h" +#include "config.h" + +#if HAVE_STRING_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif + +int strnicmp(const char* str1, const char* str2, size_t count) +{ +#if HAVE_STRNCASECMP + return (count == 0) ? 0 : strncasecmp( str1, str2, count); +#else + #error Need implementation of strnicmp compatibility function +#endif +} diff --git a/project/jni/xerces/src/strnicmp.h b/project/jni/xerces/src/strnicmp.h new file mode 100644 index 000000000..5f32bfc47 --- /dev/null +++ b/project/jni/xerces/src/strnicmp.h @@ -0,0 +1,37 @@ +/* + * 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: strnicmp.h 673966 2008-07-04 08:59:34Z borisk $ + */ + +#ifndef STRNICMP_H +#define STRNICMP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern int strnicmp(const char* str1, const char* str2, size_t count); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/jni/xerces/src/towlower.c b/project/jni/xerces/src/towlower.c new file mode 100644 index 000000000..be3aac340 --- /dev/null +++ b/project/jni/xerces/src/towlower.c @@ -0,0 +1,30 @@ +/* + * 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: towlower.c 631983 2008-02-28 14:30:15Z borisk $ + */ + +#include "towlower.h" + +int towlower(int wc) +{ + return (wc >= 'A') && (wc <= 'Z') + ? wc + 'a' - 'A' + : wc + ; +} diff --git a/project/jni/xerces/src/towlower.h b/project/jni/xerces/src/towlower.h new file mode 100644 index 000000000..24fb03e1d --- /dev/null +++ b/project/jni/xerces/src/towlower.h @@ -0,0 +1,35 @@ +/* + * 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: towlower.h 631983 2008-02-28 14:30:15Z borisk $ + */ + +#ifndef TOWLOWER_H +#define TOWLOWER_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern int towlower(int wc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/jni/xerces/src/towupper.c b/project/jni/xerces/src/towupper.c new file mode 100644 index 000000000..60b534af5 --- /dev/null +++ b/project/jni/xerces/src/towupper.c @@ -0,0 +1,30 @@ +/* + * 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: towupper.c 631983 2008-02-28 14:30:15Z borisk $ + */ + +#include "towupper.h" + +int towupper(int c) +{ + return (c >= 'a') && (c <= 'z') + ? c - 'a' + 'A' + : c + ; +} diff --git a/project/jni/xerces/src/towupper.h b/project/jni/xerces/src/towupper.h new file mode 100644 index 000000000..f6f39bfba --- /dev/null +++ b/project/jni/xerces/src/towupper.h @@ -0,0 +1,35 @@ +/* + * 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: towupper.h 631983 2008-02-28 14:30:15Z borisk $ + */ + +#ifndef TOWUPPER_H +#define TOWUPPER_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern int towupper(int wc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml b/project/jni/xerces/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml new file mode 100644 index 000000000..271f0086d --- /dev/null +++ b/project/jni/xerces/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml @@ -0,0 +1,846 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project/jni/xerces/src/xercesc/NLS/XMLErrList.dtd b/project/jni/xerces/src/xercesc/NLS/XMLErrList.dtd new file mode 100644 index 000000000..12357c837 --- /dev/null +++ b/project/jni/xerces/src/xercesc/NLS/XMLErrList.dtd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/project/jni/xerces/src/xercesc/dom/DOM.hpp b/project/jni/xerces/src/xercesc/dom/DOM.hpp new file mode 100644 index 000000000..1cf3dc2e6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOM.hpp @@ -0,0 +1,87 @@ +/* + * 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: DOM.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOM_HPP) +#define XERCESC_INCLUDE_GUARD_DOM_HPP + +// +// This is the primary header file for inclusion in application +// programs using the C++ XML Document Object Model API. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Introduced in DOM Level 2 +#include +#include +#include +#include +#include +#include +#include + +// Introduced in DOM Level 3 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMAttr.hpp b/project/jni/xerces/src/xercesc/dom/DOMAttr.hpp new file mode 100644 index 000000000..9f9494205 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMAttr.hpp @@ -0,0 +1,176 @@ +/* + * 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: DOMAttr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMATTR_HPP) +#define XERCESC_INCLUDE_GUARD_DOMATTR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElement; +class DOMTypeInfo; + +/** + * The DOMAttr class refers to an attribute of an XML element. + * + * Typically the allowable values for the + * attribute are defined in a documenttype definition. + *

DOMAttr objects inherit the DOMNode interface, but + * since attributes are not actually child nodes of the elements they are associated with, the + * DOM does not consider them part of the document tree. Thus, the + * DOMNode attributes parentNode, + * previousSibling, and nextSibling have a null + * value for DOMAttr objects. The DOM takes the view that + * attributes are properties of elements rather than having a separate + * identity from the elements they are associated with; this should make it + * more efficient to implement such features as default attributes associated + * with all elements of a given type. Furthermore, attribute nodes + * may not be immediate children of a DOMDocumentFragment. However, + * they can be associated with DOMElement nodes contained within a + * DOMDocumentFragment. In short, users of the DOM + * need to be aware that DOMAttr nodes have some things in common + * with other objects inheriting the DOMNode interface, but they + * also are quite distinct. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMAttr: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMAttr() {} + DOMAttr(const DOMAttr &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMAttr & operator = (const DOMAttr &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMAttr() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMAttr interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the name of this attribute. + * @since DOM Level 1 + */ + virtual const XMLCh * getName() const = 0; + + /** + * + * Returns true if the attribute received its value explicitly in the + * XML document, or if a value was assigned programatically with + * the setValue function. Returns false if the attribute value + * came from the default value declared in the document's DTD. + * @since DOM Level 1 + */ + virtual bool getSpecified() const = 0; + + /** + * Returns the value of the attribute. + * + * The value of the attribute is returned as a string. + * Character and general entity references are replaced with their values. + * @since DOM Level 1 + */ + virtual const XMLCh * getValue() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Sets the value of the attribute. A text node with the unparsed contents + * of the string will be created. + * + * @param value The value of the DOM attribute to be set + * @since DOM Level 1 + */ + virtual void setValue(const XMLCh *value) = 0; + //@} + + /** @name Functions introduced in DOM Level 2. */ + //@{ + /** + * The DOMElement node this attribute is attached to or + * null if this attribute is not in use. + * + * @since DOM Level 2 + */ + virtual DOMElement *getOwnerElement() const = 0; + //@} + + /** @name Functions introduced in DOM Level 3. */ + //@{ + /** + * Returns whether this attribute is known to be of type ID or not. + * When it is and its value is unique, the ownerElement of this attribute + * can be retrieved using getElementById on DOMDocument. + * + * @return bool stating if this DOMAttr is an ID + * @since DOM level 3 + */ + virtual bool isId() const = 0; + + + /** + * Returns the type information associated with this attribute. + * + * @return the DOMTypeInfo associated with this attribute + * @since DOM level 3 + */ + virtual const DOMTypeInfo * getSchemaTypeInfo() const = 0; + + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMCDATASection.hpp b/project/jni/xerces/src/xercesc/dom/DOMCDATASection.hpp new file mode 100644 index 000000000..624c6c221 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMCDATASection.hpp @@ -0,0 +1,104 @@ +/* + * 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: DOMCDATASection.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * CDATA sections are used to escape blocks of text containing characters that + * would otherwise be regarded as markup. The only delimiter that is + * recognized in a CDATA section is the "]]>" string that ends the CDATA + * section. CDATA sections cannot be nested. Their primary purpose is for + * including material such as XML fragments, without needing to escape all + * the delimiters. + *

The data attribute of the DOMText node holds + * the text that is contained by the CDATA section. Note that this may + * contain characters that need to be escaped outside of CDATA sections and + * that, depending on the character encoding ("charset") chosen for + * serialization, it may be impossible to write out some characters as part + * of a CDATA section. + *

The DOMCDATASection interface inherits from the + * DOMCharacterData interface through the DOMText + * interface. Adjacent DOMCDATASection nodes are not merged by use + * of the normalize method of the DOMNode interface. + * Because no markup is recognized within a DOMCDATASection, + * character numeric references cannot be used as an escape mechanism when + * serializing. Therefore, action needs to be taken when serializing a + * DOMCDATASection with a character encoding where some of the + * contained characters cannot be represented. Failure to do so would not + * produce well-formed XML.One potential solution in the serialization + * process is to end the CDATA section before the character, output the + * character using a character reference or entity reference, and open a new + * CDATA section for any further characters in the text node. Note, however, + * that some code conversion libraries at the time of writing do not return + * an error or exception when a character is missing from the encoding, + * making the task of ensuring that data is not corrupted on serialization + * more difficult. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMCDATASection: public DOMText { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMCDATASection() {} + DOMCDATASection(const DOMCDATASection &other) : DOMText(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMCDATASection & operator = (const DOMCDATASection &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMCDATASection() {}; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMCharacterData.hpp b/project/jni/xerces/src/xercesc/dom/DOMCharacterData.hpp new file mode 100644 index 000000000..9dc4f1c64 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMCharacterData.hpp @@ -0,0 +1,215 @@ +/* + * 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: DOMCharacterData.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * The DOMCharacterData interface extends DOMNode with a set of + * attributes and methods for accessing character data in the DOM. For + * clarity this set is defined here rather than on each object that uses + * these attributes and methods. No DOM objects correspond directly to + * DOMCharacterData, though DOMText and others do + * inherit the interface from it. All offsets in this interface + * start from 0. + *

As explained in the DOM spec, text strings in + * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In + * the following, the term 16-bit units is used whenever necessary to + * indicate that indexing on DOMCharacterData is done in 16-bit units. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMCharacterData: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMCharacterData() {} + DOMCharacterData(const DOMCharacterData &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMCharacterData & operator = (const DOMCharacterData &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMCharacterData() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMCharacterData interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the character data of the node that implements this interface. + * + * The DOM implementation may not put arbitrary limits on the amount of data that + * may be stored in a DOMCharacterData node. However, + * implementation limits may mean that the entirety of a node's data may + * not fit into a single XMLCh* String. In such cases, the user + * may call substringData to retrieve the data in + * appropriately sized pieces. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * @since DOM Level 1 + */ + virtual const XMLCh * getData() const = 0; + + /** + * Returns the number of characters that are available through data and + * the substringData method below. + * + * This may have the value + * zero, i.e., CharacterData nodes may be empty. + * @since DOM Level 1 + */ + virtual XMLSize_t getLength() const = 0; + + /** + * Extracts a range of data from the node. + * + * @param offset Start offset of substring to extract. + * @param count The number of characters to extract. + * @return The specified substring. If the sum of offset and + * count exceeds the length, then all + * characters to the end of the data are returned. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater + * than the number of characters in data, or if the + * specified count is negative. + * @since DOM Level 1 + */ + virtual const XMLCh * substringData(XMLSize_t offset, + XMLSize_t count) const = 0; + + // ----------------------------------------------------------------------- + // String methods + // ----------------------------------------------------------------------- + /** + * Append the string to the end of the character data of the node. + * + * Upon success, data provides access to the concatenation of + * data and the XMLCh* String specified. + * @param arg The XMLCh* String to append. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void appendData(const XMLCh *arg) = 0; + + /** + * Insert a string at the specified character offset. + * + * @param offset The character offset at which to insert. + * @param arg The XMLCh* String to insert. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater + * than the number of characters in data. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void insertData(XMLSize_t offset, const XMLCh *arg) = 0; + + /** + * Remove a range of characters from the node. + * + * Upon success, + * data and length reflect the change. + * @param offset The offset from which to remove characters. + * @param count The number of characters to delete. If the sum of + * offset and count exceeds length + * then all characters from offset to the end of the data + * are deleted. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater + * than the number of characters in data, or if the + * specified count is negative. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void deleteData(XMLSize_t offset, + XMLSize_t count) = 0; + + /** + * Replace the characters starting at the specified character offset with + * the specified string. + * + * @param offset The offset from which to start replacing. + * @param count The number of characters to replace. If the sum of + * offset and count exceeds length + * , then all characters to the end of the data are replaced (i.e., the + * effect is the same as a remove method call with the same + * range, followed by an append method invocation). + * @param arg The XMLCh* String with which the range must be + * replaced. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater + * than the number of characters in data, or if the + * specified count is negative. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void replaceData(XMLSize_t offset, + XMLSize_t count, + const XMLCh *arg) = 0; + + /** + * Sets the character data of the node that implements this interface. + * + * @param data The XMLCh* String to set. + * @since DOM Level 1 + */ + virtual void setData(const XMLCh *data) = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMComment.hpp b/project/jni/xerces/src/xercesc/dom/DOMComment.hpp new file mode 100644 index 000000000..96d197d39 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMComment.hpp @@ -0,0 +1,76 @@ +/* + * 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: DOMComment.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * This interface inherits from CharacterData and represents the + * content of a comment, i.e., all the characters between the starting ' + * <!--' and ending '-->'. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMComment: public DOMCharacterData { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMComment() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMComment(const DOMComment &); + DOMComment & operator = (const DOMComment &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMComment() {}; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/DOMConfiguration.hpp b/project/jni/xerces/src/xercesc/dom/DOMConfiguration.hpp new file mode 100644 index 000000000..bbd88092e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMConfiguration.hpp @@ -0,0 +1,454 @@ +/* + * 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. + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The DOMConfiguration interface represents the configuration of + * a document and maintains a table of recognized parameters. + * Using the configuration, it is possible to change + * Document.normalizeDocument behavior, such as replacing + * CDATASection nodes with Text nodes or + * specifying the type of the schema that must be used when the + * validation of the Document is requested. DOMConfiguration + * objects are also used in [DOM Level 3 Load and Save] in + * the DOMLSParser and DOMLSSerializer interfaces. + * + * The DOMConfiguration distinguish two types of parameters: + * boolean (boolean parameters) and DOMUserData + * (parameters). The names used by the DOMConfiguration object are + * defined throughout the DOM Level 3 specifications. Names are + * case-insensitive. To avoid possible conflicts, as a + * convention, names referring to boolean parameters and + * parameters defined outside the DOM specification should be made + * unique. Names are recommended to follow the XML name + * production rule but it is not enforced by the DOM + * implementation. DOM Level 3 Core Implementations are required + * to recognize all boolean parameters and parameters defined in + * this specification. Each boolean parameter state or parameter + * value may then be supported or not by the implementation. Refer + * to their definition to know if a state or a value must be + * supported or not. + * + * Note: Parameters are similar to features and properties used in + * SAX2 [SAX]. + * + * The following list of parameters defined in the DOM: + * + * "error-handler" + * [required] + * A DOMErrorHandler object. If an error is + * encountered in the document, the implementation will call + * back the DOMErrorHandler registered using this + * parameter. + * When called, DOMError.relatedData will contain the + * closest node to where the error occured. If the + * implementation is unable to determine the node where the + * error occurs, DOMError.relatedData will contain the + * Document node. Mutations to the document from + * within an error handler will result in implementation + * dependent behaviour. + * + * "schema-type" + * [optional] + * A DOMString object containing an absolute URI and + * representing the type of the schema language used to + * validate a document against. Note that no lexical + * checking is done on the absolute URI. + * If this parameter is not set, a default value may be + * provided by the implementation, based on the schema + * languages supported and on the schema language used at + * load time. + * + * Note: For XML Schema [XML Schema Part 1], + * applications must use the value + * "http://www.w3.org/2001/XMLSchema". For XML DTD + * [XML 1.0], applications must use the value + * "http://www.w3.org/TR/REC-xml". Other schema languages + * are outside the scope of the W3C and therefore should + * recommend an absolute URI in order to use this method. + * + * "schema-location" + * [optional] + * A DOMString object containing a list of URIs, + * separated by white spaces (characters matching the + * nonterminal production S defined in section 2.3 + * [XML 1.0]), that represents the schemas against + * which validation should occur. The types of schemas + * referenced in this list must match the type specified + * with schema-type, otherwise the behaviour of an + * implementation is undefined. If the schema type is XML + * Schema [XML Schema Part 1], only one of the XML + * Schemas in the list can be with no namespace. + * If validation occurs against a namespace aware schema, + * i.e. XML Schema, and the targetNamespace of a schema + * (specified using this property) matches the + * targetNamespace of a schema occurring in the instance + * document, i.e in schemaLocation attribute, the schema + * specified by the user using this property will be used + * (i.e., in XML Schema the schemaLocation attribute in the + * instance document or on the import element will be + * effectively ignored). + * + * Note: It is illegal to set the schema-location parameter + * if the schema-type parameter value is not set. It is + * strongly recommended that DOMInputSource.baseURI will be + * set, so that an implementation can successfully resolve + * any external entities referenced. + * + * The following list of boolean parameters (features) defined in + * the DOM: + * + * "canonical-form" + * + * true + * [optional] + * Canonicalize the document according to the rules + * specified in [Canonical XML]. Note that this + * is limited to what can be represented in the DOM. + * In particular, there is no way to specify the order + * of the attributes in the DOM. + * + * false + * [required] (default) + * Do not canonicalize the document. + * + * "cdata-sections" + * + * true + * [required] (default) + * Keep CDATASection nodes in the document. + * + * false + * [required] + * Transform CDATASection nodes in the document + * into Text nodes. The new Text node is + * then combined with any adjacent Text node. + * + * "comments" + * + * true + * [required] (default) + * Keep Comment nodes in the document. + * + * false + * [required] + * Discard Comment nodes in the Document. + * + * "datatype-normalization" + * + * true + * [required] + * Exposed normalized values in the tree. + * + * false + * [required] (default) + * Do not perform normalization on the tree. + * + * "discard-default-content" + * + * true + * [required] (default) + * Use whatever information available to the + * implementation (i.e. XML schema, DTD, the specified + * flag on Attr nodes, and so on) to decide what + * attributes and content should be discarded or not. + * Note that the specified flag on Attr nodes in + * itself is not always reliable, it is only reliable + * when it is set to false since the only case where + * it can be set to false is if the attribute was + * created by the implementation. The default content + * won't be removed if an implementation does not have + * any information available. + * + * false + * [required] + * Keep all attributes and all content. + * + * "entities" + * + * true + * [required] + * Keep EntityReference and Entity nodes + * in the document. + * + * false + * [required] (default) + * Remove all EntityReference and Entity + * nodes from the document, putting the entity + * expansions directly in their place. Text + * nodes are into "normal" form. Only + * EntityReference nodes to non-defined entities + * are kept in the document. + * + * "infoset" + * + * true + * [required] + * Only keep in the document the information defined + * in the XML Information Set [XML Information + * set]. + * This forces the following features to false: + * namespace-declarations, validate-if-schema, + * entities, datatype-normalization, cdata-sections. + * This forces the following features to true: + * whitespace-in-element-content, comments, + * namespaces. + * Other features are not changed unless explicitly + * specified in the description of the features. + * Note that querying this feature with getFeature + * returns true only if the individual features + * specified above are appropriately set. + * + * false + * Setting infoset to false has no effect. + * + * "namespaces" + * + * true + * [required] (default) + * Perform the namespace processing as defined in + * [XML Namespaces]. + * + * false + * [optional] + * Do not perform the namespace processing. + * + * "namespace-declarations" + * + * true + * [required] (default) + * Include namespace declaration attributes, specified + * or defaulted from the schema or the DTD, in the + * document. See also the section Declaring + * Namespaces in [XML Namespaces]. + * + * false + * [required] + * Discard all namespace declaration attributes. The + * Namespace prefixes are retained even if this + * feature is set to false. + * + * "normalize-characters" + * + * true + * [optional] + * Perform the W3C Text Normalization of the + * characters [CharModel] in the document. + * + * false + * [required] (default) + * Do not perform character normalization. + * + * "split-cdata-sections" + * + * true + * [required] (default) + * Split CDATA sections containing the CDATA section + * termination marker ']]>'. When a CDATA section is + * split a warning is issued. + * + * false + * [required] + * Signal an error if a CDATASection contains an + * unrepresentable character. + * + * "validate" + * + * true + * [optional] + * Require the validation against a schema (i.e. XML + * schema, DTD, any other type or representation of + * schema) of the document as it is being normalized + * as defined by [XML 1.0]. If validation errors + * are found, or no schema was found, the error + * handler is notified. Note also that normalized + * values will not be exposed to the schema in used + * unless the feature datatype-normalization is true. + * + * Note: validate-if-schema and validate are mutually + * exclusive, setting one of them to true will set the + * other one to false. + * + * false + * [required] (default) + * Only XML 1.0 non-validating processing must be + * done. Note that validation might still happen if + * validate-if-schema is true. + * + * "validate-if-schema" + * + * true + * [optional] + * Enable validation only if a declaration for the + * document element can be found (independently of + * where it is found, i.e. XML schema, DTD, or any + * other type or representation of schema). If + * validation errors are found, the error handler is + * notified. Note also that normalized values will not + * be exposed to the schema in used unless the feature + * datatype-normalization is true. + * + * Note: validate-if-schema and validate are mutually + * exclusive, setting one of them to true will set the + * other one to false. + * + * false + * [required] (default) + * No validation should be performed if the document + * has a schema. Note that validation must still + * happen if validate is true. + * + * "element-content-whitespace" + * + * true + * [required] (default) + * Keep all white spaces in the document. + * + * false + * [optional] + * Discard white space in element content while + * normalizing. The implementation is expected to use + * the isWhitespaceInElementContent flag on Text + * nodes to determine if a text node should be written + * out or not. + * + * The resolutions of entities is done using Document.baseURI. + * However, when the features "LS-Load" or "LS-Save" defined in + * [DOM Level 3 Load and Save] are supported by the DOM + * implementation, the parameter "entity-resolver" can also be + * used on DOMConfiguration objects attached to Document + * nodes. If this parameter is set, + * Document.normalizeDocument will invoke the entity + * resolver instead of using Document.baseURI. + */ +class CDOM_EXPORT DOMConfiguration +{ +protected: + //----------------------------------------------------------------------------------- + // Constructor + //----------------------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMConfiguration() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMConfiguration(const DOMConfiguration &); + DOMConfiguration & operator = (const DOMConfiguration &); + //@} + +public: + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** Set the value of a parameter. + * @param name The name of the parameter to set. + * @param value The new value or null if the user wishes to unset the + * parameter. While the type of the value parameter is defined as + * DOMUserData, the object type must match the type defined + * by the definition of the parameter. For example, if the parameter is + * "error-handler", the value must be of type DOMErrorHandler + * @exception DOMException (NOT_SUPPORTED_ERR) Raised when the + * parameter name is recognized but the requested value cannot be set. + * @exception DOMException (NOT_FOUND_ERR) Raised when the + * parameter name is not recognized. + * @since DOM level 3 + **/ + virtual void setParameter(const XMLCh* name, const void* value) = 0; + virtual void setParameter(const XMLCh* name, bool value) = 0; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** Return the value of a parameter if known. + * @param name The name of the parameter. + * @return The current object associated with the specified parameter or + * null if no object has been associated or if the parameter is not + * supported. + * @exception DOMException (NOT_FOUND_ERR) Raised when the i + * boolean parameter + * name is not recognized. + * @since DOM level 3 + **/ + virtual const void* getParameter(const XMLCh* name) const = 0; + + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + + /** Check if setting a parameter to a specific value is supported. + * @param name The name of the parameter to check. + * @param value An object. if null, the returned value is true. + * @return true if the parameter could be successfully set to the specified + * value, or false if the parameter is not recognized or the requested value + * is not supported. This does not change the current value of the parameter + * itself. + * @since DOM level 3 + **/ + virtual bool canSetParameter(const XMLCh* name, const void* value) const = 0; + virtual bool canSetParameter(const XMLCh* name, bool value) const = 0; + + /** + * The list of the parameters supported by this DOMConfiguration object and + * for which at least one value can be set by the application. + * Note that this list can also contain parameter names defined outside this specification. + * + * @return The list of parameters that can be used with setParameter/getParameter + * @since DOM level 3 + **/ + virtual const DOMStringList* getParameterNames() const = 0; + + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMConfiguration() {}; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMConfiguration.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/DOMDocument.hpp b/project/jni/xerces/src/xercesc/dom/DOMDocument.hpp new file mode 100644 index 000000000..1505b7d04 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMDocument.hpp @@ -0,0 +1,819 @@ +/* + * 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: DOMDocument.hpp 932887 2010-04-11 13:04:59Z borisk $ +*/ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMConfiguration; +class DOMDocumentType; +class DOMElement; +class DOMDocumentFragment; +class DOMComment; +class DOMCDATASection; +class DOMProcessingInstruction; +class DOMAttr; +class DOMEntity; +class DOMEntityReference; +class DOMImplementation; +class DOMNodeFilter; +class DOMNodeList; +class DOMNotation; +class DOMText; +class DOMNode; + + +/** + * The DOMDocument interface represents the entire XML + * document. Conceptually, it is the root of the document tree, and provides + * the primary access to the document's data. + *

Since elements, text nodes, comments, processing instructions, etc. + * cannot exist outside the context of a DOMDocument, the + * DOMDocument interface also contains the factory methods needed + * to create these objects. The DOMNode objects created have a + * ownerDocument attribute which associates them with the + * DOMDocument within whose context they were created. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + */ + +class CDOM_EXPORT DOMDocument: public DOMDocumentRange, + public DOMXPathEvaluator, + public DOMDocumentTraversal, + public DOMNode { + + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMDocument() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMDocument(const DOMDocument &); + DOMDocument & operator = (const DOMDocument &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMDocument() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMDocument interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + /** + * Creates an element of the type specified. Note that the instance + * returned implements the DOMElement interface, so attributes + * can be specified directly on the returned object. + *
In addition, if there are known attributes with default values, + * DOMAttr nodes representing them are automatically created + * and attached to the element. + *
To create an element with a qualified name and namespace URI, use + * the createElementNS method. + * @param tagName The name of the element type to instantiate. For XML, + * this is case-sensitive. + * @return A new DOMElement object with the + * nodeName attribute set to tagName, and + * localName, prefix, and + * namespaceURI set to null. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified name contains an + * illegal character. + * @since DOM Level 1 + */ + virtual DOMElement *createElement(const XMLCh *tagName) = 0; + + /** + * Creates an empty DOMDocumentFragment object. + * @return A new DOMDocumentFragment. + * @since DOM Level 1 + */ + virtual DOMDocumentFragment *createDocumentFragment() = 0; + + /** + * Creates a DOMText node given the specified string. + * @param data The data for the node. + * @return The new DOMText object. + * @since DOM Level 1 + */ + virtual DOMText *createTextNode(const XMLCh *data) = 0; + + /** + * Creates a DOMComment node given the specified string. + * @param data The data for the node. + * @return The new DOMComment object. + * @since DOM Level 1 + */ + virtual DOMComment *createComment(const XMLCh *data) = 0; + + /** + * Creates a DOMCDATASection node whose value is the specified + * string. + * @param data The data for the DOMCDATASection contents. + * @return The new DOMCDATASection object. + * @since DOM Level 1 + */ + virtual DOMCDATASection *createCDATASection(const XMLCh *data) = 0; + + /** + * Creates a DOMProcessingInstruction node given the specified + * name and data strings. + * @param target The target part of the processing instruction. + * @param data The data for the node. + * @return The new DOMProcessingInstruction object. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified target contains an + * illegal character. + * @since DOM Level 1 + */ + virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target, + const XMLCh *data) = 0; + + + /** + * Creates an DOMAttr of the given name. Note that the + * DOMAttr instance can then be set on an DOMElement + * using the setAttributeNode method. + *
To create an attribute with a qualified name and namespace URI, use + * the createAttributeNS method. + * @param name The name of the attribute. + * @return A new DOMAttr object with the nodeName + * attribute set to name, and localName, + * prefix, and namespaceURI set to + * null. The value of the attribute is the empty string. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified name contains an + * illegal character. + * @since DOM Level 1 + */ + virtual DOMAttr *createAttribute(const XMLCh *name) = 0; + + + /** + * Creates an DOMEntityReference object. In addition, if the + * referenced entity is known, the child list of the + * DOMEntityReference node is made the same as that of the + * corresponding DOMEntity node.If any descendant of the + * DOMEntity node has an unbound namespace prefix, the + * corresponding descendant of the created DOMEntityReference + * node is also unbound; (its namespaceURI is + * null). The DOM Level 2 does not support any mechanism to + * resolve namespace prefixes. + * @param name The name of the entity to reference. + * @return The new DOMEntityReference object. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified name contains an + * illegal character. + * @since DOM Level 1 + */ + virtual DOMEntityReference *createEntityReference(const XMLCh *name) = 0; + + /** + * The Document Type Declaration (see DOMDocumentType) + * associated with this document. For XML + * documents without a document type declaration this returns + * null. The DOM Level 2 does not support editing the + * Document Type Declaration. docType cannot be altered in + * any way, including through the use of methods inherited from the + * DOMNode interface, such as insertNode or + * removeNode. + * @since DOM Level 1 + */ + virtual DOMDocumentType *getDoctype() const = 0; + + /** + * The DOMImplementation object that handles this document. A + * DOM application may use objects from multiple implementations. + * @since DOM Level 1 + */ + virtual DOMImplementation *getImplementation() const = 0; + + /** + * This is a convenience attribute that allows direct access to the child + * node that is the root element of the document. + * @since DOM Level 1 + */ + virtual DOMElement *getDocumentElement() const = 0; + + /** + * Returns a DOMNodeList of all the DOMElement(s) with a + * given tag name in the order in which they are encountered in a + * preorder traversal of the DOMDocument tree. + * + * The returned node list is "live", in that changes + * to the document tree made after a nodelist was initially + * returned will be immediately reflected in the node list. + * @param tagname The name of the tag to match on. The special value "*" + * matches all tags. + * @return A new DOMNodeList object containing all the matched + * DOMElement(s). + * @since DOM Level 1 + */ + virtual DOMNodeList *getElementsByTagName(const XMLCh *tagname) const = 0; + + //@} + + /** @name Functions introduced in DOM Level 2. */ + //@{ + + /** + * Imports a node from another document to this document. The returned + * node has no parent; (parentNode is null). + * The source node is not altered or removed from the original document; + * this method creates a new copy of the source node. + *
For all nodes, importing a node creates a node object owned by the + * importing document, with attribute values identical to the source + * node's nodeName and nodeType, plus the + * attributes related to namespaces (prefix, + * localName, and namespaceURI). As in the + * cloneNode operation on a DOMNode, the source + * node is not altered. + *
Additional information is copied as appropriate to the + * nodeType, attempting to mirror the behavior expected if + * a fragment of XML source was copied from one document to + * another, recognizing that the two documents may have different DTDs + * in the XML case. The following list describes the specifics for each + * type of node. + *

+ *
ATTRIBUTE_NODE
+ *
The ownerElement attribute + * is set to null and the specified flag is + * set to true on the generated DOMAttr. The + * descendants of the source DOMAttr are recursively imported + * and the resulting nodes reassembled to form the corresponding subtree. + * Note that the deep parameter has no effect on + * DOMAttr nodes; they always carry their children with them + * when imported.
+ *
DOCUMENT_FRAGMENT_NODE
+ *
If the deep option + * was set to true, the descendants of the source element + * are recursively imported and the resulting nodes reassembled to form + * the corresponding subtree. Otherwise, this simply generates an empty + * DOMDocumentFragment.
+ *
DOCUMENT_NODE
+ *
DOMDocument + * nodes cannot be imported.
+ *
DOCUMENT_TYPE_NODE
+ *
DOMDocumentType + * nodes cannot be imported.
+ *
ELEMENT_NODE
+ *
Specified attribute nodes of the + * source element are imported, and the generated DOMAttr + * nodes are attached to the generated DOMElement. Default + * attributes are not copied, though if the document being imported into + * defines default attributes for this element name, those are assigned. + * If the importNode deep parameter was set to + * true, the descendants of the source element are + * recursively imported and the resulting nodes reassembled to form the + * corresponding subtree.
+ *
ENTITY_NODE
+ *
DOMEntity nodes can be + * imported, however in the current release of the DOM the + * DOMDocumentType is readonly. Ability to add these imported + * nodes to a DOMDocumentType will be considered for addition + * to a future release of the DOM.On import, the publicId, + * systemId, and notationName attributes are + * copied. If a deep import is requested, the descendants + * of the the source DOMEntity are recursively imported and + * the resulting nodes reassembled to form the corresponding subtree.
+ *
+ * ENTITY_REFERENCE_NODE
+ *
Only the DOMEntityReference itself is + * copied, even if a deep import is requested, since the + * source and destination documents might have defined the entity + * differently. If the document being imported into provides a + * definition for this entity name, its value is assigned.
+ *
NOTATION_NODE
+ *
+ * DOMNotation nodes can be imported, however in the current + * release of the DOM the DOMDocumentType is readonly. Ability + * to add these imported nodes to a DOMDocumentType will be + * considered for addition to a future release of the DOM.On import, the + * publicId and systemId attributes are copied. + * Note that the deep parameter has no effect on + * DOMNotation nodes since they never have any children.
+ *
+ * PROCESSING_INSTRUCTION_NODE
+ *
The imported node copies its + * target and data values from those of the + * source node.
+ *
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
+ *
These three + * types of nodes inheriting from DOMCharacterData copy their + * data and length attributes from those of + * the source node.
+ *
+ * @param importedNode The node to import. + * @param deep If true, recursively import the subtree under + * the specified node; if false, import only the node + * itself, as explained above. This has no effect on DOMAttr + * , DOMEntityReference, and DOMNotation nodes. + * @return The imported node that belongs to this DOMDocument. + * @exception DOMException + * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not + * supported. + * @since DOM Level 2 + */ + virtual DOMNode *importNode(const DOMNode *importedNode, bool deep) = 0; + + /** + * Creates an element of the given qualified name and namespace URI. + * @param namespaceURI The namespace URI of the element to create. + * @param qualifiedName The qualified name of the element type to + * instantiate. + * @return A new DOMElement object with the following + * attributes: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Attribute + * Value
DOMNode.nodeName + * qualifiedName
DOMNode.namespaceURI + * namespaceURI
DOMNode.prefixprefix, extracted + * from qualifiedName, or null if there is + * no prefix
DOMNode.localNamelocal name, extracted from + * qualifiedName
DOMElement.tagName + * qualifiedName
+ * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified qualified name + * contains an illegal character, per the XML 1.0 specification . + *
NAMESPACE_ERR: Raised if the qualifiedName is + * malformed per the Namespaces in XML specification, if the + * qualifiedName has a prefix and the + * namespaceURI is null, or if the + * qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from " + * http://www.w3.org/XML/1998/namespace" . + *
NOT_SUPPORTED_ERR: Always thrown if the current document does not + * support the "XML" feature, since namespaces were + * defined by XML. + * @since DOM Level 2 + */ + virtual DOMElement *createElementNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName) = 0; + + /** + * Creates an attribute of the given qualified name and namespace URI. + * @param namespaceURI The namespace URI of the attribute to create. + * @param qualifiedName The qualified name of the attribute to + * instantiate. + * @return A new DOMAttr object with the following attributes: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Attribute + * Value
DOMNode.nodeNamequalifiedName
+ * DOMNode.namespaceURInamespaceURI
+ * DOMNode.prefixprefix, extracted from + * qualifiedName, or null if there is no + * prefix
DOMNode.localNamelocal name, extracted from + * qualifiedName
DOMAttr.name + * qualifiedName
DOMNode.nodeValuethe empty + * string
+ * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified qualified name + * contains an illegal character, per the XML 1.0 specification . + *
NAMESPACE_ERR: Raised if the qualifiedName is + * malformed per the Namespaces in XML specification, if the + * qualifiedName has a prefix and the + * namespaceURI is null, if the + * qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from " + * http://www.w3.org/XML/1998/namespace", or if the + * qualifiedName, or its prefix, is "xmlns" and the + * namespaceURI is different from " + * http://www.w3.org/2000/xmlns/". + *
NOT_SUPPORTED_ERR: Always thrown if the current document does not + * support the "XML" feature, since namespaces were + * defined by XML. + * @since DOM Level 2 + */ + virtual DOMAttr *createAttributeNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName) = 0; + + /** + * Returns a DOMNodeList of all the DOMElement(s) with a + * given local name and namespace URI in the order in which they are + * encountered in a preorder traversal of the DOMDocument tree. + * @param namespaceURI The namespace URI of the elements to match on. The + * special value "*" matches all namespaces. + * @param localName The local name of the elements to match on. The + * special value "*" matches all local names. + * @return A new DOMNodeList object containing all the matched + * DOMElement(s). + * @since DOM Level 2 + */ + virtual DOMNodeList *getElementsByTagNameNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + + /** + * Returns the DOMElement whose ID is given by + * elementId. If no such element exists, returns + * null. Behavior is not defined if more than one element + * has this ID. The DOM implementation must have + * information that says which attributes are of type ID. Attributes + * with the name "ID" are not of type ID unless so defined. + * Implementations that do not know whether attributes are of type ID or + * not are expected to return null. + * @param elementId The unique id value for an element. + * @return The matching element. + * @since DOM Level 2 + */ + virtual DOMElement * getElementById(const XMLCh *elementId) const = 0; + //@} + + /** @name Functions introduced in DOM Level 3. */ + //@{ + + /** + * An attribute specifying the encoding used for this document at the time of the parsing. + * This is null when it is not known, such as when the DOMDocument was created in memory. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getInputEncoding() const = 0; + + /** + * An attribute specifying, as part of the XML declaration, the encoding of this document. + * This is null when unspecified or when it is not known, such as when the + * DOMDocument was created in memory. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getXmlEncoding() const = 0; + + /** + * An attribute specifying, as part of the XML declaration, whether this document is standalone. + * This is false when unspecified. + * + * @since DOM Level 3 + */ + virtual bool getXmlStandalone() const = 0; + + /** + * An attribute specifying, as part of the XML declaration, whether this + * document is standalone. + *
This attribute represents the property [standalone] defined in . + * + * @since DOM Level 3 + */ + virtual void setXmlStandalone(bool standalone) = 0; + + /** + * An attribute specifying, as part of the XML declaration, the version + * number of this document. This is null when unspecified. + *
This attribute represents the property [version] defined in . + * + * @since DOM Level 3 + */ + virtual const XMLCh* getXmlVersion() const = 0; + + /** + * An attribute specifying, as part of the XML declaration, the version + * number of this document. This is null when unspecified. + *
This attribute represents the property [version] defined in . + * + * @since DOM Level 3 + */ + virtual void setXmlVersion(const XMLCh* version) = 0; + + /** + * The location of the document or null if undefined. + *
Beware that when the DOMDocument supports the feature + * "HTML" , the href attribute of the HTML BASE element takes precedence + * over this attribute. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getDocumentURI() const = 0; + /** + * The location of the document or null if undefined. + *
Beware that when the DOMDocument supports the feature + * "HTML" , the href attribute of the HTML BASE element takes precedence + * over this attribute. + * + * @since DOM Level 3 + */ + virtual void setDocumentURI(const XMLCh* documentURI) = 0; + + /** + * An attribute specifying whether errors checking is enforced or not. + * When set to false, the implementation is free to not + * test every possible error case normally defined on DOM operations, + * and not raise any DOMException. In case of error, the + * behavior is undefined. This attribute is true by + * defaults. + * + * @since DOM Level 3 + */ + virtual bool getStrictErrorChecking() const = 0; + /** + * An attribute specifying whether errors checking is enforced or not. + * When set to false, the implementation is free to not + * test every possible error case normally defined on DOM operations, + * and not raise any DOMException. In case of error, the + * behavior is undefined. This attribute is true by + * defaults. + * + * @since DOM Level 3 + */ + virtual void setStrictErrorChecking(bool strictErrorChecking) = 0; + + /** + * Rename an existing node. When possible this simply changes the name of + * the given node, otherwise this creates a new node with the specified + * name and replaces the existing node with the new node as described + * below. This only applies to nodes of type ELEMENT_NODE + * and ATTRIBUTE_NODE. + *
When a new node is created, the following operations are performed: + * the new node is created, any registered event listener is registered + * on the new node, any user data attached to the old node is removed + * from that node, the old node is removed from its parent if it has + * one, the children are moved to the new node, if the renamed node is + * an DOMElement its attributes are moved to the new node, the + * new node is inserted at the position the old node used to have in its + * parent's child nodes list if it has one, the user data that was + * attached to the old node is attach to the new node, the user data + * event NODE_RENAMED is fired. + *
When the node being renamed is an DOMAttr that is + * attached to an DOMElement, the node is first removed from + * the DOMElement attributes map. Then, once renamed, either + * by modifying the existing node or creating a new one as described + * above, it is put back. + * + * @param n The node to rename. + * @param namespaceURI The new namespaceURI. + * @param qualifiedName The new qualified name. + * @return The renamed node. This is either the specified node or the new + * node that was created to replace the specified node. + * @exception DOMException + * NOT_SUPPORTED_ERR: Raised when the type of the specified node is + * neither ELEMENT_NODE nor ATTRIBUTE_NODE. + *
WRONG_DOCUMENT_ERR: Raised when the specified node was created + * from a different document than this document. + *
NAMESPACE_ERR: Raised if the qualifiedName is + * malformed per the Namespaces in XML specification, if the + * qualifiedName has a prefix and the + * namespaceURI is null, or if the + * qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from " + * http://www.w3.org/XML/1998/namespace" . Also raised, when the node + * being renamed is an attribute, if the qualifiedName, + * or its prefix, is "xmlns" and the namespaceURI is + * different from "http://www.w3.org/2000/xmlns/". + * @since DOM Level 3 + */ + virtual DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* qualifiedName) = 0; + + + /** + * Changes the ownerDocument of a node, its children, as well + * as the attached attribute nodes if there are any. If the node has a + * parent it is first removed from its parent child list. This + * effectively allows moving a subtree from one document to another. The + * following list describes the specifics for each type of node. + * + *
+ *
+ * ATTRIBUTE_NODE
+ *
The ownerElement attribute is set to + * null and the specified flag is set to + * true on the adopted DOMAttr. The descendants + * of the source DOMAttr are recursively adopted.
+ *
+ * DOCUMENT_FRAGMENT_NODE
+ *
The descendants of the source node are + * recursively adopted.
+ *
DOCUMENT_NODE
+ *
DOMDocument nodes cannot + * be adopted.
+ *
DOCUMENT_TYPE_NODE
+ *
DOMDocumentType nodes cannot + * be adopted.
+ *
ELEMENT_NODE
+ *
Specified attribute nodes of the source + * element are adopted, and the generated DOMAttr nodes. + * Default attributes are discarded, though if the document being + * adopted into defines default attributes for this element name, those + * are assigned. The descendants of the source element are recursively + * adopted.
+ *
ENTITY_NODE
+ *
DOMEntity nodes cannot be adopted.
+ *
+ * ENTITY_REFERENCE_NODE
+ *
Only the DOMEntityReference node + * itself is adopted, the descendants are discarded, since the source + * and destination documents might have defined the entity differently. + * If the document being imported into provides a definition for this + * entity name, its value is assigned.
+ *
NOTATION_NODE
+ *
DOMNotation + * nodes cannot be adopted.
+ *
PROCESSING_INSTRUCTION_NODE, TEXT_NODE, + * CDATA_SECTION_NODE, COMMENT_NODE
+ *
These nodes can all be adopted. No + * specifics.
+ *
+ * @param source The node to move into this document. + * @return The adopted node, or null if this operation + * fails, such as when the source node comes from a different + * implementation. + * @exception DOMException + * NOT_SUPPORTED_ERR: Raised if the source node is of type + * DOCUMENT, DOCUMENT_TYPE. + *
NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is + * readonly. + * @since DOM Level 3 + */ + virtual DOMNode* adoptNode(DOMNode* source) = 0; + + /** + * This method acts as if the document was going through a save and load + * cycle, putting the document in a "normal" form. The actual result + * depends on the features being set. See DOMConfiguration for + * details. + * + *
Noticeably this method normalizes DOMText nodes, makes + * the document "namespace wellformed", according to the algorithm + * described below in pseudo code, by adding missing namespace + * declaration attributes and adding or changing namespace prefixes, + * updates the replacement tree of DOMEntityReference nodes, + * normalizes attribute values, etc. + *
Mutation events, when supported, are generated to reflect the + * changes occurring on the document. + * Note that this is a partial implementation. Not all the required features are implemented. + * Currently DOMAttr and DOMText nodes are normalized. + * Features to remove DOMComment and DOMCDATASection work. + * @since DOM Level 3 + * + */ + virtual void normalizeDocument() = 0; + + + /** + * The configuration used when DOMDocument::normalizeDocument is invoked. + * + * @return The DOMConfiguration from this DOMDocument + * + * @since DOM Level 3 + */ + virtual DOMConfiguration* getDOMConfig() const = 0; + + //@} + + // ----------------------------------------------------------------------- + // Non-standard extension + // ----------------------------------------------------------------------- + /** @name Non-standard extension */ + //@{ + /** + * Non-standard extension + * + * Create a new entity. + * @param name The name of the entity to instantiate + * + */ + virtual DOMEntity *createEntity(const XMLCh *name) = 0; + + /** + * Non-standard extension + * + * Create a DOMDocumentType node. + * @return A DOMDocumentType that references the newly + * created DOMDocumentType node. + * + */ + virtual DOMDocumentType *createDocumentType(const XMLCh *name) = 0; + + /*** + * Provide default implementation to maintain source code compatibility + ***/ + virtual DOMDocumentType* createDocumentType(const XMLCh *qName, + const XMLCh*, //publicId, + const XMLCh* //systemId + ) + { + return createDocumentType(qName); + } + + /** + * Non-standard extension. + * + * Create a Notation. + * @param name The name of the notation to instantiate + * @return A DOMNotation that references the newly + * created DOMNotation node. + */ + virtual DOMNotation *createNotation(const XMLCh *name) = 0; + + /** + * Non-standard extension. + * + * Creates an element of the given qualified name and + * namespace URI, and also stores line/column number info. + * Used by internally XSDXercesDOMParser during schema traversal. + * + * @see createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName) + */ + virtual DOMElement *createElementNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + const XMLFileLoc lineNum, + const XMLFileLoc columnNum) = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMDocumentFragment.hpp b/project/jni/xerces/src/xercesc/dom/DOMDocumentFragment.hpp new file mode 100644 index 000000000..6f0dceb66 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMDocumentFragment.hpp @@ -0,0 +1,108 @@ +/* + * 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: DOMDocumentFragment.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * DOMDocumentFragment is a "lightweight" or "minimal" + * DOMDocument object. + * + * It is very common to want to be able to + * extract a portion of a document's tree or to create a new fragment of a + * document. Imagine implementing a user command like cut or rearranging a + * document by moving fragments around. It is desirable to have an object + * which can hold such fragments and it is quite natural to use a DOMNode for + * this purpose. While it is true that a DOMDocument object could + * fulfill this role, a DOMDocument object can potentially be a + * heavyweight object, depending on the underlying implementation. What is + * really needed for this is a very lightweight object. + * DOMDocumentFragment is such an object. + *

Furthermore, various operations -- such as inserting nodes as children + * of another DOMNode -- may take DOMDocumentFragment + * objects as arguments; this results in all the child nodes of the + * DOMDocumentFragment being moved to the child list of this node. + *

The children of a DOMDocumentFragment node are zero or more + * nodes representing the tops of any sub-trees defining the structure of the + * document. DOMDocumentFragment nodes do not need to be + * well-formed XML documents (although they do need to follow the rules + * imposed upon well-formed XML parsed entities, which can have multiple top + * nodes). For example, a DOMDocumentFragment might have only one + * child and that child node could be a DOMText node. Such a + * structure model represents neither an HTML document nor a well-formed XML + * document. + *

When a DOMDocumentFragment is inserted into a + * DOMDocument (or indeed any other DOMNode that may take + * children) the children of the DOMDocumentFragment and not the + * DOMDocumentFragment itself are inserted into the + * DOMNode. This makes the DOMDocumentFragment very + * useful when the user wishes to create nodes that are siblings; the + * DOMDocumentFragment acts as the parent of these nodes so that the + * user can use the standard methods from the DOMNode interface, + * such as insertBefore() and appendChild(). + * + * @since DOM Level 1 + */ + +class CDOM_EXPORT DOMDocumentFragment: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMDocumentFragment() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMDocumentFragment(const DOMDocumentFragment &); + DOMDocumentFragment & operator = (const DOMDocumentFragment &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMDocumentFragment() {}; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMDocumentRange.hpp b/project/jni/xerces/src/xercesc/dom/DOMDocumentRange.hpp new file mode 100644 index 000000000..da94deb12 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMDocumentRange.hpp @@ -0,0 +1,95 @@ +/* + * 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: DOMDocumentRange.hpp 527149 2007-04-10 14:56:39Z amassari $ +*/ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMRange; + + +/** + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ +class CDOM_EXPORT DOMDocumentRange { + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMDocumentRange() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMDocumentRange(const DOMDocumentRange &); + DOMDocumentRange & operator = (const DOMDocumentRange &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMDocumentRange() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMDocumentRange interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + /** + * To create the range consisting of boundary-points and offset of the + * selected contents + * + * @return The initial state of the Range such that both the boundary-points + * are positioned at the beginning of the corresponding DOMDOcument, before + * any content. The range returned can only be used to select content + * associated with this document, or with documentFragments and Attrs for + * which this document is the ownerdocument + * @since DOM Level 2 + */ + virtual DOMRange *createRange() = 0; + + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMDocumentTraversal.hpp b/project/jni/xerces/src/xercesc/dom/DOMDocumentTraversal.hpp new file mode 100644 index 000000000..f2897a761 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMDocumentTraversal.hpp @@ -0,0 +1,155 @@ +/* + * 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: DOMDocumentTraversal.hpp 671894 2008-06-26 13:29:21Z borisk $ +*/ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; +class DOMNodeIterator; +class DOMTreeWalker; + + +/** + * DOMDocumentTraversal contains methods that create + * DOMNodeIterators and DOMTreeWalkers to traverse a + * node and its children in document order (depth first, pre-order + * traversal, which is equivalent to the order in which the start tags occur + * in the text representation of the document). In DOMs which support the + * Traversal feature, DOMDocumentTraversal will be implemented by + * the same objects that implement the DOMDocument interface. + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ +class CDOM_EXPORT DOMDocumentTraversal { + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMDocumentTraversal() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMDocumentTraversal(const DOMDocumentTraversal &); + DOMDocumentTraversal & operator = (const DOMDocumentTraversal &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMDocumentTraversal() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMDocumentRange interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + /** + * Creates a NodeIterator object. (DOM2) + * + * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the + * document subtree governed by a particular node, the results of a query, or any other set of nodes. + * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2 + * specifies a single NodeIterator implementation for document-order traversal of a document subtree. + * Instances of these iterators are created by calling DOMDocumentTraversal.createNodeIterator(). + * + * To produce a view of the document that has entity references expanded and does not + * expose the entity reference node itself, use the whatToShow flags to hide the entity + * reference node and set expandEntityReferences to true when creating the iterator. To + * produce a view of the document that has entity reference nodes but no entity expansion, + * use the whatToShow flags to show the entity reference node and set + * expandEntityReferences to false. + * + * @param root The root node of the DOM tree + * @param whatToShow This attribute determines which node types are presented via the iterator. + * @param filter The filter used to screen nodes + * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are + * visible to the iterator. If false, they will be skipped over. + * @since DOM Level 2 + */ + + virtual DOMNodeIterator *createNodeIterator(DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion) = 0; + /** + * Creates a TreeWalker object. (DOM2) + * + * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined + * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs + * navigation using a TreeWalker will automatically support any view defined by a TreeWalker. + * + * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from + * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may + * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips + * all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text + * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the + * structure of the original document. + * + * To produce a view of the document that has entity references expanded + * and does not expose the entity reference node itself, use the whatToShow + * flags to hide the entity reference node and set expandEntityReferences to + * true when creating the TreeWalker. To produce a view of the document + * that has entity reference nodes but no entity expansion, use the + * whatToShow flags to show the entity reference node and set + * expandEntityReferences to false + * + * @param root The root node of the DOM tree + * @param whatToShow This attribute determines which node types are presented via the tree-walker. + * @param filter The filter used to screen nodes + * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are + * visible to the tree-walker. If false, they will be skipped over. + * @since DOM Level 2 + */ + + virtual DOMTreeWalker *createTreeWalker(DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion) = 0; + + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMDocumentType.hpp b/project/jni/xerces/src/xercesc/dom/DOMDocumentType.hpp new file mode 100644 index 000000000..29fe50ca8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMDocumentType.hpp @@ -0,0 +1,160 @@ +/* + * 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: DOMDocumentType.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNamedNodeMap; + +/** + * Each DOMDocument has a doctype attribute whose value + * is either null or a DOMDocumentType object. The + * DOMDocumentType interface in the DOM Core provides an interface + * to the list of entities that are defined for the document, and little + * else because the effect of namespaces and the various XML schema efforts + * on DTD representation are not clearly understood as of this writing. + *

The DOM Level 2 doesn't support editing DOMDocumentType nodes. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMDocumentType: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMDocumentType() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMDocumentType(const DOMDocumentType &); + DOMDocumentType & operator = (const DOMDocumentType &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMDocumentType() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMDocumentType interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + /** + * The name of DTD; i.e., the name immediately following the + * DOCTYPE keyword. + * + * @since DOM Level 1 + */ + virtual const XMLCh * getName() const = 0; + + /** + * A DOMNamedNodeMap containing the general entities, both + * external and internal, declared in the DTD. Parameter entities are + * not contained. Duplicates are discarded. For example in: + * <!DOCTYPE
+ * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar
+ * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz">
+ * ]> <ex/>
+ * the interface provides access to foo + * and the first declaration of bar but not the second + * declaration of bar or baz. Every node in + * this map also implements the DOMEntity interface. + *
The DOM Level 2 does not support editing entities, therefore + * entities cannot be altered in any way. + * + * @since DOM Level 1 + */ + virtual DOMNamedNodeMap *getEntities() const = 0; + + + /** + * A DOMNamedNodeMap containing the notations declared in the + * DTD. Duplicates are discarded. Every node in this map also implements + * the DOMNotation interface. + *
The DOM Level 2 does not support editing notations, therefore + * notations cannot be altered in any way. + * + * @since DOM Level 1 + */ + virtual DOMNamedNodeMap *getNotations() const = 0; + //@} + + /** @name Functions introduced in DOM Level 2. */ + //@{ + /** + * Get the public identifier of the external subset. + * + * @return The public identifier of the external subset. + * @since DOM Level 2 + */ + virtual const XMLCh * getPublicId() const = 0; + + /** + * Get the system identifier of the external subset. + * + * @return The system identifier of the external subset. + * @since DOM Level 2 + */ + virtual const XMLCh * getSystemId() const = 0; + + /** + * The internal subset as a string, or null if there is none. + * This is does not contain the delimiting square brackets.The actual + * content returned depends on how much information is available to the + * implementation. This may vary depending on various parameters, + * including the XML processor used to build the document. + * + * @return The internal subset as a string. + * @since DOM Level 2 + */ + virtual const XMLCh * getInternalSubset() const = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMElement.hpp b/project/jni/xerces/src/xercesc/dom/DOMElement.hpp new file mode 100644 index 000000000..e158626a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMElement.hpp @@ -0,0 +1,528 @@ +/* + * 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: DOMElement.hpp 792236 2009-07-08 17:22:35Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMAttr; +class DOMNodeList; +class DOMTypeInfo; + + +/** + * By far the vast majority of objects (apart from text) that authors + * encounter when traversing a document are DOMElement nodes. + * + * Assume the following XML document:<elementExample id="demo"> + * <subelement1/> + * <subelement2><subsubelement/></subelement2> + * </elementExample> + *

When represented using DOM, the top node is an DOMElement node + * for "elementExample", which contains two child DOMElement nodes, + * one for "subelement1" and one for "subelement2". "subelement1" contains no + * child nodes. + *

Elements may have attributes associated with them; since the + * DOMElement interface inherits from DOMNode, the generic + * DOMNode interface method getAttributes may be used + * to retrieve the set of all attributes for an element. There are methods on + * the DOMElement interface to retrieve either an DOMAttr + * object by name or an attribute value by name. In XML, where an attribute + * value may contain entity references, an DOMAttr object should be + * retrieved to examine the possibly fairly complex sub-tree representing the + * attribute value. On the other hand, in HTML, where all attributes have + * simple string values, methods to directly access an attribute value can + * safely be used as a convenience. + * + * @since DOM Level 1 + * + * It also defines the ElementTraversal helper interface defined by http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/ + * + */ + +class CDOM_EXPORT DOMElement: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMElement() {} + DOMElement(const DOMElement &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMElement & operator = (const DOMElement &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMElement() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMElement interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The name of the element. + * + * For example, in: <elementExample + * id="demo"> ... </elementExample> , tagName has + * the value "elementExample". Note that this is + * case-preserving in XML, as are all of the operations of the DOM. + * @since DOM Level 1 + */ + virtual const XMLCh * getTagName() const = 0; + + /** + * Retrieves an attribute value by name. + * + * @param name The name of the attribute to retrieve. + * @return The DOMAttr value as a string, or the empty string if + * that attribute does not have a specified or default value. + * @since DOM Level 1 + */ + virtual const XMLCh * getAttribute(const XMLCh *name) const = 0; + + /** + * Retrieves an DOMAttr node by name. + * + * @param name The name (nodeName) of the attribute to retrieve. + * @return The DOMAttr node with the specified name (nodeName) or + * null if there is no such attribute. + * @since DOM Level 1 + */ + virtual DOMAttr * getAttributeNode(const XMLCh *name) const = 0; + + /** + * Returns a DOMNodeList of all descendant elements with a given + * tag name, in the order in which they would be encountered in a preorder + * traversal of the DOMElement tree. + * + * @param name The name of the tag to match on. The special value "*" + * matches all tags. + * @return A list of matching DOMElement nodes. + * @since DOM Level 1 + */ + virtual DOMNodeList * getElementsByTagName(const XMLCh *name) const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Adds a new attribute. + * + * If an attribute with that name is already present + * in the element, its value is changed to be that of the value parameter. + * This value is a simple string, it is not parsed as it is being set. So + * any markup (such as syntax to be recognized as an entity reference) is + * treated as literal text, and needs to be appropriately escaped by the + * implementation when it is written out. In order to assign an attribute + * value that contains entity references, the user must create an + * DOMAttr node plus any DOMText and + * DOMEntityReference nodes, build the appropriate subtree, and + * use setAttributeNode to assign it as the value of an + * attribute. + * @param name The name of the attribute to create or alter. + * @param value Value to set in string form. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified name contains an + * illegal character. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void setAttribute(const XMLCh *name, + const XMLCh *value) = 0; + /** + * Adds a new attribute. + * + * If an attribute with that name (nodeName) is already present + * in the element, it is replaced by the new one. + * @param newAttr The DOMAttr node to add to the attribute list. + * @return If the newAttr attribute replaces an existing + * attribute, the replaced + * DOMAttr node is returned, otherwise null is + * returned. + * @exception DOMException + * WRONG_DOCUMENT_ERR: Raised if newAttr was created from a + * different document than the one that created the element. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an + * attribute of another DOMElement object. The DOM user must + * explicitly clone DOMAttr nodes to re-use them in other + * elements. + * @since DOM Level 1 + */ + virtual DOMAttr * setAttributeNode(DOMAttr *newAttr) = 0; + + /** + * Removes the specified attribute node. + * If the removed DOMAttr + * has a default value it is immediately replaced. The replacing attribute + * has the same namespace URI and local name, as well as the original prefix, + * when applicable. + * + * @param oldAttr The DOMAttr node to remove from the attribute + * list. + * @return The DOMAttr node that was removed. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
NOT_FOUND_ERR: Raised if oldAttr is not an attribute + * of the element. + * @since DOM Level 1 + */ + virtual DOMAttr * removeAttributeNode(DOMAttr *oldAttr) = 0; + + /** + * Removes an attribute by name. + * + * If the removed attribute + * is known to have a default value, an attribute immediately appears + * containing the default value as well as the corresponding namespace URI, + * local name, and prefix when applicable.
To remove an attribute by local + * name and namespace URI, use the removeAttributeNS method. + * @param name The name of the attribute to remove. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual void removeAttribute(const XMLCh *name) = 0; + //@} + + /** @name Functions introduced in DOM Level 2. */ + //@{ + /** + * Retrieves an attribute value by local name and namespace URI. + * + * @param namespaceURI The namespace URI of + * the attribute to retrieve. + * @param localName The local name of the + * attribute to retrieve. + * @return The DOMAttr value as a string, or an null if + * that attribute does not have a specified or default value. + * @since DOM Level 2 + */ + virtual const XMLCh * getAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + + /** + * Adds a new attribute. If an attribute with the same + * local name and namespace URI is already present on the element, its prefix + * is changed to be the prefix part of the qualifiedName, and + * its value is changed to be the value parameter. This value is + * a simple string, it is not parsed as it is being set. So any markup (such + * as syntax to be recognized as an entity reference) is treated as literal + * text, and needs to be appropriately escaped by the implementation when it + * is written out. In order to assign an attribute value that contains entity + * references, the user must create an DOMAttr + * node plus any DOMText and DOMEntityReference + * nodes, build the appropriate subtree, and use + * setAttributeNodeNS or setAttributeNode to assign + * it as the value of an attribute. + * + * @param namespaceURI The namespace URI of + * the attribute to create or alter. + * @param qualifiedName The qualified name of the + * attribute to create or alter. + * @param value The value to set in string form. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an + * illegal character. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
+ * NAMESPACE_ERR: Raised if the qualifiedName is + * malformed, if the qualifiedName has a prefix and the + * namespaceURI is null or an empty string, + * if the qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from + * "http://www.w3.org/XML/1998/namespace", if the + * qualifiedName has a prefix that is "xmlns" and the + * namespaceURI is different from + * "http://www.w3.org/2000/xmlns/", or if the + * qualifiedName is "xmlns" and the + * namespaceURI is different from + * "http://www.w3.org/2000/xmlns/". + * @since DOM Level 2 + */ + virtual void setAttributeNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, const XMLCh *value) = 0; + + /** + * Removes an attribute by local name and namespace URI. If the + * removed attribute has a default value it is immediately replaced. + * The replacing attribute has the same namespace URI and local name, as well as + * the original prefix. + * + * @param namespaceURI The namespace URI of + * the attribute to remove. + * @param localName The local name of the + * attribute to remove. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 2 + */ + virtual void removeAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) = 0; + + /** + * Retrieves an DOMAttr node by local name and namespace URI. + * + * @param namespaceURI The namespace URI of + * the attribute to retrieve. + * @param localName The local name of the + * attribute to retrieve. + * @return The DOMAttr node with the specified attribute local + * name and namespace URI or null if there is no such attribute. + * @since DOM Level 2 + */ + virtual DOMAttr * getAttributeNodeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + + /** + * Adds a new attribute. + * + * If an attribute with that local name and namespace URI is already present + * in the element, it is replaced by the new one. + * + * @param newAttr The DOMAttr node to add to the attribute list. + * @return If the newAttr attribute replaces an existing + * attribute with the same local name and namespace URI, + * the replaced DOMAttr node is + * returned, otherwise null is returned. + * @exception DOMException + * WRONG_DOCUMENT_ERR: Raised if newAttr was created from a + * different document than the one that created the element. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an + * attribute of another DOMElement object. The DOM user must + * explicitly clone DOMAttr nodes to re-use them in other + * elements. + * @since DOM Level 2 + */ + virtual DOMAttr * setAttributeNodeNS(DOMAttr *newAttr) = 0; + + /** + * Returns a DOMNodeList of all the DOMElements + * with a given local name and namespace URI in the order in which they + * would be encountered in a preorder traversal of the + * DOMDocument tree, starting from this node. + * + * @param namespaceURI The namespace URI of + * the elements to match on. The special value "*" matches all + * namespaces. + * @param localName The local name of the + * elements to match on. The special value "*" matches all local names. + * @return A new DOMNodeList object containing all the matched + * DOMElements. + * @since DOM Level 2 + */ + virtual DOMNodeList * getElementsByTagNameNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + + /** + * Returns true when an attribute with a given name is + * specified on this element or has a default value, false + * otherwise. + * @param name The name of the attribute to look for. + * @return true if an attribute with the given name is + * specified on this element or has a default value, false + * otherwise. + * @since DOM Level 2 + */ + virtual bool hasAttribute(const XMLCh *name) const = 0; + + /** + * Returns true when an attribute with a given local name and + * namespace URI is specified on this element or has a default value, + * false otherwise. HTML-only DOM implementations do not + * need to implement this method. + * @param namespaceURI The namespace URI of the attribute to look for. + * @param localName The local name of the attribute to look for. + * @return true if an attribute with the given local name + * and namespace URI is specified or has a default value on this + * element, false otherwise. + * @since DOM Level 2 + */ + virtual bool hasAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + //@} + + /** @name Functions introduced in DOM Level 3 */ + //@{ + + /** + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute. + * This affects the value of DOMAttr::isId and the behavior of + * DOMDocument::getElementById, but does not change any schema that + * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo + * of the specified DOMAttr node. Use the value false for the parameter isId + * to undeclare an attribute for being a user-determined ID attribute. + * To specify an DOMAttr by local name and namespace URI, use the + * setIdAttributeNS method. + * + * @param name The name of the DOMAttr. + * @param isId Whether the attribute is of type ID. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr + * of this element. + * + * @since DOM Level 3 + */ + virtual void setIdAttribute(const XMLCh* name, bool isId) = 0; + + + /** + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute. + * This affects the value of DOMAttr::isId and the behavior of + * DOMDocument::getElementById, but does not change any schema that + * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo + * of the specified DOMAttr node. Use the value false for the parameter isId + * to undeclare an attribute for being a user-determined ID attribute. + * + * @param namespaceURI The namespace URI of the DOMAttr. + * @param localName The local name of the DOMAttr. + * @param isId Whether the attribute is of type ID. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr of this element. + * + * @since DOM Level 3 + */ + virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId) = 0; + + + + /** + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute. + * This affects the value of DOMAttr::isId and the behavior of + * DOMDocument::getElementById, but does not change any schema that + * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo + * of the specified DOMAttr node. Use the value false for the parameter isId + * to undeclare an attribute for being a user-determined ID attribute. + * + * @param idAttr The DOMAttr node. + * @param isId Whether the attribute is of type ID. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr of this element. + * + * @since DOM Level 3 + */ + virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId) = 0; + + + + /** + * Returns the type information associated with this element. + * + * @return the DOMTypeInfo associated with this element + * @since DOM level 3 + */ + virtual const DOMTypeInfo* getSchemaTypeInfo() const = 0; + + //@} + + // ----------------------------------------------------------------------- + // DOMElementTraversal interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in the ElementTraversal specification (http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/)*/ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The first child of type DOMElement. + * + * @return The DOMElement object that is the first element node + * among the child nodes of this node, or null if there is none. + */ + virtual DOMElement * getFirstElementChild() const = 0; + + /** + * The last child of type DOMElement. + * + * @return The DOMElement object that is the last element node + * among the child nodes of this node, or null if there is none. + */ + virtual DOMElement * getLastElementChild() const = 0; + + /** + * The previous sibling node of type DOMElement. + * + * @return The DOMElement object that is the previous sibling element node + * in document order, or null if there is none. + */ + virtual DOMElement * getPreviousElementSibling() const = 0; + + /** + * The next sibling node of type DOMElement. + * + * @return The DOMElement object that is the next sibling element node + * in document order, or null if there is none. + */ + virtual DOMElement * getNextElementSibling() const = 0; + + /** + * The number of child nodes that are of type DOMElement. + * + * Note: the count is computed every time this function is invoked + * + * @return The number of DOMElement objects that are direct children + * of this object (nested elements are not counted), or 0 if there is none. + * + */ + virtual XMLSize_t getChildElementCount() const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMEntity.hpp b/project/jni/xerces/src/xercesc/dom/DOMEntity.hpp new file mode 100644 index 000000000..2a33a38f8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMEntity.hpp @@ -0,0 +1,170 @@ +/* + * 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: DOMEntity.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITY_HPP) +#define XERCESC_INCLUDE_GUARD_DOMENTITY_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This interface represents an entity, either parsed or unparsed, in an XML + * document. Note that this models the entity itself not the entity + * declaration. DOMEntity declaration modeling has been left for a + * later Level of the DOM specification. + *

The nodeName attribute that is inherited from + * DOMNode contains the name of the entity. + *

An XML processor may choose to completely expand entities before the + * structure model is passed to the DOM; in this case there will be no + * DOMEntityReference nodes in the document tree. + *

XML does not mandate that a non-validating XML processor read and + * process entity declarations made in the external subset or declared in + * external parameter entities. This means that parsed entities declared in + * the external subset need not be expanded by some classes of applications, + * and that the replacement value of the entity may not be available. When + * the replacement value is available, the corresponding DOMEntity + * node's child list represents the structure of that replacement text. + * Otherwise, the child list is empty. + *

The DOM Level 2 does not support editing DOMEntity nodes; if a + * user wants to make changes to the contents of an DOMEntity, + * every related DOMEntityReference node has to be replaced in the + * structure model by a clone of the DOMEntity's contents, and + * then the desired changes must be made to each of those clones instead. + * DOMEntity nodes and all their descendants are readonly. + *

An DOMEntity node does not have any parent.If the entity + * contains an unbound namespace prefix, the namespaceURI of + * the corresponding node in the DOMEntity node subtree is + * null. The same is true for DOMEntityReference + * nodes that refer to this entity, when they are created using the + * createEntityReference method of the DOMDocument + * interface. The DOM Level 2 does not support any mechanism to resolve + * namespace prefixes. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMEntity: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMEntity() {} + DOMEntity(const DOMEntity &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMEntity & operator = (const DOMEntity &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMEntity() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMEntity interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The public identifier associated with the entity, if specified. + * + * If the public identifier was not specified, this is null. + * + * @since DOM Level 1 + */ + virtual const XMLCh * getPublicId() const = 0; + + /** + * The system identifier associated with the entity, if specified. + * + * If the system identifier was not specified, this is null. + * + * @since DOM Level 1 + */ + virtual const XMLCh * getSystemId() const = 0; + + /** + * For unparsed entities, the name of the notation for the entity. + * + * For parsed entities, this is null. + * + * @since DOM Level 1 + */ + virtual const XMLCh * getNotationName() const = 0; + //@} + + /** @name Functions introduced in DOM Level 3. */ + //@{ + + /** + * An attribute specifying the encoding used for this entity at the time of parsing, + * when it is an external parsed entity. This is null if it an entity + * from the internal subset or if it is not known. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getInputEncoding() const = 0; + + /** + * An attribute specifying, as part of the text declaration, the encoding + * of this entity, when it is an external parsed entity. This is + * null otherwise. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getXmlEncoding() const = 0; + + /** + * An attribute specifying, as part of the text declaration, the version + * number of this entity, when it is an external parsed entity. This is + * null otherwise. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getXmlVersion() const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/DOMEntityReference.hpp b/project/jni/xerces/src/xercesc/dom/DOMEntityReference.hpp new file mode 100644 index 000000000..7dc89c387 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMEntityReference.hpp @@ -0,0 +1,96 @@ +/* + * 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: DOMEntityReference.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * DOMEntityReference objects may be inserted into the structure + * model when an entity reference is in the source document, or when the + * user wishes to insert an entity reference. Note that character references + * and references to predefined entities are considered to be expanded by + * the HTML or XML processor so that characters are represented by their + * Unicode equivalent rather than by an entity reference. Moreover, the XML + * processor may completely expand references to entities while building the + * structure model, instead of providing DOMEntityReference + * objects. If it does provide such objects, then for a given + * DOMEntityReference node, it may be that there is no + * DOMEntity node representing the referenced entity. If such an + * DOMEntity exists, then the subtree of the + * DOMEntityReference node is in general a copy of the + * DOMEntity node subtree. However, this may not be true when an + * entity contains an unbound namespace prefix. In such a case, because the + * namespace prefix resolution depends on where the entity reference is, the + * descendants of the DOMEntityReference node may be bound to + * different namespace URIs. + *

As for DOMEntity nodes, DOMEntityReference nodes and + * all their descendants are readonly. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ + +class CDOM_EXPORT DOMEntityReference: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMEntityReference() {} + DOMEntityReference(const DOMEntityReference &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMEntityReference & operator = (const DOMEntityReference &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMEntityReference() {}; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMError.hpp b/project/jni/xerces/src/xercesc/dom/DOMError.hpp new file mode 100644 index 000000000..76bb67641 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMError.hpp @@ -0,0 +1,173 @@ +/* + * 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: DOMError.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMERROR_HPP) +#define XERCESC_INCLUDE_GUARD_DOMERROR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMLocator; + + +/** + * DOMError is an interface that describes an error. + * + * @see DOMErrorHandler#handleError + * @since DOM Level 3 + */ + +class CDOM_EXPORT DOMError +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMError() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMError(const DOMError &); + DOMError & operator = (const DOMError &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMError() {}; + //@} + + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** @name Public constants */ + //@{ + /** + * The severity of the error described by the DOMError. + * + *

DOM_SEVERITY_ERROR: + * The severity of the error described by the DOMError is error. + * A DOM_SEVERITY_ERROR may not cause the processing to stop if the error can + * be recovered, unless DOMErrorHandler::handleError() returns false.

+ * + *

DOM_SEVERITY_FATAL_ERROR + * The severity of the error described by the DOMError is fatal error. + * A DOM_SEVERITY_FATAL_ERROR will cause the normal processing to stop. The return + * value of DOMErrorHandler::handleError() is ignored unless the + * implementation chooses to continue, in which case the behavior becomes undefined.

+ * + *

DOM_SEVERITY_WARNING + * The severity of the error described by the DOMError is warning. + * A DOM_SEVERITY_WARNING will not cause the processing to stop, unless + * DOMErrorHandler::handleError() returns false.

+ * + * @since DOM Level 3 + */ + enum ErrorSeverity + { + DOM_SEVERITY_WARNING = 1, + DOM_SEVERITY_ERROR = 2, + DOM_SEVERITY_FATAL_ERROR = 3 + }; + //@} + + + // ----------------------------------------------------------------------- + // Virtual DOMError interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Get the severity of the error + * + * @see setSeverity + * @since DOM Level 3 + */ + virtual ErrorSeverity getSeverity() const = 0; + + /** + * Get the message describing the error that occured. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getMessage() const = 0; + + /** + * Get the location of the error + * + * @since DOM Level 3 + */ + virtual DOMLocator* getLocation() const = 0; + + /** + * The related platform dependent exception if any. + * + * @since DOM Level 3 + */ + virtual void* getRelatedException() const = 0; + + /** + * A XMLCh* indicating which related data is expected in + * relatedData. Users should refer to the specification of the error + * in order to find its XMLCh* type and relatedData + * definitions if any. + * + * Note: As an example, DOMDocument::normalizeDocument() does generate + * warnings when the "split-cdata-sections" parameter is in use. Therefore, the + * method generates a DOM_SEVERITY_WARNING with type "cdata-sections-splitted" + * and the first DOMCDATASection node in document order resulting from the split + * is returned by the relatedData attribute. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getType() const = 0; + + /** + * The related DOMError::getType dependent data if any. + * + * @since DOM Level 3 + */ + virtual void* getRelatedData() const = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMErrorHandler.hpp b/project/jni/xerces/src/xercesc/dom/DOMErrorHandler.hpp new file mode 100644 index 000000000..880a9c08d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMErrorHandler.hpp @@ -0,0 +1,107 @@ +/* + * 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: DOMErrorHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMError; + +/** + * Basic interface for DOM error handlers. + * + *

DOMErrorHandler is a callback interface that the DOM implementation + * can call when reporting errors that happens while processing XML data, or + * when doing some other processing (e.g. validating a document).

+ * + *

The application that is using the DOM implementation is expected to + * implement this interface.

+ * + * @see DOMLSParser#getDomConfig + * @since DOM Level 3 + */ + +class CDOM_EXPORT DOMErrorHandler +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMErrorHandler() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMErrorHandler(const DOMErrorHandler &); + DOMErrorHandler & operator = (const DOMErrorHandler &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMErrorHandler() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMErrorHandler interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * This method is called on the error handler when an error occurs. + * If an exception is thrown from this method, it is considered to be equivalent of returning true. + * + * @param domError The error object that describes the error, this object + * may be reused by the DOM implementation across multiple + * calls to the handleError method. + * @return If the handleError method returns true the DOM + * implementation should continue as if the error didn't happen + * when possible, if the method returns false then the + * DOM implementation should stop the current processing when + * possible. + * + * @since DOM Level 3 + */ + virtual bool handleError(const DOMError& domError) = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMException.cpp b/project/jni/xerces/src/xercesc/dom/DOMException.cpp new file mode 100644 index 000000000..5f1f57f03 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMException.cpp @@ -0,0 +1,84 @@ +/* + * 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: DOMException.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include +#include +#include +#include +#include +#include "impl/DOMImplementationImpl.hpp" + +#include "DOMException.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Destructor and Constructor +// --------------------------------------------------------------------------- +DOMException::~DOMException() +{ + if (msg && fMsgOwned) + fMemoryManager->deallocate((void*)msg); +} + +DOMException::DOMException() +:code(0) +,msg(0) +,fMemoryManager(0) +,fMsgOwned(false) +{ +} + +DOMException::DOMException(short exCode, + short messageCode, + MemoryManager* const memoryManager) +:code(exCode) +,fMemoryManager(0) +,fMsgOwned(true) +{ + if (memoryManager) + fMemoryManager = memoryManager->getExceptionMemoryManager(); + + const XMLSize_t msgSize = 2047; + XMLCh errText[msgSize + 1]; + + // load the text + if(messageCode==0) + messageCode=XMLDOMMsg::DOMEXCEPTION_ERRX+exCode; + + msg = XMLString::replicate + ( + DOMImplementationImpl::getMsgLoader4DOM()->loadMsg(messageCode, errText, msgSize) ? errText : XMLUni::fgDefErrMsg + , fMemoryManager + ); +} + +DOMException::DOMException(const DOMException &other) +:code(other.code) +,msg(0) +,fMemoryManager(other.fMemoryManager) +,fMsgOwned(other.fMsgOwned) +{ + if (other.msg) + msg = other.fMsgOwned? XMLString::replicate(other.msg, other.fMemoryManager) : other.msg; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/DOMException.hpp b/project/jni/xerces/src/xercesc/dom/DOMException.hpp new file mode 100644 index 000000000..142f8df6f --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMException.hpp @@ -0,0 +1,257 @@ +/* + * 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: DOMException.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * DOM operations only raise exceptions in "exceptional" circumstances, i.e., + * when an operation is impossible to perform (either for logical reasons, + * because data is lost, or because the implementation has become unstable). + * In general, DOM methods return specific error values in ordinary + * processing situations, such as out-of-bound errors when using + * DOMNodeList. + *

Implementations should raise other exceptions under other circumstances. + * For example, implementations should raise an implementation-dependent + * exception if a null argument is passed. + *

Some languages and object systems do not support the concept of + * exceptions. For such systems, error conditions may be indicated using + * native error reporting mechanisms. For some bindings, for example, + * methods may return error codes similar to those listed in the + * corresponding method descriptions. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + * @since DOM Level 1 + */ + +class MemoryManager; + +class CDOM_EXPORT DOMException { +public: + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * ExceptionCode + * + *

INDEX_SIZE_ERR: + * If index or size is negative, or greater than the allowed value.

+ * + *

DOMSTRING_SIZE_ERR: + * If the specified range of text does not fit into a DOMString.

+ * + *

HIERARCHY_REQUEST_ERR: + * If any node is inserted somewhere it doesn't belong.

+ * + *

WRONG_DOCUMENT_ERR: + * If a node is used in a different document than the one that created it + * (that doesn't support it).

+ * + *

INVALID_CHARACTER_ERR: + * If an invalid or illegal character is specified, such as in a name. See + * production 2 in the XML specification for the definition of a legal + * character, and production 5 for the definition of a legal name + * character.

+ * + *

NO_DATA_ALLOWED_ERR: + * If data is specified for a node which does not support data.

+ * + *

NO_MODIFICATION_ALLOWED_ERR: + * If an attempt is made to modify an object where modifications are not + * allowed.

+ * + *

NOT_FOUND_ERR: + * If an attempt is made to reference a node in a context where it does + * not exist.

+ * + *

NOT_SUPPORTED_ERR: + * If the implementation does not support the requested type of object or + * operation.

+ * + *

INUSE_ATTRIBUTE_ERR: + * If an attempt is made to add an attribute that is already in use + * elsewhere.

+ * + * The above are since DOM Level 1 + * @since DOM Level 1 + * + *

INVALID_STATE_ERR: + * If an attempt is made to use an object that is not, or is no longer, + * usable.

+ * + *

SYNTAX_ERR: + * If an invalid or illegal string is specified.

+ * + *

INVALID_MODIFICATION_ERR: + * If an attempt is made to modify the type of the underlying object.

+ * + *

NAMESPACE_ERR: + * If an attempt is made to create or change an object in a way which is + * incorrect with regard to namespaces.

+ * + *

INVALID_ACCESS_ERR: + * If a parameter or an operation is not supported by the underlying + * object. + * + * The above are since DOM Level 2 + * @since DOM Level 2 + * + *

VALIDATION_ERR: + * If a call to a method such as insertBefore or + * removeChild would make the Node invalid + * with respect to "partial validity", this exception would be raised + * and the operation would not be done. + * + *

TYPE_MISMATCH_ERR: + * If the type of an object is incompatible with the expected type of + * the parameter associated to the object, this exception would be raised. + * + * The above is since DOM Level 3 + * @since DOM Level 3 + */ + enum ExceptionCode { + INDEX_SIZE_ERR = 1, + DOMSTRING_SIZE_ERR = 2, + HIERARCHY_REQUEST_ERR = 3, + WRONG_DOCUMENT_ERR = 4, + INVALID_CHARACTER_ERR = 5, + NO_DATA_ALLOWED_ERR = 6, + NO_MODIFICATION_ALLOWED_ERR = 7, + NOT_FOUND_ERR = 8, + NOT_SUPPORTED_ERR = 9, + INUSE_ATTRIBUTE_ERR = 10, + INVALID_STATE_ERR = 11, + SYNTAX_ERR = 12, + INVALID_MODIFICATION_ERR = 13, + NAMESPACE_ERR = 14, + INVALID_ACCESS_ERR = 15, + VALIDATION_ERR = 16, + TYPE_MISMATCH_ERR = 17 + }; + //@} + +public: + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + /** + * Default constructor for DOMException. + * + */ + DOMException(); + + /** + * Constructor which takes an error code and an optional message code. + * + * @param code The error code which indicates the exception + * @param messageCode The string containing the error message + * @param memoryManager The memory manager used to (de)allocate memory + */ + DOMException(short code, + short messageCode = 0, + MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor. + * + * @param other The object to be copied. + */ + DOMException(const DOMException &other); + + //@} + + // ----------------------------------------------------------------------- + // Destructors + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + /** + * Destructor for DOMException. + * + */ + virtual ~DOMException(); + //@} + + +public: + // ----------------------------------------------------------------------- + // Getter + // ----------------------------------------------------------------------- + inline const XMLCh* getMessage() const; + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public variables */ + //@{ + /** + * A code value, from the set defined by the ExceptionCode enum, + * indicating the type of error that occured. + */ + short code; + + /** + * A string value. Applications may use this field to hold an error + * message. The field value is not set by the DOM implementation, + * meaning that the string will be empty when an exception is first + * thrown. + */ + const XMLCh *msg; + //@} + +protected: + MemoryManager* fMemoryManager; + +private: + + /** + * A boolean value. + * If the message is provided by the applications, it is not + * adopted. + * If the message is resolved by the DOM implementation, it is + * owned. + */ + bool fMsgOwned; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMException & operator = (const DOMException &); +}; + +inline const XMLCh* DOMException::getMessage() const +{ + return msg; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMImplementation.hpp b/project/jni/xerces/src/xercesc/dom/DOMImplementation.hpp new file mode 100644 index 000000000..79ef38629 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMImplementation.hpp @@ -0,0 +1,249 @@ +/* + * 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: DOMImplementation.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMDocument; +class DOMDocumentType; + +/** + * The DOMImplementation interface provides a number of methods + * for performing operations that are independent of any particular instance + * of the document object model. + */ + +class CDOM_EXPORT DOMImplementation : public DOMImplementationLS +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMImplementation() {}; // no plain constructor + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMImplementation(const DOMImplementation &); // no copy constructor. + DOMImplementation & operator = (const DOMImplementation &); // No Assignment + //@} + + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMImplementation() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMImplementation interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + /** + * Test if the DOM implementation implements a specific feature. + * @param feature The name of the feature to test (case-insensitive). The + * values used by DOM features are defined throughout the DOM Level 2 + * specifications and listed in the section. The name must be an XML + * name. To avoid possible conflicts, as a convention, names referring + * to features defined outside the DOM specification should be made + * unique. + * @param version This is the version number of the feature to test. In + * Level 2, the string can be either "2.0" or "1.0". If the version is + * not specified, supporting any version of the feature causes the + * method to return true. + * @return true if the feature is implemented in the + * specified version, false otherwise. + * @since DOM Level 1 + */ + virtual bool hasFeature(const XMLCh *feature, const XMLCh *version) const = 0; + //@} + + // ----------------------------------------------------------------------- + // Functions introduced in DOM Level 2 + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + /** + * Creates an empty DOMDocumentType node. Entity declarations + * and notations are not made available. Entity reference expansions and + * default attribute additions do not occur. It is expected that a + * future version of the DOM will provide a way for populating a + * DOMDocumentType. + * @param qualifiedName The qualified name of the document type to be + * created. + * @param publicId The external subset public identifier. + * @param systemId The external subset system identifier. + * @return A new DOMDocumentType node with + * ownerDocument set to null. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified qualified name + * contains an illegal character. + *
NAMESPACE_ERR: Raised if the qualifiedName is + * malformed. + *
NOT_SUPPORTED_ERR: May be raised by DOM implementations which do + * not support the "XML" feature, if they choose not to + * support this method. Other features introduced in the future, by + * the DOM WG or in extensions defined by other groups, may also + * demand support for this method; please consult the definition of + * the feature to see if it requires this method. + * @since DOM Level 2 + */ + virtual DOMDocumentType *createDocumentType(const XMLCh *qualifiedName, + const XMLCh *publicId, + const XMLCh *systemId) = 0; + + /** + * Creates a DOMDocument object of the specified type with its document + * element. + * @param namespaceURI The namespace URI of the document element to + * create. + * @param qualifiedName The qualified name of the document element to be + * created. + * @param doctype The type of document to be created or null. + * When doctype is not null, its + * ownerDocument attribute is set to the document + * being created. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @return A new DOMDocument object. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified qualified name + * contains an illegal character. + *
NAMESPACE_ERR: Raised if the qualifiedName is + * malformed, if the qualifiedName has a prefix and the + * namespaceURI is null, or if the + * qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from " + * http://www.w3.org/XML/1998/namespace" , or if the DOM + * implementation does not support the "XML" feature but + * a non-null namespace URI was provided, since namespaces were + * defined by XML. + *
WRONG_DOCUMENT_ERR: Raised if doctype has already + * been used with a different document or was created from a different + * implementation. + *
NOT_SUPPORTED_ERR: May be raised by DOM implementations which do + * not support the "XML" feature, if they choose not to support this + * method. Other features introduced in the future, by the DOM WG or + * in extensions defined by other groups, may also demand support for + * this method; please consult the definition of the feature to see if + * it requires this method. + * @since DOM Level 2 + */ + + virtual DOMDocument *createDocument(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + DOMDocumentType *doctype, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + //@} + // ----------------------------------------------------------------------- + // Functions introduced in DOM Level 3 + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * This method returns a specialized object which implements the specialized APIs + * of the specified feature and version, as specified in DOM Features. + * This method also allow the implementation to provide specialized objects which + * do not support the DOMImplementation interface. + * + * @param feature The name of the feature requested (case-insensitive). + * Note that any plus sign "+" prepended to the name of the feature will + * be ignored since it is not significant in the context of this method. + * @param version This is the version number of the feature to test. + * @return Returns an object which implements the specialized APIs of the specified + * feature and version, if any, or null if there is no object which implements + * interfaces associated with that feature. + * @since DOM Level 3 + */ + virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0; + + //@} + + // ----------------------------------------------------------------------- + // Non-standard extension + // ----------------------------------------------------------------------- + /** @name Non-standard extension */ + //@{ + /** + * Non-standard extension + * + * Create a completely empty document that has neither a root element or a doctype node. + */ + virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + /** + * Non-standard extension + * + * Factory method for getting a DOMImplementation object. + * The DOM implementation retains ownership of the returned object. + * Application code should NOT delete it. + */ + static DOMImplementation *getImplementation(); + + /** + * Non-standard extension + * + * Load the default error text message for DOMException. + * @param msgToLoad The DOM ExceptionCode id to be processed + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @return true if the message is successfully loaded + */ + static bool loadDOMExceptionMsg + ( + const short msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + ); + + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMImplementationLS.hpp b/project/jni/xerces/src/xercesc/dom/DOMImplementationLS.hpp new file mode 100644 index 000000000..acd09a213 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMImplementationLS.hpp @@ -0,0 +1,183 @@ +/* + * 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: DOMImplementationLS.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMLSParser; +class DOMLSSerializer; +class DOMLSInput; +class DOMLSOutput; +class MemoryManager; +class XMLGrammarPool; + +/** + *

DOMImplementationLS contains the factory methods for + * creating Load and Save objects.

+ * + *

An object that implements DOMImplementationLS is obtained by doing a + * binding specific cast from DOMImplementation to DOMImplementationLS. + * Implementations supporting the Load and Save feature must implement the + * DOMImplementationLS interface on whatever object implements the + * DOMImplementation interface.

+ * + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMImplementationLS +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMImplementationLS() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMImplementationLS(const DOMImplementationLS &); + DOMImplementationLS & operator = (const DOMImplementationLS &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMImplementationLS() {}; + //@} + + // ----------------------------------------------------------------------- + // Public constants + // ----------------------------------------------------------------------- + /** @name Public constants */ + //@{ + /** + * Create a synchronous or an asynchronous DOMLSParser. + * @see createLSParser(const DOMImplementationLSMode mode, const XMLCh* const schemaType) + * @since DOM Level 3 + * + */ + enum DOMImplementationLSMode + { + MODE_SYNCHRONOUS = 1, + MODE_ASYNCHRONOUS = 2 + }; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMImplementationLS interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Factory create methods + // ----------------------------------------------------------------------- + /** + * Create a new DOMLSParser. The newly constructed parser may then be configured + * by means of its DOMConfiguration object, and used to parse documents by + * means of its parse method. + * + * @param mode The mode argument is either MODE_SYNCHRONOUS + * or MODE_ASYNCHRONOUS, if mode is MODE_SYNCHRONOUS + * then the DOMLSParser that is created will operate in synchronous + * mode, if it's MODE_ASYNCHRONOUS then the DOMLSParser + * that is created will operate in asynchronous mode. + * @param schemaType An absolute URI representing the type of the schema + * language used during the load of a DOMDocument using the newly + * created DOMLSParser. Note that no lexical checking is done on + * the absolute URI. In order to create a DOMLSParser for any kind + * of schema types (i.e. the DOMLSParser will be free to use any + * schema found), use the value NULL. + * Note: For W3C XML Schema [XML Schema Part 1], applications must use + * the value "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0], + * applications must use the value "http://www.w3.org/TR/REC-xml". + * Other Schema languages are outside the scope of the W3C and therefore should + * recommend an absolute URI in order to use this method. + * @param manager Pointer to the memory manager to be used to allocate objects. + * @param gramPool The collection of cached grammars. + * @return The newly created DOMLSParser object. This + * DOMLSParser is either synchronous or asynchronous depending + * on the value of the mode argument. + * @exception DOMException NOT_SUPPORTED_ERR: Raised if the requested mode + * or schema type is not supported. + * + * @see DOMLSParser + * @since DOM Level 3 + */ + virtual DOMLSParser* createLSParser(const DOMImplementationLSMode mode, + const XMLCh* const schemaType, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager, + XMLGrammarPool* const gramPool = 0) = 0; + + + /** + * Create a new DOMLSSerializer. DOMLSSerializer is used to serialize a DOM tree + * back into an XML document. + * + * @return The newly created DOMLSSerializer object. + * + * @see DOMLSSerializer + * @since DOM Level 3 + */ + virtual DOMLSSerializer* createLSSerializer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + /** + * Create a new "empty" DOMLSInput. + * + * @return The newly created DOMLSInput object. + * + * @see DOMLSInput + * @since DOM Level 3 + */ + virtual DOMLSInput* createLSInput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + /** + * Create a new "empty" LSOutput. + * + * @return The newly created LSOutput object. + * + * @see LSOutput + * @since DOM Level 3 + */ + virtual DOMLSOutput* createLSOutput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMImplementationList.hpp b/project/jni/xerces/src/xercesc/dom/DOMImplementationList.hpp new file mode 100644 index 000000000..45990e955 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMImplementationList.hpp @@ -0,0 +1,124 @@ +/* + * 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: DOMImplementationList.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMImplementation; + + +/** + * The DOMImplementationList interface provides the abstraction of an ordered + * collection of DOM implementations, without defining or constraining how this collection + * is implemented. The items in the DOMImplementationList are accessible via + * an integral index, starting from 0. + */ + +class CDOM_EXPORT DOMImplementationList { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMImplementationList() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMImplementationList(const DOMImplementationList &); + DOMImplementationList & operator = (const DOMImplementationList &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMImplementationList() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMImplementationList interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the index item in the collection. + * + * If index is greater than or equal to the number of DOMImplementation in + * the list, this returns null. + * + * @param index Index into the collection. + * @return The DOMImplementation at the indexth position in the + * DOMImplementationList, or null if that is not a valid + * index. + * @since DOM Level 3 + */ + virtual DOMImplementation *item(XMLSize_t index) const = 0; + + /** + * Returns the number of DOMImplementation in the list. + * + * The range of valid child node indices is 0 to length-1 inclusive. + * @since DOM Level 3 + */ + virtual XMLSize_t getLength() const = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this list is no longer in use + * and that the implementation may relinquish any resources associated with it and + * its associated children. + * + * Access to a released object will lead to unexpected result. + * + */ + virtual void release() = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMImplementationRegistry.hpp b/project/jni/xerces/src/xercesc/dom/DOMImplementationRegistry.hpp new file mode 100644 index 000000000..b151cf195 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMImplementationRegistry.hpp @@ -0,0 +1,101 @@ +/* + * 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: DOMImplementationRegistry.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP + + /** + * This class holds the list of registered DOMImplementations. Implementation + * or application can register DOMImplementationSource to the registry, and + * then can query DOMImplementation based on a list of requested features. + * + *

This provides an application with an implementation independent starting + * point. + * + * @see DOMImplementation + * @see DOMImplementationList + * @see DOMImplementationSource + * @since DOM Level 3 + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMImplementation; +class DOMImplementationSource; +class DOMImplementationList; + +class CDOM_EXPORT DOMImplementationRegistry +{ +public: + // ----------------------------------------------------------------------- + // Static DOMImplementationRegistry interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * Return the first registered implementation that has the desired features, + * or null if none is found. + * + * @param features A string that specifies which features are required. + * This is a space separated list in which each feature is + * specified by its name optionally followed by a space + * and a version number. + * This is something like: "XML 1.0 Traversal 2.0" + * @return An implementation that has the desired features, or + * null if this source has none. + * @since DOM Level 3 + */ + static DOMImplementation* getDOMImplementation(const XMLCh* features); + + /** + * Return the list of registered implementation that have the desired features. + * + * @param features A string that specifies which features are required. + * This is a space separated list in which each feature is + * specified by its name optionally followed by a space + * and a version number. + * This is something like: "XML 1.0 Traversal 2.0" + * @return A DOMImplementationList object that contains the DOMImplementation + * that have the desired features + * @since DOM Level 3 + */ + static DOMImplementationList* getDOMImplementationList(const XMLCh* features); + + /** + * Register an implementation. + * + * @param source A DOMImplementation Source object to be added to the registry. + * The registry does NOT adopt the source object. Users still own it. + * @since DOM Level 3 + */ + static void addSource(DOMImplementationSource* source); + //@} + +private: + DOMImplementationRegistry(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMImplementationSource.hpp b/project/jni/xerces/src/xercesc/dom/DOMImplementationSource.hpp new file mode 100644 index 000000000..21cc7b690 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMImplementationSource.hpp @@ -0,0 +1,112 @@ +/* + * 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: DOMImplementationSource.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP + + /** + * This interface permits a DOM implementer to supply one or more + * implementations, based upon requested features and versions. Each implemented + * DOMImplementationSource object is listed in the + * binding-specific list of available sources so that its + * DOMImplementation objects are made available. + * + * @since DOM Level 3 + */ +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMImplementation; +class DOMImplementationList; + +class CDOM_EXPORT DOMImplementationSource +{ +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMImplementationSource() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMImplementationSource(const DOMImplementationSource &); + DOMImplementationSource & operator = (const DOMImplementationSource &); + //@} + + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMImplementationSource() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMImplementationSource interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * A method to request the first DOM implementation that supports the specified features. + * + * @param features A string that specifies which features are required. + * This is a space separated list in which each feature is specified + * by its name optionally followed by a space and a version number. + * This is something like: "XML 1.0 Traversal 2.0" + * @return An implementation that has the desired features, or + * null if this source has none. + * @since DOM Level 3 + */ + virtual DOMImplementation* getDOMImplementation(const XMLCh* features) const = 0; + + /** + * A method to request a list of DOM implementations that support the specified features and versions, + * + * @param features A string that specifies which features are required. + * This is a space separated list in which each feature is specified + * by its name optionally followed by a space and a version number. + * This is something like: "XML 1.0 Traversal 2.0" + * @return A list of DOM implementations that support the desired features + * @since DOM Level 3 + */ + virtual DOMImplementationList* getDOMImplementationList(const XMLCh* features) const = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSException.cpp b/project/jni/xerces/src/xercesc/dom/DOMLSException.cpp new file mode 100644 index 000000000..0e3df1c6d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSException.cpp @@ -0,0 +1,49 @@ +/* + * 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: DOMLSException.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMLSException.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMLSException::DOMLSException() +: DOMException() +{ +} + +DOMLSException::DOMLSException(short exCode, + short messageCode, + MemoryManager* const memoryManager) +: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMLSEXCEPTION_ERRX+exCode-DOMLSException::PARSE_ERR+1, memoryManager) +{ +} + +DOMLSException::DOMLSException(const DOMLSException &other) +: DOMException(other) +{ +} + + +DOMLSException::~DOMLSException() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSException.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSException.hpp new file mode 100644 index 000000000..14d9cabe0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSException.hpp @@ -0,0 +1,123 @@ +/* + * 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: DOMLSException.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Parser or write operations may throw an LSException if the processing is stopped. + * The processing can be stopped due to a DOMError with a severity of + * DOMError::DOM_SEVERITY_FATAL_ERROR or a non recovered DOMError::DOM_SEVERITY_ERROR, + * or if DOMErrorHandler::handleError() returned false. + *

Note: As suggested in the definition of the constants in the DOMError + * interface, a DOM implementation may choose to continue after a fatal error, but the + * resulting DOM tree is then implementation dependent. + *

See also the + * Document Object Model (DOM) Level 3 Load and Save Specification. + * @since DOM Level 3 + */ + +class MemoryManager; + +class CDOM_EXPORT DOMLSException : public DOMException { +public: + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Contants */ + //@{ + /** + * ExceptionCode + * + *

PARSE_ERR: + * If an attempt was made to load a document, or an XML Fragment, using DOMLSParser + * and the processing has been stopped.

+ * + *

SERIALIZE_ERR: + * If an attempt was made to serialize a Node using LSSerializer and the processing + * has been stopped.

+ * + * @since DOM Level 3 + */ + enum LSExceptionCode { + PARSE_ERR = 81, + SERIALIZE_ERR = 82 + }; + //@} + + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + /** + * Default constructor for DOMLSException. + * + */ + DOMLSException(); + + /** + * Constructor which takes an error code and a message. + * + * @param code The error code which indicates the exception + * @param messageCode The string containing the error message + * @param memoryManager The memory manager used to (de)allocate memory + */ + DOMLSException(short code, + short messageCode, + MemoryManager* const memoryManager); + + /** + * Copy constructor. + * + * @param other The object to be copied. + */ + DOMLSException(const DOMLSException &other); + + //@} + + // ----------------------------------------------------------------------- + // Destructors + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + /** + * Destructor for DOMLSException. + * + */ + virtual ~DOMLSException(); + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMLSException & operator = (const DOMLSException &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSInput.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSInput.hpp new file mode 100644 index 000000000..a73a6eab6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSInput.hpp @@ -0,0 +1,274 @@ +/* + * 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: DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class InputSource; + + +/** + * This interface represents a single input source for an XML entity. + * + *

This interface allows an application to encapsulate information about + * an input source in a single object, which may include a public identifier, + * a system identifier, a byte stream (possibly with a specified encoding), + * and/or a character stream.

+ * + *

There are two places that the application will deliver this input source + * to the parser: as the argument to the parse method, or as the return value + * of the DOMLSResourceResolver.resolveResource method.

+ * + *

The DOMLSParser will use the DOMLSInput object to determine how to + * read XML input. If there is a character stream available, the parser will + * read that stream directly; if not, the parser will use a byte stream, if + * available; if neither a character stream nor a byte stream is available, + * the parser will attempt to open a URI connection to the resource identified + * by the system identifier.

+ * + *

A DOMLSInput object belongs to the application: the parser shall + * never modify it in any way (it may modify a copy if necessary).

+ * + * @see DOMLSParser#parse + * @see DOMLSResourceResolver#resolveResource + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMLSInput +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSInput() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSInput(const DOMLSInput &); + DOMLSInput & operator = (const DOMLSInput &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSInput() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSInput interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters). + * It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of + * the encoding attribute will be ignored. + * + */ + virtual const XMLCh* getStringData() const = 0; + + /** + * Returns the byte stream for this input source. + * + * @see InputSource + */ + virtual InputSource* getByteStream() const = 0; + + /** + * An input source can be set to force the parser to assume a particular + * encoding for the data that input source reprsents, via the setEncoding() + * method. This method returns name of the encoding that is to be forced. + * If the encoding has never been forced, it returns a null pointer. + * + * @return The forced encoding, or null if none was supplied. + * @see #setEncoding + * @since DOM Level 3 + */ + virtual const XMLCh* getEncoding() const = 0; + + + /** + * Get the public identifier for this input source. + * + * @return The public identifier, or null if none was supplied. + * @see #setPublicId + * @since DOM Level 3 + */ + virtual const XMLCh* getPublicId() const = 0; + + + /** + * Get the system identifier for this input source. + * + *

If the system ID is a URL, it will be fully resolved.

+ * + * @return The system identifier. + * @see #setSystemId + * @since DOM Level 3 + */ + virtual const XMLCh* getSystemId() const = 0; + + + /** + * Get the base URI to be used for resolving relative URIs to absolute + * URIs. If the baseURI is itself a relative URI, the behavior is + * implementation dependent. + * + * @return The base URI. + * @see #setBaseURI + * @since DOM Level 3 + */ + virtual const XMLCh* getBaseURI() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + // ----------------------------------------------------------------------- + /** + * Sets the UTF-16 string for this input source. + * + */ + virtual void setStringData(const XMLCh* data) = 0; + + /** + * Sets the byte stream for this input source. + * + * @see BinInputStream + */ + virtual void setByteStream(InputSource* stream) = 0; + + /** + * Set the encoding which will be required for use with the XML text read + * via a stream opened by this input source. + * + *

This is usually not set, allowing the encoding to be sensed in the + * usual XML way. However, in some cases, the encoding in the file is known + * to be incorrect because of intermediate transcoding, for instance + * encapsulation within a MIME document. + * + * @param encodingStr The name of the encoding to force. + * @since DOM Level 3 + */ + virtual void setEncoding(const XMLCh* const encodingStr) = 0; + + + /** + * Set the public identifier for this input source. + * + *

The public identifier is always optional: if the application writer + * includes one, it will be provided as part of the location information.

+ * + * @param publicId The public identifier as a string. + * @see #getPublicId + * @since DOM Level 3 + */ + virtual void setPublicId(const XMLCh* const publicId) = 0; + + /** + * Set the system identifier for this input source. + * + *

The system id is always required. The public id may be used to map + * to another system id, but the system id must always be present as a fall + * back.

+ * + *

If the system ID is a URL, it must be fully resolved.

+ * + * @param systemId The system identifier as a string. + * @see #getSystemId + * @since DOM Level 3 + */ + virtual void setSystemId(const XMLCh* const systemId) = 0; + + /** + * Set the base URI to be used for resolving relative URIs to absolute + * URIs. If the baseURI is itself a relative URI, the behavior is + * implementation dependent. + * + * @param baseURI The base URI. + * @see #getBaseURI + * @since DOM Level 3 + */ + virtual void setBaseURI(const XMLCh* const baseURI) = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + + /** + * Indicates if the parser should issue fatal error if this input source + * is not found. If set to false, the parser issue warning message instead. + * + * @param flag True if the parser should issue fatal error if this input source is not found. + * If set to false, the parser issue warning message instead. (Default: true) + * + * @see #getIssueFatalErrorIfNotFound + */ + virtual void setIssueFatalErrorIfNotFound(bool flag) = 0; + + + /** + * Get the flag that indicates if the parser should issue fatal error if this input source + * is not found. + * + * @return True if the parser should issue fatal error if this input source is not found. + * False if the parser issue warning message instead. + * @see #setIssueFatalErrorIfNotFound + */ + virtual bool getIssueFatalErrorIfNotFound() const = 0; + + /** + * Called to indicate that this DOMLSInput is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSOutput.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSOutput.hpp new file mode 100644 index 000000000..ab86288e6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSOutput.hpp @@ -0,0 +1,169 @@ +/* + * 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: DOMLSOutput.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class XMLFormatTarget; + + +/** + * This interface represents an output destination for data. + * + * @see XMLFormatTarget + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMLSOutput +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSOutput() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSOutput(const DOMLSOutput &); + DOMLSOutput & operator = (const DOMLSOutput &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSOutput() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSOutput interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the byte stream for this input source. + * + * @see InputSource + */ + virtual XMLFormatTarget* getByteStream() const = 0; + + /** + * An input source can be set to force the parser to assume a particular + * encoding for the data that input source reprsents, via the setEncoding() + * method. This method returns name of the encoding that is to be forced. + * If the encoding has never been forced, it returns a null pointer. + * + * @return The forced encoding, or null if none was supplied. + * @see #setEncoding + * @since DOM Level 3 + */ + virtual const XMLCh* getEncoding() const = 0; + + /** + * Get the system identifier for this input source. + * + *

If the system ID is a URL, it will be fully resolved.

+ * + * @return The system identifier. + * @see #setSystemId + * @since DOM Level 3 + */ + virtual const XMLCh* getSystemId() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Sets the byte stream for this input source. + * + * @see BinInputStream + */ + virtual void setByteStream(XMLFormatTarget* stream) = 0; + + /** + * Set the encoding which will be required for use with the XML text read + * via a stream opened by this input source. + * + *

This is usually not set, allowing the encoding to be sensed in the + * usual XML way. However, in some cases, the encoding in the file is known + * to be incorrect because of intermediate transcoding, for instance + * encapsulation within a MIME document. + * + * @param encodingStr The name of the encoding to force. + * @since DOM Level 3 + */ + virtual void setEncoding(const XMLCh* const encodingStr) = 0; + + /** + * Set the system identifier for this input source. + * + *

The system id is always required. The public id may be used to map + * to another system id, but the system id must always be present as a fall + * back.

+ * + *

If the system ID is a URL, it must be fully resolved.

+ * + * @param systemId The system identifier as a string. + * @see #getSystemId + * @since DOM Level 3 + */ + virtual void setSystemId(const XMLCh* const systemId) = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this DOMLSOutput is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSParser.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSParser.hpp new file mode 100644 index 000000000..fcfc839be --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSParser.hpp @@ -0,0 +1,766 @@ +/* + * 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: DOMLSParser.hpp 832686 2009-11-04 08:55:59Z borisk $ + * + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMErrorHandler; +class DOMLSInput; +class DOMNode; +class DOMDocument; + +/** + * DOMLSParser provides an API for parsing XML documents and building the + * corresponding DOM document tree. A DOMLSParser instance is obtained from + * the DOMImplementationLS interface by invoking its createLSParser method. + * + * @since DOM Level 3 + * + */ +class CDOM_EXPORT DOMLSParser +{ +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSParser() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSParser(const DOMLSParser &); + DOMLSParser & operator = (const DOMLSParser &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSParser() {}; + //@} + + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * A set of possible actions for the parseWithContext method. + * + *

ACTION_APPEND_AS_CHILDREN: + * Append the result of the parse operation as children of the context node. + * For this action to work, the context node must be a DOMElement + * or a DOMDocumentFragment.

+ * + *

ACTION_INSERT_AFTER: + * Insert the result of the parse operation as the immediately following sibling + * of the context node. For this action to work the context node's parent must + * be a DOMElement or a DOMDocumentFragment.

+ * + *

ACTION_INSERT_BEFORE: + * Insert the result of the parse operation as the immediately preceding sibling + * of the context node. For this action to work the context node's parent must + * be a DOMElement or a DOMDocumentFragment.

+ * + *

ACTION_REPLACE: + * Replace the context node with the result of the parse operation. For this + * action to work, the context node must have a parent, and the parent must be + * a DOMElement or a DOMDocumentFragment.

+ * + *

ACTION_REPLACE_CHILDREN: + * Replace all the children of the context node with the result of the parse + * operation. For this action to work, the context node must be a DOMElement, + * a DOMDocument, or a DOMDocumentFragment.

+ * + * @see parseWithContext(...) + * @since DOM Level 3 + */ + enum ActionType + { + ACTION_APPEND_AS_CHILDREN = 1, + ACTION_REPLACE_CHILDREN = 2, + ACTION_INSERT_BEFORE = 3, + ACTION_INSERT_AFTER = 4, + ACTION_REPLACE = 5 + }; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSParser interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** + * Get a pointer to the DOMConfiguration object used when parsing + * an input source. + * This DOMConfiguration is specific to the parse operation. + * No parameter values from this DOMConfiguration object are passed + * automatically to the DOMConfiguration object on the + * DOMDocument that is created, or used, by the parse operation. + * The DOM application is responsible for passing any needed parameter values + * from this DOMConfiguration object to the DOMConfiguration + * object referenced by the DOMDocument object. + * + * In addition to the parameters recognized in on the DOMConfiguration + * interface defined in [DOM Level 3 Core], the DOMConfiguration objects + * for DOMLSParser add or modify the following parameters: + * + * "charset-overrides-xml-encoding" + * true [optional] (default) + * If a higher level protocol such as HTTP [IETF RFC 2616] provides an + * indication of the character encoding of the input stream being processed, + * that will override any encoding specified in the XML declaration or the + * Text declaration (see also section 4.3.3, "Character Encoding in Entities", + * in [XML 1.0]). Explicitly setting an encoding in the DOMLSInput + * overrides any encoding from the protocol. + * false [required] + * The parser ignores any character set encoding information from higher-level + * protocols. + * + * "disallow-doctype" + * true [optional] + * Throw a fatal "doctype-not-allowed" error if a doctype node is found while + * parsing the document. This is useful when dealing with things like SOAP + * envelopes where doctype nodes are not allowed. + * false [required] (default) + * Allow doctype nodes in the document. + * + * "ignore-unknown-character-denormalizations" + * true [required] (default) + * If, while verifying full normalization when [XML 1.1] is supported, a + * processor encounters characters for which it cannot determine the normalization + * properties, then the processor will ignore any possible denormalizations + * caused by these characters. + * This parameter is ignored for [XML 1.0]. + * false [optional] + * Report an fatal "unknown-character-denormalization" error if a character + * is encountered for which the processor cannot determine the normalization + * properties. + * + * "infoset" + * See the definition of DOMConfiguration for a description of this parameter. + * Unlike in [DOM Level 3 Core], this parameter will default to true for DOMLSParser. + * + * "namespaces" + * true [required] (default) + * Perform the namespace processing as defined in [XML Namespaces] and + * [XML Namespaces 1.1]. + * false [optional] + * Do not perform the namespace processing. + * + * "resource-resolver" [required] + * A pointer to a DOMLSResourceResolver object, or NULL. If the value of this parameter + * is not null when an external resource (such as an external XML entity or an XML schema + * location) is encountered, the implementation will request that the DOMLSResourceResolver + * referenced in this parameter resolves the resource. + * + * "supported-media-types-only" + * true [optional] + * Check that the media type of the parsed resource is a supported media type. If + * an unsupported media type is encountered, a fatal error of type "unsupported-media-type" + * will be raised. The media types defined in [IETF RFC 3023] must always be accepted. + * false [required] (default) + * Accept any media type. + * + * "validate" + * See the definition of DOMConfiguration for a description of this parameter. + * Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even + * if this parameter is set to false. + * + * "validate-if-schema" + * See the definition of DOMConfiguration for a description of this parameter. + * Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even + * if this parameter is set to false. + * + * "well-formed" + * See the definition of DOMConfiguration for a description of this parameter. + * Unlike in [DOM Level 3 Core], this parameter cannot be set to false. + * + * In addition to these, Xerces adds these non standard parameters: + * + * "http://apache.org/xml/properties/entity-resolver" + * A pointer to a XMLEntityResolver object, or NULL. If the value of this parameter + * is not null when an external resource (such as an external XML entity or an XML schema + * location) is encountered, the implementation will request that the XMLEntityResolver + * referenced in this parameter resolves the resource. + * + * "http://apache.org/xml/properties/schema/external-schemaLocation" + * A string holding a set of [namespaceUri schemaLocation] entries that will be treated as + * the content of the attribute xsi:schemaLocation of the root element + * + * "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" + * A string holding the schemaLocation for the empty namespace URI that will be treated as + * the content of the attribute xsi:noNamespaceSchemaLocation of the root element + * + * "http://apache.org/xml/properties/security-manager" + * A pointer to a SecurityManager object that will control how many entity references will be + * expanded during parsing + * + * "http://apache.org/xml/properties/scannerName" + * A string holding the type of scanner used while parsing. The valid names are: + *
    + *
  • IGXMLScanner: the default one, capable of both XMLSchema and DTD validation
  • + *
  • SGXMLScanner: a scanner that can only perform XMLSchema validation
  • + *
  • DGXMLScanner: a scanner that can only perform DTD validation
  • + *
  • WFXMLScanner: a scanner that cannot perform any type validation, only well-formedness
  • + *
+ * + * "http://apache.org/xml/properties/parser-use-DOMDocument-from-Implementation" + * A string holding the capabilities of the DOM implementation to be used to create the DOMDocument + * resulting from the parse operation. For instance, "LS" or "Core" + * + * "http://apache.org/xml/features/validation/schema" + * true + * Enable XMLSchema validation (note that also namespace processing should be enabled) + * false (default) + * Don't perform XMLSchema validation + * + * "http://apache.org/xml/features/validation/schema-full-checking" + * true + * Turn on full XMLSchema checking (e.g. Unique Particle Attribution) + * false (default) + * Don't perform full XMLSchema checking + * + * "http://apache.org/xml/features/validating/load-schema" + * true (default) + * Allow the parser to load schemas that are not in the grammar pool + * false + * Schemas that are not in the grammar pool are ignored + * + * "http://apache.org/xml/features/dom/user-adopts-DOMDocument" + * true + * The DOMDocument objects returned by parse will be owned by the caller + * false (default) + * The DOMDocument objects returned by parse will be owned by this DOMLSParser + * and deleted when released + * + * "http://apache.org/xml/features/nonvalidating/load-external-dtd" + * true (default) + * Allow the parser to load external DTDs + * false + * References to external DTDs will be ignored + * + * "http://apache.org/xml/features/continue-after-fatal-error" + * true + * Parsing should try to continue even if a fatal error has been triggered, trying to generate a DOM tree + * from a non well-formed XML + * false (default) + * Violation of XML rules will abort parsing + * + * "http://apache.org/xml/features/validation-error-as-fatal" + * true + * Validation errors are treated as fatal errors, and abort parsing (unless "continue-after-fatal-error" + * has been specified) + * false (default) + * Validation errors are normal errors + * + * "http://apache.org/xml/features/validation/cache-grammarFromParse" + * true + * XMLSchemas referenced by an XML file are cached in order to be reused by other parse operations + * false (default) + * XMLSchemas loaded during a parse operation will be discarded before the next one + * + * "http://apache.org/xml/features/validation/use-cachedGrammarInParse" + * true + * During this parse operation, reuse the XMLSchemas found in the cache + * false (default) + * Don't reuse the XMLSchemas found in the cache + * + * "http://apache.org/xml/features/calculate-src-ofs" + * true + * During parsing update the position in the source stream + * false (default) + * Don't waste time computing the position in the source stream + * + * "http://apache.org/xml/features/standard-uri-conformant" + * true + * Require that every URL being resolved is made of valid URL characters only + * false (default) + * Allow invalid URL characters in URL (e.g. spaces) + * + * "http://apache.org/xml/features/dom-has-psvi-info" + * true + * Add schema informations to DOMElement and DOMAttr nodes in the output DOM tree + * false (default) + * Don't store schema informations in the output DOM tree + * + * "http://apache.org/xml/features/generate-synthetic-annotations" + * true + * Create annotation objects in the representation of the loaded XMLSchemas + * false (default) + * Discard annotations found in the loaded XMLSchemas + * + * "http://apache.org/xml/features/validate-annotations" + * true + * Check that annotations are valid according to their XMLSchema definition + * false (default) + * Don't validate annotations + * + * "http://apache.org/xml/features/validation/identity-constraint-checking" + * true (default) + * Enforce identity constraints specified in the XMLSchema + * false + * Don't enforce identity constraints + * + * "http://apache.org/xml/features/validation/ignoreCachedDTD" + * true + * Don't reuse DTDs found in the cache, even if use-cachedGrammarInParse is true + * false (default) + * Reuse DTDs found in the cache, if use-cachedGrammarInParse is true + * + * "http://apache.org/xml/features/schema/ignore-annotations" + * true + * Don't process annotations found in an XMLSchema + * false (default) + * Process the annotations found in an XMLSchema + * + * "http://apache.org/xml/features/disable-default-entity-resolution" + * true + * Entities will be resolved only by a resolver installed by the user + * false (default) + * If the entity resolver has not been installed, or it refuses to resolve the given entity, the + * parser will try to locate it himself + * + * "http://apache.org/xml/features/validation/schema/skip-dtd-validation" + * true + * If XMLSchema validation is true, DTD validation will not be performed + * false (default) + * If a DTD is found, it will be used to validate the XML + * + * @return The pointer to the configuration object. + * @since DOM Level 3 + */ + virtual DOMConfiguration* getDomConfig() = 0; + + /** + * Get a const pointer to the application filter + * + * This method returns the installed application filter. If no filter + * has been installed, then it will be a zero pointer. + * + * @return A const pointer to the installed application filter + * @since DOM Level 3 + */ + virtual const DOMLSParserFilter* getFilter() const = 0; + + /** + * Return whether the parser is asynchronous + * + * @return true if the DOMLSParser is asynchronous, + * false if it is synchronous + * @since DOM Level 3 + */ + virtual bool getAsync() const = 0; + + /** + * Return whether the parser is busy parsing + * + * @return true if the DOMLSParser is currently busy + * loading a document, otherwise false. + * @since DOM Level 3 + */ + virtual bool getBusy() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Set the application filter + * + * When the application provides a filter, the parser will call out to + * the filter at the completion of the construction of each DOMElement + * node. The filter implementation can choose to remove the element from the + * document being constructed or to terminate the parse early. + * The filter is invoked after the operations requested by the DOMConfiguration + * parameters have been applied. For example, if "validate" is set to true, + * the validation is done before invoking the filter. + * + * Any previously set filter is merely dropped, since the parser + * does not own them. + * + * @param filter A const pointer to the user supplied application + * filter. + * + * @see #getFilter + * @since DOM Level 3 + */ + virtual void setFilter(DOMLSParserFilter* const filter) = 0; + + // ----------------------------------------------------------------------- + // Parsing methods + // ----------------------------------------------------------------------- + /** + * Parse an XML document from a resource identified by a DOMLSInput. + * + * The parser owns the returned DOMDocument. It will be deleted + * when the parser is released. + * + * @param source The DOMLSInput from which the source of the document + * is to be read. + * @return If the DOMLSParser is a synchronous DOMLSParser + * the newly created and populated DOMDocument is returned. + * If the DOMLSParser is asynchronous then NULL + * is returned since the document object may not yet be constructed when + * this method returns. + * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy + * attribute is true. + * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is + * raised if the DOMLSParser was unable + * to load the XML document. DOM applications should + * attach a DOMErrorHandler using the + * parameter "error-handler" if they wish to get details + * on the error. + * + * @see DOMLSInput#DOMLSInput + * @see DOMConfiguration + * @see resetDocumentPool + * @since DOM Level 3 + */ + virtual DOMDocument* parse(const DOMLSInput* source) = 0; + + /** + * Parse an XML document from a location identified by a URI reference [IETF RFC 2396]. + * If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]), + * the behavior is not defined by this specification, future versions of this + * specification may define the behavior. + * + * The parser owns the returned DOMDocument. It will be deleted + * when the parser is released. + * + * @param uri The location of the XML document to be read (in Unicode) + * @return If the DOMLSParser is a synchronous DOMLSParser + * the newly created and populated DOMDocument is returned. + * If the DOMLSParser is asynchronous then NULL + * is returned since the document object is not yet parsed when this method returns. + * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy + * attribute is true. + * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is + * raised if the DOMLSParser was unable + * to load the XML document. DOM applications should + * attach a DOMErrorHandler using the + * parameter "error-handler" if they wish to get details + * on the error. + * + * @see #parse(DOMLSInput,...) + * @see resetDocumentPool + * @since DOM Level 3 + */ + virtual DOMDocument* parseURI(const XMLCh* const uri) = 0; + + /** + * Parse an XML document from a location identified by a URI reference [IETF RFC 2396]. + * If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]), + * the behavior is not defined by this specification, future versions of this + * specification may define the behavior. + * + * The parser owns the returned DOMDocument. It will be deleted + * when the parser is released. + * + * @param uri The location of the XML document to be read (in the local code page) + * @return If the DOMLSParser is a synchronous DOMLSParser + * the newly created and populated DOMDocument is returned. + * If the DOMLSParser is asynchronous then NULL + * is returned since the document object is not yet parsed when this method returns. + * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy + * attribute is true. + * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is + * raised if the DOMLSParser was unable + * to load the XML document. DOM applications should + * attach a DOMErrorHandler using the + * parameter "error-handler" if they wish to get details + * on the error. + * + * @see #parse(DOMLSInput,...) + * @see resetDocumentPool + * @since DOM Level 3 + */ + virtual DOMDocument* parseURI(const char* const uri) = 0; + + /** + * Parse an XML fragment from a resource identified by a DOMLSInput + * and insert the content into an existing document at the position specified + * with the context and action arguments. When parsing the input stream, the + * context node (or its parent, depending on where the result will be inserted) + * is used for resolving unbound namespace prefixes. The context node's + * ownerDocument node (or the node itself if the node of type + * DOCUMENT_NODE) is used to resolve default attributes and entity + * references. + * As the new data is inserted into the document, at least one mutation event + * is fired per new immediate child or sibling of the context node. + * If the context node is a DOMDocument node and the action is + * ACTION_REPLACE_CHILDREN, then the document that is passed as + * the context node will be changed such that its xmlEncoding, + * documentURI, xmlVersion, inputEncoding, + * xmlStandalone, and all other such attributes are set to what they + * would be set to if the input source was parsed using DOMLSParser::parse(). + * This method is always synchronous, even if the DOMLSParser is + * asynchronous (DOMLSParser::getAsync() returns true). + * If an error occurs while parsing, the caller is notified through the ErrorHandler + * instance associated with the "error-handler" parameter of the DOMConfiguration. + * When calling parseWithContext, the values of the following configuration + * parameters will be ignored and their default values will always be used instead: + * "validate", + * "validate-if-schema" + * "element-content-whitespace". + * Other parameters will be treated normally, and the parser is expected to call + * the DOMLSParserFilter just as if a whole document was parsed. + * + * @param source The DOMLSInput from which the source document is + * to be read. The source document must be an XML fragment, i.e. + * anything except a complete XML document (except in the case where + * the context node of type DOCUMENT_NODE, and the action is + * ACTION_REPLACE_CHILDREN), a DOCTYPE + * (internal subset), entity declaration(s), notation declaration(s), + * or XML or text declaration(s). + * @param contextNode The node that is used as the context for the data that is being + * parsed. This node must be a DOMDocument node, a + * DOMDocumentFragment node, or a node of a type that + * is allowed as a child of an DOMElement node, e.g. + * it cannot be an DOMAttribute node. + * @param action This parameter describes which action should be taken between the new + * set of nodes being inserted and the existing children of the context node. + * The set of possible actions is defined in ACTION_TYPES above. + * @return Return the node that is the result of the parse operation. If the result is more + * than one top-level node, the first one is returned. + * + * @exception DOMException + * HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be inserted before, after, + * or as a child of the context node (see also DOMNode::insertBefore + * or DOMNode::replaceChild in [DOM Level 3 Core]). + * NOT_SUPPORTED_ERR: Raised if the DOMLSParser doesn't support this method, + * or if the context node is of type DOMDocument and the DOM + * implementation doesn't support the replacement of the DOMDocumentType + * child or DOMElement child. + * NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a read only node and the content + * is being appended to its child list, or if the parent node of + * the context node is read only node and the content is being + * inserted in its child list. + * INVALID_STATE_ERR: Raised if the DOMLSParser::getBusy() returns true. + * + * @exception DOMLSException PARSE_ERR: Raised if the DOMLSParser was unable to load + * the XML fragment. DOM applications should attach a + * DOMErrorHandler using the parameter "error-handler" + * if they wish to get details on the error. + * @since DOM Level 3 + */ + virtual DOMNode* parseWithContext(const DOMLSInput* source, DOMNode* contextNode, const ActionType action) = 0; + + /** + * Abort the loading of the document that is currently being loaded by the DOMLSParser. + * If the DOMLSParser is currently not busy, a call to this method does nothing. + * + * Note: invoking this method will remove the installed DOMLSParserFilter filter + * + * @since DOM Level 3 + */ + virtual void abort() = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this DOMLSParser is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + + /** Reset the documents vector pool and release all the associated memory + * back to the system. + * + * When parsing a document using a DOM parser, all memory allocated + * for a DOM tree is associated to the DOM document. + * + * If you do multiple parse using the same DOM parser instance, then + * multiple DOM documents will be generated and saved in a vector pool. + * All these documents (and thus all the allocated memory) + * won't be deleted until the parser instance is destroyed. + * + * If you don't need these DOM documents anymore and don't want to + * destroy the DOM parser instance at this moment, then you can call this method + * to reset the document vector pool and release all the allocated memory + * back to the system. + * + * It is an error to call this method if you are in the middle of a + * parse (e.g. in the mid of a progressive parse). + * + * @exception IOException An exception from the parser if this function + * is called when a parse is in progress. + * + */ + virtual void resetDocumentPool() = 0; + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the DOMLSInput parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param source A const reference to the DOMLSInput object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see DOMLSInput#DOMLSInput + */ + virtual Grammar* loadGrammar(const DOMLSInput* source, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag is + * enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag is + * enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) const = 0; + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + virtual Grammar* getRootGrammar() const = 0; + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + virtual const XMLCh* getURIText(unsigned int uriId) const = 0; + + /** + * Clear the cached grammar pool + */ + virtual void resetCachedGrammarPool() = 0; + + /** + * Returns the current src offset within the input source. + * + * @return offset within the input source + */ + virtual XMLFilePos getSrcOffset() const = 0; + + //@} + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSParserFilter.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSParserFilter.hpp new file mode 100644 index 000000000..062132218 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSParserFilter.hpp @@ -0,0 +1,164 @@ +/* + * 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: DOMLSParserFilter.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP + + /** + * + * DOMLSParserFilter.hpp: interface for the DOMLSParserFilter class. + * + * DOMLSParserFilter provide applications the ability to examine nodes + * as they are being created during the parse process. + * + * DOMLSParserFilter lets the application decide what nodes should be + * in the output DOM tree or not. + * + * @since DOM Level 3 + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElement; +class DOMNode; + +class CDOM_EXPORT DOMLSParserFilter { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSParserFilter() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSParserFilter(const DOMLSParserFilter &); + DOMLSParserFilter & operator = (const DOMLSParserFilter &); + //@} + + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSParserFilter() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Contants */ + //@{ + /** + * Constants returned by acceptNode. + * + *

FILTER_ACCEPT: + * Accept the node.

+ * + *

FILTER_REJECT: + * Reject the node and its children.

+ * + *

FILTER_SKIP: + * Skip this single node. The children of this node will still be considered.

+ * + *

FILTER_INTERRUPT: + * Interrupt the normal processing of the document.

+ * + * @since DOM Level 3 + */ + enum FilterAction {FILTER_ACCEPT = 1, + FILTER_REJECT = 2, + FILTER_SKIP = 3, + FILTER_INTERRUPT = 4}; + + // ----------------------------------------------------------------------- + // Virtual DOMLSParserFilter interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * This method will be called by the parser at the completion of the parsing of each node. + * The node and all of its descendants will exist and be complete. The parent node will also exist, + * although it may be incomplete, i.e. it may have additional children that have not yet been parsed. + * Attribute nodes are never passed to this function. + * From within this method, the new node may be freely modified - children may be added or removed, + * text nodes modified, etc. The state of the rest of the document outside this node is not defined, + * and the affect of any attempt to navigate to, or to modify any other part of the document is undefined. + * For validating parsers, the checks are made on the original document, before any modification by the + * filter. No validity checks are made on any document modifications made by the filter. + * If this new node is rejected, the parser might reuse the new node and any of its descendants. + * + * @param node The newly constructed element. At the time this method is called, the element is complete - + * it has all of its children (and their children, recursively) and attributes, and is attached + * as a child to its parent. + * @return One of the FilterAction enum + */ + virtual FilterAction acceptNode(DOMNode* node) = 0; + + /** + * The parser will call this method after each DOMElement start tag has been scanned, + * but before the remainder of the DOMElement is processed. The intent is to allow the element, + * including any children, to be efficiently skipped. Note that only element nodes are passed to the + * startElement function. + * The element node passed to startElement for filtering will include all of the attributes, but none + * of the children nodes. The DOMElement may not yet be in place in the document being + * constructed (it may not have a parent node.) + * A startElement filter function may access or change the attributes for the DOMElement. + * Changing namespace declarations will have no effect on namespace resolution by the parser. + * + * @param node The newly encountered element. At the time this method is called, the element is incomplete - + * it will have its attributes, but no children. + * @return One of the FilterAction enum + */ + virtual FilterAction startElement(DOMElement* node) = 0; + + /** + * Tells the DOMLSParser what types of nodes to show to the method DOMLSParserFilter::acceptNode. + * If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built. + * See DOMNodeFilter for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT, + * SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here. + * Those nodes will never be passed to DOMLSParserFilter::acceptNode. + * + * @return The constants of what types of nodes to show. + * @since DOM Level 3 + */ + virtual DOMNodeFilter::ShowType getWhatToShow() const = 0; + + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSResourceResolver.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSResourceResolver.hpp new file mode 100644 index 000000000..24792d3c6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSResourceResolver.hpp @@ -0,0 +1,143 @@ +/* + * 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: DOMLSResourceResolver.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMLSInput; + +/** + * DOMLSResourceResolver provides a way for applications to redirect references + * to external entities. + * + *

Applications needing to implement customized handling for external + * entities must implement this interface and register their implementation + * by setting the entityResolver attribute of the DOMLSParser.

+ * + *

The DOMLSParser will then allow the application to intercept any + * external entities (including the external DTD subset and external parameter + * entities) before including them.

+ * + *

Many DOM applications will not need to implement this interface, but it + * will be especially useful for applications that build XML documents from + * databases or other specialized input sources, or for applications that use + * URNs.

+ * + * @see DOMLSParser#getDomConfig + * @see DOMLSInput#DOMLSInput + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMLSResourceResolver +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSResourceResolver() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSResourceResolver(const DOMLSResourceResolver &); + DOMLSResourceResolver & operator = (const DOMLSResourceResolver &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSResourceResolver() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSResourceResolver interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * Allow the application to resolve external resources. + * + * The DOMLSParser will call this method before opening any external resource, + * including the external DTD subset, external entities referenced within the DTD, and + * external entities referenced within the document element (however, the top-level + * document entity is not passed to this method). The application may then request that + * the DOMLSParser resolve the external resource itself, that it use an + * alternative URI, or that it use an entirely different input source. + * + * Application writers can use this method to redirect external system identifiers to + * secure and/or local URI, to look up public identifiers in a catalogue, or to read + * an entity from a database or other input source (including, for example, a dialog box). + * + * The returned DOMLSInput is owned by the DOMLSParser which is + * responsible to clean up the memory. + * + * @param resourceType The type of the resource being resolved. For XML [XML 1.0] resources + * (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". + * For XML Schema [XML Schema Part 1], applications must use the value + * "http://www.w3.org/2001/XMLSchema". Other types of resources are outside + * the scope of this specification and therefore should recommend an absolute + * URI in order to use this method. + * @param namespaceUri The namespace of the resource being resolved, e.g. the target namespace + * of the XML Schema [XML Schema Part 1] when resolving XML Schema resources. + * @param publicId The public identifier of the external entity being referenced, or null + * if no public identifier was supplied or if the resource is not an entity. + * @param systemId The system identifier, a URI reference [IETF RFC 2396], of the external + * resource being referenced, or null if no system identifier was supplied. + * @param baseURI The absolute base URI of the resource being parsed, or null if + * there is no base URI. + * @return A DOMLSInput object describing the new input source, + * or null to request that the parser open a regular + * URI connection to the resource. + * The returned DOMLSInput is owned by the DOMLSParser which is + * responsible to clean up the memory. + * @see DOMLSInput#DOMLSInput + * @since DOM Level 3 + */ + virtual DOMLSInput* resolveResource( const XMLCh* const resourceType + , const XMLCh* const namespaceUri + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const baseURI) = 0; + + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSSerializer.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSSerializer.hpp new file mode 100644 index 000000000..96aadd4d6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSSerializer.hpp @@ -0,0 +1,547 @@ +/* + * 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: DOMLSSerializer.hpp 883665 2009-11-24 11:41:38Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP + +/** + * + * DOMLSSerializer provides an API for serializing (writing) a DOM document out in + * an XML document. The XML data is written to an output stream, the type of + * which depends on the specific language bindings in use. During + * serialization of XML data, namespace fixup is done when possible. + *

DOMLSSerializer accepts any node type for serialization. For + * nodes of type Document or Entity, well formed + * XML will be created if possible. The serialized output for these node + * types is either as a Document or an External Entity, respectively, and is + * acceptable input for an XML parser. For all other types of nodes the + * serialized form is not specified, but should be something useful to a + * human for debugging or diagnostic purposes. Note: rigorously designing an + * external (source) form for stand-alone node types that don't already have + * one defined in seems a bit much to take on here. + *

Within a Document or Entity being serialized, Nodes are processed as + * follows Documents are written including an XML declaration and a DTD + * subset, if one exists in the DOM. Writing a document node serializes the + * entire document. Entity nodes, when written directly by + * write defined in the DOMLSSerializer interface, + * output the entity expansion but no namespace fixup is done. The resulting + * output will be valid as an external entity. Entity References nodes are + * serializes as an entity reference of the form + * "&entityName;") in the output. Child nodes (the + * expansion) of the entity reference are ignored. CDATA sections + * containing content characters that can not be represented in the + * specified output encoding are handled according to the + * "split-cdata-sections" feature.If the feature is true, CDATA + * sections are split, and the unrepresentable characters are serialized as + * numeric character references in ordinary content. The exact position and + * number of splits is not specified. If the feature is false, + * unrepresentable characters in a CDATA section are reported as errors. The + * error is not recoverable - there is no mechanism for supplying + * alternative characters and continuing with the serialization. All other + * node types (DOMElement, DOMText, etc.) are serialized to their corresponding + * XML source form. + *

Within the character data of a document (outside of markup), any + * characters that cannot be represented directly are replaced with + * character references. Occurrences of '<' and '&' are replaced by + * the predefined entities &lt; and &amp. The other predefined + * entities (&gt, &apos, etc.) are not used; these characters can be + * included directly. Any character that can not be represented directly in + * the output character encoding is serialized as a numeric character + * reference. + *

Attributes not containing quotes are serialized in quotes. Attributes + * containing quotes but no apostrophes are serialized in apostrophes + * (single quotes). Attributes containing both forms of quotes are + * serialized in quotes, with quotes within the value represented by the + * predefined entity &quot;. Any character that can not be represented + * directly in the output character encoding is serialized as a numeric + * character reference. + *

Within markup, but outside of attributes, any occurrence of a character + * that cannot be represented in the output character encoding is reported + * as an error. An example would be serializing the element + * <LaCañada/> with the encoding="us-ascii". + *

When requested by setting the normalize-characters feature + * on DOMLSSerializer, all data to be serialized, both markup and + * character data, is W3C Text normalized according to the rules defined in + * . The W3C Text normalization process affects only the data as it is being + * written; it does not alter the DOM's view of the document after + * serialization has completed. + *

Namespaces are fixed up during serialization, the serialization process + * will verify that namespace declarations, namespace prefixes and the + * namespace URIs associated with Elements and Attributes are consistent. If + * inconsistencies are found, the serialized form of the document will be + * altered to remove them. The algorithm used for doing the namespace fixup + * while seralizing a document is a combination of the algorithms used for + * lookupNamespaceURI and lookupPrefix. previous paragraph to be + * defined closer here. + *

Any changes made affect only the namespace prefixes and declarations + * appearing in the serialized data. The DOM's view of the document is not + * altered by the serialization operation, and does not reflect any changes + * made to namespace declarations or prefixes in the serialized output. + *

While serializing a document the serializer will write out + * non-specified values (such as attributes whose specified is + * false) if the output-default-values feature is + * set to true. If the output-default-values flag + * is set to false and the use-abstract-schema + * feature is set to true the abstract schema will be used to + * determine if a value is specified or not, if + * use-abstract-schema is not set the specified + * flag on attribute nodes is used to determine if attribute values should + * be written out. + *

Ref to Core spec (1.1.9, XML namespaces, 5th paragraph) entity ref + * description about warning about unbound entity refs. Entity refs are + * always serialized as &foo;, also mention this in the load part of + * this spec. + *

When serializing a document the DOMLSSerializer checks to see if the document + * element in the document is a DOM Level 1 element or a DOM Level 2 (or + * higher) element (this check is done by looking at the localName of the + * root element). If the root element is a DOM Level 1 element then the + * DOMLSSerializer will issue an error if a DOM Level 2 (or higher) element is + * found while serializing. Likewise if the document element is a DOM Level + * 2 (or higher) element and the DOMLSSerializer sees a DOM Level 1 element an + * error is issued. Mixing DOM Level 1 elements with DOM Level 2 (or higher) + * is not supported. + *

DOMLSSerializers have a number of named features that can be + * queried or set. The name of DOMLSSerializer features must be valid + * XML names. Implementation specific features (extensions) should choose an + * implementation dependent prefix to avoid name collisions. + *

Here is a list of properties that must be recognized by all + * implementations. + *

+ *
"normalize-characters"
+ *
+ *
+ *
true
+ *
[ + * optional] (default) Perform the W3C Text Normalization of the characters + * in document as they are written out. Only the characters being written + * are (potentially) altered. The DOM document itself is unchanged.
+ *
+ * false
+ *
[required] do not perform character normalization.
+ *
+ *
+ * "split-cdata-sections"
+ *
+ *
+ *
true
+ *
[required] (default) + * Split CDATA sections containing the CDATA section termination marker + * ']]>' or characters that can not be represented in the output + * encoding, and output the characters using numeric character references. + * If a CDATA section is split a warning is issued.
+ *
false
+ *
[ + * required] Signal an error if a CDATASection contains an + * unrepresentable character.
+ *
+ *
"validation"
+ *
+ *
+ *
true
+ *
[ + * optional] Use the abstract schema to validate the document as it is being + * serialized. If validation errors are found the error handler is notified + * about the error. Setting this state will also set the feature + * use-abstract-schema to true.
+ *
false
+ *
[ + * required] (default) Don't validate the document as it is being + * serialized.
+ *
+ *
"expand-entity-references"
+ *
+ *
+ *
true
+ *
[ + * optional] Expand EntityReference nodes when serializing.
+ *
+ * false
+ *
[required] (default) Serialize all + * EntityReference nodes as XML entity references.
+ *
+ *
+ * "whitespace-in-element-content"
+ *
+ *
+ *
true
+ *
[required] ( + * default) Output all white spaces in the document.
+ *
false
+ *
[ + * optional] Only output white space that is not within element content. The + * implementation is expected to use the + * isWhitespaceInElementContent flag on Text nodes + * to determine if a text node should be written out or not.
+ *
+ *
+ * "discard-default-content"
+ *
+ *
+ *
true
+ *
[required] (default + * ) Use whatever information available to the implementation (i.e. XML + * schema, DTD, the specified flag on Attr nodes, + * and so on) to decide what attributes and content should be serialized or + * not. Note that the specified flag on Attr nodes + * in itself is not always reliable, it is only reliable when it is set to + * false since the only case where it can be set to + * false is if the attribute was created by a Level 1 + * implementation.
+ *
false
+ *
[required] Output all attributes and + * all content.
+ *
+ *
"format-canonical"
+ *
+ *
+ *
true
+ *
[optional] + * This formatting writes the document according to the rules specified in . + * Setting this feature to true will set the feature "format-pretty-print" + * to false.
+ *
false
+ *
[required] (default) Don't canonicalize the + * output.
+ *
+ *
"format-pretty-print"
+ *
+ *
+ *
true
+ *
[optional] + * Formatting the output by adding whitespace to produce a pretty-printed, + * indented, human-readable form. The exact form of the transformations is + * not specified by this specification. Setting this feature to true will + * set the feature "format-canonical" to false.
+ *
false
+ *
[required] + * (default) Don't pretty-print the result.
+ *
+ *
"http://apache.org/xml/features/dom/byte-order-mark"
+ *
+ *
+ *
false
+ *
[optional] + * (default) Setting this feature to true will output the correct BOM for the specified + * encoding.
+ *
true
+ *
[required] + * Don't generate a BOM.
+ *
+ *
"http://apache.org/xml/features/pretty-print/space-first-level-elements"
+ *
+ *
+ *
true
+ *
[optional] + * (default) Setting this feature to true will add an extra line feed between the elements + * that are children of the document root.
+ *
false
+ *
[required] + * Don't add the extra line feed.
+ *
+ *
+ *

See also the Document Object Model (DOM) Level 3 Load and Save Specification. + * + * @since DOM Level 3 + */ + + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMLSOutput; + +class CDOM_EXPORT DOMLSSerializer +{ +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSSerializer() {}; + //@} +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSSerializer(const DOMLSSerializer &); + DOMLSSerializer & operator = (const DOMLSSerializer &); + //@} + + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSSerializer() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSSerializer interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Feature methods + // ----------------------------------------------------------------------- + /** + * The DOMConfiguration object used by the LSSerializer when serializing a DOM node. + * + * In addition to the parameters recognized in on the DOMConfiguration + * interface defined in [DOM Level 3 Core], the DOMConfiguration objects + * for DOMLSSerializer add or modify the following parameters: + * + * "canonical-form" + * true [optional] + * Writes the document according to the rules specified in [Canonical XML]. In addition to + * the behavior described in "canonical-form" [DOM Level 3 Core], setting this parameter to + * true will set the parameters "format-pretty-print", "discard-default-content", and + * "xml-declaration", to false. Setting one of those parameters to true will set this + * parameter to false. Serializing an XML 1.1 document when "canonical-form" is true will + * generate a fatal error. + * false [required] (default) + * Do not canonicalize the output. + * + * "discard-default-content" + * true [required] (default) + * Use the DOMAttr::getSpecified attribute to decide what attributes should be discarded. + * Note that some implementations might use whatever information available to the implementation + * (i.e. XML schema, DTD, the DOMAttr::getSpecified attribute, and so on) to determine what + * attributes and content to discard if this parameter is set to true. + * false [required] + * Keep all attributes and all content. + * + * "format-pretty-print" + * true [optional] + * Formatting the output by adding whitespace to produce a pretty-printed, indented, + * human-readable form. The exact form of the transformations is not specified by this specification. + * Pretty-printing changes the content of the document and may affect the validity of the document, + * validating implementations should preserve validity. + * false [required] (default) + * Don't pretty-print the result. + * + * "ignore-unknown-character-denormalizations" + * true [required] (default) + * If, while verifying full normalization when [XML 1.1] is supported, a character is encountered + * for which the normalization properties cannot be determined, then raise a "unknown-character-denormalization" + * warning (instead of raising an error, if this parameter is not set) and ignore any possible + * denormalizations caused by these characters. + * false [optional] + * Report a fatal error if a character is encountered for which the processor cannot determine the + * normalization properties. + * + * "normalize-characters" + * This parameter is equivalent to the one defined by DOMConfiguration in [DOM Level 3 Core]. + * Unlike in the Core, the default value for this parameter is true. While DOM implementations are not + * required to support fully normalizing the characters in the document according to appendix E of [XML 1.1], + * this parameter must be activated by default if supported. + * + * "xml-declaration" + * true [required] (default) + * If a DOMDocument, DOMElement, or DOMEntity node is serialized, the XML declaration, or text declaration, + * should be included. The version (DOMDocument::xmlVersion if the document is a Level 3 document and the + * version is non-null, otherwise use the value "1.0"), and the output encoding (see DOMLSSerializer::write + * for details on how to find the output encoding) are specified in the serialized XML declaration. + * false [required] + * Do not serialize the XML and text declarations. Report a "xml-declaration-needed" warning if this will + * cause problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an encoding would + * be needed to be able to re-parse the serialized data). + * + * "error-handler" + * Contains a DOMErrorHandler object. If an error is encountered in the document, the implementation will call back + * the DOMErrorHandler registered using this parameter. The implementation may provide a default DOMErrorHandler + * object. When called, DOMError::relatedData will contain the closest node to where the error occurred. + * If the implementation is unable to determine the node where the error occurs, DOMError::relatedData will contain + * the DOMDocument node. Mutations to the document from within an error handler will result in implementation + * dependent behavior. + * + * @return The pointer to the configuration object. + * @since DOM Level 3 + */ + virtual DOMConfiguration* getDomConfig() = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * The end-of-line sequence of characters to be used in the XML being + * written out. The only permitted values are these: + *

+ *
null
+ *
+ * Use a default end-of-line sequence. DOM implementations should choose + * the default to match the usual convention for text files in the + * environment being used. Implementations must choose a default + * sequence that matches one of those allowed by 2.11 "End-of-Line + * Handling". However, Xerces-C++ always uses LF when this + * property is set to null since otherwise automatic + * translation of LF to CR-LF on Windows for text files would + * result in such files containing CR-CR-LF. If you need Windows-style + * end of line sequences in your output, consider writing to a file + * opened in text mode or explicitly set this property to CR-LF.
+ *
CR
+ *
The carriage-return character (\#xD).
+ *
CR-LF
+ *
The + * carriage-return and line-feed characters (\#xD \#xA).
+ *
LF
+ *
The line-feed + * character (\#xA).
+ *
+ *
The default value for this attribute is null. + * + * @param newLine The end-of-line sequence of characters to be used. + * @see getNewLine + * @since DOM Level 3 + */ + virtual void setNewLine(const XMLCh* const newLine) = 0; + + /** + * When the application provides a filter, the serializer will call out + * to the filter before serializing each Node. Attribute nodes are never + * passed to the filter. The filter implementation can choose to remove + * the node from the stream or to terminate the serialization early. + * + * @param filter The writer filter to be used. + * @see getFilter + * @since DOM Level 3 + */ + virtual void setFilter(DOMLSSerializerFilter *filter) = 0; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Return the end-of-line sequence of characters to be used in the XML being + * written out. + * + * @return The end-of-line sequence of characters to be used. + * @see setNewLine + * @since DOM Level 3 + */ + virtual const XMLCh* getNewLine() const = 0; + + /** + * Return the WriterFilter used. + * + * @return The writer filter used. + * @see setFilter + * @since DOM Level 3 + */ + virtual DOMLSSerializerFilter* getFilter() const = 0; + + // ----------------------------------------------------------------------- + // Write methods + // ----------------------------------------------------------------------- + /** + * Write out the specified node as described above in the description of + * DOMLSSerializer. Writing a Document or Entity node produces a + * serialized form that is well formed XML. Writing other node types + * produces a fragment of text in a form that is not fully defined by + * this document, but that should be useful to a human for debugging or + * diagnostic purposes. + * + * @param nodeToWrite The Document or Entity node to + * be written. For other node types, something sensible should be + * written, but the exact serialized form is not specified. + * @param destination The destination for the data to be written. + * @return Returns true if node was + * successfully serialized and false in case a failure + * occured and the failure wasn't canceled by the error handler. + * @since DOM Level 3 + */ + virtual bool write(const DOMNode* nodeToWrite, + DOMLSOutput* const destination) = 0; + + /** + * Write out the specified node as described above in the description of + * DOMLSSerializer. Writing a Document or Entity node produces a + * serialized form that is well formed XML. Writing other node types + * produces a fragment of text in a form that is not fully defined by + * this document, but that should be useful to a human for debugging or + * diagnostic purposes. + * + * @param nodeToWrite The Document or Entity node to + * be written. For other node types, something sensible should be + * written, but the exact serialized form is not specified. + * @param uri The destination for the data to be written. + * @return Returns true if node was + * successfully serialized and false in case a failure + * occured and the failure wasn't canceled by the error handler. + * @since DOM Level 3 + */ + virtual bool writeToURI(const DOMNode* nodeToWrite, + const XMLCh* uri) = 0; + /** + * Serialize the specified node as described above in the description of + * DOMLSSerializer. The result of serializing the node is + * returned as a string. Writing a Document or Entity node produces a + * serialized form that is well formed XML. Writing other node types + * produces a fragment of text in a form that is not fully defined by + * this document, but that should be useful to a human for debugging or + * diagnostic purposes. + * + * @param nodeToWrite The node to be written. + * @param manager The memory manager to be used to allocate the result string. + * If NULL is used, the memory manager used to construct the serializer will + * be used. + * @return Returns the serialized data, or null in case a + * failure occured and the failure wasn't canceled by the error + * handler. The returned string is always in UTF-16. + * The encoding information available in DOMLSSerializer is ignored in writeToString(). + * @since DOM Level 3 + */ + virtual XMLCh* writeToString(const DOMNode* nodeToWrite, MemoryManager* manager = NULL) = 0; + + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this Writer is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} + + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLSSerializerFilter.hpp b/project/jni/xerces/src/xercesc/dom/DOMLSSerializerFilter.hpp new file mode 100644 index 000000000..0bd9bc795 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLSSerializerFilter.hpp @@ -0,0 +1,107 @@ +/* + * 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: DOMLSSerializerFilter.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP + +/** + * + * DOMLSSerializerFilter.hpp: interface for the DOMLSSerializerFilter class. + * + * DOMLSSerializerFilter provide applications the ability to examine nodes + * as they are being serialized. + * + * DOMLSSerializerFilter lets the application decide what nodes should be + * serialized or not. + * + * The DOMDocument, DOMDocumentType, DOMNotation, and DOMEntity nodes are not passed + * to the filter. + * + * @since DOM Level 3 + */ + + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMLSSerializerFilter : public DOMNodeFilter { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLSSerializerFilter() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLSSerializerFilter(const DOMLSSerializerFilter &); + DOMLSSerializerFilter & operator = (const DOMLSSerializerFilter &); + //@} + + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLSSerializerFilter() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLSSerializerFilter interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * Interface from DOMNodeFilter, + * to be implemented by implementation (derived class) + */ + virtual FilterAction acceptNode(const DOMNode* node) const = 0; + + /** + * Tells the DOMLSSerializer what types of nodes to show to the filter. + * See DOMNodeFilter for definition of the constants. + * The constant SHOW_ATTRIBUTE is meaningless here, attribute nodes will + * never be passed to a DOMLSSerializerFilter. + * + * @return The constants of what types of nodes to show. + * @since DOM Level 3 + */ + virtual ShowType getWhatToShow() const =0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMLocator.hpp b/project/jni/xerces/src/xercesc/dom/DOMLocator.hpp new file mode 100644 index 000000000..abbcd8ed3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMLocator.hpp @@ -0,0 +1,135 @@ +/* + * 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: DOMLocator.hpp 676853 2008-07-15 09:58:05Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; + + +/** + * DOMLocator is an interface that describes a location. (e.g. where an error + * occured). + * + * @see DOMError#DOMError + * @since DOM Level 3 + */ + +class CDOM_EXPORT DOMLocator +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMLocator() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMLocator(const DOMLocator &); + DOMLocator & operator = (const DOMLocator &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMLocator() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMLocator interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Get the line number where the error occured, or 0 if there is + * no line number available. + * + * @since DOM Level 3 + */ + virtual XMLFileLoc getLineNumber() const = 0; + + /** + * Get the column number where the error occured, or 0 if there + * is no column number available. + * + * @since DOM Level 3 + */ + virtual XMLFileLoc getColumnNumber() const = 0; + + /** + * Get the byte offset into the input source, or ~(XMLFilePos(0)) if + * there is no byte offset available. + * + * @since DOM Level 3 + */ + virtual XMLFilePos getByteOffset() const = 0; + + /** + * Get the UTF-16 offset into the input source, or ~(XMLFilePos(0)) if + * there is no UTF-16 offset available. + * + * @since DOM Level 3 + */ + virtual XMLFilePos getUtf16Offset() const = 0; + + /** + * Get the DOMNode where the error occured, or null if there + * is no node available. + * + * @since DOM Level 3 + */ + virtual DOMNode* getRelatedNode() const = 0; + + /** + * Get the URI where the error occured, or null if there is no + * URI available. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getURI() const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMMemoryManager.hpp b/project/jni/xerces/src/xercesc/dom/DOMMemoryManager.hpp new file mode 100644 index 000000000..c1dd83cc7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMMemoryManager.hpp @@ -0,0 +1,160 @@ +/* + * 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. + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The DOMMemoryManager interface exposes the memory allocation-related + * functionalities of a DOMDocument + */ + +class CDOM_EXPORT DOMMemoryManager +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMMemoryManager() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMMemoryManager(const DOMMemoryManager &); + DOMMemoryManager & operator = (const DOMMemoryManager &); + //@} + +public: + + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMMemoryManager() {}; + //@} + + // ----------------------------------------------------------------------- + // data types + // ----------------------------------------------------------------------- + enum NodeObjectType { + ATTR_OBJECT = 0, + ATTR_NS_OBJECT = 1, + CDATA_SECTION_OBJECT = 2, + COMMENT_OBJECT = 3, + DOCUMENT_FRAGMENT_OBJECT = 4, + DOCUMENT_TYPE_OBJECT = 5, + ELEMENT_OBJECT = 6, + ELEMENT_NS_OBJECT = 7, + ENTITY_OBJECT = 8, + ENTITY_REFERENCE_OBJECT = 9, + NOTATION_OBJECT = 10, + PROCESSING_INSTRUCTION_OBJECT = 11, + TEXT_OBJECT = 12 + }; + + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the size of the chunks of memory allocated by the memory manager + * + * @return the dimension of the chunks of memory allocated by the memory manager + */ + virtual XMLSize_t getMemoryAllocationBlockSize() const = 0; + + //@} + + //@{ + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Set the size of the chunks of memory allocated by the memory manager + * + * @param size the new size of the chunks; it must be greater than 4KB + */ + virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0; + //@} + + //@{ + // ----------------------------------------------------------------------- + // Operations + // ----------------------------------------------------------------------- + /** + * Allocate a memory block of the requested size from the managed pool + * + * @param amount the size of the new memory block + * + * @return the pointer to the newly allocated block + */ + virtual void* allocate(XMLSize_t amount) = 0; + + /** + * Allocate a memory block of the requested size from the managed pool of DOM objects + * + * @param amount the size of the new memory block + * @param type the type of the DOM object that will be stored in the block + * + * @return the pointer to the newly allocated block + */ + virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0; + + /** + * Release a DOM object and place its memory back in the pool + * + * @param object the pointer to the DOM node + * @param type the type of the DOM object + */ + virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0; + + /** + * Allocate a memory block from the mnaged pool and copy the provided string + * + * @param src the string to be copied + * + * @return the pointer to the newly allocated block + */ + virtual XMLCh* cloneString(const XMLCh *src) = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMMemoryManager.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/DOMNamedNodeMap.hpp b/project/jni/xerces/src/xercesc/dom/DOMNamedNodeMap.hpp new file mode 100644 index 000000000..2d23f2790 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNamedNodeMap.hpp @@ -0,0 +1,245 @@ +/* + * 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: DOMNamedNodeMap.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; + +/** + * DOMNamedNodeMaps are used to + * represent collections of nodes that can be accessed by name. + * + * Note that DOMNamedNodeMap does not inherit from DOMNodeList; + * DOMNamedNodeMaps are not maintained in any particular order. + * Nodes contained in a DOMNamedNodeMap may + * also be accessed by an ordinal index, but this is simply to allow + * convenient enumeration of the contents, and + * does not imply that the DOM specifies an order to these Nodes. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMNamedNodeMap { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNamedNodeMap() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMNamedNodeMap(const DOMNamedNodeMap &); + DOMNamedNodeMap & operator = (const DOMNamedNodeMap &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNamedNodeMap() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMNamedNodeMap interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Adds a node using its nodeName attribute. + * + *
As the nodeName attribute is used to derive the name + * which the node must be stored under, multiple nodes of certain types + * (those that have a "special" string value) cannot be stored as the names + * would clash. This is seen as preferable to allowing nodes to be aliased. + * @param arg A node to store in a named node map. The node will later be + * accessible using the value of the nodeName attribute of + * the node. If a node with that name is already present in the map, it + * is replaced by the new one. + * @return If the new DOMNode replaces an existing node the + * replaced DOMNode is returned, + * otherwise null is returned. + * @exception DOMException + * WRONG_DOCUMENT_ERR: Raised if arg was created from a + * different document than the one that created the + * DOMNamedNodeMap. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this + * DOMNamedNodeMap is readonly. + *
INUSE_ATTRIBUTE_ERR: Raised if arg is an + * DOMAttr that is already an attribute of another + * DOMElement object. The DOM user must explicitly clone + * DOMAttr nodes to re-use them in other elements. + * @since DOM Level 1 + */ + virtual DOMNode *setNamedItem(DOMNode *arg) = 0; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the indexth item in the map. + * + * If index + * is greater than or equal to the number of nodes in the map, this returns + * null. + * @param index Index into the map. + * @return The node at the indexth position in the + * DOMNamedNodeMap, or null if that is not a valid + * index. + * @since DOM Level 1 + */ + virtual DOMNode *item(XMLSize_t index) const = 0; + + /** + * Retrieves a node specified by name. + * + * @param name The nodeName of a node to retrieve. + * @return A DOMNode (of any type) with the specified nodeName, or + * null if it does not identify any node in + * the map. + * @since DOM Level 1 + */ + virtual DOMNode *getNamedItem(const XMLCh *name) const = 0; + + /** + * The number of nodes in the map. + * + * The range of valid child node indices is + * 0 to length-1 inclusive. + * @since DOM Level 1 + */ + virtual XMLSize_t getLength() const = 0; + + // ----------------------------------------------------------------------- + // Node methods + // ----------------------------------------------------------------------- + /** + * Removes a node specified by name. + * + * If the removed node is an + * DOMAttr with a default value it is immediately replaced. + * @param name The nodeName of a node to remove. + * @return The node removed from the map if a node with such a name exists. + * @exception DOMException + * NOT_FOUND_ERR: Raised if there is no node named name in + * the map. + *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this DOMNamedNodeMap + * is readonly. + * @since DOM Level 1 + */ + virtual DOMNode *removeNamedItem(const XMLCh *name) = 0; + //@} + + /** @name Functions introduced in DOM Level 2 */ + //@{ + /** + * Retrieves a node specified by local name and namespace URI. + * + * @param namespaceURI The namespace URI of + * the node to retrieve. + * @param localName The local name of the node to retrieve. + * @return A DOMNode (of any type) with the specified + * local name and namespace URI, or null if they do not + * identify any node in the map. + * @since DOM Level 2 + */ + virtual DOMNode *getNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) const = 0; + + /** + * Adds a node using its namespaceURI and localName. + * + * @param arg A node to store in a named node map. The node will later be + * accessible using the value of the namespaceURI and + * localName attribute of the node. If a node with those + * namespace URI and local name is already present in the map, it is + * replaced by the new one. + * @return If the new DOMNode replaces an existing node the + * replaced DOMNode is returned, + * otherwise null is returned. + * @exception DOMException + * WRONG_DOCUMENT_ERR: Raised if arg was created from a + * different document than the one that created the + * DOMNamedNodeMap. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this + * DOMNamedNodeMap is readonly. + *
INUSE_ATTRIBUTE_ERR: Raised if arg is an + * DOMAttr that is already an attribute of another + * DOMElement object. The DOM user must explicitly clone + * DOMAttr nodes to re-use them in other elements. + * @since DOM Level 2 + */ + virtual DOMNode *setNamedItemNS(DOMNode *arg) = 0; + + /** + * Removes a node specified by local name and namespace URI. + * + * @param namespaceURI The namespace URI of + * the node to remove. + * @param localName The local name of the + * node to remove. When this DOMNamedNodeMap contains the + * attributes attached to an element, as returned by the attributes + * attribute of the DOMNode interface, if the removed + * attribute is known to have a default value, an attribute + * immediately appears containing the default value + * as well as the corresponding namespace URI, local name, and prefix. + * @return The node removed from the map if a node with such a local name + * and namespace URI exists. + * @exception DOMException + * NOT_FOUND_ERR: Raised if there is no node named name in + * the map. + *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this DOMNamedNodeMap + * is readonly. + * @since DOM Level 2 + */ + virtual DOMNode *removeNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) = 0; + //@} + +}; + +#define GetDOMNamedNodeMapMemoryManager GET_INDIRECT_MM(fOwnerNode) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMNode.hpp b/project/jni/xerces/src/xercesc/dom/DOMNode.hpp new file mode 100644 index 000000000..0cf0f993d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNode.hpp @@ -0,0 +1,922 @@ +/* + * 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: DOMNode.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMDocument; +class DOMNamedNodeMap; +class DOMNodeList; +class DOMUserDataHandler; + +/** + * The DOMNode interface is the primary datatype for the entire + * Document Object Model. It represents a single node in the document tree. + * While all objects implementing the DOMNode interface expose + * methods for dealing with children, not all objects implementing the + * DOMNode interface may have children. For example, + * DOMText nodes may not have children, and adding children to + * such nodes results in a DOMException being raised. + *

The attributes nodeName, nodeValue and + * attributes are included as a mechanism to get at node + * information without casting down to the specific derived interface. In + * cases where there is no obvious mapping of these attributes for a + * specific nodeType (e.g., nodeValue for an + * DOMElement or attributes for a DOMComment + * ), this returns null. Note that the specialized interfaces + * may contain additional and more convenient mechanisms to get and set the + * relevant information. + *

The values of nodeName, + * nodeValue, and attributes vary according to the + * node type as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
InterfacenodeNamenodeValueattributes
DOMAttrname of attributevalue of attributenull
DOMCDATASection"\#cdata-section"content of the CDATA Sectionnull
DOMComment"\#comment"content of the commentnull
DOMDocument"\#document"nullnull
DOMDocumentFragment"\#document-fragment"nullnull
DOMDocumentTypedocument type namenullnull
DOMElementtag namenullNamedNodeMap
DOMEntityentity namenullnull
DOMEntityReferencename of entity referencednullnull
DOMNotationnotation namenullnull
DOMProcessingInstructiontargetentire content excluding the targetnull
DOMText"\#text"content of the text nodenull
+ *

See also the Document Object Model (DOM) Level 2 Core Specification. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNode() {} + DOMNode(const DOMNode &) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMNode & operator = (const DOMNode &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNode() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * NodeType + * + * @since DOM Level 1 + */ + enum NodeType { + ELEMENT_NODE = 1, + ATTRIBUTE_NODE = 2, + TEXT_NODE = 3, + CDATA_SECTION_NODE = 4, + ENTITY_REFERENCE_NODE = 5, + ENTITY_NODE = 6, + PROCESSING_INSTRUCTION_NODE = 7, + COMMENT_NODE = 8, + DOCUMENT_NODE = 9, + DOCUMENT_TYPE_NODE = 10, + DOCUMENT_FRAGMENT_NODE = 11, + NOTATION_NODE = 12 + }; + + /** + * DocumentPosition: + * + *

DOCUMENT_POSITION_CONTAINED_BY: + * The node is contained by the reference node. A node which is contained is always following, too.

+ *

DOCUMENT_POSITION_CONTAINS: + * The node contains the reference node. A node which contains is always preceding, too.

+ *

DOCUMENT_POSITION_DISCONNECTED: + * The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.

+ *

DOCUMENT_POSITION_FOLLOWING: + * The node follows the reference node.

+ *

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: + * The determination of preceding versus following is implementation-specific.

+ *

DOCUMENT_POSITION_PRECEDING: + * The second node precedes the reference node.

+ * + * @since DOM Level 3 + */ + enum DocumentPosition { + DOCUMENT_POSITION_DISCONNECTED = 0x01, + DOCUMENT_POSITION_PRECEDING = 0x02, + DOCUMENT_POSITION_FOLLOWING = 0x04, + DOCUMENT_POSITION_CONTAINS = 0x08, + DOCUMENT_POSITION_CONTAINED_BY = 0x10, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20 + }; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMNode interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The name of this node, depending on its type; see the table above. + * @since DOM Level 1 + */ + virtual const XMLCh * getNodeName() const = 0; + + /** + * Gets the value of this node, depending on its type. + * + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * @since DOM Level 1 + */ + virtual const XMLCh * getNodeValue() const = 0; + + /** + * An enum value representing the type of the underlying object. + * @since DOM Level 1 + */ + virtual NodeType getNodeType() const = 0; + + /** + * Gets the parent of this node. + * + * All nodes, except DOMDocument, + * DOMDocumentFragment, and DOMAttr may have a parent. + * However, if a node has just been created and not yet added to the tree, + * or if it has been removed from the tree, a null DOMNode + * is returned. + * @since DOM Level 1 + */ + virtual DOMNode *getParentNode() const = 0; + + /** + * Gets a DOMNodeList that contains all children of this node. + * + * If there + * are no children, this is a DOMNodeList containing no nodes. + * The content of the returned DOMNodeList is "live" in the sense + * that, for instance, changes to the children of the node object that + * it was created from are immediately reflected in the nodes returned by + * the DOMNodeList accessors; it is not a static snapshot of the + * content of the node. This is true for every DOMNodeList, + * including the ones returned by the getElementsByTagName + * method. + * @since DOM Level 1 + */ + virtual DOMNodeList *getChildNodes() const = 0; + /** + * Gets the first child of this node. + * + * If there is no such node, this returns null. + * @since DOM Level 1 + */ + virtual DOMNode *getFirstChild() const = 0; + + /** + * Gets the last child of this node. + * + * If there is no such node, this returns null. + * @since DOM Level 1 + */ + virtual DOMNode *getLastChild() const = 0; + + /** + * Gets the node immediately preceding this node. + * + * If there is no such node, this returns null. + * @since DOM Level 1 + */ + virtual DOMNode *getPreviousSibling() const = 0; + + /** + * Gets the node immediately following this node. + * + * If there is no such node, this returns null. + * @since DOM Level 1 + */ + virtual DOMNode *getNextSibling() const = 0; + + /** + * Gets a DOMNamedNodeMap containing the attributes of this node (if it + * is an DOMElement) or null otherwise. + * @since DOM Level 1 + */ + virtual DOMNamedNodeMap *getAttributes() const = 0; + + /** + * Gets the DOMDocument object associated with this node. + * + * This is also + * the DOMDocument object used to create new nodes. When this + * node is a DOMDocument or a DOMDocumentType + * which is not used with any DOMDocument yet, this is + * null. + * + * @since DOM Level 1 + */ + virtual DOMDocument *getOwnerDocument() const = 0; + + // ----------------------------------------------------------------------- + // Node methods + // ----------------------------------------------------------------------- + /** + * Returns a duplicate of this node. + * + * This function serves as a generic copy constructor for nodes. + * + * The duplicate node has no parent ( + * parentNode returns null.). + *
Cloning an DOMElement copies all attributes and their + * values, including those generated by the XML processor to represent + * defaulted attributes, but this method does not copy any text it contains + * unless it is a deep clone, since the text is contained in a child + * DOMText node. Cloning any other type of node simply returns a + * copy of this node. + * @param deep If true, recursively clone the subtree under the + * specified node; if false, clone only the node itself (and + * its attributes, if it is an DOMElement). + * @return The duplicate node. + * @since DOM Level 1 + */ + virtual DOMNode * cloneNode(bool deep) const = 0; + + /** + * Inserts the node newChild before the existing child node + * refChild. + * + * If refChild is null, + * insert newChild at the end of the list of children. + *
If newChild is a DOMDocumentFragment object, + * all of its children are inserted, in the same order, before + * refChild. If the newChild is already in the + * tree, it is first removed. Note that a DOMNode that + * has never been assigned to refer to an actual node is == null. + * @param newChild The node to insert. + * @param refChild The reference node, i.e., the node before which the new + * node must be inserted. + * @return The node being inserted. + * @exception DOMException + * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not + * allow children of the type of the newChild node, or if + * the node to insert is one of this node's ancestors. + *
WRONG_DOCUMENT_ERR: Raised if newChild was created + * from a different document than the one that created this node. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being + * inserted is readonly. + *
NOT_FOUND_ERR: Raised if refChild is not a child of + * this node. + * @since DOM Level 1 + */ + virtual DOMNode *insertBefore(DOMNode *newChild, + DOMNode *refChild) = 0; + + + /** + * Replaces the child node oldChild with newChild + * in the list of children, and returns the oldChild node. + * + * If newChild is a DOMDocumentFragment object, + * oldChild is replaced by all of the DOMDocumentFragment + * children, which are inserted in the same order. + * + * If the newChild is already in the tree, it is first removed. + * @param newChild The new node to put in the child list. + * @param oldChild The node being replaced in the list. + * @return The node replaced. + * @exception DOMException + * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not + * allow children of the type of the newChild node, or it + * the node to put in is one of this node's ancestors. + *
WRONG_DOCUMENT_ERR: Raised if newChild was created + * from a different document than the one that created this node. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly. + *
NOT_FOUND_ERR: Raised if oldChild is not a child of + * this node. + * @since DOM Level 1 + */ + virtual DOMNode *replaceChild(DOMNode *newChild, + DOMNode *oldChild) = 0; + /** + * Removes the child node indicated by oldChild from the list + * of children, and returns it. + * + * @param oldChild The node being removed. + * @return The node removed. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
NOT_FOUND_ERR: Raised if oldChild is not a child of + * this node. + * @since DOM Level 1 + */ + virtual DOMNode *removeChild(DOMNode *oldChild) = 0; + + /** + * Adds the node newChild to the end of the list of children of + * this node. + * + * If the newChild is already in the tree, it is + * first removed. + * @param newChild The node to add.If it is a DOMDocumentFragment + * object, the entire contents of the document fragment are moved into + * the child list of this node + * @return The node added. + * @exception DOMException + * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not + * allow children of the type of the newChild node, or if + * the node to append is one of this node's ancestors. + *
WRONG_DOCUMENT_ERR: Raised if newChild was created + * from a different document than the one that created this node. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being + * appended is readonly. + * @since DOM Level 1 + */ + virtual DOMNode *appendChild(DOMNode *newChild) = 0; + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + /** + * This is a convenience method to allow easy determination of whether a + * node has any children. + * + * @return true if the node has any children, + * false if the node has no children. + * @since DOM Level 1 + */ + virtual bool hasChildNodes() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Sets the value of the node. + * + * Any node which can have a nodeValue will + * also accept requests to set it to a string. The exact response to + * this varies from node to node -- Attribute, for example, stores + * its values in its children and has to replace them with a new Text + * holding the replacement value. + * + * For most types of Node, value is null and attempting to set it + * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will + * also be thrown if the node is read-only. + * @see #getNodeValue + * @since DOM Level 1 + */ + virtual void setNodeValue(const XMLCh *nodeValue) = 0; + //@} + + /** @name Functions introduced in DOM Level 2. */ + //@{ + /** + * Puts all DOMText + * nodes in the full depth of the sub-tree underneath this DOMNode, + * including attribute nodes, into a "normal" form where only markup (e.g., + * tags, comments, processing instructions, CDATA sections, and entity + * references) separates DOMText + * nodes, i.e., there are neither adjacent DOMText + * nodes nor empty DOMText + * nodes. This can be used to ensure that the DOM view of a document is the + * same as if it were saved and re-loaded, and is useful when operations + * (such as XPointer lookups) that depend on a particular document tree + * structure are to be used. + *

Note: In cases where the document contains DOMCDATASections, + * the normalize operation alone may not be sufficient, since XPointers do + * not differentiate between DOMText + * nodes and DOMCDATASection + * nodes.

+ * + * @since DOM Level 2 + */ + virtual void normalize() = 0; + + /** + * Tests whether the DOM implementation implements a specific + * feature and that feature is supported by this node. + * + * @param feature The string of the feature to test. This is the same + * name as what can be passed to the method hasFeature on + * DOMImplementation. + * @param version This is the version number of the feature to test. In + * Level 2, version 1, this is the string "2.0". If the version is not + * specified, supporting any version of the feature will cause the + * method to return true. + * @return Returns true if the specified feature is supported + * on this node, false otherwise. + * @since DOM Level 2 + */ + virtual bool isSupported(const XMLCh *feature, + const XMLCh *version) const = 0; + + /** + * Get the namespace URI of + * this node, or null if it is unspecified. + *

+ * This is not a computed value that is the result of a namespace lookup + * based on an examination of the namespace declarations in scope. It is + * merely the namespace URI given at creation time. + *

+ * For nodes of any type other than ELEMENT_NODE and + * ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, + * such as createElement from the DOMDocument + * interface, this is always null. + * + * @since DOM Level 2 + */ + virtual const XMLCh * getNamespaceURI() const = 0; + + /** + * Get the namespace prefix + * of this node, or null if it is unspecified. + * + * @since DOM Level 2 + */ + virtual const XMLCh * getPrefix() const = 0; + + /** + * Returns the local part of the qualified name of this node. + *

+ * For nodes created with a DOM Level 1 method, such as + * createElement from the DOMDocument interface, + * it is null. + * + * @since DOM Level 2 + */ + virtual const XMLCh * getLocalName() const = 0; + + /** + * Set the namespace prefix of this node. + *

+ * Note that setting this attribute, when permitted, changes + * the nodeName attribute, which holds the qualified + * name, as well as the tagName and name + * attributes of the DOMElement and DOMAttr + * interfaces, when applicable. + *

+ * Note also that changing the prefix of an + * attribute, that is known to have a default value, does not make a new + * attribute with the default value and the original prefix appear, since the + * namespaceURI and localName do not change. + * + * + * @param prefix The prefix of this node. + * @exception DOMException + * INVALID_CHARACTER_ERR: Raised if the specified prefix contains + * an illegal character. + *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
+ * NAMESPACE_ERR: Raised if the specified prefix is + * malformed, if the namespaceURI of this node is + * null, if the specified prefix is "xml" and the + * namespaceURI of this node is different from + * "http://www.w3.org/XML/1998/namespace", if this node is an attribute + * and the specified prefix is "xmlns" and the + * namespaceURI of this node is different from + * "http://www.w3.org/2000/xmlns/", or if this node is an attribute and + * the qualifiedName of this node is "xmlns". + * @since DOM Level 2 + */ + virtual void setPrefix(const XMLCh * prefix) = 0; + + /** + * Returns whether this node (if it is an element) has any attributes. + * @return true if this node has any attributes, + * false otherwise. + * @since DOM Level 2 + */ + virtual bool hasAttributes() const = 0; + //@} + + /** @name Functions introduced in DOM Level 3. */ + //@{ + /** + * Returns whether this node is the same node as the given one. + *
This method provides a way to determine whether two + * DOMNode references returned by the implementation reference + * the same object. When two DOMNode references are references + * to the same object, even if through a proxy, the references may be + * used completely interchangeably, such that all attributes have the + * same values and calling the same DOM method on either reference + * always has exactly the same effect. + * + * @param other The node to test against. + * @return Returns true if the nodes are the same, + * false otherwise. + * @since DOM Level 3 + */ + virtual bool isSameNode(const DOMNode* other) const = 0; + + /** + * Tests whether two nodes are equal. + *
This method tests for equality of nodes, not sameness (i.e., + * whether the two nodes are pointers to the same object) which can be + * tested with DOMNode::isSameNode. All nodes that are the same + * will also be equal, though the reverse may not be true. + *
Two nodes are equal if and only if the following conditions are + * satisfied: The two nodes are of the same type.The following string + * attributes are equal: nodeName, localName, + * namespaceURI, prefix, nodeValue + * , baseURI. This is: they are both null, or + * they have the same length and are character for character identical. + * The attributes DOMNamedNodeMaps are equal. + * This is: they are both null, or they have the same + * length and for each node that exists in one map there is a node that + * exists in the other map and is equal, although not necessarily at the + * same index.The childNodes DOMNodeLists are + * equal. This is: they are both null, or they have the + * same length and contain equal nodes at the same index. This is true + * for DOMAttr nodes as for any other type of node. Note that + * normalization can affect equality; to avoid this, nodes should be + * normalized before being compared. + *
For two DOMDocumentType nodes to be equal, the following + * conditions must also be satisfied: The following string attributes + * are equal: publicId, systemId, + * internalSubset.The entities + * DOMNamedNodeMaps are equal.The notations + * DOMNamedNodeMaps are equal. + *
On the other hand, the following do not affect equality: the + * ownerDocument attribute, the specified + * attribute for DOMAttr nodes, the + * isWhitespaceInElementContent attribute for + * DOMText nodes, as well as any user data or event listeners + * registered on the nodes. + * + * @param arg The node to compare equality with. + * @return If the nodes, and possibly subtrees are equal, + * true otherwise false. + * @since DOM Level 3 + */ + virtual bool isEqualNode(const DOMNode* arg) const = 0; + + + /** + * Associate an object to a key on this node. The object can later be + * retrieved from this node by calling getUserData with the + * same key. + * + * Deletion of the user data remains the responsibility of the + * application program; it will not be automatically deleted when + * the nodes themselves are reclaimed. + * + * Both the parameter data and the returned object are + * void pointer, it is applications' responsibility to keep track of + * their original type. Casting them to the wrong type may result + * unexpected behavior. + * + * @param key The key to associate the object to. + * @param data The object to associate to the given key, or + * null to remove any existing association to that key. + * @param handler The handler to associate to that key, or + * null. + * @return Returns the void* object previously associated to + * the given key on this node, or null if there was none. + * @see #getUserData + * + * @since DOM Level 3 + */ + virtual void* setUserData(const XMLCh* key, + void* data, + DOMUserDataHandler* handler) = 0; + + /** + * Retrieves the object associated to a key on a this node. The object + * must first have been set to this node by calling + * setUserData with the same key. + * + * @param key The key the object is associated to. + * @return Returns the void* associated to the given key + * on this node, or null if there was none. + * @see #setUserData + * @since DOM Level 3 + */ + virtual void* getUserData(const XMLCh* key) const = 0; + + + /** + * The absolute base URI of this node or null if undefined. + * This value is computed according to . However, when the + * DOMDocument supports the feature "HTML" , the base URI is + * computed using first the value of the href attribute of the HTML BASE + * element if any, and the value of the documentURI + * attribute from the DOMDocument interface otherwise. + * + *
When the node is an DOMElement, a DOMDocument + * or a a DOMProcessingInstruction, this attribute represents + * the properties [base URI] defined in . When the node is a + * DOMNotation, an DOMEntity, or an + * DOMEntityReference, this attribute represents the + * properties [declaration base URI]. + * @since DOM Level 3 + */ + virtual const XMLCh* getBaseURI() const = 0; + + /** + * Compares the reference node, i.e. the node on which this method is being called, + * with a node, i.e. the one passed as a parameter, with regard to their position + * in the document and according to the document order. + * + * @param other The node to compare against this node. + * @return Returns how the given node is positioned relatively to this + * node. + * @since DOM Level 3 + */ + virtual short compareDocumentPosition(const DOMNode* other) const = 0; + + /** + * This attribute returns the text content of this node and its + * descendants. No serialization is performed, the returned string + * does not contain any markup. No whitespace normalization is + * performed and the returned string does not contain the white + * spaces in element content. + * + *
The string returned is made of the text content of this node + * depending on its type, as defined below: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Node typeContent
+ * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, + * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent + * attribute value of every child node, excluding COMMENT_NODE and + * PROCESSING_INSTRUCTION_NODE nodes
ATTRIBUTE_NODE, TEXT_NODE, + * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE + * nodeValue
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE + * null
+ * @exception DOMException + * DOMSTRING_SIZE_ERR: Raised when it would return more characters than + * fit in a DOMString variable on the implementation + * platform. + * @see #setTextContent + * @since DOM Level 3 + */ + virtual const XMLCh* getTextContent() const = 0; + + /** + * This attribute removes any possible children this node may have and, if the + * new string is not empty or null, replaced by a single DOMText + * node containing the string this attribute is set to. No parsing is + * performed, the input string is taken as pure textual content. + * + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * @see #getTextContent + * @since DOM Level 3 + */ + virtual void setTextContent(const XMLCh* textContent) = 0; + + /** + * Look up the prefix associated to the given namespace URI, starting from this node. + * The default namespace declarations are ignored by this method. + * + * @param namespaceURI The namespace URI to look for. + * @return Returns an associated namespace prefix if found, + * null if none is found. If more + * than one prefix are associated to the namespace prefix, the + * returned namespace prefix is implementation dependent. + * @since DOM Level 3 + */ + virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const = 0; + + /** + * This method checks if the specified namespaceURI is the + * default namespace or not. + * + * @param namespaceURI The namespace URI to look for. + * @return true if the specified namespaceURI + * is the default namespace, false otherwise. + * @since DOM Level 3 + */ + virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0; + + /** + * Look up the namespace URI associated to the given prefix, starting from + * this node. + * + * @param prefix The prefix to look for. If this parameter is + * null, the method will return the default namespace URI + * if any. + * @return Returns the associated namespace URI or null if + * none is found. + * @since DOM Level 3 + */ + virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0; + + /** + * This method makes available a DOMNode's specialized interface + * + * @param feature The name of the feature requested (case-insensitive). + * @param version The version of the feature requested. + * @return Returns an alternate DOMNode which implements the + * specialized APIs of the specified feature, if any, or + * null if there is no alternate DOMNode which + * implements interfaces associated with that feature. Any alternate + * DOMNode returned by this method must delegate to the + * primary core DOMNode and not return results inconsistent + * with the primary core DOMNode such as key, + * attributes, childNodes, etc. + * @since DOM Level 3 + */ + virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this Node (and its associated children) is no longer in use + * and that the implementation may relinquish any resources associated with it and + * its associated children. + * + * If this is a document, any nodes it owns (created by DOMDocument::createXXXX()) + * are also released. + * + * Access to a released object will lead to unexpected result. + * + * @exception DOMException + * INVALID_ACCESS_ERR: Raised if this Node has a parent and thus should not be released yet. + */ + virtual void release() = 0; + //@} +#if defined(XML_DOMREFCOUNT_EXPERIMENTAL) + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * This is custom function which can be implemented by classes deriving + * from DOMNode for implementing reference counting on DOMNodes. Any + * implementation which has memory management model which involves + * disposing of nodes immediately after being used can override this + * function to do that job. + */ + virtual void decRefCount() {} + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * This is custom function which can be implemented by classes deriving + * from DOMNode for implementing reference counting on DOMNodes. + */ + virtual void incRefCount() {} + //@} +#endif +}; + +/*** + * Utilities macros for getting memory manager within DOM +***/ +#define GET_OWNER_DOCUMENT(ptr) \ + ((DOMDocumentImpl*)(ptr->getOwnerDocument())) + +#define GET_DIRECT_MM(ptr) \ + (ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager) + +#define GET_INDIRECT_MM(ptr) \ + (!ptr ? XMLPlatformUtils::fgMemoryManager : \ + GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \ + XMLPlatformUtils::fgMemoryManager) + +/*** + * For DOMNode and its derivatives +***/ +#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMNodeFilter.hpp b/project/jni/xerces/src/xercesc/dom/DOMNodeFilter.hpp new file mode 100644 index 000000000..55d1d31fa --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNodeFilter.hpp @@ -0,0 +1,221 @@ +/* + * 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: DOMNodeFilter.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Filters are objects that know how to "filter out" nodes. If a + * DOMNodeIterator or DOMTreeWalker is given a + * DOMNodeFilter, it applies the filter before it returns the next + * node. If the filter says to accept the node, the traversal logic returns + * it; otherwise, traversal looks for the next node and pretends that the + * node that was rejected was not there. + *

The DOM does not provide any filters. DOMNodeFilter is just an + * interface that users can implement to provide their own filters. + *

DOMNodeFilters do not need to know how to traverse from node + * to node, nor do they need to know anything about the data structure that + * is being traversed. This makes it very easy to write filters, since the + * only thing they have to know how to do is evaluate a single node. One + * filter may be used with a number of different kinds of traversals, + * encouraging code reuse. + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ + +class CDOM_EXPORT DOMNodeFilter +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNodeFilter() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMNodeFilter(const DOMNodeFilter &); + DOMNodeFilter & operator = (const DOMNodeFilter &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNodeFilter() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * Constants returned by acceptNode. + * + *

FILTER_ACCEPT: + * Accept the node. Navigation methods defined for + * DOMNodeIterator or DOMTreeWalker will return this + * node.

+ * + *

FILTER_REJECT: + * Reject the node. Navigation methods defined for + * DOMNodeIterator or DOMTreeWalker will not return + * this node. For DOMTreeWalker, the children of this node + * will also be rejected. DOMNodeIterators treat this as a + * synonym for FILTER_SKIP.

+ * + *

FILTER_SKIP: + * Skip this single node. Navigation methods defined for + * DOMNodeIterator or DOMTreeWalker will not return + * this node. For both DOMNodeIterator and + * DOMTreeWalker, the children of this node will still be + * considered.

+ * + * @since DOM Level 2 + */ + enum FilterAction {FILTER_ACCEPT = 1, + FILTER_REJECT = 2, + FILTER_SKIP = 3}; + + /** + * Constants for whatToShow + * + *

SHOW_ALL: + * Show all DOMNode(s).

+ * + *

SHOW_ELEMENT: + * Show DOMElement nodes.

+ * + *

SHOW_ATTRIBUTE: + * Show DOMAttr nodes. This is meaningful only when creating an + * DOMNodeIterator or DOMTreeWalker with an + * attribute node as its root; in this case, it means that + * the attribute node will appear in the first position of the iteration + * or traversal. Since attributes are never children of other nodes, + * they do not appear when traversing over the document tree.

+ * + *

SHOW_TEXT: + * Show DOMText nodes.

+ * + *

SHOW_CDATA_SECTION: + * Show DOMCDATASection nodes.

+ * + *

SHOW_ENTITY_REFERENCE: + * Show DOMEntityReference nodes.

+ * + *

SHOW_ENTITY: + * Show DOMEntity nodes. This is meaningful only when creating + * an DOMNodeIterator or DOMTreeWalker with an + * DOMEntity node as its root; in this case, it + * means that the DOMEntity node will appear in the first + * position of the traversal. Since entities are not part of the + * document tree, they do not appear when traversing over the document + * tree.

+ * + *

SHOW_PROCESSING_INSTRUCTION: + * Show DOMProcessingInstruction nodes.

+ * + *

SHOW_COMMENT: + * Show DOMComment nodes.

+ * + *

SHOW_DOCUMENT: + * Show DOMDocument nodes.

+ * + *

SHOW_DOCUMENT_TYPE: + * Show DOMDocumentType nodes.

+ * + *

SHOW_DOCUMENT_FRAGMENT: + * Show DOMDocumentFragment nodes.

+ * + *

SHOW_NOTATION: + * Show DOMNotation nodes. This is meaningful only when creating + * an DOMNodeIterator or DOMTreeWalker with a + * DOMNotation node as its root; in this case, it + * means that the DOMNotation node will appear in the first + * position of the traversal. Since notations are not part of the + * document tree, they do not appear when traversing over the document + * tree.

+ * + * @since DOM Level 2 + */ + enum ShowTypeMasks { + SHOW_ALL = 0x0000FFFF, + SHOW_ELEMENT = 0x00000001, + SHOW_ATTRIBUTE = 0x00000002, + SHOW_TEXT = 0x00000004, + SHOW_CDATA_SECTION = 0x00000008, + SHOW_ENTITY_REFERENCE = 0x00000010, + SHOW_ENTITY = 0x00000020, + SHOW_PROCESSING_INSTRUCTION = 0x00000040, + SHOW_COMMENT = 0x00000080, + SHOW_DOCUMENT = 0x00000100, + SHOW_DOCUMENT_TYPE = 0x00000200, + SHOW_DOCUMENT_FRAGMENT = 0x00000400, + SHOW_NOTATION = 0x00000800 + }; + + typedef unsigned long ShowType; + + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMNodeFilter interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + /** + * Test whether a specified node is visible in the logical view of a + * DOMTreeWalker or DOMNodeIterator. This function + * will be called by the implementation of DOMTreeWalker and + * DOMNodeIterator; it is not normally called directly from + * user code. (Though you could do so if you wanted to use the same + * filter to guide your own application logic.) + * @param node The node to check to see if it passes the filter or not. + * @return A constant to determine whether the node is accepted, + * rejected, or skipped, as defined above. + * @since DOM Level 2 + */ + virtual FilterAction acceptNode (const DOMNode* node) const =0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMNodeIterator.hpp b/project/jni/xerces/src/xercesc/dom/DOMNodeIterator.hpp new file mode 100644 index 000000000..44b29a9a7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNodeIterator.hpp @@ -0,0 +1,196 @@ +/* + * 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: DOMNodeIterator.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * DOMNodeIterators are used to step through a set of nodes, e.g. + * the set of nodes in a DOMNodeList, the document subtree + * governed by a particular DOMNode, the results of a query, or + * any other set of nodes. The set of nodes to be iterated is determined by + * the implementation of the DOMNodeIterator. DOM Level 2 + * specifies a single DOMNodeIterator implementation for + * document-order traversal of a document subtree. Instances of these + * DOMNodeIterators are created by calling + * DOMDocumentTraversal.createNodeIterator(). + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ +class CDOM_EXPORT DOMNodeIterator +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNodeIterator() {} + DOMNodeIterator(const DOMNodeIterator &) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMNodeIterator & operator = (const DOMNodeIterator &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNodeIterator() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMNodeFilter interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The root node of the DOMNodeIterator, as specified + * when it was created. + * @since DOM Level 2 + */ + virtual DOMNode* getRoot() = 0; + /** + * Return which node types are presented via the iterator. + * This attribute determines which node types are presented via the + * DOMNodeIterator. The available set of constants is defined + * in the DOMNodeFilter interface. Nodes not accepted by + * whatToShow will be skipped, but their children may still + * be considered. Note that this skip takes precedence over the filter, + * if any. + * @since DOM Level 2 + * + */ + virtual DOMNodeFilter::ShowType getWhatToShow() = 0; + + /** + * The DOMNodeFilter used to screen nodes. + * + * @since DOM Level 2 + */ + virtual DOMNodeFilter* getFilter() = 0; + + /** + * Return the expandEntityReferences flag. + * The value of this flag determines whether the children of entity + * reference nodes are visible to the DOMNodeIterator. If + * false, these children and their descendants will be rejected. Note + * that this rejection takes precedence over whatToShow and + * the filter. Also note that this is currently the only situation where + * DOMNodeIterators may reject a complete subtree rather than + * skipping individual nodes. + *
+ *
To produce a view of the document that has entity references + * expanded and does not expose the entity reference node itself, use + * the whatToShow flags to hide the entity reference node + * and set expandEntityReferences to true when creating the + * DOMNodeIterator. To produce a view of the document that has + * entity reference nodes but no entity expansion, use the + * whatToShow flags to show the entity reference node and + * set expandEntityReferences to false. + * + * @since DOM Level 2 + */ + virtual bool getExpandEntityReferences() = 0; + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + /** + * Returns the next node in the set and advances the position of the + * DOMNodeIterator in the set. After a + * DOMNodeIterator is created, the first call to + * nextNode() returns the first node in the set. + * @return The next DOMNode in the set being iterated over, or + * null if there are no more members in that set. + * @exception DOMException + * INVALID_STATE_ERR: Raised if this method is called after the + * detach method was invoked. + * @since DOM Level 2 + */ + virtual DOMNode* nextNode() = 0; + + /** + * Returns the previous node in the set and moves the position of the + * DOMNodeIterator backwards in the set. + * @return The previous DOMNode in the set being iterated over, + * or null if there are no more members in that set. + * @exception DOMException + * INVALID_STATE_ERR: Raised if this method is called after the + * detach method was invoked. + * @since DOM Level 2 + */ + virtual DOMNode* previousNode() = 0; + + /** + * Detaches the DOMNodeIterator from the set which it iterated + * over, releasing any computational resources and placing the + * DOMNodeIterator in the INVALID state. After + * detach has been invoked, calls to nextNode + * or previousNode will raise the exception + * INVALID_STATE_ERR. + * @since DOM Level 2 + */ + virtual void detach() = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this NodeIterator is no longer in use + * and that the implementation may relinquish any resources associated with it. + * (release() will call detach() where appropriate) + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + +#define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMNodeList.hpp b/project/jni/xerces/src/xercesc/dom/DOMNodeList.hpp new file mode 100644 index 000000000..a8cfc7871 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNodeList.hpp @@ -0,0 +1,112 @@ +/* + * 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: DOMNodeList.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; + + +/** + * The DOMNodeList interface provides the abstraction of an ordered + * collection of nodes. DOMNodeLists are created by DOMDocument::getElementsByTagName(), + * DOMNode::getChildNodes(), + * + *

The items in the DOMNodeList are accessible via an integral + * index, starting from 0. + * + * DOMNodeLists are "live", in that any changes to the document tree are immediately + * reflected in any DOMNodeLists that may have been created for that tree. + */ + +class CDOM_EXPORT DOMNodeList { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNodeList() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMNodeList(const DOMNodeList &); + DOMNodeList & operator = (const DOMNodeList &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNodeList() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMNodeList interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the index item in the collection. + * + * If index is greater than or equal to the number of nodes in + * the list, this returns null. + * + * @param index Index into the collection. + * @return The node at the indexth position in the + * DOMNodeList, or null if that is not a valid + * index. + * @since DOM Level 1 + */ + virtual DOMNode *item(XMLSize_t index) const = 0; + + /** + * Returns the number of nodes in the list. + * + * The range of valid child node indices is 0 to length-1 inclusive. + * @since DOM Level 1 + */ + virtual XMLSize_t getLength() const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMNotation.hpp b/project/jni/xerces/src/xercesc/dom/DOMNotation.hpp new file mode 100644 index 000000000..919c7e935 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMNotation.hpp @@ -0,0 +1,114 @@ +/* + * 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: DOMNotation.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * This interface represents a notation declared in the DTD. A notation either + * declares, by name, the format of an unparsed entity (see section 4.7 of + * the XML 1.0 specification), or is used for formal declaration of + * Processing Instruction targets (see section 2.6 of the XML 1.0 + * specification). The nodeName attribute inherited from + * DOMNode is set to the declared name of the notation. + *

The DOM Level 1 does not support editing DOMNotation nodes; + * they are therefore readonly. + *

A DOMNotation node does not have any parent. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMNotation: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMNotation() {} + DOMNotation(const DOMNotation &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMNotation & operator = (const DOMNotation &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMNotation() {}; + //@} + + + // ----------------------------------------------------------------------- + // Virtual DOMNotation interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Get the public identifier of this notation. + * + * If the public identifier was not + * specified, this is null. + * @return Returns the public identifier of the notation + * @since DOM Level 1 + */ + virtual const XMLCh *getPublicId() const = 0; + + /** + * Get the system identifier of this notation. + * + * If the system identifier was not + * specified, this is null. + * @return Returns the system identifier of the notation + * @since DOM Level 1 + */ + virtual const XMLCh *getSystemId() const = 0; + + + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMPSVITypeInfo.hpp b/project/jni/xerces/src/xercesc/dom/DOMPSVITypeInfo.hpp new file mode 100644 index 000000000..8ccd1fbe8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMPSVITypeInfo.hpp @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP) +#define XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The DOMPSVITypeInfo interface represent the PSVI info used by + * DOMElement or DOMAttr nodes, specified in the + * schemas associated with the document. + */ +class CDOM_EXPORT DOMPSVITypeInfo +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMPSVITypeInfo() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMPSVITypeInfo(const DOMPSVITypeInfo &); + DOMPSVITypeInfo & operator = (const DOMPSVITypeInfo &); + //@} + +public: + + enum PSVIProperty + { + PSVI_Validity + , PSVI_Validation_Attempted + , PSVI_Type_Definition_Type + , PSVI_Type_Definition_Name + , PSVI_Type_Definition_Namespace + , PSVI_Type_Definition_Anonymous + , PSVI_Nil + , PSVI_Member_Type_Definition_Name + , PSVI_Member_Type_Definition_Namespace + , PSVI_Member_Type_Definition_Anonymous + , PSVI_Schema_Default + , PSVI_Schema_Normalized_Value + , PSVI_Schema_Specified + }; + + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMPSVITypeInfo() {}; + //@} + + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the string value of the specified PSVI property associated to a + * DOMElement or DOMAttr, or null if not available. + * + * + * @return the string value of the specified PSVI property associated to a + * DOMElement or DOMAttr, or null if not available. + */ + virtual const XMLCh* getStringProperty(PSVIProperty prop) const = 0; + + /** + * Returns the numeric value of the specified PSVI property associated to a + * DOMElement or DOMAttr, or null if not available. + * + * + * @return the numeric value of the specified PSVI property associated to a + * DOMElement or DOMAttr, or null if not available. + */ + virtual int getNumericProperty(PSVIProperty prop) const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMPSVITypeInfo.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/DOMProcessingInstruction.hpp b/project/jni/xerces/src/xercesc/dom/DOMProcessingInstruction.hpp new file mode 100644 index 000000000..269416c42 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMProcessingInstruction.hpp @@ -0,0 +1,121 @@ +/* + * 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: DOMProcessingInstruction.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * The DOMProcessingInstruction interface represents a "processing + * instruction", used in XML as a way to keep processor-specific information + * in the text of the document. + * + * @since DOM Level 1 + */ +class CDOM_EXPORT DOMProcessingInstruction: public DOMNode { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMProcessingInstruction() {} + DOMProcessingInstruction(const DOMProcessingInstruction &other) : DOMNode(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMProcessingInstruction & operator = (const DOMProcessingInstruction &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMProcessingInstruction() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMProcessingInstruction interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * The target of this processing instruction. + * + * XML defines this as being the + * first token following the markup that begins the processing instruction. + * + * @since DOM Level 1 + */ + virtual const XMLCh * getTarget() const = 0; + + /** + * The content of this processing instruction. + * + * This is from the first non + * white space character after the target to the character immediately + * preceding the ?>. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. + * @since DOM Level 1 + */ + virtual const XMLCh * getData() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Sets the content of this processing instruction. + * + * This is from the first non + * white space character after the target to the character immediately + * preceding the ?>. + * @param data The string containing the processing instruction + * @since DOM Level 1 + */ + virtual void setData(const XMLCh * data) = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/DOMRange.hpp b/project/jni/xerces/src/xercesc/dom/DOMRange.hpp new file mode 100644 index 000000000..f0cdec532 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMRange.hpp @@ -0,0 +1,530 @@ +/* + * 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: DOMRange.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMRANGE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMNode; +class DOMDocumentFragment; + +/** + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ +class CDOM_EXPORT DOMRange { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMRange() {} + DOMRange(const DOMRange &) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMRange & operator = (const DOMRange &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMRange() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * Constants CompareHow. + * + *

START_TO_START: + * Compare start boundary-point of sourceRange to start + * boundary-point of Range on which compareBoundaryPoints + * is invoked.

+ * + *

START_TO_END: + * Compare start boundary-point of sourceRange to end + * boundary-point of Range on which compareBoundaryPoints + * is invoked.

+ * + *

END_TO_END: + * Compare end boundary-point of sourceRange to end + * boundary-point of Range on which compareBoundaryPoints + * is invoked.

+ * + *

END_TO_START: + * Compare end boundary-point of sourceRange to start + * boundary-point of Range on which compareBoundaryPoints + * is invoked.

+ * + * @since DOM Level 2 + */ + enum CompareHow { + START_TO_START = 0, + START_TO_END = 1, + END_TO_END = 2, + END_TO_START = 3 + }; + + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMRange interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * DOMNode within which the Range begins + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual DOMNode* getStartContainer() const = 0; + + /** + * Offset within the starting node of the Range. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual XMLSize_t getStartOffset() const = 0; + + /** + * DOMNode within which the Range ends + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual DOMNode* getEndContainer() const = 0; + + /** + * Offset within the ending node of the Range. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual XMLSize_t getEndOffset() const = 0; + + /** + * TRUE if the Range is collapsed + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual bool getCollapsed() const = 0; + + /** + * The deepest common ancestor container of the Range's two + * boundary-points. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual const DOMNode* getCommonAncestorContainer() const = 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * Sets the attributes describing the start of the Range. + * @param refNode The refNode value. This parameter must be + * different from null. + * @param offset The startOffset value. + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor + * of refNode is an DOMEntity, DOMNotation, or DOMDocumentType + * node. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if offset is negative or greater + * than the number of child units in refNode. Child units + * are 16-bit units if refNode is a type of DOMCharacterData + * node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction + * node. Child units are Nodes in all other cases. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setStart(const DOMNode *refNode, XMLSize_t offset) = 0; + + /** + * Sets the attributes describing the end of a Range. + * @param refNode The refNode value. This parameter must be + * different from null. + * @param offset The endOffset value. + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor + * of refNode is an DOMEntity, DOMNotation, or DOMDocumentType + * node. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if offset is negative or greater + * than the number of child units in refNode. Child units + * are 16-bit units if refNode is a type of DOMCharacterData + * node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction + * node. Child units are Nodes in all other cases. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setEnd(const DOMNode *refNode, XMLSize_t offset) = 0; + + /** + * Sets the start position to be before a node + * @param refNode Range starts before refNode + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if the root container of + * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment + * node or if refNode is a DOMDocument, DOMDocumentFragment, + * DOMAttr, DOMEntity, or DOMNotation node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setStartBefore(const DOMNode *refNode) = 0; + + /** + * Sets the start position to be after a node + * @param refNode Range starts after refNode + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if the root container of + * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment + * node or if refNode is a DOMDocument, DOMDocumentFragment, + * DOMAttr, DOMEntity, or DOMNotation node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setStartAfter(const DOMNode *refNode) = 0; + + /** + * Sets the end position to be before a node. + * @param refNode Range ends before refNode + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if the root container of + * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment + * node or if refNode is a DOMDocument, DOMDocumentFragment, + * DOMAttr, DOMEntity, or DOMNotation node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setEndBefore(const DOMNode *refNode) = 0; + + /** + * Sets the end of a Range to be after a node + * @param refNode Range ends after refNode. + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if the root container of + * refNode is not a DOMAttr, DOMDocument or DOMDocumentFragment + * node or if refNode is a DOMDocument, DOMDocumentFragment, + * DOMAttr, DOMEntity, or DOMNotation node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void setEndAfter(const DOMNode *refNode) = 0; + + // ----------------------------------------------------------------------- + // Misc methods + // ----------------------------------------------------------------------- + /** + * Collapse a Range onto one of its boundary-points + * @param toStart If TRUE, collapses the Range onto its start; if FALSE, + * collapses it onto its end. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual void collapse(bool toStart) = 0; + + /** + * Select a node and its contents + * @param refNode The node to select. + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode + * is an DOMEntity, DOMNotation or DOMDocumentType node or if + * refNode is a DOMDocument, DOMDocumentFragment, DOMAttr, DOMEntity, + * or DOMNotation node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void selectNode(const DOMNode *refNode) = 0; + + /** + * Select the contents within a node + * @param refNode DOMNode to select from + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor + * of refNode is an DOMEntity, DOMNotation or DOMDocumentType node. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + *
WRONG_DOCUMENT_ERR: Raised if refNode was created + * from a different document than the one that created this range. + * + * @since DOM Level 2 + */ + virtual void selectNodeContents(const DOMNode *refNode) = 0; + + /** + * Compare the boundary-points of two Ranges in a document. + * @param how A code representing the type of comparison, as defined + * above. + * @param sourceRange The Range on which this current + * Range is compared to. + * @return -1, 0 or 1 depending on whether the corresponding + * boundary-point of the Range is respectively before, equal to, or + * after the corresponding boundary-point of sourceRange. + * @exception DOMException + * WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same + * DOMDocument or DOMDocumentFragment. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * + * @since DOM Level 2 + */ + virtual short compareBoundaryPoints(CompareHow how, const DOMRange* sourceRange) const = 0; + + /** + * Removes the contents of a Range from the containing document or + * document fragment without returning a reference to the removed + * content. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of + * the Range is read-only or any of the nodes that contain any of the + * content of the Range are read-only. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * + * @since DOM Level 2 + */ + virtual void deleteContents() = 0; + + /** + * Moves the contents of a Range from the containing document or document + * fragment to a new DOMDocumentFragment. + * @return A DOMDocumentFragment containing the extracted contents. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of + * the Range is read-only or any of the nodes which contain any of the + * content of the Range are read-only. + *
HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be + * extracted into the new DOMDocumentFragment. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * + * @since DOM Level 2 + */ + virtual DOMDocumentFragment* extractContents() = 0; + + /** + * Duplicates the contents of a Range + * @return A DOMDocumentFragment that contains content equivalent to this + * Range. + * @exception DOMException + * HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be + * extracted into the new DOMDocumentFragment. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * + * @since DOM Level 2 + */ + virtual DOMDocumentFragment* cloneContents() const = 0; + + /** + * Inserts a node into the DOMDocument or DOMDocumentFragment at the start of + * the Range. If the container is a DOMText node, this will be split at the + * start of the Range (as if the DOMText node's splitText method was + * performed at the insertion point) and the insertion will occur + * between the two resulting DOMText nodes. Adjacent DOMText nodes will not be + * automatically merged. If the node to be inserted is a + * DOMDocumentFragment node, the children will be inserted rather than the + * DOMDocumentFragment node itself. + * @param newNode The node to insert at the start of the Range + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the + * start of the Range is read-only. + *
WRONG_DOCUMENT_ERR: Raised if newNode and the + * container of the start of the Range were not created from the same + * document. + *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of + * the Range is of a type that does not allow children of the type of + * newNode or if newNode is an ancestor of + * the container. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * @exception DOMRangeException + * INVALID_NODE_TYPE_ERR: Raised if newNode is an DOMAttr, + * DOMEntity, DOMNotation, or DOMDocument node. + * + * @since DOM Level 2 + */ + virtual void insertNode(DOMNode *newNode) = 0; + + /** + * Reparents the contents of the Range to the given node and inserts the + * node at the position of the start of the Range. + * @param newParent The node to surround the contents with. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of + * either boundary-point of the Range is read-only. + *
WRONG_DOCUMENT_ERR: Raised if newParent and the + * container of the start of the Range were not created from the same + * document. + *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of + * the Range is of a type that does not allow children of the type of + * newParent or if newParent is an ancestor + * of the container or if node would end up with a child + * node of a type not allowed by the type of node. + *
INVALID_STATE_ERR: Raised if detach() has already + * been invoked on this object. + * @exception DOMRangeException + * BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a + * non-text node. + *
INVALID_NODE_TYPE_ERR: Raised if node is an DOMAttr, + * DOMEntity, DOMDocumentType, DOMNotation, DOMDocument, or DOMDocumentFragment node. + * + * @since DOM Level 2 + */ + virtual void surroundContents(DOMNode *newParent) = 0; + + /** + * Produces a new Range whose boundary-points are equal to the + * boundary-points of the Range. + * @return The duplicated Range. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual DOMRange* cloneRange() const = 0; + + /** + * Returns the contents of a Range as a string. This string contains only + * the data characters, not any markup. + * @return The contents of the Range. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual const XMLCh* toString() const = 0; + + /** + * Called to indicate that the Range is no longer in use and that the + * implementation may relinquish any resources associated with this + * Range. Subsequent calls to any methods or attribute getters on this + * Range will result in a DOMException being thrown with an + * error code of INVALID_STATE_ERR. + * @exception DOMException + * INVALID_STATE_ERR: Raised if detach() has already been + * invoked on this object. + * + * @since DOM Level 2 + */ + virtual void detach() = 0; + + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this Range is no longer in use + * and that the implementation may relinquish any resources associated with it. + * (release() will call detach() where appropriate) + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMRangeException.cpp b/project/jni/xerces/src/xercesc/dom/DOMRangeException.cpp new file mode 100644 index 000000000..28a824973 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMRangeException.cpp @@ -0,0 +1,52 @@ +/* + * 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: DOMRangeException.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMRangeException.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +DOMRangeException::DOMRangeException() +: DOMException() +{ +} + + +DOMRangeException::DOMRangeException(short exCode, + short messageCode, + MemoryManager* const memoryManager) +: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMRANGEEXCEPTION_ERRX+exCode-DOMRangeException::BAD_BOUNDARYPOINTS_ERR+1, memoryManager) +{ +} + + +DOMRangeException::DOMRangeException(const DOMRangeException &other) +: DOMException(other) +{ +} + + +DOMRangeException::~DOMRangeException() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/DOMRangeException.hpp b/project/jni/xerces/src/xercesc/dom/DOMRangeException.hpp new file mode 100644 index 000000000..c4d05f877 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMRangeException.hpp @@ -0,0 +1,114 @@ +/* + * 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: DOMRangeException.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Range operations may throw a DOMRangeException as specified in + * their method descriptions. + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * @since DOM Level 2 + */ + +class CDOM_EXPORT DOMRangeException : public DOMException { +public: + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * Enumerators for DOM Range Exceptions + * + *

BAD_BOUNDARYPOINTS_ERR: + * If the boundary-points of a Range do not meet specific requirements.

+ * + *

INVALID_NODE_TYPE_ERR: + * If the container of an boundary-point of a Range is being set to either + * a node of an invalid type or a node with an ancestor of an invalid + * type.

+ * + * @since DOM Level 2 + */ + enum RangeExceptionCode { + BAD_BOUNDARYPOINTS_ERR = 111, + INVALID_NODE_TYPE_ERR = 112 + }; + //@} + +public: + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + /** + * Default constructor for DOMRangeException. + * + */ + DOMRangeException(); + + /** + * Constructor which takes an error code and a message. + * + * @param code The error code which indicates the exception + * @param messageCode The string containing the error message + * @param memoryManager The memory manager used to (de)allocate memory + */ + DOMRangeException(short code, + short messageCode, + MemoryManager* const memoryManager); + + /** + * Copy constructor. + * + * @param other The object to be copied. + */ + DOMRangeException(const DOMRangeException &other); + //@} + + // ----------------------------------------------------------------------- + // Destructors + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + /** + * Destructor for DOMRangeException. + * + */ + virtual ~DOMRangeException(); + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMRangeException & operator = (const DOMRangeException &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMStringList.hpp b/project/jni/xerces/src/xercesc/dom/DOMStringList.hpp new file mode 100644 index 000000000..e594566a1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMStringList.hpp @@ -0,0 +1,131 @@ +/* + * 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: DOMStringList.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP) +#define XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * The DOMStringList interface provides the abstraction of an ordered + * collection of strings, without defining or constraining how this collection + * is implemented. The items in the DOMStringList are accessible via + * an integral index, starting from 0. + */ + +class CDOM_EXPORT DOMStringList { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMStringList() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMStringList(const DOMStringList &); + DOMStringList & operator = (const DOMStringList &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMStringList() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMStringList interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns the index item in the collection. + * + * If index is greater than or equal to the number of strings in + * the list, this returns null. + * + * @param index Index into the collection. + * @return The string at the indexth position in the + * DOMStringList, or null if that is not a valid + * index. + * @since DOM Level 3 + */ + virtual const XMLCh *item(XMLSize_t index) const = 0; + + /** + * Returns the number of strings in the list. + * + * The range of valid child node indices is 0 to length-1 inclusive. + * + * @since DOM Level 3 + */ + virtual XMLSize_t getLength() const = 0; + + /** + * Test if a string is part of this DOMStringList + * + * @return true if the string has been found, false otherwise. + * + * @since DOM Level 3 + */ + virtual bool contains(const XMLCh*) const = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this list is no longer in use + * and that the implementation may relinquish any resources associated with it and + * its associated children. + * + * Access to a released object will lead to unexpected result. + * + */ + virtual void release() = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMText.hpp b/project/jni/xerces/src/xercesc/dom/DOMText.hpp new file mode 100644 index 000000000..9bc305346 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMText.hpp @@ -0,0 +1,182 @@ +/* + * 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: DOMText.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTEXT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTEXT_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * The DOMText interface inherits from DOMCharacterData + * and represents the textual content (termed character data in XML) of an + * DOMElement or DOMAttr. If there is no markup inside + * an element's content, the text is contained in a single object + * implementing the DOMText interface that is the only child of + * the element. If there is markup, it is parsed into the information items + * (elements, comments, etc.) and DOMText nodes that form the list + * of children of the element. + *

When a document is first made available via the DOM, there is only one + * DOMText node for each block of text. Users may create adjacent + * DOMText nodes that represent the contents of a given element + * without any intervening markup, but should be aware that there is no way + * to represent the separations between these nodes in XML or HTML, so they + * will not (in general) persist between DOM editing sessions. The + * normalize() method on DOMNode merges any such + * adjacent DOMText objects into a single node for each block of + * text. + *

See also the Document Object Model (DOM) Level 2 Core Specification. + */ +class CDOM_EXPORT DOMText: public DOMCharacterData { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMText() {} + DOMText(const DOMText &other) : DOMCharacterData(other) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented operators */ + //@{ + DOMText & operator = (const DOMText &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMText() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMText interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 1 */ + //@{ + /** + * Breaks this node into two nodes at the specified offset, + * keeping both in the tree as siblings. After being split, this node + * will contain all the content up to the offset point. A + * new node of the same type, which contains all the content at and + * after the offset point, is returned. If the original + * node had a parent node, the new node is inserted as the next sibling + * of the original node. When the offset is equal to the + * length of this node, the new node has no data. + * @param offset The 16-bit unit offset at which to split, starting from + * 0. + * @return The new node, of the same type as this node. + * @exception DOMException + * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater + * than the number of 16-bit units in data. + *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * @since DOM Level 1 + */ + virtual DOMText *splitText(XMLSize_t offset) = 0; + //@} + + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * Returns whether this text node contains element content whitespace, + * often abusively called "ignorable whitespace". The text node is determined + * to contain whitespace in element content during the load of the document + * or if validation occurs while using DOMDocument::normalizeDocument(). + * + * @since DOM Level 3 + */ + virtual bool getIsElementContentWhitespace() const = 0; + + /** + * Returns all text of DOMText nodes logically-adjacent text + * nodes to this node, concatenated in document order. + * + * @since DOM Level 3 + */ + virtual const XMLCh* getWholeText() const = 0; + + /** + * Substitutes the a specified text for the text of the current node and + * all logically-adjacent text nodes. + * + *
This method returns the node in the hierarchy which received the + * replacement text, which is null if the text was empty or is the + * current node if the current node is not read-only or otherwise is a + * new node of the same type as the current node inserted at the site of + * the replacement. All logically-adjacent text nodes are removed + * including the current node unless it was the recipient of the + * replacement text. + *
Where the nodes to be removed are read-only descendants of an + * DOMEntityReference, the DOMEntityReference must + * be removed instead of the read-only nodes. If any + * DOMEntityReference to be removed has descendants that are + * not DOMEntityReference, DOMText, or + * DOMCDATASection nodes, the replaceWholeText + * method must fail before performing any modification of the document, + * raising a DOMException with the code + * NO_MODIFICATION_ALLOWED_ERR. + * + * @param content The content of the replacing DOMText node. + * @return The DOMText node created with the specified content. + * @exception DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the DOMText + * nodes being replaced is readonly. + * @since DOM Level 3 + */ + virtual DOMText* replaceWholeText(const XMLCh* content) = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard extension + // ----------------------------------------------------------------------- + /** @name Non-standard extension */ + //@{ + /** + * Non-standard extension + * + * Return true if this node contains ignorable whitespaces only. + * @return True if this node contains ignorable whitespaces only. + */ + virtual bool isIgnorableWhitespace() const = 0; + //@} + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/DOMTreeWalker.hpp b/project/jni/xerces/src/xercesc/dom/DOMTreeWalker.hpp new file mode 100644 index 000000000..9f22fbe43 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMTreeWalker.hpp @@ -0,0 +1,276 @@ +/* + * 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: DOMTreeWalker.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * DOMTreeWalker objects are used to navigate a document tree or + * subtree using the view of the document defined by their + * whatToShow flags and filter (if any). Any function which + * performs navigation using a DOMTreeWalker will automatically + * support any view defined by a DOMTreeWalker. + *

Omitting nodes from the logical view of a subtree can result in a + * structure that is substantially different from the same subtree in the + * complete, unfiltered document. Nodes that are siblings in the + * DOMTreeWalker view may be children of different, widely + * separated nodes in the original view. For instance, consider a + * DOMNodeFilter that skips all nodes except for DOMText nodes and + * the root node of a document. In the logical view that results, all text + * nodes will be siblings and appear as direct children of the root node, no + * matter how deeply nested the structure of the original document. + *

See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. + * + * @since DOM Level 2 + */ +class CDOM_EXPORT DOMTreeWalker { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMTreeWalker() {} + DOMTreeWalker(const DOMTreeWalker &) {} + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMTreeWalker & operator = (const DOMTreeWalker &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMTreeWalker() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMTreeWalker interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 2 */ + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** + * The root node of the DOMTreeWalker, as specified + * when it was created. + * + * @since DOM Level 2 + */ + virtual DOMNode* getRoot() = 0; + /** + * This attribute determines which node types are presented via the + * DOMTreeWalker. The available set of constants is defined in + * the DOMNodeFilter interface. Nodes not accepted by + * whatToShow will be skipped, but their children may still + * be considered. Note that this skip takes precedence over the filter, + * if any. + * + * @since DOM Level 2 + */ + virtual DOMNodeFilter::ShowType getWhatToShow()= 0; + + /** + * Return The filter used to screen nodes. + * + * @since DOM Level 2 + */ + virtual DOMNodeFilter* getFilter()= 0; + + /** + * The value of this flag determines whether the children of entity + * reference nodes are visible to the DOMTreeWalker. If false, + * these children and their descendants will be rejected. Note that + * this rejection takes precedence over whatToShow and the + * filter, if any. + *
To produce a view of the document that has entity references + * expanded and does not expose the entity reference node itself, use + * the whatToShow flags to hide the entity reference node + * and set expandEntityReferences to true when creating the + * DOMTreeWalker. To produce a view of the document that has + * entity reference nodes but no entity expansion, use the + * whatToShow flags to show the entity reference node and + * set expandEntityReferences to false. + * + * @since DOM Level 2 + */ + virtual bool getExpandEntityReferences()= 0; + + /** + * Return the node at which the DOMTreeWalker is currently positioned. + * + * @since DOM Level 2 + */ + virtual DOMNode* getCurrentNode()= 0; + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + /** + * Moves to and returns the closest visible ancestor node of the current + * node. If the search for parentNode attempts to step + * upward from the DOMTreeWalker's root node, or + * if it fails to find a visible ancestor node, this method retains the + * current position and returns null. + * @return The new parent node, or null if the current node + * has no parent in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* parentNode()= 0; + + /** + * Moves the DOMTreeWalker to the first visible child of the + * current node, and returns the new node. If the current node has no + * visible children, returns null, and retains the current + * node. + * @return The new node, or null if the current node has no + * visible children in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* firstChild()= 0; + + /** + * Moves the DOMTreeWalker to the last visible child of the + * current node, and returns the new node. If the current node has no + * visible children, returns null, and retains the current + * node. + * @return The new node, or null if the current node has no + * children in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* lastChild()= 0; + + /** + * Moves the DOMTreeWalker to the previous sibling of the + * current node, and returns the new node. If the current node has no + * visible previous sibling, returns null, and retains the + * current node. + * @return The new node, or null if the current node has no + * previous sibling. in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* previousSibling()= 0; + + /** + * Moves the DOMTreeWalker to the next sibling of the current + * node, and returns the new node. If the current node has no visible + * next sibling, returns null, and retains the current node. + * @return The new node, or null if the current node has no + * next sibling. in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* nextSibling()= 0; + + /** + * Moves the DOMTreeWalker to the previous visible node in + * document order relative to the current node, and returns the new + * node. If the current node has no previous node, or if the search for + * previousNode attempts to step upward from the + * DOMTreeWalker's root node, returns + * null, and retains the current node. + * @return The new node, or null if the current node has no + * previous node in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* previousNode()= 0; + + /** + * Moves the DOMTreeWalker to the next visible node in document + * order relative to the current node, and returns the new node. If the + * current node has no next node, or if the search for nextNode attempts + * to step upward from the DOMTreeWalker's root + * node, returns null, and retains the current node. + * @return The new node, or null if the current node has no + * next node in the DOMTreeWalker's logical view. + * + * @since DOM Level 2 + */ + virtual DOMNode* nextNode()= 0; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** + * The node at which the DOMTreeWalker is currently positioned. + *
Alterations to the DOM tree may cause the current node to no longer + * be accepted by the DOMTreeWalker's associated filter. + * currentNode may also be explicitly set to any node, + * whether or not it is within the subtree specified by the + * root node or would be accepted by the filter and + * whatToShow flags. Further traversal occurs relative to + * currentNode even if it is not part of the current view, + * by applying the filters in the requested direction; if no traversal + * is possible, currentNode is not changed. + * @exception DOMException + * NOT_SUPPORTED_ERR: Raised if an attempt is made to set + * currentNode to null. + * + * @since DOM Level 2 + */ + virtual void setCurrentNode(DOMNode* currentNode)= 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this TreeWalker is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + +#define GetDOMTreeWalkerMemoryManager GET_INDIRECT_MM(fCurrentNode) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMTypeInfo.hpp b/project/jni/xerces/src/xercesc/dom/DOMTypeInfo.hpp new file mode 100644 index 000000000..4e22b8d53 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMTypeInfo.hpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The DOMTypeInfo interface represent a type used by + * DOMElement or DOMAttr nodes, specified in the + * schemas associated with the document. The type is a pair of a namespace URI + * and name properties, and depends on the document's schema. + */ +class CDOM_EXPORT DOMTypeInfo +{ +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMTypeInfo() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMTypeInfo(const DOMTypeInfo &); + DOMTypeInfo & operator = (const DOMTypeInfo &); + //@} + +public: + + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMTypeInfo() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Contants */ + //@{ + /** + * These are the available values for the derivationMethod parameter used by the + * method DOMTypeInfo::isDerivedFrom(). It is a set of possible types + * of derivation, and the values represent bit positions. If a bit in the derivationMethod + * parameter is set to 1, the corresponding type of derivation will be taken into account + * when evaluating the derivation between the reference type definition and the other type + * definition. When using the isDerivedFrom method, combining all of them in the + * derivationMethod parameter is equivalent to invoking the method for each of them separately + * and combining the results with the OR boolean function. This specification only defines + * the type of derivation for XML Schema. + * + * In addition to the types of derivation listed below, please note that: + * - any type derives from xsd:anyType. + * - any simple type derives from xsd:anySimpleType by restriction. + * - any complex type does not derive from xsd:anySimpleType by restriction. + * + *

DERIVATION_EXTENSION: + * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the + * derivation by extension. The reference type definition is derived by extension from the other + * type definition if the other type definition can be reached recursively following the + * {base type definition} property from the reference type definition, and at least one of the + * derivation methods involved is an extension.

+ * + *

DERIVATION_LIST: + * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the list. + * The reference type definition is derived by list from the other type definition if there exists + * two type definitions T1 and T2 such as the reference type definition is derived from T1 by + * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by + * DERIVATION_RESTRICTION, T1 has {variety} list, and T2 is the {item type definition}. Note that + * T1 could be the same as the reference type definition, and T2 could be the same as the other + * type definition.

+ * + *

DERIVATION_RESTRICTION: + * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the + * derivation by restriction if complex types are involved, or a restriction if simple types are + * involved. + * The reference type definition is derived by restriction from the other type definition if the + * other type definition is the same as the reference type definition, or if the other type definition + * can be reached recursively following the {base type definition} property from the reference type + * definition, and all the derivation methods involved are restriction.

+ * + *

DERIVATION_UNION: + * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the union + * if simple types are involved. + * The reference type definition is derived by union from the other type definition if there exists + * two type definitions T1 and T2 such as the reference type definition is derived from T1 by + * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by + * DERIVATION_RESTRICTION, T1 has {variety} union, and one of the {member type definitions} is T2. + * Note that T1 could be the same as the reference type definition, and T2 could be the same as the + * other type definition.

+ * + * @since DOM Level 3 + * + */ + enum DerivationMethods { + DERIVATION_RESTRICTION = 0x001, + DERIVATION_EXTENSION = 0x002, + DERIVATION_UNION = 0x004, + DERIVATION_LIST = 0x008 + }; + //@} + + //@{ + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Returns The name of a type declared for the associated DOMElement + * or DOMAttr, or null if unknown. + * + * @return The name of a type declared for the associated DOMElement + * or DOMAttribute, or null if unknown. + * @since DOM level 3 + */ + virtual const XMLCh* getTypeName() const = 0; + + /** + * The namespace of the type declared for the associated DOMElement + * or DOMAttr or null if the DOMElement does not have + * declaration or if no namespace information is available. + * + * @return The namespace of the type declared for the associated DOMElement + * or DOMAttr or null if the DOMElement does not have + * declaration or if no namespace information is available. + * @since DOM level 3 + */ + virtual const XMLCh* getTypeNamespace() const = 0; + //@} + + //@{ + /** + * This method returns if there is a derivation between the reference type definition, + * i.e. the DOMTypeInfo on which the method is being called, and the other type definition, + * i.e. the one passed as parameters. + * + * @param typeNamespaceArg The namespace of the other type definition. + * @param typeNameArg The name of the other type definition. + * @param derivationMethod The type of derivation and conditions applied between two types, + * as described in the list of constants provided in this interface. + * @return If the document's schema is a DTD or no schema is associated with the document, + * this method will always return false. + * If the document's schema is an XML Schema, the method will true if the reference + * type definition is derived from the other type definition according to the derivation + * parameter. If the value of the parameter is 0 (no bit is set to 1 for the + * derivationMethod parameter), the method will return true if the other type definition + * can be reached by recursing any combination of {base type definition}, + * {item type definition}, or {member type definitions} from the reference type definition. + * @since DOM level 3 + */ + virtual bool isDerivedFrom(const XMLCh* typeNamespaceArg, + const XMLCh* typeNameArg, + DerivationMethods derivationMethod) const = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMTypeInfo.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/DOMUserDataHandler.hpp b/project/jni/xerces/src/xercesc/dom/DOMUserDataHandler.hpp new file mode 100644 index 000000000..74c24dd56 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMUserDataHandler.hpp @@ -0,0 +1,140 @@ +/* + * 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: DOMUserDataHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * When associating an object to a key on a node using setUserData + * the application can provide a handler that gets called when the node the + * object is associated to is being cloned or imported. This can be used by + * the application to implement various behaviors regarding the data it + * associates to the DOM nodes. This interface defines that handler. + * + *

See also the Document Object Model (DOM) Level 3 Core Specification. + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMUserDataHandler { +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMUserDataHandler() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMUserDataHandler(const DOMUserDataHandler &); + DOMUserDataHandler & operator = (const DOMUserDataHandler &); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMUserDataHandler() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * Operation Type + * + *

NODE_CLONED: + * The node is cloned.

+ * + *

NODE_IMPORTED + * The node is imported.

+ * + *

NODE_DELETED + * The node is deleted.

+ * + *

NODE_RENAMED + * The node is renamed. + * + *

NODE_ADOPTED + * The node is adopted. + * + * @since DOM Level 3 + */ + enum DOMOperationType { + NODE_CLONED = 1, + NODE_IMPORTED = 2, + NODE_DELETED = 3, + NODE_RENAMED = 4, + NODE_ADOPTED = 5 + }; + //@} + + + // ----------------------------------------------------------------------- + // Virtual DOMUserDataHandler interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * This method is called whenever the node for which this handler is + * registered is imported or cloned. + * + * @param operation Specifies the type of operation that is being + * performed on the node. + * @param key Specifies the key for which this handler is being called. + * @param data Specifies the data for which this handler is being called. + * @param src Specifies the node being cloned, adopted, imported, or renamed. + * This is null when the node is being deleted. + * @param dst Specifies the node newly created if any, or null. + * + * @since DOM Level 3 + */ + virtual void handle(DOMOperationType operation, + const XMLCh* const key, + void* data, + const DOMNode* src, + DOMNode* dst) = 0; + + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathEvaluator.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathEvaluator.hpp new file mode 100644 index 000000000..b491c7e04 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathEvaluator.hpp @@ -0,0 +1,180 @@ +/* + * 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: DOMXPathEvaluator.hpp 698579 2008-09-24 14:13:08Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMXPathNSResolver; +class DOMXPathExpression; +class DOMNode; + +/** + * The evaluation of XPath expressions is provided by DOMXPathEvaluator. + * In a DOM implementation which supports the XPath feature, the DOMXPathEvaluator + * interface will be implemented on the same object which implements the Document interface permitting + * it to be obtained by casting or by using the DOM Level 3 getFeature method. In this case the + * implementation obtained from the Document supports the XPath DOM module and is compatible + * with the XPath 1.0 specification. + * Evaluation of expressions with specialized extension functions or variables may not + * work in all implementations and is, therefore, not portable. XPathEvaluator implementations + * may be available from other sources that could provide specific support for specialized extension + * functions or variables as would be defined by other specifications. + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathEvaluator +{ + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMXPathEvaluator() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMXPathEvaluator(const DOMXPathEvaluator &); + DOMXPathEvaluator& operator = (const DOMXPathEvaluator&); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMXPathEvaluator() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMXPathEvaluator interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + + /** + * Creates a parsed XPath expression with resolved namespaces. This is useful + * when an expression will be reused in an application since it makes it + * possible to compile the expression string into a more efficient internal + * form and preresolve all namespace prefixes which occur within the expression. + * @param expression of type XMLCh - The XPath expression string to be parsed. + * @param resolver of type XPathNSResolver - The resolver permits + * translation of all prefixes, including the xml namespace prefix, within the XPath expression + * into appropriate namespace URIs. If this is specified as null, any namespace + * prefix within the expression will result in DOMException being thrown with the + * code NAMESPACE_ERR. + * @return DOMXPathExpression The compiled form of the XPath expression. + * @exception DOMXPathException + * INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the + * rules of the DOMXPathEvaluator. + * @exception DOMException + * NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot + * be resolved by the specified XPathNSResolver. + * @since DOM Level 3 + */ + virtual DOMXPathExpression* createExpression(const XMLCh *expression, + const DOMXPathNSResolver *resolver) = 0; + + + /** Adapts any DOM node to resolve namespaces so that an XPath expression can be + * easily evaluated relative to the context of the node where it appeared within + * the document. This adapter works like the DOM Level 3 method lookupNamespaceURI + * on nodes in resolving the namespaceURI from a given prefix using the current + * information available in the node's hierarchy at the time lookupNamespaceURI + * is called. also correctly resolving the implicit xml prefix. + * @param nodeResolver of type DOMNode The node to be used as a context + * for namespace resolution. If this parameter is null, an unpopulated + * DOMXPathNSResolver is returned, which can be populated using the + * Xerces-C extension DOMXPathNSResolver::addNamespaceBinding(). + * @return DOMXPathNSResolver The object which resolves namespaces + * with respect to the definitions in scope for the specified node. + */ + virtual DOMXPathNSResolver* createNSResolver(const DOMNode *nodeResolver) = 0; + + + /** + * Evaluates an XPath expression string and returns a result of the specified + * type if possible. + * @param expression of type XMLCh The XPath expression string to be parsed + * and evaluated. + * @param contextNode of type DOMNode The context is context node + * for the evaluation + * of this XPath expression. If the DOMXPathEvaluator was obtained by + * casting the DOMDocument then this must be owned by the same + * document and must be a DOMDocument, DOMElement, + * DOMAttribute, DOMText, DOMCDATASection, + * DOMComment, DOMProcessingInstruction, or + * XPathNamespace node. If the context node is a DOMText or + * a DOMCDATASection, then the context is interpreted as the whole + * logical text node as seen by XPath, unless the node is empty in which case it + * may not serve as the XPath context. + * @param resolver of type XPathNSResolver The resolver permits + * translation of all prefixes, including the xml namespace prefix, within + * the XPath expression into appropriate namespace URIs. If this is specified + * as null, any namespace prefix within the expression will result in + * DOMException being thrown with the code NAMESPACE_ERR. + * @param type - If a specific type is specified, then + * the result will be returned as the corresponding type. This must be one + * of the codes of the DOMXPathResult interface. + * @param result of type DOMXPathResult* - The result specifies a specific result object + * which may be reused and returned by this method. If this is specified as + * null or the implementation does not reuse the specified result, a new result + * object will be constructed and returned. + * @return DOMXPathResult* The result of the evaluation of the XPath expression. + * @exception DOMXPathException + * INVALID_EXPRESSION_ERR: Raised if the expression is not legal + * according to the rules of the DOMXPathEvaluator + * TYPE_ERR: Raised if the result cannot be converted to return the specified type. + * @exception DOMException + * NAMESPACE_ERR: Raised if the expression contains namespace prefixes + * which cannot be resolved by the specified XPathNSResolver. + * WRONG_DOCUMENT_ERR: The DOMNode is from a document that is not supported + * by this DOMXPathEvaluator. + * NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context + * node or the request type is not permitted by this DOMXPathEvaluator. + */ + virtual DOMXPathResult* evaluate(const XMLCh *expression, + const DOMNode *contextNode, + const DOMXPathNSResolver *resolver, + DOMXPathResult::ResultType type, + DOMXPathResult* result) = 0; + + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathException.cpp b/project/jni/xerces/src/xercesc/dom/DOMXPathException.cpp new file mode 100644 index 000000000..8e4877eba --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathException.cpp @@ -0,0 +1,52 @@ +/* + * 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. + */ + + +#include "DOMXPathException.hpp" +#include +#include +#include +#include "impl/DOMImplementationImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +DOMXPathException::DOMXPathException() +: DOMException() +{ +} + + +DOMXPathException::DOMXPathException(short exCode, + short messageCode, + MemoryManager* const memoryManager) +: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMXPATHEXCEPTION_ERRX+exCode-DOMXPathException::INVALID_EXPRESSION_ERR+1, memoryManager) +{ +} + + +DOMXPathException::DOMXPathException(const DOMXPathException &other) +: DOMException(other) +{ +} + + +DOMXPathException::~DOMXPathException() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathException.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathException.hpp new file mode 100644 index 000000000..3ad187e8e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathException.hpp @@ -0,0 +1,105 @@ +/* + * 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: DOMXPathException.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathException : public DOMException +{ +public: + //@{ + /** + * ExceptionCode + *
INVALID_EXPRESSION_ERR The expression has a syntax error or otherwise + * is not a legal expression according to the rules of the specific + * DOMXPathEvaluator or contains specialized extension functions + * or variables not supported by this implementation. + *
TYPE_ERR The expression cannot be converted to return the specified type. + *
NO_RESULT_ERROR There is no current result in the result object. + */ + enum ExceptionCode { + INVALID_EXPRESSION_ERR = 51, + TYPE_ERR = 52, + NO_RESULT_ERROR = 53 + }; + //@} + +public: + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + /** + * Default constructor for DOMXPathException. + * + */ + DOMXPathException(); + + /** + * Constructor which takes an error code and a message. + * + * @param code The error code which indicates the exception + * @param messageCode The string containing the error message + * @param memoryManager The memory manager used to (de)allocate memory + */ + DOMXPathException(short code, + short messageCode = 0, + MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor. + * + * @param other The object to be copied. + */ + DOMXPathException(const DOMXPathException &other); + + //@} + + // ----------------------------------------------------------------------- + // Destructors + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + /** + * Destructor for DOMXPathException. + * + */ + virtual ~DOMXPathException(); + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMXPathException& operator = (const DOMXPathException&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathExpression.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathExpression.hpp new file mode 100644 index 000000000..0bf34b26b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathExpression.hpp @@ -0,0 +1,129 @@ +/* + * 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: DOMXPathExpression.hpp 698579 2008-09-24 14:13:08Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMNode; + +/** + * The DOMXPathExpression interface represents a parsed and resolved XPath expression. + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathExpression +{ + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMXPathExpression() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMXPathExpression(const DOMXPathExpression &); + DOMXPathExpression& operator = (const DOMXPathExpression&); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMXPathExpression() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMXPathExpression interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + + /** + * Evaluates this XPath expression and returns a result. + * @param contextNode of type DOMNode The context is context + * node for the evaluation of this XPath expression. + * If the XPathEvaluator was obtained by casting the Document then this must + * be owned by the same document and must be a DOMDocument, DOMElement, + * DOMAttribute, DOMText, DOMCDATASection, + * DOMComment, DOMProcessingInstruction, or + * XPathNamespace. If the context node is a DOMText or a + * DOMCDATASection, then the context is interpreted as the whole logical + * text node as seen by XPath, unless the node is empty in which case it may not + * serve as the XPath context. + * @param type If a specific type is specified, then the result + * will be coerced to return the specified type relying on XPath conversions and fail + * if the desired coercion is not possible. This must be one of the type codes of DOMXPathResult. + * @param result of type DOMXPathResult* The result specifies a specific result object which + * may be reused and returned by this method. If this is specified as nullor the + * implementation does not reuse the specified result, a new result object will be constructed + * and returned. + * @return DOMXPathResult* The result of the evaluation of the XPath expression. + * @exception DOMXPathException + * TYPE_ERR: Raised if the result cannot be converted to return the specified type. + * @exception DOMException + * WRONG_DOCUMENT_ERR: The DOMNode is from a document that is not supported by + * the XPathEvaluator that created this DOMXPathExpression. + * NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context node or the + * request type is not permitted by this DOMXPathExpression. + */ + + virtual DOMXPathResult* evaluate(const DOMNode *contextNode, + DOMXPathResult::ResultType type, + DOMXPathResult* result) const = 0; + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this DOMXPathExpression is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathNSResolver.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathNSResolver.hpp new file mode 100644 index 000000000..b12d5a822 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathNSResolver.hpp @@ -0,0 +1,130 @@ +/* + * 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: DOMXPathNSResolver.hpp 698579 2008-09-24 14:13:08Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN +/** + * The DOMXPathNSResolver interface permit prefix strings + * in the expression to be properly bound to namespaceURI strings. + * DOMXPathEvaluator can construct an implementation of + * DOMXPathNSResolver from a node, or the interface may be + * implemented by any application. + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathNSResolver +{ + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMXPathNSResolver() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMXPathNSResolver(const DOMXPathNSResolver &); + DOMXPathNSResolver& operator = (const DOMXPathNSResolver&); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMXPathNSResolver() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMDocument interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + + /** Look up the namespace URI associated to the given namespace prefix. + * + * @param prefix of type XMLCh - The prefix to look for. An empty or + * null string denotes the default namespace. + * @return the associated namespace URI or null if none is found. + */ + virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0; + //@} + + + // ----------------------------------------------------------------------- + // Non-standard extension + // ----------------------------------------------------------------------- + /** @name Non-standard extension */ + //@{ + + /** + * Non-standard extension + * + * XPath2 implementations require a reverse lookup in the static context. + * Look up the prefix associated with the namespace URI + * @param URI of type XMLCh - The namespace to look for. + * @return the associated prefix which can be an empty string if this + * is a default namespace or null if none is found. + */ + virtual const XMLCh* lookupPrefix(const XMLCh* URI) const = 0; + + /** + * Non-standard extension + * + * Associate the given namespace prefix to the namespace URI. + * @param prefix of type XMLCh - The namespace prefix to bind. An empty + * or null string denotes the default namespace. + * @param uri of type XMLCh - The associated namespace URI. If this + * argument is null or an empty string then the existing binding for this + * prefix is removed. + */ + virtual void addNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0; + + /** + * Called to indicate that this object (and its associated children) is no longer in use + * and that the implementation may relinquish any resources associated with it and + * its associated children. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathNamespace.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathNamespace.hpp new file mode 100644 index 000000000..ae6234129 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathNamespace.hpp @@ -0,0 +1,115 @@ +/* + * 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: DOMXPathNamespace.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElement; + +/** + * The DOMXPathNamespace interface is returned by DOMXPathResult + * interfaces to represent the XPath namespace node type that DOM lacks. There is no + * public constructor for this node type. Attempts to place it into a hierarchy or a + * NamedNodeMap result in a DOMException with the code HIERARCHY_REQUEST_ERR. This node + * is read only, so methods or setting of attributes that would mutate the node result + * in a DOMException with the code NO_MODIFICATION_ALLOWED_ERR. + * The core specification describes attributes of the DOMNode interface that + * are different for different node types but does not describe XPATH_NAMESPACE_NODE, + * so here is a description of those attributes for this node type. All attributes of + * DOMNode not described in this section have a null or false value. + * ownerDocument matches the ownerDocument of the ownerElement even if the element is later adopted. + * nodeName is always the string "#namespace". + * prefix is the prefix of the namespace represented by the node. + * localName is the same as prefix. + * nodeType is equal to XPATH_NAMESPACE_NODE. + * namespaceURI is the namespace URI of the namespace represented by the node. + * nodeValue is the same as namespaceURI. + * adoptNode, cloneNode, and importNode fail on this node type by raising a DOMException with the code NOT_SUPPORTED_ERR. + * Note: In future versions of the XPath specification, the definition of a namespace node may + * be changed incompatibly, in which case incompatible changes to field values may be required to + * implement versions beyond XPath 1.0. + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathNamespace : public DOMNode +{ + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMXPathNamespace() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMXPathNamespace(const DOMXPathNamespace &); + DOMXPathNamespace& operator = (const DOMXPathNamespace&); + //@} + +public: + + + enum XPathNodeType { + XPATH_NAMESPACE_NODE = 13 + }; + + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMXPathNamespace() {}; + //@} + + // ----------------------------------------------------------------------- + // Virtual DOMXPathNamespace interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + /** + * The DOMElement on which the namespace was in scope when + * it was requested. This does not change on a returned namespace node + * even if the document changes such that the namespace goes out of + * scope on that element and this node is no longer found there by XPath. + * @since DOM Level 3 + */ + virtual DOMElement *getOwnerElement() const = 0; + + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/DOMXPathResult.hpp b/project/jni/xerces/src/xercesc/dom/DOMXPathResult.hpp new file mode 100644 index 000000000..2e35eb371 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/DOMXPathResult.hpp @@ -0,0 +1,351 @@ +/* + * 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: DOMXPathResult.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMXPathNSResolver; +class DOMXPathExpression; +class DOMTypeInfo; +class DOMNode; + +/** + * The DOMXPathResult interface represents the result of the + * evaluation of an XPath 1.0 or XPath 2.0 expression within the context + * of a particular node. Since evaluation of an XPath expression can result + * in various result types, this object makes it possible to discover and + * manipulate the type and value of the result. + * + * Note that some function signatures were changed compared to the + * DOM Level 3 in order to accommodate XPath 2.0. + * + * @since DOM Level 3 + */ +class CDOM_EXPORT DOMXPathResult +{ + +protected: + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Hidden constructors */ + //@{ + DOMXPathResult() {}; + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + /** @name Unimplemented constructors and operators */ + //@{ + DOMXPathResult(const DOMXPathResult &); + DOMXPathResult& operator = (const DOMXPathResult&); + //@} + +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~DOMXPathResult() {}; + //@} + + // ----------------------------------------------------------------------- + // Class Types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + *

ANY_TYPE + *
[XPath 1.0] This code does not represent a specific type. An evaluation of an XPath + * expression will never produce this type. If this type is requested, then + * the evaluation returns whatever type naturally results from evaluation + * of the expression. + * If the natural result is a node set when ANY_TYPE was requested, then + * UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other + * representation of a node set must be explicitly requested. + *

ANY_UNORDERED_NODE_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed + * as a single node, which may be null if the node set is empty. Document + * modification does not invalidate the node, but may mean that the result + * node no longer corresponds to the current document. This is a convenience + * that permits optimization since the implementation can stop once any node + * in the resulting set has been found. + * If there is more than one node in the actual result, the single node + * returned might not be the first in document order. + *

BOOLEAN_TYPE + *
[XPath 1.0] The result is a boolean as defined by XPath 1.0. Document modification + * does not invalidate the boolean, but may mean that reevaluation would not + * yield the same boolean. + *

FIRST_ORDERED_NODE_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed + * as a single node, which may be null if the node set is empty. Document + * modification does not invalidate the node, but may mean that the result + * node no longer corresponds to the current document. This is a convenience + * that permits optimization since the implementation can stop once the first + * node in document order of the resulting set has been found. + * If there are more than one node in the actual result, the single node + * returned will be the first in document order. + *

NUMBER_TYPE + *
[XPath 1.0] The result is a number as defined by XPath 1.0. Document modification does + * not invalidate the number, but may mean that reevaluation would not yield the + * same number. + *

ORDERED_NODE_ITERATOR_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed + * iteratively, which will produce document-ordered nodes. Document modification + * invalidates the iteration. + *

ORDERED_NODE_SNAPSHOT_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a + * snapshot list of nodes that will be in original document order. Document + * modification does not invalidate the snapshot but may mean that reevaluation would + * not yield the same snapshot and nodes in the snapshot may have been altered, moved, + * or removed from the document. + *

STRING_TYPE + *
[XPath 1.0] The result is a string as defined by XPath 1.0. Document modification does not + * invalidate the string, but may mean that the string no longer corresponds to the + * current document. + *

UNORDERED_NODE_ITERATOR_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed iteratively, + * which may not produce nodes in a particular order. Document modification invalidates the iteration. + * This is the default type returned if the result is a node set and ANY_TYPE is requested. + *

UNORDERED_NODE_SNAPSHOT_TYPE + *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a + * snapshot list of nodes that may not be in a particular order. Document modification + * does not invalidate the snapshot but may mean that reevaluation would not yield the same + * snapshot and nodes in the snapshot may have been altered, moved, or removed from the document. + *

FIRST_RESULT_TYPE + *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 and will be accessed + * as a single current value or there will be no current value if the sequence + * is empty. Document modification does not invalidate the value, but may mean + * that the result no longer corresponds to the current document. This is a + * convenience that permits optimization since the implementation can stop once + * the first item in the resulting sequence has been found. If there is more + * than one item in the actual result, the single item returned might not be + * the first in document order. + *

ITERATOR_RESULT_TYPE + *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed + * iteratively. Document modification invalidates the iteration. + *

SNAPSHOT_RESULT_TYPE + *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed + * as a snapshot list of values. Document modification does not invalidate the + * snapshot but may mean that reevaluation would not yield the same snapshot + * and any items in the snapshot may have been altered, moved, or removed from + * the document. + */ + enum ResultType { + /* XPath 1.0 */ + ANY_TYPE = 0, + NUMBER_TYPE = 1, + STRING_TYPE = 2, + BOOLEAN_TYPE = 3, + UNORDERED_NODE_ITERATOR_TYPE = 4, + ORDERED_NODE_ITERATOR_TYPE = 5, + UNORDERED_NODE_SNAPSHOT_TYPE = 6, + ORDERED_NODE_SNAPSHOT_TYPE = 7, + ANY_UNORDERED_NODE_TYPE = 8, + FIRST_ORDERED_NODE_TYPE = 9, + /* XPath 2.0 */ + FIRST_RESULT_TYPE = 100, + ITERATOR_RESULT_TYPE = 101, + SNAPSHOT_RESULT_TYPE = 102 + }; + //@} + + + // ----------------------------------------------------------------------- + // Virtual DOMXPathResult interface + // ----------------------------------------------------------------------- + /** @name Functions introduced in DOM Level 3 */ + //@{ + + /** + * Returns the result type of this result + * @return ResultType + * A code representing the type of this result, as defined by the type constants. + */ + virtual ResultType getResultType() const = 0; + + /** + * Returns the DOM type info of the current result node or value + * (XPath 2 only). + * @return typeInfo of type TypeInfo, readonly + */ + virtual const DOMTypeInfo *getTypeInfo() const = 0; + + /** + * Returns true if the result has a current result and the value is a + * node (XPath 2 only). This function is necessary to distinguish + * between a string value and a node of type string as returned by + * the getTypeInfo() function. + * @return isNode of type boolean, readonly + */ + virtual bool isNode() const = 0; + + /** + * Returns the boolean value of this result + * @return booleanValue of type boolean + * The value of this boolean result. + * @exception DOMXPathException + * TYPE_ERR: raised if ResultType is not BOOLEAN_TYPE (XPath 1.0) or + * if current result cannot be properly converted to boolean (XPath 2.0). + *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). + */ + virtual bool getBooleanValue() const = 0; + + /** + * Returns the integer value of this result (XPath 2 only). + * @return integerValue of type int + * The value of this integer result. + * @exception DOMXPathException + * TYPE_ERR: raised if current result cannot be properly converted to + * int (XPath 2.0). + *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). + */ + virtual int getIntegerValue() const = 0; + + /** + * Returns the number value of this result + * @return numberValue + * The value of this number result. If the native double type of the DOM + * binding does not directly support the exact IEEE 754 result of the XPath + * expression, then it is up to the definition of the binding to specify how + * the XPath number is converted to the native binding number. + * @exception DOMXPathException + * TYPE_ERR: raised if ResultType is not NUMBER_TYPE (XPath 1.0) or + * if current result cannot be properly converted to double (XPath 2.0). + *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). + */ + virtual double getNumberValue() const = 0; + + /** + * Returns the string value of this result + * @return stringValue + * The value of this string result. + * @exception DOMXPathException + * TYPE_ERR: raised if ResultType is not STRING_TYPE (XPath 1.0) or + * if current result cannot be properly converted to string (XPath 2.0). + *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). + */ + virtual const XMLCh* getStringValue() const = 0; + + /** + * Returns the node value of this result + * @return nodeValue + * The value of this node result, which may be null. + * @exception DOMXPathException + * TYPE_ERR: raised if ResultType is not ANY_UNORDERED_NODE_TYPE, + * FIRST_ORDERED_NODE_TYPE, UNORDERED_NODE_ITERATOR_TYPE, + * ORDERED_NODE_ITERATOR_TYPE, UNORDERED_NODE_SNAPSHOT_TYPE, or + * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if current result is + * not a node (XPath 2.0). + *
+ * NO_RESULT_ERROR: raised if there is no current result in the result + * object. + */ + virtual DOMNode* getNodeValue() const = 0; + + /** + * Iterates and returns true if the current result is the next item from the + * sequence or false if there are no more items. + * @return boolean True if the current result is the next item from the sequence + * or false if there are no more items. + * @exception XPathException + * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or + * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not + * ITERATOR_RESULT_TYPE (XPath 2.0). + * @exception DOMException + * INVALID_STATE_ERR: The document has been mutated since the result was returned. + */ + virtual bool iterateNext() = 0; + + /** + * Signifies that the iterator has become invalid. + * @return invalidIteratorState + * True if ResultType is UNORDERED_NODE_ITERATOR_TYPE or + * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or ITERATOR_RESULT_TYPE (XPath 2.0) + * and the document has been modified since this result was returned. + * @exception XPathException + * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or + * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not + * ITERATOR_RESULT_TYPE (XPath 2.0). + */ + virtual bool getInvalidIteratorState() const = 0; + + /** + * Sets the current result to the indexth item in the snapshot collection. If + * index is greater than or equal to the number of items in the list, this method + * returns false. Unlike the iterator result, the snapshot does not become + * invalid, but may not correspond to the current document if it is mutated. + * @param index of type XMLSize_t - Index into the snapshot collection. + * @return boolean True if the current result is the next item from the sequence + * or false if there are no more items. + * @exception XPathException + * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or + * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not + * SNAPSHOT_RESULT_TYPE (XPath 2.0). + */ + virtual bool snapshotItem(XMLSize_t index) = 0; + + /** + * The number of items in the result snapshot. Valid values for snapshotItem + * indices are 0 to snapshotLength-1 inclusive. + * @return snapshotLength of type XMLSize_t + * @exception XPathException + * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or + * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not + * SNAPSHOT_RESULT_TYPE (XPath 2.0). + */ + virtual XMLSize_t getSnapshotLength() const = 0; + + //@} + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + /** + * Called to indicate that this DOMXPathResult is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + virtual void release() = 0; + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/StDOMNode.hpp b/project/jni/xerces/src/xercesc/dom/StDOMNode.hpp new file mode 100644 index 000000000..c28248a2b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/StDOMNode.hpp @@ -0,0 +1,95 @@ +/* + * 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: StDOMNode.hpp 570480 2007-08-28 16:36:34Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_STDOMNODE_HPP) +#define XERCESC_INCLUDE_GUARD_STDOMNODE_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* This class is a smart pointer implementation over DOMNode interface and +** classes derived from it. It takes care of reference counting automatically. +** Reference counting is optional so use of this class is experimental. +*/ +template class StDOMNode { + T* m_node; + + static inline void INCREFCOUNT(T *x) { if (x != (T*)0) x->incRefCount(); } + static inline void DECREFCOUNT(T *x) { if (x != (T*)0) x->decRefCount(); } + +public: + inline StDOMNode(T* node = (T*)0) : m_node(node) { INCREFCOUNT(m_node); } + inline StDOMNode(const StDOMNode& stNode) : m_node(stNode.m_node) { INCREFCOUNT(m_node); } + inline ~StDOMNode() { DECREFCOUNT(m_node); } + + inline T* operator= (T *node) + { + if (m_node != node) { + DECREFCOUNT(m_node); + m_node = node; + INCREFCOUNT(m_node); + } + return (m_node); + } + + inline bool operator!= (T* node) const { return (m_node != node); } + inline bool operator== (T* node) const { return (m_node == node); } + + inline T& operator* () { return (*m_node); } + inline const T& operator* () const { return (*m_node); } + inline T* operator-> () const { return (m_node); } + inline operator T*() const { return (m_node); } + inline void ClearNode() { operator=((T*)(0)); } +}; + +#if defined(XML_DOMREFCOUNT_EXPERIMENTAL) + typedef StDOMNode DOMNodeSPtr; +#else + typedef DOMNode* DOMNodeSPtr; +#endif + +/* StDOMNode is a smart pointer implementation over DOMNode interface and +** classes derived from it. It takes care of reference counting automatically. +** Reference counting is optional so use of this class is experimental. +*/ +#if defined(XML_DOMREFCOUNT_EXPERIMENTAL) + typedef StDOMNode DOMAttrSPtr; +#else + typedef DOMAttr* DOMAttrSPtr; +#endif + +/* StDOMNode is a smart pointer implementation over DOMNode interface and +** classes derived from it. It takes care of reference counting automatically. +** Reference counting is optional so use of this class is experimental. +*/ +#if defined(XML_DOMREFCOUNT_EXPERIMENTAL) + typedef StDOMNode DOMElementSPtr; +#else + typedef DOMElement* DOMElementSPtr; +#endif + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.cpp new file mode 100644 index 000000000..7bd14094c --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.cpp @@ -0,0 +1,362 @@ +/* + * 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: DOMAttrImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include +#include + +#include "DOMAttrImpl.hpp" +#include "DOMStringPool.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMTypeInfoImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMAttrImpl::DOMAttrImpl(DOMDocument *ownerDoc, const XMLCh *aName) + : fNode(ownerDoc), fParent (ownerDoc), fSchemaType(0) +{ + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc; + fName = docImpl->getPooledString(aName); + fNode.isSpecified(true); +} + +DOMAttrImpl::DOMAttrImpl(const DOMAttrImpl &other, bool /*deep*/) + : DOMAttr(other) + , fNode(other.fNode) + , fParent (other.fParent) + , fName(other.fName) + , fSchemaType(other.fSchemaType) +{ + if (other.fNode.isSpecified()) + fNode.isSpecified(true); + else + fNode.isSpecified(false); + + if (other.fNode.isIdAttr()) + { + fNode.isIdAttr(true); + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + doc->getNodeIDMap()->add(this); + } + + fParent.cloneChildren(&other); +} + + +DOMAttrImpl::~DOMAttrImpl() { +} + + +DOMNode * DOMAttrImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (fParent.fOwnerDocument, DOMDocumentImpl::ATTR_OBJECT) DOMAttrImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMAttrImpl::getNodeName() const{ + return fName; +} + +DOMNode::NodeType DOMAttrImpl::getNodeType() const { + return DOMNode::ATTRIBUTE_NODE; +} + + +const XMLCh * DOMAttrImpl::getName() const { + return fName; +} + + +const XMLCh * DOMAttrImpl::getNodeValue() const +{ + return getValue(); +} + + +bool DOMAttrImpl::getSpecified() const +{ + return fNode.isSpecified(); +} + + + + +const XMLCh * DOMAttrImpl::getValue() const +{ + if (fParent.fFirstChild == 0) { + return XMLUni::fgZeroLenString; // return ""; + } + + // Simple case where attribute value is just a single text node + DOMNode *node = castToChildImpl(fParent.fFirstChild)->nextSibling; + if (node == 0 && fParent.fFirstChild->getNodeType() == DOMNode::TEXT_NODE) { + return fParent.fFirstChild->getNodeValue(); + } + + // + // Complicated case where attribute value is a DOM tree + // + // According to the spec, the child nodes of the Attr node may be either + // Text or EntityReference nodes. + // + // The parser will not create such thing, this is for those created by users. + // + // In such case, we have to visit each child to retrieve the text + // + + DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument; + + XMLBuffer buf(1023, doc->getMemoryManager()); + for (node = fParent.fFirstChild; node != 0; node = castToChildImpl(node)->nextSibling) + getTextValue(node, buf); + + return doc->getPooledString(buf.getRawBuffer()); +} + +void DOMAttrImpl::getTextValue(DOMNode* node, XMLBuffer& buf) const +{ + if (node->getNodeType() == DOMNode::TEXT_NODE) + buf.append(node->getNodeValue()); + else if (node->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) + { + for (node = node->getFirstChild(); node != 0; node = castToChildImpl(node)->nextSibling) + { + getTextValue(node, buf); + } + } + + return; +} + + +void DOMAttrImpl::setNodeValue(const XMLCh *val) +{ + setValue(val); +} + + + +void DOMAttrImpl::setSpecified(bool arg) +{ + fNode.isSpecified(arg); +} + + + +void DOMAttrImpl::setValue(const XMLCh *val) +{ + if (fNode.isReadOnly()) + { + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + + // If this attribute was of type ID and in the map, take it out, + // then put it back in with the new name. For now, we don't worry + // about what happens if the new name conflicts + // + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + if (fNode.isIdAttr()) + doc->getNodeIDMap()->remove(this); + + DOMNode *kid; + while ((kid = fParent.fFirstChild) != 0) // Remove existing kids + { + DOMNode* node = removeChild(kid); + if (node) + node->release(); + } + + if (val != 0) // Create and add the new one + fParent.appendChildFast(doc->createTextNode(val)); + fNode.isSpecified(true); + fParent.changed(); + + if (fNode.isIdAttr()) + doc->getNodeIDMap()->add(this); + +} + +void DOMAttrImpl::setValueFast(const XMLCh *val) +{ + if (val != 0) + fParent.appendChildFast(fParent.fOwnerDocument->createTextNode(val)); + + fNode.isSpecified (true); +} + + + +//Introduced in DOM Level 2 + +DOMElement *DOMAttrImpl::getOwnerElement() const +{ + // if we have an owner, ownerNode is our ownerElement, otherwise it's + // our ownerDocument and we don't have an ownerElement + return (DOMElement *) (fNode.isOwned() ? fNode.fOwnerNode : 0); +} + + +//internal use by parser only +void DOMAttrImpl::setOwnerElement(DOMElement *ownerElem) +{ + fNode.fOwnerNode = ownerElem; + // revisit. Is this backwards? isOwned(true)? + fNode.isOwned(false); +} + + +//For DOM Level 3 + +void DOMAttrImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::ATTR_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + + +bool DOMAttrImpl::isId() const { + return fNode.isIdAttr(); +} + + +DOMNode* DOMAttrImpl::rename(const XMLCh* namespaceURI, const XMLCh* name) +{ + DOMElement* el = getOwnerElement(); + DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument; + + if (el) + el->removeAttributeNode(this); + + if (!namespaceURI || !*namespaceURI) { + fName = doc->getPooledString(name); + + if (el) + el->setAttributeNode(this); + + // and fire user data NODE_RENAMED event + castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this); + + return this; + } + else { + + // create a new AttrNS + DOMAttr* newAttr = doc->createAttributeNS(namespaceURI, name); + + // transfer the userData + doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newAttr)); + + // move children to new node + DOMNode* child = getFirstChild(); + while (child) { + removeChild(child); + newAttr->appendChild(child); + child = getFirstChild(); + } + + // reattach attr to element + if (el) + el->setAttributeNodeNS(newAttr); + + // and fire user data NODE_RENAMED event + castToNodeImpl(newAttr)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newAttr); + + return newAttr; + } +} + +const DOMTypeInfo *DOMAttrImpl::getSchemaTypeInfo() const +{ + if(!fSchemaType) + return &DOMTypeInfoImpl::g_DtdNotValidatedAttribute; + + return fSchemaType; +} + + +void DOMAttrImpl::setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo) +{ + fSchemaType = typeInfo; +} + +bool DOMAttrImpl::isSupported(const XMLCh *feature, const XMLCh *version) const +{ + // check for '+DOMPSVITypeInfo' + if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfacePSVITypeInfo)) + return true; + return fNode.isSupported (feature, version); +} + +void* DOMAttrImpl::getFeature(const XMLCh* feature, const XMLCh* version) const +{ + if(XMLString::equals(feature, XMLUni::fgXercescInterfacePSVITypeInfo)) + return (DOMPSVITypeInfo*)fSchemaType; + return fNode.getFeature(feature, version); +} + + DOMNode* DOMAttrImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } + DOMNamedNodeMap* DOMAttrImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMAttrImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMAttrImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMAttrImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMAttrImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMAttrImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMAttrImpl::getNextSibling() const {return fNode.getNextSibling (); } + DOMDocument* DOMAttrImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMAttrImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMAttrImpl::getParentNode() const {return fNode.getParentNode (); } + DOMNode* DOMAttrImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } + bool DOMAttrImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + DOMNode* DOMAttrImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); } + void DOMAttrImpl::normalize() {fParent.normalize (); } + DOMNode* DOMAttrImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } + DOMNode* DOMAttrImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); } + void DOMAttrImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMAttrImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMAttrImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMAttrImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); } + void* DOMAttrImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMAttrImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMAttrImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMAttrImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMAttrImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMAttrImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMAttrImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMAttrImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMAttrImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.hpp new file mode 100644 index 000000000..e4fc0fa3d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrImpl.hpp @@ -0,0 +1,137 @@ +/* + * 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: DOMAttrImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include +#include "DOMParentNode.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include +#include +#include "DOMNodeIDMap.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElementImpl; +class DOMTypeInfoImpl; + +class CDOM_EXPORT DOMAttrImpl: public DOMAttr { + +public: + DOMNodeImpl fNode; + DOMParentNode fParent; + const XMLCh *fName; + +protected: + const DOMTypeInfoImpl *fSchemaType; + +public: + DOMAttrImpl(DOMDocument *ownerDocument, const XMLCh *aName); + DOMAttrImpl(const DOMAttrImpl &other, bool deep=false); + virtual ~DOMAttrImpl(); + +public: + // Add all functions that are pure virtual in DOMNODE + DOMNODE_FUNCTIONS; + +public: + virtual const XMLCh * getName() const; + virtual bool getSpecified() const; + virtual const XMLCh * getValue() const; + virtual void setSpecified(bool arg); + virtual void setValue(const XMLCh * value); + virtual DOMElement * getOwnerElement() const; + virtual bool isId() const; + virtual const DOMTypeInfo* getSchemaTypeInfo() const; + + void setOwnerElement(DOMElement *ownerElem); //internal use only + + // helper function for DOM Level 3 renameNode + virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name); + + //helper function for DOM Level 3 TypeInfo + virtual void setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo); + + // helper method that sets this attr to an idnode and places it into the document map + virtual void addAttrToIDNodeMap(); + + // helper to remove this attr from from the id map if it is in there + virtual void removeAttrFromIDNodeMap(); + +public: + // Set attribute value fast. Assumptions: + // + // - node is not read-only + // - no ID management is performed + // - this attribute does not have a value + // + virtual void setValueFast (const XMLCh * value); + +protected: + void getTextValue(DOMNode* node, XMLBuffer& buf) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMAttrImpl& operator=(const DOMAttrImpl&); +}; + +inline void DOMAttrImpl::removeAttrFromIDNodeMap() +{ + if (fNode.isIdAttr()) { + ((DOMDocumentImpl *)fParent.fOwnerDocument)->getNodeIDMap()->remove(this); + fNode.isIdAttr(false); + } +} + +inline void DOMAttrImpl::addAttrToIDNodeMap() +{ + if (fNode.isIdAttr()) + return; + + fNode.isIdAttr(true); + + // REVIST For now, we don't worry about what happens if the new + // name conflicts as per setValue + DOMDocumentImpl *doc = (DOMDocumentImpl *)(fParent.fOwnerDocument); + + if (doc->fNodeIDMap == 0) + doc->fNodeIDMap = new (doc) DOMNodeIDMap(500, doc); + + doc->getNodeIDMap()->add(this); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.cpp new file mode 100644 index 000000000..6ae5e515e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.cpp @@ -0,0 +1,494 @@ +/* + * 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: DOMAttrMapImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include "DOMCasts.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMNodeVector.hpp" +#include "DOMAttrMapImpl.hpp" +#include "DOMAttrImpl.hpp" +#include "DOMElementImpl.hpp" + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod) +{ + this->fOwnerNode=ownerNod; + this->fNodes = 0; + hasDefaults(false); +} + +DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults) +{ + this->fOwnerNode=ownerNod; + this->fNodes = 0; + hasDefaults(false); + if (defaults != 0) + { + if (defaults->getLength() > 0) + { + hasDefaults(true); + cloneContent(defaults); + } + } +} + +DOMAttrMapImpl::~DOMAttrMapImpl() +{ +} + +void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap) +{ + if ((srcmap != 0) && (srcmap->fNodes != 0)) + { + if (fNodes != 0) + fNodes->reset(); + else + { + XMLSize_t size = srcmap->fNodes->size(); + if(size > 0) { + DOMDocumentImpl *doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument(); + fNodes = new (doc) DOMNodeVector(doc, size); + } + } + + for (XMLSize_t i = 0; i < srcmap->fNodes->size(); i++) + { + DOMNode *n = srcmap->fNodes->elementAt(i); + DOMNode *clone = n->cloneNode(true); + castToNodeImpl(clone)->isSpecified(castToNodeImpl(n)->isSpecified()); + castToNodeImpl(clone)->fOwnerNode = fOwnerNode; + castToNodeImpl(clone)->isOwned(true); + fNodes->addElement(clone); + } + } +} + +DOMAttrMapImpl *DOMAttrMapImpl::cloneAttrMap(DOMNode *ownerNode_p) +{ + DOMAttrMapImpl *newmap = new (castToNodeImpl(ownerNode_p)->getOwnerDocument()) DOMAttrMapImpl(ownerNode_p); + newmap->cloneContent(this); + // newmap->attrDefaults = this->attrDefaults; // revisit + return newmap; +} + +void DOMAttrMapImpl::setReadOnly(bool readOnl, bool deep) +{ + // this->fReadOnly=readOnl; + if(deep && fNodes!=0) + { + XMLSize_t sz = fNodes->size(); + for (XMLSize_t i=0; ielementAt(i))->setReadOnly(readOnl, deep); + } + } +} + +bool DOMAttrMapImpl::readOnly() { + return castToNodeImpl(fOwnerNode)->isReadOnly(); +} + +int DOMAttrMapImpl::findNamePoint(const XMLCh *name) const +{ + // Binary search + int i=0; + if(fNodes!=0) + { + int first=0,last=(int)fNodes->size()-1; + + while(first<=last) + { + i=(first+last)/2; + int test = XMLString::compareString(name, fNodes->elementAt(i)->getNodeName()); + if(test==0) + return i; // Name found + else if(test<0) + last=i-1; + else + first=i+1; + } + if(first>i) i=first; + } + /******************** + // Linear search + int i = 0; + if (fNodes != 0) + for (i = 0; i < fNodes.size(); ++i) + { + int test = name.compareTo(((NodeImpl *) (fNodes.elementAt(i))).getNodeName()); + if (test == 0) + return i; + else + if (test < 0) + { + break; // Found insertpoint + } + } + + *******************/ + return -1 - i; // not-found has to be encoded. +} + +DOMNode * DOMAttrMapImpl::getNamedItem(const XMLCh *name) const +{ + int i=findNamePoint(name); + return (i<0) ? 0 : fNodes->elementAt(i); +} + +DOMNode *DOMAttrMapImpl::setNamedItem(DOMNode *arg) +{ + if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + DOMNodeImpl *argImpl = castToNodeImpl(arg); + if(argImpl->getOwnerDocument() != doc) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNamedNodeMapMemoryManager); + if (this->readOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode)) + throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + int i=findNamePoint(arg->getNodeName()); + DOMNode * previous=0; + if(i>=0) + { + previous = fNodes->elementAt(i); + fNodes->setElementAt(arg,i); + } + else + { + i=-1-i; // Insert point (may be end of list) + if(0==fNodes) + { + fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc); + } + fNodes->insertElementAt(arg,i); + } + if (previous != 0) { + castToNodeImpl(previous)->fOwnerNode = doc; + castToNodeImpl(previous)->isOwned(false); + } + + return previous; +} + +//Introduced in DOM Level 2 + +int DOMAttrMapImpl::findNamePoint(const XMLCh *namespaceURI, + const XMLCh *localName) const +{ + if (fNodes == 0) + return -1; + // This is a linear search through the same fNodes Vector. + // The Vector is sorted on the DOM Level 1 nodename. + // The DOM Level 2 NS keys are namespaceURI and Localname, + // so we must linear search thru it. + // In addition, to get this to work with fNodes without any namespace + // (namespaceURI and localNames are both 0) we then use the nodeName + // as a secondary key. + const XMLSize_t len = fNodes -> size(); + for (XMLSize_t i = 0; i < len; ++i) { + DOMNode *node = fNodes -> elementAt(i); + const XMLCh * nNamespaceURI = node->getNamespaceURI(); + const XMLCh * nLocalName = node->getLocalName(); + if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match + continue; + else { + if (XMLString::equals(localName, nLocalName) + || + (nLocalName == 0 && XMLString::equals(localName, node->getNodeName()))) + return (int)i; + } + } + return -1; //not found +} + +DOMNode *DOMAttrMapImpl::getNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) const +{ + int i = findNamePoint(namespaceURI, localName); + return i < 0 ? 0 : fNodes -> elementAt(i); +} + +DOMNode *DOMAttrMapImpl::setNamedItemNS(DOMNode* arg) +{ + if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + DOMNodeImpl *argImpl = castToNodeImpl(arg); + if (argImpl->getOwnerDocument() != doc) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager); + if (this->readOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + if (argImpl->isOwned()) + throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName()); + DOMNode *previous=0; + if(i>=0) { + previous = fNodes->elementAt(i); + fNodes->setElementAt(arg,i); + } else { + i=findNamePoint(arg->getNodeName()); // Insert point (may be end of list) + if (i<0) + i = -1 - i; + if(0==fNodes) + fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc); + fNodes->insertElementAt(arg,i); + } + if (previous != 0) { + castToNodeImpl(previous)->fOwnerNode = doc; + castToNodeImpl(previous)->isOwned(false); + } + + return previous; +} + +DOMNode *DOMAttrMapImpl::removeNamedItem(const XMLCh *name) +{ + if (this->readOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + int i=findNamePoint(name); + DOMNode *removed = 0; + + if(i<0) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + removed = fNodes->elementAt(i); + fNodes->removeElementAt(i); + castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument(); + castToNodeImpl(removed)->isOwned(false); + + // Replace it if it had a default value + // (DOM spec level 1 - Element Interface) + if (hasDefaults() && (removed != 0)) + { + DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes(); + DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItem(name)); + if (attr != 0) + { + DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true); + setNamedItem(newAttr); + } + } + + return removed; +} + +DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName) +{ + if (this->readOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + int i = findNamePoint(namespaceURI, localName); + if (i < 0) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + DOMNode * removed = fNodes -> elementAt(i); + fNodes -> removeElementAt(i); //remove n from nodes + castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument(); + castToNodeImpl(removed)->isOwned(false); + + // Replace it if it had a default value + // (DOM spec level 2 - Element Interface) + + if (hasDefaults() && (removed != 0)) + { + DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes(); + DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItemNS(namespaceURI, localName)); + if (attr != 0) + { + DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true); + setNamedItemNS(newAttr); + } + } + + return removed; +} + +// remove the name using index +// avoid calling findNamePoint again if the index is already known +DOMNode * DOMAttrMapImpl::removeNamedItemAt(XMLSize_t index) +{ + if (this->readOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + DOMNode *removed = item(index); + if(!removed) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + fNodes->removeElementAt(index); + castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument(); + castToNodeImpl(removed)->isOwned(false); + + // Replace it if it had a default value + // (DOM spec level 1 - Element Interface) + if (hasDefaults() && (removed != 0)) + { + DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes(); + + const XMLCh* localName = removed->getLocalName(); + DOMAttr* attr = 0; + if (localName) + attr = (DOMAttr*)(defAttrs->getNamedItemNS(removed->getNamespaceURI(), localName)); + else + attr = (DOMAttr*)(defAttrs->getNamedItem(((DOMAttr*)removed)->getName())); + + if (attr != 0) + { + DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true); + setNamedItem(newAttr); + } + } + + return removed; +} + +/** + * Get this AttributeMap in sync with the given "defaults" map. + * @param defaults The default attributes map to sync with. + */ +void DOMAttrMapImpl::reconcileDefaultAttributes(const DOMAttrMapImpl* defaults) { + + // remove any existing default + XMLSize_t nsize = getLength(); + for (XMLSize_t i = nsize; i > 0; i--) { + DOMAttr* attr = (DOMAttr*)item(i-1); + if (!attr->getSpecified()) { + removeNamedItemAt(i-1); + } + } + + hasDefaults(false); + + // add the new defaults + if (defaults) { + hasDefaults(true); + + if (nsize == 0) { + cloneContent(defaults); + } + else { + XMLSize_t dsize = defaults->getLength(); + for (XMLSize_t n = 0; n < dsize; n++) { + DOMAttr* attr = (DOMAttr*)defaults->item(n); + + DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true); + setNamedItemNS(newAttr); + DOMAttrImpl* newAttrImpl = (DOMAttrImpl*) newAttr; + newAttrImpl->setSpecified(false); + } + } + } +} // reconcileDefaults() + + +/** + * Move specified attributes from the given map to this one + */ +void DOMAttrMapImpl::moveSpecifiedAttributes(DOMAttrMapImpl* srcmap) { + XMLSize_t nsize = srcmap->getLength(); + + for (XMLSize_t i = nsize; i > 0; i--) { + DOMAttr* attr = (DOMAttr*)srcmap->item(i-1); + if (attr->getSpecified()) { + srcmap->removeNamedItemAt(i-1); + } + + if (attr->getLocalName()) + setNamedItemNS(attr); + else + setNamedItem(attr); + } +} // moveSpecifiedAttributes(AttributeMap):void + +XMLSize_t DOMAttrMapImpl::getLength() const +{ + return (fNodes != 0) ? fNodes->size() : 0; +} + +DOMNode * DOMAttrMapImpl::item(XMLSize_t index) const +{ + return (fNodes != 0 && index < fNodes->size()) ? + fNodes->elementAt(index) : 0; +} + +void DOMAttrMapImpl::setNamedItemFast(DOMNode *arg) +{ + DOMNodeImpl *argImpl = castToNodeImpl(arg); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + int i = findNamePoint(arg->getNodeName()); + + if(i >= 0) + fNodes->setElementAt(arg, i); + else + { + i= -1 -i; + fNodes->insertElementAt(arg, i); + } +} + +void DOMAttrMapImpl::setNamedItemNSFast(DOMNode* arg) +{ + DOMNodeImpl *argImpl = castToNodeImpl(arg); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName()); + + if(i >= 0) + { + fNodes->setElementAt(arg,i); + } + else + { + i = findNamePoint(arg->getNodeName()); + + if (i < 0) + i = -1 - i; + + fNodes->insertElementAt(arg,i); + } +} + +void DOMAttrMapImpl::reserve (XMLSize_t n) +{ + if (fNodes == 0) + { + DOMDocumentImpl* doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument(); + fNodes = new (doc) DOMNodeVector(doc, n); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.hpp new file mode 100644 index 000000000..2d2254314 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrMapImpl.hpp @@ -0,0 +1,125 @@ +/* + * 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: DOMAttrMapImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMNode; +class DOMNodeVector; + +class CDOM_EXPORT DOMAttrMapImpl : public DOMNamedNodeMap +{ +protected: + DOMNodeVector* fNodes; + DOMNode* fOwnerNode; // the node this map belongs to + bool attrDefaults; + + virtual void cloneContent(const DOMAttrMapImpl *srcmap); + + bool readOnly(); // revisit. Look at owner node read-only. + +public: + DOMAttrMapImpl(DOMNode *ownerNod); + + // revisit. This "copy" constructor is used for cloning an Element with Attributes, + // and for setting up default attributes. It's probably not right + // for one or the other or both. + DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults); + DOMAttrMapImpl(); + + virtual ~DOMAttrMapImpl(); + virtual DOMAttrMapImpl *cloneAttrMap(DOMNode *ownerNode); + virtual bool hasDefaults(); + virtual void hasDefaults(bool value); + virtual int findNamePoint(const XMLCh *name) const; + virtual int findNamePoint(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual DOMNode* removeNamedItemAt(XMLSize_t index); + virtual void setReadOnly(bool readOnly, bool deep); + + + virtual XMLSize_t getLength() const; + virtual DOMNode* item(XMLSize_t index) const; + + virtual DOMNode* getNamedItem(const XMLCh *name) const; + virtual DOMNode* setNamedItem(DOMNode *arg); + virtual DOMNode* removeNamedItem(const XMLCh *name); + + virtual DOMNode* getNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual DOMNode* setNamedItemNS(DOMNode *arg); + virtual DOMNode* removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName); + + // Fast versions of the above functions which bypass validity checks. + // It also assumes that fNode is not 0 (call reserve) and that there + // is no previous node with this name. These are used in parsing. + // + void setNamedItemFast(DOMNode *arg); + void setNamedItemNSFast(DOMNode *arg); + + // Tries to reserve space for the specified number of elements. + // Currently only works on newly-created instances (fNodes == 0). + // + void reserve (XMLSize_t); + + void reconcileDefaultAttributes(const DOMAttrMapImpl* defaults); + void moveSpecifiedAttributes(DOMAttrMapImpl* srcmap); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMAttrMapImpl(const DOMAttrMapImpl &); + DOMAttrMapImpl & operator = (const DOMAttrMapImpl &); +}; + +// --------------------------------------------------------------------------- +// DOMAttrMapImpl: Getters & Setters +// --------------------------------------------------------------------------- + +inline bool DOMAttrMapImpl::hasDefaults() +{ + return attrDefaults; +} + +inline void DOMAttrMapImpl::hasDefaults(bool value) +{ + attrDefaults = value; +} + +XERCES_CPP_NAMESPACE_END + + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.cpp new file mode 100644 index 000000000..4402d0d6d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.cpp @@ -0,0 +1,247 @@ +/* + * 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: DOMAttrNSImpl.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#include +#include "DOMAttrNSImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include +#include +#include + +#include "assert.h" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) : +DOMAttrImpl(ownerDoc, nam) +{ + this->fNamespaceURI=0; //DOM Level 2 + this->fLocalName=0; //DOM Level 2 + this->fPrefix=0; +} + +//Introduced in DOM Level 2 +DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *qualifiedName) : +DOMAttrImpl(ownerDoc, qualifiedName) +{ + setName(namespaceURI, qualifiedName); +} + +DOMAttrNSImpl:: +DOMAttrNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *prefix, + const XMLCh *localName, + const XMLCh *qualifiedName) + : DOMAttrImpl(ownerDoc, qualifiedName) +{ + DOMDocumentImpl* docImpl = (DOMDocumentImpl*)fParent.fOwnerDocument; + + if (prefix == 0 || *prefix == 0) + { + fPrefix = 0; + fLocalName = fName; + } + else + { + fPrefix = docImpl->getPooledString(prefix); + fLocalName = docImpl->getPooledString(localName); + } + + // DOM Level 3: namespace URI is never empty string. + // + const XMLCh * URI = DOMNodeImpl::mapPrefix + ( + fPrefix, + (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI, + DOMNode::ATTRIBUTE_NODE + ); + this -> fNamespaceURI = (URI == 0) ? 0 : docImpl->getPooledString(URI); +} + +DOMAttrNSImpl::DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep) : +DOMAttrImpl(other, deep) +{ + this->fNamespaceURI = other.fNamespaceURI; //DOM Level 2 + this->fLocalName = other.fLocalName; //DOM Level 2 + this->fPrefix = other.fPrefix; +} + +DOMNode * DOMAttrNSImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ATTR_NS_OBJECT) DOMAttrNSImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + +const XMLCh * DOMAttrNSImpl::getNamespaceURI() const +{ + return fNamespaceURI; +} + +const XMLCh * DOMAttrNSImpl::getPrefix() const +{ + return fPrefix; +} + +const XMLCh * DOMAttrNSImpl::getLocalName() const +{ + return fLocalName; +} + +void DOMAttrNSImpl::setPrefix(const XMLCh *prefix) +{ + const XMLCh * xmlns = DOMNodeImpl::getXmlnsString(); + + if (fNode.isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || XMLString::equals(fLocalName, xmlns)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + if (prefix == 0 || prefix[0] == chNull) { + fName = fLocalName; + fPrefix = 0; + return; + } + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + + if (!doc->isXMLName(prefix)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager); + + const XMLCh * xml = DOMNodeImpl::getXmlString(); + const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString(); + const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString(); + + if ((XMLString::equals(prefix, xml) && + !XMLString::equals(fNamespaceURI, xmlURI)) + || (XMLString::equals(prefix, xmlns) && + !XMLString::equals(fNamespaceURI, xmlnsURI))) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + if (XMLString::indexOf(prefix, chColon) != -1) { + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + + this-> fPrefix = doc->getPooledString(prefix); + + XMLSize_t prefixLen = XMLString::stringLen(prefix); + XMLSize_t newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName); + XMLCh* newName; + XMLCh temp[256]; + if (newQualifiedNameLen >= 255) + newName = (XMLCh*) doc->getMemoryManager()->allocate + ( + newQualifiedNameLen * sizeof(XMLCh) + );//new XMLCh[newQualifiedNameLen]; + else + newName = temp; + + // newName = prefix + chColon + fLocalName; + XMLString::copyString(newName, prefix); + newName[prefixLen] = chColon; + XMLString::copyString(&newName[prefixLen+1], fLocalName); + + fName = doc->getPooledString(newName); + + if (newQualifiedNameLen >= 255) + doc->getMemoryManager()->deallocate(newName);//delete[] newName; + +} + +void DOMAttrNSImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::ATTR_NS_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + + +DOMNode* DOMAttrNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name) +{ + DOMElement* el = getOwnerElement(); + if (el) + el->removeAttributeNode(this); + + setName(namespaceURI, name); + + if (el) + el->setAttributeNodeNS(this); + + return this; +} + +void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedName) +{ + DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *)fParent.fOwnerDocument; + const XMLCh * xmlns = DOMNodeImpl::getXmlnsString(); + const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString(); + this->fName = ownerDoc->getPooledString(qualifiedName); + + int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName); + if (index < 0) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + bool xmlnsAlone = false; //true if attribute name is "xmlns" + if (index == 0) + { //qualifiedName contains no ':' + if (XMLString::equals(this->fName, xmlns)) { + if (!XMLString::equals(namespaceURI, xmlnsURI)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + xmlnsAlone = true; + } + fPrefix = 0; + fLocalName = fName; + } + else + { + fPrefix = ownerDoc->getPooledNString(fName, index); + fLocalName = ownerDoc->getPooledString(fName+index+1); + + // Before we carry on, we should check if the prefix or localName are valid XMLName + if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + + // DOM Level 3: namespace URI is never empty string. + const XMLCh * URI = xmlnsAlone ? xmlnsURI + : DOMNodeImpl::mapPrefix + ( + fPrefix, + (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI, + DOMNode::ATTRIBUTE_NODE + ); + this -> fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.hpp new file mode 100644 index 000000000..64470e612 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMAttrNSImpl.hpp @@ -0,0 +1,85 @@ +/* + * 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: DOMAttrNSImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include "DOMAttrImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMAttrNSImpl: public DOMAttrImpl { +protected: + //Introduced in DOM Level 2 + const XMLCh * fNamespaceURI; //namespace URI of this node + const XMLCh * fLocalName; //local part of qualified name + const XMLCh * fPrefix; // prefix part of qualified name + // revisit - can return local part + // by pointing into the qualified (L1) name. + +public: + DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *name); + DOMAttrNSImpl(DOMDocument *ownerDoc, //DOM Level 2 + const XMLCh *namespaceURI, const XMLCh *qualifiedName); + DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep=false); + + // Fast construction without any checks for name validity. Used in + // parsing. Note that if prefix is not specified and localName is + // 'xmlns', this constructor expects proper namespaceURI. + // + DOMAttrNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *prefix, // Null or empty - no prefix. + const XMLCh *localName, + const XMLCh *qualifiedName); + + virtual DOMNode * cloneNode(bool deep) const; + //Introduced in DOM Level 2 + virtual const XMLCh * getNamespaceURI() const; + virtual const XMLCh * getPrefix() const; + virtual const XMLCh * getLocalName() const; + virtual void setPrefix(const XMLCh *prefix); + virtual void release(); + + // helper function for DOM Level 3 renameNode + virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name); + void setName(const XMLCh* namespaceURI, const XMLCh* name); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMAttrNSImpl & operator = (const DOMAttrNSImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp new file mode 100644 index 000000000..9bf763803 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp @@ -0,0 +1,316 @@ +/* + * 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: DOMCDATASectionImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include "DOMCDATASectionImpl.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMRangeImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMStringPool.hpp" +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMCDATASectionImpl::DOMCDATASectionImpl(DOMDocument *ownerDoc, + const XMLCh *dat) + : fNode(ownerDoc), fCharacterData(ownerDoc, dat) +{ + fNode.setIsLeafNode(true); +} + +DOMCDATASectionImpl:: +DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n) + : fNode(ownerDoc), fCharacterData(ownerDoc, data, n) +{ + fNode.setIsLeafNode(true); +} + +DOMCDATASectionImpl::DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool /*deep*/) + : DOMCDATASection(other), + fNode(*castToNodeImpl(&other)), + fChild(*castToChildImpl(&other)), + fCharacterData(other.fCharacterData) +{ + // revisit. Something nees to make "deep" work. +} + + +DOMCDATASectionImpl::~DOMCDATASectionImpl() +{ +} + + +DOMNode *DOMCDATASectionImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (this->getOwnerDocument(), DOMMemoryManager::CDATA_SECTION_OBJECT) DOMCDATASectionImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMCDATASectionImpl::getNodeName() const { + static const XMLCh gcdata_section[] = {chPound, chLatin_c, chLatin_d, chLatin_a, chLatin_t, chLatin_a, + chDash, chLatin_s, chLatin_e, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, 0}; + return gcdata_section; +} + + +DOMNode::NodeType DOMCDATASectionImpl::getNodeType() const { + return DOMNode::CDATA_SECTION_NODE; +} + + +bool DOMCDATASectionImpl::isIgnorableWhitespace() const +{ + return fNode.ignorableWhitespace(); +} + + +// +// splitText. revist - factor into a common function for use +// here and in DOMTextImpl +// +DOMText *DOMCDATASectionImpl::splitText(XMLSize_t offset) +{ + if (fNode.isReadOnly()) + { + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + XMLSize_t len = fCharacterData.fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); + DOMText *newText = + doc->createCDATASection(this->substringData(offset, len - offset)); + + DOMNode *parent = getParentNode(); + if (parent != 0) + parent->insertBefore(newText, getNextSibling()); + + fCharacterData.fDataBuf->chop(offset); + + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset); + } + } + } + } + + return newText; +} + + +bool DOMCDATASectionImpl::getIsElementContentWhitespace() const +{ + return isIgnorableWhitespace(); +} + +const XMLCh* DOMCDATASectionImpl::getWholeText() const +{ + DOMDocument *doc = getOwnerDocument(); + DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true); + pWalker->setCurrentNode((DOMNode*)this); + // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in + // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) + { + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + } + XMLBuffer buff(1023, GetDOMNodeMemoryManager); + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE) + buff.append(nextNode->getNodeValue()); + } + pWalker->release(); + + XMLCh* wholeString = (XMLCh*) (GetDOMNodeMemoryManager->allocate((buff.getLen()+1)*sizeof(XMLCh))); + XMLString::copyString(wholeString, buff.getRawBuffer()); + return wholeString; +} + +DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh* newText) +{ + DOMDocument *doc = getOwnerDocument(); + DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true); + pWalker->setCurrentNode((DOMNode*)this); + // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in + // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. + DOMNode* pFirstTextNode=this; + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) + { + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + pFirstTextNode=prevNode; + } + // before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text + DOMNode* pCurrentNode=pWalker->getCurrentNode(); + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE) + { + DOMTreeWalker* pInnerWalker=doc->createTreeWalker(nextNode, DOMNodeFilter::SHOW_ALL, NULL, true); + while(pInnerWalker->nextNode()) + { + short nodeType=pInnerWalker->getCurrentNode()->getNodeType(); + if(nodeType!=ENTITY_REFERENCE_NODE && nodeType!=TEXT_NODE && nodeType!=CDATA_SECTION_NODE) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + pInnerWalker->release(); + } + } + DOMText* retVal=NULL; + // if the first node in the chain is a text node, replace its content, otherwise create a new node + if(newText && *newText) + { + if(!castToNodeImpl(pFirstTextNode)->isReadOnly() && (pFirstTextNode->getNodeType()==TEXT_NODE || pFirstTextNode->getNodeType()==CDATA_SECTION_NODE)) + { + pFirstTextNode->setNodeValue(newText); + retVal=(DOMText*)pFirstTextNode; + } + else + { + if(getNodeType()==TEXT_NODE) + retVal=doc->createTextNode(newText); + else + retVal=doc->createCDATASection(newText); + pFirstTextNode->getParentNode()->insertBefore(retVal, pFirstTextNode); + } + } + // now delete all the following text nodes + pWalker->setCurrentNode(pCurrentNode); + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode!=retVal) + { + // keep the tree walker valid + pWalker->previousNode(); + nextNode->getParentNode()->removeChild(nextNode); + nextNode->release(); + } + } + pWalker->release(); + return retVal; +} + + +void DOMCDATASectionImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fCharacterData.releaseBuffer(); + doc->release(this, DOMMemoryManager::CDATA_SECTION_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + + +// +// Delegation stubs for other DOM_Node inherited functions. +// + DOMNode* DOMCDATASectionImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } + DOMNamedNodeMap* DOMCDATASectionImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMCDATASectionImpl::getChildNodes() const {return fNode.getChildNodes (); } + DOMNode* DOMCDATASectionImpl::getFirstChild() const {return fNode.getFirstChild (); } + DOMNode* DOMCDATASectionImpl::getLastChild() const {return fNode.getLastChild (); } + const XMLCh* DOMCDATASectionImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMCDATASectionImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMCDATASectionImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMCDATASectionImpl::getNodeValue() const {return fCharacterData.getNodeValue (); } + DOMDocument* DOMCDATASectionImpl::getOwnerDocument() const {return fNode.getOwnerDocument(); } + const XMLCh* DOMCDATASectionImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMCDATASectionImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMCDATASectionImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMCDATASectionImpl::hasChildNodes() const {return fNode.hasChildNodes (); } + DOMNode* DOMCDATASectionImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fNode.insertBefore (newChild, refChild); } + void DOMCDATASectionImpl::normalize() {fNode.normalize (); } + DOMNode* DOMCDATASectionImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } + DOMNode* DOMCDATASectionImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fNode.replaceChild (newChild, oldChild); } + bool DOMCDATASectionImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMCDATASectionImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMCDATASectionImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMCDATASectionImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMCDATASectionImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } + void* DOMCDATASectionImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMCDATASectionImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMCDATASectionImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMCDATASectionImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMCDATASectionImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMCDATASectionImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMCDATASectionImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMCDATASectionImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMCDATASectionImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMCDATASectionImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + + +// +// Delegation of CharacerData functions. +// + + + const XMLCh* DOMCDATASectionImpl::getData() const {return fCharacterData.getData();} + XMLSize_t DOMCDATASectionImpl::getLength() const {return fCharacterData.getLength();} + const XMLCh* DOMCDATASectionImpl::substringData(XMLSize_t offset, XMLSize_t count) const + {return fCharacterData.substringData(this, offset, count);} + void DOMCDATASectionImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);} + void DOMCDATASectionImpl::insertData(XMLSize_t offset, const XMLCh *arg) + {fCharacterData.insertData(this, offset, arg);} + void DOMCDATASectionImpl::deleteData(XMLSize_t offset, XMLSize_t count) + {fCharacterData.deleteData(this, offset, count);} + void DOMCDATASectionImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg) + {fCharacterData.replaceData(this, offset, count, arg);} + void DOMCDATASectionImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);} + void DOMCDATASectionImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); } + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.hpp new file mode 100644 index 000000000..b8711aeb6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCDATASectionImpl.hpp @@ -0,0 +1,98 @@ +/* + * 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: DOMCDATASectionImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include +#include +#include "DOMNodeImpl.hpp" +#include "DOMChildNode.hpp" +#include "DOMParentNode.hpp" +#include "DOMCharacterDataImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMCDATASectionImpl: public DOMCDATASection { +protected: + DOMNodeImpl fNode; + DOMChildNode fChild; + DOMCharacterDataImpl fCharacterData; + + +public: + DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data); + DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n); + DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool deep = false); + + virtual ~DOMCDATASectionImpl(); + + // Functions inherited from TEXT + virtual DOMText* splitText(XMLSize_t offset); + // DOM Level 3 + virtual bool getIsElementContentWhitespace() const; + virtual const XMLCh* getWholeText() const; + virtual DOMText* replaceWholeText(const XMLCh* content); + + // non-standard extension + virtual bool isIgnorableWhitespace() const; + + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + // Functions introduced by DOMCharacterData + virtual const XMLCh* getData() const; + virtual XMLSize_t getLength() const; + virtual const XMLCh* substringData(XMLSize_t offset, + XMLSize_t count) const; + virtual void appendData(const XMLCh *arg); + virtual void insertData(XMLSize_t offset, const XMLCh *arg); + virtual void deleteData(XMLSize_t offset, + XMLSize_t count); + virtual void replaceData(XMLSize_t offset, + XMLSize_t count, + const XMLCh *arg); + virtual void setData(const XMLCh *data); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMCDATASectionImpl & operator = (const DOMCDATASectionImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCasts.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCasts.hpp new file mode 100644 index 000000000..63502789e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCasts.hpp @@ -0,0 +1,146 @@ +/* + * 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: DOMCasts.hpp 673975 2008-07-04 09:23:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCASTS_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCASTS_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +// +// Define inline casting functions to convert from +// (DOMNode *) to DOMParentNode or DOMChildNode *. +// +// This requires knowledge of the structure of the fields of +// for all node types. There are three categories - +// +// Nodetypes that can have children and can be a child themselves. +// e.g. Elements +// +// Object +// DOMNodeImpl fNode; +// DOMParentNode fParent; +// DOMChildNode fChild; +// ... // other fields, depending on node type. +// +// Nodetypes that can not have children, e.g. TEXT +// +// Object +// DOMNodeImpl fNode; +// DOMChildNode fChild; +// ... // other fields, depending on node type +// +// Nodetypes that can not be a child of other nodes, but that can +// have children (are a parent) e.g. ATTR +// Object +// DOMNodeImpl fNode; +// DOMParentNode fParent +// ... // other fields, depending on node type +// +// The casting functions make these assumptions: +// 1. The cast is possible. Using code will not attempt to +// cast to something that does not exist, such as the child +// part of an ATTR +// +// 2. The nodes belong to this implementation. +// +// Some of the casts use the LEAFNODE flag in the common fNode part to +// determine whether an fParent field exists, and thus the +// position of the fChild part within the node. +// +// These functions also cast off const. It was either do that, or make +// a second overloaded set that took and returned const arguements. +// + +// +// Note that using offsetof, or taking the offset of an object member at +// a 0 address, is now undefined in C++. And gcc now warns about this behavior. +// This is because doing do so is unreliable for some types of objects. +// See: http://gcc.gnu.org/ml/gcc/2004-06/msg00227.html +// : http://gcc.gnu.org/ml/gcc-bugs/2000-03/msg00805.html +// The casting code below works around gcc's warnings by using a dummy +// pointer, which the compiler cannot tell is null. The defeats the warning, +// but also masks the potential problem. +// The gcc option -Wno-invalid-offsetof may also be used to turn off this warning. +// + +#include "DOMElementImpl.hpp" +#include "DOMTextImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +static inline DOMNodeImpl *castToNodeImpl(const DOMNode *p) +{ + DOMElementImpl *pE = (DOMElementImpl *)p; + return &(pE->fNode); +} + + +static inline DOMParentNode *castToParentImpl(const DOMNode *p) { + DOMElementImpl *pE = (DOMElementImpl *)p; + return &(pE->fParent); +} + + +static inline DOMChildNode *castToChildImpl(const DOMNode *p) { + DOMElementImpl *pE = (DOMElementImpl *)p; + if (pE->fNode.isLeafNode()) { + DOMTextImpl *pT = (DOMTextImpl *)p; + return &(pT->fChild); + } + return &(pE->fChild); +} + + +static inline DOMNode *castToNode(const DOMParentNode *p ) { + DOMElementImpl* dummy = 0; + XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy; + char *retPtr = (char *)p - parentOffset; + return (DOMNode *)retPtr; +} + +static inline DOMNode *castToNode(const DOMNodeImpl *p) { + DOMElementImpl* dummy = 0; + XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy; + char *retPtr = (char *)p - nodeImplOffset; + return (DOMNode *)retPtr; +} + + +static inline DOMNodeImpl *castToNodeImpl(const DOMParentNode *p) +{ + DOMElementImpl* dummy = 0; + XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy; + XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy; + char *retPtr = (char *)p - parentOffset + nodeImplOffset; + return (DOMNodeImpl *)retPtr; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp new file mode 100644 index 000000000..bf093ca94 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp @@ -0,0 +1,318 @@ +/* + * 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: DOMCharacterDataImpl.cpp 678766 2008-07-22 14:00:16Z borisk $ + */ + +#include "DOMCharacterDataImpl.hpp" +#include +#include +#include "DOMRangeImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMStringPool.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMCharacterDataImpl::DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat) +{ + fDoc = (DOMDocumentImpl*)doc; + + XMLSize_t len=XMLString::stringLen(dat); + fDataBuf = fDoc->popBuffer(len+1); + if (!fDataBuf) + fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15); + fDataBuf->set(dat, len); +} + +DOMCharacterDataImpl:: +DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* dat, XMLSize_t len) +{ + fDoc = (DOMDocumentImpl*)doc; + + fDataBuf = fDoc->popBuffer(len+1); + + if (!fDataBuf) + fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15); + + fDataBuf->set(dat, len); +} + +DOMCharacterDataImpl::DOMCharacterDataImpl(const DOMCharacterDataImpl &other) +{ + fDoc = (DOMDocumentImpl*)other.fDoc; + + XMLSize_t len=other.getLength(); + fDataBuf = fDoc->popBuffer(len+1); + if (!fDataBuf) + fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15); + fDataBuf->set(other.fDataBuf->getRawBuffer(), len); +} + + +DOMCharacterDataImpl::~DOMCharacterDataImpl() { +} + + +const XMLCh * DOMCharacterDataImpl::getNodeValue() const +{ + return fDataBuf->getRawBuffer(); +} + + +void DOMCharacterDataImpl::setNodeValue(const DOMNode *node, const XMLCh *value) +{ + if (castToNodeImpl(node)->isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + fDataBuf->set(value); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument(); + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->receiveReplacedText((DOMNode*)node); + } + } + } + } +} + + +void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat) +{ + if(castToNodeImpl(node)->isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + fDataBuf->append(dat); +} + +void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat, XMLSize_t n) +{ + if(castToNodeImpl(node)->isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + fDataBuf->append(dat, n); +} + +void DOMCharacterDataImpl::deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count) +{ + if (castToNodeImpl(node)->isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + // Note: the C++ XMLCh * operation throws the correct DOMExceptions + // when parameter values are bad. + // + + XMLSize_t len = this->fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + + + // Cap the value of delLength to avoid trouble with overflows + // in the following length computations. + if (count > len) + count = len; + + // If the length of data to be deleted would extend off the end + // of the string, cut it back to stop at the end of string. + if (offset + count >= len) + count = len - offset; + + XMLSize_t newLen = len - count; + + XMLCh* newString; + XMLCh temp[4096]; + if (newLen >= 4095) + newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + ( + (newLen+1) * sizeof(XMLCh) + );//new XMLCh[newLen+1]; + else + newString = temp; + + XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset); + XMLString::copyString(newString+offset, fDataBuf->getRawBuffer()+offset+count); + + fDataBuf->set(newString); + + if (newLen >= 4095) + XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString; + + // We don't delete the old string (doesn't work), or alter + // the old string (may be shared) + // It just hangs around, possibly orphaned. + + DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument(); + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateRangeForDeletedText( (DOMNode*)node, offset, count); + } + } + } + } +} + + + +const XMLCh *DOMCharacterDataImpl::getData() const +{ + return fDataBuf->getRawBuffer(); +} + + +// +// getCharDataLength - return the length of the character data string. +// +XMLSize_t DOMCharacterDataImpl::getLength() const +{ + return fDataBuf->getLen(); +} + + + +void DOMCharacterDataImpl::insertData(const DOMNode *node, XMLSize_t offset, const XMLCh *dat) +{ + if (castToNodeImpl(node)->isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + // Note: the C++ XMLCh * operation throws the correct DOMExceptions + // when parameter values are bad. + // + + XMLSize_t len = fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + XMLSize_t datLen = XMLString::stringLen(dat); + + XMLSize_t newLen = len + datLen; + + XMLCh* newString; + XMLCh temp[4096]; + if (newLen >= 4095) + newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + ( + (newLen + 1) * sizeof(XMLCh) + );//new XMLCh[newLen+1]; + else + newString = temp; + + XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset); + XMLString::copyNString(newString+offset, dat, datLen); + XMLString::copyString(newString+offset+datLen, fDataBuf->getRawBuffer()+offset); + + fDataBuf->set(newString); + + if (newLen >= 4095) + XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString; + + DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument(); + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateRangeForInsertedText( (DOMNode*)node, offset, datLen); + } + } + } + } +} + + + +void DOMCharacterDataImpl::replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count, + const XMLCh *dat) +{ + if (castToNodeImpl(node)->isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + deleteData(node, offset, count); + insertData(node, offset, dat); +} + + + + +void DOMCharacterDataImpl::setData(const DOMNode *node, const XMLCh *arg) +{ + setNodeValue(node, arg); +} + + + + + +const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t offset, + XMLSize_t count) const +{ + + // Note: the C++ XMLCh * operation throws the correct DOMExceptions + // when parameter values are bad. + // + + + XMLSize_t len = fDataBuf->getLen(); + + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument(); + + XMLCh* newString; + XMLCh temp[4096]; + if (len >= 4095) + newString = (XMLCh*) doc->getMemoryManager()->allocate + ( + (len + 1) * sizeof(XMLCh) + );//new XMLCh[len+1]; + else + newString = temp; + + XMLString::copyNString(newString, fDataBuf->getRawBuffer()+offset, count); + newString[count] = chNull; + + const XMLCh* retString = doc->getPooledString(newString); + + if (len >= 4095) + doc->getMemoryManager()->deallocate(newString);//delete[] newString; + + return retString; + +} + + +void DOMCharacterDataImpl::releaseBuffer() { + fDoc->releaseBuffer(fDataBuf); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp new file mode 100644 index 000000000..64bdf5e65 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp @@ -0,0 +1,89 @@ +/* + * 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: DOMCharacterDataImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; +class DOMDocument; +class DOMDocumentImpl; +class DOMBuffer; + +// Instances of DOMCharacterDataImpl appear as members of node types +// that implement the DOMCharacterData interfaces. +// Operations in those classes are delegated to this class. +// +class CDOM_EXPORT DOMCharacterDataImpl +{ +public: + DOMBuffer* fDataBuf; + // for the buffer bid + DOMDocumentImpl* fDoc; + +public: + DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat); + DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* data, XMLSize_t n); + DOMCharacterDataImpl(const DOMCharacterDataImpl &other); + ~DOMCharacterDataImpl(); + const XMLCh * getNodeValue() const; + void setNodeValue(const XMLCh * value); + void appendData(const DOMNode *node, const XMLCh *data); + void appendData(const DOMNode *node, const XMLCh *data, XMLSize_t n); + void deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count); + const XMLCh* getData() const; + XMLSize_t getLength() const; + void insertData(const DOMNode *node, XMLSize_t offset, const XMLCh * data); + void replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count, const XMLCh * data); + void setData(const DOMNode *node, const XMLCh * arg); + void setNodeValue(const DOMNode *node, const XMLCh *value); + + + const XMLCh* substringData(const DOMNode *node, XMLSize_t offset, XMLSize_t count) const; + void releaseBuffer(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMCharacterDataImpl & operator = (const DOMCharacterDataImpl &); +}; + +#define GetDOMCharacterDataImplMemoryManager GET_DIRECT_MM(fDoc) + +XERCES_CPP_NAMESPACE_END + + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.cpp new file mode 100644 index 000000000..0ed42f6b0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.cpp @@ -0,0 +1,78 @@ +/* + * 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: DOMChildNode.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// This class only adds the ability to have siblings + +#include +#include "DOMNodeImpl.hpp" +#include "DOMChildNode.hpp" +#include "DOMCasts.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +DOMChildNode::DOMChildNode() +{ + this->previousSibling = 0; + this->nextSibling = 0; +} + +// This only makes a shallow copy, cloneChildren must also be called for a +// deep clone +DOMChildNode::DOMChildNode(const DOMChildNode &) +{ + // Need to break the association w/ original siblings and parent + this->previousSibling = 0; + this->nextSibling = 0; +} + +DOMChildNode::~DOMChildNode() { +} + + +DOMNode * DOMChildNode::getNextSibling() const { + return nextSibling; +} + +// +// Note: for getParentNode and getPreviousSibling(), below, an +// extra paramter "thisNode" is required. This is because there +// is no way to cast from a DOMChildNode pointer back to the +// DOMNodeImpl that it is part of. Our "this" may or may not +// be preceded by a fParent in the object layout, and there's no +// practical way to tell, so we just take an extra parameter instead. + +DOMNode * DOMChildNode::getParentNode(const DOMNode *thisNode) const +{ + // if we have an owner, ownerNode is our parent, otherwise it's + // our ownerDocument and we don't have a parent + DOMNodeImpl *thisNodeImpl = castToNodeImpl(thisNode); + return thisNodeImpl->isOwned() ? thisNodeImpl->fOwnerNode : 0; +} + +DOMNode * DOMChildNode::getPreviousSibling(const DOMNode *thisNode) const { + // if we are the firstChild, previousSibling actually refers to our + // parent's lastChild, but we hide that + return castToNodeImpl(thisNode)->isFirstChild() ? 0 : previousSibling; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.hpp new file mode 100644 index 000000000..e7c181206 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMChildNode.hpp @@ -0,0 +1,72 @@ +/* + * 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: DOMChildNode.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +/** + * ChildNode adds to NodeImpl the capability of being a child, this is having + * siblings. + **/ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMDocument; +class DOMNode; + + +class CDOM_EXPORT DOMChildNode { + +public: + DOMNode *previousSibling; + DOMNode *nextSibling; + + DOMChildNode(); + DOMChildNode(const DOMChildNode &other); + ~DOMChildNode(); + + DOMNode * getNextSibling() const; + DOMNode * getParentNode(const DOMNode *thisNode) const; + DOMNode * getPreviousSibling(const DOMNode *thisNode) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMChildNode & operator = (const DOMChildNode &); +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.cpp new file mode 100644 index 000000000..b8fa54055 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.cpp @@ -0,0 +1,189 @@ +/* + * 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: DOMCommentImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + +#include "DOMCommentImpl.hpp" +#include "DOMCharacterDataImpl.hpp" +#include "DOMStringPool.hpp" +#include "DOMCasts.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMRangeImpl.hpp" +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMCommentImpl::DOMCommentImpl(DOMDocument *ownerDoc, const XMLCh *dat) + : fNode(ownerDoc), fCharacterData(ownerDoc, dat) +{ + fNode.setIsLeafNode(true); +} + + +DOMCommentImpl::DOMCommentImpl(const DOMCommentImpl &other, bool) + + : fNode(other.fNode), + fChild(other.fChild), + fCharacterData(other.fCharacterData) +{ + fNode.setIsLeafNode(true); +} + + +DOMCommentImpl::~DOMCommentImpl() { +} + + + +DOMNode * DOMCommentImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::COMMENT_OBJECT) DOMCommentImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMCommentImpl::getNodeName() const { + static const XMLCh gComment[] = + {chPound, chLatin_c, chLatin_o, chLatin_m, chLatin_m, chLatin_e,chLatin_n, chLatin_t, 0}; + return gComment; +} + +DOMNode::NodeType DOMCommentImpl::getNodeType() const { + return DOMNode::COMMENT_NODE; +} + +void DOMCommentImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fCharacterData.releaseBuffer(); + doc->release(this, DOMMemoryManager::COMMENT_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + + +// Non standard extension for the range to work +DOMComment *DOMCommentImpl::splitText(XMLSize_t offset) +{ + if (fNode.isReadOnly()) + { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + XMLSize_t len = fCharacterData.fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); + DOMComment *newText = + doc->createComment(this->substringData(offset, len - offset)); + + DOMNode *parent = getParentNode(); + if (parent != 0) + parent->insertBefore(newText, getNextSibling()); + + fCharacterData.fDataBuf->chop(offset); + + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset); + } + } + } + } + + return newText; +} + + + DOMNode* DOMCommentImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } + DOMNamedNodeMap* DOMCommentImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMCommentImpl::getChildNodes() const {return fNode.getChildNodes (); } + DOMNode* DOMCommentImpl::getFirstChild() const {return fNode.getFirstChild (); } + DOMNode* DOMCommentImpl::getLastChild() const {return fNode.getLastChild (); } + const XMLCh* DOMCommentImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMCommentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMCommentImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMCommentImpl::getNodeValue() const {return fCharacterData.getNodeValue (); } + DOMDocument* DOMCommentImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); } + const XMLCh* DOMCommentImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMCommentImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMCommentImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMCommentImpl::hasChildNodes() const {return fNode.hasChildNodes (); } + DOMNode* DOMCommentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fNode.insertBefore (newChild, refChild); } + void DOMCommentImpl::normalize() {fNode.normalize (); } + DOMNode* DOMCommentImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } + DOMNode* DOMCommentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fNode.replaceChild (newChild, oldChild); } + bool DOMCommentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMCommentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMCommentImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMCommentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMCommentImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } + void* DOMCommentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMCommentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMCommentImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMCommentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMCommentImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMCommentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMCommentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMCommentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMCommentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMCommentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + + +// +// Delegation of CharacerData functions. +// + + + const XMLCh* DOMCommentImpl::getData() const {return fCharacterData.getData();} + XMLSize_t DOMCommentImpl::getLength() const {return fCharacterData.getLength();} + const XMLCh* DOMCommentImpl::substringData(XMLSize_t offset, XMLSize_t count) const + {return fCharacterData.substringData(this, offset, count);} + void DOMCommentImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);} + void DOMCommentImpl::insertData(XMLSize_t offset, const XMLCh *arg) + {fCharacterData.insertData(this, offset, arg);} + void DOMCommentImpl::deleteData(XMLSize_t offset, XMLSize_t count) + {fCharacterData.deleteData(this, offset, count);} + void DOMCommentImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg) + {fCharacterData.replaceData(this, offset, count, arg);} + void DOMCommentImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);} + void DOMCommentImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); } + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.hpp new file mode 100644 index 000000000..e3cc62cc3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMCommentImpl.hpp @@ -0,0 +1,84 @@ +/* + * 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: DOMCommentImpl.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include +#include + +#include "DOMNodeImpl.hpp" +#include "DOMChildNode.hpp" +#include "DOMCharacterDataImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMCommentImpl: public DOMComment { +public: + DOMNodeImpl fNode; + DOMChildNode fChild; + DOMCharacterDataImpl fCharacterData; + +public: + DOMCommentImpl(DOMDocument *, const XMLCh *); + DOMCommentImpl(const DOMCommentImpl &other, bool deep); + virtual ~DOMCommentImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + // Functions from DOMCharacterData + virtual void appendData(const XMLCh *data); + virtual void deleteData(XMLSize_t offset, XMLSize_t count); + virtual const XMLCh * getData() const; + virtual XMLSize_t getLength() const; + virtual void insertData(XMLSize_t offset, const XMLCh * data); + virtual void replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh * data); + virtual void setData(const XMLCh * arg); + virtual const XMLCh * substringData(XMLSize_t offset, XMLSize_t count) const; + + // Non standard extension for the range to work + DOMComment* splitText(XMLSize_t offset); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMCommentImpl & operator = (const DOMCommentImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.cpp new file mode 100644 index 000000000..fa4fb87e5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.cpp @@ -0,0 +1,271 @@ +/* + * 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. + */ + +#include "DOMConfigurationImpl.hpp" +#include "DOMStringListImpl.hpp" +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const unsigned short DOMConfigurationImpl::fDEFAULT_VALUES = 0x2596; + +DOMConfigurationImpl::DOMConfigurationImpl(MemoryManager* const manager): featureValues(fDEFAULT_VALUES), + fErrorHandler(0), fSchemaType(0), fSchemaLocation(0), + fSupportedParameters(0), fMemoryManager(manager) +{ + fSupportedParameters=new (fMemoryManager) DOMStringListImpl(17, fMemoryManager); + fSupportedParameters->add(XMLUni::fgDOMErrorHandler); + fSupportedParameters->add(XMLUni::fgDOMSchemaType); + fSupportedParameters->add(XMLUni::fgDOMSchemaLocation); + fSupportedParameters->add(XMLUni::fgDOMCanonicalForm); + fSupportedParameters->add(XMLUni::fgDOMCDATASections); + fSupportedParameters->add(XMLUni::fgDOMComments); + fSupportedParameters->add(XMLUni::fgDOMDatatypeNormalization); + fSupportedParameters->add(XMLUni::fgDOMWRTDiscardDefaultContent); + fSupportedParameters->add(XMLUni::fgDOMEntities); + fSupportedParameters->add(XMLUni::fgDOMInfoset); + fSupportedParameters->add(XMLUni::fgDOMNamespaces); + fSupportedParameters->add(XMLUni::fgDOMNamespaceDeclarations); + fSupportedParameters->add(XMLUni::fgDOMNormalizeCharacters); + fSupportedParameters->add(XMLUni::fgDOMSplitCDATASections); + fSupportedParameters->add(XMLUni::fgDOMValidate); + fSupportedParameters->add(XMLUni::fgDOMValidateIfSchema); + fSupportedParameters->add(XMLUni::fgDOMElementContentWhitespace); +} + +DOMConfigurationImpl::~DOMConfigurationImpl() { + delete fSupportedParameters; +} + +void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) { + if(!canSetParameter(name, value)) { + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); + } + + if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) { + fErrorHandler = (DOMErrorHandler*)value; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) { + fSchemaType = (XMLCh*)value; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) { + fSchemaLocation = (XMLCh*)value; + } else { // canSetParameter above should take care of this case + throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager); + } + +} + +void DOMConfigurationImpl::setParameter(const XMLCh* name, bool value) { + if(!canSetParameter(name, value)) { + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); + } + + DOMConfigurationFeature whichFlag = getFeatureFlag(name); + if(value) { + featureValues |= whichFlag; + } else { + featureValues &= ~whichFlag; + } + +} + +// -------------------------------------- +// Getter Methods +// -------------------------------------- + +const void* DOMConfigurationImpl::getParameter(const XMLCh* name) const { + DOMConfigurationFeature whichFlag; + try { + whichFlag = getFeatureFlag(name); + if(featureValues & whichFlag) { + return (void*)true; + } else { + return (void*)false; + } + } catch (DOMException&) { + // must not be a boolean parameter + if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) { + return fErrorHandler; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) { + return fSchemaType; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) { + return fSchemaLocation; + } else { + throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager); + } + } + +} + +// ----------------------------------------- +// Query Methods +// ----------------------------------------- + +bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, const void* /*value*/) const { + + /** + * canSetParameter(name, value) returns false in two conditions: + * 1) if a [required] feature has no supporting code, then return false in + * both the true and false outcomes (This is in order to be either fully + * spec compliant, or not at all) + * 2) if an [optional] feature has no supporting code, then return false + **/ + + if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) { + return true; // required // + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) { + return false; // optional // + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) { + return false; // optional // + } + return false; +} + +bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, bool booleanValue) const { + /** + * canSetParameter(name, value) returns false in two conditions: + * 1) if a [required] feature has no supporting code, then return false in + * both the true and false outcomes (This is in order to be either fully + * spec compliant, or not at all) + * 2) if an [optional] feature has no supporting code, then return false + **/ + + DOMConfigurationFeature whichFlag = getFeatureFlag(name); + switch (whichFlag) { + case FEATURE_CANONICAL_FORM: + if(booleanValue) return false; // optional // + else return true; // required // + case FEATURE_CDATA_SECTIONS: + return true; + case FEATURE_COMMENTS: + return true; + case FEATURE_DATATYPE_NORMALIZATION: + if(booleanValue) return false; // required // + else return true; // required // + case FEATURE_DISCARD_DEFAULT_CONTENT: + if(booleanValue) return false; // required // + else return true; // required // + case FEATURE_ENTITIES: + if(booleanValue) return true; // required // + else return true; // required // + case FEATURE_INFOSET: + if(booleanValue) return false; // required // + else return true; // no effect// + case FEATURE_NAMESPACES: + return true; + case FEATURE_NAMESPACE_DECLARATIONS: + if(booleanValue) return true; // optional // + else return false; // required // + case FEATURE_NORMALIZE_CHARACTERS: + if(booleanValue) return false; // optional // + else return true; // required // + case FEATURE_SPLIT_CDATA_SECTIONS: + //we dont report an error in the false case so we cant claim we do it + if(booleanValue) return false; // required // + else return false; // required // + case FEATURE_VALIDATE: + if(booleanValue) return false; // optional // + else return true; // required // + case FEATURE_VALIDATE_IF_SCHEMA: + if(booleanValue) return false; // optional // + else return true; // required // + + case FEATURE_ELEMENT_CONTENT_WHITESPACE: + if(booleanValue) return true; // required // + else return false; // optional // + } + // should never be here + return false; +} + +const DOMStringList* DOMConfigurationImpl::getParameterNames() const +{ + return fSupportedParameters; +} + +// ------------------------------------------- +// Impl methods +// ------------------------------------------- + +DOMConfigurationImpl::DOMConfigurationFeature DOMConfigurationImpl::getFeatureFlag(const XMLCh* name) const { + if(XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm)==0) { + return FEATURE_CANONICAL_FORM; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections )==0) { + return FEATURE_CDATA_SECTIONS; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMComments)==0) { + return FEATURE_COMMENTS; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization)==0) { + return FEATURE_DATATYPE_NORMALIZATION; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMWRTDiscardDefaultContent)==0) { + return FEATURE_DISCARD_DEFAULT_CONTENT; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities)==0) { + return FEATURE_ENTITIES; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset)==0) { + return FEATURE_INFOSET; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces)==0) { + return FEATURE_NAMESPACES; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations)==0) { + return FEATURE_NAMESPACE_DECLARATIONS; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters)==0) { + return FEATURE_NORMALIZE_CHARACTERS; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections)==0) { + return FEATURE_SPLIT_CDATA_SECTIONS; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate)==0) { + return FEATURE_VALIDATE; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema)==0) { + return FEATURE_VALIDATE_IF_SCHEMA; + } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace)==0) { + return FEATURE_ELEMENT_CONTENT_WHITESPACE; + } else { + throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager); + } + +} + +DOMErrorHandler* DOMConfigurationImpl::getErrorHandler() const { + return fErrorHandler; +} + +const XMLCh* DOMConfigurationImpl::getSchemaType() const { + return fSchemaType; +} + +const XMLCh* DOMConfigurationImpl::getSchemaLocation() const { + return fSchemaLocation; +} + +void DOMConfigurationImpl::setErrorHandler(DOMErrorHandler *erHandler) { + fErrorHandler = erHandler; +} + +void DOMConfigurationImpl::setSchemaType(const XMLCh* st) { + fSchemaType = st; +} + +void DOMConfigurationImpl::setSchemaLocation(const XMLCh* sl) { + fSchemaLocation = sl; +} + + +XERCES_CPP_NAMESPACE_END + + +/** + * End of file DOMConfigurationImpl.cpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.hpp new file mode 100644 index 000000000..91033a152 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMConfigurationImpl.hpp @@ -0,0 +1,150 @@ +/* + * 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. + */ + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMDocumentImpl; +class DOMStringListImpl; + +class CDOM_EXPORT DOMConfigurationImpl : public DOMConfiguration +{ +private: + //unimplemented + DOMConfigurationImpl(const DOMConfiguration &); + DOMConfigurationImpl & operator = (const DOMConfiguration &); + + +public: + + //----------------------------------------------------------------------------------- + // Constructor + //----------------------------------------------------------------------------------- + DOMConfigurationImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMConfigurationImpl(); + + enum DOMConfigurationFeature { + FEATURE_CANONICAL_FORM = 0x0001, + FEATURE_CDATA_SECTIONS = 0x0002, + FEATURE_COMMENTS = 0x0004, + FEATURE_DATATYPE_NORMALIZATION = 0x0008, + FEATURE_DISCARD_DEFAULT_CONTENT = 0x0010, + FEATURE_ENTITIES = 0x0020, + FEATURE_INFOSET = 0x0040, + FEATURE_NAMESPACES = 0x0080, + FEATURE_NAMESPACE_DECLARATIONS = 0x0100, + FEATURE_NORMALIZE_CHARACTERS = 0x0200, + FEATURE_SPLIT_CDATA_SECTIONS = 0x0400, + FEATURE_VALIDATE = 0x0800, + FEATURE_VALIDATE_IF_SCHEMA = 0x1000, + FEATURE_ELEMENT_CONTENT_WHITESPACE = 0x2000 + }; + + unsigned short featureValues; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + virtual void setParameter(const XMLCh* name, const void* value); + virtual void setParameter(const XMLCh* name, bool value); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + virtual const void* getParameter(const XMLCh* name) const; + + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + + virtual bool canSetParameter(const XMLCh* name, const void* value) const; + virtual bool canSetParameter(const XMLCh* name, bool value) const; + + virtual const DOMStringList* getParameterNames() const; + + // --------------------------------------------------------------------------- + // Impl specific methods + // --------------------------------------------------------------------------- + + /* specific get and set methods for non-boolean parameters + * */ + + DOMErrorHandler* getErrorHandler() const; + + const XMLCh* getSchemaType() const; + + const XMLCh* getSchemaLocation() const; + + void setErrorHandler(DOMErrorHandler *erHandler); + + void setSchemaType(const XMLCh* st); + + void setSchemaLocation(const XMLCh* sl); + + // The default values for the boolean parameters + // from CANONICAL_FORM to ELEMENT_CONTENT_WHITESPACE + // 10010110010110 = 0x2596 + static const unsigned short fDEFAULT_VALUES; + + +protected: + // implements a simple map between the name and its enum value + DOMConfigurationFeature getFeatureFlag(const XMLCh* name) const; + + // the error handler + DOMErrorHandler* fErrorHandler; + + // the schema type + const XMLCh* fSchemaType; + + // the schema location + const XMLCh* fSchemaLocation; + + // the list of supported parameters + DOMStringListImpl* fSupportedParameters; + + MemoryManager* fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMConfigurationImpl.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp new file mode 100644 index 000000000..f48189f63 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp @@ -0,0 +1,219 @@ +/* + * 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: DOMDeepNodeListImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + +#include "DOMDeepNodeListImpl.hpp" +#include "DOMElementImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMNodeImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +static const XMLCh kAstr[] = {chAsterisk, chNull}; + +DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode, + const XMLCh *tagName) + : fRootNode(rootNode) + , fChanges(0) + , fCurrentNode(0) + , fCurrentIndexPlus1(0) + , fNamespaceURI(0) + , fMatchAllURI(false) + , fMatchURIandTagname(false) +{ + fTagName = ((DOMDocumentImpl *)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(tagName); + fMatchAll = XMLString::equals(fTagName, kAstr); +} + + +//DOM Level 2 +DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode, + const XMLCh *namespaceURI, + const XMLCh *localName) + : fRootNode(rootNode) + , fChanges(0) + , fCurrentNode(0) + , fCurrentIndexPlus1(0) + , fMatchAllURI(false) + , fMatchURIandTagname(true) +{ + DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(rootNode)->getOwnerDocument(); + + fTagName = doc->getPooledString(localName); + fMatchAll = XMLString::equals(fTagName, kAstr); + fMatchAllURI = XMLString::equals(namespaceURI, kAstr); + fNamespaceURI = doc->getPooledString(namespaceURI); +} + + +DOMDeepNodeListImpl::~DOMDeepNodeListImpl() +{ +} + +XMLSize_t DOMDeepNodeListImpl::getLength() const +{ + // Reset cache to beginning of list + item(0); + + // Preload all matching elements. (Stops when we run out of subtree!) + item(INT_MAX); + return fCurrentIndexPlus1; +} + + +DOMNode *DOMDeepNodeListImpl::item(XMLSize_t index) const +{ + return ((DOMDeepNodeListImpl*)this)->cacheItem(index); +} + +// Start from the first child and count forward, 0-based. index>length-1 +// should return 0. +// +// Attempts to do only work actually requested, cache work already +// done, and to flush that cache when the tree has changed. +// +// LIMITATION: ????? Unable to tell relevant tree-changes from +// irrelevant ones. Doing so in a really useful manner would seem +// to involve a tree-walk in its own right, or maintaining our data +// in a parallel tree. +DOMNode *DOMDeepNodeListImpl::cacheItem(XMLSize_t index) +{ + XMLSize_t currentIndexPlus1 = fCurrentIndexPlus1; + DOMNode *currentNode = fCurrentNode; + + if (castToParentImpl(fRootNode)->changes() != fChanges) + { + // Tree changed. Do it all from scratch! + currentIndexPlus1 = 0; + currentNode = (DOMNode *)fRootNode; + fChanges = castToParentImpl(fRootNode)->changes(); + } + else if (currentIndexPlus1 > index+1) + { + // Interested in something before cached node. Do it all from scratch! + currentIndexPlus1 = 0; + currentNode = (DOMNode *)fRootNode; + } + else if (index+1 == currentIndexPlus1) + { + // What luck! User is interested in cached node. + return currentNode; + } + + DOMNode *nextNode = 0; + +// revisit - ???? How efficient is this loop? ???? + + // Start at the place in the tree at which we're + // currently pointing and count off nodes until we + // reach the node of interest or the end of the tree. + while (currentIndexPlus1 < index+1 && currentNode != 0) + { + nextNode = nextMatchingElementAfter(currentNode); + if (nextNode == 0) + break; + currentNode = nextNode; + currentIndexPlus1++; + } + + fCurrentNode = currentNode; + fCurrentIndexPlus1 = currentIndexPlus1; + + // If we found a node at the requested index, make that the current node + if (nextNode != 0) + { + return currentNode; + } + + // If we didn't find a node at the requested index, return 0 + return 0; +} + + + +/* Iterative tree-walker. When you have a Parent link, there's often no +need to resort to recursion. NOTE THAT only Element nodes are matched +since we're specifically supporting getElementsByTagName(). +*/ +DOMNode *DOMDeepNodeListImpl::nextMatchingElementAfter(DOMNode *current) +{ + DOMNode *next; + while (current != 0) + { + // Look down to first child. + if (current->hasChildNodes()) + { + current = current->getFirstChild(); + } + // Look right to sibling (but not from root!) + else + { + if (current != fRootNode && 0 != (next = current->getNextSibling())) + { + current = next; + } + // Look up and right (but not past root!) + else + { + next = 0; + for (; + current != fRootNode; // Stop on return to starting point + current = current->getParentNode()) + { + next = current->getNextSibling(); + if (next != 0) + break; + } + current = next; + } + } + + // Have we found an Element with the right tagName? + // ("*" matches anything.) + if (current != 0 && current != fRootNode && + current->getNodeType() == DOMNode::ELEMENT_NODE) { + DOMElement *currElement = (DOMElement *)current; + + if (!fMatchURIandTagname) { //DOM Level 1 + if (fMatchAll || + XMLString::equals(currElement->getTagName(), fTagName)) + return current; + } else { //DOM Level 2 + if (!fMatchAllURI && + !XMLString::equals(current->getNamespaceURI(), fNamespaceURI)) + continue; + + if (fMatchAll || + XMLString::equals(current->getLocalName(), fTagName)) + return current; + } + } + + // Otherwise continue walking the tree + } + // Fell out of tree-walk; no more instances found + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.hpp new file mode 100644 index 000000000..ea670660f --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListImpl.hpp @@ -0,0 +1,80 @@ +/* + * 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: DOMDeepNodeListImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; + + +class CDOM_EXPORT DOMDeepNodeListImpl: public DOMNodeList { +protected: + const DOMNode* fRootNode; + const XMLCh* fTagName; + bool fMatchAll; + int fChanges; + DOMNode* fCurrentNode; + XMLSize_t fCurrentIndexPlus1; + + //DOM Level 2 + const XMLCh* fNamespaceURI; + bool fMatchAllURI; + bool fMatchURIandTagname; //match both namespaceURI and tagName + +public: + DOMDeepNodeListImpl(const DOMNode *rootNode, const XMLCh *tagName); + DOMDeepNodeListImpl(const DOMNode *rootNode, //DOM Level 2 + const XMLCh *namespaceURI, + const XMLCh *localName); + virtual ~DOMDeepNodeListImpl(); + virtual XMLSize_t getLength() const; + virtual DOMNode* item(XMLSize_t index) const; + DOMNode* cacheItem(XMLSize_t index); + +protected: + DOMNode* nextMatchingElementAfter(DOMNode *current); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMDeepNodeListImpl(const DOMDeepNodeListImpl &); + DOMDeepNodeListImpl & operator = (const DOMDeepNodeListImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.c b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.c new file mode 100644 index 000000000..618c7c338 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.c @@ -0,0 +1,428 @@ +/* + * 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: DOMDeepNodeListPool.c 883368 2009-11-23 15:28:19Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#include +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + + +// --------------------------------------------------------------------------- +// DOMDeepNodeListPool: Constructors and Destructor +// --------------------------------------------------------------------------- +template +DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus + , const bool adoptElems + , const XMLSize_t initSize) : + fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fMemoryManager(XMLPlatformUtils::fgMemoryManager) +{ + initialize(modulus); + + // + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus + , const bool adoptElems + , const THasher& hasher + , const XMLSize_t initSize) : + fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fMemoryManager(XMLPlatformUtils::fgMemoryManager) + , fHasher(hasher) +{ + initialize(modulus); + + // + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus + , const XMLSize_t initSize) : + fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fMemoryManager(XMLPlatformUtils::fgMemoryManager) +{ + initialize(modulus); + + // + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +void DOMDeepNodeListPool::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (DOMDeepNodeListPoolTableBucketElem**) + fMemoryManager->allocate + ( + fHashModulus * sizeof(DOMDeepNodeListPoolTableBucketElem*) + );//new DOMDeepNodeListPoolTableBucketElem*[fHashModulus]; + for (XMLSize_t index = 0; index < fHashModulus; index++) + fBucketList[index] = 0; +} + +template +DOMDeepNodeListPool::~DOMDeepNodeListPool() +{ + removeAll(); + + // Then delete the bucket list & hasher & id pointers list + fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs; + fMemoryManager->deallocate(fBucketList);//delete [] fBucketList; +} + + +// --------------------------------------------------------------------------- +// DOMDeepNodeListPool: Element management +// --------------------------------------------------------------------------- +template +bool DOMDeepNodeListPool::isEmpty() const +{ + // Just check the bucket list for non-empty elements + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + if (fBucketList[buckInd] != 0) + return false; + } + return true; +} + +template +bool DOMDeepNodeListPool::containsKey( const void* const key1 + , const XMLCh* const key2 + , const XMLCh* const key3) const +{ + XMLSize_t hashVal; + const DOMDeepNodeListPoolTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + return (findIt != 0); +} + +template +void DOMDeepNodeListPool::removeAll() +{ + if (fIdCounter == 0) return; + + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + DOMDeepNodeListPoolTableBucketElem* curElem = fBucketList[buckInd]; + DOMDeepNodeListPoolTableBucketElem* nextElem; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + + // If we adopted the data, then delete it too + // (Note: the userdata hash table instance has data type of void *. + // This will generate compiler warnings here on some platforms, but they + // can be ignored since fAdoptedElements is false. + if (fAdoptedElems) + delete curElem->fData; + + // Then delete the current element and move forward + fMemoryManager->deallocate(curElem->fKey2);//delete [] curElem->fKey2; + fMemoryManager->deallocate(curElem->fKey3);//delete [] curElem->fKey3; + + delete curElem; + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + + // Reset the id counter + fIdCounter = 0; +} + +template +void DOMDeepNodeListPool::cleanup() +{ + removeAll(); + + // Then delete the bucket list & hasher & id pointers list + fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs; + fMemoryManager->deallocate(fBucketList);//delete [] fBucketList; +} + + + +// --------------------------------------------------------------------------- +// DOMDeepNodeListPool: Getters +// --------------------------------------------------------------------------- +template +TVal* +DOMDeepNodeListPool::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) +{ + XMLSize_t hashVal; + DOMDeepNodeListPoolTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +const TVal* +DOMDeepNodeListPool::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const +{ + XMLSize_t hashVal; + const DOMDeepNodeListPoolTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +TVal* +DOMDeepNodeListPool::getById(const XMLSize_t elemId) +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +template +const TVal* +DOMDeepNodeListPool::getById(const XMLSize_t elemId) const +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +// --------------------------------------------------------------------------- +// DOMDeepNodeListPool: Putters +// --------------------------------------------------------------------------- +template +XMLSize_t +DOMDeepNodeListPool::put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt) +{ + // First see if the key exists already + XMLSize_t hashVal; + DOMDeepNodeListPoolTableBucketElem* newBucket = findBucketElem(key1, key2, key3, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + if (fAdoptedElems) + delete newBucket->fData; + + fMemoryManager->deallocate(newBucket->fKey2);//delete[] newBucket->fKey2; + fMemoryManager->deallocate(newBucket->fKey3);//delete[] newBucket->fKey3; + + newBucket->fData = valueToAdopt; + newBucket->fKey1 = key1; + newBucket->fKey2 = XMLString::replicate(key2, fMemoryManager); + newBucket->fKey3 = XMLString::replicate(key3, fMemoryManager); + } + else + { + // Revisit: the gcc compiler 2.95.x is generating an + // internal compiler error message. So we use the default + // memory manager for now. +#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600) + newBucket = new DOMDeepNodeListPoolTableBucketElem + ( + key1 + , key2 + , key3 + , valueToAdopt + , fBucketList[hashVal] + , fMemoryManager + ); +#else + newBucket = new (fMemoryManager) DOMDeepNodeListPoolTableBucketElem + ( + key1 + , key2 + , key3 + , valueToAdopt + , fBucketList[hashVal] + , fMemoryManager + ); +#endif + fBucketList[hashVal] = newBucket; + } + + // + // Give this new one the next available id and add to the pointer list. + // Expand the list if that is now required. + // + if (fIdCounter + 1 == fIdPtrsCount) + { + // Create a new count 1.5 times larger and allocate a new array + XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5); + TVal** newArray = (TVal**) fMemoryManager->allocate + ( + newCount * sizeof(TVal*) + );//new TVal*[newCount]; + + // Copy over the old contents to the new array + memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*)); + + // Ok, toss the old array and store the new data + fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs; + fIdPtrs = newArray; + fIdPtrsCount = newCount; + } + const XMLSize_t retId = ++fIdCounter; + fIdPtrs[retId] = valueToAdopt; + + // Return the id that we gave to this element + return retId; +} + +// --------------------------------------------------------------------------- +// DOMDeepNodeListPool: Private methods +// --------------------------------------------------------------------------- +template +DOMDeepNodeListPoolTableBucketElem* DOMDeepNodeListPool:: +findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + DOMDeepNodeListPoolTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + //key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same + //but we need them to be treated as different keys in this case + if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) { + if (!key2 || !curElem->fKey2) { + if (key2 || curElem->fKey2) { + curElem = curElem->fNext; + continue; + } + } + if (!key3 || !curElem->fKey3) { + if (key3 || curElem->fKey3) { + curElem = curElem->fNext; + continue; + } + } + + return curElem; + } + + curElem = curElem->fNext; + } + return 0; +} + +template +const DOMDeepNodeListPoolTableBucketElem* DOMDeepNodeListPool:: +findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + const DOMDeepNodeListPoolTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + //key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same + //but we need them to be treated as different keys in this case + if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) { + if (!key2 || !curElem->fKey2) { + if (key2 || curElem->fKey2) { + curElem = curElem->fNext; + continue; + } + } + if (!key3 || !curElem->fKey3) { + if (key3 || curElem->fKey3) { + curElem = curElem->fNext; + continue; + } + } + return curElem; + } + + curElem = curElem->fNext; + } + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp new file mode 100644 index 000000000..ad609b62e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp @@ -0,0 +1,200 @@ +/* + * 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: DOMDeepNodeListPool.hpp 883368 2009-11-23 15:28:19Z amassari $ + */ + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP + + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +template +struct DOMDeepNodeListPoolTableBucketElem : public XMemory +{ + DOMDeepNodeListPoolTableBucketElem + ( + void* key1 + , XMLCh* key2 + , XMLCh* key3 + , TVal* const value + , DOMDeepNodeListPoolTableBucketElem* next + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) : + fData(value) + , fNext(next) + , fKey1(key1) + , fKey2(0) + , fKey3(0) + { + if (key2) + fKey2 = XMLString::replicate(key2, manager); + + if (key3) + fKey3 = XMLString::replicate(key3, manager); + } + + TVal* fData; + DOMDeepNodeListPoolTableBucketElem* fNext; + void* fKey1; + XMLCh* fKey2; + XMLCh* fKey3; + + ~DOMDeepNodeListPoolTableBucketElem() {}; +}; + + +template +class DOMDeepNodeListPool +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DOMDeepNodeListPool + ( + const XMLSize_t modulus + , const XMLSize_t initSize = 128 + ); + + DOMDeepNodeListPool + ( + const XMLSize_t modulus + , const bool adoptElems + , const XMLSize_t initSize = 128 + ); + + DOMDeepNodeListPool + ( + const XMLSize_t modulus + , const bool adoptElems + , const THasher& hasher + , const XMLSize_t initSize = 128 + ); + + ~DOMDeepNodeListPool(); + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const; + void removeAll(); + void cleanup(); + + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3); + const TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const; + + TVal* getById(const XMLSize_t elemId); + const TVal* getById(const XMLSize_t elemId) const; + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + XMLSize_t put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt); + +private: + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + DOMDeepNodeListPoolTableBucketElem* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal); + const DOMDeepNodeListPoolTableBucketElem* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const; + void initialize(const XMLSize_t modulus); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMDeepNodeListPool(const DOMDeepNodeListPool &); + DOMDeepNodeListPool & operator = (const DOMDeepNodeListPool &); + + // ----------------------------------------------------------------------- + // Data members + // + // fAdoptedElems + // Indicates whether the values added are adopted or just referenced. + // If adopted, then they are deleted when they are removed from the + // hash table. + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fHash + // The hasher for the key1 data type. + // + // fIdPtrs + // fIdPtrsCount + // This is the array of pointers to the bucket elements in order of + // their assigned ids. So taking id N and referencing this array + // gives you the element with that id. The count field indicates + // the current size of this list. When fIdCounter+1 reaches this + // value the list must be expanded. + // + // fIdCounter + // This is used to give out unique ids to added elements. It starts + // at zero (which means empty), and is bumped up for each newly added + // element. So the first element is 1, the next is 2, etc... This + // means that this value is set to the top index of the fIdPtrs array. + // ----------------------------------------------------------------------- + bool fAdoptedElems; + DOMDeepNodeListPoolTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + TVal** fIdPtrs; + XMLSize_t fIdPtrsCount; + XMLSize_t fIdCounter; + MemoryManager* fMemoryManager; + THasher fHasher; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp new file mode 100644 index 000000000..c96fec9cc --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp @@ -0,0 +1,137 @@ +/* + * 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: DOMDocumentFragmentImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMDocumentFragmentImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMDocumentFragmentImpl::DOMDocumentFragmentImpl(DOMDocument *masterDoc) + : fNode(masterDoc), fParent(masterDoc) +{ +} + + +DOMDocumentFragmentImpl::DOMDocumentFragmentImpl(const DOMDocumentFragmentImpl &other, + bool deep) + : fNode(other.fNode), fParent(other.fParent) +{ + if (deep) + castToParentImpl(this)->cloneChildren(&other); +} + + +DOMDocumentFragmentImpl::~DOMDocumentFragmentImpl() +{ +} + + + +DOMNode *DOMDocumentFragmentImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (castToNodeImpl(this)->getOwnerDocument(), DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT) DOMDocumentFragmentImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMDocumentFragmentImpl::getNodeName() const { + static const XMLCh name[] = {chPound, chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, + chLatin_e, chLatin_n, chLatin_t, chDash, + chLatin_f, chLatin_r, chLatin_a, chLatin_g, chLatin_m, chLatin_e, chLatin_n, chLatin_t, 0}; + return name; +} + + +DOMNode::NodeType DOMDocumentFragmentImpl::getNodeType() const { + return DOMNode::DOCUMENT_FRAGMENT_NODE; +} + + +void DOMDocumentFragmentImpl::setNodeValue(const XMLCh *x) +{ + fNode.setNodeValue(x); +} + + +void DOMDocumentFragmentImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +// +// Delegation stubs for inherited functions. +// + DOMNode* DOMDocumentFragmentImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } + DOMNamedNodeMap* DOMDocumentFragmentImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMDocumentFragmentImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMDocumentFragmentImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMDocumentFragmentImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMDocumentFragmentImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMDocumentFragmentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMDocumentFragmentImpl::getNextSibling() const {return fNode.getNextSibling (); } + const XMLCh* DOMDocumentFragmentImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMDocumentFragmentImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMDocumentFragmentImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMDocumentFragmentImpl::getParentNode() const {return fNode.getParentNode (); } + DOMNode* DOMDocumentFragmentImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } + bool DOMDocumentFragmentImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + DOMNode* DOMDocumentFragmentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); } + void DOMDocumentFragmentImpl::normalize() {fParent.normalize (); } + DOMNode* DOMDocumentFragmentImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } + DOMNode* DOMDocumentFragmentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); } + bool DOMDocumentFragmentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMDocumentFragmentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMDocumentFragmentImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMDocumentFragmentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMDocumentFragmentImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); } + void* DOMDocumentFragmentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMDocumentFragmentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMDocumentFragmentImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMDocumentFragmentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMDocumentFragmentImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMDocumentFragmentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMDocumentFragmentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMDocumentFragmentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMDocumentFragmentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMDocumentFragmentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.hpp new file mode 100644 index 000000000..2ff08d073 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentFragmentImpl.hpp @@ -0,0 +1,69 @@ +/* + * 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: DOMDocumentFragmentImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include +#include "DOMParentNode.hpp" +#include "DOMNodeImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMDocumentFragmentImpl: public DOMDocumentFragment { +protected: + DOMNodeImpl fNode; + DOMParentNode fParent; + +protected: + DOMDocumentFragmentImpl(DOMDocument *); + DOMDocumentFragmentImpl(const DOMDocumentFragmentImpl &other, bool deep); + friend class DOMDocumentImpl; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMDocumentFragmentImpl & operator = (const DOMDocumentFragmentImpl &); + +public: + virtual ~DOMDocumentFragmentImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.cpp new file mode 100644 index 000000000..c4ced068c --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.cpp @@ -0,0 +1,1509 @@ +/* + * 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: DOMDocumentImpl.cpp 932949 2010-04-11 17:40:33Z borisk $ + */ +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMConfigurationImpl.hpp" +#include "DOMDocumentTypeImpl.hpp" +#include "DOMAttrImpl.hpp" +#include "DOMAttrNSImpl.hpp" +#include "DOMCDATASectionImpl.hpp" +#include "DOMCommentImpl.hpp" +#include "DOMDeepNodeListImpl.hpp" +#include "DOMDocumentFragmentImpl.hpp" +#include "DOMElementImpl.hpp" +#include "XSDElementNSImpl.hpp" +#include "DOMEntityImpl.hpp" +#include "DOMEntityReferenceImpl.hpp" +#include "DOMNormalizer.hpp" +#include "DOMNotationImpl.hpp" +#include "DOMProcessingInstructionImpl.hpp" +#include "DOMTextImpl.hpp" +#include "DOMTreeWalkerImpl.hpp" +#include "DOMNodeIteratorImpl.hpp" +#include "DOMNodeIDMap.hpp" +#include "DOMRangeImpl.hpp" +#include "DOMTypeInfoImpl.hpp" +#include "DOMXPathExpressionImpl.hpp" +#include "DOMXPathNSResolverImpl.hpp" + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// The chunk size to allocate from the system allocator. +static XMLSize_t kInitialHeapAllocSize = 0x4000; +static XMLSize_t kMaxHeapAllocSize = 0x80000; +static XMLSize_t kMaxSubAllocationSize = 0x0100; // Any request for more bytes + // than this will be handled by + // allocating directly with system. + +void XMLInitializer::initializeDOMHeap (XMLSize_t initialHeapAllocSize, + XMLSize_t maxHeapAllocSize, + XMLSize_t maxSubAllocationSize) +{ + kInitialHeapAllocSize = initialHeapAllocSize; + kMaxHeapAllocSize = maxHeapAllocSize; + kMaxSubAllocationSize = maxSubAllocationSize; +} + +// +// Constructors. Warning - be very careful with the ordering of initialization +// of the heap. Ordering depends on the order of declaration +// in the .hpp file, not on the order of initializers here +// in the constructor. The heap declaration can not be +// first - fNode and fParent must be first for the casting +// functions in DOMCasts to work correctly. This means that +// fNode and fParent constructors used here can not +// allocate. +// +DOMDocumentImpl::DOMDocumentImpl(DOMImplementation* domImpl, MemoryManager* const manager) + : fNode(this), + fParent(this), + fNodeIDMap(0), + fInputEncoding(0), + fXmlEncoding(0), + fXmlStandalone(false), + fXmlVersion(0), + fDocumentURI(0), + fDOMConfiguration(0), + fUserDataTableKeys(17, manager), + fUserDataTable(0), + fCurrentBlock(0), + fFreePtr(0), + fFreeBytesRemaining(0), + fHeapAllocSize(kInitialHeapAllocSize), + fRecycleNodePtr(0), + fRecycleBufferPtr(0), + fNodeListPool(0), + fDocType(0), + fDocElement(0), + fNameTableSize(257), + fNormalizer(0), + fRanges(0), + fNodeIterators(0), + fMemoryManager(manager), + fDOMImplementation(domImpl), + fChanges(0), + errorChecking(true) +{ + fNameTable = (DOMStringPoolEntry**)allocate ( + sizeof (DOMStringPoolEntry*) * fNameTableSize); + for (XMLSize_t i = 0; i < fNameTableSize; i++) + fNameTable[i] = 0; +} + + +//DOM Level 2 +DOMDocumentImpl::DOMDocumentImpl(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName, + DOMDocumentType *doctype, + DOMImplementation* domImpl, + MemoryManager* const manager) + : fNode(this), + fParent(this), + fNodeIDMap(0), + fInputEncoding(0), + fXmlEncoding(0), + fXmlStandalone(false), + fXmlVersion(0), + fDocumentURI(0), + fDOMConfiguration(0), + fUserDataTableKeys(17, manager), + fUserDataTable(0), + fCurrentBlock(0), + fFreePtr(0), + fFreeBytesRemaining(0), + fHeapAllocSize(kInitialHeapAllocSize), + fRecycleNodePtr(0), + fRecycleBufferPtr(0), + fNodeListPool(0), + fDocType(0), + fDocElement(0), + fNameTableSize(257), + fNormalizer(0), + fRanges(0), + fNodeIterators(0), + fMemoryManager(manager), + fDOMImplementation(domImpl), + fChanges(0), + errorChecking(true) +{ + fNameTable = (DOMStringPoolEntry**)allocate ( + sizeof (DOMStringPoolEntry*) * fNameTableSize); + for (XMLSize_t i = 0; i < fNameTableSize; i++) + fNameTable[i] = 0; + + try { + setDocumentType(doctype); + + if (qualifiedName) + appendChild(createElementNS(fNamespaceURI, qualifiedName)); //root element + else if (fNamespaceURI) + throw DOMException(DOMException::NAMESPACE_ERR, 0, getMemoryManager()); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) { + this->deleteHeap(); + throw; + } +} + +void DOMDocumentImpl::setDocumentType(DOMDocumentType *doctype) +{ + if (!doctype) + return; + + // New doctypes can be created either with the factory methods on DOMImplementation, in + // which case ownerDocument will be 0, or with methods on DocumentImpl, in which case + // ownerDocument will be set, but the DocType won't yet be a child of the document. + // + DOMDocument* doc = doctype->getOwnerDocument(); + if (doc != 0 && doc != this) + throw DOMException( //one doctype can belong to only one DOMDocumentImpl + DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager()); + + DOMDocumentTypeImpl* doctypeImpl = (DOMDocumentTypeImpl*) doctype; + doctypeImpl->setOwnerDocument(this); + + // The doctype can not have any Entities or Notations yet, because they can not + // be created except through factory methods on a document. + + // revisit. What if this doctype is already a child of the document? + appendChild(doctype); + +} + +DOMDocumentImpl::~DOMDocumentImpl() +{ + // While DOMConfiguration is allocated on the Document's heap, itself + // it uses the memory manager directly. This means that while we cannot + // delete with operator delete, we need to call its d-tor. + // + if (fDOMConfiguration) + fDOMConfiguration->~DOMConfiguration (); + + // Clean up the fNodeListPool + if (fNodeListPool) + fNodeListPool->cleanup(); + + if (fRanges) + delete fRanges; //fRanges->cleanup(); + + if (fNodeIterators) + delete fNodeIterators;//fNodeIterators->cleanup(); + + if (fUserDataTable) + delete fUserDataTable;//fUserDataTable->cleanup(); + + if (fRecycleNodePtr) { + fRecycleNodePtr->deleteAllElements(); + delete fRecycleNodePtr; + } + + if (fRecycleBufferPtr) { + delete fRecycleBufferPtr; + } + + delete fNormalizer; + + // Delete the heap for this document. This uncerimoniously yanks the storage + // out from under all of the nodes in the document. Destructors are NOT called. + this->deleteHeap(); +} + + +DOMNode *DOMDocumentImpl::cloneNode(bool deep) const { + + // Note: the cloned document node goes on the same heap we live in. + DOMDocumentImpl *newdoc = new (fMemoryManager) DOMDocumentImpl(fDOMImplementation, fMemoryManager); + if(fXmlEncoding && *fXmlEncoding) + newdoc->setXmlEncoding(fXmlEncoding); + if(fXmlVersion && *fXmlVersion) + newdoc->setXmlVersion(fXmlVersion); + newdoc->setXmlStandalone(fXmlStandalone); + + // then the children by _importing_ them + if (deep) + for (DOMNode *n = this->getFirstChild(); n != 0; n = n->getNextSibling()) { + newdoc->appendChild(newdoc->importNode(n, true, true)); + } + + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newdoc); + return newdoc; +} + + +const XMLCh * DOMDocumentImpl::getNodeName() const { + static const XMLCh nam[] = // "#document" + {chPound, chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, 0}; + return nam; +} + + +DOMNode::NodeType DOMDocumentImpl::getNodeType() const { + return DOMNode::DOCUMENT_NODE; +} + + +// even though ownerDocument refers to this in this implementation +// the DOM Level 2 spec says it must be 0, so make it appear so +DOMDocument * DOMDocumentImpl::getOwnerDocument() const { + return 0; +} + + +DOMAttr *DOMDocumentImpl::createAttribute(const XMLCh *nam) +{ + if(!nam || !isXMLName(nam)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + return new (this, DOMMemoryManager::ATTR_OBJECT) DOMAttrImpl(this,nam); +} + + + +DOMCDATASection *DOMDocumentImpl::createCDATASection(const XMLCh *data) { + return new (this, DOMMemoryManager::CDATA_SECTION_OBJECT) DOMCDATASectionImpl(this,data); +} + + + +DOMComment *DOMDocumentImpl::createComment(const XMLCh *data) +{ + return new (this, DOMMemoryManager::COMMENT_OBJECT) DOMCommentImpl(this, data); +} + + + +DOMDocumentFragment *DOMDocumentImpl::createDocumentFragment() +{ + return new (this, DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT) DOMDocumentFragmentImpl(this); +} + + + +DOMDocumentType *DOMDocumentImpl::createDocumentType(const XMLCh *nam) +{ + if (!nam || !isXMLName(nam)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(this, nam, false); +} + + + +DOMDocumentType * + DOMDocumentImpl::createDocumentType(const XMLCh *qualifiedName, + const XMLCh *publicId, + const XMLCh *systemId) +{ + if (!qualifiedName || !isXMLName(qualifiedName)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(this, qualifiedName, publicId, systemId, false); +} + + + +DOMElement *DOMDocumentImpl::createElement(const XMLCh *tagName) +{ + if(!tagName || !isXMLName(tagName)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + + return new (this, DOMMemoryManager::ELEMENT_OBJECT) DOMElementImpl(this,tagName); +} + + +DOMElement *DOMDocumentImpl::createElementNoCheck(const XMLCh *tagName) +{ + return new (this, DOMMemoryManager::ELEMENT_OBJECT) DOMElementImpl(this, tagName); +} + + + + +DOMEntity *DOMDocumentImpl::createEntity(const XMLCh *nam) +{ + if (!nam || !isXMLName(nam)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::ENTITY_OBJECT) DOMEntityImpl(this, nam); +} + + + +DOMEntityReference *DOMDocumentImpl::createEntityReference(const XMLCh *nam) +{ + if (!nam || !isXMLName(nam)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(this, nam); +} + +DOMEntityReference *DOMDocumentImpl::createEntityReferenceByParser(const XMLCh *nam) +{ + if (!nam || !isXMLName(nam)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(this, nam, false); +} + +DOMNotation *DOMDocumentImpl::createNotation(const XMLCh *nam) +{ + if (!nam || !isXMLName(nam)) + throw DOMException( + DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager()); + + return new (this, DOMMemoryManager::NOTATION_OBJECT) DOMNotationImpl(this, nam); +} + + + +DOMProcessingInstruction *DOMDocumentImpl::createProcessingInstruction( + const XMLCh *target, const XMLCh *data) +{ + if(!target || !isXMLName(target)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + return new (this, DOMMemoryManager::PROCESSING_INSTRUCTION_OBJECT) DOMProcessingInstructionImpl(this,target,data); +} + + + + +DOMText *DOMDocumentImpl::createTextNode(const XMLCh *data) +{ + return new (this, DOMMemoryManager::TEXT_OBJECT) DOMTextImpl(this,data); +} + + +DOMNodeIterator* DOMDocumentImpl::createNodeIterator ( + DOMNode *root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion) +{ + if (!root) { + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + return 0; + } + + DOMNodeIteratorImpl* nodeIterator = new (this) DOMNodeIteratorImpl(this, root, whatToShow, filter, entityReferenceExpansion); + + if (fNodeIterators == 0L) { + //fNodeIterators = new (this) NodeIterators(1, false); + fNodeIterators = new (fMemoryManager) NodeIterators(1, false, fMemoryManager); + } + fNodeIterators->addElement(nodeIterator); + + return nodeIterator; +} + + +NodeIterators* DOMDocumentImpl::getNodeIterators() const +{ + return fNodeIterators; +} + +void DOMDocumentImpl::removeNodeIterator(DOMNodeIteratorImpl* nodeIterator) +{ + if (fNodeIterators != 0) { + XMLSize_t sz = fNodeIterators->size(); + if (sz !=0) { + for (XMLSize_t i =0; ielementAt(i) == nodeIterator) { + fNodeIterators->removeElementAt(i); + break; + } + } + } + } +} + + +DOMXPathExpression* DOMDocumentImpl::createExpression(const XMLCh * expression, const DOMXPathNSResolver *resolver) +{ + return new (getMemoryManager()) DOMXPathExpressionImpl(expression, resolver, getMemoryManager()); +} + +DOMXPathNSResolver* DOMDocumentImpl::createNSResolver(const DOMNode *nodeResolver) +{ + return new (getMemoryManager()) DOMXPathNSResolverImpl(nodeResolver, getMemoryManager()); +} + +DOMXPathResult* DOMDocumentImpl::evaluate(const XMLCh *expression, + const DOMNode *contextNode, + const DOMXPathNSResolver *resolver, + DOMXPathResult::ResultType type, + DOMXPathResult* result) +{ + JanitorMemFunCall expr( + createExpression(expression, resolver), + &DOMXPathExpression::release); + return expr->evaluate(contextNode, type, result); +} + + + +DOMTreeWalker* DOMDocumentImpl::createTreeWalker ( + DOMNode *root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion) +{ + if (!root) { + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + return 0; + } + + return new (this) DOMTreeWalkerImpl(root, whatToShow, filter, entityReferenceExpansion); +} + + + + +DOMDocumentType *DOMDocumentImpl::getDoctype() const +{ + return fDocType; +} + + + +DOMElement *DOMDocumentImpl::getDocumentElement() const +{ + return fDocElement; +} + + + +DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const +{ + // cast off the const of this because we will update the fNodeListPool + return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname); +} + + +DOMImplementation *DOMDocumentImpl::getImplementation() const { + + return fDOMImplementation; +} + + +DOMNode *DOMDocumentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) +{ + // Only one such child permitted + if( + (newChild->getNodeType() == DOMNode::ELEMENT_NODE && fDocElement!=0) + || + (newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE && fDocType!=0) + ) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, getMemoryManager()); + + // if the newChild is a documenttype node created from domimplementation, set the ownerDoc first + if ((newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) && !newChild->getOwnerDocument()) + ((DOMDocumentTypeImpl*)newChild)->setOwnerDocument(this); + + fParent.insertBefore(newChild,refChild); + + // If insert succeeded, cache the kid appropriately + if(newChild->getNodeType() == DOMNode::ELEMENT_NODE) + fDocElement=(DOMElement *)newChild; + else if(newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) + fDocType=(DOMDocumentType *)newChild; + + return newChild; +} + + +DOMNode* DOMDocumentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) { + DOMDocumentType* tempDocType = fDocType; + DOMElement* tempDocElement = fDocElement; + + if(oldChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) + fDocType=0; + else if(oldChild->getNodeType() == DOMNode::ELEMENT_NODE) + fDocElement=0; + + try { + insertBefore(newChild, oldChild); + // changed() already done. + + if((oldChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) + || (oldChild->getNodeType() == DOMNode::ELEMENT_NODE)) + return fParent.removeChild(oldChild); + else + return removeChild(oldChild); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + fDocType = tempDocType; + fDocElement = tempDocElement; + throw; + } +} + +bool DOMDocumentImpl::isXMLName(const XMLCh *s) +{ + // fXmlVersion points directly to the static constants + if (fXmlVersion==XMLUni::fgVersion1_1) + return XMLChar1_1::isValidName(s); + else + return XMLChar1_0::isValidName(s); +} + + + + +DOMNode *DOMDocumentImpl::removeChild(DOMNode *oldChild) +{ + fParent.removeChild(oldChild); + + // If remove succeeded, un-cache the kid appropriately + if(oldChild->getNodeType() == DOMNode::ELEMENT_NODE) + fDocElement=0; + else if(oldChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) + fDocType=0; + + return oldChild; +} + + + +void DOMDocumentImpl::setNodeValue(const XMLCh *x) +{ + fNode.setNodeValue(x); +} + + +//Introduced in DOM Level 2 +DOMNode *DOMDocumentImpl::importNode(const DOMNode *source, bool deep) +{ + return importNode(source, deep, false); +} + + +DOMElement *DOMDocumentImpl::createElementNS(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName) +{ + if(!qualifiedName || !isXMLName(qualifiedName)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + + return new (this, DOMMemoryManager::ELEMENT_NS_OBJECT) DOMElementNSImpl(this, fNamespaceURI, qualifiedName); +} + +DOMElement *DOMDocumentImpl::createElementNS(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName, + const XMLFileLoc lineNo, + const XMLFileLoc columnNo) +{ + if(!qualifiedName || !isXMLName(qualifiedName)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + + return new (this) XSDElementNSImpl(this, fNamespaceURI, qualifiedName, lineNo, columnNo); +} + + +DOMAttr *DOMDocumentImpl::createAttributeNS(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName) +{ + if(!qualifiedName || !isXMLName(qualifiedName)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager()); + return new (this, DOMMemoryManager::ATTR_NS_OBJECT) DOMAttrNSImpl(this, fNamespaceURI, qualifiedName); +} + + +DOMNodeList *DOMDocumentImpl::getElementsByTagNameNS(const XMLCh *fNamespaceURI, + const XMLCh *fLocalName) const +{ + // cast off the const of this because we will update the fNodeListPool + return ((DOMDocumentImpl*)this)->getDeepNodeList(this, fNamespaceURI, fLocalName); +} + + +DOMElement *DOMDocumentImpl::getElementById(const XMLCh *elementId) const +{ + if (fNodeIDMap == 0) + return 0; + + DOMAttr *theAttr = fNodeIDMap->find(elementId); + if (theAttr == 0) + return 0; + + return theAttr->getOwnerElement(); +} + +const XMLCh* DOMDocumentImpl::getBaseURI() const +{ + return fDocumentURI; +} + +DOMRange* DOMDocumentImpl::createRange() +{ + + DOMRangeImpl* range = new (this) DOMRangeImpl(this, fMemoryManager); + + if (fRanges == 0L) { + //fRanges = new (this) Ranges(1, false); + fRanges = new (fMemoryManager) Ranges(1, false, fMemoryManager); // XMemory + } + fRanges->addElement(range); + return range; +} + +Ranges* DOMDocumentImpl::getRanges() const +{ + return fRanges; +} + +void DOMDocumentImpl::removeRange(DOMRangeImpl* range) +{ + if (fRanges != 0) { + XMLSize_t sz = fRanges->size(); + if (sz !=0) { + for (XMLSize_t i =0; ielementAt(i) == range) { + fRanges->removeElementAt(i); + break; + } + } + } + } +} + +/** Uses the kidOK lookup table to check whether the proposed + tree structure is legal. + + ????? It feels like there must be a more efficient solution, + but for the life of me I can't think what it would be. +*/ +bool DOMDocumentImpl::isKidOK(DOMNode *parent, DOMNode *child) +{ + static int kidOK[14]; + + if (kidOK[DOMNode::ATTRIBUTE_NODE] == 0) + { + kidOK[DOMNode::DOCUMENT_NODE] = + 1 << DOMNode::ELEMENT_NODE | + 1 << DOMNode::PROCESSING_INSTRUCTION_NODE | + 1 << DOMNode::COMMENT_NODE | + 1 << DOMNode::DOCUMENT_TYPE_NODE; + + kidOK[DOMNode::DOCUMENT_FRAGMENT_NODE] = + kidOK[DOMNode::ENTITY_NODE] = + kidOK[DOMNode::ENTITY_REFERENCE_NODE] = + kidOK[DOMNode::ELEMENT_NODE] = + 1 << DOMNode::ELEMENT_NODE | + 1 << DOMNode::PROCESSING_INSTRUCTION_NODE | + 1 << DOMNode::COMMENT_NODE | + 1 << DOMNode::TEXT_NODE | + 1 << DOMNode::CDATA_SECTION_NODE | + 1 << DOMNode::ENTITY_REFERENCE_NODE; + + kidOK[DOMNode::ATTRIBUTE_NODE] = + 1 << DOMNode::TEXT_NODE | + 1 << DOMNode::ENTITY_REFERENCE_NODE; + + kidOK[DOMNode::PROCESSING_INSTRUCTION_NODE] = + kidOK[DOMNode::COMMENT_NODE] = + kidOK[DOMNode::TEXT_NODE] = + kidOK[DOMNode::CDATA_SECTION_NODE] = + kidOK[DOMNode::NOTATION_NODE] = + 0; + } + int p=parent->getNodeType(); + int ch = child->getNodeType(); + return ((kidOK[p] & 1<getXmlVersion(), XMLUni::fgVersion1_1))? + XMLChar1_1::isAllSpaces(child->getNodeValue(), XMLString::stringLen(child->getNodeValue())): + XMLChar1_0::isAllSpaces(child->getNodeValue(), XMLString::stringLen(child->getNodeValue()))) + ); +} + +void DOMDocumentImpl::changed() +{ + fChanges++; +} + + +int DOMDocumentImpl::changes() const{ + return fChanges; +} + + + +// +// Delegation for functions inherited from DOMNode +// + DOMNode* DOMDocumentImpl::appendChild(DOMNode *newChild) {return insertBefore(newChild, 0); } + DOMNamedNodeMap* DOMDocumentImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMDocumentImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMDocumentImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMDocumentImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMDocumentImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMDocumentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMDocumentImpl::getNextSibling() const {return fNode.getNextSibling (); } + const XMLCh* DOMDocumentImpl::getNodeValue() const {return fNode.getNodeValue (); } + const XMLCh* DOMDocumentImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMDocumentImpl::getParentNode() const {return fNode.getParentNode (); } + DOMNode* DOMDocumentImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } + bool DOMDocumentImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + void DOMDocumentImpl::normalize() {fParent.normalize (); } + void DOMDocumentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMDocumentImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMDocumentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other);} + bool DOMDocumentImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg);} + void* DOMDocumentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMDocumentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMDocumentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMDocumentImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMDocumentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMDocumentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMDocumentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMDocumentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + + + + +//----------------------------------------------------------------------- +// +// Per Document Heap and Heap Helper functions +// +// revisit - this stuff should be a class of its own, rather than +// just lying around naked in DocumentImpl. +// +//----------------------------------------------------------------------- + +XMLCh * DOMDocumentImpl::cloneString(const XMLCh *src) +{ + if (!src) return 0; + XMLSize_t len = XMLString::stringLen(src); + len = (len + 1) * sizeof(XMLCh); + len = (len % 4) + len; + XMLCh *newStr = (XMLCh *)this->allocate(len); + XMLString::copyString(newStr, src); + return newStr; +} + +XMLSize_t DOMDocumentImpl::getMemoryAllocationBlockSize() const +{ + return fHeapAllocSize; +} + +void DOMDocumentImpl::setMemoryAllocationBlockSize(XMLSize_t size) +{ + // the new size must be bigger than the maximum amount of each allocation + if(size>kMaxSubAllocationSize) + fHeapAllocSize=size; +} + +void* DOMDocumentImpl::allocate(XMLSize_t amount) +{ + // Align the request size so that suballocated blocks + // beyond this one will be maintained at the same alignment. + amount = XMLPlatformUtils::alignPointerForNewBlockAllocation(amount); + + // If the request is for a largish block, hand it off to the system + // allocator. The block still must be linked into the list of + // allocated blocks so that it will be deleted when the time comes. + if (amount > kMaxSubAllocationSize) + { + // The size of the header we add to our raw blocks + XMLSize_t sizeOfHeader = XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(void *)); + + // Try to allocate the block + void* newBlock; + newBlock = fMemoryManager->allocate(sizeOfHeader + amount); + + // Link it into the list beyond current block, as current block + // is still being subdivided. If there is no current block + // then track that we have no bytes to further divide. + if (fCurrentBlock) + { + *(void **)newBlock = *(void **)fCurrentBlock; + *(void **)fCurrentBlock = newBlock; + } + else + { + *(void **)newBlock = 0; + fCurrentBlock = newBlock; + fFreePtr = 0; + fFreeBytesRemaining = 0; + } + + void *retPtr = (char*)newBlock + sizeOfHeader; + return retPtr; + } + + // It's a normal (sub-allocatable) request. + // Are we out of room in our current block? + if (amount > fFreeBytesRemaining) + { + // Request doesn't fit in the current block. + // The size of the header we add to our raw blocks + XMLSize_t sizeOfHeader = XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(void *)); + + // Get a new block from the system allocator. + void* newBlock; + newBlock = fMemoryManager->allocate(fHeapAllocSize); + + *(void **)newBlock = fCurrentBlock; + fCurrentBlock = newBlock; + fFreePtr = (char *)newBlock + sizeOfHeader; + fFreeBytesRemaining = fHeapAllocSize - sizeOfHeader; + + if(fHeapAllocSizedeallocate(fCurrentBlock); + fCurrentBlock = nextBlock; + } +} + + +DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName) +{ + if(!fNodeListPool) { + fNodeListPool = new (this) DOMDeepNodeListPool(109, false); + } + + DOMDeepNodeListImpl* retList = fNodeListPool->getByKey(rootNode, tagName, 0); + if (!retList) { + XMLSize_t id = fNodeListPool->put((void*) rootNode, (XMLCh*) tagName, 0, new (this) DOMDeepNodeListImpl(rootNode, tagName)); + retList = fNodeListPool->getById(id); + } + + return retList; +} + + +DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, //DOM Level 2 + const XMLCh *namespaceURI, + const XMLCh *localName) +{ + if(!fNodeListPool) { + fNodeListPool = new (this) DOMDeepNodeListPool(109, false); + } + + DOMDeepNodeListImpl* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI); + if (!retList) { + // the pool will adopt the DOMDeepNodeListImpl + XMLSize_t id = fNodeListPool->put((void*) rootNode, (XMLCh*) localName, (XMLCh*) namespaceURI, new (this) DOMDeepNodeListImpl(rootNode, namespaceURI, localName)); + retList = fNodeListPool->getById(id); + } + + return retList; +} + + +//Introduced in DOM Level 3 +const XMLCh* DOMDocumentImpl::getInputEncoding() const { + return fInputEncoding; +} + +void DOMDocumentImpl::setInputEncoding(const XMLCh* actualEncoding){ + fInputEncoding = cloneString(actualEncoding); +} + +const XMLCh* DOMDocumentImpl::getXmlEncoding() const { + return fXmlEncoding; +} + +void DOMDocumentImpl::setXmlEncoding(const XMLCh* encoding){ + fXmlEncoding = cloneString(encoding); +} + +bool DOMDocumentImpl::getXmlStandalone() const{ + return fXmlStandalone; +} + +void DOMDocumentImpl::setXmlStandalone(bool standalone){ + fXmlStandalone = standalone; +} + +const XMLCh* DOMDocumentImpl::getXmlVersion() const { + return fXmlVersion; +} + +void DOMDocumentImpl::setXmlVersion(const XMLCh* version){ + + // store the static strings, so that comparisons will be faster + if(version==0) + fXmlVersion = 0; + else if(*version==0) + fXmlVersion = XMLUni::fgZeroLenString; + else if(XMLString::equals(version, XMLUni::fgVersion1_0)) + fXmlVersion = XMLUni::fgVersion1_0; + else if(XMLString::equals(version, XMLUni::fgVersion1_1)) + fXmlVersion = XMLUni::fgVersion1_1; + else + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); +} + +const XMLCh* DOMDocumentImpl::getDocumentURI() const +{ + return fDocumentURI; +} + +void DOMDocumentImpl::setDocumentURI(const XMLCh* documentURI){ + if (documentURI && *documentURI) { + XMLCh* temp = (XMLCh*) this->allocate((XMLString::stringLen(documentURI) + 9)*sizeof(XMLCh)); + XMLString::fixURI(documentURI, temp); + fDocumentURI = temp; + } + else + fDocumentURI = 0; +} + +bool DOMDocumentImpl::getStrictErrorChecking() const { + return getErrorChecking(); +} + +void DOMDocumentImpl::setStrictErrorChecking(bool strictErrorChecking) { + setErrorChecking(strictErrorChecking); +} + +DOMNode* DOMDocumentImpl::adoptNode(DOMNode* sourceNode) { + if(sourceNode->getOwnerDocument()!=this) + { + // cannot take ownership of a node created by another document, as it comes from its memory pool + // and would be delete when the original document is deleted + return 0; + } + // if the adopted node is already part of this document (i.e. the source and target document are the same), + // this method still has the effect of removing the source node from the child list of its parent, if any + switch(sourceNode->getNodeType()) + { + case DOCUMENT_NODE: + case DOCUMENT_TYPE_NODE: + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + case ATTRIBUTE_NODE: + { + DOMAttr* sourceAttr=(DOMAttr*)sourceNode; + DOMElement* sourceAttrElem=sourceAttr->getOwnerElement(); + if(sourceAttrElem) + sourceAttrElem->removeAttributeNode(sourceAttr); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_ADOPTED, sourceNode, sourceNode); + break; + } + default: + { + DOMNode* sourceNodeParent=sourceNode->getParentNode(); + if(sourceNodeParent) + sourceNodeParent->removeChild(sourceNode); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_ADOPTED, sourceNode, sourceNode); + } + } + return 0; +} + +void DOMDocumentImpl::normalizeDocument() { + + if(!fNormalizer) + fNormalizer = new (fMemoryManager) DOMNormalizer(fMemoryManager); + + fNormalizer->normalizeDocument(this); +} + +DOMConfiguration* DOMDocumentImpl::getDOMConfig() const { + if(!fDOMConfiguration) + ((DOMDocumentImpl*)this)->fDOMConfiguration = new ((DOMDocumentImpl*)this) DOMConfigurationImpl(fMemoryManager); + + return fDOMConfiguration; +} + +DOMNode *DOMDocumentImpl::importNode(const DOMNode *source, bool deep, bool cloningDoc) +{ + DOMNode *newnode=0; + bool oldErrorCheckingFlag = errorChecking; + + switch (source->getNodeType()) + { + case DOMNode::ELEMENT_NODE : + { + DOMElement *newelement; + if (source->getLocalName() == 0) + newelement = createElement(source->getNodeName()); + else + { + DOMElementNSImpl* nsElem = (DOMElementNSImpl*)createElementNS(source->getNamespaceURI(), source->getNodeName()); + DOMTypeInfoImpl* clonedTypeInfo=NULL; + // if the source has type informations, copy them + DOMPSVITypeInfo* sourcePSVI=(DOMPSVITypeInfo*)source->getFeature(XMLUni::fgXercescInterfacePSVITypeInfo, 0); + if(sourcePSVI && sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified)) + clonedTypeInfo=new (this) DOMTypeInfoImpl(this, sourcePSVI); + else + { + const DOMTypeInfo * typeInfo=((DOMElement*)source)->getSchemaTypeInfo(); + // copy it only if it has valid data + if(typeInfo && typeInfo->getTypeName()!=NULL) + clonedTypeInfo=new (this) DOMTypeInfoImpl(typeInfo->getTypeNamespace(), typeInfo->getTypeName()); + } + if(clonedTypeInfo) + nsElem->setSchemaTypeInfo(clonedTypeInfo); + newelement=nsElem; + } + DOMNamedNodeMap *srcattr=source->getAttributes(); + if(srcattr!=0) + for(XMLSize_t i=0;igetLength();++i) + { + DOMAttr *attr = (DOMAttr *) srcattr->item(i); + if (attr -> getSpecified() || cloningDoc) { // not a default attribute or we are in the process of cloning the elements from inside a DOMDocumentType + DOMAttr *nattr = (DOMAttr *) importNode(attr, true, cloningDoc); + if (attr -> getLocalName() == 0) + newelement->setAttributeNode(nattr); + else + newelement->setAttributeNodeNS(nattr); + + // if the imported attribute is of ID type, register the new node in fNodeIDMap + if (attr->isId()) { + castToNodeImpl(nattr)->isIdAttr(true); + if (!fNodeIDMap) + fNodeIDMap = new (this) DOMNodeIDMap(500, this); + fNodeIDMap->add((DOMAttr*)nattr); + } + } + } + newnode=newelement; + + } + break; + case DOMNode::ATTRIBUTE_NODE : + { + DOMAttrImpl* newattr=NULL; + if (source->getLocalName() == 0) + newattr = (DOMAttrImpl*)createAttribute(source->getNodeName()); + else { + newattr = (DOMAttrImpl*)createAttributeNS(source->getNamespaceURI(), source->getNodeName()); + } + DOMTypeInfoImpl* clonedTypeInfo=NULL; + // if the source has type informations, copy them + DOMPSVITypeInfo* sourcePSVI=(DOMPSVITypeInfo*)source->getFeature(XMLUni::fgXercescInterfacePSVITypeInfo, 0); + if(sourcePSVI && sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified)) + clonedTypeInfo=new (this) DOMTypeInfoImpl(this, sourcePSVI); + else + { + const DOMTypeInfo * typeInfo=((DOMAttr*)source)->getSchemaTypeInfo(); + // copy it only if it has valid data + if(typeInfo && typeInfo->getTypeName()!=NULL) + clonedTypeInfo=new (this) DOMTypeInfoImpl(typeInfo->getTypeNamespace(), typeInfo->getTypeName()); + } + if(clonedTypeInfo) + newattr->setSchemaTypeInfo(clonedTypeInfo); + newnode=newattr; + } + deep = true; + // Kids carry value + + break; + case DOMNode::TEXT_NODE : + newnode = createTextNode(source->getNodeValue()); + break; + case DOMNode::CDATA_SECTION_NODE : + newnode = createCDATASection(source->getNodeValue()); + break; + case DOMNode::ENTITY_REFERENCE_NODE : + { + DOMEntityReferenceImpl* newentityRef = (DOMEntityReferenceImpl*)createEntityReference(source->getNodeName()); + newnode=newentityRef; + // Only the EntityReference itself is copied, even if a deep import is requested, since the source and + // destination documents might have defined the entity differently. + deep = false; + } + break; + case DOMNode::ENTITY_NODE : + { + DOMEntity *srcentity=(DOMEntity *)source; + DOMEntityImpl *newentity = (DOMEntityImpl *)createEntity(source->getNodeName()); + newentity->setPublicId(srcentity->getPublicId()); + newentity->setSystemId(srcentity->getSystemId()); + newentity->setNotationName(srcentity->getNotationName()); + newentity->setBaseURI(srcentity->getBaseURI()); + // Kids carry additional value + newnode=newentity; + castToNodeImpl(newentity)->setReadOnly(false, true);// allow deep import temporarily + } + break; + case DOMNode::PROCESSING_INSTRUCTION_NODE : + newnode = createProcessingInstruction(source->getNodeName(), source->getNodeValue()); + break; + case DOMNode::COMMENT_NODE : + newnode = createComment(source->getNodeValue()); + break; + case DOMNode::DOCUMENT_TYPE_NODE : + { + // unless this is used as part of cloning a Document + // forbid it for the sake of being compliant to the DOM spec + if (!cloningDoc) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + + DOMDocumentType *srcdoctype = (DOMDocumentType *)source; + DOMDocumentTypeImpl *newdoctype = (DOMDocumentTypeImpl *) + createDocumentType(srcdoctype->getNodeName(), + srcdoctype->getPublicId(), + srcdoctype->getSystemId()); + // Values are on NamedNodeMaps + DOMNamedNodeMap *smap = srcdoctype->getEntities(); + DOMNamedNodeMap *tmap = newdoctype->getEntities(); + if(smap != 0) { + for(XMLSize_t i = 0; i < smap->getLength(); i++) { + tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc)); + } + } + smap = srcdoctype->getNotations(); + tmap = newdoctype->getNotations(); + if (smap != 0) { + for(XMLSize_t i = 0; i < smap->getLength(); i++) { + tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc)); + } + } + const XMLCh* intSubset=srcdoctype->getInternalSubset(); + if(intSubset != 0) { + newdoctype->setInternalSubset(intSubset); + } + + // detect if the DTD being copied is our own implementation, and use the provided methods + try + { + DOMDocumentTypeImpl* docTypeImpl=(DOMDocumentTypeImpl*)(srcdoctype->getFeature(XMLUni::fgXercescInterfaceDOMDocumentTypeImpl, XMLUni::fgZeroLenString)); + if(docTypeImpl) + { + smap = docTypeImpl->getElements(); + tmap = newdoctype->getElements(); + if (smap != 0) { + for(XMLSize_t i = 0; i < smap->getLength(); i++) { + tmap->setNamedItem(importNode(smap->item(i), true, cloningDoc)); + } + } + } + } catch(DOMException&) { + } + + newnode = newdoctype; + } + break; + case DOMNode::DOCUMENT_FRAGMENT_NODE : + newnode = createDocumentFragment(); + // No name, kids carry value + break; + case DOMNode::NOTATION_NODE : + { + DOMNotation *srcnotation=(DOMNotation *)source; + DOMNotationImpl *newnotation = (DOMNotationImpl *)createNotation(source->getNodeName()); + newnotation->setPublicId(srcnotation->getPublicId()); + newnotation->setSystemId(srcnotation->getSystemId()); + newnotation->setBaseURI(srcnotation->getBaseURI()); + newnode=newnotation; + // No name, no value + break; + } + + case DOMNode::DOCUMENT_NODE : // Document can't be child of Document + default: // Unknown node type + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + } + + // If deep, replicate and attach the kids. + if (deep) + for (DOMNode *srckid = source->getFirstChild(); + srckid != 0; + srckid = srckid->getNextSibling()) + { + newnode->appendChild(importNode(srckid, true, cloningDoc)); + } + + if (newnode->getNodeType() == DOMNode::ENTITY_NODE) { + castToNodeImpl(newnode)->setReadOnly(true, true); + errorChecking = oldErrorCheckingFlag; + } + + if (cloningDoc) + { + // we know for sure that the source node is a DOMNodeImpl, as cloningDoc is set to true when + // a DOMDocumentImpl is cloned + castToNodeImpl(source)->callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, source, newnode); + } + else + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_IMPORTED, source, newnode); + + return newnode; +} + +// user data utility +void* DOMDocumentImpl::setUserData(DOMNodeImpl* n, const XMLCh* key, void* data, DOMUserDataHandler* handler) +{ + void* oldData = 0; + unsigned int keyId=fUserDataTableKeys.addOrFind(key); + + if (!fUserDataTable) { + // create the table on heap so that it can be cleaned in destructor + fUserDataTable = new (fMemoryManager) RefHash2KeysTableOf + ( + 109 + , true + , fMemoryManager + ); + } + else { + DOMUserDataRecord* oldDataRecord = fUserDataTable->get((void*)n, keyId); + + if (oldDataRecord) { + oldData = oldDataRecord->getKey(); + fUserDataTable->removeKey((void*)n, keyId); + } + } + + if (data) { + + // clone the key first, and create the DOMUserDataRecord + // create on the heap and adopted by the hashtable which will delete it upon removal. + fUserDataTable->put((void*)n, keyId, new (fMemoryManager) DOMUserDataRecord(data, handler)); + } + else { + RefHash2KeysTableOfEnumerator enumKeys(fUserDataTable, false, fMemoryManager); + enumKeys.setPrimaryKey(n); + if (!enumKeys.hasMoreElements()) + n->hasUserData(false); + } + + return oldData; +} + +void* DOMDocumentImpl::getUserData(const DOMNodeImpl* n, const XMLCh* key) const +{ + if (fUserDataTable) { + unsigned int keyId=fUserDataTableKeys.getId(key); + if(keyId!=0) { + DOMUserDataRecord* dataRecord = fUserDataTable->get((void*)n, keyId); + if (dataRecord) + return dataRecord->getKey(); + } + } + + return 0; +} + +void DOMDocumentImpl::callUserDataHandlers(const DOMNodeImpl* n, DOMUserDataHandler::DOMOperationType operation, const DOMNode* src, DOMNode* dst) const +{ + if (fUserDataTable) { + RefHash2KeysTableOfEnumerator userDataEnum(fUserDataTable, false, fMemoryManager); + userDataEnum.setPrimaryKey(n); + // Create a snapshot of the handlers to be called, as the "handle" callback could be invalidating the enumerator by calling + // setUserData on the dst node + ValueVectorOf< int > snapshot(3, fMemoryManager); + while (userDataEnum.hasMoreElements()) { + // get the key + void* key; + int key2; + userDataEnum.nextElementKey(key,key2); + snapshot.addElement(key2); + } + ValueVectorEnumerator< int > snapshotEnum(&snapshot); + while(snapshotEnum.hasMoreElements()) + { + int key2=snapshotEnum.nextElement(); + + // get the DOMUserDataRecord + DOMUserDataRecord* userDataRecord = fUserDataTable->get((void*)n,key2); + + // get the handler + DOMUserDataHandler* handler = userDataRecord->getValue(); + + if (handler) { + // get the data + void* data = userDataRecord->getKey(); + const XMLCh* userKey = fUserDataTableKeys.getValueForId(key2); + handler->handle(operation, userKey, data, src, dst); + } + } + // if the operation is NODE_DELETED, we in fact should remove the data from the table + if (operation == DOMUserDataHandler::NODE_DELETED) + fUserDataTable->removeKey((void*)n); + } +} + + +void DOMDocumentImpl::transferUserData(DOMNodeImpl* n1, DOMNodeImpl* n2) +{ + if (fUserDataTable) { + fUserDataTable->transferElement((void*)n1, (void*)n2); + n1->hasUserData(false); + n2->hasUserData(true); + } +} + + +DOMNode* DOMDocumentImpl::renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* name) +{ + if (n->getOwnerDocument() != this) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager()); + + switch (n->getNodeType()) { + case ELEMENT_NODE: + return ((DOMElementImpl*)n)->rename(namespaceURI, name); + case ATTRIBUTE_NODE: + return ((DOMAttrImpl*)n)->rename(namespaceURI, name); + default: + break; + } + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + + return 0; +} + +void DOMDocumentImpl::release() +{ + DOMDocument* doc = (DOMDocument*) this; + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + + // notify userdatahandler first, if we have some + if (fUserDataTable) + releaseDocNotifyUserData(this); + + // release the docType in case it was created from heap + if (fDocType) { + castToNodeImpl(fDocType)->isToBeReleased(true); + fDocType->release(); + } + + // delete the document memory pool + delete doc; +} + +void DOMDocumentImpl::releaseDocNotifyUserData(DOMNode* object) +{ + DOMNode *child = object->getFirstChild(); + + while( child != 0) + { + + DOMNamedNodeMap *attrlist=child->getAttributes(); + + if(attrlist!=0) + for(XMLSize_t i=0;igetLength();++i) + releaseDocNotifyUserData(attrlist->item(i)); + + releaseDocNotifyUserData(child); + child = child->getNextSibling(); + } + + castToNodeImpl(object)->callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); +} + +void DOMDocumentImpl::release(DOMNode* object, DOMMemoryManager::NodeObjectType type) +{ + if (!fRecycleNodePtr) + fRecycleNodePtr = new (fMemoryManager) RefArrayOf (15, fMemoryManager); + + if (!fRecycleNodePtr->operator[](type)) + fRecycleNodePtr->operator[](type) = new (fMemoryManager) RefStackOf (15, false, fMemoryManager); + + fRecycleNodePtr->operator[](type)->push(object); +} + +void DOMDocumentImpl::releaseBuffer(DOMBuffer* buffer) +{ + if (!fRecycleBufferPtr) + fRecycleBufferPtr = new (fMemoryManager) RefStackOf (15, false, fMemoryManager); + + fRecycleBufferPtr->push(buffer); +} + +DOMBuffer* DOMDocumentImpl::popBuffer(XMLSize_t nMinSize) +{ + if (!fRecycleBufferPtr || fRecycleBufferPtr->empty()) + return 0; + + for(XMLSize_t index=fRecycleBufferPtr->size()-1;index>0;index--) + if(fRecycleBufferPtr->elementAt(index)->getCapacity()>=nMinSize) + return fRecycleBufferPtr->popAt(index); + // if we didn't find a buffer big enough, get the last one + return fRecycleBufferPtr->pop(); +} + + +void * DOMDocumentImpl::allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) +{ + if (!fRecycleNodePtr) + return allocate(amount); + + DOMNodePtr* ptr = fRecycleNodePtr->operator[](type); + if (!ptr || ptr->empty()) + return allocate(amount); + + return (void*) ptr->pop(); + +} + +bool DOMDocumentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const +{ + // check for '+DOMMemoryManager' + if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfaceDOMMemoryManager)) + return true; + if(feature && *feature) + { + if((*feature==chPlus && XMLString::equals(feature+1, XMLUni::fgXercescInterfaceDOMDocumentImpl)) || + XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentImpl)) + return true; + } + return fNode.isSupported (feature, version); +} + +void* DOMDocumentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const +{ + if(XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMMemoryManager)) + return (DOMMemoryManager*)this; + if(XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentImpl)) + return (DOMDocumentImpl*)this; + return fNode.getFeature(feature,version); +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.hpp new file mode 100644 index 000000000..76deafc36 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentImpl.hpp @@ -0,0 +1,507 @@ +/* + * 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: DOMDocumentImpl.hpp 679340 2008-07-24 10:28:29Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "DOMNodeImpl.hpp" +#include "DOMStringPool.hpp" +#include "DOMParentNode.hpp" +#include "DOMDeepNodeListPool.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMAttrImpl; +class DOMCDATASectionImpl; +class DOMCommentImpl; +class DOMConfiguration; +class DOMDeepNodeListImpl; +class DOMDocumentFragmentImpl; +class DOMDocumentTypeImpl; +class DOMElementImpl; +class DOMEntityImpl; +class DOMEntityReferenceImpl; +class DOMNotationImpl; +class DOMProcessingInstructionImpl; +class DOMTextImpl; +class DOMNodeIteratorImpl; +class DOMNormalizer; +class DOMTreeWalkerImpl; +class DOMNodeFilter; +class DOMNodeFilterImpl; +class DOMImplementation; +class DOMNodeIDMap; +class DOMRangeImpl; +class DOMBuffer; +class MemoryManager; +class XPathNSResolver; +class XPathExpression; + +typedef RefVectorOf Ranges; +typedef RefVectorOf NodeIterators; +typedef KeyRefPair DOMUserDataRecord; +typedef RefStackOf DOMNodePtr; + +class CDOM_EXPORT DOMDocumentImpl: public XMemory, public DOMMemoryManager, public DOMDocument { +public: + // ----------------------------------------------------------------------- + // data + // ----------------------------------------------------------------------- + DOMNodeImpl fNode; // Implements common node functionality. + DOMParentNode fParent; // Implements common parent node functionality + DOMNodeIDMap* fNodeIDMap; // for use by GetElementsById(). + +public: + DOMDocumentImpl(DOMImplementation* domImpl, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + DOMDocumentImpl(const XMLCh* namespaceURI, //DOM Level 2 + const XMLCh* qualifiedName, + DOMDocumentType* doctype, + DOMImplementation* domImpl, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~DOMDocumentImpl(); + + void setDocumentType(DOMDocumentType *doctype); + +public: + // Add all functions that are pure virtual in DOMNODE + DOMNODE_FUNCTIONS; + +public: + // Add all functions that are pure virtual in DOMDocument + virtual DOMAttr* createAttribute(const XMLCh *name); + virtual DOMCDATASection* createCDATASection(const XMLCh *data); + virtual DOMComment* createComment(const XMLCh *data); + virtual DOMDocumentFragment* createDocumentFragment(); + virtual DOMDocumentType* createDocumentType(const XMLCh *name); + virtual DOMDocumentType* createDocumentType(const XMLCh *qName, + const XMLCh *publicId, + const XMLCh *systemId); + virtual DOMElement* createElement(const XMLCh * tagName); + virtual DOMElement* createElementNoCheck(const XMLCh *tagName); + virtual DOMEntity* createEntity(const XMLCh * name); + virtual DOMEntityReference* createEntityReference(const XMLCh * name); + virtual DOMNotation* createNotation(const XMLCh * name); + virtual DOMProcessingInstruction* createProcessingInstruction(const XMLCh * target, const XMLCh * data); + virtual DOMText* createTextNode(const XMLCh * data); + virtual DOMDocumentType* getDoctype() const; + virtual DOMElement* getDocumentElement() const; + virtual DOMNodeList* getElementsByTagName(const XMLCh * tagname) const; + virtual DOMImplementation* getImplementation() const; + bool isXMLName(const XMLCh * s); + virtual DOMNodeIterator* createNodeIterator(DOMNode *root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion); + virtual DOMTreeWalker* createTreeWalker(DOMNode *root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* filter, + bool entityReferenceExpansion); + + + virtual DOMRange* createRange(); + virtual Ranges* getRanges() const; //non-standard api + virtual NodeIterators* getNodeIterators() const; //non-standard api + virtual void removeRange(DOMRangeImpl* range); //non-standard api + virtual void removeNodeIterator(DOMNodeIteratorImpl* nodeIterator); //non-standard api + + virtual DOMXPathExpression* createExpression(const XMLCh *expression, + const DOMXPathNSResolver *resolver); + virtual DOMXPathNSResolver* createNSResolver(const DOMNode *nodeResolver); + virtual DOMXPathResult* evaluate(const XMLCh *expression, + const DOMNode *contextNode, + const DOMXPathNSResolver *resolver, + DOMXPathResult::ResultType type, + DOMXPathResult* result); + + + // Extension to be called by the Parser + DOMEntityReference* createEntityReferenceByParser(const XMLCh * name); + + // Add all functions that are pure virtual in DOMMemoryManager + virtual XMLSize_t getMemoryAllocationBlockSize() const; + virtual void setMemoryAllocationBlockSize(XMLSize_t size); + virtual void* allocate(XMLSize_t amount); + virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type); + virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type); + virtual XMLCh* cloneString(const XMLCh *src); + + // + // Functions to keep track of document mutations, so that node list chached + // information can be invalidated. One global changes counter per document. + // + virtual void changed(); + virtual int changes() const; + + /** + * Sets whether the DOM implementation performs error checking + * upon operations. Turning off error checking only affects + * the following DOM checks: + *

    + *
  • Checking strings to make sure that all characters are + * legal XML characters + *
  • Hierarchy checking such as allowed children, checks for + * cycles, etc. + *
+ *

+ * Turning off error checking does not turn off the + * following checks: + *

    + *
  • Read only checks + *
  • Checks related to DOM events + *
+ */ + inline void setErrorChecking(bool check) { + errorChecking = check; + } + + /** + * Returns true if the DOM implementation performs error checking. + */ + inline bool getErrorChecking() const { + return errorChecking; + } + + //Introduced in DOM Level 2 + virtual DOMNode* importNode(const DOMNode *source, bool deep); + virtual DOMElement* createElementNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName); + virtual DOMElement* createElementNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + const XMLFileLoc lineNo, + const XMLFileLoc columnNo); + virtual DOMAttr* createAttributeNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName); + virtual DOMNodeList* getElementsByTagNameNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual DOMElement* getElementById(const XMLCh *elementId) const; + + //Introduced in DOM Level 3 + virtual const XMLCh* getInputEncoding() const; + virtual const XMLCh* getXmlEncoding() const; + virtual bool getXmlStandalone() const; + virtual void setXmlStandalone(bool standalone); + virtual const XMLCh* getXmlVersion() const; + virtual void setXmlVersion(const XMLCh* version); + virtual const XMLCh* getDocumentURI() const; + virtual void setDocumentURI(const XMLCh* documentURI); + virtual bool getStrictErrorChecking() const; + virtual void setStrictErrorChecking(bool strictErrorChecking); + virtual DOMNode* adoptNode(DOMNode* source); + virtual void normalizeDocument(); + virtual DOMConfiguration* getDOMConfig() const; + + void setInputEncoding(const XMLCh* actualEncoding); + void setXmlEncoding(const XMLCh* encoding); + // helper functions to prevent storing userdata pointers on every node. + void* setUserData(DOMNodeImpl* n, + const XMLCh* key, + void* data, + DOMUserDataHandler* handler); + void* getUserData(const DOMNodeImpl* n, + const XMLCh* key) const; + void callUserDataHandlers(const DOMNodeImpl* n, + DOMUserDataHandler::DOMOperationType operation, + const DOMNode* src, + DOMNode* dst) const; + void transferUserData(DOMNodeImpl* n1, DOMNodeImpl* n2); + + DOMNode* renameNode(DOMNode* n, + const XMLCh* namespaceURI, + const XMLCh* name); + + //Return the index > 0 of ':' in the given qualified name qName="prefix:localName". + //Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd". + static int indexofQualifiedName(const XMLCh * qName); + static bool isKidOK(DOMNode *parent, DOMNode *child); + + inline DOMNodeIDMap* getNodeIDMap() {return fNodeIDMap;}; + + + // + // Memory Management Functions. All memory is allocated by and owned by + // a document, and is not recovered until the + // document itself is deleted. + // + const XMLCh* getPooledString(const XMLCh*); + const XMLCh* getPooledNString(const XMLCh*, XMLSize_t); + void deleteHeap(); + void releaseDocNotifyUserData(DOMNode* object); + void releaseBuffer(DOMBuffer* buffer); + DOMBuffer* popBuffer(XMLSize_t nMinSize); + MemoryManager* getMemoryManager() const; + + // Factory methods for getting/creating node lists. + // Because nothing is ever deleted, the implementation caches and recycles + // previously used instances of DOMDeepNodeList + // + DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName); + DOMNodeList* getDeepNodeList(const DOMNode *rootNode, //DOM Level 2 + const XMLCh *namespaceURI, + const XMLCh *localName); + +protected: + //Internal helper functions + virtual DOMNode* importNode(const DOMNode *source, bool deep, bool cloningNode); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMDocumentImpl(const DOMDocumentImpl &); + DOMDocumentImpl & operator = (const DOMDocumentImpl &); + +protected: + // ----------------------------------------------------------------------- + // data + // ----------------------------------------------------------------------- + // New data introduced in DOM Level 3 + const XMLCh* fInputEncoding; + const XMLCh* fXmlEncoding; + bool fXmlStandalone; + const XMLCh* fXmlVersion; + const XMLCh* fDocumentURI; + DOMConfiguration* fDOMConfiguration; + + XMLStringPool fUserDataTableKeys; + RefHash2KeysTableOf* fUserDataTable; + + + // Per-Document heap Variables. + // The heap consists of one or more biggish blocks which are + // sub-allocated for individual allocations of nodes, strings, etc. + // The big blocks form a linked list, allowing them to be located for deletion. + // + // There is no provision for deleting suballocated blocks, other than + // deleting the entire heap when the document is deleted. + // + // There is no header on individual sub-allocated blocks. + // The header on big blocks consists only of a single back pointer to + // the previously allocated big block (our linked list of big blocks) + // + // + // revisit - this heap should be encapsulated into its own + // class, rather than hanging naked on Document. + // + void* fCurrentBlock; + char* fFreePtr; + XMLSize_t fFreeBytesRemaining, + fHeapAllocSize; + + // To recycle the DOMNode pointer + RefArrayOf* fRecycleNodePtr; + + // To recycle DOMBuffer pointer + RefStackOf* fRecycleBufferPtr; + + // Pool of DOMNodeList for getElementsByTagName + DOMDeepNodeListPool* fNodeListPool; + + // Other data + DOMDocumentType* fDocType; + DOMElement* fDocElement; + + DOMStringPoolEntry** fNameTable; + XMLSize_t fNameTableSize; + + DOMNormalizer* fNormalizer; + Ranges* fRanges; + NodeIterators* fNodeIterators; + MemoryManager* fMemoryManager; // configurable memory manager + DOMImplementation* fDOMImplementation; + + int fChanges; + bool errorChecking; // Bypass error checking. + +}; + +inline MemoryManager* DOMDocumentImpl::getMemoryManager() const +{ + return fMemoryManager; +} + +inline const XMLCh* DOMDocumentImpl::getPooledString(const XMLCh *in) +{ + if (in == 0) + return 0; + + DOMStringPoolEntry **pspe; + DOMStringPoolEntry *spe; + + XMLSize_t inHash = XMLString::hash(in, fNameTableSize); + pspe = &fNameTable[inHash]; + while (*pspe != 0) + { + if (XMLString::equals((*pspe)->fString, in)) + return (*pspe)->fString; + pspe = &((*pspe)->fNext); + } + + // This string hasn't been seen before. Add it to the pool. + // + + // Compute size to allocate. Note that there's 1 char of string + // declared in the struct, so we don't need to add one again to + // account for the trailing null. + // + XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + XMLString::stringLen(in)*sizeof(XMLCh); + *pspe = spe = (DOMStringPoolEntry *)allocate(sizeToAllocate); + spe->fNext = 0; + XMLString::copyString((XMLCh*)spe->fString, in); + + return spe->fString; +} + +inline const XMLCh* DOMDocumentImpl:: +getPooledNString(const XMLCh *in, XMLSize_t n) +{ + if (in == 0) + return 0; + + DOMStringPoolEntry **pspe; + DOMStringPoolEntry *spe; + + XMLSize_t inHash = XMLString::hashN(in, n, fNameTableSize); + pspe = &fNameTable[inHash]; + while (*pspe != 0) + { + if (XMLString::equalsN((*pspe)->fString, in, n)) + return (*pspe)->fString; + pspe = &((*pspe)->fNext); + } + + // This string hasn't been seen before. Add it to the pool. + // + + // Compute size to allocate. Note that there's 1 char of string + // declared in the struct, so we don't need to add one again to + // account for the trailing null. + // + XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + n*sizeof(XMLCh); + *pspe = spe = (DOMStringPoolEntry *)allocate(sizeToAllocate); + spe->fNext = 0; + XMLString::copyNString((XMLCh*)spe->fString, in, n); + + return spe->fString; +} + +inline int DOMDocumentImpl::indexofQualifiedName(const XMLCh* name) +{ + int i = 0; + int colon = -1; + int colon_count = 0; + for (; *name != 0; ++i, ++name) + { + if (*name == chColon) + { + ++colon_count; + colon = i; + } + } + + if (i == 0 || colon == 0 || colon == (i - 1) || colon_count > 1) + return -1; + + return colon != -1 ? colon : 0; +} + +XERCES_CPP_NAMESPACE_END + +// --------------------------------------------------------------------------- +// +// Operator new. Global overloaded version, lets any object be allocated on +// the heap owned by a document. +// +// --------------------------------------------------------------------------- +inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType type) +{ + void *p = doc->allocate(amt, type); + return p; +} + +inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType type) +{ + XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager* mgr=(XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager*)doc->getFeature(XERCES_CPP_NAMESPACE_QUALIFIER XMLUni::fgXercescInterfaceDOMMemoryManager,0); + void* p=0; + if(mgr) + p = mgr->allocate(amt, type); + return p; +} + +inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *doc) +{ + void* p = doc->allocate(amt); + return p; +} + +inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc) +{ + XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager* mgr=(XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager*)doc->getFeature(XERCES_CPP_NAMESPACE_QUALIFIER XMLUni::fgXercescInterfaceDOMMemoryManager,0); + void* p=0; + if(mgr) + p = mgr->allocate(amt); + return p; +} + +// --------------------------------------------------------------------------- +// For DOM: +// Bypass compiler warning: +// no matching operator delete found; memory will not be freed if initialization throws an exception +// --------------------------------------------------------------------------- +#if !defined(XERCES_NO_MATCHING_DELETE_OPERATOR) +inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl * /*doc*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType /*type*/) +{ + return; +} +inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * /*doc*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMMemoryManager::NodeObjectType /*type*/) +{ + return; +} + +inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl * /*doc*/) +{ + return; +} +inline void operator delete(void* /*ptr*/, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * /*doc*/) +{ + return; +} +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp new file mode 100644 index 000000000..9d5469ea9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp @@ -0,0 +1,555 @@ +/* + * 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: DOMDocumentTypeImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include "DOMDocumentTypeImpl.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DOMNamedNodeMapImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMCasts.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +static DOMDocument* sDocument = 0; +static XMLMutex* sDocumentMutex = 0; + +void XMLInitializer::initializeDOMDocumentTypeImpl() +{ + sDocumentMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager); + + static const XMLCh gCoreStr[] = { chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull }; + DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gCoreStr); + sDocument = impl->createDocument(); // document type object (DTD). +} + +void XMLInitializer::terminateDOMDocumentTypeImpl() +{ + sDocument->release(); + sDocument = 0; + + delete sDocumentMutex; + sDocumentMutex = 0; +} + +DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc, + const XMLCh *dtName, + bool heap) + : fNode(ownerDoc), + fParent(ownerDoc), + fName(0), + fEntities(0), + fNotations(0), + fElements(0), + fPublicId(0), + fSystemId(0), + fInternalSubset(0), + fIntSubsetReading(false), + fIsCreatedFromHeap(heap) +{ + if (ownerDoc) + { + fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(dtName); + fEntities = new (ownerDoc) DOMNamedNodeMapImpl(this); + fNotations= new (ownerDoc) DOMNamedNodeMapImpl(this); + fElements = new (ownerDoc) DOMNamedNodeMapImpl(this); + } + else + { + XMLMutexLock lock(sDocumentMutex); + DOMDocument* doc = sDocument; + fName = ((DOMDocumentImpl *)doc)->getPooledString(dtName); + fEntities = new (doc) DOMNamedNodeMapImpl(this); + fNotations= new (doc) DOMNamedNodeMapImpl(this); + fElements = new (doc) DOMNamedNodeMapImpl(this); + } +} + + +//Introduced in DOM Level 2 +DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc, + const XMLCh *qualifiedName, + const XMLCh *pubId, + const XMLCh *sysId, + bool heap) + : fNode(ownerDoc), + fParent(ownerDoc), + fName(0), + fEntities(0), + fNotations(0), + fElements(0), + fPublicId(0), + fSystemId(0), + fInternalSubset(0), + fIntSubsetReading(false), + fIsCreatedFromHeap(heap) +{ + int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName); + if (index < 0) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + else if (index > 0) + { + // we have to make sure the qualifiedName has correct prefix and localName + // although we don't really to store them separately + XMLCh* newName; + XMLCh temp[256]; + if (index >= 255) + newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + ( + (XMLString::stringLen(qualifiedName)+1) * sizeof(XMLCh) + );//new XMLCh[XMLString::stringLen(qualifiedName)+1]; + else + newName = temp; + + XMLString::copyNString(newName, qualifiedName, index); + newName[index] = chNull; + + // Before we carry on, we should check if the prefix or localName are valid XMLName + if (ownerDoc) { + if (!((DOMDocumentImpl*)ownerDoc)->isXMLName(newName) || !((DOMDocumentImpl*)ownerDoc)->isXMLName(qualifiedName+index+1)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + else { + // document is not there yet, so assume XML 1.0 + if (!XMLChar1_0::isValidName(newName) || !XMLChar1_0::isValidName(qualifiedName+index+1)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + + if (index >= 255) + XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName; + } + + if (ownerDoc) + { + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc; + fPublicId = docImpl->cloneString(pubId); + fSystemId = docImpl->cloneString(sysId); + fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(qualifiedName); + fEntities = new (ownerDoc) DOMNamedNodeMapImpl(this); + fNotations= new (ownerDoc) DOMNamedNodeMapImpl(this); + fElements = new (ownerDoc) DOMNamedNodeMapImpl(this); + } + else + { + XMLMutexLock lock(sDocumentMutex); + DOMDocument* doc = sDocument; + fPublicId = ((DOMDocumentImpl*) doc)->cloneString(pubId); + fSystemId = ((DOMDocumentImpl*) doc)->cloneString(sysId); + fName = ((DOMDocumentImpl*) doc)->getPooledString(qualifiedName); + fEntities = new (doc) DOMNamedNodeMapImpl(this); + fNotations= new (doc) DOMNamedNodeMapImpl(this); + fElements = new (doc) DOMNamedNodeMapImpl(this); + } +} + + +DOMDocumentTypeImpl::DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep) + : fNode(other.fNode), + fParent(other.fParent), + fChild(other.fChild), + fName(0), + fEntities(0), + fNotations(0), + fElements(0), + fPublicId(0), + fSystemId(0), + fInternalSubset(0), + fIntSubsetReading(other.fIntSubsetReading), + fIsCreatedFromHeap(heap) +{ + fName = other.fName; + + //DOM Level 2 + fPublicId = other.fPublicId; + fSystemId = other.fSystemId; + fInternalSubset = other.fInternalSubset; + + if ((DOMDocumentImpl *)this->fNode.getOwnerDocument() && deep) + fParent.cloneChildren(&other); + + fEntities = other.fEntities->cloneMap(this); + fNotations= other.fNotations->cloneMap(this); + fElements = other.fElements->cloneMap(this); +} + + +DOMDocumentTypeImpl::~DOMDocumentTypeImpl() +{ +} + + +DOMNode *DOMDocumentTypeImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = 0; + DOMDocument* doc = castToNodeImpl(this)->getOwnerDocument(); + if (doc != 0) + newNode = new (doc, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep); + else + { + XMLMutexLock lock(sDocumentMutex); + newNode = new (sDocument, DOMMemoryManager::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep); + } + + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + +/** + * NON-DOM + * set the ownerDocument of this node and its children + */ +void DOMDocumentTypeImpl::setOwnerDocument(DOMDocument *doc) { + + if (castToNodeImpl(this)->getOwnerDocument()) { + fNode.setOwnerDocument(doc); + fParent.setOwnerDocument(doc); + } + else { + if (doc) { + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)doc; + + fPublicId = docImpl->cloneString(fPublicId); + fSystemId = docImpl->cloneString(fSystemId); + fInternalSubset = docImpl->cloneString(fInternalSubset); + fName = docImpl->getPooledString(fName); + + fNode.setOwnerDocument(doc); + fParent.setOwnerDocument(doc); + + DOMNamedNodeMapImpl* entitiesTemp = fEntities->cloneMap(this); + DOMNamedNodeMapImpl* notationsTemp = fNotations->cloneMap(this); + DOMNamedNodeMapImpl* elementsTemp = fElements->cloneMap(this); + + fEntities = entitiesTemp; + fNotations = notationsTemp; + fElements = elementsTemp; + } + } +} + +const XMLCh * DOMDocumentTypeImpl::getNodeName() const +{ + return fName; +} + + +DOMNode::NodeType DOMDocumentTypeImpl::getNodeType() const { + return DOMNode::DOCUMENT_TYPE_NODE; +} + + +DOMNamedNodeMap *DOMDocumentTypeImpl::getEntities() const +{ + return fEntities; +} + + + +const XMLCh * DOMDocumentTypeImpl::getName() const +{ + return fName; +} + + +DOMNamedNodeMap *DOMDocumentTypeImpl::getNotations() const +{ + return fNotations; +} + + +DOMNamedNodeMap *DOMDocumentTypeImpl::getElements() const +{ + return fElements; +} + + +void DOMDocumentTypeImpl::setNodeValue(const XMLCh *val) +{ + fNode.setNodeValue(val); +} + + +void DOMDocumentTypeImpl::setReadOnly(bool readOnl, bool deep) +{ + fNode.setReadOnly(readOnl,deep); + if (fEntities) + fEntities->setReadOnly(readOnl,true); + if (fNotations) + fNotations->setReadOnly(readOnl,true); +} + + +//Introduced in DOM Level 2 + +const XMLCh * DOMDocumentTypeImpl::getPublicId() const +{ + return fPublicId; +} + + +const XMLCh * DOMDocumentTypeImpl::getSystemId() const +{ + return fSystemId; +} + + +const XMLCh * DOMDocumentTypeImpl::getInternalSubset() const +{ + return fInternalSubset; +} + +bool DOMDocumentTypeImpl::isIntSubsetReading() const +{ + return fIntSubsetReading; +} + + +//set functions + +void DOMDocumentTypeImpl::setPublicId(const XMLCh *value) +{ + // revist. Why shouldn't 0 be assigned like any other value? + if (value == 0) + return; + + DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument(); + if (doc != 0) + fPublicId = doc->cloneString(value); + else { + XMLMutexLock lock(sDocumentMutex); + fPublicId = ((DOMDocumentImpl *)sDocument)->cloneString(value); + } +} + +void DOMDocumentTypeImpl::setSystemId(const XMLCh *value) +{ + DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument(); + if (doc != 0) + fSystemId = doc->cloneString(value); + else { + XMLMutexLock lock(sDocumentMutex); + fSystemId = ((DOMDocumentImpl *)sDocument)->cloneString(value); + } +} + +void DOMDocumentTypeImpl::setInternalSubset(const XMLCh *value) +{ + DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument(); + if (doc != 0) + fInternalSubset = doc->cloneString(value); + else { + XMLMutexLock lock(sDocumentMutex); + fInternalSubset = ((DOMDocumentImpl *)sDocument)->cloneString(value); + } +} + +void DOMDocumentTypeImpl::release() +{ + if (fNode.isOwned()) { + if (fNode.isToBeReleased()) { + // we are calling from documnet.release() which will notify the user data handler + if (fIsCreatedFromHeap) { + DOMDocumentType* docType = this; + delete docType; + } + } + else + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } + else { + if (fIsCreatedFromHeap) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + DOMDocumentType* docType = this; + delete docType; + } + else { + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + doc->release(this, DOMMemoryManager::DOCUMENT_TYPE_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } + } + } +} + + +// +// Delegation for functions inherited from Node +// + + DOMNode* DOMDocumentTypeImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } + DOMNamedNodeMap* DOMDocumentTypeImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMDocumentTypeImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMDocumentTypeImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMDocumentTypeImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMDocumentTypeImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMDocumentTypeImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMDocumentTypeImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMDocumentTypeImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMDocumentTypeImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMDocumentTypeImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMDocumentTypeImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMDocumentTypeImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMDocumentTypeImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + DOMNode* DOMDocumentTypeImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); } + void DOMDocumentTypeImpl::normalize() {fParent.normalize (); } + DOMNode* DOMDocumentTypeImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } + DOMNode* DOMDocumentTypeImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); } + void DOMDocumentTypeImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMDocumentTypeImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMDocumentTypeImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + void* DOMDocumentTypeImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMDocumentTypeImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMDocumentTypeImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMDocumentTypeImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMDocumentTypeImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMDocumentTypeImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMDocumentTypeImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMDocumentTypeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMDocumentTypeImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + + +bool DOMDocumentTypeImpl::isEqualNode(const DOMNode* arg) const +{ + if (isSameNode(arg)) { + return true; + } + + if (!fNode.isEqualNode(arg)) { + return false; + } + + DOMDocumentType* argDT = (DOMDocumentType*) arg; + // check the string values + if (!getPublicId()) { + if (argDT->getPublicId()) { + return false; + } + } + else if (!XMLString::equals(getPublicId(), argDT->getPublicId())) { + return false; + } + + if (!getSystemId()) { + if (argDT->getSystemId()) { + return false; + } + } + else if (!XMLString::equals(getSystemId(), argDT->getSystemId())) { + return false; + } + + if (!getInternalSubset()) { + if (argDT->getInternalSubset()) { + return false; + } + } + else if (!XMLString::equals(getInternalSubset(), argDT->getInternalSubset())) { + return false; + } + + // check the notations + if (getNotations()) { + if (!argDT->getNotations()) + return false; + + DOMNamedNodeMap* map1 = getNotations(); + DOMNamedNodeMap* map2 = argDT->getNotations(); + + XMLSize_t len = map1->getLength(); + if (len != map2->getLength()) { + return false; + } + for (XMLSize_t i = 0; i < len; i++) { + DOMNode* n1 = map1->item(i); + DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); + if (!n2 || !n1->isEqualNode(n2)) { + return false; + } + } + } + else { + if (argDT->getNotations()) + return false; + } + + // check the entities + if (getEntities()) { + if (!argDT->getEntities()) + return false; + + DOMNamedNodeMap* map1 = getEntities(); + DOMNamedNodeMap* map2 = argDT->getEntities(); + + XMLSize_t len = map1->getLength(); + if (len != map2->getLength()) { + return false; + } + for (XMLSize_t i = 0; i < len; i++) { + DOMNode* n1 = map1->item(i); + DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); + if (!n2 || !n1->isEqualNode(n2)) { + return false; + } + } + } + else { + if (argDT->getEntities()) + return false; + } + + return fParent.isEqualNode(arg); +} + +bool DOMDocumentTypeImpl::isSupported(const XMLCh *feature, const XMLCh *version) const +{ + // check for 'DOMDocumentTypeImpl' or '+DOMDocumentTypeImpl' + if(feature && *feature) + { + if((*feature==chPlus && XMLString::equals(feature+1, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl)) || + XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl)) + return true; + } + return fNode.isSupported (feature, version); +} + +void* DOMDocumentTypeImpl::getFeature(const XMLCh* feature, const XMLCh* version) const +{ + if(XMLString::equals(feature, XMLUni::fgXercescInterfaceDOMDocumentTypeImpl)) + return (DOMDocumentTypeImpl*)this; + return fNode.getFeature(feature,version); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.hpp new file mode 100644 index 000000000..3716411ec --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMDocumentTypeImpl.hpp @@ -0,0 +1,107 @@ +/* + * 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: DOMDocumentTypeImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPEIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + + +#include +#include +#include "DOMNodeImpl.hpp" +#include "DOMChildNode.hpp" +#include "DOMParentNode.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNamedNodeMapImpl; + +class CDOM_EXPORT DOMDocumentTypeImpl: public DOMDocumentType { +protected: + DOMNodeImpl fNode; + DOMParentNode fParent; + DOMChildNode fChild; + + const XMLCh * fName; + DOMNamedNodeMapImpl* fEntities; + DOMNamedNodeMapImpl* fNotations; + DOMNamedNodeMapImpl* fElements; + const XMLCh * fPublicId; + const XMLCh * fSystemId; + const XMLCh * fInternalSubset; + + bool fIntSubsetReading; + bool fIsCreatedFromHeap; + + virtual void setPublicId(const XMLCh * value); + virtual void setSystemId(const XMLCh * value); + virtual void setInternalSubset(const XMLCh *value); + bool isIntSubsetReading() const; + + friend class AbstractDOMParser; + friend class DOMDocumentImpl; + +public: + DOMDocumentTypeImpl(DOMDocument *, const XMLCh *, bool); + DOMDocumentTypeImpl(DOMDocument *, + const XMLCh *qualifiedName, //DOM Level 2 + const XMLCh *publicId, const XMLCh *systemId, bool); + DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep=false); + virtual ~DOMDocumentTypeImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + virtual void setOwnerDocument(DOMDocument *doc); + virtual DOMNamedNodeMap * getEntities() const; + virtual const XMLCh * getName() const; + virtual DOMNamedNodeMap * getNotations() const; + virtual DOMNamedNodeMap * getElements() const; + virtual void setReadOnly(bool readOnly, bool deep); + + //Introduced in DOM Level 2 + + virtual const XMLCh * getPublicId() const; + virtual const XMLCh * getSystemId() const; + virtual const XMLCh * getInternalSubset() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMDocumentTypeImpl & operator = (const DOMDocumentTypeImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.cpp new file mode 100644 index 000000000..8ddc78b5b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.cpp @@ -0,0 +1,880 @@ +/* + * 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: DOMElementImpl.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#include "DOMElementImpl.hpp" + +#include +#include +#include +#include +#include + +#include "DOMAttrMapImpl.hpp" +#include "DOMAttrImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMParentNode.hpp" +#include "DOMCasts.hpp" +#include "DOMElementNSImpl.hpp" +#include "DOMTypeInfoImpl.hpp" + +#include "DOMDocumentTypeImpl.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMAttr; + +DOMElementImpl::DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *eName) + : fNode(ownerDoc), fParent(ownerDoc), fAttributes(0), fDefaultAttributes(0) +{ + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc; + fName = docImpl->getPooledString(eName); + setupDefaultAttributes(); + if (!fDefaultAttributes) { + fDefaultAttributes = new (docImpl) DOMAttrMapImpl(this); + fAttributes = new (docImpl) DOMAttrMapImpl(this); + } + else { + fAttributes = new (docImpl) DOMAttrMapImpl(this, fDefaultAttributes); + } +} + + +DOMElementImpl::DOMElementImpl(const DOMElementImpl &other, bool deep) + : DOMElement(other), + fNode (other.fParent.fOwnerDocument), + fParent (other.fParent.fOwnerDocument), + fAttributes(0), + fDefaultAttributes(0) +{ + fName = other.fName; + + if (deep) + fParent.cloneChildren(&other); + + if (other.getAttributes()) + { + fAttributes = ((DOMAttrMapImpl *)other.getAttributes())->cloneAttrMap(this); + } + + if (other.getDefaultAttributes()) + { + fDefaultAttributes = ((DOMAttrMapImpl *)other.getDefaultAttributes())->cloneAttrMap(this); + } + + if (!fDefaultAttributes) + setupDefaultAttributes(); + + if (!fDefaultAttributes) + fDefaultAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this); + + if (!fAttributes) { + if (!fDefaultAttributes) { + fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this); + } + else { + fAttributes = new (fParent.fOwnerDocument) DOMAttrMapImpl(this, fDefaultAttributes); + } + } + +} + + +DOMElementImpl::~DOMElementImpl() +{ +} + + +DOMNode *DOMElementImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ELEMENT_OBJECT) DOMElementImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + + + +const XMLCh * DOMElementImpl::getNodeName() const { + return fName; +} + + +DOMNode::NodeType DOMElementImpl::getNodeType() const { + return DOMNode::ELEMENT_NODE; +} + + +const XMLCh * DOMElementImpl::getAttribute(const XMLCh *nam) const +{ + DOMNode * attr = fAttributes->getNamedItem(nam); + if (attr) + return attr->getNodeValue(); + + return XMLUni::fgZeroLenString; +} + + + +DOMAttr *DOMElementImpl::getAttributeNode(const XMLCh *nam) const +{ + return (DOMAttr *)fAttributes->getNamedItem(nam); +} + + +DOMNamedNodeMap *DOMElementImpl::getAttributes() const +{ + DOMElementImpl *ncThis = (DOMElementImpl *)this; // cast off const + return ncThis->fAttributes; +} + + + +DOMNodeList *DOMElementImpl::getElementsByTagName(const XMLCh *tagname) const +{ + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument; + return docImpl->getDeepNodeList(this,tagname); +} + + +const XMLCh * DOMElementImpl::getTagName() const +{ + return fName; +} + + +void DOMElementImpl::removeAttribute(const XMLCh *nam) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + int i = fAttributes->findNamePoint(nam); + if (i >= 0) + { + DOMNode *att = fAttributes->removeNamedItemAt(i); + ((DOMAttrImpl *)att)->removeAttrFromIDNodeMap(); + att->release(); + } +} + + + +DOMAttr *DOMElementImpl::removeAttributeNode(DOMAttr *oldAttr) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + DOMNode* found = 0; + + // Since there is no removeAttributeNodeNS, check if this oldAttr has NS or not + const XMLCh* localName = oldAttr->getLocalName(); + int i = 0; + if (localName) + i = fAttributes->findNamePoint(oldAttr->getNamespaceURI(), localName); + else + i = fAttributes->findNamePoint(oldAttr->getName()); + + if (i >= 0) { + // If it is in fact the right object, remove it. + found = fAttributes->item(i); + if (found == oldAttr) { + fAttributes->removeNamedItemAt(i); + ((DOMAttrImpl *)oldAttr)->removeAttrFromIDNodeMap(); + } + else + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + + } + else + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + + return (DOMAttr *)found; +} + + + +void DOMElementImpl::setAttribute(const XMLCh *nam, const XMLCh *val) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + DOMAttr* newAttr = getAttributeNode(nam); + if (!newAttr) + { + newAttr = fParent.fOwnerDocument->createAttribute(nam); + fAttributes->setNamedItem(newAttr); + } + + newAttr->setNodeValue(val); +} + +void DOMElementImpl::setIdAttribute(const XMLCh* name, bool isId) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + DOMAttr *attr = getAttributeNode(name); + + if (!attr) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + + if(isId) + ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); + else + ((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap(); +} + +void DOMElementImpl::setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId) { + + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + DOMAttr *attr = getAttributeNodeNS(namespaceURI, localName); + + if (!attr) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + + if(isId) + ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); + else + ((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap(); +} + + +void DOMElementImpl::setIdAttributeNode(const DOMAttr *idAttr, bool isId) { + + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + DOMAttr *attr; + const XMLCh* localName = idAttr->getLocalName(); + if (localName) + attr = getAttributeNodeNS(idAttr->getNamespaceURI(), idAttr->getLocalName()); + else + attr = getAttributeNode(idAttr->getName()); + + if(!attr) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + + if(isId) + ((DOMAttrImpl *)attr)->addAttrToIDNodeMap(); + else + ((DOMAttrImpl *)attr)->removeAttrFromIDNodeMap(); +} + + +DOMAttr * DOMElementImpl::setAttributeNode(DOMAttr *newAttr) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager); + // revisit. Exception doesn't match test. + + // This will throw INUSE if necessary + DOMAttr *oldAttr = (DOMAttr *) fAttributes->setNamedItem(newAttr); + + return oldAttr; +} + + +void DOMElementImpl::setNodeValue(const XMLCh *x) +{ + fNode.setNodeValue(x); +} + + + +void DOMElementImpl::setReadOnly(bool readOnl, bool deep) +{ + fNode.setReadOnly(readOnl,deep); + fAttributes->setReadOnly(readOnl,true); +} + + +//Introduced in DOM Level 2 +const XMLCh * DOMElementImpl::getAttributeNS(const XMLCh *fNamespaceURI, + const XMLCh *fLocalName) const +{ + DOMAttr * attr= + (DOMAttr *)(fAttributes->getNamedItemNS(fNamespaceURI, fLocalName)); + return (attr==0) ? XMLUni::fgZeroLenString : attr->getValue(); +} + + +void DOMElementImpl::setAttributeNS(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName, const XMLCh *fValue) +{ + if (fNode.isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName); + if (index < 0) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + DOMAttr* newAttr = getAttributeNodeNS(fNamespaceURI, qualifiedName+index); + if (!newAttr) + { + newAttr = fParent.fOwnerDocument->createAttributeNS(fNamespaceURI, qualifiedName); + fAttributes->setNamedItemNS(newAttr); + } + + newAttr->setNodeValue(fValue); +} + + +void DOMElementImpl::removeAttributeNS(const XMLCh *fNamespaceURI, + const XMLCh *fLocalName) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + int i = fAttributes->findNamePoint(fNamespaceURI, fLocalName); + if (i >= 0) + { + DOMNode *att = fAttributes->removeNamedItemAt(i); + att->release(); + } +} + + +DOMAttr *DOMElementImpl::getAttributeNodeNS(const XMLCh *fNamespaceURI, + const XMLCh *fLocalName) const +{ + return (DOMAttr *)fAttributes->getNamedItemNS(fNamespaceURI, fLocalName); +} + + +DOMAttr *DOMElementImpl::setAttributeNodeNS(DOMAttr *newAttr) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + if (newAttr -> getOwnerDocument() != fParent.fOwnerDocument) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager); + + // This will throw INUSE if necessary + DOMAttr *oldAttr = (DOMAttr *) fAttributes->setNamedItemNS(newAttr); + + return oldAttr; +} + + +DOMNodeList *DOMElementImpl::getElementsByTagNameNS(const XMLCh *namespaceURI, + const XMLCh *localName) const +{ + DOMDocumentImpl *docImpl = (DOMDocumentImpl *)fParent.fOwnerDocument; + return docImpl->getDeepNodeList(this, namespaceURI, localName); +} + +bool DOMElementImpl::hasAttributes() const +{ + return (fAttributes != 0 && fAttributes->getLength() != 0); +} + + +bool DOMElementImpl::hasAttribute(const XMLCh *name) const +{ + return (getAttributeNode(name) != 0); +} + + +bool DOMElementImpl::hasAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const +{ + return (getAttributeNodeNS(namespaceURI, localName) != 0); +} + + +// util functions for default attributes +// returns the default attribute map for this node from the owner document +DOMAttrMapImpl *DOMElementImpl::getDefaultAttributes() const +{ + return fDefaultAttributes; +} + +// initially set up the default attribute information based on doctype information +void DOMElementImpl::setupDefaultAttributes() +{ + DOMDocument *tmpdoc = fParent.fOwnerDocument; + if ((fNode.fOwnerNode == 0) || (tmpdoc == 0) || (tmpdoc->getDoctype() == 0)) + return; + + DOMNode *eldef = ((DOMDocumentTypeImpl*)tmpdoc->getDoctype())->getElements()->getNamedItem(getNodeName()); + DOMAttrMapImpl* defAttrs = (eldef == 0) ? 0 : (DOMAttrMapImpl *)(eldef->getAttributes()); + + if (defAttrs) + fDefaultAttributes = new (tmpdoc) DOMAttrMapImpl(this, defAttrs); +} + +DOMAttr * DOMElementImpl::setDefaultAttributeNode(DOMAttr *newAttr) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager); + // revisit. Exception doesn't match test. + + // This will throw INUSE if necessary + DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItem(newAttr); + fAttributes->hasDefaults(true); + + return oldAttr; +} + + +DOMAttr *DOMElementImpl::setDefaultAttributeNodeNS(DOMAttr *newAttr) +{ + if (fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + if (newAttr -> getOwnerDocument() != fParent.fOwnerDocument) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager); + + // This will throw INUSE if necessary + DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItemNS(newAttr); + fAttributes->hasDefaults(true); + + return oldAttr; +} + +void DOMElementImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + // release children + fParent.release(); + // release attributes + fAttributes->hasDefaults(false); + XMLSize_t count; + while((count = fAttributes->getLength()) != 0) + { + DOMNode* attr = fAttributes->removeNamedItemAt(count-1); + attr->release(); + } + + doc->release(this, DOMMemoryManager::ELEMENT_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +const XMLCh* DOMElementImpl::getBaseURI() const +{ + const XMLCh* baseURI = fNode.fOwnerNode->getBaseURI(); + if (fAttributes) { + const XMLCh baseString[] = + { + chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull + }; + DOMNode* attrNode = fAttributes->getNamedItemNS(DOMNodeImpl::getXmlURIString(), baseString); + if (attrNode==NULL) { + const XMLCh xmlBaseString[] = + { + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull + }; + attrNode = fAttributes->getNamedItem(xmlBaseString); + } + if (attrNode) { + const XMLCh* uri = attrNode->getNodeValue(); + if (uri && *uri) {// attribute value is always empty string + // if there is a base URI for the parent node, use it to resolve relative URI + if(baseURI) + { + try { + DOMDocumentImpl* doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + XMLUri temp(baseURI, doc->getMemoryManager()); + XMLUri temp2(&temp, uri, doc->getMemoryManager()); + uri = doc->cloneString(temp2.getUriText()); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...){ + // REVISIT: what should happen in this case? + return 0; + } + } + return uri; + } + } + } + return baseURI; +} + + + +// +// Functions inherited from Node +// + DOMNode* DOMElementImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } + DOMNodeList* DOMElementImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMElementImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMElementImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMElementImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMElementImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMElementImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMElementImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMElementImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMElementImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMElementImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMElementImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMElementImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + DOMNode* DOMElementImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); } + void DOMElementImpl::normalize() {fParent.normalize (); } + DOMNode* DOMElementImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } + DOMNode* DOMElementImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); } + bool DOMElementImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMElementImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMElementImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + void* DOMElementImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMElementImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMElementImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMElementImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMElementImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMElementImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMElementImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMElementImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMElementImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + + +bool DOMElementImpl::isEqualNode(const DOMNode* arg) const +{ + if (isSameNode(arg)) { + return true; + } + + if (!fNode.isEqualNode(arg)) { + return false; + } + + bool hasAttrs = hasAttributes(); + + if (hasAttrs != arg->hasAttributes()) { + return false; + } + + if (hasAttrs) { + DOMNamedNodeMap* map1 = getAttributes(); + DOMNamedNodeMap* map2 = arg->getAttributes(); + + XMLSize_t len = map1->getLength(); + if (len != map2->getLength()) { + return false; + } + for (XMLSize_t i = 0; i < len; i++) { + DOMNode* n1 = map1->item(i); + if (!n1->getLocalName()) { // DOM Level 1 Node + DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); + if (!n2 || !n1->isEqualNode(n2)) { + return false; + } + } + else { + DOMNode* n2 = map2->getNamedItemNS(n1->getNamespaceURI(), + n1->getLocalName()); + if (!n2 || !n1->isEqualNode(n2)) { + return false; + } + } + } + } + + return fParent.isEqualNode(arg); +} + +DOMNode* DOMElementImpl::rename(const XMLCh* namespaceURI, const XMLCh* name) +{ + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + + if (!namespaceURI || !*namespaceURI) { + fName = doc->getPooledString(name); + fAttributes->reconcileDefaultAttributes(getDefaultAttributes()); + + // and fire user data NODE_RENAMED event + castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this); + + return this; + } + else { + + // create a new ElementNS + DOMElementNSImpl* newElem = (DOMElementNSImpl*)doc->createElementNS(namespaceURI, name); + + // transfer the userData + doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newElem)); + + // remove old node from parent if any + DOMNode* parent = getParentNode(); + DOMNode* nextSib = getNextSibling(); + if (parent) { + parent->removeChild(this); + } + + // move children to new node + DOMNode* child = getFirstChild(); + while (child) { + removeChild(child); + newElem->appendChild(child); + child = getFirstChild(); + } + + // insert new node where old one was + if (parent) { + parent->insertBefore(newElem, nextSib); + } + + // move specified attributes to new node + newElem->fAttributes->moveSpecifiedAttributes(fAttributes); + + // and fire user data NODE_RENAMED event + castToNodeImpl(newElem)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newElem); + + return newElem; + } +} + +const DOMTypeInfo *DOMElementImpl::getSchemaTypeInfo() const +{ + return &DOMTypeInfoImpl::g_DtdValidatedElement; +} + +// DOMElementTraversal +DOMElement * DOMElementImpl::getFirstElementChild() const +{ + DOMNode* n = getFirstChild(); + while (n != NULL) { + switch (n->getNodeType()) { + case DOMNode::ELEMENT_NODE: + return (DOMElement*) n; + case DOMNode::ENTITY_REFERENCE_NODE: + { + DOMElement* e = getFirstElementChild(n); + if (e != NULL) + return e; + } + break; + default: + break; + } + n = n->getNextSibling(); + } + return NULL; +} + +DOMElement * DOMElementImpl::getLastElementChild() const +{ + DOMNode* n = getLastChild(); + while (n != NULL) { + switch (n->getNodeType()) { + case DOMNode::ELEMENT_NODE: + return (DOMElement*) n; + case DOMNode::ENTITY_REFERENCE_NODE: + { + DOMElement* e = getLastElementChild(n); + if (e != NULL) + return e; + } + break; + default: + break; + } + n = n->getPreviousSibling(); + } + return NULL; +} + +DOMElement * DOMElementImpl::getNextElementSibling() const +{ + DOMNode* n = getNextLogicalSibling(this); + while (n != NULL) { + switch (n->getNodeType()) { + case DOMNode::ELEMENT_NODE: + return (DOMElement*) n; + case DOMNode::ENTITY_REFERENCE_NODE: + { + DOMElement* e = getFirstElementChild(n); + if (e != NULL) + return e; + } + break; + default: + break; + } + n = getNextLogicalSibling(n); + } + return NULL; +} + +DOMElement * DOMElementImpl::getPreviousElementSibling() const +{ + DOMNode* n = getPreviousLogicalSibling(this); + while (n != NULL) { + switch (n->getNodeType()) { + case DOMNode::ELEMENT_NODE: + return (DOMElement*) n; + case DOMNode::ENTITY_REFERENCE_NODE: + { + DOMElement* e = getLastElementChild(n); + if (e != NULL) + return e; + } + break; + default: + break; + } + n = getPreviousLogicalSibling(n); + } + return NULL; +} + +XMLSize_t DOMElementImpl::getChildElementCount() const +{ + XMLSize_t count = 0; + DOMElement* child = getFirstElementChild(); + while (child != NULL) { + ++count; + child = child->getNextElementSibling(); + } + return count; +} + +// Returns the first element node found from a +// non-recursive in order traversal of the given node. +DOMElement* DOMElementImpl::getFirstElementChild(const DOMNode* n) const +{ + const DOMNode* top = n; + while (n != NULL) { + if (n->getNodeType() == DOMNode::ELEMENT_NODE) { + return (DOMElement*) n; + } + DOMNode* next = n->getFirstChild(); + while (next == NULL) { + if (top == n) { + break; + } + next = n->getNextSibling(); + if (next == NULL) { + n = n->getParentNode(); + if (n == NULL || top == n) { + return NULL; + } + } + } + n = next; + } + return NULL; +} + +// Returns the first element node found from a +// non-recursive reverse order traversal of the given node. +DOMElement* DOMElementImpl::getLastElementChild(const DOMNode* n) const +{ + const DOMNode* top = n; + while (n != NULL) { + if (n->getNodeType() == DOMNode::ELEMENT_NODE) { + return (DOMElement*) n; + } + DOMNode* next = n->getLastChild(); + while (next == NULL) { + if (top == n) { + break; + } + next = n->getPreviousSibling(); + if (next == NULL) { + n = n->getParentNode(); + if (n == NULL || top == n) { + return NULL; + } + } + } + n = next; + } + return NULL; +} + +// Returns the next logical sibling with respect to the given node. +DOMNode* DOMElementImpl::getNextLogicalSibling(const DOMNode* n) const +{ + DOMNode* next = n->getNextSibling(); + // If "n" has no following sibling and its parent is an entity reference node we + // need to continue the search through the following siblings of the entity + // reference as these are logically siblings of the given node. + if (next == NULL) { + DOMNode* parent = n->getParentNode(); + while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) { + next = parent->getNextSibling(); + if (next != NULL) { + break; + } + parent = parent->getParentNode(); + } + } + return next; +} + +// Returns the previous logical sibling with respect to the given node. +DOMNode* DOMElementImpl::getPreviousLogicalSibling(const DOMNode* n) const +{ + DOMNode* prev = n->getPreviousSibling(); + // If "n" has no previous sibling and its parent is an entity reference node we + // need to continue the search through the previous siblings of the entity + // reference as these are logically siblings of the given node. + if (prev == NULL) { + DOMNode* parent = n->getParentNode(); + while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) { + prev = parent->getPreviousSibling(); + if (prev != NULL) { + break; + } + parent = parent->getParentNode(); + } + } + return prev; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.hpp new file mode 100644 index 000000000..8075a7cdc --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMElementImpl.hpp @@ -0,0 +1,143 @@ +/* + * 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: DOMElementImpl.hpp 792236 2009-07-08 17:22:35Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include +#include +#include + +#include "DOMChildNode.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMParentNode.hpp" + +#include "DOMAttrMapImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMTypeInfo; +class DOMNodeList; +class DOMAttrMapImpl; +class DOMDocument; + + + + +class CDOM_EXPORT DOMElementImpl: public DOMElement { +public: + DOMNodeImpl fNode; + DOMParentNode fParent; + DOMChildNode fChild; + DOMAttrMapImpl *fAttributes; + DOMAttrMapImpl *fDefaultAttributes; + const XMLCh *fName; + +public: + DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *name); + + DOMElementImpl(const DOMElementImpl &other, bool deep=false); + virtual ~DOMElementImpl(); + +public: + // Declare functions from DOMNode. They all must be implemented by this class + DOMNODE_FUNCTIONS; + +public: + // Functions introduced on Element... + virtual const XMLCh* getAttribute(const XMLCh *name) const; + virtual DOMAttr* getAttributeNode(const XMLCh *name) const; + virtual DOMNodeList* getElementsByTagName(const XMLCh *tagname) const; + virtual const XMLCh* getTagName() const; + virtual void removeAttribute(const XMLCh *name); + virtual DOMAttr* removeAttributeNode(DOMAttr * oldAttr); + virtual void setAttribute(const XMLCh *name, const XMLCh *value); + virtual DOMAttr* setAttributeNode(DOMAttr *newAttr); + virtual void setReadOnly(bool readOnly, bool deep); + + //Introduced in DOM Level 2 + virtual const XMLCh* getAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual void setAttributeNS(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + const XMLCh *value); + virtual void removeAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName); + virtual DOMAttr* getAttributeNodeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual DOMAttr* setAttributeNodeNS(DOMAttr *newAttr); + virtual DOMNodeList* getElementsByTagNameNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual bool hasAttribute(const XMLCh *name) const; + virtual bool hasAttributeNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + + //Introduced in DOM level 3 + virtual void setIdAttribute(const XMLCh* name, bool isId); + virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId); + virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId); + virtual const DOMTypeInfo * getSchemaTypeInfo() const; + + // for handling of default attribute + virtual DOMAttr* setDefaultAttributeNode(DOMAttr *newAttr); + virtual DOMAttr* setDefaultAttributeNodeNS(DOMAttr *newAttr); + virtual DOMAttrMapImpl* getDefaultAttributes() const; + + // helper function for DOM Level 3 renameNode + virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name); + + // DOMElementTraversal + virtual DOMElement * getFirstElementChild() const; + virtual DOMElement * getLastElementChild() const; + virtual DOMElement * getPreviousElementSibling() const; + virtual DOMElement * getNextElementSibling() const; + virtual XMLSize_t getChildElementCount() const; + +protected: + // default attribute helper functions + virtual void setupDefaultAttributes(); + + // helper function for DOMElementTraversal methods + DOMElement* getFirstElementChild(const DOMNode* n) const; + DOMElement* getLastElementChild(const DOMNode* n) const; + DOMNode* getNextLogicalSibling(const DOMNode* n) const; + DOMNode* getPreviousLogicalSibling(const DOMNode* n) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMElementImpl & operator = (const DOMElementImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.cpp new file mode 100644 index 000000000..31ebb2921 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.cpp @@ -0,0 +1,264 @@ +/* + * 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: DOMElementNSImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include +#include "DOMElementNSImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMTypeInfoImpl.hpp" +#include "DOMCasts.hpp" +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) : + DOMElementImpl(ownerDoc, nam) +{ + this->fNamespaceURI=0; //DOM Level 2 + this->fLocalName=0; //DOM Level 2 + this->fPrefix=0; + this->fSchemaType = 0; +} + +//Introduced in DOM Level 2 +DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *qualifiedName) : + DOMElementImpl(ownerDoc, qualifiedName) +{ + setName(namespaceURI, qualifiedName); + this->fSchemaType = 0; +} + +DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *prefix, + const XMLCh *localName, + const XMLCh *qualifiedName) + : DOMElementImpl(ownerDoc, qualifiedName) +{ + this->fSchemaType = 0; + + DOMDocumentImpl* docImpl = (DOMDocumentImpl*)fParent.fOwnerDocument; + + if (prefix == 0 || *prefix == 0) + { + fPrefix = 0; + fLocalName = fName; + } + else + { + fPrefix = docImpl->getPooledString(prefix); + fLocalName = docImpl->getPooledString(localName); + } + + // DOM Level 3: namespace URI is never empty string. + // + const XMLCh * URI = DOMNodeImpl::mapPrefix ( + fPrefix, + (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI, + DOMNode::ELEMENT_NODE); + + fNamespaceURI = (URI == 0) ? 0 : docImpl->getPooledString(URI); +} + +DOMElementNSImpl::DOMElementNSImpl(const DOMElementNSImpl &other, bool deep) : + DOMElementImpl(other, deep) +{ + this->fNamespaceURI = other.fNamespaceURI; //DOM Level 2 + this->fLocalName = other.fLocalName; //DOM Level 2 + this->fPrefix = other.fPrefix; + this->fSchemaType = other.fSchemaType; +} + +DOMNode * DOMElementNSImpl::cloneNode(bool deep) const { + DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ELEMENT_NS_OBJECT) DOMElementNSImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + +const XMLCh * DOMElementNSImpl::getNamespaceURI() const +{ + return fNamespaceURI; +} + +const XMLCh * DOMElementNSImpl::getPrefix() const +{ + return fPrefix; +} + + +const XMLCh * DOMElementNSImpl::getLocalName() const +{ + return fLocalName; +} + +void DOMElementNSImpl::setPrefix(const XMLCh *prefix) +{ + if (fNode.isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + if (prefix == 0 || *prefix == 0) { + fPrefix = 0; + fName = fLocalName; + return; + } + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + + if(!doc->isXMLName(prefix)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager); + + const XMLCh * xml = DOMNodeImpl::getXmlString(); + const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString(); + + if (XMLString::equals(prefix, xml) && + !XMLString::equals(fNamespaceURI, xmlURI)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + + if (XMLString::indexOf(prefix, chColon) != -1) { + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + + this-> fPrefix = doc->getPooledString(prefix); + + XMLSize_t prefixLen = XMLString::stringLen(prefix); + XMLSize_t newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName); + + XMLCh *newName; + XMLCh temp[256]; + if (newQualifiedNameLen >= 255) + newName = (XMLCh*) doc->getMemoryManager()->allocate + ( + newQualifiedNameLen * sizeof(XMLCh) + );//new XMLCh[newQualifiedNameLen]; + else + newName = temp; + + // newName = prefix + chColon + fLocalName; + XMLString::copyString(newName, prefix); + newName[prefixLen] = chColon; + XMLString::copyString(&newName[prefixLen+1], fLocalName); + + fName = doc->getPooledString(newName); + + if (newQualifiedNameLen >= 255) + doc->getMemoryManager()->deallocate(newName);//delete[] newName; + +} + +void DOMElementNSImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::ELEMENT_NS_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +DOMNode* DOMElementNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name) +{ + setName(namespaceURI, name); + fAttributes->reconcileDefaultAttributes(getDefaultAttributes()); + // and fire user data NODE_RENAMED event + castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this); + + return this; +} + +void DOMElementNSImpl::setName(const XMLCh *namespaceURI, + const XMLCh *qualifiedName) +{ + DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *) fParent.fOwnerDocument; + this->fName = ownerDoc->getPooledString(qualifiedName); + + int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName); + if (index < 0) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + + if (index == 0) + { + //qualifiedName contains no ':' + // + fPrefix = 0; + fLocalName = fName; + } + else + { //0 < index < this->name.length()-1 + // + fPrefix = ownerDoc->getPooledNString(qualifiedName, index); + fLocalName = ownerDoc->getPooledString(fName+index+1); + + // Before we carry on, we should check if the prefix or localName are valid XMLName + if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName)) + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); + } + + // DOM Level 3: namespace URI is never empty string. + // + const XMLCh * URI = DOMNodeImpl::mapPrefix ( + fPrefix, + (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI, + DOMNode::ELEMENT_NODE); + + fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI); +} + +const DOMTypeInfo *DOMElementNSImpl::getSchemaTypeInfo() const +{ + if(!fSchemaType) + return &DOMTypeInfoImpl::g_DtdValidatedElement; + return fSchemaType; +} + +void DOMElementNSImpl::setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo) +{ + fSchemaType = typeInfo; +} + +bool DOMElementNSImpl::isSupported(const XMLCh *feature, const XMLCh *version) const +{ + // check for '+DOMPSVITypeInfo' + if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfacePSVITypeInfo)) + return true; + return fNode.isSupported (feature, version); +} + +void* DOMElementNSImpl::getFeature(const XMLCh* feature, const XMLCh* version) const +{ + if(XMLString::equals(feature, XMLUni::fgXercescInterfacePSVITypeInfo)) + return (DOMPSVITypeInfo*)fSchemaType; + return DOMElementImpl::getFeature(feature, version); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.hpp new file mode 100644 index 000000000..140ecc2ad --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMElementNSImpl.hpp @@ -0,0 +1,95 @@ +/* + * 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: DOMElementNSImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENTNSIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMELEMENTNSIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include "DOMElementImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMTypeInfoImpl; + +class CDOM_EXPORT DOMElementNSImpl: public DOMElementImpl { +protected: + //Introduced in DOM Level 2 + const XMLCh * fNamespaceURI; //namespace URI of this node + const XMLCh * fLocalName; //local part of qualified name + const XMLCh * fPrefix; + const DOMTypeInfoImpl *fSchemaType; + +public: + DOMElementNSImpl(DOMDocument *ownerDoc, const XMLCh *name); + DOMElementNSImpl(DOMDocument *ownerDoc, //DOM Level 2 + const XMLCh *namespaceURI, + const XMLCh *qualifiedName); + DOMElementNSImpl(const DOMElementNSImpl &other, bool deep=false); + + // Fast construction without any checks for name validity. Used in + // parsing. + // + DOMElementNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *prefix, // Null or empty - no prefix. + const XMLCh *localName, + const XMLCh *qualifiedName); + + virtual DOMNode * cloneNode(bool deep) const; + virtual bool isSupported(const XMLCh *feature, const XMLCh *version) const; + virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const; + + //Introduced in DOM Level 2 + virtual const XMLCh *getNamespaceURI() const; + virtual const XMLCh *getPrefix() const; + virtual const XMLCh *getLocalName() const; + virtual void setPrefix(const XMLCh *prefix); + virtual void release(); + + //Introduced in DOM Level 3 + virtual const DOMTypeInfo * getSchemaTypeInfo() const; + + // helper function for DOM Level 3 renameNode + virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name); + void setName(const XMLCh* namespaceURI, const XMLCh* name); + + //helper function for DOM Level 3 TypeInfo + virtual void setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMElementNSImpl & operator = (const DOMElementNSImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.cpp new file mode 100644 index 000000000..5224bb830 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.cpp @@ -0,0 +1,295 @@ +/* + * 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: DOMEntityImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + +#include +#include +#include +#include "DOMEntityImpl.hpp" +#include "DOMDocumentImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMEntityImpl::DOMEntityImpl(DOMDocument *ownerDoc, const XMLCh *eName) + : fNode(ownerDoc), + fParent(ownerDoc), + fPublicId(0), + fSystemId(0), + fNotationName(0), + fRefEntity(0), + fInputEncoding(0), + fXmlEncoding(0), + fXmlVersion(0), + fBaseURI(0), + fEntityRefNodeCloned(false) +{ + fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(eName); + fNode.setReadOnly(true, true); +} + + +DOMEntityImpl::DOMEntityImpl(const DOMEntityImpl &other, bool deep) + : DOMEntity(other), + fNode(other.fNode), + fParent(other.fParent), + fName(other.fName), + fPublicId(other.fPublicId), + fSystemId(other.fSystemId), + fNotationName(other.fNotationName), + fRefEntity(other.fRefEntity), + fInputEncoding(other.fInputEncoding), + fXmlEncoding(other.fXmlEncoding), + fXmlVersion(other.fXmlVersion), + fBaseURI(other.fBaseURI), + fEntityRefNodeCloned(false) +{ + if (deep) + fParent.cloneChildren(&other); + fNode.setReadOnly(true, true); +} + + +DOMEntityImpl::~DOMEntityImpl() { +} + + +DOMNode *DOMEntityImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ENTITY_OBJECT) DOMEntityImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMEntityImpl::getNodeName() const { + return fName; +} + + +DOMNode::NodeType DOMEntityImpl::getNodeType() const { + return DOMNode::ENTITY_NODE; +} + + +const XMLCh * DOMEntityImpl::getNotationName() const +{ + return fNotationName; +} + + +const XMLCh * DOMEntityImpl::getPublicId() const { + return fPublicId; +} + + +const XMLCh * DOMEntityImpl::getSystemId() const +{ + return fSystemId; +} + + +const XMLCh* DOMEntityImpl::getBaseURI() const +{ + return fBaseURI; +} + + +void DOMEntityImpl::setNodeValue(const XMLCh *arg) +{ + fNode.setNodeValue(arg); +} + + +void DOMEntityImpl::setNotationName(const XMLCh *arg) +{ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fNotationName = doc->cloneString(arg); +} + + +void DOMEntityImpl::setPublicId(const XMLCh *arg) +{ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fPublicId = doc->cloneString(arg); +} + + +void DOMEntityImpl::setSystemId(const XMLCh *arg) +{ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fSystemId = doc->cloneString(arg); +} + + +void DOMEntityImpl::setBaseURI(const XMLCh* baseURI) { + if (baseURI && *baseURI) { + XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)fParent.fOwnerDocument)->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh)); + XMLString::fixURI(baseURI, temp); + fBaseURI = temp; + } + else + fBaseURI = 0; +} + + +void DOMEntityImpl::setEntityRef(DOMEntityReference* other) +{ + fRefEntity = other; +} + + +DOMEntityReference* DOMEntityImpl::getEntityRef() const +{ + return fRefEntity; +} + +void DOMEntityImpl::cloneEntityRefTree() const +{ + if (fEntityRefNodeCloned) + return; + + // cast off const. This method is const because it is + // called from a bunch of logically const methods, like + // getFirstChild(). + DOMEntityImpl *ncThis = (DOMEntityImpl *)this; + + //lazily clone the entityRef tree to this entity + if (fParent.fFirstChild != 0) + return; + + if (!fRefEntity) + return; + + ncThis->fEntityRefNodeCloned = true; + ncThis->fNode.setReadOnly(false, true); + ncThis->fParent.cloneChildren(fRefEntity); + ncThis->fNode.setReadOnly(true, true); +} + +DOMNode * DOMEntityImpl::getFirstChild() const +{ + cloneEntityRefTree(); + return fParent.fFirstChild; +} + +DOMNode * DOMEntityImpl::getLastChild() const +{ + cloneEntityRefTree(); + return fParent.getLastChild(); +} + +DOMNodeList* DOMEntityImpl::getChildNodes() const +{ + cloneEntityRefTree(); + return this->fParent.getChildNodes(); + +} + +bool DOMEntityImpl::hasChildNodes() const +{ + cloneEntityRefTree(); + return fParent.fFirstChild!=0; +} + + +void DOMEntityImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::ENTITY_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +// +// Functions inherited from Node +// + + DOMNode* DOMEntityImpl::appendChild(DOMNode *newChild) {cloneEntityRefTree(); return fParent.appendChild (newChild); } + DOMNamedNodeMap* DOMEntityImpl::getAttributes() const {return fNode.getAttributes (); } + const XMLCh* DOMEntityImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMEntityImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMEntityImpl::getNextSibling() const {return fNode.getNextSibling (); } + const XMLCh* DOMEntityImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMEntityImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMEntityImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMEntityImpl::getParentNode() const {return fNode.getParentNode (); } + DOMNode* DOMEntityImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } + DOMNode* DOMEntityImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {cloneEntityRefTree(); return fParent.insertBefore (newChild, refChild); } + void DOMEntityImpl::normalize() {cloneEntityRefTree(); fParent.normalize (); } + DOMNode* DOMEntityImpl::removeChild(DOMNode *oldChild) {cloneEntityRefTree(); return fParent.removeChild (oldChild); } + DOMNode* DOMEntityImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {cloneEntityRefTree(); return fParent.replaceChild (newChild, oldChild); } + bool DOMEntityImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMEntityImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMEntityImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMEntityImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMEntityImpl::isEqualNode(const DOMNode* arg) const {cloneEntityRefTree(); return fParent.isEqualNode(arg); } + void* DOMEntityImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMEntityImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMEntityImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMEntityImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMEntityImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMEntityImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMEntityImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMEntityImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMEntityImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + +//Introduced in DOM Level 3 +const XMLCh* DOMEntityImpl::getInputEncoding() const { + return fInputEncoding; +} + +void DOMEntityImpl::setInputEncoding(const XMLCh* actualEncoding){ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fInputEncoding = doc->cloneString(actualEncoding); +} + +const XMLCh* DOMEntityImpl::getXmlEncoding() const { + return fXmlEncoding; +} + +void DOMEntityImpl::setXmlEncoding(const XMLCh* encoding){ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fXmlEncoding = doc->cloneString(encoding); +} + +const XMLCh* DOMEntityImpl::getXmlVersion() const { + return fXmlVersion; +} + +void DOMEntityImpl::setXmlVersion(const XMLCh* version){ + DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument; + fXmlVersion = doc->cloneString(version); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.hpp new file mode 100644 index 000000000..6750b3f36 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityImpl.hpp @@ -0,0 +1,107 @@ +/* + * 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: DOMEntityImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMENTITYIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include "DOMNodeImpl.hpp" +#include "DOMParentNode.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMEntityReference; + +class CDOM_EXPORT DOMEntityImpl: public DOMEntity { +protected: + DOMNodeImpl fNode; + DOMParentNode fParent; + + const XMLCh * fName; + const XMLCh * fPublicId; + const XMLCh * fSystemId; + const XMLCh * fNotationName; + DOMEntityReference* fRefEntity; + + // New data introduced in DOM Level 3 + const XMLCh* fInputEncoding; + const XMLCh* fXmlEncoding; + const XMLCh* fXmlVersion; + const XMLCh* fBaseURI; + bool fEntityRefNodeCloned; + + // helper function + void cloneEntityRefTree() const; + + friend class XercesDOMParser; + +public: + DOMEntityImpl(DOMDocument *doc, const XMLCh *eName); + DOMEntityImpl(const DOMEntityImpl &other, bool deep=false); + virtual ~DOMEntityImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + virtual const XMLCh * getPublicId() const; + virtual const XMLCh * getSystemId() const; + virtual const XMLCh * getNotationName() const; + virtual void setNotationName(const XMLCh *arg); + virtual void setPublicId(const XMLCh *arg); + virtual void setSystemId(const XMLCh *arg); + + //DOM Level 2 additions. Non standard functions + virtual void setEntityRef(DOMEntityReference *); + virtual DOMEntityReference* getEntityRef() const; + + //Introduced in DOM Level 3 + virtual const XMLCh* getInputEncoding() const; + virtual const XMLCh* getXmlEncoding() const; + virtual const XMLCh* getXmlVersion() const; + virtual void setBaseURI(const XMLCh *arg); + + void setInputEncoding(const XMLCh* actualEncoding); + void setXmlEncoding(const XMLCh* encoding); + void setXmlVersion(const XMLCh* version); +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMEntityImpl & operator = (const DOMEntityImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp new file mode 100644 index 000000000..9f52ef2f8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp @@ -0,0 +1,223 @@ +/* + * 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: DOMEntityReferenceImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + +#include "DOMDocumentImpl.hpp" +#include "DOMDocumentTypeImpl.hpp" +#include "DOMEntityImpl.hpp" +#include "DOMEntityReferenceImpl.hpp" + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMEntityReferenceImpl::DOMEntityReferenceImpl(DOMDocument *ownerDoc, + const XMLCh *entityName) + : fNode(ownerDoc), fParent(ownerDoc), fBaseURI(0) +{ + fName = ((DOMDocumentImpl*)fParent.fOwnerDocument)->getPooledString(entityName); + // EntityReference behaves as a read-only node, since its contents + // reflect the Entity it refers to -- but see setNodeName(). + //retrieve the corresponding entity content + + if (ownerDoc) { + if (ownerDoc->getDoctype()) { + if (ownerDoc->getDoctype()->getEntities()) { + DOMEntityImpl* entity = (DOMEntityImpl*)ownerDoc->getDoctype()->getEntities()->getNamedItem(entityName); + if (entity) { + fBaseURI = entity->getBaseURI(); + DOMEntityReference* refEntity = entity->getEntityRef(); + if (refEntity) { + fParent.cloneChildren(refEntity); + } + } + } + } + } + + fNode.setReadOnly(true, true); +} + + +DOMEntityReferenceImpl::DOMEntityReferenceImpl(DOMDocument *ownerDoc, + const XMLCh *entityName, + bool cloneChild) + : fNode(ownerDoc), fParent(ownerDoc), fBaseURI(0) +{ + fName = ((DOMDocumentImpl*)fParent.fOwnerDocument)->getPooledString(entityName); + // EntityReference behaves as a read-only node, since its contents + // reflect the Entity it refers to -- but see setNodeName(). + //retrieve the corresponding entity content + + if (ownerDoc) { + if (ownerDoc->getDoctype()) { + if (ownerDoc->getDoctype()->getEntities()) { + DOMEntityImpl* entity = (DOMEntityImpl*)ownerDoc->getDoctype()->getEntities()->getNamedItem(entityName); + if (entity) { + fBaseURI = entity->getBaseURI(); + if (cloneChild) { + DOMEntityReference* refEntity = entity->getEntityRef(); + if (refEntity) { + fParent.cloneChildren(refEntity); + } + } + } + } + } + } + + fNode.setReadOnly(true, true); +} + +DOMEntityReferenceImpl::DOMEntityReferenceImpl(const DOMEntityReferenceImpl &other, + bool deep) + : DOMEntityReference(other), + fNode(other.fNode), + fParent(other.fParent), + fChild(other.fChild), + fName(other.fName), + fBaseURI(other.fBaseURI) +{ + if (deep) + fParent.cloneChildren(&other); + fNode.setReadOnly(true, true); +} + + + +DOMEntityReferenceImpl::~DOMEntityReferenceImpl() +{ +} + +DOMNode *DOMEntityReferenceImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMEntityReferenceImpl::getNodeName() const +{ + return fName; +} + + +DOMNode::NodeType DOMEntityReferenceImpl::getNodeType() const { + return DOMNode::ENTITY_REFERENCE_NODE; +} + + + +/** +* EntityReferences never have a nodeValue. +* @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) +*/ +void DOMEntityReferenceImpl::setNodeValue(const XMLCh *x) +{ + fNode.setNodeValue(x); +} + + +/** +* EntityRef is already, and must be, a read-only node. Attempts to change +* that will throw a NO_MODIFICATION_ALLOWED_ERR DOMException. +*

+* If you want to alter its contents, edit the Entity definition. +* +* @param readOnly boolean +*/ +void DOMEntityReferenceImpl::setReadOnly(bool readOnl,bool deep) +{ + if(((DOMDocumentImpl *)fParent.fOwnerDocument)->getErrorChecking() && readOnl==false) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + fNode.setReadOnly(readOnl,deep); +} + + +void DOMEntityReferenceImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument; + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fParent.release(); + doc->release(this, DOMMemoryManager::ENTITY_REFERENCE_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +const XMLCh* DOMEntityReferenceImpl::getBaseURI() const +{ + return fBaseURI; +} + + + +// +// Delegate functions from Node to the appropriate implementation. +// + + + DOMNode* DOMEntityReferenceImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); } + DOMNamedNodeMap* DOMEntityReferenceImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMEntityReferenceImpl::getChildNodes() const {return fParent.getChildNodes (); } + DOMNode* DOMEntityReferenceImpl::getFirstChild() const {return fParent.getFirstChild (); } + DOMNode* DOMEntityReferenceImpl::getLastChild() const {return fParent.getLastChild (); } + const XMLCh* DOMEntityReferenceImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMEntityReferenceImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMEntityReferenceImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMEntityReferenceImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMEntityReferenceImpl::getOwnerDocument() const {return fParent.fOwnerDocument; } + const XMLCh* DOMEntityReferenceImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMEntityReferenceImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMEntityReferenceImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMEntityReferenceImpl::hasChildNodes() const {return fParent.hasChildNodes (); } + DOMNode* DOMEntityReferenceImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); } + void DOMEntityReferenceImpl::normalize() {fParent.normalize (); } + DOMNode* DOMEntityReferenceImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); } + DOMNode* DOMEntityReferenceImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); } + bool DOMEntityReferenceImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMEntityReferenceImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMEntityReferenceImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMEntityReferenceImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMEntityReferenceImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); } + void* DOMEntityReferenceImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMEntityReferenceImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMEntityReferenceImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMEntityReferenceImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMEntityReferenceImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMEntityReferenceImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMEntityReferenceImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMEntityReferenceImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMEntityReferenceImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.hpp new file mode 100644 index 000000000..26a718885 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMEntityReferenceImpl.hpp @@ -0,0 +1,79 @@ +/* + * 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: DOMEntityReferenceImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCEIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCEIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +#include "DOMParentNode.hpp" +#include "DOMChildNode.hpp" +#include "DOMNodeImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMEntityReferenceImpl: public DOMEntityReference +{ +protected: + DOMNodeImpl fNode; + DOMParentNode fParent; + DOMChildNode fChild; + + const XMLCh *fName; + const XMLCh *fBaseURI; + + friend class XercesDOMParser; + +public: + DOMEntityReferenceImpl(DOMDocument *ownerDoc, const XMLCh *entityName); + DOMEntityReferenceImpl(DOMDocument *ownerDoc, const XMLCh *entityName, bool cloneChild); + DOMEntityReferenceImpl(const DOMEntityReferenceImpl &other, bool deep=false); + virtual ~DOMEntityReferenceImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + virtual void setReadOnly(bool readOnly,bool deep); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMEntityReferenceImpl & operator = (const DOMEntityReferenceImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.cpp new file mode 100644 index 000000000..f4c8ac067 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.cpp @@ -0,0 +1,90 @@ +/* + * 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: DOMErrorImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMErrorImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Constructors and Destructor +// --------------------------------------------------------------------------- +DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(0) +, fLocation(0) +, fType(0) +, fRelatedData(0) +{ +} + +DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity, + const XMLCh* const message, + DOMLocator* const location) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(message) +, fLocation(location) +, fType(0) +, fRelatedData(0) +{ +} + +DOMErrorImpl::DOMErrorImpl(const ErrorSeverity severity, + const XMLCh* type, + const XMLCh* message, + void* relatedData) : +fAdoptLocation(false) +, fSeverity(severity) +, fMessage(message) +, fLocation(0) +, fType(type) +, fRelatedData(relatedData) +{ + +} + +DOMErrorImpl::~DOMErrorImpl() +{ + if (fAdoptLocation) + delete fLocation; +} + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Setter methods +// --------------------------------------------------------------------------- +void DOMErrorImpl::setLocation(DOMLocator* const location) +{ + if (fAdoptLocation) + delete fLocation; + + fLocation = location; +} + +void DOMErrorImpl::setRelatedException(void*) const +{ + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.hpp new file mode 100644 index 000000000..f4e8488fa --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMErrorImpl.hpp @@ -0,0 +1,188 @@ +/* + * 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: DOMErrorImpl.hpp 676853 2008-07-15 09:58:05Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMERRORIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMERRORIMPL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Introduced in DOM Level 3 + * Implementation of a DOMError interface. + * + * @see DOMError#DOMError + */ + +class CDOM_EXPORT DOMErrorImpl : public DOMError +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** Constructors */ + DOMErrorImpl(const ErrorSeverity severity); + + DOMErrorImpl + ( + const ErrorSeverity severity + , const XMLCh* const message + , DOMLocator* const location + ); + + DOMErrorImpl + ( + const ErrorSeverity severity + , const XMLCh* type + , const XMLCh* message + , void* relatedData + ); + + /** Desctructor */ + virtual ~DOMErrorImpl(); + + //@} + + // DOMError interface + virtual ErrorSeverity getSeverity() const; + virtual const XMLCh* getMessage() const; + virtual DOMLocator* getLocation() const; + virtual void* getRelatedException() const; + virtual const XMLCh* getType() const; + virtual void* getRelatedData() const; + + // Setters + void setSeverity(const ErrorSeverity severity); + void setMessage(const XMLCh* const message); + void setLocation(DOMLocator* const location); + void setAdoptLocation(const bool value); + void setRelatedException(void* exc) const; + void setType(const XMLCh* type); + void setRelatedData(void* relatedData); + +private: + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMErrorImpl(const DOMErrorImpl&); + + /* Assignment operator */ + DOMErrorImpl& operator=(const DOMErrorImpl&); + +protected: + // ----------------------------------------------------------------------- + // Private data members + // + // fAdoptLocation + // Indicates whether we own the DOMLocator object or not. + // + // fSeverity + // The type of the error. + // + // fMessage + // The error message. + // + // fLocation + // The location info of the error. + // + // fType + // The type of the error. + // + // fRelatedData + // The data related to this error. + // + // ----------------------------------------------------------------------- + bool fAdoptLocation; + ErrorSeverity fSeverity; + const XMLCh* fMessage; + DOMLocator* fLocation; + const XMLCh* fType; + void* fRelatedData; +}; + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Getter methods +// --------------------------------------------------------------------------- +inline DOMError::ErrorSeverity DOMErrorImpl::getSeverity() const +{ + return fSeverity; +} + +inline const XMLCh* DOMErrorImpl::getMessage() const +{ + return fMessage; +} + +inline DOMLocator* DOMErrorImpl::getLocation() const +{ + return fLocation; +} + +inline void* DOMErrorImpl::getRelatedException() const +{ + return 0; +} + +inline const XMLCh* DOMErrorImpl::getType() const +{ + return fType; +} + +inline void* DOMErrorImpl::getRelatedData() const +{ + return fRelatedData; +} + +// --------------------------------------------------------------------------- +// DOMErrorImpl: Setter methods +// --------------------------------------------------------------------------- +inline void DOMErrorImpl::setSeverity(const ErrorSeverity severity) +{ + fSeverity = severity; +} + +inline void DOMErrorImpl::setMessage(const XMLCh* const message) +{ + fMessage = message; +} + +inline void DOMErrorImpl::setAdoptLocation(const bool value) +{ + fAdoptLocation = value; +} + +inline void DOMErrorImpl::setType(const XMLCh* type) +{ + fType = type; +} + +inline void DOMErrorImpl::setRelatedData(void* relatedData) +{ + fRelatedData = relatedData; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.cpp new file mode 100644 index 000000000..99240062c --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.cpp @@ -0,0 +1,291 @@ +/* + * 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: DOMImplementationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMImplementationImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMDocumentTypeImpl.hpp" +#include "DOMLSSerializerImpl.hpp" +#include "DOMLSInputImpl.hpp" +#include "DOMLSOutputImpl.hpp" +#include "DOMImplementationListImpl.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// ------------------------------------------------------------ +// Static constants +// ------------------------------------------------------------ +static const XMLCh g1_0[] = // Points to "1.0" + {chDigit_1, chPeriod, chDigit_0, chNull}; +static const XMLCh g2_0[] = // Points to "2.0" + {chDigit_2, chPeriod, chDigit_0, chNull}; +static const XMLCh g3_0[] = // Points to "3.0" + {chDigit_3, chPeriod, chDigit_0, chNull}; +static const XMLCh gTrav[] = // Points to "Traversal" + {chLatin_T, chLatin_r, chLatin_a, chLatin_v, chLatin_e, chLatin_r, + chLatin_s, chLatin_a, chLatin_l, chNull}; +static const XMLCh gCore[] = // Points to "Core" + {chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull}; +static const XMLCh gRange[] = // Points to "Range" + {chLatin_R, chLatin_a, chLatin_n, chLatin_g, chLatin_e, chNull}; +static const XMLCh gLS[] = // Points to "LS" + {chLatin_L, chLatin_S, chNull}; +static const XMLCh gXPath[] = // Points to "XPath" + {chLatin_X, chLatin_P, chLatin_a, chLatin_t, chLatin_h, chNull}; + + +static XMLMsgLoader *sMsgLoader = 0; +static DOMImplementationImpl *gDomimp = 0; + +void XMLInitializer::initializeDOMImplementationImpl() +{ + sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLDOMMsgDomain); + + if (!sMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); + + gDomimp = new DOMImplementationImpl; +} + +void XMLInitializer::terminateDOMImplementationImpl() +{ + delete gDomimp; + gDomimp = 0; + + delete sMsgLoader; + sMsgLoader = 0; +} + +// +// +XMLMsgLoader* DOMImplementationImpl::getMsgLoader4DOM() +{ + return sMsgLoader; +} + +DOMImplementationImpl *DOMImplementationImpl::getDOMImplementationImpl() +{ + return gDomimp; +} + +// ------------------------------------------------------------ +// DOMImplementation Virtual interface +// ------------------------------------------------------------ +bool DOMImplementationImpl::hasFeature(const XMLCh * feature, const XMLCh * version) const +{ + if (!feature) + return false; + + // ignore the + modifier + if(*feature==chPlus) + feature++; + + bool anyVersion = (version == 0 || !*version); + bool version1_0 = XMLString::equals(version, g1_0); + bool version2_0 = XMLString::equals(version, g2_0); + bool version3_0 = XMLString::equals(version, g3_0); + + // Currently, we support only XML Level 1 version 1.0 + if (XMLString::compareIStringASCII(feature, XMLUni::fgXMLString) == 0 + && (anyVersion || version1_0 || version2_0)) + return true; + + if (XMLString::compareIStringASCII(feature, gCore) == 0 + && (anyVersion || version1_0 || version2_0 || version3_0)) + return true; + + if (XMLString::compareIStringASCII(feature, gTrav) == 0 + && (anyVersion || version2_0)) + return true; + + if (XMLString::compareIStringASCII(feature, gRange) == 0 + && (anyVersion || version2_0)) + return true; + + if (XMLString::compareIStringASCII(feature, gLS) == 0 + && (anyVersion || version3_0)) + return true; + + if (XMLString::compareIStringASCII(feature, gXPath) == 0 + && (anyVersion || version3_0)) + return true; + + return false; +} + + +//Introduced in DOM Level 2 +DOMDocumentType *DOMImplementationImpl::createDocumentType(const XMLCh *qualifiedName, + const XMLCh * publicId, const XMLCh *systemId) +{ + // assume XML 1.0 since we do not know its version yet. + if(!XMLChar1_0::isValidName(qualifiedName)) + throw DOMException(DOMException::INVALID_CHARACTER_ERR, 0); + + //to do: do we need to create with user's memorymanager??? + DOMDocumentTypeImpl* docType = new DOMDocumentTypeImpl(0, qualifiedName, publicId, systemId, true); + return docType; +} + +DOMDocument *DOMImplementationImpl::createDocument(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, DOMDocumentType *doctype, + MemoryManager* const manager) +{ + return new (manager) DOMDocumentImpl(namespaceURI, qualifiedName, doctype, this, manager); +} + + +//Introduced in DOM Level 3 +void* DOMImplementationImpl::getFeature(const XMLCh*, const XMLCh*) const { + return 0; +} + +// Non-standard extension +DOMDocument *DOMImplementationImpl::createDocument(MemoryManager* const manager) +{ + return new (manager) DOMDocumentImpl(this, manager); +} + +// +// DOMImplementation::getImplementation. DOMImplementation is supposed to +// be a pure interface class. This one static +// function is the hook that lets things get started. +DOMImplementation *DOMImplementation::getImplementation() +{ + return (DOMImplementation*) DOMImplementationImpl::getDOMImplementationImpl(); +} + +bool DOMImplementation::loadDOMExceptionMsg +( + const short msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars +) +{ + // Figure out which exception range this code is and load the corresponding + // message. + // + if (msgToLoad <= 50) + { + // DOMException + return sMsgLoader->loadMsg(XMLDOMMsg::DOMEXCEPTION_ERRX+msgToLoad, toFill, maxChars); + } + else if (msgToLoad <= 80) + { + // DOMXPathException + return sMsgLoader->loadMsg(XMLDOMMsg::DOMXPATHEXCEPTION_ERRX+msgToLoad-DOMXPathException::INVALID_EXPRESSION_ERR+1, toFill, maxChars); + } + else if (msgToLoad <= 110) + { + // DOMXLSException + return sMsgLoader->loadMsg(XMLDOMMsg::DOMLSEXCEPTION_ERRX+msgToLoad-DOMLSException::PARSE_ERR+1, toFill, maxChars); + } + else + { + // DOMRangeException + return sMsgLoader->loadMsg(XMLDOMMsg::DOMRANGEEXCEPTION_ERRX+msgToLoad-DOMRangeException::BAD_BOUNDARYPOINTS_ERR+1, toFill, maxChars); + } +} + +// ------------------------------------------------------------ +// DOMImplementationLS Virtual interface +// ------------------------------------------------------------ +//Introduced in DOM Level 3 +DOMLSParser* DOMImplementationImpl::createLSParser( const DOMImplementationLSMode mode, + const XMLCh* const /*schemaType*/, + MemoryManager* const manager, + XMLGrammarPool* const gramPool) +{ + if (mode == DOMImplementationLS::MODE_ASYNCHRONOUS) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, manager); + + // TODO: schemaType + return new (manager) DOMLSParserImpl(0, manager, gramPool); +} + + +DOMLSSerializer* DOMImplementationImpl::createLSSerializer(MemoryManager* const manager) +{ + return new (manager) DOMLSSerializerImpl(manager); +} + +DOMLSInput* DOMImplementationImpl::createLSInput(MemoryManager* const manager) +{ + return new (manager) DOMLSInputImpl(manager); +} + +DOMLSOutput* DOMImplementationImpl::createLSOutput(MemoryManager* const manager) +{ + return new (manager) DOMLSOutputImpl(manager); +} + +// ------------------------------------------------------------ +// DOMImplementationSource Virtual interface +// ------------------------------------------------------------ +DOMImplementation* DOMImplementationImpl::getDOMImplementation(const XMLCh* features) const +{ + DOMImplementation* impl = DOMImplementation::getImplementation(); + + XMLStringTokenizer tokenizer(features, XMLPlatformUtils::fgMemoryManager); + const XMLCh* feature = 0; + + while (feature || tokenizer.hasMoreTokens()) { + + if (!feature) + feature = tokenizer.nextToken(); + + const XMLCh* version = 0; + const XMLCh* token = tokenizer.nextToken(); + + if (token && XMLString::isDigit(token[0])) + version = token; + + if (!impl->hasFeature(feature, version)) + return 0; + + if (!version) + feature = token; + } + return impl; +} + +DOMImplementationList* DOMImplementationImpl::getDOMImplementationList(const XMLCh* features) const +{ + DOMImplementationListImpl* list = new DOMImplementationListImpl; + DOMImplementation* myImpl=getDOMImplementation(features); + if(myImpl) + list->add(myImpl); + return list; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.hpp new file mode 100644 index 000000000..e68a32336 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationImpl.hpp @@ -0,0 +1,102 @@ +/* + * 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: DOMImplementationImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLMsgLoader; + +class DOMImplementationImpl: public XMemory, + public DOMImplementation, + public DOMImplementationSource +{ +private: + DOMImplementationImpl(const DOMImplementationImpl &); + DOMImplementationImpl & operator = (const DOMImplementationImpl &); + friend class XMLInitializer; + +protected: + DOMImplementationImpl() {}; + +public: + virtual ~DOMImplementationImpl() {}; + static DOMImplementationImpl* getDOMImplementationImpl(); + static XMLMsgLoader* getMsgLoader4DOM(); + + // ------------------------------------------------------------ + // DOMImplementation Virtual interface + // ------------------------------------------------------------ + virtual bool hasFeature(const XMLCh * feature, const XMLCh * version) const; + + // Introduced in DOM Level 2 + virtual DOMDocumentType* createDocumentType(const XMLCh *qualifiedName, + const XMLCh * publicId, + const XMLCh *systemId); + virtual DOMDocument* createDocument(const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + DOMDocumentType *doctype, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // DOM Level 3 + virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const; + + // Non-standard extension + virtual DOMDocument* createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ------------------------------------------------------------ + // DOMImplementationLS Virtual interface + // ------------------------------------------------------------ + // Introduced in DOM Level 3 + virtual DOMLSParser* createLSParser(const DOMImplementationLSMode mode, + const XMLCh* const schemaType, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager, + XMLGrammarPool* const gramPool = 0); + virtual DOMLSSerializer* createLSSerializer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual DOMLSInput* createLSInput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual DOMLSOutput* createLSOutput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ------------------------------------------------------------ + // DOMImplementationSource Virtual interface + // ------------------------------------------------------------ + virtual DOMImplementation* getDOMImplementation(const XMLCh* features) const; + virtual DOMImplementationList* getDOMImplementationList(const XMLCh* features) const; + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.cpp new file mode 100644 index 000000000..dd3bfbc20 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.cpp @@ -0,0 +1,59 @@ +/* + * 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: DOMImplementationListImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMImplementationListImpl.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMImplementationListImpl::DOMImplementationListImpl() +{ + fList=new RefVectorOf(3, false); +} + + +DOMImplementationListImpl:: ~DOMImplementationListImpl() +{ + delete fList; +} + + +void DOMImplementationListImpl::add(DOMImplementation* impl) { + fList->addElement(impl); +} + +XMLSize_t DOMImplementationListImpl::getLength() const{ + return fList->size(); +} + + +DOMImplementation *DOMImplementationListImpl::item(XMLSize_t index) const +{ + if(indexsize()) + return fList->elementAt(index); + return 0; +} + +void DOMImplementationListImpl::release() { + delete this; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.hpp new file mode 100644 index 000000000..d501e6523 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationListImpl.hpp @@ -0,0 +1,56 @@ +/* + * 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: DOMImplementationListImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLISTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLISTIMPL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMImplementation; + +class CDOM_EXPORT DOMImplementationListImpl: public DOMImplementationList +{ +protected: + RefVectorOf *fList; + +private: + // Unused, and unimplemented constructors, operators, etc. + DOMImplementationListImpl(const DOMImplementationListImpl & other); + DOMImplementationListImpl & operator = (const DOMImplementationListImpl & other); + +public: + DOMImplementationListImpl(); + void add(DOMImplementation* impl); + + virtual ~DOMImplementationListImpl(); + virtual DOMImplementation * item(XMLSize_t index) const; + virtual XMLSize_t getLength() const; + virtual void release(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationRegistry.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationRegistry.cpp new file mode 100644 index 000000000..5d7dc11d4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMImplementationRegistry.cpp @@ -0,0 +1,117 @@ +/* + * 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: DOMImplementationRegistry.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include "DOMImplementationImpl.hpp" +#include "DOMImplementationListImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +// Points to the singleton instance of a registry of DOMImplementationSource. +// +static RefVectorOf* gDOMImplSrcVector = 0; + +// Global mutex that is used to synchronize access to the vector. +// +static XMLMutex* gDOMImplSrcVectorMutex = 0; + +void XMLInitializer::initializeDOMImplementationRegistry() +{ + gDOMImplSrcVectorMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager); + gDOMImplSrcVector = new RefVectorOf(3, false); +} + +void XMLInitializer::terminateDOMImplementationRegistry() +{ + delete gDOMImplSrcVector; + gDOMImplSrcVector = 0; + + delete gDOMImplSrcVectorMutex; + gDOMImplSrcVectorMutex = 0; +} + +// ----------------------------------------------------------------------- +// DOMImplementationRegistry Functions +// ----------------------------------------------------------------------- +DOMImplementation *DOMImplementationRegistry::getDOMImplementation(const XMLCh* features) { + + XMLMutexLock lock(gDOMImplSrcVectorMutex); + + XMLSize_t len = gDOMImplSrcVector->size(); + + // Put our defined source there + if (len == 0) { + gDOMImplSrcVector->addElement((DOMImplementationSource*)DOMImplementationImpl::getDOMImplementationImpl()); + + len = gDOMImplSrcVector->size(); + } + + for (XMLSize_t i = len; i > 0; i--) { + DOMImplementationSource* source = gDOMImplSrcVector->elementAt(i-1); + DOMImplementation* impl = source->getDOMImplementation(features); + if (impl) + return impl; + } + + return 0; +} + +DOMImplementationList* DOMImplementationRegistry::getDOMImplementationList(const XMLCh* features) { + + DOMImplementationListImpl* list = new DOMImplementationListImpl; + + XMLMutexLock lock(gDOMImplSrcVectorMutex); + + XMLSize_t len = gDOMImplSrcVector->size(); + + // Put our defined source there + if (len == 0) + gDOMImplSrcVector->addElement((DOMImplementationSource*)DOMImplementationImpl::getDOMImplementationImpl()); + + len = gDOMImplSrcVector->size(); + + for (XMLSize_t i = len; i > 0; i--) { + DOMImplementationSource* source = gDOMImplSrcVector->elementAt(i-1); + DOMImplementationList* oneList = source->getDOMImplementationList(features); + XMLSize_t oneListLen=oneList->getLength(); + for(XMLSize_t j=0; jadd(oneList->item(j)); + oneList->release(); + } + + return list; +} + +void DOMImplementationRegistry::addSource (DOMImplementationSource* source) +{ + XMLMutexLock lock(gDOMImplSrcVectorMutex); + gDOMImplSrcVector->addElement(source); +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.cpp new file mode 100644 index 000000000..c70dc969a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.cpp @@ -0,0 +1,95 @@ +/* + * 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: DOMLSInputImpl.cpp 752848 2009-03-12 12:44:40Z amassari $ + */ + +#include "DOMLSInputImpl.hpp" + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMLSInputImpl::DOMLSInputImpl(MemoryManager* const manager /*= XMLPlatformUtils::fgMemoryManager*/) +:fStringData(0) +,fByteStream(0) +,fEncoding(0) +,fPublicId(0) +,fSystemId(0) +,fBaseURI(0) +,fIssueFatalErrorIfNotFound(true) +,fMemoryManager(manager) +{ +} + +DOMLSInputImpl::~DOMLSInputImpl() +{ + fMemoryManager->deallocate(fEncoding); + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + fMemoryManager->deallocate(fBaseURI); +} + +void DOMLSInputImpl::setStringData(const XMLCh* data) +{ + fStringData=data; + setEncoding(XMLUni::fgXMLChEncodingString); +} + +void DOMLSInputImpl::setByteStream(InputSource* stream) +{ + fByteStream=stream; +} + +void DOMLSInputImpl::setEncoding(const XMLCh* const encodingStr) +{ + fMemoryManager->deallocate(fEncoding); + fEncoding = XMLString::replicate(encodingStr, fMemoryManager); +} + +void DOMLSInputImpl::setPublicId(const XMLCh* const publicId) +{ + fMemoryManager->deallocate(fPublicId); + fPublicId = XMLString::replicate(publicId, fMemoryManager); +} + +void DOMLSInputImpl::setSystemId(const XMLCh* const systemId) +{ + fMemoryManager->deallocate(fSystemId); + fSystemId = XMLString::replicate(systemId, fMemoryManager); +} + +void DOMLSInputImpl::setBaseURI(const XMLCh* const baseURI) +{ + fMemoryManager->deallocate(fBaseURI); + fBaseURI = XMLString::replicate(baseURI, fMemoryManager); +} + +void DOMLSInputImpl::setIssueFatalErrorIfNotFound(bool flag) +{ + fIssueFatalErrorIfNotFound=flag; +} + +void DOMLSInputImpl::release() +{ + delete this; +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.hpp new file mode 100644 index 000000000..cad5d6267 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSInputImpl.hpp @@ -0,0 +1,134 @@ +/* + * 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: DOMLSInputImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSINPUTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSINPUTIMPL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CDOM_EXPORT DOMLSInputImpl : public XMemory, public DOMLSInput +{ + +public: + + DOMLSInputImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMLSInputImpl(); + + virtual const XMLCh* getStringData() const; + virtual InputSource* getByteStream() const; + virtual const XMLCh* getEncoding() const; + virtual const XMLCh* getPublicId() const; + virtual const XMLCh* getSystemId() const; + virtual const XMLCh* getBaseURI() const; + + virtual void setStringData(const XMLCh* data); + virtual void setByteStream(InputSource* stream); + virtual void setEncoding(const XMLCh* const encodingStr); + virtual void setPublicId(const XMLCh* const publicId); + virtual void setSystemId(const XMLCh* const systemId); + virtual void setBaseURI(const XMLCh* const baseURI); + + virtual void setIssueFatalErrorIfNotFound(bool flag); + virtual bool getIssueFatalErrorIfNotFound() const; + virtual void release(); + + +private: + /** unimplemented copy ctor and assignment operator */ + DOMLSInputImpl(const DOMLSInputImpl&); + DOMLSInputImpl & operator = (const DOMLSInputImpl&); + +protected: + // ----------------------------------------------------------------------- + // Private data members + // + // fStringData + // We don't own it + // + // fByteStream + // We don't own it + // + // fEncoding + // We own it + // + // fPublicId + // We own it + // + // fSystemId + // We own it + // + // fBaseURI + // We own it + // + // ----------------------------------------------------------------------- + + const XMLCh *fStringData; + InputSource *fByteStream; + XMLCh *fEncoding; + XMLCh *fPublicId; + XMLCh *fSystemId; + XMLCh *fBaseURI; + bool fIssueFatalErrorIfNotFound; + MemoryManager* fMemoryManager; +}; + +inline const XMLCh* DOMLSInputImpl::getStringData() const +{ + return fStringData; +} + +inline InputSource* DOMLSInputImpl::getByteStream() const +{ + return fByteStream; +} + +inline const XMLCh* DOMLSInputImpl::getEncoding() const +{ + return fEncoding; +} + +inline const XMLCh* DOMLSInputImpl::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* DOMLSInputImpl::getSystemId() const +{ + return fSystemId; +} + +inline const XMLCh* DOMLSInputImpl::getBaseURI() const +{ + return fBaseURI; +} + +inline bool DOMLSInputImpl::getIssueFatalErrorIfNotFound() const +{ + return fIssueFatalErrorIfNotFound; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.cpp new file mode 100644 index 000000000..07ba2c8e5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.cpp @@ -0,0 +1,66 @@ +/* + * 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: DOMLSOutputImpl.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include "DOMLSOutputImpl.hpp" + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMLSOutputImpl::DOMLSOutputImpl(MemoryManager* const manager /*= XMLPlatformUtils::fgMemoryManager*/) +:fByteStream(0) +,fEncoding(0) +,fSystemId(0) +,fMemoryManager(manager) +{ +} + +DOMLSOutputImpl::~DOMLSOutputImpl() +{ + fMemoryManager->deallocate(fEncoding); + fMemoryManager->deallocate(fSystemId); +} + +void DOMLSOutputImpl::setByteStream(XMLFormatTarget* stream) +{ + fByteStream=stream; +} + +void DOMLSOutputImpl::setEncoding(const XMLCh* const encodingStr) +{ + fMemoryManager->deallocate(fEncoding); + fEncoding = XMLString::replicate(encodingStr, fMemoryManager); +} + +void DOMLSOutputImpl::setSystemId(const XMLCh* const systemId) +{ + fMemoryManager->deallocate(fSystemId); + fSystemId = XMLString::replicate(systemId, fMemoryManager); +} + +void DOMLSOutputImpl::release() +{ + delete this; +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.hpp new file mode 100644 index 000000000..2d3565e74 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSOutputImpl.hpp @@ -0,0 +1,92 @@ +/* + * 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: DOMLSOutputImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSOUTPUTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSOUTPUTIMPL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CDOM_EXPORT DOMLSOutputImpl : public XMemory, public DOMLSOutput +{ + +public: + + DOMLSOutputImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMLSOutputImpl(); + + virtual XMLFormatTarget* getByteStream() const; + virtual const XMLCh* getEncoding() const; + virtual const XMLCh* getSystemId() const; + + virtual void setByteStream(XMLFormatTarget* stream); + virtual void setEncoding(const XMLCh* const encodingStr); + virtual void setSystemId(const XMLCh* const systemId); + + virtual void release(); + +private: + + /** unimplemented copy ctor and assignment operator */ + DOMLSOutputImpl(const DOMLSOutputImpl&); + DOMLSOutputImpl & operator = (const DOMLSOutputImpl&); + +protected: + // ----------------------------------------------------------------------- + // Private data members + // + // fByteStream + // We don't own it + // + // fEncoding + // We own it + // + // fSystemId + // We own it + // + // ----------------------------------------------------------------------- + + XMLFormatTarget *fByteStream; + XMLCh *fEncoding; + XMLCh *fSystemId; + MemoryManager* fMemoryManager; +}; + +inline XMLFormatTarget* DOMLSOutputImpl::getByteStream() const +{ + return fByteStream; +} + +inline const XMLCh* DOMLSOutputImpl::getEncoding() const +{ + return fEncoding; +} + +inline const XMLCh* DOMLSOutputImpl::getSystemId() const +{ + return fSystemId; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp new file mode 100644 index 000000000..cc0c51f8a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp @@ -0,0 +1,1721 @@ +/* + * 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: DOMLSSerializerImpl.cpp 768978 2009-04-27 13:45:52Z amassari $ + */ + +#include "DOMLSSerializerImpl.hpp" +#include "DOMLSOutputImpl.hpp" +#include "DOMErrorImpl.hpp" +#include "DOMLocatorImpl.hpp" +#include "DOMImplementationImpl.hpp" +#include "DOMStringListImpl.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// Local const data +// +// --------------------------------------------------------------------------- + +static const int INVALID_FEATURE_ID = -1; +static const int CANONICAL_FORM_ID = 0x0; +static const int DISCARD_DEFAULT_CONTENT_ID = 0x1; +static const int ENTITIES_ID = 0x2; +static const int FORMAT_PRETTY_PRINT_ID = 0x3; +static const int NORMALIZE_CHARACTERS_ID = 0x4; +static const int SPLIT_CDATA_SECTIONS_ID = 0x5; +static const int VALIDATION_ID = 0x6; +static const int WHITESPACE_IN_ELEMENT_CONTENT_ID = 0x7; +static const int BYTE_ORDER_MARK_ID = 0x8; +static const int XML_DECLARATION = 0x9; +static const int FORMAT_PRETTY_PRINT_1ST_LEVEL_ID = 0xA; + +// feature true false +// ================================================================================ +//canonical-form [optional] Not Supported [required] (default) +//discard-default-content [required] (default) [required] +//entity [required] (default) [optional] +//format-pretty-print [optional] Partially Supported [required] (default) +//normalize-characters [optional] Not Supported [required] (default) +//split-cdata-sections [required] (default) [required] +//validation [optional] Not Supported [required] (default) +//whitespace-in-element-content [requierd] (default) [optional] Not Supported +// + +// +// Each feature has 2 entries in this array, +// the first for "true", +// the second for "false". +// +static const bool featuresSupported[] = { + false, true, // canonical-form + true, true, // discard-default-content + true, true, // entity + true, true, // format-pretty-print + false, true, // normalize-characters + true, true, // split-cdata-sections + false, true, // validation + true, false, // whitespace-in-element-content + true, true, // http://apache.org/xml/features/dom/byte-order-mark + true, true, // xml-declaration + true, true // http://apache.org/xml/features/pretty-print/space-first-level-elements +}; + +// default end-of-line sequence +static const XMLCh gEOLSeq[] = +{ + chLF, chNull +}; + +//UTF-8 +static const XMLCh gUTF8[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_8, chNull +}; + +// +static const XMLCh gEndPI[] = +{ + chQuestion, chCloseAngle, chNull +}; + +// +static const XMLCh gXMLDecl_endtag[] = +{ + chQuestion, chCloseAngle, chNull +}; + +// +static const XMLCh gEndCDATA[] = +{ +// chCloseSquare, chCloseAngle, chCloseAngle, chNull // test only: ]>> + chCloseSquare, chCloseSquare, chCloseAngle, chNull +}; + +// +static const XMLCh gEndComment[] = +{ + chDash, chDash, chCloseAngle, chNull +}; + +//setUnRepFlags(XMLFormatter::UnRep_Fail); \ +try \ +{ \ + action; \ +} \ +catch(TranscodingException const &e) \ +{ \ + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, e.getMessage()); \ + throw e; \ +} + +DOMLSSerializerImpl::~DOMLSSerializerImpl() +{ + fMemoryManager->deallocate(fNewLine);//delete [] fNewLine; + delete fNamespaceStack; + delete fSupportedParameters; + // we don't own/adopt error handler and filter +} + +DOMLSSerializerImpl::DOMLSSerializerImpl(MemoryManager* const manager) +:fFeatures(0) +,fNewLine(0) +,fErrorHandler(0) +,fFilter(0) +,fDocumentVersion(XMLUni::fgVersion1_0) +,fSupportedParameters(0) +,fEncodingUsed(0) +,fNewLineUsed(0) +,fFormatter(0) +,fErrorCount(0) +,fCurrentLine(0) +,fLineFeedInTextNodePrinted(false) +,fLastWhiteSpaceInTextNode(0) +,fNamespaceStack(0) +,fMemoryManager(manager) +{ + fNamespaceStack=new (fMemoryManager) RefVectorOf< RefHashTableOf >(0,true, fMemoryManager); + + // + // set features to default setting + // + setFeature(CANONICAL_FORM_ID, false); + setFeature(DISCARD_DEFAULT_CONTENT_ID, true ); + setFeature(ENTITIES_ID, true ); + setFeature(FORMAT_PRETTY_PRINT_ID, false); + setFeature(NORMALIZE_CHARACTERS_ID, false); + setFeature(SPLIT_CDATA_SECTIONS_ID, true ); + setFeature(VALIDATION_ID, false); + setFeature(WHITESPACE_IN_ELEMENT_CONTENT_ID, true ); + setFeature(BYTE_ORDER_MARK_ID, false); + setFeature(XML_DECLARATION, true ); + setFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID, true ); + + fSupportedParameters=new (fMemoryManager) DOMStringListImpl(12, fMemoryManager); + fSupportedParameters->add(XMLUni::fgDOMErrorHandler); + fSupportedParameters->add(XMLUni::fgDOMWRTCanonicalForm); + fSupportedParameters->add(XMLUni::fgDOMWRTDiscardDefaultContent); + fSupportedParameters->add(XMLUni::fgDOMWRTEntities); + fSupportedParameters->add(XMLUni::fgDOMWRTFormatPrettyPrint); + fSupportedParameters->add(XMLUni::fgDOMWRTNormalizeCharacters); + fSupportedParameters->add(XMLUni::fgDOMWRTSplitCdataSections); + fSupportedParameters->add(XMLUni::fgDOMWRTValidation); + fSupportedParameters->add(XMLUni::fgDOMWRTWhitespaceInElementContent); + fSupportedParameters->add(XMLUni::fgDOMWRTBOM); + fSupportedParameters->add(XMLUni::fgDOMXMLDeclaration); + fSupportedParameters->add(XMLUni::fgDOMWRTXercesPrettyPrint); +} + +bool DOMLSSerializerImpl::canSetParameter(const XMLCh* featName + , const void* /*value*/) const +{ + if(XMLString::compareIStringASCII(featName, XMLUni::fgDOMErrorHandler)==0) + return true; + return false; +} + +bool DOMLSSerializerImpl::canSetParameter(const XMLCh* featName + , bool state) const +{ + int featureId = INVALID_FEATURE_ID; + return checkFeature(featName, false, featureId) ? canSetFeature(featureId, state) : false; +} + +void DOMLSSerializerImpl::setParameter(const XMLCh* featName + , const void* value) +{ + if(XMLString::compareIStringASCII(featName, XMLUni::fgDOMErrorHandler)==0) + fErrorHandler = (DOMErrorHandler*)value; + else + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); +} + +void DOMLSSerializerImpl::setParameter(const XMLCh* featName + , bool state) +{ + int featureId = INVALID_FEATURE_ID; + checkFeature(featName, true, featureId); + + if (!canSetFeature(featureId, state)) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); + + setFeature(featureId, state); + + // + // setting "canonical-form" to true will set the parameters "format-pretty-print", + // "discard-default-content", and "xml-declaration", to false + // + if ((featureId == CANONICAL_FORM_ID) && state) + { + setFeature(FORMAT_PRETTY_PRINT_ID, false); + setFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID, false); + setFeature(DISCARD_DEFAULT_CONTENT_ID, false); + setFeature(XML_DECLARATION, false); + } + // Setting one of those parameters to true will set "canonical-form" to false. + if ((featureId == FORMAT_PRETTY_PRINT_ID || featureId == DISCARD_DEFAULT_CONTENT_ID || featureId == XML_DECLARATION) && state) + setFeature(CANONICAL_FORM_ID, false); +} + +const void* DOMLSSerializerImpl::getParameter(const XMLCh* featName) const +{ + if(XMLString::compareIStringASCII(featName, XMLUni::fgDOMErrorHandler)==0) + { + return (void*)fErrorHandler; + } + else + { + int featureId = INVALID_FEATURE_ID; + checkFeature(featName, true, featureId); + return (void*)getFeature(featureId); + } +} + +const DOMStringList* DOMLSSerializerImpl::getParameterNames() const +{ + return fSupportedParameters; +} + +void DOMLSSerializerImpl::setNewLine(const XMLCh* const newLine) +{ + fMemoryManager->deallocate(fNewLine);//delete [] fNewLine; + fNewLine = XMLString::replicate(newLine, fMemoryManager); +} + +const XMLCh* DOMLSSerializerImpl::getNewLine() const +{ + return fNewLine; +} + +void DOMLSSerializerImpl::setFilter(DOMLSSerializerFilter *filter) +{ + fFilter = filter; +} + +DOMLSSerializerFilter* DOMLSSerializerImpl::getFilter() const +{ + return fFilter; +} + +// +// +// +bool DOMLSSerializerImpl::write(const DOMNode* nodeToWrite, + DOMLSOutput* const destination) +{ + XMLFormatTarget* pTarget=destination->getByteStream(); + Janitor janTarget(0); + if(!pTarget) + { + const XMLCh* szSystemId=destination->getSystemId(); + if(!szSystemId) + { + //TODO: report error "missing target" + return false; + } + pTarget=new LocalFileFormatTarget(szSystemId, fMemoryManager); + janTarget.reset(pTarget); + } + /** + * When writing to a LSOutput, the encoding is found by looking at the encoding information + * that is reachable through the LSOutput and the item to be written (or its owner document) in this order: + * + * 1. LSOutput.encoding, + * 2. Document.inputEncoding, + * 3. Document.xmlEncoding. + * + * If no encoding is reachable through the above properties, a default encoding of "UTF-8" will be used. + * If the specified encoding is not supported an "unsupported-encoding" fatal error is raised. + */ + fEncodingUsed = gUTF8; + + const DOMDocument *docu = (nodeToWrite->getNodeType() == DOMNode::DOCUMENT_NODE)? + (const DOMDocument*)nodeToWrite : nodeToWrite->getOwnerDocument(); + + const XMLCh* lsEncoding=destination->getEncoding(); + if (lsEncoding && *lsEncoding) + { + fEncodingUsed = lsEncoding; + } + else if (docu) + { + const XMLCh* tmpEncoding = docu->getInputEncoding(); + + if ( tmpEncoding && *tmpEncoding) + { + fEncodingUsed = tmpEncoding; + } + else + { + tmpEncoding = docu->getXmlEncoding(); + + if ( tmpEncoding && *tmpEncoding) + { + fEncodingUsed = tmpEncoding; + } + } + } + + + /** + * The end-of-line sequence of characters to be used in the XML being + * written out. The only permitted values are these: + * . null + * + * Use a default end-of-line sequence. DOM implementations should choose + * the default to match the usual convention for text files in the + * environment being used. Implementations must choose a default + * sequence that matches one of those allowed by 2.11 "End-of-Line + * Handling". + * + * CR The carriage-return character (#xD) + * CR-LF The carriage-return and line-feed characters (#xD #xA) + * LF The line-feed character (#xA) + * + * The default value for this attribute is null + */ + fNewLineUsed = (fNewLine && *fNewLine)? fNewLine : gEOLSeq; + + /** + * get Document Version + */ + fDocumentVersion = (docu && docu->getXmlVersion() && *(docu->getXmlVersion()))?docu->getXmlVersion():XMLUni::fgVersion1_0; + + fErrorCount = 0; + + fLineFeedInTextNodePrinted = false; + fLastWhiteSpaceInTextNode = 0; + + try + { + fFormatter = new (fMemoryManager) XMLFormatter( fEncodingUsed + ,fDocumentVersion + ,pTarget + ,XMLFormatter::NoEscapes + ,XMLFormatter::UnRep_CharRef + ,fMemoryManager); + } + catch (const TranscodingException& e) + { + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, e.getMessage()); + return false; + } + + try + { + Janitor janName(fFormatter); + processNode(nodeToWrite); + pTarget->flush(); + } + + // + // The serialize engine (processNode) throws an exception to abort + // serialization if + // + // . A fatal error occurs which renders the output ill-formed, or + // . Instructed by the application's error handler + // + catch (const TranscodingException&) + { + pTarget->flush(); + return false; + } + + catch (const XMLDOMMsg::Codes) + { + pTarget->flush(); + return false; + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) + { + pTarget->flush(); + throw; + } + + // + // true if node was successfully serialized and + // false in case a failure occured and the + // failure wasn't canceled by the error handler. + // + return ((fErrorCount == 0)? true : false); +} + +bool DOMLSSerializerImpl::writeToURI(const DOMNode* nodeToWrite, const XMLCh* uri) +{ + DOMLSOutputImpl output(fMemoryManager); + output.setSystemId(uri); + return write(nodeToWrite, &output); +} + +// +// We don't throw DOMSTRING_SIZE_ERR since we are no longer +// using DOMString. +// +XMLCh* DOMLSSerializerImpl::writeToString(const DOMNode* nodeToWrite, MemoryManager* manager /*= NULL*/) +{ + if(manager==NULL) + manager = fMemoryManager; + MemBufFormatTarget destination(1023, manager); + bool retVal; + + bool bBOMFlag=getFeature(BYTE_ORDER_MARK_ID); + setFeature(BYTE_ORDER_MARK_ID, false); + try + { + DOMLSOutputImpl output(manager); + output.setByteStream(&destination); + output.setEncoding(XMLUni::fgUTF16EncodingString); + retVal = write(nodeToWrite, &output); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) + { + // + // there is a possibility that memory allocation + // exception thrown in XMLBuffer class + // + setFeature(BYTE_ORDER_MARK_ID, bBOMFlag); + return 0; + } + + setFeature(BYTE_ORDER_MARK_ID, bBOMFlag); + return (retVal ? XMLString::replicate((XMLCh*) destination.getRawBuffer(), manager) : 0); +} + +// +// Characters not representable in output encoding, +// +// 1. CHARACTER DATA (outside of markup) --- no error +// ordinary character -> numeric character reference +// '<' and '&' -> < and & +// +// 2. Within MARKUP, but outside of attributes +// reported as an error --- ERROR +// markup: +// start tag done +// end tag done +// empty element tag done +// entity references done +// character references // REVISIT +// comments done +// CDATA section delimiters done, done +// document type declarartions done +// processing instructions (PI) done +// +// 3. With in ATTRIBUTE +// -> numeric character reference +// no quotes -> in quotes +// with quotes, no apostrophe -> in apostrophe +// with quotes and apostrophe -> in quotes and " +// +// 4. CDATA sections +// "split_cdata_section" true --- char ref +// false --- ERROR +// +// --------------------------------------------------------------------------- +// Stream out a DOM node, and, recursively, all of its children. This +// function is the heart of writing a DOM tree out as XML source. Give it +// a document node and it will do the whole thing. +// --------------------------------------------------------------------------- + +void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int level) +{ + + // Get the name and value out for convenience + const XMLCh* nodeName = nodeToWrite->getNodeName(); + const XMLCh* nodeValue = nodeToWrite->getNodeValue(); + XMLSize_t lent = XMLString::stringLen(nodeValue); + + switch (nodeToWrite->getNodeType()) + { + case DOMNode::TEXT_NODE: + { + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + if (getFeature(FORMAT_PRETTY_PRINT_ID)) + { + fLineFeedInTextNodePrinted = false; + fLastWhiteSpaceInTextNode = 0; + + if(XMLChar1_0::isAllSpaces(nodeValue, XMLString::stringLen(nodeValue))) + { + // skips whitespace-only text nodes unless whitespace-in-element is set. + if (!getFeature(WHITESPACE_IN_ELEMENT_CONTENT_ID)) + { + break; + } + else + { + // + // we need to trace if newline(s) have been printed out + // to avoid generate extra newline for pretty printing, + // as well as the number of whitespaces after the last + // newline character to do indentation properly. + // + int pos = XMLString::lastIndexOf(nodeValue, chLF); + if (-1 != pos) + { + fLineFeedInTextNodePrinted = true; + fLastWhiteSpaceInTextNode = (unsigned int)(lent - pos); + } + else + { + // for those platforms using chCR alone as + // a newline character + pos = XMLString::lastIndexOf(nodeValue, chCR); + if (-1 != pos) + { + fLineFeedInTextNodePrinted = true; + fLastWhiteSpaceInTextNode = (unsigned int)(lent - pos); + } + } + } + } + } + + setURCharRef(); // character data + fFormatter->formatBuf(nodeValue, lent, XMLFormatter::CharEscapes); + break; + } + + case DOMNode::PROCESSING_INSTRUCTION_NODE: + { + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + if(level == 1 && getFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID)) + printNewLine(); + + printNewLine(); + printIndent(level); + + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gStartPI << nodeName; + if (lent > 0) + { + *fFormatter << chSpace << nodeValue; + } + *fFormatter << gEndPI; + ) + break; + } + + case DOMNode::DOCUMENT_NODE: // Not to be shown to Filter + { + + // output BOM if needed + processBOM(); + + setURCharRef(); + const DOMDocument *docu = (const DOMDocument*)nodeToWrite; + + //[23] XMLDecl ::= '' + //[24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') + //[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName + //[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) + // + + if (getFeature(XML_DECLARATION)) { + // use the version and encoding resolved + *fFormatter << gXMLDecl_VersionInfo << fDocumentVersion << gXMLDecl_separator; + *fFormatter << gXMLDecl_EncodingDecl << fEncodingUsed << gXMLDecl_separator; + + const XMLCh* st = (docu->getXmlStandalone())? XMLUni::fgYesString : XMLUni::fgNoString; + *fFormatter << gXMLDecl_SDDecl << st << gXMLDecl_separator; + + *fFormatter << gXMLDecl_endtag; + } + + DOMNodeSPtr child = nodeToWrite->getFirstChild(); + while( child != 0) + { + processNode(child, level); + child = child->getNextSibling(); + } + printNewLine(); + break; + } + + case DOMNode::DOCUMENT_FRAGMENT_NODE: + { + + setURCharRef(); + + DOMNode *child = nodeToWrite->getFirstChild(); + while( child != 0) + { + processNode(child, level); + child = child->getNextSibling(); + } + printNewLine(); + break; + } + + case DOMNode::ELEMENT_NODE: + { + DOMNodeFilter::FilterAction filterAction = checkFilter(nodeToWrite); + + if ( filterAction == DOMNodeFilter::FILTER_REJECT) + break; + + if (!fLineFeedInTextNodePrinted) + { + if(level == 1 && getFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID)) + printNewLine(); + + printNewLine(); + } + else + { + fLineFeedInTextNodePrinted = false; + } + + printIndent(level); + + //track the line number the current node begins on + int nodeLine = fCurrentLine; + + // add an entry in the namespace stack + RefHashTableOf* namespaceMap=NULL; + + if ( filterAction == DOMNodeFilter::FILTER_ACCEPT) + { + // this element attributes child elements + // accept yes yes yes + // skip no no yes + // + TRY_CATCH_THROW + ( + // The name has to be representable without any escapes + *fFormatter << XMLFormatter::NoEscapes + << chOpenAngle << nodeName; + ) + + // Output any attributes on this element + setURCharRef(); + DOMNamedNodeMap *attributes = nodeToWrite->getAttributes(); + XMLSize_t attrCount = attributes->getLength(); + + // check if the namespace for the current node is already defined + const XMLCh* prefix = nodeToWrite->getPrefix(); + const XMLCh* uri = nodeToWrite->getNamespaceURI(); + if((uri && uri[0]) || ((prefix==0 || prefix[0]==0) && isDefaultNamespacePrefixDeclared())) + { + if(prefix==0 || prefix[0]==0) + prefix=XMLUni::fgZeroLenString; + if(!isNamespaceBindingActive(prefix, uri)) + { + if(namespaceMap==NULL) + { + namespaceMap=new (fMemoryManager) RefHashTableOf(12, false, fMemoryManager); + fNamespaceStack->addElement(namespaceMap); + } + namespaceMap->put((void*)prefix,(XMLCh*)uri); + *fFormatter << XMLFormatter::NoEscapes + << chSpace << XMLUni::fgXMLNSString; + if(!XMLString::equals(prefix,XMLUni::fgZeroLenString)) + *fFormatter << chColon << prefix; + *fFormatter << chEqual << chDoubleQuote + << XMLFormatter::AttrEscapes + << uri + << XMLFormatter::NoEscapes + << chDoubleQuote; + } + } + + bool discard = getFeature(DISCARD_DEFAULT_CONTENT_ID); + for (XMLSize_t i = 0; i < attrCount; i++) + { + DOMAttrSPtr attribute = (DOMAttr*)attributes->item(i); + + // Not to be shown to Filter + + // + //"discard-default-content" + // true + // [required] (default) + // Use whatever information available to the implementation + // (i.e. XML schema, DTD, the specified flag on Attr nodes, + // and so on) to decide what attributes and content should be + // discarded or not. + // Note that the specified flag on Attr nodes in itself is + // not always reliable, it is only reliable when it is set + // to false since the only case where it can be set to false + // is if the attribute was created by the implementation. + // The default content won't be removed if an implementation + // does not have any information available. + // false + // [required] + // Keep all attributes and all content. + // + if (discard && !((DOMAttr*)attribute )->getSpecified()) + continue; + // + // Again the name has to be completely representable. But the + // attribute can have refs and requires the attribute style + // escaping. + // + + // if this attribute is a namespace declaration, add it to the namespace map for the current level + const XMLCh* ns = attribute->getNamespaceURI(); + if (ns != 0 ) + { + if(XMLString::equals(ns, XMLUni::fgXMLNSURIName)) + { + if(namespaceMap==NULL) + { + namespaceMap=new (fMemoryManager) RefHashTableOf(12, false, fMemoryManager); + fNamespaceStack->addElement(namespaceMap); + } + const XMLCh* nsPrefix = attribute->getLocalName(); + if(XMLString::equals(attribute->getNodeName(),XMLUni::fgXMLNSString)) + nsPrefix = XMLUni::fgZeroLenString; + if(namespaceMap->containsKey((void*)nsPrefix)) + continue; + namespaceMap->put((void*)attribute->getLocalName(),(XMLCh*)attribute->getNodeValue()); + } + else if(!XMLString::equals(ns, XMLUni::fgXMLURIName)) + { + // check if the namespace for the current node is already defined + const XMLCh* prefix = attribute->getPrefix(); + if(prefix && prefix[0]) + { + const XMLCh* uri = attribute->getNamespaceURI(); + if(!isNamespaceBindingActive(prefix, uri)) + { + if(namespaceMap==NULL) + { + namespaceMap=new (fMemoryManager) RefHashTableOf(12, false, fMemoryManager); + fNamespaceStack->addElement(namespaceMap); + } + namespaceMap->put((void*)prefix,(XMLCh*)uri); + *fFormatter << XMLFormatter::NoEscapes + << chSpace << XMLUni::fgXMLNSString << chColon << prefix + << chEqual << chDoubleQuote + << XMLFormatter::AttrEscapes + << uri + << XMLFormatter::NoEscapes + << chDoubleQuote; + } + } + } + } + if (XMLString::equals(ns, XMLUni::fgXMLNSURIName) || checkFilter(attribute) == DOMNodeFilter::FILTER_ACCEPT) + { + *fFormatter << XMLFormatter::NoEscapes + << chSpace << attribute->getNodeName() + << chEqual << chDoubleQuote + << XMLFormatter::AttrEscapes; + if (getFeature(ENTITIES_ID)) + { + DOMNodeSPtr child = attribute->getFirstChild(); + while( child != 0) + { + if(child->getNodeType()==DOMNode::TEXT_NODE) + *fFormatter << child->getNodeValue(); + else if(child->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + *fFormatter << XMLFormatter::NoEscapes + << chAmpersand << child->getNodeName() << chSemiColon + << XMLFormatter::AttrEscapes; + child = child->getNextSibling(); + } + } + else + *fFormatter << attribute->getNodeValue(); + *fFormatter << XMLFormatter::NoEscapes + << chDoubleQuote; + } + } // end of for + } // end of FILTER_ACCEPT + + level++; + + // FILTER_SKIP may start from here + + // + // Test for the presence of children, which includes both + // text content and nested elements. + // + DOMNodeSPtr child = nodeToWrite->getFirstChild(); + if (child != 0) + { + // There are children. Close start-tag, and output children. + // No escapes are legal here + if (filterAction == DOMNodeFilter::FILTER_ACCEPT) + *fFormatter << XMLFormatter::NoEscapes << chCloseAngle; + + while( child != 0) + { + processNode(child, level); + child = child->getNextSibling(); + } + + level--; + + if (filterAction == DOMNodeFilter::FILTER_ACCEPT) + { + //if we are not on the same line as when we started + //this node then print a new line and indent + if(nodeLine != fCurrentLine) + { + if (!fLineFeedInTextNodePrinted) + { + printNewLine(); + } + else + { + fLineFeedInTextNodePrinted = false; + } + + if(nodeLine != fCurrentLine && level == 0 && getFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID)) + printNewLine(); + + printIndent(level); + } + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gEndElement + << nodeName << chCloseAngle; + ) + + } + } + else + { + level--; + + // + // There were no children. Output the short form close of + // the element start tag, making it an empty-element tag. + // + if (filterAction == DOMNodeFilter::FILTER_ACCEPT) + { + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << chForwardSlash << chCloseAngle; + ) + } + } + + // remove the namespace map at this level + if(namespaceMap!=NULL) + fNamespaceStack->removeLastElement(); + + break; + } + case DOMNode::ATTRIBUTE_NODE: + { + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + const XMLCh* localName = nodeToWrite->getLocalName(); + + // check if this is a DOM Level 1 Node + if(localName == 0) + *fFormatter << XMLFormatter::NoEscapes + << nodeToWrite->getNodeName(); + else + *fFormatter << XMLFormatter::NoEscapes + << chOpenCurly << nodeToWrite->getNamespaceURI() + << chCloseCurly << localName; + *fFormatter << chEqual << chDoubleQuote + << XMLFormatter::AttrEscapes; + if (getFeature(ENTITIES_ID)) + { + DOMNodeSPtr child = nodeToWrite->getFirstChild(); + while( child != 0) + { + if(child->getNodeType()==DOMNode::TEXT_NODE) + *fFormatter << child->getNodeValue(); + else if(child->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + *fFormatter << XMLFormatter::NoEscapes + << chAmpersand << child->getNodeName() << chSemiColon + << XMLFormatter::AttrEscapes; + child = child->getNextSibling(); + } + } + else + *fFormatter << nodeValue; + *fFormatter << XMLFormatter::NoEscapes + << chDoubleQuote; + + break; + } + case DOMNode::ENTITY_REFERENCE_NODE: + { + //"entities" + //true + //[required] (default) + //Keep EntityReference and Entity nodes in the document. + + //false + //[optional] + //Remove all EntityReference and Entity nodes from the document, + // putting the entity expansions directly in their place. + // Text nodes are into "normal" form. + //Only EntityReference nodes to non-defined entities are kept in the document. + + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + if (getFeature(ENTITIES_ID)) + { + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << chAmpersand + << nodeName << chSemiColon; + ) + } + else + { + // check if the referenced entity is defined or not + if (nodeToWrite->getOwnerDocument()->getDoctype()->getEntities()->getNamedItem(nodeName)) + { + DOMNodeSPtr child; + for (child = nodeToWrite->getFirstChild(); + child != 0; + child = child->getNextSibling()) + { + processNode(child, level); + } + } + else + { + TRY_CATCH_THROW + ( + *fFormatter< unrep-char + // =============================================================== + // true split split + // false fails fails + // + case DOMNode::CDATA_SECTION_NODE: + { + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + if (getFeature(SPLIT_CDATA_SECTIONS_ID)) + { + // it is fairly complicated and we process this + // in a separate function. + procCdataSection(nodeValue, nodeToWrite); + } + else + { + // search for "]]>", the node value is not supposed to have this + if (XMLString::patternMatch((XMLCh*) nodeValue, gEndCDATA) != -1) + { + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, XMLDOMMsg::Writer_NestedCDATA); + } + + TRY_CATCH_THROW + ( + // transcoder throws exception for unrep chars + *fFormatter << XMLFormatter::NoEscapes << gStartCDATA << nodeValue << gEndCDATA; + ) + } + + break; + } + + case DOMNode::COMMENT_NODE: + { + if (checkFilter(nodeToWrite) != DOMNodeFilter::FILTER_ACCEPT) + break; + + // Figure out if we want pretty-printing for this comment. + // If this comment node does not have any element siblings + // (i.e., it is a text node) then we don't want to add any + // whitespaces since that might be significant to the + // application. Otherwise we want pretty-printing. + // + + bool pretty = (level == 0); // Document-level comments. + + if (!pretty) + { + // See if we have any element siblings. + // + const DOMNode* s = nodeToWrite->getNextSibling (); + + while (s != 0 && s->getNodeType () != DOMNode::ELEMENT_NODE) + s = s->getNextSibling (); + + if (s != 0) + pretty = true; + else + { + s = nodeToWrite->getPreviousSibling (); + + while (s != 0 && s->getNodeType () != DOMNode::ELEMENT_NODE) + s = s->getPreviousSibling (); + + if (s != 0) + pretty = true; + } + } + + if (pretty) + { + if(level == 1 && getFeature(FORMAT_PRETTY_PRINT_1ST_LEVEL_ID)) + printNewLine(); + + printNewLine(); + printIndent(level); + } + + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gStartComment + << nodeValue << gEndComment; + ) + break; + } + + case DOMNode::DOCUMENT_TYPE_NODE: // Not to be shown to Filter + { + const DOMDocumentType *doctype = (const DOMDocumentType *)nodeToWrite; + + fFormatter->setEscapeFlags(XMLFormatter::NoEscapes); + + printNewLine(); + printIndent(level); + + TRY_CATCH_THROW + ( + *fFormatter << gStartDoctype << nodeName; + + const XMLCh *id = doctype->getPublicId(); + if (id && *id) + { + *fFormatter << chSpace << gPublic << id << chDoubleQuote; + + id = doctype->getSystemId(); + if (id && *id) + { + *fFormatter << chSpace << chDoubleQuote << id << chDoubleQuote; + } + else + { + // + // 4.2.2 External Entities + // [Definition: If the entity is not internal, + // it is an external entity, declared as follows:] + // External Entity Declaration + // [75] ExternalID ::= 'SYSTEM' S SystemLiteral + // | 'PUBLIC' S PubidLiteral S SystemLiteral + // + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, XMLDOMMsg::Writer_NotRecognizedType); + // systemLiteral not found + } + } + else + { + id = doctype->getSystemId(); + if (id && *id) + { + *fFormatter << chSpace << gSystem << id << chDoubleQuote; + } + } + + id = doctype->getInternalSubset(); + if (id && *id) + { + *fFormatter << chSpace << chOpenSquare << id << chCloseSquare; + } + + *fFormatter << chCloseAngle; + ) // end of TRY_CATCH_THROW + + break; + } + + case DOMNode::ENTITY_NODE: // Not to be shown to Filter + { + // + // REVISIT: how does the feature "entities" impact + // entity node? + // + printNewLine(); + printIndent(level); + + fFormatter->setEscapeFlags(XMLFormatter::NoEscapes); + *fFormatter << gStartEntity << nodeName; + + const XMLCh * id = ((const DOMEntity*)nodeToWrite)->getPublicId(); + if (id) + *fFormatter << gPublic << id << chDoubleQuote; + + id = ((const DOMEntity*)nodeToWrite)->getSystemId(); + if (id) + *fFormatter << gSystem << id << chDoubleQuote; + + id = ((const DOMEntity*)nodeToWrite)->getNotationName(); + if (id) + *fFormatter << gNotation << id << chDoubleQuote; + + *fFormatter << chCloseAngle; + + break; + } + + default: + /*** + This is an implementation specific behaviour, we abort if a user derived class has not dealt with + this node type. + ***/ + { + if(!customNodeSerialize(nodeToWrite, level)) { + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, XMLDOMMsg::Writer_NotRecognizedType); + // UnreognizedNodeType; + } + } + + break; + } + +} + +bool DOMLSSerializerImpl::customNodeSerialize(const DOMNode* const, int) { + return false; +} + +// +// +DOMNodeFilter::FilterAction DOMLSSerializerImpl::checkFilter(const DOMNode* const node) const +{ + if (!fFilter || + ((fFilter->getWhatToShow() & (1 << (node->getNodeType() - 1))) == 0)) + return DOMNodeFilter::FILTER_ACCEPT; + + // + // if and only if there is a filter, and it is interested + // in the node type, then we pass the node to the filter + // for examination + // + return (DOMNodeFilter::FilterAction) fFilter->acceptNode(node); +} + + +bool DOMLSSerializerImpl::checkFeature(const XMLCh* const featName + , bool toThrow + , int& featureId) const +{ + // check for null and/or empty feature name + if (!featName || !*featName) + { + if (toThrow) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager); + + return false; + } + + featureId = INVALID_FEATURE_ID; + + if (XMLString::equals(featName, XMLUni::fgDOMWRTCanonicalForm)) + featureId = CANONICAL_FORM_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTDiscardDefaultContent)) + featureId = DISCARD_DEFAULT_CONTENT_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTEntities)) + featureId = ENTITIES_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTFormatPrettyPrint)) + featureId = FORMAT_PRETTY_PRINT_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTNormalizeCharacters)) + featureId = NORMALIZE_CHARACTERS_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTSplitCdataSections)) + featureId = SPLIT_CDATA_SECTIONS_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTValidation)) + featureId = VALIDATION_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTWhitespaceInElementContent)) + featureId = WHITESPACE_IN_ELEMENT_CONTENT_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTBOM)) + featureId = BYTE_ORDER_MARK_ID; + else if (XMLString::equals(featName, XMLUni::fgDOMXMLDeclaration)) + featureId = XML_DECLARATION; + else if (XMLString::equals(featName, XMLUni::fgDOMWRTXercesPrettyPrint)) + featureId = FORMAT_PRETTY_PRINT_1ST_LEVEL_ID; + + + //feature name not resolvable + if (featureId == INVALID_FEATURE_ID) + { + if (toThrow) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager); + + return false; + } + + return true; +} + +bool DOMLSSerializerImpl::reportError(const DOMNode* const errorNode + , DOMError::ErrorSeverity errorType + , const XMLCh* const errorMsg) +{ + bool toContinueProcess = true; // default value for no error handler + + if (fErrorHandler) + { + DOMLocatorImpl locator(0, 0, (DOMNode*) errorNode, 0); + DOMErrorImpl domError(errorType , errorMsg, &locator); + try + { + toContinueProcess = fErrorHandler->handleError(domError); + } + catch(...) + { + } + } + + if (errorType != DOMError::DOM_SEVERITY_WARNING) + fErrorCount++; + + return toContinueProcess; +} + +bool DOMLSSerializerImpl::reportError(const DOMNode* const errorNode + , DOMError::ErrorSeverity errorType + , XMLDOMMsg::Codes toEmit) +{ + const XMLSize_t msgSize = 1023; + XMLCh errText[msgSize + 1]; + + DOMImplementationImpl::getMsgLoader4DOM()->loadMsg(toEmit, errText, msgSize); + + bool toContinueProcess = true; // default value for no error handler + + if (fErrorHandler) + { + DOMLocatorImpl locator(0, 0, (DOMNode*) errorNode, 0); + DOMErrorImpl domError(errorType , errText, &locator); + try + { + toContinueProcess = fErrorHandler->handleError(domError); + } + catch(...) + { + } + } + + if (errorType != DOMError::DOM_SEVERITY_WARNING) + fErrorCount++; + + if (errorType == DOMError::DOM_SEVERITY_FATAL_ERROR || !toContinueProcess) + throw toEmit; + + return toContinueProcess; +} + +// +// +// +void DOMLSSerializerImpl::procCdataSection(const XMLCh* const nodeValue + , const DOMNode* const nodeToWrite) +{ + static const XMLSize_t offset = XMLString::stringLen(gEndCDATA); + + /*** + * Append a ']]>' at the end + */ + XMLSize_t len = XMLString::stringLen(nodeValue); + XMLCh* repNodeValue = (XMLCh*) fMemoryManager->allocate + ( + (len + offset + 1) * sizeof(XMLCh) + );//new XMLCh [len + offset + 1]; + XMLString::copyString(repNodeValue, nodeValue); + XMLString::catString(repNodeValue, gEndCDATA); + ArrayJanitor jName(repNodeValue, fMemoryManager); + + XMLCh* curPtr = (XMLCh*) repNodeValue; + XMLCh* nextPtr = 0; + int endTagPos = -1; + + bool endTagFound = true; + + while (endTagFound) + { + endTagPos = XMLString::patternMatch(curPtr, gEndCDATA); + if (endTagPos != -1) + { + nextPtr = curPtr + endTagPos + offset; // skip the ']]>' + *(curPtr + endTagPos) = chNull; //nullify the first ']' + if (XMLSize_t(endTagPos) != len) + reportError(nodeToWrite, DOMError::DOM_SEVERITY_WARNING, XMLDOMMsg::Writer_NestedCDATA); + len = len - endTagPos - offset; + } + else + { + endTagFound = false; + } + + /*** + to check ]]>]]> + ***/ + if (endTagPos == 0) + { + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gStartCDATA << gEndCDATA; + ) + } + else + { + procUnrepCharInCdataSection(curPtr, nodeToWrite); + } + + if (endTagFound) + { + *(nextPtr - offset) = chCloseSquare; //restore the first ']' + curPtr = nextPtr; + } + } +} + +// +// +// +void DOMLSSerializerImpl::procUnrepCharInCdataSection(const XMLCh* const nodeValue + , const DOMNode* const nodeToWrite) +{ + // + // We have to check each character and see if it could be represented. + // As long as it can, we just keep up with where we started and how + // many chars we've checked. When we hit an unrepresentable one, we + // stop, transcode everything we've collected, then start handling + // the unrepresentables via char refs. We repeat this until we get all + // the chars done. + // + const XMLCh* srcPtr = nodeValue; + const XMLCh* endPtr = nodeValue + XMLString::stringLen(nodeValue); + + // Set up the common part of the buffer that we build char refs into + XMLCh tmpBuf[32]; + tmpBuf[0] = chAmpersand; + tmpBuf[1] = chPound; + tmpBuf[2] = chLatin_x; + + while (srcPtr < endPtr) + { + const XMLCh* tmpPtr = srcPtr; + while (tmpPtr < endPtr) + { + if (fFormatter->getTranscoder()->canTranscodeTo(*tmpPtr)) + tmpPtr++; + else + break; + } + + if (tmpPtr > srcPtr) + { + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gStartCDATA; + ) + + // We got at least some chars that can be done normally + fFormatter->formatBuf + ( + srcPtr + , tmpPtr - srcPtr + , XMLFormatter::NoEscapes + , XMLFormatter::UnRep_Fail + ); + + TRY_CATCH_THROW + ( + *fFormatter << XMLFormatter::NoEscapes << gEndCDATA; + ) + + // Update the source pointer to our new spot + srcPtr = tmpPtr; + } + else + { + // + // We hit something unrepresentable. So continue forward doing + // char refs until we hit something representable again or the + // end of input. + // + + // one warning for consective unrep chars + reportError(nodeToWrite, DOMError::DOM_SEVERITY_WARNING, XMLDOMMsg::Writer_NotRepresentChar); + + while (srcPtr < endPtr) + { + // Build a char ref for the current char + XMLString::binToText(*srcPtr, &tmpBuf[3], 8, 16, fMemoryManager); + const XMLSize_t bufLen = XMLString::stringLen(tmpBuf); + tmpBuf[bufLen] = chSemiColon; + tmpBuf[bufLen+1] = chNull; + + // And now call recursively back to our caller to format this + fFormatter->formatBuf + ( + tmpBuf + , bufLen + 1 + , XMLFormatter::NoEscapes + , XMLFormatter::UnRep_Fail + ); + + // Move up the source pointer and break out if needed + srcPtr++; + if (fFormatter->getTranscoder()->canTranscodeTo(*srcPtr)) + break; + } + } + } +} + +void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite) +{ + processNode(nodeToWrite, 0); +} + +bool DOMLSSerializerImpl::canSetFeature(const int featureId + , bool val) const +{ + return featuresSupported[2*featureId + (val? 0: 1)]; +} + +void DOMLSSerializerImpl::printNewLine() +{ + if (getFeature(FORMAT_PRETTY_PRINT_ID)) + { + fCurrentLine++; + *fFormatter << fNewLineUsed; + } +} + +void DOMLSSerializerImpl::printIndent(unsigned int level) +{ + if (getFeature(FORMAT_PRETTY_PRINT_ID)) + { + if (fLastWhiteSpaceInTextNode) + { + unsigned int indentLevel = fLastWhiteSpaceInTextNode/2; // two chSpaces equals one indent level + fLastWhiteSpaceInTextNode = 0; + // if fLastWhiteSpaceInTextNode/2 is greater than level, then + // it means too many spaces have been written to the + // output stream and we can no longer indent properly + if(indentLevel < level) + level -= indentLevel; + else + level = 0; + } + + for(unsigned int i = 0; i < level; i++) + *fFormatter << chSpace << chSpace; + } +} + +void DOMLSSerializerImpl::release() +{ + DOMLSSerializerImpl* writer = (DOMLSSerializerImpl*) this; + delete writer; +} + +void DOMLSSerializerImpl::processBOM() +{ + // if the feature is not set, don't output bom + if (!getFeature(BYTE_ORDER_MARK_ID)) + return; + + if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF8EncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF8EncodingString2) == 0) ) + { + fFormatter->writeBOM(BOM_utf8, 3); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16LEncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16LEncodingString2) == 0) ) + { + fFormatter->writeBOM(BOM_utf16le, 2); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16BEncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16BEncodingString2) == 0) ) + { + fFormatter->writeBOM(BOM_utf16be, 2); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString2) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString3) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString4) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString5) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString6) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUTF16EncodingString7) == 0) ) + { + if (XMLPlatformUtils::fgXMLChBigEndian) + fFormatter->writeBOM(BOM_utf16be, 2); + else + fFormatter->writeBOM(BOM_utf16le, 2); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4LEncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4LEncodingString2) == 0) ) + { + fFormatter->writeBOM(BOM_ucs4le, 4); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4BEncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4BEncodingString2) == 0) ) + { + fFormatter->writeBOM(BOM_ucs4be, 4); + } + else if ((XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString2) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString3) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString4) == 0) || + (XMLString::compareIStringASCII(fEncodingUsed, XMLUni::fgUCS4EncodingString5) == 0) ) + { + if (XMLPlatformUtils::fgXMLChBigEndian) + fFormatter->writeBOM(BOM_ucs4be, 4); + else + fFormatter->writeBOM(BOM_ucs4le, 4); + } +} + +bool DOMLSSerializerImpl::isDefaultNamespacePrefixDeclared() const +{ + for(XMLSize_t i=fNamespaceStack->size();i>0;i--) + { + RefHashTableOf* curNamespaceMap=fNamespaceStack->elementAt(i-1); + const XMLCh* thisUri=curNamespaceMap->get((void*)XMLUni::fgZeroLenString); + if(thisUri) + return true; + } + return false; +} + +bool DOMLSSerializerImpl::isNamespaceBindingActive(const XMLCh* prefix, const XMLCh* uri) const +{ + for(XMLSize_t i=fNamespaceStack->size();i>0;i--) + { + RefHashTableOf* curNamespaceMap=fNamespaceStack->elementAt(i-1); + const XMLCh* thisUri=curNamespaceMap->get((void*)prefix); + // if the prefix has been declared, check if it binds to the correct namespace, otherwise, reports it isn't bound + if(thisUri) + return XMLString::equals(thisUri,uri); + } + return false; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.hpp new file mode 100644 index 000000000..3281f755e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLSSerializerImpl.hpp @@ -0,0 +1,232 @@ +/* + * 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: DOMLSSerializerImpl.hpp 695856 2008-09-16 12:52:32Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERMPL_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMStringListImpl; + +class CDOM_EXPORT DOMLSSerializerImpl : public XMemory, + public DOMLSSerializer, + public DOMConfiguration +{ + +public: + + /** @name Constructor and Destructor */ + //@{ + + /** + * Constructor. + */ + DOMLSSerializerImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Destructor. + */ + ~DOMLSSerializerImpl(); + //@} + + /** @name Implementation of DOMLSSerializer interface */ + //@{ + + virtual DOMConfiguration* getDomConfig(); + + virtual void setNewLine(const XMLCh* const newLine); + virtual const XMLCh* getNewLine() const; + + virtual void setFilter(DOMLSSerializerFilter *filter); + virtual DOMLSSerializerFilter* getFilter() const; + + virtual bool write(const DOMNode* nodeToWrite, + DOMLSOutput* const destination); + virtual bool writeToURI(const DOMNode* nodeToWrite, + const XMLCh* uri); + /** + * The caller is responsible for the release of the returned string + */ + virtual XMLCh* writeToString(const DOMNode* nodeToWrite, MemoryManager* manager = NULL); + virtual void release(); + + //@} + + /** @name Implementation of DOMConfiguration interface */ + //@{ + virtual void setParameter(const XMLCh* name, const void* value); + virtual void setParameter(const XMLCh* name, bool value); + virtual const void* getParameter(const XMLCh* name) const; + virtual bool canSetParameter(const XMLCh* name, const void* value) const; + virtual bool canSetParameter(const XMLCh* name, bool value) const; + virtual const DOMStringList* getParameterNames() const; + //@} + +private: + + /** unimplemented copy ctor and assignment operator */ + DOMLSSerializerImpl(const DOMLSSerializerImpl&); + DOMLSSerializerImpl & operator = (const DOMLSSerializerImpl&); + +protected: + /** helper **/ + void processNode(const DOMNode* const); + + void procCdataSection(const XMLCh* const nodeValue + , const DOMNode* const nodeToWrite); + + void procUnrepCharInCdataSection(const XMLCh* const nodeValue + , const DOMNode* const nodeToWrite); + +protected: + /** + * Overidden by derived classes to extend the abilities of the standard writer + * always returns false in the default implementation + * @return true if the method deals with nodeToWrite + */ + virtual bool customNodeSerialize(const DOMNode* const nodeToWrite, int level); + + DOMNodeFilter::FilterAction checkFilter(const DOMNode* const) const; + + bool checkFeature(const XMLCh* const featName + , bool state + , int& featureId) const; + + bool reportError(const DOMNode* const errorNode + , DOMError::ErrorSeverity errorType + , const XMLCh* const errorMsg); + bool reportError(const DOMNode* const errorNode + , DOMError::ErrorSeverity errorType + , XMLDOMMsg::Codes toEmit); + + bool canSetFeature(const int featureId + , bool val) const; + void setFeature(const int featureId + , bool val); + bool getFeature(const int featureId) const; + + void printNewLine(); + void setURCharRef(); + bool isDefaultNamespacePrefixDeclared() const; + bool isNamespaceBindingActive(const XMLCh* prefix, const XMLCh* uri) const; + + + void printIndent(unsigned int level); + //does the actual work for processNode while keeping track of the level + void processNode(const DOMNode* const nodeToWrite, int level); + + void processBOM(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fFeatures + // + // fNewLine + // own it + // + // fErrorHandler + // don't own it + // + // fFilter + // don't own it + // + // fDocumentVersion + // The XML Version of the document to be serialized. + // + // fSupportedParameters + // A list of the parameters that can be set, including the ones + // specific of Xerces + // + // fEncodingUsed (session var) + // the actual encoding used in write(), + // it does not own any data(memory). + // + // fNewLineUsed (session var) + // the actual "end of line" sequence used in write(), + // it does not own any data(memory). + // + // fFormatter (session var) + // the formatter used in write() + // + // fErrorCount + // the count of error encountered in the serialization, + // which neither the error handler, nor the serializer itself, + // treat as fatal. And the serializer will return true/false + // based on this value. + // + // fCurrentLine + // the current line. Used to track the line number the current + // node begins on + // + // ----------------------------------------------------------------------- + + int fFeatures; + XMLCh *fNewLine; + DOMErrorHandler *fErrorHandler; + DOMLSSerializerFilter *fFilter; + const XMLCh *fDocumentVersion; + DOMStringListImpl *fSupportedParameters; + + //session vars + const XMLCh *fEncodingUsed; + const XMLCh *fNewLineUsed; + XMLFormatter *fFormatter; + int fErrorCount; + int fCurrentLine; + bool fLineFeedInTextNodePrinted; + unsigned int fLastWhiteSpaceInTextNode; + + RefVectorOf< RefHashTableOf >* fNamespaceStack; + MemoryManager* fMemoryManager; +}; + +inline DOMConfiguration* DOMLSSerializerImpl::getDomConfig() +{ + return this; +} + +inline void DOMLSSerializerImpl::setFeature(const int featureId + , bool val) +{ + (val)? fFeatures |= (1<setUnRepFlags(XMLFormatter::UnRep_CharRef); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.cpp new file mode 100644 index 000000000..7d078b569 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.cpp @@ -0,0 +1,60 @@ +/* + * 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: DOMLocatorImpl.cpp 676853 2008-07-15 09:58:05Z borisk $ + */ + +#include "DOMLocatorImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Constructors and Destructor +// --------------------------------------------------------------------------- +DOMLocatorImpl::DOMLocatorImpl() : +fLineNum(0) +, fColumnNum(0) +, fByteOffset(~(XMLFilePos(0))) +, fUtf16Offset(~(XMLFilePos(0))) +, fRelatedNode(0) +, fURI(0) +{ +} + + +DOMLocatorImpl::DOMLocatorImpl(const XMLFileLoc lineNum, + const XMLFileLoc columnNum, + DOMNode* const errorNode, + const XMLCh* const uri, + const XMLFilePos byteOffset, + const XMLFilePos utf16Offset) : +fLineNum(lineNum) +, fColumnNum(columnNum) +, fByteOffset(byteOffset) +, fUtf16Offset(utf16Offset) +, fRelatedNode(errorNode) +, fURI(uri) +{ +} + +DOMLocatorImpl::~DOMLocatorImpl() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.hpp new file mode 100644 index 000000000..207579441 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMLocatorImpl.hpp @@ -0,0 +1,187 @@ +/* + * 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: DOMLocatorImpl.hpp 676853 2008-07-15 09:58:05Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMLOCATORIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMLOCATORIMPL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Introduced in DOM Level 3 + * + * Implementation of a DOMLocator interface. + * + * @see DOMLocator#DOMLocator + */ + +class CDOM_EXPORT DOMLocatorImpl : public DOMLocator +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** Constructor */ + DOMLocatorImpl(); + + DOMLocatorImpl + ( + const XMLFileLoc lineNum + , const XMLFileLoc columnNum + , DOMNode* const errorNode + , const XMLCh* const uri + , const XMLFilePos offset = ~(XMLFilePos(0)) + , const XMLFilePos utf16Offset = ~(XMLFilePos(0)) + ); + + /** Desctructor */ + virtual ~DOMLocatorImpl(); + + //@} + + // DOMLocator interface + virtual XMLFileLoc getLineNumber() const; + virtual XMLFileLoc getColumnNumber() const; + virtual XMLFilePos getByteOffset() const; + virtual XMLFilePos getUtf16Offset() const; + virtual DOMNode* getRelatedNode() const; + virtual const XMLCh* getURI() const; + + // Setter functions + void setLineNumber(const XMLFileLoc lineNumber); + void setColumnNumber(const XMLFileLoc columnNumber); + void setByteOffset(const XMLFilePos offset); + void setUtf16Offset(const XMLFilePos offset); + void setRelatedNode(DOMNode* const errorNode); + void setURI(const XMLCh* const uri); + + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DOMLocatorImpl(const DOMLocatorImpl&); + + /* Assignment operator */ + DOMLocatorImpl& operator=(const DOMLocatorImpl&); + +protected: + // ----------------------------------------------------------------------- + // Private data members + // + // fLineNum + // fColumnNum + // Track line/column number of where the error occured + // + // fByteOffset + // Track byte offset in the input source where the error + // occured + // + // fUtf16Offset + // Track character offset in the input source where the error + // occured + // + // fRelatedNode + // Current node where the error occured + // + // fURI + // The uri where the error occured + // ----------------------------------------------------------------------- + XMLFileLoc fLineNum; + XMLFileLoc fColumnNum; + XMLFilePos fByteOffset; + XMLFilePos fUtf16Offset; + DOMNode* fRelatedNode; + const XMLCh* fURI; +}; + + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Getter methods +// --------------------------------------------------------------------------- +inline XMLFileLoc DOMLocatorImpl::getLineNumber() const +{ + return fLineNum; +} + +inline XMLFileLoc DOMLocatorImpl::getColumnNumber() const +{ + return fColumnNum; +} + +inline XMLFilePos DOMLocatorImpl::getByteOffset() const +{ + return fByteOffset; +} + +inline XMLFilePos DOMLocatorImpl::getUtf16Offset() const +{ + return fUtf16Offset; +} + +inline DOMNode* DOMLocatorImpl::getRelatedNode() const +{ + return fRelatedNode; +} + +inline const XMLCh* DOMLocatorImpl::getURI() const +{ + return fURI; +} + + +// --------------------------------------------------------------------------- +// DOMLocatorImpl: Setter methods +// --------------------------------------------------------------------------- +inline void DOMLocatorImpl::setLineNumber(const XMLFileLoc lineNumber) +{ + fLineNum = lineNumber; +} + +inline void DOMLocatorImpl::setColumnNumber(const XMLFileLoc columnNumber) +{ + fColumnNum = columnNumber; +} + +inline void DOMLocatorImpl::setByteOffset(const XMLFilePos offset) +{ + fByteOffset = offset; +} + +inline void DOMLocatorImpl::setUtf16Offset(const XMLFilePos offset) +{ + fUtf16Offset = offset; +} + +inline void DOMLocatorImpl::setRelatedNode(DOMNode* const errorNode) +{ + fRelatedNode = errorNode; +} + +inline void DOMLocatorImpl::setURI(const XMLCh* const uri) +{ + fURI = uri; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp new file mode 100644 index 000000000..5f471ca4f --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp @@ -0,0 +1,340 @@ +/* + * 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: DOMNamedNodeMapImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + + +#include +#include +#include +#include + +#include "DOMNodeVector.hpp" +#include "DOMNamedNodeMapImpl.hpp" +#include "DOMCasts.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMNodeImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMNamedNodeMapImpl::DOMNamedNodeMapImpl(DOMNode *ownerNod) +{ + fOwnerNode=ownerNod; + memset(fBuckets,0,MAP_SIZE*sizeof(DOMNodeVector*)); +} + +DOMNamedNodeMapImpl::~DOMNamedNodeMapImpl() +{ +} + +bool DOMNamedNodeMapImpl::readOnly() +{ + return castToNodeImpl(fOwnerNode)->isReadOnly(); +} + +DOMNamedNodeMapImpl *DOMNamedNodeMapImpl::cloneMap(DOMNode *ownerNod) +{ + DOMDocumentImpl *doc = (DOMDocumentImpl *)(castToNodeImpl(ownerNod)->getOwnerDocument()); + DOMNamedNodeMapImpl *newmap = new (doc) DOMNamedNodeMapImpl(ownerNod); + + for(XMLSize_t index=0;indexsize(); + newmap->fBuckets[index] = new (doc) DOMNodeVector(doc, size); + for (XMLSize_t i = 0; i < size; ++i) { + DOMNode *s = fBuckets[index]->elementAt(i); + DOMNode *n = s->cloneNode(true); + castToNodeImpl(n)->isSpecified(castToNodeImpl(s)->isSpecified()); + castToNodeImpl(n)->fOwnerNode = ownerNod; + castToNodeImpl(n)->isOwned(true); + newmap->fBuckets[index]->addElement(n); + } + } + + return newmap; +} + + +XMLSize_t DOMNamedNodeMapImpl::getLength() const +{ + XMLSize_t count=0; + for(XMLSize_t index=0;indexsize()); + return count; +} + +DOMNode * DOMNamedNodeMapImpl::item(XMLSize_t index) const +{ + XMLSize_t count=0; + for(XMLSize_t i=0;isize(); + if(index>=count && index<(count+thisBucket)) + return fBuckets[i]->elementAt(index-count); + count+=thisBucket; + } + return NULL; +} + + +DOMNode * DOMNamedNodeMapImpl::getNamedItem(const XMLCh *name) const +{ + XMLSize_t hash=XMLString::hash(name,MAP_SIZE); + if(fBuckets[hash]==0) + return 0; + + XMLSize_t i = 0; + XMLSize_t size = fBuckets[hash]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[hash]->elementAt(i); + if(XMLString::equals(name,n->getNodeName())) + return n; + } + + return 0; +} + + +// +// removeNamedItem() - Remove the named item, and return it. +// The caller can release the +// returned item if it's not used +// we can't do it here because the caller would +// never see the returned node. +// +DOMNode * DOMNamedNodeMapImpl::removeNamedItem(const XMLCh *name) +{ + if (this->readOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + XMLSize_t hash=XMLString::hash(name,MAP_SIZE); + if(fBuckets[hash]==0) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + + XMLSize_t i = 0; + XMLSize_t size = fBuckets[hash]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[hash]->elementAt(i); + if(XMLString::equals(name,n->getNodeName())) { + fBuckets[hash]->removeElementAt(i); + castToNodeImpl(n)->fOwnerNode = doc; + castToNodeImpl(n)->isOwned(false); + return n; + } + } + + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + return 0; +} + + + +// +// setNamedItem() Put the item into the NamedNodeList by name. +// If an item with the same name already was +// in the list, replace it. Return the old +// item, if there was one. +// Caller is responsible for arranging for +// deletion of the old item if its ref count is +// zero. +// +DOMNode * DOMNamedNodeMapImpl::setNamedItem(DOMNode * arg) +{ + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + DOMNodeImpl *argImpl = castToNodeImpl(arg); + if(argImpl->getOwnerDocument() != doc) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager); + if (this->readOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode)) + throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + + const XMLCh* name=arg->getNodeName(); + XMLSize_t hash=XMLString::hash(name,MAP_SIZE); + if(fBuckets[hash]==0) + fBuckets[hash] = new (doc) DOMNodeVector(doc, 3); + + XMLSize_t i = 0; + XMLSize_t size = fBuckets[hash]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[hash]->elementAt(i); + if(XMLString::equals(name,n->getNodeName())) { + fBuckets[hash]->setElementAt(arg,i); + castToNodeImpl(n)->fOwnerNode = doc; + castToNodeImpl(n)->isOwned(false); + return n; + } + } + fBuckets[hash]->addElement(arg); + return 0; +} + + +void DOMNamedNodeMapImpl::setReadOnly(bool readOnl, bool deep) +{ + // this->fReadOnly=readOnl; + if(deep) { + for (XMLSize_t index = 0; index < MAP_SIZE; index++) { + if(fBuckets[index]==0) + continue; + XMLSize_t sz = fBuckets[index]->size(); + for (XMLSize_t i=0; ielementAt(i))->setReadOnly(readOnl, deep); + } + } +} + + +//Introduced in DOM Level 2 + +DOMNode *DOMNamedNodeMapImpl::getNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName) const +{ + // the map is indexed using the full name of nodes; to search given a namespace and a local name + // we have to do a linear search + for (XMLSize_t index = 0; index < MAP_SIZE; index++) { + if(fBuckets[index]==0) + continue; + + XMLSize_t i = 0; + XMLSize_t size = fBuckets[index]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[index]->elementAt(i); + const XMLCh * nNamespaceURI = n->getNamespaceURI(); + const XMLCh * nLocalName = n->getLocalName(); + if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match + continue; + else { + if (XMLString::equals(localName, nLocalName) + || + (nLocalName == 0 && XMLString::equals(localName, n->getNodeName()))) + return n; + } + } + } + return 0; +} + + +// +// setNamedItemNS() Put the item into the NamedNodeList by name. +// If an item with the same name already was +// in the list, replace it. Return the old +// item, if there was one. +// Caller is responsible for arranging for +// deletion of the old item if its ref count is +// zero. +// +DOMNode * DOMNamedNodeMapImpl::setNamedItemNS(DOMNode *arg) +{ + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + DOMNodeImpl *argImpl = castToNodeImpl(arg); + if (argImpl->getOwnerDocument() != doc) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager); + if (this->readOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + if (argImpl->isOwned()) + throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager); + + argImpl->fOwnerNode = fOwnerNode; + argImpl->isOwned(true); + + const XMLCh* namespaceURI=arg->getNamespaceURI(); + const XMLCh* localName=arg->getLocalName(); + // the map is indexed using the full name of nodes; to search given a namespace and a local name + // we have to do a linear search + for (XMLSize_t index = 0; index < MAP_SIZE; index++) { + if(fBuckets[index]==0) + continue; + + XMLSize_t i = 0; + XMLSize_t size = fBuckets[index]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[index]->elementAt(i); + const XMLCh * nNamespaceURI = n->getNamespaceURI(); + const XMLCh * nLocalName = n->getLocalName(); + if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match + continue; + else { + if (XMLString::equals(localName, nLocalName) + || + (nLocalName == 0 && XMLString::equals(localName, n->getNodeName()))) { + fBuckets[index]->setElementAt(arg,i); + castToNodeImpl(n)->fOwnerNode = doc; + castToNodeImpl(n)->isOwned(false); + return n; + } + } + } + } + // if not found, add it using the full name as key + return setNamedItem(arg); +} + + +// removeNamedItemNS() - Remove the named item, and return it. +// The caller can release the +// returned item if it's not used +// we can't do it here because the caller would +// never see the returned node. +DOMNode *DOMNamedNodeMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) +{ + if (this->readOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager); + + // the map is indexed using the full name of nodes; to search given a namespace and a local name + // we have to do a linear search + for (XMLSize_t index = 0; index < MAP_SIZE; index++) { + if(fBuckets[index]==0) + continue; + + DOMDocument *doc = fOwnerNode->getOwnerDocument(); + XMLSize_t i = 0; + XMLSize_t size = fBuckets[index]->size(); + for (i = 0; i < size; ++i) { + DOMNode *n=fBuckets[index]->elementAt(i); + const XMLCh * nNamespaceURI = n->getNamespaceURI(); + const XMLCh * nLocalName = n->getLocalName(); + if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match + continue; + else { + if (XMLString::equals(localName, nLocalName) + || + (nLocalName == 0 && XMLString::equals(localName, n->getNodeName()))) { + fBuckets[index]->removeElementAt(i); + castToNodeImpl(n)->fOwnerNode = doc; + castToNodeImpl(n)->isOwned(false); + return n; + } + } + } + } + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager); + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.hpp new file mode 100644 index 000000000..a8bf8e740 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNamedNodeMapImpl.hpp @@ -0,0 +1,80 @@ +/* + * 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: DOMNamedNodeMapImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAPIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAPIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNodeVector; +class DOMNode; + +#define MAP_SIZE 193 + +class CDOM_EXPORT DOMNamedNodeMapImpl: public DOMNamedNodeMap { +protected: + DOMNodeVector* fBuckets[MAP_SIZE]; + DOMNode* fOwnerNode; // the node this map belongs to + //bool fReadOnly; // revisit - flag on owner node instead? + + bool readOnly(); // revisit. Look at owner node read-only. + +public: + DOMNamedNodeMapImpl(DOMNode *ownerNode); + + virtual ~DOMNamedNodeMapImpl(); + virtual DOMNamedNodeMapImpl *cloneMap(DOMNode *ownerNode); + virtual void setReadOnly(bool readOnly, bool deep); + + virtual XMLSize_t getLength() const; + virtual DOMNode* item(XMLSize_t index) const; + virtual DOMNode* getNamedItem(const XMLCh *name) const; + virtual DOMNode* setNamedItem(DOMNode *arg); + virtual DOMNode* removeNamedItem(const XMLCh *name); + + //Introduced in DOM Level 2 + virtual DOMNode* getNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName) const; + virtual DOMNode* setNamedItemNS(DOMNode *arg); + virtual DOMNode* removeNamedItemNS(const XMLCh *namespaceURI, + const XMLCh *localName); +private: + // unimplemented + DOMNamedNodeMapImpl(const DOMNamedNodeMapImpl &); + DOMNamedNodeMapImpl & operator = (const DOMNamedNodeMapImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIDMap.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIDMap.cpp new file mode 100644 index 000000000..dab97221a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIDMap.cpp @@ -0,0 +1,230 @@ +/* + * 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: DOMNodeIDMap.cpp 678144 2008-07-19 12:08:55Z borisk $ + */ + +#include "DOMAttrImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMNodeIDMap.hpp" + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +static const XMLSize_t gPrimes[] = {997, 9973, 99991, 999983, 0 }; // To do - add a few more. + +static const float gMaxFill = 0.8f; // The maximum fraction of the total + // table entries to consume before exanding. + +DOMNodeIDMap::DOMNodeIDMap(XMLSize_t initialSize, DOMDocument *doc) +: fNumEntries(0) +, fDoc(doc) +{ + for (fSizeIndex = 0; gPrimes[fSizeIndex] < initialSize; fSizeIndex++) + { + if (gPrimes[fSizeIndex] == 0) + { + // We need a bigger size than the largest available one. + // Big trouble. + fSizeIndex--; + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::NodeIDMap_GrowErr, ((DOMDocumentImpl *)fDoc)->getMemoryManager()); + } + } + + fSize = gPrimes[fSizeIndex]; + fMaxEntries = (XMLSize_t)(float(fSize) * gMaxFill); + + //fTable = new (fDoc) DOMAttr*[fSize]; + fTable = (DOMAttr**) ((DOMDocumentImpl *)fDoc)->allocate(sizeof(DOMAttr*) * fSize); + XMLSize_t i; + for (i=0; i= fMaxEntries) + growTable(); + + fNumEntries++; + + // + // Hash the value string from the ID attribute being added to the table + // 0 < Initial hash value < table size. + // An initial hash of zero would cause the rehash to fail. + // + const XMLCh *id=attr->getValue(); + XMLSize_t initalHash = XMLString::hash(id, fSize-1); + initalHash++; + XMLSize_t currentHash = initalHash; + + // + // Loop looking for an empty slot for this ID. + // Don't even bother checking to see if the ID is already there - + // the table is only filled by the parser from valid documents, which + // can not have duplicates. Behavior of invalid docs is not defined. + // + while (fTable[currentHash]!=0 && fTable[currentHash]!=(DOMAttr *)-1) + { + currentHash += initalHash; // rehash + if (currentHash >= fSize) + currentHash = currentHash % fSize; + } + + // + // We've found our slot. Stick the pointer to the attr into it. + // + fTable[currentHash] = attr; + +} + + +void DOMNodeIDMap::remove(DOMAttr *attr) +{ + // + // Hash the value string from the ID attribute being added to the table + // 0 < Initial hash value < table size. + // An initial hash of zero would cause the rehash to fail. + // + const XMLCh *id=attr->getValue(); + XMLSize_t initalHash = XMLString::hash(id, fSize-1); + initalHash++; + XMLSize_t currentHash = initalHash; + + // + // Loop looking for a slot pointing to an attr with this id. + // + DOMAttr *tableSlot; + while ((tableSlot= fTable[currentHash])!=0) + { + if (tableSlot == attr) + { + // Found the attribute. Set the slot to -1 to indicate + // that it was once used, meaning that lookups, while never + // matching here, can not stop either, but must rehash again + // and continue searching. + fTable[currentHash] = (DOMAttr *)-1; + return; + } + + currentHash += initalHash; // rehash. + if (currentHash >= fSize) + currentHash = currentHash % fSize; + } + // There is no matching entry in the table +} + + +DOMAttr *DOMNodeIDMap::find(const XMLCh *id) +{ + // + // Get the hashcode for the supplied string. + // + XMLSize_t initalHash = XMLString::hash(id, fSize-1); + initalHash++; + XMLSize_t currentHash = initalHash; + + // + // Loop looking for a slot pointing to an attr with this id. + // + DOMAttr *tableSlot; + while ((tableSlot= fTable[currentHash])!=0) + { + if ((tableSlot != (DOMAttr *)-1) && XMLString::equals(tableSlot->getValue(), id)) + return tableSlot; + + currentHash += initalHash; // rehash + if (currentHash >= fSize) + currentHash = currentHash % fSize; + } + // There is no matching entry in the table + return 0; +} + + +// +// Grow the table to the next larger size. +// It has gotten too full for efficient operation. +// (We never fill it all the way) +// +void DOMNodeIDMap::growTable() +{ + DOMAttr **oldTable = fTable; + XMLSize_t oldSize = fSize; + + // + // Figure the new table size. + // +#if defined(XERCES_DEBUG) + fprintf(stderr, "growing...\n"); +#endif + fSizeIndex++; + fSize = gPrimes[fSizeIndex]; + if (fSize == 0) + { + // We need to grow bigger than the largest available size. + // Big trouble. + fSizeIndex--; + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::NodeIDMap_GrowErr, ((DOMDocumentImpl *)fDoc)->getMemoryManager()); + } + + // + // Allocate the new table. + // + //fTable = new (fDoc) DOMAttr *[fSize]; + fTable = (DOMAttr**) ((DOMDocumentImpl *)fDoc)->allocate(sizeof(DOMAttr*) * fSize); + XMLSize_t i; + for (i=0; i for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +XERCES_CPP_NAMESPACE_BEGIN + + +// +// Class DOMNodeIDMap is a hash table that is used in the implementation of +// of DOM_Document::getElementsByID(). +// +// Why Yet Another HashTable implementation? Becuase it can be significantly +// smaller when tuned for this exact usage, and the generic RefHashTableOf +// from the xerces utils project is not a paricularly good fit. +// +class DOMAttr; +class DOMDocument; + + +class DOMNodeIDMap { +public: + + DOMNodeIDMap(XMLSize_t initialSize, DOMDocument *doc); // Create a new hash table, sized to hold "initialSize" + // Entries. It will automatically grow if need be. + + ~DOMNodeIDMap(); + +private: + DOMNodeIDMap(const DOMNodeIDMap &other); // No copy, assignement, comparison. + DOMNodeIDMap &operator = (const DOMNodeIDMap &other); + bool operator == (const DOMNodeIDMap &other); + +public: + void add(DOMAttr *attr); // Add the specified attribute to the table. + void remove(DOMAttr *other); // Remove the specified attribute. + // Does nothing if the node is not in the table. + DOMAttr *find(const XMLCh *ID); // Find the attribute node in the table with this ID + +private: + void growTable(); + +private: + DOMAttr **fTable; + XMLSize_t fSizeIndex; // Index of the current table size in the + // array of possible table sizes. + XMLSize_t fSize; // The current size of the table array + // (number of slots, not bytes.) + XMLSize_t fNumEntries; // The number of entries used. + XMLSize_t fMaxEntries; // The max number of entries to use before + // growing the table. + DOMDocument *fDoc; // The owning document. +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.cpp new file mode 100644 index 000000000..c5daea69e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.cpp @@ -0,0 +1,1028 @@ +/* + * 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: DOMNodeImpl.cpp 673428 2008-07-02 16:00:35Z amassari $ + */ + +// This class doesn't support having any children, and implements the behavior +// of an empty NodeList as far getChildNodes is concerned. +// The ParentNode subclass overrides this behavior. + + +#include "DOMCasts.hpp" + +#include "DOMDocumentTypeImpl.hpp" +#include "DOMElementImpl.hpp" +#include "DOMAttrImpl.hpp" + +#include +#include + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +//Though DOMNodeImpl does not derivate from DOMNode, it shares +//the same GetDOMNodeMemoryManager + +const unsigned short DOMNodeImpl::READONLY = 0x1<<0; +const unsigned short DOMNodeImpl::SYNCDATA = 0x1<<1; +const unsigned short DOMNodeImpl::SYNCCHILDREN = 0x1<<2; +const unsigned short DOMNodeImpl::OWNED = 0x1<<3; +const unsigned short DOMNodeImpl::FIRSTCHILD = 0x1<<4; +const unsigned short DOMNodeImpl::SPECIFIED = 0x1<<5; +const unsigned short DOMNodeImpl::IGNORABLEWS = 0x1<<6; +const unsigned short DOMNodeImpl::SETVALUE = 0x1<<7; +const unsigned short DOMNodeImpl::ID_ATTR = 0x1<<8; +const unsigned short DOMNodeImpl::USERDATA = 0x1<<9; +const unsigned short DOMNodeImpl::LEAFNODETYPE = 0x1<<10; +const unsigned short DOMNodeImpl::CHILDNODE = 0x1<<11; +const unsigned short DOMNodeImpl::TOBERELEASED = 0x1<<12; + +// +// +static DOMNodeListImpl *gEmptyNodeList = 0; // Singleton empty node list. + +void XMLInitializer::initializeDOMNodeListImpl() +{ + gEmptyNodeList = new DOMNodeListImpl(0); +} + +void XMLInitializer::terminateDOMNodeListImpl() +{ + delete gEmptyNodeList; + gEmptyNodeList = 0; +} + +// ----------------------------------------------------------------------- +// DOMNodeImpl Functions +// ----------------------------------------------------------------------- +DOMNodeImpl::DOMNodeImpl(DOMNode *ownerNode) +: fOwnerNode(ownerNode) +{ + this->flags = 0; + // as long as we do not have any owner, fOwnerNode is our ownerDocument +} + +// This only makes a shallow copy, cloneChildren must also be called for a +// deep clone +DOMNodeImpl::DOMNodeImpl(const DOMNodeImpl &other) +{ + this->flags = other.flags; + this->isReadOnly(false); + + // Need to break the association w/ original parent + this->fOwnerNode = other.getOwnerDocument(); + this->isOwned(false); +} + + + +DOMNodeImpl::~DOMNodeImpl() { +} + + +DOMNode * DOMNodeImpl::appendChild(DOMNode *) +{ + // Only node types that don't allow children will use this default function. + // Others will go to DOMParentNode::appendChild. + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMNodeMemoryManager); + return 0; + // return insertBefore(newChild, 0); +} + + +DOMNamedNodeMap * DOMNodeImpl::getAttributes() const { + return 0; // overridden in ElementImpl +} + + +DOMNodeList *DOMNodeImpl::getChildNodes() const { + return gEmptyNodeList; +} + + + +DOMNode * DOMNodeImpl::getFirstChild() const { + return 0; // overridden in ParentNode +} + + +DOMNode * DOMNodeImpl::getLastChild() const +{ + return 0; // overridden in ParentNode +} + + +DOMNode * DOMNodeImpl::getNextSibling() const { + return 0; // overridden in ChildNode +} + + +const XMLCh * DOMNodeImpl::getNodeValue() const { + return 0; // Overridden by anything that has a value +} + + +// +// Unlike the external getOwnerDocument, this one returns the owner document +// for document nodes as well as all of the other node types. +// +DOMDocument *DOMNodeImpl::getOwnerDocument() const +{ + if (!this->isLeafNode()) + { + DOMElementImpl *ep = (DOMElementImpl *)castToNode(this); + return ep->fParent.fOwnerDocument; + } + + // Leaf node types - those that cannot have children, like Text. + if (isOwned()) { + + DOMDocument* ownerDoc = fOwnerNode->getOwnerDocument(); + + if (!ownerDoc) { + + assert (fOwnerNode->getNodeType() == DOMNode::DOCUMENT_NODE); + return (DOMDocument *)fOwnerNode; + } + else { + return ownerDoc; + } + } else { + assert (fOwnerNode->getNodeType() == DOMNode::DOCUMENT_NODE); + return (DOMDocument *)fOwnerNode; + } +} + + +void DOMNodeImpl::setOwnerDocument(DOMDocument *doc) { + // if we have an owner we rely on it to have it right + // otherwise fOwnerNode is our ownerDocument + if (!isOwned()) { + // revisit. Problem with storage for doctype nodes that were created + // on the system heap in advance of having a document. + fOwnerNode = doc; + } +} + +DOMNode * DOMNodeImpl::getParentNode() const +{ + return 0; // overridden in ChildNode +} + + +DOMNode* DOMNodeImpl::getPreviousSibling() const +{ + return 0; // overridden in ChildNode +} + +bool DOMNodeImpl::hasChildNodes() const +{ + return false; +} + + + +DOMNode *DOMNodeImpl::insertBefore(DOMNode *, DOMNode *) { + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNodeMemoryManager); + return 0; +} + + +DOMNode *DOMNodeImpl::removeChild(DOMNode *) +{ + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager); + return 0; +} + + +DOMNode *DOMNodeImpl::replaceChild(DOMNode *, DOMNode *) +{ + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMNodeMemoryManager); + return 0; +} + + + +void DOMNodeImpl::setNodeValue(const XMLCh *) +{ + // Default behavior is to do nothing, overridden in some subclasses +} + + + +void DOMNodeImpl::setReadOnly(bool readOnl, bool deep) +{ + this->isReadOnly(readOnl); + + if (deep) { + for (DOMNode *mykid = castToNode(this)->getFirstChild(); + mykid != 0; + mykid = mykid->getNextSibling()) { + + short kidNodeType = mykid->getNodeType(); + + switch (kidNodeType) { + case DOMNode::ENTITY_REFERENCE_NODE: + break; + case DOMNode::ELEMENT_NODE: + ((DOMElementImpl*) mykid)->setReadOnly(readOnl, true); + break; + case DOMNode::DOCUMENT_TYPE_NODE: + ((DOMDocumentTypeImpl*) mykid)->setReadOnly(readOnl, true); + break; + default: + castToNodeImpl(mykid)->setReadOnly(readOnl, true); + break; + } + } + } +} + + +//Introduced in DOM Level 2 + +void DOMNodeImpl::normalize() +{ + // does nothing by default, overridden by subclasses +} + + +bool DOMNodeImpl::isSupported(const XMLCh *feature, const XMLCh *version) const +{ + return DOMImplementation::getImplementation()->hasFeature(feature, version); +} + +const XMLCh *DOMNodeImpl::getNamespaceURI() const +{ + return 0; +} + +const XMLCh *DOMNodeImpl::getPrefix() const +{ + return 0; +} + +const XMLCh *DOMNodeImpl::getLocalName() const +{ + return 0; +} + + +void DOMNodeImpl::setPrefix(const XMLCh *) +{ + throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager); +} + + +bool DOMNodeImpl::hasAttributes() const { + return 0; // overridden in ElementImpl +} + + + + + +const XMLCh *DOMNodeImpl::getXmlString() {return XMLUni::fgXMLString;} +const XMLCh *DOMNodeImpl::getXmlURIString() {return XMLUni::fgXMLURIName;} +const XMLCh *DOMNodeImpl::getXmlnsString() {return XMLUni::fgXMLNSString;} +const XMLCh *DOMNodeImpl::getXmlnsURIString() {return XMLUni::fgXMLNSURIName;} + +//Return a URI mapped from the given prefix and namespaceURI as below +// prefix namespaceURI output +//--------------------------------------------------- +// "xml" xmlURI xmlURI +// "xml" otherwise NAMESPACE_ERR +// "xmlns" xmlnsURI xmlnsURI (nType = ATTRIBUTE_NODE only) +// "xmlns" otherwise NAMESPACE_ERR (nType = ATTRIBUTE_NODE only) +// != null null or "" NAMESPACE_ERR +// else any namesapceURI +const XMLCh* DOMNodeImpl::mapPrefix(const XMLCh *prefix, + const XMLCh *namespaceURI, short nType) +{ + if (prefix == 0) + return namespaceURI; + + if (XMLString::equals(prefix, XMLUni::fgXMLString)) { + if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) + return XMLUni::fgXMLURIName; + throw DOMException(DOMException::NAMESPACE_ERR, 0); + } else if (nType == DOMNode::ATTRIBUTE_NODE && XMLString::equals(prefix, XMLUni::fgXMLNSString)) { + if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName)) + return XMLUni::fgXMLNSURIName; + throw DOMException(DOMException::NAMESPACE_ERR, 0); + } else if (namespaceURI == 0 || *namespaceURI == 0) + throw DOMException(DOMException::NAMESPACE_ERR, 0); + return namespaceURI; +} + +//Introduced in DOM Level 3 +void* DOMNodeImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) +{ + if (!data && !hasUserData()) + return 0; + + hasUserData(true); + return ((DOMDocumentImpl*)getOwnerDocument())->setUserData(this, key, data, handler); +} + +void* DOMNodeImpl::getUserData(const XMLCh* key) const +{ + if (hasUserData()) + return ((DOMDocumentImpl*)getOwnerDocument())->getUserData(this, key); + return 0; +} + +void DOMNodeImpl::callUserDataHandlers(DOMUserDataHandler::DOMOperationType operation, + const DOMNode* src, + DOMNode* dst) const +{ + DOMDocumentImpl* doc=(DOMDocumentImpl*)getOwnerDocument(); + if (doc) + doc->callUserDataHandlers(this, operation, src, dst); +} + +bool DOMNodeImpl::isSameNode(const DOMNode* other) const +{ + return (castToNode(this) == other); +} + +bool DOMNodeImpl::isEqualNode(const DOMNode* arg) const +{ + if (!arg) + return false; + + if (isSameNode(arg)) { + return true; + } + + DOMNode* thisNode = castToNode(this); + + if (arg->getNodeType() != thisNode->getNodeType()) { + return false; + } + + // the compareString will check null string as well + if (!XMLString::equals(thisNode->getNodeName(), arg->getNodeName())) { + return false; + } + + if (!XMLString::equals(thisNode->getLocalName(),arg->getLocalName())) { + return false; + } + + if (!XMLString::equals(thisNode->getNamespaceURI(), arg->getNamespaceURI())) { + return false; + } + + if (!XMLString::equals(thisNode->getPrefix(), arg->getPrefix())) { + return false; + } + + if (!XMLString::equals(thisNode->getNodeValue(), arg->getNodeValue())) { + return false; + } + + return true; +} + +const XMLCh* DOMNodeImpl::lookupPrefix(const XMLCh* namespaceURI) const { + // REVISIT: When Namespaces 1.1 comes out this may not be true + // Prefix can't be bound to null namespace + if (namespaceURI == 0) { + return 0; + } + + DOMNode *thisNode = castToNode(this); + + short type = thisNode->getNodeType(); + + switch (type) { + case DOMNode::ELEMENT_NODE: { + return lookupPrefix(namespaceURI, (DOMElement*)thisNode); + } + case DOMNode::DOCUMENT_NODE:{ + return ((DOMDocument*)thisNode)->getDocumentElement()->lookupPrefix(namespaceURI); + } + + case DOMNode::ENTITY_NODE : + case DOMNode::NOTATION_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + case DOMNode::DOCUMENT_TYPE_NODE: + // type is unknown + return 0; + case DOMNode::ATTRIBUTE_NODE:{ + if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) { + return fOwnerNode->lookupPrefix(namespaceURI); + } + return 0; + } + default:{ + DOMNode *ancestor = getElementAncestor(thisNode); + if (ancestor != 0) { + return ancestor->lookupPrefix(namespaceURI); + } + return 0; + } + } +} + + +DOMNode* DOMNodeImpl::getElementAncestor (const DOMNode* currentNode) const { + DOMNode* parent = currentNode->getParentNode(); + while(parent != 0) { + short type = parent->getNodeType(); + if (type == DOMNode::ELEMENT_NODE) { + return parent; + } + parent=parent->getParentNode(); + } + return 0; +} + + +const XMLCh* DOMNodeImpl::lookupPrefix(const XMLCh* const namespaceURI, DOMElement *originalElement) const { + DOMNode *thisNode = castToNode(this); + + const XMLCh* ns = thisNode->getNamespaceURI(); + // REVISIT: if no prefix is available is it null or empty string, or + // could be both? + const XMLCh* prefix = thisNode->getPrefix(); + + if (ns != 0 && XMLString::equals(ns,namespaceURI) && prefix != 0) { + const XMLCh* foundNamespace = originalElement->lookupNamespaceURI(prefix); + if (foundNamespace != 0 && XMLString::equals(foundNamespace, namespaceURI)) { + return prefix; + } + } + if (thisNode->hasAttributes()) { + DOMNamedNodeMap *nodeMap = thisNode->getAttributes(); + + if(nodeMap != 0) { + XMLSize_t length = nodeMap->getLength(); + + for (XMLSize_t i = 0;i < length;i++) { + DOMNode *attr = nodeMap->item(i); + const XMLCh* attrPrefix = attr->getPrefix(); + const XMLCh* value = attr->getNodeValue(); + + ns = attr->getNamespaceURI(); + + if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) { + // DOM Level 2 nodes + if ((attrPrefix != 0 && XMLString::equals(attrPrefix, XMLUni::fgXMLNSString)) && + XMLString::equals(value, namespaceURI)) { + const XMLCh* localname= attr->getLocalName(); + const XMLCh* foundNamespace = originalElement->lookupNamespaceURI(localname); + if (foundNamespace != 0 && XMLString::equals(foundNamespace, namespaceURI)) { + return localname; + } + } + } + } + } + } + DOMNode *ancestor = getElementAncestor(thisNode); + if (ancestor != 0) { + return castToNodeImpl(ancestor)->lookupPrefix(namespaceURI, originalElement); + } + return 0; +} + +const XMLCh* DOMNodeImpl::lookupNamespaceURI(const XMLCh* specifiedPrefix) const { + DOMNode *thisNode = castToNode(this); + + short type = thisNode->getNodeType(); + switch (type) { + case DOMNode::ELEMENT_NODE : { + const XMLCh* ns = thisNode->getNamespaceURI(); + const XMLCh* prefix = thisNode->getPrefix(); + if (ns != 0) { + // REVISIT: is it possible that prefix is empty string? + if (specifiedPrefix == 0 && prefix == specifiedPrefix) { + // looking for default namespace + return ns; + } else if (prefix != 0 && XMLString::equals(prefix, specifiedPrefix)) { + // non default namespace + return ns; + } + } + if (thisNode->hasAttributes()) { + DOMNamedNodeMap *nodeMap = thisNode->getAttributes(); + if(nodeMap != 0) { + XMLSize_t length = nodeMap->getLength(); + for (XMLSize_t i = 0;i < length;i++) { + DOMNode *attr = nodeMap->item(i); + const XMLCh *attrPrefix = attr->getPrefix(); + const XMLCh *value = attr->getNodeValue(); + ns = attr->getNamespaceURI(); + + if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) { + // at this point we are dealing with DOM Level 2 nodes only + if (specifiedPrefix == 0 && + XMLString::equals(attr->getNodeName(), XMLUni::fgXMLNSString)) { + // default namespace + return value; + } else if (attrPrefix != 0 && + XMLString::equals(attrPrefix, XMLUni::fgXMLNSString) && + XMLString::equals(attr->getLocalName(), specifiedPrefix)) { + // non default namespace + return value; + } + } + } + } + } + DOMNode *ancestor = getElementAncestor(thisNode); + if (ancestor != 0) { + return ancestor->lookupNamespaceURI(specifiedPrefix); + } + return 0; + } + case DOMNode::DOCUMENT_NODE : { + return((DOMDocument*)thisNode)->getDocumentElement()->lookupNamespaceURI(specifiedPrefix); + } + case DOMNode::ENTITY_NODE : + case DOMNode::NOTATION_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + case DOMNode::DOCUMENT_TYPE_NODE: + // type is unknown + return 0; + case DOMNode::ATTRIBUTE_NODE:{ + if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) { + return fOwnerNode->lookupNamespaceURI(specifiedPrefix); + } + return 0; + } + default:{ + DOMNode *ancestor = getElementAncestor(castToNode(this)); + if (ancestor != 0) { + return ancestor->lookupNamespaceURI(specifiedPrefix); + } + return 0; + } + } +} + + +const XMLCh* DOMNodeImpl::getBaseURI() const{ + DOMNode *thisNode = castToNode(this); + DOMNode* parent = thisNode->getParentNode(); + if (parent) + return parent->getBaseURI(); + else + return 0; +} + +const DOMNode* DOMNodeImpl::getTreeParentNode(const DOMNode* node) const { + const DOMNode* parent=node->getParentNode(); + if(parent) + return parent; + short nodeType=node->getNodeType(); + switch(nodeType) + { + case DOMNode::ATTRIBUTE_NODE: return ((const DOMAttr*)node)->getOwnerElement(); + case DOMNode::NOTATION_NODE: + case DOMNode::ENTITY_NODE: return node->getOwnerDocument()->getDoctype(); + } + return 0; +} + +short DOMNodeImpl::compareDocumentPosition(const DOMNode* other) const { + DOMNode* thisNode = castToNode(this); + + // If the two nodes being compared are the same node, then no flags are set on the return. + if (thisNode == other) + return 0; + + //if this is a custom node, we don't really know what to do, just return + //user should provide its own compareDocumentPosition logic, and shouldn't reach here + if(thisNode->getNodeType() > 12) { + return 0; + } + + //if it is a custom node we must ask it for the order + if(other->getNodeType() > 12) { + return reverseTreeOrderBitPattern(other->compareDocumentPosition(thisNode)); + } + + // Otherwise, the order of two nodes is determined by looking for common containers -- + // containers which contain both. A node directly contains any child nodes. + // A node also directly contains any other nodes attached to it such as attributes + // contained in an element or entities and notations contained in a document type. + // Nodes contained in contained nodes are also contained, but less-directly as + // the number of intervening containers increases. + + // If one of the nodes being compared contains the other node, then the container precedes + // the contained node, and reversely the contained node follows the container. For example, + // when comparing an element against its own attribute or child, the element node precedes + // its attribute node and its child node, which both follow it. + + const DOMNode* tmpNode; + const DOMNode* myRoot = castToNode(this); + int myDepth=0; + while((tmpNode=getTreeParentNode(myRoot))!=0) + { + myRoot=tmpNode; + if(myRoot==other) + return DOMNode::DOCUMENT_POSITION_CONTAINS | DOMNode::DOCUMENT_POSITION_PRECEDING; + myDepth++; + } + + const DOMNode* hisRoot = other; + int hisDepth=0; + while((tmpNode=getTreeParentNode(hisRoot))!=0) + { + hisRoot=tmpNode; + if(hisRoot==thisNode) + return DOMNode::DOCUMENT_POSITION_CONTAINED_BY | DOMNode::DOCUMENT_POSITION_FOLLOWING; + hisDepth++; + } + + // If there is no common container node, then the order is based upon order between the + // root container of each node that is in no container. In this case, the result is + // disconnected and implementation-specific. This result is stable as long as these + // outer-most containing nodes remain in memory and are not inserted into some other + // containing node. This would be the case when the nodes belong to different documents + // or fragments, and cloning the document or inserting a fragment might change the order. + + if(myRoot!=hisRoot) + return DOMNode::DOCUMENT_POSITION_DISCONNECTED | DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | + (myRoot hisDepth) { + for (int i= 0 ; i < myDepth - hisDepth; i++) + myRoot = getTreeParentNode(myRoot); + } + else { + for (int i = 0; i < hisDepth - myDepth; i++) + hisRoot = getTreeParentNode(hisRoot); + } + + // We now have nodes at the same depth in the tree. Find a common ancestor. + const DOMNode *myNodeP=myRoot; + const DOMNode *hisNodeP=hisRoot; + while(myRoot!=hisRoot) + { + myNodeP = myRoot; + hisNodeP = hisRoot; + myRoot = getTreeParentNode(myRoot); + hisRoot = getTreeParentNode(hisRoot); + } + + short myNodeType=myNodeP->getNodeType(); + short hisNodeType=hisNodeP->getNodeType(); + bool bMyNodeIsChild=(myNodeType!=DOMNode::ATTRIBUTE_NODE && myNodeType!=DOMNode::ENTITY_NODE && myNodeType!=DOMNode::NOTATION_NODE); + bool bHisNodeIsChild=(hisNodeType!=DOMNode::ATTRIBUTE_NODE && hisNodeType!=DOMNode::ENTITY_NODE && hisNodeType!=DOMNode::NOTATION_NODE); + + // If these two determining nodes are both child nodes, then the natural DOM order of these + // determining nodes within the containing node is returned as the order of the corresponding nodes. + // This would be the case, for example, when comparing two child elements of the same element. + if(bMyNodeIsChild && bHisNodeIsChild) + { + while(myNodeP != 0) + { + myNodeP = myNodeP->getNextSibling(); + if(myNodeP == hisNodeP) + return DOMNode::DOCUMENT_POSITION_FOLLOWING; + } + return DOMNode::DOCUMENT_POSITION_PRECEDING; + } + + // If one of the two determining nodes is a child node and the other is not, then the corresponding + // node of the child node follows the corresponding node of the non-child node. This would be the case, + // for example, when comparing an attribute of an element with a child element of the same element. + else if(!bMyNodeIsChild && bHisNodeIsChild) + return DOMNode::DOCUMENT_POSITION_FOLLOWING; + else if(bMyNodeIsChild && !bHisNodeIsChild) + return DOMNode::DOCUMENT_POSITION_PRECEDING; + + else + { + // If neither of the two determining node is a child node and one determining node has a greater value + // of nodeType than the other, then the corresponding node precedes the other. This would be the case, + // for example, when comparing an entity of a document type against a notation of the same document type. + if(myNodeType!=hisNodeType) + return (myNodeTypeallocate((nBufferLength+1) * sizeof(XMLCh)); + getTextContent(pzBuffer, nBufferLength); + pzBuffer[nBufferLength] = 0; + + return pzBuffer; + +} + +const XMLCh* DOMNodeImpl::getTextContent(XMLCh* pzBuffer, XMLSize_t& rnBufferLength) const +{ + XMLSize_t nRemainingBuffer = rnBufferLength; + rnBufferLength = 0; + + if (pzBuffer) + *pzBuffer = 0; + + DOMNode *thisNode = castToNode(this); + + switch (thisNode->getNodeType()) + { + case DOMNode::ELEMENT_NODE: + case DOMNode::ENTITY_NODE: + case DOMNode::ENTITY_REFERENCE_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + { + DOMNode* current = thisNode->getFirstChild(); + + while (current != NULL) + { + if (current->getNodeType() != DOMNode::COMMENT_NODE && + current->getNodeType() != DOMNode::PROCESSING_INSTRUCTION_NODE) + { + + if (pzBuffer) + { + XMLSize_t nContentLength = nRemainingBuffer; + castToNodeImpl(current)->getTextContent(pzBuffer + rnBufferLength, nContentLength); + rnBufferLength += nContentLength; + nRemainingBuffer -= nContentLength; + } + else + { + XMLSize_t nContentLength = 0; + castToNodeImpl(current)->getTextContent(NULL, nContentLength); + rnBufferLength += nContentLength; + } + } + + current = current->getNextSibling(); + + } + } + + break; + + case DOMNode::ATTRIBUTE_NODE: + case DOMNode::TEXT_NODE: + case DOMNode::CDATA_SECTION_NODE: + case DOMNode::COMMENT_NODE: + case DOMNode::PROCESSING_INSTRUCTION_NODE: + { + const XMLCh* pzValue = thisNode->getNodeValue(); + XMLSize_t nStrLen = XMLString::stringLen(pzValue); + + if (pzBuffer) + { + XMLSize_t nContentLength = (nRemainingBuffer >= nStrLen) ? nStrLen : nRemainingBuffer; + XMLString::copyNString(pzBuffer + rnBufferLength, pzValue, nContentLength); + rnBufferLength += nContentLength; + nRemainingBuffer -= nContentLength; + } + else + { + rnBufferLength += nStrLen; + } + + } + + break; + + /*** + DOCUMENT_NODE + DOCUMENT_TYPE_NODE + NOTATION_NODE + ***/ + default: + + break; + } + + return pzBuffer; + +} + +void DOMNodeImpl::setTextContent(const XMLCh* textContent){ + DOMNode *thisNode = castToNode(this); + switch (thisNode->getNodeType()) + { + case DOMNode::ELEMENT_NODE: + case DOMNode::ENTITY_NODE: + case DOMNode::ENTITY_REFERENCE_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + { + if (isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + // Remove all childs + DOMNode* current = thisNode->getFirstChild(); + while (current != NULL) + { + thisNode->removeChild(current); + current = thisNode->getFirstChild(); + } + if (textContent != NULL) + { + // Add textnode containing data + current = ((DOMDocumentImpl*)thisNode->getOwnerDocument())->createTextNode(textContent); + thisNode->appendChild(current); + } + } + break; + + case DOMNode::ATTRIBUTE_NODE: + case DOMNode::TEXT_NODE: + case DOMNode::CDATA_SECTION_NODE: + case DOMNode::COMMENT_NODE: + case DOMNode::PROCESSING_INSTRUCTION_NODE: + if (isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + + thisNode->setNodeValue(textContent); + break; + + case DOMNode::DOCUMENT_NODE: + case DOMNode::DOCUMENT_TYPE_NODE: + case DOMNode::NOTATION_NODE: + break; + + default: + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager); + } +} + + +bool DOMNodeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const{ + DOMNode *thisNode = castToNode(this); + short type = thisNode->getNodeType(); + switch (type) { + case DOMNode::ELEMENT_NODE: { + const XMLCh *prefix = thisNode->getPrefix(); + + // REVISIT: is it possible that prefix is empty string? + if (prefix == 0 || !*prefix) { + return XMLString::equals(namespaceURI, thisNode->getNamespaceURI()); + } + + if (thisNode->hasAttributes()) { + DOMElement *elem = (DOMElement *)thisNode; + DOMNode *attr = elem->getAttributeNodeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString); + if (attr != 0) { + const XMLCh *value = attr->getNodeValue(); + return XMLString::equals(namespaceURI, value); + } + } + DOMNode *ancestor = getElementAncestor(thisNode); + if (ancestor != 0) { + return ancestor->isDefaultNamespace(namespaceURI); + } + + return false; + } + case DOMNode::DOCUMENT_NODE:{ + return ((DOMDocument*)thisNode)->getDocumentElement()->isDefaultNamespace(namespaceURI); + } + + case DOMNode::ENTITY_NODE : + case DOMNode::NOTATION_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + case DOMNode::DOCUMENT_TYPE_NODE: + // type is unknown + return false; + case DOMNode::ATTRIBUTE_NODE:{ + if (fOwnerNode->getNodeType() == DOMNode::ELEMENT_NODE) { + return fOwnerNode->isDefaultNamespace(namespaceURI); + + } + return false; + } + default:{ + DOMNode *ancestor = getElementAncestor(thisNode); + if (ancestor != 0) { + return ancestor->isDefaultNamespace(namespaceURI); + } + return false; + } + + } +} + +void* DOMNodeImpl::getFeature(const XMLCh*, const XMLCh*) const { + return 0; +} + + +// non-standard extension +void DOMNodeImpl::release() +{ + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.hpp new file mode 100644 index 000000000..9c6c278f9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeImpl.hpp @@ -0,0 +1,382 @@ +/* + * 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: DOMNodeImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODEIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +/** + * A DOMNodeImpl doesn't have any children, and can therefore only be directly + * inherited by classes of nodes that never have any, such as Text nodes. For + * other types, such as Element, classes must inherit from ParentNode. + *

+ * All nodes in a single document must originate + * in that document. (Note that this is much tighter than "must be + * same implementation") Nodes are all aware of their ownerDocument, + * and attempts to mismatch will throw WRONG_DOCUMENT_ERR. + *

+ * However, to save memory not all nodes always have a direct reference + * to their ownerDocument. When a node is owned by another node it relies + * on its owner to store its ownerDocument. Parent nodes always store it + * though, so there is never more than one level of indirection. + * And when a node doesn't have an owner, ownerNode refers to its + * ownerDocument. + **/ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNamedNodeMap; +class DOMNodeList; +class DOMNode; +class DOMDocument; +class DOMElement; + +class CDOM_EXPORT DOMNodeImpl { +public: + + // data + DOMNode *fOwnerNode; // typically the parent but not always! + + unsigned short flags; + + static const unsigned short READONLY; + static const unsigned short SYNCDATA; + static const unsigned short SYNCCHILDREN; + static const unsigned short OWNED; + static const unsigned short FIRSTCHILD; + static const unsigned short SPECIFIED; + static const unsigned short IGNORABLEWS; + static const unsigned short SETVALUE; + static const unsigned short ID_ATTR; + static const unsigned short USERDATA; + static const unsigned short LEAFNODETYPE; + static const unsigned short CHILDNODE; + static const unsigned short TOBERELEASED; + + +public: + DOMNodeImpl(DOMNode *ownerDocument); + DOMNodeImpl(const DOMNodeImpl &other); + ~DOMNodeImpl(); + + DOMNode * appendChild(DOMNode *newChild); + DOMNamedNodeMap * getAttributes() const; + DOMNodeList * getChildNodes() const; + DOMNode * getFirstChild() const; + DOMNode * getLastChild() const; + const XMLCh * getLocalName() const; + const XMLCh * getNamespaceURI() const; + DOMNode * getNextSibling() const; + const XMLCh * getNodeValue() const; + DOMDocument * getOwnerDocument() const; + DOMNode * getParentNode() const; + const XMLCh * getPrefix() const; + DOMNode * getPreviousSibling() const; + bool hasChildNodes() const; + DOMNode * insertBefore(DOMNode *newChild, DOMNode *refChild); + void normalize(); + DOMNode * removeChild(DOMNode *oldChild); + DOMNode * replaceChild(DOMNode *newChild, DOMNode *oldChild); + void setNodeValue(const XMLCh *value); + void setPrefix(const XMLCh *fPrefix); + void setReadOnly(bool readOnly, bool deep); + bool isSupported(const XMLCh *feature, const XMLCh *version) const; + bool hasAttributes() const; + + // Introduced in DOM Level 3 + void* setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler); + void* getUserData(const XMLCh* key) const; + bool isSameNode(const DOMNode* other) const; + bool isEqualNode(const DOMNode* arg) const; + const XMLCh* getBaseURI() const ; + short compareDocumentPosition(const DOMNode* other) const; + const XMLCh* getTextContent() const ; + const XMLCh* getTextContent(XMLCh* pzBuffer, XMLSize_t& rnBufferLength) const; + void setTextContent(const XMLCh* textContent) ; + const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const ; + bool isDefaultNamespace(const XMLCh* namespaceURI) const ; + const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const ; + void* getFeature(const XMLCh* feature, const XMLCh* version) const; + + + // Helper functions for DOM Level 3 + void release(); + void callUserDataHandlers(DOMUserDataHandler::DOMOperationType operation, + const DOMNode* src, + DOMNode* dst) const; + //reverses the bit pattern given by compareDocumentPosition + short reverseTreeOrderBitPattern(short pattern) const; + const DOMNode* getTreeParentNode(const DOMNode* node) const; + + + //Utility, not part of DOM Level 2 API + static bool isKidOK(DOMNode *parent, DOMNode *child); + static const XMLCh *mapPrefix(const XMLCh *prefix, + const XMLCh *namespaceURI, short nType); + + static const XMLCh *getXmlnsString(); + static const XMLCh *getXmlnsURIString(); + static const XMLCh *getXmlString(); + static const XMLCh *getXmlURIString(); + +public: // should really be protected - ALH + + DOMNode* getElementAncestor (const DOMNode* currentNode) const; + const XMLCh* lookupPrefix(const XMLCh* const namespaceURI, DOMElement *el) const ; + void setOwnerDocument(DOMDocument *doc); + + /* + * Flags setters and getters + */ + + inline bool isReadOnly() const { + return (flags & READONLY) != 0; + } + + inline void isReadOnly(bool value) { + flags = (value ? flags | READONLY : flags & ~READONLY); + } + + inline bool needsSyncData() const { + return (flags & SYNCDATA) != 0; + } + + inline void needsSyncData(bool value) { + flags = (value ? flags | SYNCDATA : flags & ~SYNCDATA); + } + + inline bool needsSyncChildren() const { + return (flags & SYNCCHILDREN) != 0; + } + + inline void needsSyncChildren(bool value) { + flags = (value ? flags | SYNCCHILDREN : flags & ~SYNCCHILDREN); + } + + // For Attributes, true if the attr node is attached to an element. + // For all other node types, true if the node has a parent node. + inline bool isOwned() const { + return (flags & OWNED) != 0; + } + + inline void isOwned(bool value) { + flags = (value ? flags | OWNED : flags & ~OWNED); + } + + inline bool isFirstChild() const { + return (flags & FIRSTCHILD) != 0; + } + + inline void isFirstChild(bool value) { + flags = (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD); + } + + inline bool isSpecified() const { + return (flags & SPECIFIED) != 0; + } + + inline void isSpecified(bool value) { + flags = (value ? flags | SPECIFIED : flags & ~SPECIFIED); + } + + inline bool ignorableWhitespace() const { + return (flags & IGNORABLEWS) != 0; + } + + inline void ignorableWhitespace(bool value) { + flags = (value ? flags | IGNORABLEWS : flags & ~IGNORABLEWS); + } + + inline bool setValue() const { + return (flags & SETVALUE) != 0; + } + + inline void setValue(bool value) { + flags = (value ? flags | SETVALUE : flags & ~SETVALUE); + } + + inline bool isIdAttr() const { + return (flags & ID_ATTR) != 0; + } + + inline void isIdAttr(bool value) { + flags = (value ? flags | ID_ATTR : flags & ~ID_ATTR); + } + + inline bool hasUserData() const { + return (flags & USERDATA) != 0; + } + + inline void hasUserData(bool value) { + flags = (value ? flags | USERDATA : flags & ~USERDATA); + } + + // + // LeafNode is set true for node types that can not be ParentNodes (can't have children) + // This knowledge is used to allow casting from any unknown node type to the + // IDParentImpl or IDChildImpl parts of the node. + // + inline bool isLeafNode() const { + return (flags & LEAFNODETYPE) != 0; + } + + inline void setIsLeafNode(bool value) { + flags = (value ? flags | LEAFNODETYPE : flags & ~LEAFNODETYPE); + } + + + // + // ChildNode is set true for node types that can be children of other nodes, and + // therefore include a DOMChildNode data member. Note that all of the leaf + // node types (above flag) are also ChildNodes, but not all ChildNodes are + // leaf nodes. + inline bool isChildNode() const { + return (flags & CHILDNODE) != 0; + } + + inline void setIsChildNode(bool value) { + flags = (value ? flags | CHILDNODE : flags & ~CHILDNODE); + } + + // True if this node has to be released regardless if it has a owner or not + // This is true if called from fParent->release() + inline bool isToBeReleased() const { + return (flags & TOBERELEASED) != 0; + } + + inline void isToBeReleased(bool value) { + flags = (value ? flags | TOBERELEASED : flags & ~TOBERELEASED); + } + +}; + + +// This macro lists all of the pure virtual functions declared in DOMNode that must +// be implemented by all node types. Since there is no inheritance of implementation, +// using this macro in the class declaration of the node types make it easier to +// accurately get all of the functions declared. +// +#define DOMNODE_FUNCTIONS \ + virtual DOMNode* appendChild(DOMNode *newChild) ;\ + virtual DOMNode* cloneNode(bool deep) const ;\ + virtual DOMNamedNodeMap* getAttributes() const ;\ + virtual DOMNodeList* getChildNodes() const ;\ + virtual DOMNode* getFirstChild() const ;\ + virtual DOMNode* getLastChild() const ;\ + virtual const XMLCh* getLocalName() const ;\ + virtual const XMLCh* getNamespaceURI() const ;\ + virtual DOMNode* getNextSibling() const ;\ + virtual const XMLCh* getNodeName() const ;\ + virtual NodeType getNodeType() const ;\ + virtual const XMLCh* getNodeValue() const ;\ + virtual DOMDocument* getOwnerDocument() const ;\ + virtual const XMLCh* getPrefix() const ;\ + virtual DOMNode* getParentNode() const ;\ + virtual DOMNode* getPreviousSibling() const ;\ + virtual bool hasChildNodes() const ;\ + virtual DOMNode* insertBefore(DOMNode *newChild, DOMNode *refChild) ;\ + virtual void normalize() ;\ + virtual DOMNode* removeChild(DOMNode *oldChild) ;\ + virtual DOMNode* replaceChild(DOMNode *newChild, DOMNode *oldChild) ;\ + virtual void setNodeValue(const XMLCh *nodeValue) ;\ + virtual bool isSupported(const XMLCh *feature, const XMLCh *version) const ;\ + virtual bool hasAttributes() const ;\ + virtual void setPrefix(const XMLCh * prefix) ;\ + virtual void* setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) ;\ + virtual void* getUserData(const XMLCh* key) const ;\ + virtual bool isSameNode(const DOMNode* other) const;\ + virtual bool isEqualNode(const DOMNode* arg) const;\ + virtual const XMLCh* getBaseURI() const ;\ + virtual short compareDocumentPosition(const DOMNode* other) const ;\ + virtual const XMLCh* getTextContent() const ;\ + const XMLCh* getTextContent(XMLCh* pzBuffer, unsigned int& rnBufferLength) const;\ + virtual void setTextContent(const XMLCh* textContent) ;\ + virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const ;\ + virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const;\ + virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const ;\ + virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const ;\ + virtual void release() + + +/* + * Here are dummy stubs for most of the functions introduced by DOMNode. + * Each subclass of DOMNode will have something like this that delegates each + * function to the appropriate implementation. + * Functions that must be supplied by every node class are omitted. + * + DOMNode* xxx::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }; + DOMNamedNodeMap* xxx::getAttributes() const {return fNode.getAttributes (); }; + DOMNodeList* xxx::getChildNodes() const {return fParent.getChildNodes (); }; + DOMNode* xxx::getFirstChild() const {return fParent.getFirstChild (); }; + DOMNode* xxx::getLastChild() const {return fParent.getLastChild (); }; + const XMLCh* xxx::getLocalName() const {return fNode.getLocalName (); }; + const XMLCh* xxx::getNamespaceURI() const {return fNode.getNamespaceURI (); }; + DOMNode* xxx::getNextSibling() const {return fChild.getNextSibling (); }; + const XMLCh* xxx::getNodeValue() const {return fNode.getNodeValue (); }; + DOMDocument* xxx::getOwnerDocument() const {return fNode.getOwnerDocument (); }; + const XMLCh* xxx::getPrefix() const {return fNode.getPrefix (); }; + DOMNode* xxx::getParentNode() const {return fChild.getParentNode (this); }; + DOMNode* xxx::getPreviousSibling() const {return fChild.getPreviousSibling (this); }; + bool xxx::hasChildNodes() const {return fParent.hasChildNodes (); }; + DOMNode* xxx::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fParent.insertBefore (newChild, refChild); }; + void xxx::normalize() {fParent.normalize(); }; + DOMNode* xxx::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }; + DOMNode* xxx::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fParent.replaceChild (newChild, oldChild); }; + bool xxx::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); }; + void xxx::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }; + bool xxx::hasAttributes() const {return fNode.hasAttributes(); }; + bool xxx::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }; + bool xxx::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }; + void* xxx::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); }; + void* xxx::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }; + const XMLCh* xxx::getBaseURI() const {return fNode.getBaseURI(); }; + short xxx::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }; + const XMLCh* xxx::getTextContent() const {return fNode.getTextContent(); }; + void xxx::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }; + const XMLCh* xxx::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }; + bool xxx::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }; + const XMLCh* xxx::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }; + void* xxx::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }; + + +*/ + + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp new file mode 100644 index 000000000..49bdcb52b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp @@ -0,0 +1,365 @@ +/* + * 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: DOMNodeIteratorImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +////////////////////////////////////////////////////////////////////// +// DOMNodeIteratorImpl.cpp: implementation of the DOMNodeIteratorImpl class. +// +////////////////////////////////////////////////////////////////////// + +#include "DOMNodeIteratorImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +DOMNodeIteratorImpl::DOMNodeIteratorImpl (DOMDocument* doc, + DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* nodeFilter, + bool expandEntityRef) +: fRoot(root), + fDocument(doc), + fWhatToShow(whatToShow), + fNodeFilter(nodeFilter), + fExpandEntityReferences(expandEntityRef), + fDetached(false), + fCurrentNode(0), + fForward(true) +{ + +} + + +DOMNodeIteratorImpl::DOMNodeIteratorImpl ( const DOMNodeIteratorImpl& toCopy) + : DOMNodeIterator(toCopy), + fRoot(toCopy.fRoot), + fDocument(toCopy.fDocument), + fWhatToShow(toCopy.fWhatToShow), + fNodeFilter(toCopy.fNodeFilter), + fExpandEntityReferences(toCopy.fExpandEntityReferences), + fDetached(toCopy.fDetached), + fCurrentNode(toCopy.fCurrentNode), + fForward(toCopy.fForward) +{ +} + + +DOMNodeIteratorImpl& DOMNodeIteratorImpl::operator= (const DOMNodeIteratorImpl& other) { + fRoot = other.fRoot; + fCurrentNode = other.fRoot; + fWhatToShow = other.fWhatToShow; + fNodeFilter = other.fNodeFilter; + fForward = other.fForward; + fDetached = other.fDetached; + fExpandEntityReferences = other.fExpandEntityReferences; + fDocument = other.fDocument; + return *this; +} + +DOMNodeIteratorImpl::~DOMNodeIteratorImpl () +{ + fDetached = false; +} + + +void DOMNodeIteratorImpl::detach () +{ + fDetached = true; + ((DOMDocumentImpl *)fDocument)->removeNodeIterator(this); +} + + +DOMNode* DOMNodeIteratorImpl::getRoot() { + return fRoot; +} + + +// Implementation Note: Note that the iterator looks at whatToShow +// and filter values at each call, and therefore one _could_ add +// setters for these values and alter them while iterating! + +/** Return the whatToShow value */ + +DOMNodeFilter::ShowType DOMNodeIteratorImpl::getWhatToShow () { + return fWhatToShow; +} + + +/** Return the filter */ + +DOMNodeFilter* DOMNodeIteratorImpl::getFilter () { + return fNodeFilter; +} + +/** Get the expandEntity reference flag. */ +bool DOMNodeIteratorImpl::getExpandEntityReferences() +{ + return fExpandEntityReferences; +} + +/** Return the next DOMNode* in the Iterator. The node is the next node in + * depth-first order which also passes the filter, and whatToShow. + * A 0 return means either that + */ + +DOMNode* DOMNodeIteratorImpl::nextNode () { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + // if root is 0 there is no next node-> + if (!fRoot) + return 0; + + DOMNode* aNextNode = fCurrentNode; + bool accepted = false; // the next node has not been accepted. + + while (!accepted) { + + // if last direction is not forward, repeat node-> + if (!fForward && (aNextNode != 0)) { + //System.out.println("nextNode():!fForward:"+fCurrentNode.getNodeName()); + aNextNode = fCurrentNode; + } else { + // else get the next node via depth-first + aNextNode = nextNode(aNextNode, true); + } + + fForward = true; //REVIST: should direction be set forward before 0 check? + + // nothing in the list. return 0. + if (!aNextNode) return 0; + + // does node pass the filters and whatToShow? + accepted = acceptNode(aNextNode); + if (accepted) { + // if so, then the node is the current node-> + fCurrentNode = aNextNode; + return fCurrentNode; + } + } + + // no nodes, or no accepted nodes. + return 0; +} + + +/** Return the previous Node in the Iterator. The node is the next node in + * _backwards_ depth-first order which also passes the filter, and whatToShow. + */ + +DOMNode* DOMNodeIteratorImpl::previousNode () { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + // if the root is 0, or the current node is 0, return 0. + if (!fRoot || !fCurrentNode) return 0; + + DOMNode* aPreviousNode = fCurrentNode; + bool accepted = false; + + while (!accepted) { + + if (fForward && (aPreviousNode != 0)) { + //repeat last node-> + aPreviousNode = fCurrentNode; + } else { + // get previous node in backwards depth first order. + aPreviousNode = previousNode(aPreviousNode); + } + + // we are going backwards + fForward = false; + + // if the new previous node is 0, we're at head or past the root, + // so return 0. + if (!aPreviousNode) return 0; + + // check if node passes filters and whatToShow. + accepted = acceptNode(aPreviousNode); + if (accepted) { + // if accepted, update the current node, and return it. + fCurrentNode = aPreviousNode; + return fCurrentNode; + } + } + // there are no nodes? + return 0; +} + + +/** The node is accepted if it passes the whatToShow and the filter. */ +bool DOMNodeIteratorImpl::acceptNode (DOMNode* node) { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + if (fNodeFilter == 0) { + return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0); + } else { + return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0) + && fNodeFilter->acceptNode(node) == DOMNodeFilter::FILTER_ACCEPT; + } +} + + +/** Return node, if matches or any parent if matches. */ +DOMNode* DOMNodeIteratorImpl::matchNodeOrParent (DOMNode* node) { + + for (DOMNode* n = fCurrentNode; n != fRoot; n = n->getParentNode()) { + if (node == n) return n; + } + + return 0; +} + + +/** The method nextNode(DOMNode, bool) returns the next node + * from the actual DOM tree. + * + * The bool visitChildren determines whether to visit the children. + * The result is the nextNode. + */ + +DOMNode* DOMNodeIteratorImpl::nextNode (DOMNode* node, bool visitChildren) { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + if (!node) return fRoot; + + DOMNode* result = 0; + // only check children if we visit children. + if (visitChildren) { + //if hasChildren, return 1st child. + if ((fExpandEntityReferences || node->getNodeType()!=DOMNode::ENTITY_REFERENCE_NODE) && + node->hasChildNodes()) { + result = node->getFirstChild(); + return result; + } + } + + // if hasSibling, return sibling + if (node != fRoot) { + result = node->getNextSibling(); + if (result != 0) return result; + + + // return parent's 1st sibling. + DOMNode* parent = node->getParentNode(); + while ((parent != 0) && parent != fRoot) { + result = parent->getNextSibling(); + if (result != 0) { + return result; + } else { + parent = parent->getParentNode(); + } + + } // while (parent != 0 && parent != fRoot) { + } + // end of list, return 0 + return 0; +} + + +/** The method previousNode(DOMNode) returns the previous node + * from the actual DOM tree. + */ + +DOMNode* DOMNodeIteratorImpl::previousNode (DOMNode* node) { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + DOMNode* result = 0; + + // if we're at the root, return 0. + if (node == fRoot) + return 0; + + // get sibling + result = node->getPreviousSibling(); + if (!result) { + //if 1st sibling, return parent + result = node->getParentNode(); + return result; + } + + // if sibling has children, keep getting last child of child. + if (result->hasChildNodes()) { + while ((fExpandEntityReferences || result->getNodeType()!=DOMNode::ENTITY_REFERENCE_NODE) && + result->hasChildNodes()) { + result = result->getLastChild(); + } + } + + return result; +} + + +/** Fix-up the iterator on a remove. Called by DOM or otherwise, + * before an actual DOM remove. + */ + +void DOMNodeIteratorImpl::removeNode (DOMNode* node) { + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager); + + // Implementation note: Fix-up means setting the current node properly + // after a remove. + + if (!node) return; + + DOMNode* deleted = matchNodeOrParent(node); + + if (!deleted) return; + + if (fForward) { + fCurrentNode = previousNode(deleted); + } else + // if (!fForward) + { + DOMNode* next = nextNode(deleted, false); + if (next != 0) { + // normal case: there _are_ nodes following this in the iterator. + fCurrentNode = next; + } else { + // the last node in the iterator is to be removed, + // so we set the current node to be the previous one. + fCurrentNode = previousNode(deleted); + fForward = true; + } + + } + +} + + +void DOMNodeIteratorImpl::release() +{ + detach(); + + // for performance reason, do not recycle pointer + // chance that this is allocated again and again is not usual +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.hpp new file mode 100644 index 000000000..50fc7849b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeIteratorImpl.hpp @@ -0,0 +1,122 @@ +/* + * 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: DOMNodeIteratorImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEITERATORIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODEITERATORIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +////////////////////////////////////////////////////////////////////// +// DOMNodeIteratorImpl.hpp: interface for the DOMNodeIteratorImpl class. +// +////////////////////////////////////////////////////////////////////// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CDOM_EXPORT DOMNodeIteratorImpl : public DOMNodeIterator { + protected: + // + // Data + // + // The root. + DOMNode* fRoot; + + // The Document used to create this iterator + DOMDocument* fDocument; + + // The whatToShow mask. + DOMNodeFilter::ShowType fWhatToShow; + + // The NodeFilter reference. + DOMNodeFilter* fNodeFilter; + + + // The expandEntity reference flag. + bool fExpandEntityReferences; + bool fDetached; + + + // + // Iterator state - current node and direction. + // + // Note: The current node and direction are sufficient to implement + // the desired behaviour of the current pointer being _between_ + // two nodes. The fCurrentNode is actually the last node returned, + // and the + // direction is whether the pointer is in front or behind this node. + // (usually akin to whether the node was returned via nextNode()) + // (eg fForward = true) or previousNode() (eg fForward = false). + // The last Node returned. + DOMNode* fCurrentNode; + + // The direction of the iterator on the fCurrentNode. + // + // nextNode() == fForward = true;
+ // previousNode() == fForward = false;
+ //
+ bool fForward; + + public: + virtual ~DOMNodeIteratorImpl (); + DOMNodeIteratorImpl ( + DOMDocument* fDocument, + DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* nodeFilter, + bool expandEntityRef); + + DOMNodeIteratorImpl ( const DOMNodeIteratorImpl& toCopy); + DOMNodeIteratorImpl& operator= (const DOMNodeIteratorImpl& other); + + virtual DOMNode* getRoot (); + virtual DOMNodeFilter::ShowType getWhatToShow (); + virtual DOMNodeFilter* getFilter (); + // Get the expandEntity reference flag. + virtual bool getExpandEntityReferences(); + + virtual DOMNode* nextNode (); + virtual DOMNode* previousNode (); + virtual void detach (); + + virtual void release(); + void removeNode (DOMNode* node); + + protected: + DOMNode* matchNodeOrParent (DOMNode* node); + DOMNode* nextNode (DOMNode* node, bool visitChildren); + DOMNode* previousNode (DOMNode* node); + bool acceptNode (DOMNode* node); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.cpp new file mode 100644 index 000000000..228dd137a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.cpp @@ -0,0 +1,72 @@ +/* + * 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: DOMNodeListImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + + +#include +#include "DOMNodeListImpl.hpp" +#include "DOMCasts.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +// revisit +// this implementation is too stupid - needs a cache of some kind. +// + +DOMNodeListImpl::DOMNodeListImpl(DOMParentNode *node) +: fNode(node) +{ +} + + +DOMNodeListImpl:: ~DOMNodeListImpl() +{ +} + + + +XMLSize_t DOMNodeListImpl::getLength() const{ + XMLSize_t count = 0; + if (fNode) { + DOMNode *node = fNode->fFirstChild; + while(node != 0){ + ++count; + node = castToChildImpl(node)->nextSibling; + } + } + + return count; +} + + + +DOMNode *DOMNodeListImpl::item(XMLSize_t index) const{ + if (fNode) { + DOMNode *node = fNode->fFirstChild; + for(XMLSize_t i=0; inextSibling; + return node; + } + return 0; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.hpp new file mode 100644 index 000000000..8117ee383 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeListImpl.hpp @@ -0,0 +1,73 @@ +/* + * 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: DOMNodeListImpl.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNODELISTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNODELISTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +// NodeList implementation class - +// This is for NodeLists returned by GetChildNodes only, not for +// node lists returned by GetElementsByTagName +// +// Every node type capable of having children has (as an embedded member) +// an instance of this class. To hold down the size overhead on each node, a +// cache of extended data for active node lists is maintained +// separately. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMParentNode; +class DOMNode; + +class CDOM_EXPORT DOMNodeListImpl: public DOMNodeList +{ +protected: + DOMParentNode *fNode; + +private: + // Unused, and unimplemented constructors, operators, etc. + DOMNodeListImpl(); + DOMNodeListImpl(const DOMNodeListImpl & other); + DOMNodeListImpl & operator = (const DOMNodeListImpl & other); + +public: + DOMNodeListImpl(DOMParentNode *node); + virtual ~DOMNodeListImpl(); + virtual DOMNode * item(XMLSize_t index) const; + virtual XMLSize_t getLength() const; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNodeVector.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeVector.cpp new file mode 100644 index 000000000..cba8e64be --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNodeVector.cpp @@ -0,0 +1,123 @@ +/* + * 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: DOMNodeVector.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +// +// file: DOMNodeVector.cpp +// Implementation of class DOMNodeVector. +// (Use of STL vector, or equivalent, would have been nice, +// but is not available. 'DOMNode *' is the only type +// kept in Vectors in this DOM implementation, so this is +// a hardwired implementation for that type. +// + +#include "DOMNodeVector.hpp" +#include "DOMDocumentImpl.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +DOMNodeVector::DOMNodeVector(DOMDocument *doc) +{ + init(doc, 10); +} + +DOMNodeVector::DOMNodeVector(DOMDocument *doc, XMLSize_t size) { + init(doc, size); +} + + +void DOMNodeVector::init(DOMDocument *doc, XMLSize_t size) { + assert(size > 0); + data = (DOMNode**) ((DOMDocumentImpl *)doc)->allocate(sizeof(DOMNode*) * size); + assert(data != 0); + for (XMLSize_t i=0; igetOwnerDocument(); + + //DOMNode **newData = new (doc) DOMNode *[newAllocatedSize]; + DOMNode **newData = (DOMNode**) ((DOMDocumentImpl *)doc)->allocate(sizeof(DOMNode*) * newAllocatedSize); + + assert(newData != 0); + for (XMLSize_t i=0; iindex; --i) { + data[i] = data[i-1]; + } + data[index] = elem; + ++nextFreeSlot; + +} + + +void DOMNodeVector::removeElementAt(XMLSize_t index) { + assert(index < nextFreeSlot); + for (XMLSize_t i=index; i for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMNode; +class DOMDocument; + + +class DOMNodeVector { +private: + DOMNode **data; + XMLSize_t allocatedSize; + XMLSize_t nextFreeSlot; + void init(DOMDocument *doc, XMLSize_t size); + void checkSpace(); + + // unimplemented + DOMNodeVector ( const DOMNodeVector& toCopy); + DOMNodeVector& operator= (const DOMNodeVector& other); + +public: + DOMNodeVector(DOMDocument *doc); + DOMNodeVector(DOMDocument *doc, XMLSize_t size); + ~DOMNodeVector(); + + XMLSize_t size(); + DOMNode* elementAt(XMLSize_t index); + DOMNode* lastElement(); + void addElement(DOMNode *); + void insertElementAt(DOMNode *, XMLSize_t index); + void setElementAt(DOMNode *val, XMLSize_t index); + void removeElementAt(XMLSize_t index); + void reset(); +}; + +inline DOMNode *DOMNodeVector::elementAt(XMLSize_t index) { + if (index >= nextFreeSlot) + return 0; + return data[index]; +} + +inline DOMNode *DOMNodeVector::lastElement() { + if (nextFreeSlot == 0) + return 0; + return data[nextFreeSlot-1]; +} + +inline XMLSize_t DOMNodeVector::size() { + return nextFreeSlot; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.cpp new file mode 100644 index 000000000..649c5a1c9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.cpp @@ -0,0 +1,500 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "DOMConfigurationImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMElementImpl.hpp" +#include "DOMErrorImpl.hpp" +#include "DOMEntityReferenceImpl.hpp" +#include "DOMNormalizer.hpp" +#include "DOMTextImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +static XMLMsgLoader* gMsgLoader = 0; + +void XMLInitializer::initializeDOMNormalizer() +{ + gMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLErrDomain); + + if (!gMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); +} + +void XMLInitializer::terminateDOMNormalizer() +{ + delete gMsgLoader; + gMsgLoader = 0; +} + +// +// +DOMNormalizer::DOMNormalizer(MemoryManager* const manager) + : fDocument(0) + , fConfiguration(0) + , fErrorHandler(0) + , fNSScope(0) + , fNewNamespaceCount(1) + , fMemoryManager(manager) +{ + fNSScope = new (fMemoryManager) InScopeNamespaces(fMemoryManager); +} + +DOMNormalizer::~DOMNormalizer() { + delete fNSScope; +} + +void DOMNormalizer::normalizeDocument(DOMDocumentImpl *doc) { + + fDocument = doc; + fConfiguration = (DOMConfigurationImpl*)doc->getDOMConfig(); + DOMConfigurationImpl *dci = (DOMConfigurationImpl*)fDocument->getDOMConfig(); + if(dci) + fErrorHandler = dci->getErrorHandler(); + else + fErrorHandler = 0; + + DOMNode *child = 0; + DOMNode *next = 0; + ((DOMNormalizer *)this)->fNewNamespaceCount = 1; + + for(child = doc->getFirstChild();child != 0; child = next) { + next = child->getNextSibling(); + child = normalizeNode(child); + if(child != 0) { + next = child; + } + } +} + +DOMNode * DOMNormalizer::normalizeNode(DOMNode *node) const { + switch(node->getNodeType()) { + case DOMNode::ELEMENT_NODE: { + fNSScope->addScope(fMemoryManager); + DOMNamedNodeMap *attrMap = node->getAttributes(); + + if(fConfiguration->featureValues & DOMConfigurationImpl::FEATURE_NAMESPACES) { + namespaceFixUp((DOMElementImpl*)node); + } + else { + //this is done in namespace fixup so no need to do it if namespace is on + if(attrMap) { + for(XMLSize_t i = 0; i < attrMap->getLength(); i++) { + attrMap->item(i)->normalize(); + } + } + } + + DOMNode *child = node->getFirstChild(); + DOMNode *next = 0; + for (; child != 0; child = next) { + next = child->getNextSibling(); + child = normalizeNode(child); + if(child != 0) { + next = child; + } + } + fNSScope->removeScope(); + break; + } + case DOMNode::COMMENT_NODE: { + if (!(fConfiguration->featureValues & DOMConfigurationImpl::FEATURE_COMMENTS)) { + DOMNode *prevSibling = node->getPreviousSibling(); + DOMNode *parent = node->getParentNode(); + // remove the comment node + parent->removeChild(node); + if (prevSibling != 0 && prevSibling->getNodeType() == DOMNode::TEXT_NODE) { + DOMNode *nextSibling = prevSibling->getNextSibling(); + if (nextSibling != 0 && nextSibling->getNodeType() == DOMNode::TEXT_NODE) { + ((DOMTextImpl*)nextSibling)->insertData(0, prevSibling->getNodeValue()); + parent->removeChild(prevSibling); + return nextSibling; + } + } + } + break; + } + case DOMNode::CDATA_SECTION_NODE: { + if (!(fConfiguration->featureValues & DOMConfigurationImpl::FEATURE_CDATA_SECTIONS)) { + // convert CDATA to TEXT nodes + DOMText *text = fDocument->createTextNode(node->getNodeValue()); + DOMNode *parent = node->getParentNode(); + DOMNode *prevSibling = node->getPreviousSibling(); + node = parent->replaceChild(text, node); + if (prevSibling != 0 && prevSibling->getNodeType() == DOMNode::TEXT_NODE) { + text->insertData(0, prevSibling->getNodeValue()); + parent->removeChild(prevSibling); + } + return text; // Don't advance; + } + break; + } + case DOMNode::TEXT_NODE: { + DOMNode *next = node->getNextSibling(); + + if(next != 0 && next->getNodeType() == DOMNode::TEXT_NODE) { + ((DOMText*)node)->appendData(next->getNodeValue()); + node->getParentNode()->removeChild(next); + return node; + } else { + const XMLCh* nv = node->getNodeValue(); + if (nv == 0 || *nv == 0) { + node->getParentNode()->removeChild(node); + } + } + } + default: + break; + } + + return 0; +} + + +void DOMNormalizer::namespaceFixUp(DOMElementImpl *ele) const { + DOMAttrMapImpl *attrMap = ele->fAttributes; + + XMLSize_t len = attrMap->getLength(); + //get the ns info from the attrs + for(XMLSize_t i = 0; i < len; i++) { + DOMAttr *at = (DOMAttr*)attrMap->item(i); + + //normalize the attr whatever happens + at->normalize(); + + const XMLCh *uri = at->getNamespaceURI(); + const XMLCh *value = at->getNodeValue(); + + if(XMLString::equals(XMLUni::fgXMLNSURIName, uri)) { + if(XMLString::equals(XMLUni::fgXMLNSURIName, value)) { + error(XMLErrs::NSDeclInvalid, ele); + } + else { + const XMLCh *prefix = at->getPrefix(); + + if(XMLString::equals(prefix, XMLUni::fgXMLNSString)) { + fNSScope->addOrChangeBinding(at->getLocalName(), value, fMemoryManager); + } + else { + fNSScope->addOrChangeBinding(XMLUni::fgZeroLenString, value, fMemoryManager); + } + } + } + } + + const XMLCh* prefix = ele->getPrefix(); + prefix ? prefix : prefix = XMLUni::fgZeroLenString; + const XMLCh* uri = ele->getNamespaceURI(); + uri ? uri : uri = XMLUni::fgZeroLenString; + + if(!XMLString::equals(uri, XMLUni::fgZeroLenString)) { + if(!fNSScope->isValidBinding(prefix, uri)) { + addOrChangeNamespaceDecl(prefix, uri, ele); + fNSScope->addOrChangeBinding(prefix, uri, fMemoryManager); + } + } + else { + if(ele->getLocalName() == 0) { + error(XMLErrs::DOMLevel1Node, ele); + } + else if(!fNSScope->isValidBinding(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString)) { + addOrChangeNamespaceDecl(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, ele); + fNSScope->addOrChangeBinding(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, fMemoryManager); + } + } + + //fix up non ns attrs + len = attrMap->getLength(); + + // hp aCC complains this i is a redefinition of the i on line 283 + for(XMLSize_t j = 0; j < len; j++) { + DOMAttr *at = (DOMAttr*)attrMap->item(j); + const XMLCh *uri = at->getNamespaceURI(); + const XMLCh* prefix = at->getPrefix(); + + if(!XMLString::equals(XMLUni::fgXMLNSURIName, uri)) { + if(uri != 0) { + if(prefix == 0 || !fNSScope->isValidBinding(prefix, uri)) { + + const XMLCh* newPrefix = fNSScope->getPrefix(uri); + + if(newPrefix != 0) { + at->setPrefix(newPrefix); + } + else { + if(prefix != 0 && !fNSScope->getUri(prefix)) { + fNSScope->addOrChangeBinding(prefix, uri, fMemoryManager); + addOrChangeNamespaceDecl(prefix, uri, ele); + } + else { + newPrefix = addCustomNamespaceDecl(uri, ele); + fNSScope->addOrChangeBinding(newPrefix, uri, fMemoryManager); + at->setPrefix(newPrefix); + } + } + } + } + else if(at->getLocalName() == 0) { + error(XMLErrs::DOMLevel1Node, at); + } + } + } +} + + + +const XMLCh * DOMNormalizer::integerToXMLCh(unsigned int i) const { + XMLCh *buf = (XMLCh*) fMemoryManager->allocate(15 * sizeof(XMLCh));//new XMLCh[15]; + XMLCh *pos = buf + sizeof(buf) - sizeof(XMLCh); + *pos = chNull; + + do { + switch(i % 10) { + case 0 : *--pos = chDigit_0;break; + case 1 : *--pos = chDigit_1;break; + case 2 : *--pos = chDigit_2;break; + case 3 : *--pos = chDigit_3;break; + case 4 : *--pos = chDigit_4;break; + case 5 : *--pos = chDigit_5;break; + case 6 : *--pos = chDigit_6;break; + case 7 : *--pos = chDigit_7;break; + case 8 : *--pos = chDigit_8;break; + case 9 : *--pos = chDigit_9;break; + default:; + } + i /= 10; + } while (i); + + const XMLCh *copy = fDocument->getPooledString(pos); + fMemoryManager->deallocate(buf);//delete[] buf; + return copy; +} + + + + + +void DOMNormalizer::addOrChangeNamespaceDecl(const XMLCh* prefix, const XMLCh* uri, DOMElementImpl* element) const { + + if (XMLString::equals(prefix, XMLUni::fgZeroLenString)) { + element->setAttributeNS(XMLUni::fgXMLNSURIName, XMLUni::fgXMLNSString, uri); + } else { + XMLBuffer buf(1023, fMemoryManager); + buf.set(XMLUni::fgXMLNSString); + buf.append(chColon); + buf.append(prefix); + element->setAttributeNS(XMLUni::fgXMLNSURIName, buf.getRawBuffer(), uri); + } +} + +const XMLCh* DOMNormalizer::addCustomNamespaceDecl(const XMLCh* uri, DOMElementImpl *element) const { + XMLBuffer preBuf(1023, fMemoryManager); + preBuf.append(chLatin_N); + preBuf.append(chLatin_S); + preBuf.append(integerToXMLCh(fNewNamespaceCount)); + ((DOMNormalizer *)this)->fNewNamespaceCount++; + + while(fNSScope->getUri(preBuf.getRawBuffer())) { + preBuf.reset(); + preBuf.append(chLatin_N); + preBuf.append(chLatin_S); + preBuf.append(integerToXMLCh(fNewNamespaceCount)); + ((DOMNormalizer *)this)->fNewNamespaceCount++; + } + + XMLBuffer buf(1023, fMemoryManager); + buf.set(XMLUni::fgXMLNSString); + buf.append(chColon); + buf.append(preBuf.getRawBuffer()); + element->setAttributeNS(XMLUni::fgXMLNSURIName, buf.getRawBuffer(), uri); + + return element->getAttributeNodeNS(XMLUni::fgXMLNSURIName, preBuf.getRawBuffer())->getLocalName(); +} + +XMLSize_t DOMNormalizer::InScopeNamespaces::size() { + return fScopes->size(); +} + +DOMNormalizer::InScopeNamespaces::InScopeNamespaces(MemoryManager* const manager) +: lastScopeWithBindings(0) +{ + fScopes = new (manager) RefVectorOf(10, true, manager); +} + +DOMNormalizer::InScopeNamespaces::~InScopeNamespaces() { + delete fScopes; +} + +void DOMNormalizer::InScopeNamespaces::addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri, + MemoryManager* const manager) { + XMLSize_t s = fScopes->size(); + + if(!s) + addScope(manager); + + Scope *curScope = fScopes->elementAt(s - 1); + curScope->addOrChangeBinding(prefix, uri, manager); + + lastScopeWithBindings = curScope; +} + +void DOMNormalizer::InScopeNamespaces::addScope(MemoryManager* const manager) { + Scope *s = new (manager) Scope(lastScopeWithBindings); + fScopes->addElement(s); +} + +void DOMNormalizer::InScopeNamespaces::removeScope() { + lastScopeWithBindings = fScopes->elementAt(fScopes->size() - 1)->fBaseScopeWithBindings; + Scope *s = fScopes->orphanElementAt(fScopes->size() - 1); + delete s; +} + +bool DOMNormalizer::InScopeNamespaces::isValidBinding(const XMLCh* prefix, const XMLCh* uri) const { + const XMLCh* actual = fScopes->elementAt(fScopes->size() - 1)->getUri(prefix); + if(actual == 0 || !XMLString::equals(actual, uri)) + return false; + return true; +} + +const XMLCh* DOMNormalizer::InScopeNamespaces::getPrefix(const XMLCh* uri) const { + return fScopes->elementAt(fScopes->size() - 1)->getPrefix(uri); +} + +const XMLCh* DOMNormalizer::InScopeNamespaces::getUri(const XMLCh* prefix) const { + return fScopes->elementAt(fScopes->size() - 1)->getUri(prefix); +} + + + +DOMNormalizer::InScopeNamespaces::Scope::Scope(Scope *baseScopeWithBindings) : fBaseScopeWithBindings(baseScopeWithBindings), fPrefixHash(0), fUriHash(0) +{ +} + +DOMNormalizer::InScopeNamespaces::Scope::~Scope() { + delete fPrefixHash; + delete fUriHash; +} + +void DOMNormalizer::InScopeNamespaces::Scope::addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri, + MemoryManager* const manager) { + //initialize and copy forward now we need to + if(!fUriHash) { + fPrefixHash = new (manager) RefHashTableOf(10, (bool) false, manager); + fUriHash = new (manager) RefHashTableOf(10, (bool) false, manager); + + if(fBaseScopeWithBindings) { + RefHashTableOfEnumerator preEnumer(fBaseScopeWithBindings->fPrefixHash, false, manager); + while(preEnumer.hasMoreElements()) { + const XMLCh* prefix = (XMLCh*) preEnumer.nextElementKey(); + const XMLCh* uri = fBaseScopeWithBindings->fPrefixHash->get((void*)prefix); + + //have to cast here because otherwise we have delete problems under windows :( + fPrefixHash->put((void *)prefix, (XMLCh*)uri); + } + + RefHashTableOfEnumerator uriEnumer(fBaseScopeWithBindings->fUriHash, false, manager); + while(uriEnumer.hasMoreElements()) { + const XMLCh* uri = (XMLCh*) uriEnumer.nextElementKey(); + const XMLCh* prefix = fBaseScopeWithBindings->fUriHash->get((void*)uri); + + //have to cast here because otherwise we have delete problems under windows :( + fUriHash->put((void *)uri, (XMLCh*)prefix); + } + } + } + + const XMLCh *oldUri = fPrefixHash->get(prefix); + if(oldUri) { + fUriHash->removeKey(oldUri); + } + + fPrefixHash->put((void *)prefix, (XMLCh*)uri); + fUriHash->put((void *)uri, (XMLCh*)prefix); +} + +const XMLCh* DOMNormalizer::InScopeNamespaces::Scope::getUri(const XMLCh *prefix) const { + const XMLCh* uri = 0; + + if(fPrefixHash) { + uri = fPrefixHash->get(prefix); + } + else if(fBaseScopeWithBindings) { + uri = fBaseScopeWithBindings->getUri(prefix); + } + + return uri ? uri : 0; +} + +const XMLCh* DOMNormalizer::InScopeNamespaces::Scope::getPrefix(const XMLCh* uri) const { + const XMLCh* prefix = 0; + + if(fUriHash) { + prefix = fUriHash->get(uri); + } + else if(fBaseScopeWithBindings) { + prefix = fBaseScopeWithBindings->getPrefix(uri); + } + return prefix ? prefix : 0; +} + +void DOMNormalizer::error(const XMLErrs::Codes code, const DOMNode *node) const +{ + if (fErrorHandler) { + + // Load the message into alocal and replace any tokens found in + // the text. + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + if (!gMsgLoader->loadMsg(code, errText, maxChars)) + { + // Should probably load a default message here + } + + DOMErrorImpl domError( + XMLErrs::DOMErrorType (code), 0, errText, (void*)node); + bool toContinueProcess = true; + try + { + toContinueProcess = fErrorHandler->handleError(domError); + } + catch(...) + { + } + if (!toContinueProcess) + throw (XMLErrs::Codes) code; + } +} + + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.hpp new file mode 100644 index 000000000..4823e091b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNormalizer.hpp @@ -0,0 +1,166 @@ +/* + * 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: DOMNormalizer.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNORMALIZER_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNORMALIZER_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMConfigurationImpl; +class DOMErrorHandler; +class DOMDocumentImpl; +class DOMNode; +class DOMElementImpl; +class DOMAttr; +class DOMNamedNodeMap; + +class DOMNormalizer : public XMemory { + + //the following are the data structures maintain the stack of namespace information + class InScopeNamespaces : public XMemory { + class Scope : public XMemory { + public: + Scope(Scope *baseScopeWithBindings); + ~Scope(); + void addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + const XMLCh* getUri(const XMLCh *prefix) const; + const XMLCh* getPrefix(const XMLCh* uri) const; + Scope *fBaseScopeWithBindings; + + private: + RefHashTableOf *fPrefixHash; + RefHashTableOf *fUriHash; + // unimplemented + Scope ( const Scope& toCopy); + Scope& operator= (const Scope& other); + }; + + public: + InScopeNamespaces(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~InScopeNamespaces(); + void addOrChangeBinding(const XMLCh *prefix, const XMLCh *uri, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + void addScope(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + void removeScope(); + bool isValidBinding(const XMLCh* prefix, const XMLCh* uri) const; + const XMLCh* getOrDeclarePrefix(const XMLCh* uri); + const XMLCh* getPrefix(const XMLCh* uri) const; + const XMLCh* getUri(const XMLCh* prefix) const; + XMLSize_t size(); + + private: + RefVectorOf *fScopes; + Scope *lastScopeWithBindings; + // unimplemented + InScopeNamespaces ( const InScopeNamespaces& toCopy); + InScopeNamespaces& operator= (const InScopeNamespaces& other); + }; + +public: + DOMNormalizer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMNormalizer(); + + /** + * Main entry method to normalize a document + */ + void normalizeDocument(DOMDocumentImpl *doc); + +private: + // unimplemented + DOMNormalizer ( const DOMNormalizer& toCopy); + DOMNormalizer& operator= (const DOMNormalizer& other); + +protected: + /** + * Recursively normalizes a node + */ + DOMNode * normalizeNode(DOMNode *node) const; + + /** + * Helper method that fixes up the namespace declarations according to the + * DOM Level 3 psydocode + */ + void namespaceFixUp(DOMElementImpl *ele) const; + + /** + * Converts an integer to an XMLCh - max 15 digits long. + */ + const XMLCh * integerToXMLCh(unsigned int i) const; + + /** + * Adds a namespace attribute or replaces the value of existing namespace + * attribute with the given prefix and value for URI. + * In case prefix is empty will add/update default namespace declaration. + */ + void addOrChangeNamespaceDecl(const XMLCh* prefix, const XMLCh* uri, DOMElementImpl *element) const; + + /** + * Adds a custom namespace in the form "NSx" where x is an integer that + * has not yet used in the document + */ + const XMLCh* addCustomNamespaceDecl(const XMLCh* uri, DOMElementImpl *element) const; + + + /** + * Report an error + */ + void error(const XMLErrs::Codes code, const DOMNode *node) const; + + // + // fDocument - the document we are operating on + // + // fDOMConfiguration - the configuration from the document + // + // fErrorHandler - the errorhandler to be used when reporting errors during normalization + // + // fNSScope - the data stucture that holds the prefix-uri information + // + // fNewNamespaceCount - the number of custom namespace declarations we have created + // + DOMDocumentImpl *fDocument; + DOMConfigurationImpl *fConfiguration; + DOMErrorHandler *fErrorHandler; + InScopeNamespaces *fNSScope; + unsigned int fNewNamespaceCount; + MemoryManager* fMemoryManager; +}; + + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.cpp new file mode 100644 index 000000000..b91658210 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.cpp @@ -0,0 +1,179 @@ +/* + * 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: DOMNotationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMDocumentImpl.hpp" +#include "DOMNotationImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMNotationImpl::DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *nName) + : fNode(ownerDoc), fName(0), fPublicId(0), fSystemId(0), fBaseURI(0) +{ + fNode.setIsLeafNode(true); + fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(nName); +} + +DOMNotationImpl::DOMNotationImpl(const DOMNotationImpl &other, bool /*deep*/) + : DOMNotation(other), + fNode(other.fNode), + fName(other.fName), + fPublicId(other.fPublicId), + fSystemId(other.fSystemId), + fBaseURI(other.fBaseURI) +{ + fNode.setIsLeafNode(true); +} + + +DOMNotationImpl::~DOMNotationImpl() +{ +} + + +DOMNode *DOMNotationImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::NOTATION_OBJECT) DOMNotationImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMNotationImpl::getNodeName() const { + return fName; +} + + +DOMNode::NodeType DOMNotationImpl::getNodeType() const { + return DOMNode::NOTATION_NODE; +} + + + +const XMLCh * DOMNotationImpl::getPublicId() const +{ + return fPublicId; +} + + +const XMLCh * DOMNotationImpl::getSystemId() const +{ + return fSystemId; +} + + +void DOMNotationImpl::setNodeValue(const XMLCh *arg) +{ + fNode.setNodeValue(arg); +} + + +void DOMNotationImpl::setPublicId(const XMLCh *arg) +{ + if(fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager); + + fPublicId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg); +} + + +void DOMNotationImpl::setSystemId(const XMLCh *arg) +{ + if(fNode.isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager); + + fSystemId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg); +} + +void DOMNotationImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + doc->release(this, DOMMemoryManager::NOTATION_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +void DOMNotationImpl::setBaseURI(const XMLCh* baseURI) { + if (baseURI && *baseURI) { + XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)getOwnerDocument())->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh)); + XMLString::fixURI(baseURI, temp); + fBaseURI = temp; + } + else + fBaseURI = 0; +} + +const XMLCh* DOMNotationImpl::getBaseURI() const +{ + return fBaseURI; +} + + + DOMNode* DOMNotationImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } + DOMNamedNodeMap* DOMNotationImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMNotationImpl::getChildNodes() const {return fNode.getChildNodes (); } + DOMNode* DOMNotationImpl::getFirstChild() const {return fNode.getFirstChild (); } + DOMNode* DOMNotationImpl::getLastChild() const {return fNode.getLastChild (); } + const XMLCh* DOMNotationImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMNotationImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMNotationImpl::getNextSibling() const {return fNode.getNextSibling (); } + const XMLCh* DOMNotationImpl::getNodeValue() const {return fNode.getNodeValue (); } + DOMDocument* DOMNotationImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); } + const XMLCh* DOMNotationImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMNotationImpl::getParentNode() const {return fNode.getParentNode (); } + DOMNode* DOMNotationImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); } + bool DOMNotationImpl::hasChildNodes() const {return fNode.hasChildNodes (); } + DOMNode* DOMNotationImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fNode.insertBefore (newChild, refChild); } + void DOMNotationImpl::normalize() {fNode.normalize (); } + DOMNode* DOMNotationImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } + DOMNode* DOMNotationImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fNode.replaceChild (newChild, oldChild); } + bool DOMNotationImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMNotationImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMNotationImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMNotationImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMNotationImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } + void* DOMNotationImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMNotationImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMNotationImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMNotationImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMNotationImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMNotationImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMNotationImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMNotationImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMNotationImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.hpp new file mode 100644 index 000000000..888c184c9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMNotationImpl.hpp @@ -0,0 +1,93 @@ +/* + * 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: DOMNotationImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMNOTATIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMNOTATIONIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +#include "DOMNodeImpl.hpp" + +class DOMDocument; + + +class CDOM_EXPORT DOMNotationImpl: public DOMNotation { +public: + DOMNodeImpl fNode; + + const XMLCh * fName; + const XMLCh * fPublicId; + const XMLCh * fSystemId; + const XMLCh * fBaseURI; + +public: + DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *); + DOMNotationImpl(const DOMNotationImpl &other, bool deep=false); + + virtual ~DOMNotationImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + // + // The Public Identifier for this Notation. If no public identifier + // was specified, this will be null. + virtual const XMLCh * getPublicId() const; + + // The System Identifier for this Notation. If no system identifier + // was specified, this will be null. + virtual const XMLCh * getSystemId() const; + + // NON-DOM: The Public Identifier for this Notation. If no public + // identifier was specified, this will be null. + virtual void setPublicId(const XMLCh *arg); + + + // NON-DOM: The System Identifier for this Notation. If no system + // identifier was specified, this will be null. + virtual void setSystemId(const XMLCh *arg); + + // NON-DOM: set base uri + virtual void setBaseURI(const XMLCh *arg); + +private: + // unimplemented + DOMNotationImpl& operator= (const DOMNotationImpl& other); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.cpp new file mode 100644 index 000000000..c1eae2452 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.cpp @@ -0,0 +1,464 @@ +/* + * 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: DOMParentNode.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#include +#include +#include + +#include "DOMDocumentImpl.hpp" +#include "DOMRangeImpl.hpp" +#include "DOMNodeIteratorImpl.hpp" +#include "DOMParentNode.hpp" +#include "DOMCasts.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMParentNode::DOMParentNode(DOMDocument *ownerDoc) + : fOwnerDocument(ownerDoc), fFirstChild(0), fChildNodeList(this) +{ +} + +// This only makes a shallow copy, cloneChildren must also be called for a +// deep clone +DOMParentNode::DOMParentNode(const DOMParentNode &other) : + fChildNodeList(this) +{ + this->fOwnerDocument = other.fOwnerDocument; + + // Need to break the association w/ original kids + this->fFirstChild = 0; +} + +void DOMParentNode::changed() +{ + ((DOMDocumentImpl*)fOwnerDocument)->changed(); +} + + +int DOMParentNode::changes() const +{ + return ((DOMDocumentImpl*)fOwnerDocument)->changes(); +} + + +DOMNode * DOMParentNode::appendChild(DOMNode *newChild) +{ + return insertBefore(newChild, 0); +} + + +void DOMParentNode::cloneChildren(const DOMNode *other) { + // for (DOMNode *mykid = other.getFirstChild(); + for (DOMNode *mykid = other->getFirstChild(); + mykid != 0; + mykid = mykid->getNextSibling()) + { + appendChild(mykid->cloneNode(true)); + } +} + +DOMDocument * DOMParentNode::getOwnerDocument() const { + return fOwnerDocument; +} + +// unlike getOwnerDocument this is not overriden by DocumentImpl to return 0 +DOMDocument * DOMParentNode::getDocument() const { + return fOwnerDocument; +} + +void DOMParentNode::setOwnerDocument(DOMDocument* doc) { + fOwnerDocument = doc; +} + +DOMNodeList *DOMParentNode::getChildNodes() const { + const DOMNodeList *ret = &fChildNodeList; + return (DOMNodeList *)ret; // cast off const. +} + + +DOMNode * DOMParentNode::getFirstChild() const { + return fFirstChild; +} + + +DOMNode * DOMParentNode::getLastChild() const +{ + return lastChild(); +} + +DOMNode * DOMParentNode::lastChild() const +{ + // last child is stored as the previous sibling of first child + if (fFirstChild == 0) { + return 0; + } + + DOMChildNode *firstChild = castToChildImpl(fFirstChild); + DOMNode *ret = firstChild->previousSibling; + return ret; +} + + +// +// revisit. Is this function used anywhere? I don't see it. +// +void DOMParentNode::lastChild(DOMNode *node) { + // store lastChild as previous sibling of first child + if (fFirstChild != 0) { + DOMChildNode *firstChild = castToChildImpl(fFirstChild); + firstChild->previousSibling = node; + } +} + + +bool DOMParentNode::hasChildNodes() const +{ + return fFirstChild!=0; +} + + + +DOMNode *DOMParentNode::insertBefore(DOMNode *newChild, DOMNode *refChild) { + //not really in the specs, but better than nothing + if(newChild==NULL) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager); + + DOMNodeImpl *thisNodeImpl = castToNodeImpl(this); + if (thisNodeImpl->isReadOnly()) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager); + + if (newChild->getOwnerDocument() != fOwnerDocument) + throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMParentNodeMemoryManager); + + // Prevent cycles in the tree + //only need to do this if the node has children + if(newChild->hasChildNodes()) { + bool treeSafe=true; + for(DOMNode *a=castToNode(this)->getParentNode(); + treeSafe && a!=0; + a=a->getParentNode()) + treeSafe=(newChild!=a); + if(!treeSafe) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager); + } + + // refChild must in fact be a child of this node (or 0) + if (refChild!=0 && refChild->getParentNode() != castToNode(this)) + throw DOMException(DOMException::NOT_FOUND_ERR,0, GetDOMParentNodeMemoryManager); + + // if the new node has to be placed before itself, we don't have to do anything + // (even worse, we would crash if we continue, as we assume they are two distinct nodes) + if (refChild!=0 && newChild->isSameNode(refChild)) + return newChild; + + if (newChild->getNodeType() == DOMNode::DOCUMENT_FRAGMENT_NODE) + { + // SLOW BUT SAFE: We could insert the whole subtree without + // juggling so many next/previous pointers. (Wipe out the + // parent's child-list, patch the parent pointers, set the + // ends of the list.) But we know some subclasses have special- + // case behavior they add to insertBefore(), so we don't risk it. + // This approch also takes fewer bytecodes. + + // NOTE: If one of the children is not a legal child of this + // node, throw HIERARCHY_REQUEST_ERR before _any_ of the children + // have been transferred. (Alternative behaviors would be to + // reparent up to the first failure point or reparent all those + // which are acceptable to the target node, neither of which is + // as robust. PR-DOM-0818 isn't entirely clear on which it + // recommends????? + + // No need to check kids for right-document; if they weren't, + // they wouldn't be kids of that DocFrag. + for(DOMNode *kid=newChild->getFirstChild(); // Prescan + kid!=0; + kid=kid->getNextSibling()) + { + if (!DOMDocumentImpl::isKidOK(castToNode(this), kid)) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager); + } + while(newChild->hasChildNodes()) // Move + castToNode(this)->insertBefore(newChild->getFirstChild(),refChild); + } + + else if (!DOMDocumentImpl::isKidOK(castToNode(this), newChild)) + throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager); + + else + { + DOMNode *oldparent=newChild->getParentNode(); + if(oldparent!=0) + oldparent->removeChild(newChild); + + // Attach up + castToNodeImpl(newChild)->fOwnerNode = castToNode(this); + castToNodeImpl(newChild)->isOwned(true); + + // Attach before and after + // Note: fFirstChild.previousSibling == lastChild!! + if (fFirstChild == 0) { + // this our first and only child + fFirstChild = newChild; + castToNodeImpl(newChild)->isFirstChild(true); + // castToChildImpl(newChild)->previousSibling = newChild; + DOMChildNode *newChild_ci = castToChildImpl(newChild); + newChild_ci->previousSibling = newChild; + } else { + if (refChild == 0) { + // this is an append + DOMNode *lastChild = castToChildImpl(fFirstChild)->previousSibling; + castToChildImpl(lastChild)->nextSibling = newChild; + castToChildImpl(newChild)->previousSibling = lastChild; + castToChildImpl(fFirstChild)->previousSibling = newChild; + } else { + // this is an insert + if (refChild == fFirstChild) { + // at the head of the list + castToNodeImpl(fFirstChild)->isFirstChild(false); + castToChildImpl(newChild)->nextSibling = fFirstChild; + castToChildImpl(newChild)->previousSibling = castToChildImpl(fFirstChild)->previousSibling; + castToChildImpl(fFirstChild)->previousSibling = newChild; + fFirstChild = newChild; + castToNodeImpl(newChild)->isFirstChild(true); + } else { + // somewhere in the middle + DOMNode *prev = castToChildImpl(refChild)->previousSibling; + castToChildImpl(newChild)->nextSibling = refChild; + castToChildImpl(prev)->nextSibling = newChild; + castToChildImpl(refChild)->previousSibling = newChild; + castToChildImpl(newChild)->previousSibling = prev; + } + } + } + } + + changed(); + + if (fOwnerDocument != 0) { + Ranges* ranges = ((DOMDocumentImpl*)fOwnerDocument)->getRanges(); + if ( ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateRangeForInsertedNode(newChild); + } + } + } + } + + return newChild; +} + + + +DOMNode *DOMParentNode::removeChild(DOMNode *oldChild) +{ + if (castToNodeImpl(this)->isReadOnly()) + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager); + + if (oldChild == 0 || oldChild->getParentNode() != castToNode(this)) + throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMParentNodeMemoryManager); + + if (fOwnerDocument != 0) { + //notify iterators + NodeIterators* nodeIterators = ((DOMDocumentImpl*)fOwnerDocument)->getNodeIterators(); + if (nodeIterators != 0) { + XMLSize_t sz = nodeIterators->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i) != 0) + nodeIterators->elementAt(i)->removeNode(oldChild); + } + } + } + + //fix other ranges for change before deleting the node + Ranges* ranges = ((DOMDocumentImpl*)fOwnerDocument)->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i) != 0) + ranges->elementAt(i)->updateRangeForDeletedNode(oldChild); + } + } + } + } + + + // Patch linked list around oldChild + // Note: lastChild == fFirstChild->previousSibling + if (oldChild == fFirstChild) { + // removing first child + castToNodeImpl(oldChild)->isFirstChild(false); + fFirstChild = castToChildImpl(oldChild)->nextSibling; + if (fFirstChild != 0) { + castToNodeImpl(fFirstChild)->isFirstChild(true); + castToChildImpl(fFirstChild)->previousSibling = castToChildImpl(oldChild)->previousSibling; + } + } else { + DOMNode *prev = castToChildImpl(oldChild)->previousSibling; + DOMNode *next = castToChildImpl(oldChild)->nextSibling; + castToChildImpl(prev)->nextSibling = next; + if (next == 0) { + // removing last child + castToChildImpl(fFirstChild)->previousSibling = prev; + } else { + // removing some other child in the middle + castToChildImpl(next)->previousSibling = prev; + } + } + + // Remove oldChild's references to tree + castToNodeImpl(oldChild)->fOwnerNode = fOwnerDocument; + castToNodeImpl(oldChild)->isOwned(false); + castToChildImpl(oldChild)->nextSibling = 0; + castToChildImpl(oldChild)->previousSibling = 0; + + changed(); + + return oldChild; +} + + +DOMNode *DOMParentNode::replaceChild(DOMNode *newChild, DOMNode *oldChild) +{ + insertBefore(newChild, oldChild); + // changed() already done. + return removeChild(oldChild); +} + + +DOMNode * DOMParentNode::appendChildFast(DOMNode *newChild) +{ + // This function makes the following assumptions: + // + // - newChild != 0 + // - newChild is not read-only + // - newChild is not a document fragment + // - owner documents of this node and newChild are the same + // - appending newChild to this node cannot result in a cycle + // - DOMDocumentImpl::isKidOK (this, newChild) return true (that is, + // appending newChild to this node results in a valid structure) + // - newChild->getParentNode() is 0 + // - there are no ranges set for this document + // + + // Attach up + castToNodeImpl(newChild)->fOwnerNode = castToNode(this); + castToNodeImpl(newChild)->isOwned(true); + + // Attach before and after + // Note: fFirstChild.previousSibling == lastChild!! + if (fFirstChild != 0) + { + DOMNode *lastChild = castToChildImpl(fFirstChild)->previousSibling; + castToChildImpl(lastChild)->nextSibling = newChild; + castToChildImpl(newChild)->previousSibling = lastChild; + castToChildImpl(fFirstChild)->previousSibling = newChild; + } + else + { + // this our first and only child + fFirstChild = newChild; + castToNodeImpl(newChild)->isFirstChild(true); + // castToChildImpl(newChild)->previousSibling = newChild; + DOMChildNode *newChild_ci = castToChildImpl(newChild); + newChild_ci->previousSibling = newChild; + } + + return newChild; +} + + +//Introduced in DOM Level 2 + +void DOMParentNode::normalize() +{ + DOMNode *kid, *next; + for (kid = fFirstChild; kid != 0; kid = next) + { + next = castToChildImpl(kid)->nextSibling; + + // If kid and next are both Text nodes (but _not_ CDATASection, + // which is a subclass of Text), they can be merged. + if (next != 0 && + kid->getNodeType() == DOMNode::TEXT_NODE && + next->getNodeType() == DOMNode::TEXT_NODE ) + { + ((DOMTextImpl *) kid)->appendData(((DOMTextImpl *) next)->getData()); + // revisit: + // should I release the removed node? + // not released in case user still referencing it externally + removeChild(next); + next = kid; // Don't advance; there might be another. + } + + // Otherwise it might be an Element, which is handled recursively + else + if (kid->getNodeType() == DOMNode::ELEMENT_NODE) + kid->normalize(); + } + + // changed() will have occurred when the removeChild() was done, + // so does not have to be reissued. +} + +//Introduced in DOM Level 3 + +bool DOMParentNode::isEqualNode(const DOMNode* arg) const +{ + if (arg && castToNodeImpl(this)->isSameNode(arg)) + return true; + + if (arg && castToNodeImpl(this)->isEqualNode(arg)) + { + DOMNode *kid, *argKid; + for (kid = fFirstChild, argKid = arg->getFirstChild(); + kid != 0 && argKid != 0; + kid = kid->getNextSibling(), argKid = argKid->getNextSibling()) + { + if (!kid->isEqualNode(argKid)) + return false; + } + return (kid || argKid) ? false : true; + } + return false; +} + + +//Non-standard extension +void DOMParentNode::release() +{ + DOMNode *kid, *next; + for (kid = fFirstChild; kid != 0; kid = next) + { + next = castToChildImpl(kid)->nextSibling; + + // set is Owned false before releasing its child + castToNodeImpl(kid)->isToBeReleased(true); + kid->release(); + } +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.hpp new file mode 100644 index 000000000..cd571a557 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMParentNode.hpp @@ -0,0 +1,114 @@ +/* + * 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: DOMParentNode.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMPARENTNODE_HPP) +#define XERCESC_INCLUDE_GUARD_DOMPARENTNODE_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +/** + * ParentNode provides the capability of having child + * nodes. Not every node in the DOM can have children, so only nodes that can + * should include this class and pay the price for it. + *

+ * While we have a direct reference to the first child, the last child is + * stored as the previous sibling of the first child. First child nodes are + * marked as being so, and getNextSibling hides this fact. + * + **/ + +#include +#include "DOMNodeListImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class DOMChildNode; +class DOMDocument; +class DOMNode; +class DOMNodeList; + +class CDOM_EXPORT DOMParentNode { +public: + DOMDocument *fOwnerDocument; // Document this node belongs to + DOMNode *fFirstChild; + DOMNodeListImpl fChildNodeList; // for GetChildNodes() + +public: + DOMParentNode(DOMDocument *ownerDocument); + DOMParentNode(const DOMParentNode &other); + + DOMDocument * getOwnerDocument() const; + void setOwnerDocument(DOMDocument* doc); + + // Track changes to the node tree structure under this node. An optimization + // for NodeLists. + int changes() const; + void changed(); + + DOMNode* appendChild(DOMNode *newChild); + DOMNodeList* getChildNodes() const; + DOMNode* getFirstChild() const; + DOMNode* getLastChild() const; + bool hasChildNodes() const; + DOMNode* insertBefore(DOMNode *newChild, DOMNode *refChild); + DOMNode* item(unsigned int index) const; + DOMNode* removeChild(DOMNode *oldChild); + DOMNode* replaceChild(DOMNode *newChild, DOMNode *oldChild); + + // Append certain types of nodes fast. Used to speed up XML to DOM + // parsing. See the function implementation for detail. + virtual DOMNode* appendChildFast(DOMNode *newChild); + + //Introduced in DOM Level 2 + void normalize(); + + //Introduced in DOM Level 3 + bool isEqualNode(const DOMNode* arg) const; + + // NON-DOM + // unlike getOwnerDocument this never returns null, even for Document nodes + DOMDocument * getDocument() const; + void release(); + + +public: + void cloneChildren(const DOMNode *other); + DOMNode * lastChild() const; + void lastChild(DOMNode *); + +private: + // unimplemented + DOMParentNode& operator= (const DOMParentNode& other); +}; + +#define GetDOMParentNodeMemoryManager GET_DIRECT_MM(fOwnerDocument) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp new file mode 100644 index 000000000..7f37f083d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp @@ -0,0 +1,215 @@ +/* + * 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: DOMProcessingInstructionImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ + +#include "DOMProcessingInstructionImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMStringPool.hpp" +#include "DOMRangeImpl.hpp" + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMProcessingInstructionImpl::DOMProcessingInstructionImpl(DOMDocument *ownerDoc, + const XMLCh *targt, + const XMLCh *dat) + : fNode(ownerDoc), fCharacterData(ownerDoc, dat), fBaseURI(0) +{ + fNode.setIsLeafNode(true); + this->fTarget = ((DOMDocumentImpl *)ownerDoc)->cloneString(targt); +} + + +DOMProcessingInstructionImpl::DOMProcessingInstructionImpl( + const DOMProcessingInstructionImpl &other, + bool /*deep*/) + : DOMProcessingInstruction(other), + fNode(other.fNode), + fChild(other.fChild), + fCharacterData(other.fCharacterData), + fTarget(other.fTarget), + fBaseURI(other.fBaseURI) +{ + fNode.setIsLeafNode(true); +} + + +DOMProcessingInstructionImpl::~DOMProcessingInstructionImpl() +{ +} + + +DOMNode *DOMProcessingInstructionImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::PROCESSING_INSTRUCTION_OBJECT) DOMProcessingInstructionImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMProcessingInstructionImpl::getNodeName() const +{ + return fTarget; +} + + +DOMNode::NodeType DOMProcessingInstructionImpl::getNodeType() const { + return DOMNode::PROCESSING_INSTRUCTION_NODE; +} + + +/** A PI's "target" states what processor channel the PI's data +should be directed to. It is defined differently in HTML and XML. + + In XML, a PI's "target" is the first (whitespace-delimited) token + following the "release(this, DOMMemoryManager::PROCESSING_INSTRUCTION_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +void DOMProcessingInstructionImpl::setBaseURI(const XMLCh* baseURI) { + this->fBaseURI = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(baseURI); +} + +const XMLCh* DOMProcessingInstructionImpl::getBaseURI() const +{ + return fBaseURI? fBaseURI : fNode.fOwnerNode->getBaseURI(); +} + +// Non standard extension for the range to work +DOMProcessingInstruction *DOMProcessingInstructionImpl::splitText(XMLSize_t offset) +{ + if (fNode.isReadOnly()) + { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + XMLSize_t len = fCharacterData.fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); + DOMProcessingInstruction *newText = + doc->createProcessingInstruction( + fTarget, this->substringData(offset, len - offset)); + + DOMNode *parent = getParentNode(); + if (parent != 0) + parent->insertBefore(newText, getNextSibling()); + + fCharacterData.fDataBuf->chop(offset); + + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset); + } + } + } + } + + return newText; +} + +// +// Delegation stubs for inherited functions +// + DOMNode* DOMProcessingInstructionImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } + DOMNamedNodeMap* DOMProcessingInstructionImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMProcessingInstructionImpl::getChildNodes() const {return fNode.getChildNodes (); } + DOMNode* DOMProcessingInstructionImpl::getFirstChild() const {return fNode.getFirstChild (); } + DOMNode* DOMProcessingInstructionImpl::getLastChild() const {return fNode.getLastChild (); } + const XMLCh* DOMProcessingInstructionImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMProcessingInstructionImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMProcessingInstructionImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMProcessingInstructionImpl::getNodeValue() const {return fCharacterData.getNodeValue (); } + DOMDocument* DOMProcessingInstructionImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); } + const XMLCh* DOMProcessingInstructionImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMProcessingInstructionImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMProcessingInstructionImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMProcessingInstructionImpl::hasChildNodes() const {return fNode.hasChildNodes (); } + DOMNode* DOMProcessingInstructionImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fNode.insertBefore (newChild, refChild); } + void DOMProcessingInstructionImpl::normalize() {fNode.normalize (); } + DOMNode* DOMProcessingInstructionImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } + DOMNode* DOMProcessingInstructionImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fNode.replaceChild (newChild, oldChild); } + bool DOMProcessingInstructionImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMProcessingInstructionImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMProcessingInstructionImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMProcessingInstructionImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMProcessingInstructionImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } + void* DOMProcessingInstructionImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMProcessingInstructionImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + short DOMProcessingInstructionImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMProcessingInstructionImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMProcessingInstructionImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMProcessingInstructionImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMProcessingInstructionImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMProcessingInstructionImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMProcessingInstructionImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + +// +// Delegation of CharacerData functions. +// + + + const XMLCh* DOMProcessingInstructionImpl::getData() const {return fCharacterData.getData();} + void DOMProcessingInstructionImpl::deleteData(XMLSize_t offset, XMLSize_t count) + {fCharacterData.deleteData(this, offset, count);} + const XMLCh* DOMProcessingInstructionImpl::substringData(XMLSize_t offset, XMLSize_t count) const + {return fCharacterData.substringData(this, offset, count);} + void DOMProcessingInstructionImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);} + void DOMProcessingInstructionImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); } + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.hpp new file mode 100644 index 000000000..4d90d1524 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMProcessingInstructionImpl.hpp @@ -0,0 +1,92 @@ +/* + * 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: DOMProcessingInstructionImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTIONIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include +#include +#include "DOMCharacterDataImpl.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMChildNode.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class DocumentImpl; + + +class CDOM_EXPORT DOMProcessingInstructionImpl: public DOMProcessingInstruction { +protected: + DOMNodeImpl fNode; + DOMChildNode fChild; + // use fCharacterData to store its data so that those character utitlites can be used + DOMCharacterDataImpl fCharacterData; + + XMLCh *fTarget; + const XMLCh *fBaseURI; + +public: + DOMProcessingInstructionImpl(DOMDocument *ownerDoc, + const XMLCh * target, + const XMLCh *data); + DOMProcessingInstructionImpl(const DOMProcessingInstructionImpl &other, + bool deep=false); + virtual ~DOMProcessingInstructionImpl(); + +public: + // Declare all of the functions from DOMNode. + DOMNODE_FUNCTIONS; + +public: + virtual const XMLCh *getData() const; + virtual const XMLCh *getTarget() const; + virtual void setData(const XMLCh *arg); + + // NON-DOM: set base uri + virtual void setBaseURI(const XMLCh* baseURI); + + // Non standard extension for the range to work + void deleteData(XMLSize_t offset, XMLSize_t count); + const XMLCh* substringData(XMLSize_t offset, XMLSize_t count) const; + DOMProcessingInstruction* splitText(XMLSize_t offset); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMProcessingInstructionImpl & operator = (const DOMProcessingInstructionImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.cpp new file mode 100644 index 000000000..2fece60a5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.cpp @@ -0,0 +1,2115 @@ +/* + * 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: DOMRangeImpl.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#include "DOMRangeImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include "DOMDocumentFragmentImpl.hpp" +#include "DOMCommentImpl.hpp" +#include "DOMProcessingInstructionImpl.hpp" +#include "DOMCasts.hpp" + +#include +#include +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +//--------------------- +// C'tor and D'tor +//--------------------- + +DOMRangeImpl::DOMRangeImpl(DOMDocument* doc, MemoryManager* const manager) + + : fStartContainer(doc), + fStartOffset(0), + fEndContainer(doc), + fEndOffset(0), + fCollapsed(true), + fDocument(doc), + fDetached(false), + fRemoveChild(0), + fMemoryManager(manager) +{ +} + +DOMRangeImpl::DOMRangeImpl(const DOMRangeImpl& other) +: DOMRange(other), + fStartContainer(other.fStartContainer), + fStartOffset(other.fStartOffset), + fEndContainer(other.fEndContainer), + fEndOffset(other.fEndOffset), + fCollapsed(other.fCollapsed), + fDocument(other.fDocument), + fDetached(other.fDetached), + fRemoveChild(other.fRemoveChild), + fMemoryManager(other.fMemoryManager) +{ +} + +DOMRangeImpl::~DOMRangeImpl() +{ +} + + +//------------------------------- +// Public getter functions +//------------------------------- + + +DOMNode* DOMRangeImpl::getStartContainer() const +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + return fStartContainer; +} + +XMLSize_t DOMRangeImpl::getStartOffset() const +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + return fStartOffset; +} + +DOMNode* DOMRangeImpl::getEndContainer() const +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + return fEndContainer; +} + +XMLSize_t DOMRangeImpl::getEndOffset() const +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + return fEndOffset; +} + + + +bool DOMRangeImpl::getCollapsed() const +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + return ((fStartContainer == fEndContainer) + && (fStartOffset == fEndOffset)); +} + +//------------------------------- +// Public setter functions +//------------------------------- + +void DOMRangeImpl::setStartContainer(const DOMNode* node) +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + fStartContainer = (DOMNode*) node; +} + +void DOMRangeImpl::setStartOffset(XMLSize_t offset) +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + fStartOffset = offset; +} + +void DOMRangeImpl::setEndContainer(const DOMNode* node) +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + fEndContainer = (DOMNode*) node; + +} + +void DOMRangeImpl::setEndOffset(XMLSize_t offset) +{ + if (fDetached) + { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + fEndOffset = offset; +} + +void DOMRangeImpl::setStart(const DOMNode* refNode, XMLSize_t offset) +{ + validateNode(refNode); + checkIndex(refNode, offset); + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(true); //collapse the range positions to start + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fStartContainer = (DOMNode*) refNode; + fStartOffset = offset; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fEndContainer)) + collapse(true); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(true); //collapse the range positions to start + else + fCollapsed = false; +} + +void DOMRangeImpl::setEnd(const DOMNode* refNode, XMLSize_t offset) +{ + validateNode(refNode); + checkIndex(refNode, offset); + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(false); //collapse the range positions to end + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fEndContainer = (DOMNode*) refNode; + fEndOffset = offset; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fStartContainer)) + collapse(false); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(false); //collapse the range positions to end + else + fCollapsed = false; +} + +void DOMRangeImpl::setStartBefore(const DOMNode* refNode) +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(true); //collapse the range positions to start + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fStartContainer = refNode->getParentNode(); + XMLSize_t i = 0; + for (DOMNode* n = (DOMNode*) refNode; n!=0; n = n->getPreviousSibling()) { + i++; + } + if (i == 0) + fStartOffset = 0; + else + fStartOffset = i-1; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fEndContainer)) + collapse(true); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(true); //collapse the range positions to start + else + fCollapsed = false; +} + +void DOMRangeImpl::setStartAfter(const DOMNode* refNode) +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(true); //collapse the range positions to start + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fStartContainer = refNode->getParentNode(); + XMLSize_t i = 0; + for (DOMNode* n = (DOMNode*) refNode; n!=0; n = n->getPreviousSibling()) { + i++; + } + + fStartOffset = i; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fEndContainer)) + collapse(true); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(true); //collapse the range positions to start + else + fCollapsed = false; +} + +void DOMRangeImpl::setEndBefore(const DOMNode* refNode) +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(false); //collapse the range positions to end + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fEndContainer = refNode->getParentNode(); + XMLSize_t i = 0; + for (DOMNode* n = (DOMNode*) refNode; n!=0; n = n->getPreviousSibling(), i++) ; + + if (i< 1) + fEndOffset = 0; + else + fEndOffset = i-1; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fStartContainer)) + collapse(false); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(false); //collapse the range positions to end + else + fCollapsed = false; +} + +void DOMRangeImpl::setEndAfter(const DOMNode* refNode) +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + // error if not the same owner document + if (fDocument != refNode->getOwnerDocument()) { + if ( refNode != fDocument ) { + collapse(false); //collapse the range positions to end + fCollapsed = true; + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + } + + fEndContainer = refNode->getParentNode(); + XMLSize_t i = 0; + for (DOMNode* n = (DOMNode*) refNode; n!=0; n = n->getPreviousSibling(), i++) ; + + if (i ==0) + fEndOffset = 0; + else + fEndOffset = i; + + // they may be of same document, but not same root container + // collapse if not the same root container + if (!commonAncestorOf(refNode, fStartContainer)) + collapse(false); + + //compare the start and end boundary point + //collapse if start point is after the end point + if(compareBoundaryPoints(DOMRange::END_TO_START, this) == 1) + collapse(false); //collapse the range positions to end + else + fCollapsed = false; +} +//------------------------------- +// Public Misc. functions +//------------------------------- +void DOMRangeImpl::detach() +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + ((DOMDocumentImpl *)fDocument)->removeRange(this); + + fDetached = true; + + //0ify nodes + fStartContainer = 0; + fStartOffset = 0; + fEndContainer = 0; + fEndOffset = 0; + fCollapsed = true; + + fRemoveChild = 0; +} + +void DOMRangeImpl::collapse(bool toStart) +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + if (toStart) { + fEndContainer = fStartContainer; + fEndOffset = fStartOffset; + } else { + fStartContainer = fEndContainer; + fStartOffset = fEndOffset; + } + fCollapsed = true; +} + +void DOMRangeImpl::selectNode(const DOMNode* refNode) +{ + validateNode(refNode); + if ( !isLegalContainedNode(refNode)) { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + //First check for the text type node + short type = refNode->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + //The node itself is the container. + fStartContainer = (DOMNode*) refNode; + fEndContainer = (DOMNode*) refNode; + + //Select all the contents of the node + fStartOffset = 0; + if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) + fEndOffset = XMLString::stringLen(((DOMProcessingInstruction*)refNode)->getData()); + else + fEndOffset = ((DOMText *)refNode)->getLength(); + return; + } + + DOMNode* parent = refNode->getParentNode(); + if (parent != 0 ) // REVIST: what to do if it IS 0? + { + fStartContainer = parent; + fEndContainer = parent; + + XMLSize_t i = 0; + for (DOMNode* n = parent->getFirstChild(); n!=0 && n!=refNode; n = n->getNextSibling()) { + i++; + } + + fStartOffset = i; + fEndOffset = fStartOffset+1; + } +} + +void DOMRangeImpl::selectNodeContents(const DOMNode* node) +{ + validateNode(node); + + fStartContainer = (DOMNode*) node; + fEndContainer = (DOMNode*) node; + + fStartOffset = 0; + short type = node->getNodeType(); + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE)) { + + fEndOffset = ((DOMText *)node)->getLength(); + return; + } + if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) { + fEndOffset = XMLString::stringLen(((DOMProcessingInstruction*)node)->getData()); + return; + } + + DOMNode* first = node->getFirstChild(); + if (first == 0) { + fEndOffset = 0; + return; + } + XMLSize_t i = 0; + for (DOMNode* n = first; n!=0; n = n->getNextSibling()) { + i++; + } + fEndOffset = i; +} + +void DOMRangeImpl::surroundContents(DOMNode* newParent) +{ + if (newParent==0) return; + + //check for elimination criteria + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + if (newParent->getOwnerDocument() !=fDocument) { + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + + int type = newParent->getNodeType(); + if ( !isLegalContainedNode(newParent) + || type == DOMNode::DOCUMENT_TYPE_NODE) + { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + DOMNode* realStart = fStartContainer; + DOMNode* realEnd = fEndContainer; + + type = fStartContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + realStart = fStartContainer->getParentNode(); + } + type = fEndContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + realEnd = fEndContainer->getParentNode(); + } + + if (realStart != realEnd) { + throw DOMRangeException( + DOMRangeException::BAD_BOUNDARYPOINTS_ERR, 0, fMemoryManager); + } + + DOMDocumentFragment* frag = (DOMDocumentFragment*) extractContents(); + insertNode(newParent); + newParent->appendChild(frag); + selectNode(newParent); +} + + +short DOMRangeImpl::compareBoundaryPoints(DOMRange::CompareHow how, const DOMRange* srcRange) const +{ + if (fDocument != ((DOMRangeImpl*)srcRange)->fDocument) { + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + DOMNode* pointA; + DOMNode* pointB; + XMLSize_t offsetA, offsetB; + + switch (how) + { + case (DOMRange::START_TO_START) : + pointB = srcRange->getStartContainer(); + pointA = fStartContainer; + offsetB = srcRange->getStartOffset(); + offsetA = fStartOffset; + break; + case (DOMRange::START_TO_END) : + pointB = srcRange->getStartContainer(); + pointA = fEndContainer; + offsetB = srcRange->getStartOffset(); + offsetA = fEndOffset; + break; + case (DOMRange::END_TO_START) : + pointB = srcRange->getEndContainer(); + pointA = fStartContainer; + offsetB = srcRange->getEndOffset(); + offsetA = fStartOffset; + break; + case (DOMRange::END_TO_END) : + pointB = srcRange->getEndContainer(); + pointA = fEndContainer; + offsetB = srcRange->getEndOffset(); + offsetA = fEndOffset; + break; + default: + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + // case 1: same container + if (pointA == pointB) { + if (offsetA < offsetB) return -1; //A before B + if (offsetA == offsetB) return 0; //A equal to B + return 1; // A after B + } + // case 2: Child C of container A is ancestor of B + for (DOMNode* node = pointA->getFirstChild(); node != 0; node=node->getNextSibling()) { + if (isAncestorOf(node, pointB)) { + XMLSize_t index = indexOf(node, pointA); + if (offsetA <= index) return -1; + return 1; + } + } + // case 3: Child C of container B is ancestor of A + for (DOMNode* nd = pointB->getFirstChild(); nd != 0; nd=nd->getNextSibling()) { + if (isAncestorOf(nd, pointA)) { + XMLSize_t index = indexOf(nd, pointB); + if (index < offsetB ) return -1; + return 1; //B strictly before A + } + } + + // case 4: preorder traversal of context tree. + // Instead of literally walking the context tree in pre-order, + // we use relative node depth walking which is usually faster + + int depthDiff = 0; + DOMNode* n = 0; + for ( n = pointB; n != 0; n = n->getParentNode() ) + depthDiff++; + for ( n = pointA; n != 0; n = n->getParentNode() ) + depthDiff--; + while (depthDiff > 0) { + pointB = pointB->getParentNode(); + depthDiff--; + } + while (depthDiff < 0) { + pointA = pointA->getParentNode(); + depthDiff++; + } + for (DOMNode* pB = pointB->getParentNode(), + *pA = pointA->getParentNode(); + pB != pA; + pB = pB->getParentNode(), pA = pA->getParentNode() ) + { + pointB = pB; + pointA = pA; + } + for ( n = pointB->getNextSibling(); + n != 0; + n = n->getNextSibling() ) + { + if (n == pointA) { + return 1; + } + } + return -1; +} + + +void DOMRangeImpl:: deleteContents() +{ + traverseContents(DELETE_CONTENTS); +} + +DOMDocumentFragment* DOMRangeImpl::extractContents() +{ + checkReadOnly(fStartContainer, fEndContainer, fStartOffset, fEndOffset); + return traverseContents(EXTRACT_CONTENTS); +} + +DOMDocumentFragment* DOMRangeImpl::cloneContents() const +{ + // cast off const. + return ((DOMRangeImpl *)this)->traverseContents(CLONE_CONTENTS); +} + + +void DOMRangeImpl::insertNode(DOMNode* newNode) +{ + if (newNode == 0) return; //don't have to do anything + + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + int type = newNode->getNodeType(); + if (type == DOMNode::ATTRIBUTE_NODE + || type == DOMNode::ENTITY_NODE + || type == DOMNode::NOTATION_NODE + || type == DOMNode::DOCUMENT_NODE) + { + throw DOMRangeException( + DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } + + // Prevent cycles in the tree. + //isKidOK() is not checked here as its taken care by insertBefore() function + if (isAncestorOf( newNode, fStartContainer)) { + throw DOMException( + DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager); + } + + for (DOMNode* aNode = fStartContainer; aNode!=0; aNode = aNode->getParentNode()) { + if (castToNodeImpl(newNode)->isReadOnly()) { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager); + } + } + + if (fDocument != newNode->getOwnerDocument()) { + throw DOMException( + DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager); + } + + + DOMNode* parent; + DOMNode* next; + + type = fStartContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + + //set 'parent' and 'next' here + parent = fStartContainer->getParentNode(); + + //split the text nodes + if (fStartOffset > 0) { + if (type == DOMNode::COMMENT_NODE) + ((DOMCommentImpl*)fStartContainer)->splitText(fStartOffset); + else if (type == DOMNode::PROCESSING_INSTRUCTION_NODE) + ((DOMProcessingInstructionImpl*)fStartContainer)->splitText(fStartOffset); + else + ((DOMText*)fStartContainer)->splitText(fStartOffset); + } + + //update the new start information later. After inserting the first newNode + if (fStartOffset == 0) + next = fStartContainer; + else + next = fStartContainer->getNextSibling(); + + } // end of text handling + else { + parent = fStartContainer; + + next = fStartContainer->getFirstChild(); + for(XMLSize_t i = 0; (i < fStartOffset) && (next != 0); i++) { + next=next->getNextSibling(); + } + } + + if (parent != 0) { + if (next != 0) + parent->insertBefore(newNode, next); + else + parent->appendChild(newNode); + } +} + +DOMRange* DOMRangeImpl::cloneRange() const +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + DOMRange* range = fDocument->createRange(); + range->setStart(fStartContainer, fStartOffset); + range->setEnd(fEndContainer, fEndOffset); + + return range; +} + +const XMLCh* DOMRangeImpl::toString() const +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + if ((fStartContainer == fEndContainer) && (fEndOffset == fStartOffset)) + return XMLUni::fgZeroLenString; + + DOMNode* node = fStartContainer; + DOMNode* stopNode = fEndContainer; + + XMLBuffer retStringBuf(1023, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + short type = fStartContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + if (fStartContainer == fEndContainer) { + XMLCh* tempString; + XMLCh temp[4000]; + if ((fEndOffset-fStartOffset) >= 3999) + tempString = (XMLCh*) fMemoryManager->allocate + ( + (fEndOffset - fStartOffset + 1) * sizeof(XMLCh) + );//new XMLCh[fEndOffset-fStartOffset+1]; + else + tempString = temp; + + XMLString::subString(tempString, fStartContainer->getNodeValue(), fStartOffset, fEndOffset, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + const XMLCh* retString = ((DOMDocumentImpl *)fDocument)->getPooledString(tempString); + + if ((fEndOffset-fStartOffset) >= 3999) + fMemoryManager->deallocate(tempString);//delete[] tempString; + + return retString; + } else { + XMLSize_t length = XMLString::stringLen(fStartContainer->getNodeValue()); + if (length != fStartOffset) { + + XMLCh* tempString; + XMLCh temp[4000]; + if ((length - fStartOffset) >= 3999) + tempString = (XMLCh*) fMemoryManager->allocate + ( + (length - fStartOffset + 1) * sizeof(XMLCh) + );//new XMLCh[length - fStartOffset+1]; + else + tempString = temp; + + XMLString::subString(tempString, fStartContainer->getNodeValue(), fStartOffset, length, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + retStringBuf.append(tempString); + + if ((length - fStartOffset) >= 3999) + fMemoryManager->deallocate(tempString);//delete[] tempString; + } + + node = nextNode(node, true); + } + }else { //fStartContainer is not a TextNode + node=node->getFirstChild(); + if (fStartOffset>0) { //find a first node within a range, specified by fStartOffset + XMLSize_t counter = 0; + while (countergetNextSibling(); + counter++; + } + } + if (node == 0) { + node = nextNode(fStartContainer,false); + } + } + + type = fEndContainer->getNodeType(); + if((type != DOMNode::TEXT_NODE + && type != DOMNode::CDATA_SECTION_NODE + && type != DOMNode::COMMENT_NODE + && type != DOMNode::PROCESSING_INSTRUCTION_NODE)) { + int i=(int)fEndOffset; + stopNode = fEndContainer->getFirstChild(); + while( i>0 && stopNode!=0 ){ + --i; + stopNode = stopNode->getNextSibling(); + } + if ( stopNode == 0 ) + stopNode = nextNode( fEndContainer, false ); + } + + while (node != stopNode) { //look into all kids of the Range + if (node == 0) break; + type = node->getNodeType(); + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + retStringBuf.append(node->getNodeValue()); + } + node = nextNode(node, true); + } + + type = fEndContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + + if (fEndOffset != 0) { + + XMLCh* tempString; + XMLCh temp[4000]; + if (fEndOffset >= 3999) + tempString = (XMLCh*) fMemoryManager->allocate + ( + (fEndOffset+1) * sizeof(XMLCh) + );//new XMLCh[fEndOffset+1]; + else + tempString = temp; + + XMLString::subString(tempString, fEndContainer->getNodeValue(), 0, fEndOffset, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + retStringBuf.append(tempString); + + if (fEndOffset >= 3999) + fMemoryManager->deallocate(tempString);//delete[] tempString; + } + } + return ((DOMDocumentImpl *)fDocument)->getPooledString(retStringBuf.getRawBuffer()); +} + +DOMDocument* DOMRangeImpl::getDocument() +{ + return fDocument; +} + +const DOMNode* DOMRangeImpl::getCommonAncestorContainer() const +{ + return commonAncestorOf(fStartContainer, fEndContainer); + +} + +void DOMRangeImpl::release() +{ + detach(); + // for performance reason, do not recycle pointer + // chance that this is allocated again and again is not usual +} + +//--------------------- +//private functions +//--------------------- + +bool DOMRangeImpl::isValidAncestorType(const DOMNode* node) const +{ + for (DOMNode* aNode = (DOMNode*) node; aNode!=0; aNode = aNode->getParentNode()) { + short type = aNode->getNodeType(); + if ( type == DOMNode::ENTITY_NODE + || type == DOMNode::NOTATION_NODE + || type == DOMNode::DOCUMENT_TYPE_NODE) + return false; + } + return true; +} + +bool DOMRangeImpl::isAncestorOf(const DOMNode* a, const DOMNode* b) { + for (DOMNode* node = (DOMNode*) b; node != 0; node=node->getParentNode()) { + if (node == a) return true; + } + return false; +} + +bool DOMRangeImpl::hasLegalRootContainer(const DOMNode* node) const { + if ( node==0 ) + return false; + + DOMNode* rootContainer = (DOMNode*)node; + for (; rootContainer->getParentNode()!=0; rootContainer = rootContainer->getParentNode()) + ; + + switch( rootContainer->getNodeType() ) { + case DOMNode::ATTRIBUTE_NODE: + case DOMNode::DOCUMENT_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + return true; + default: + return false; + } +} + +bool DOMRangeImpl::isLegalContainedNode(const DOMNode* node ) const { + if ( node==0 ) + return false; + switch( node->getNodeType() ) + { + case DOMNode::DOCUMENT_NODE: + case DOMNode::DOCUMENT_FRAGMENT_NODE: + case DOMNode::ATTRIBUTE_NODE: + case DOMNode::ENTITY_NODE: + case DOMNode::NOTATION_NODE: + return false; + default: + return true; + } +} + +XMLSize_t DOMRangeImpl::indexOf(const DOMNode* child, const DOMNode* parent) const +{ + XMLSize_t i = 0; + if (child->getParentNode() != parent) return (XMLSize_t)-1; + for(DOMNode* node = child->getPreviousSibling(); node!= 0; node=node->getPreviousSibling()) { + i++; + } + return i; +} + +void DOMRangeImpl::validateNode(const DOMNode* node) const +{ + if( fDetached) { + throw DOMException( + DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + } + + if ( !isValidAncestorType(node)) { + throw DOMRangeException(DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager); + } +} + + +const DOMNode* DOMRangeImpl::commonAncestorOf(const DOMNode* pointA, const DOMNode* pointB) const +{ + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + + //if the containers are same then it itself is its common ancestor. + if (pointA == pointB) + return pointA; + + typedef RefVectorOf VectorNodes; + VectorNodes startV(1, false, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + DOMNode* node; + + for (node=(DOMNode*)pointA; node != 0; node=node->getParentNode()) + { + startV.addElement(node); + } + VectorNodes endV(1, false, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + for (node=(DOMNode*)pointB; node != 0; node=node->getParentNode()) + { + endV.addElement(node); + } + + XMLSize_t s = startV.size(); + XMLSize_t e = endV.size(); + + DOMNode* commonAncestor = 0; + + while (s>0 && e>0) { + if (startV.elementAt(s-1) == endV.elementAt(e-1)) { + commonAncestor = startV.elementAt(s-1); + } + else break; + --s; + --e; + } + + return commonAncestor; +} + +void DOMRangeImpl::checkIndex(const DOMNode* node, XMLSize_t offset) const +{ + short type = node->getNodeType(); + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) { + if (offset > XMLString::stringLen(node->getNodeValue())) + throw DOMException( DOMException::INDEX_SIZE_ERR, 0, fMemoryManager ); + else return; + } + + DOMNode* child = node->getFirstChild(); + XMLSize_t i = 0; + for (; child != 0; i++) { + child = child->getNextSibling(); + } + if (i < offset) { + throw DOMException( DOMException::INDEX_SIZE_ERR, 0, fMemoryManager ); + } + +} + +DOMNode* DOMRangeImpl::nextNode(const DOMNode* node, bool visitChildren) const +{ + + if (node == 0) return 0; + + DOMNode* result; + if (visitChildren) { + result = node->getFirstChild(); + if (result != 0) { + return result; + } + } + + // if hasSibling, return sibling + result = node->getNextSibling(); + if (result != 0) { + return result; + } + + + // return parent's 1st sibling. + DOMNode* parent = node->getParentNode(); + + + while ( (parent != 0) && (parent != fDocument) ) + { + result = parent->getNextSibling(); + if (result != 0) { + return result; + } else { + parent = parent->getParentNode(); + } + + } + // end of list, return 0 + return 0; +} + + +/** This is the master routine invoked to visit the nodes +* selected by this range. For each such node, different +* actions are taken depending on the value of the TraversalType argument. +*/ +DOMDocumentFragment* DOMRangeImpl::traverseContents(TraversalType how) +{ + if (fDetached) + throw DOMException(DOMException::INVALID_STATE_ERR, 0, fMemoryManager); + + if (fStartContainer == 0 || fEndContainer == 0) { + return 0; // REVIST: Throw exception? + } + + /* Traversal is accomplished by first determining the + relationship between the endpoints of the range. + For each of four significant relationships, we will + delegate the traversal call to a method that + can make appropriate assumptions. + */ + + // case 1: same container + if ( fStartContainer == fEndContainer ) + return traverseSameContainer( how ); + + // case 2: Child C of start container is ancestor of end container + // This can be quickly tested by walking the parent chain of + // end container + int endContainerDepth = 0; + for ( DOMNode* c = fEndContainer, *p = c->getParentNode(); + p != 0; + c = p, p = p->getParentNode()) + { + if (p == fStartContainer) + return traverseCommonStartContainer( c, how ); + ++endContainerDepth; + } + + // case 3: Child C of end container is ancestor of start container + // This can be quickly tested by walking the parent chain of A + int startContainerDepth = 0; + for ( DOMNode* c2 = fStartContainer, *p2 = c2->getParentNode(); + p2 != 0; + c2 = p2, p2 = p2->getParentNode()) + { + if (p2 == fEndContainer) + return traverseCommonEndContainer( c2, how ); + ++startContainerDepth; + } + + // case 4: There is a common ancestor container. Find the + // ancestor siblings that are children of that container. + int depthDiff = startContainerDepth - endContainerDepth; + + DOMNode* startNode = fStartContainer; + while (depthDiff > 0) { + startNode = startNode->getParentNode(); + depthDiff--; + } + + DOMNode* endNode = fEndContainer; + while (depthDiff < 0) { + endNode = endNode->getParentNode(); + depthDiff++; + } + + // ascend the ancestor hierarchy until we have a common parent. + for( DOMNode* sp = startNode->getParentNode(), *ep = endNode->getParentNode(); + sp!=ep; + sp = sp->getParentNode(), ep = ep->getParentNode() ) + { + startNode = sp; + endNode = ep; + } + return traverseCommonAncestors( startNode, endNode, how ); + } + +/** + * Visits the nodes selected by this range when we know + * a-priori that the start and end containers are the same. + * + */ +DOMDocumentFragment* DOMRangeImpl::traverseSameContainer( int how ) +{ + DOMDocumentFragment* frag = 0; + if ( how!=DELETE_CONTENTS) + frag = fDocument->createDocumentFragment(); + + // If selection is empty, just return the fragment + if ( fStartOffset==fEndOffset ) + return frag; + + DOMNode* cloneCurrent = 0; + + // Text node needs special case handling + short type = fStartContainer->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + cloneCurrent = fStartContainer->cloneNode(false); + if (fEndOffset == fStartOffset) { + cloneCurrent->setNodeValue(XMLUni::fgZeroLenString); + } + else { + XMLCh* tempString; + XMLCh temp[4000]; + if (fEndOffset >= 3999) + tempString = (XMLCh*) fMemoryManager->allocate + ( + (fEndOffset+1) * sizeof(XMLCh) + );//new XMLCh[fEndOffset+1]; + else + tempString = temp; + + XMLString::subString(tempString, cloneCurrent->getNodeValue(), fStartOffset, fEndOffset, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + cloneCurrent->setNodeValue(((DOMDocumentImpl *)fDocument)->getPooledString(tempString)); + + if (fEndOffset >= 3999) + fMemoryManager->deallocate(tempString);//delete[] tempString; + } + + // set the original text node to its new value + if ( how != CLONE_CONTENTS ) { + if(type == DOMNode::PROCESSING_INSTRUCTION_NODE) { + ((DOMProcessingInstructionImpl*)fStartContainer)->deleteData(fStartOffset, fEndOffset-fStartOffset); + } + else + ((DOMCharacterData*)fStartContainer)->deleteData(fStartOffset, fEndOffset-fStartOffset); + } + if ( how != DELETE_CONTENTS) + frag->appendChild(cloneCurrent); + } + else { + // Copy nodes between the start/end offsets. + DOMNode* n = getSelectedNode( fStartContainer, (int)fStartOffset ); + int cnt = (int)fEndOffset - (int)fStartOffset; + while( cnt > 0 && n) + { + DOMNode* sibling = n->getNextSibling(); + DOMNode* xferNode = traverseFullySelected( n, how ); + if ( frag!=0 ) + frag->appendChild( xferNode ); + --cnt; + n = sibling; + } + } + + // Nothing is partially selected, so collapse to start point + if ( how != CLONE_CONTENTS ) + collapse(true); + return frag; +} + +/** + * Visits the nodes selected by this range when we know + * a-priori that the start and end containers are not the + * same, but the start container is an ancestor of the end container + * + */ +DOMDocumentFragment* DOMRangeImpl::traverseCommonStartContainer( DOMNode*endAncestor, int how ) +{ + DOMDocumentFragment* frag = 0; + if ( how!=DELETE_CONTENTS) + frag = fDocument->createDocumentFragment(); + DOMNode*n = traverseRightBoundary( endAncestor, how ); + if ( frag!=0 ) + frag->appendChild( n ); + + XMLSize_t endIdx = indexOf( endAncestor, fStartContainer ); + if ( endIdx <= fStartOffset ) + { + // Collapse to just before the endAncestor, which + // is partially selected. + if ( how != CLONE_CONTENTS ) + { + setEndBefore( endAncestor ); + collapse( false ); + } + return frag; + } + + n = endAncestor->getPreviousSibling(); + int cnt = (int)endIdx - (int)fStartOffset; + while( cnt > 0 ) + { + DOMNode* sibling = n->getPreviousSibling(); + DOMNode* xferNode = traverseFullySelected( n, how ); + if ( frag!=0 ) + frag->insertBefore( xferNode, frag->getFirstChild() ); + --cnt; + n = sibling; + } + // Collapse to just before the endAncestor, which + // is partially selected. + if ( how != CLONE_CONTENTS ) + { + setEndBefore( endAncestor ); + collapse( false ); + } + return frag; +} + +/** + * Visits the nodes selected by this range when we know + * a-priori that the start and end containers are not the + * same, but the end container is an ancestor of the start container + * + */ +DOMDocumentFragment* DOMRangeImpl::traverseCommonEndContainer( DOMNode*startAncestor, int how ) +{ + DOMDocumentFragment* frag = 0; + if ( how!=DELETE_CONTENTS) + frag = fDocument->createDocumentFragment(); + DOMNode* n = traverseLeftBoundary( startAncestor, how ); + if ( frag!=0 ) + frag->appendChild( n ); + XMLSize_t startIdx = indexOf( startAncestor, fEndContainer ); + ++startIdx; // Because we already traversed it.... + + int cnt = (int)fEndOffset - (int)startIdx; + n = startAncestor->getNextSibling(); + while( cnt > 0 ) + { + DOMNode* sibling = n->getNextSibling(); + DOMNode* xferNode = traverseFullySelected( n, how ); + if ( frag!=0 ) + frag->appendChild( xferNode ); + --cnt; + n = sibling; + } + + if ( how != CLONE_CONTENTS ) + { + setStartAfter( startAncestor ); + collapse( true ); + } + + return frag; +} + +/** + * Visits the nodes selected by this range when we know + * a-priori that the start and end containers are not + * the same, and we also know that neither the start + * nor end container is an ancestor of the other. + */ +DOMDocumentFragment* DOMRangeImpl::traverseCommonAncestors( DOMNode*startAncestor, DOMNode*endAncestor, int how ) +{ + DOMDocumentFragment* frag = 0; + if ( how!=DELETE_CONTENTS) + frag = fDocument->createDocumentFragment(); + + DOMNode*n = traverseLeftBoundary( startAncestor, how ); + if ( frag!=0 ) + frag->appendChild( n ); + + DOMNode*commonParent = startAncestor->getParentNode(); + XMLSize_t startOffset = indexOf( startAncestor, commonParent ); + XMLSize_t endOffset = indexOf( endAncestor, commonParent ); + ++startOffset; + + int cnt = (int)endOffset - (int)startOffset; + DOMNode* sibling = startAncestor->getNextSibling(); + + while( cnt > 0 ) + { + DOMNode* nextSibling = sibling->getNextSibling(); + n = traverseFullySelected( sibling, how ); + if ( frag!=0 ) + frag->appendChild( n ); + sibling = nextSibling; + --cnt; + } + + n = traverseRightBoundary( endAncestor, how ); + if ( frag!=0 ) + frag->appendChild( n ); + + if ( how != CLONE_CONTENTS ) + { + setStartAfter( startAncestor ); + collapse( true ); + } + return frag; +} + +/** + * Traverses the "right boundary" of this range and + * operates on each "boundary node" according to the + * how parameter. It is a-priori assumed + * by this method that the right boundary does + * not contain the range's start container. + * + * A "right boundary" is best visualized by thinking + * of a sample tree: + * A + * /|\ + * / | \ + * / | \ + * B C D + * /|\ /|\ + * E F G H I J + * + * Imagine first a range that begins between the + * "E" and "F" nodes and ends between the + * "I" and "J" nodes. The start container is + * "B" and the end container is "D". Given this setup, + * the following applies: + * + * Partially Selected Nodes: B, D
+ * Fully Selected Nodes: F, G, C, H, I + * + * The "right boundary" is the highest subtree node + * that contains the ending container. The root of + * this subtree is always partially selected. + * + * In this example, the nodes that are traversed + * as "right boundary" nodes are: H, I, and D. + * + */ +DOMNode* DOMRangeImpl::traverseRightBoundary( DOMNode*root, int how ) +{ + DOMNode*next = getSelectedNode( fEndContainer, (int)fEndOffset-1 ); + bool isFullySelected = ( next!=fEndContainer ); + + if ( next==root ) + return traverseNode( next, isFullySelected, false, how ); + + DOMNode*parent = next->getParentNode(); + DOMNode*clonedParent = traverseNode( parent, false, false, how ); + + while( parent!=0 ) + { + while( next!=0 ) + { + DOMNode* prevSibling = next->getPreviousSibling(); + DOMNode* clonedChild = + traverseNode( next, isFullySelected, false, how ); + if ( how!=DELETE_CONTENTS ) + { + clonedParent->insertBefore( + clonedChild, + clonedParent->getFirstChild() + ); + } + isFullySelected = true; + next = prevSibling; + } + if ( parent==root ) + return clonedParent; + + next = parent->getPreviousSibling(); + parent = parent->getParentNode(); + DOMNode* clonedGrandParent = traverseNode( parent, false, false, how ); + if ( how!=DELETE_CONTENTS ) + clonedGrandParent->appendChild( clonedParent ); + clonedParent = clonedGrandParent; + + } + + // should never occur + return 0; +} + +/** + * Traverses the "left boundary" of this range and + * operates on each "boundary node" according to the + * how parameter. It is a-priori assumed + * by this method that the left boundary does + * not contain the range's end container. + * + * A "left boundary" is best visualized by thinking + * of a sample tree: + * + * A + * /|\ + * / | \ + * / | \ + * B C D + * /|\ /|\ + * E F G H I J + * + * Imagine first a range that begins between the + * "E" and "F" nodes and ends between the + * "I" and "J" nodes. The start container is + * "B" and the end container is "D". Given this setup, + * the following applies: + * + * Partially Selected Nodes: B, D
+ * Fully Selected Nodes: F, G, C, H, I + * + * The "left boundary" is the highest subtree node + * that contains the starting container. The root of + * this subtree is always partially selected. + * + * In this example, the nodes that are traversed + * as "left boundary" nodes are: F, G, and B. + * + */ +DOMNode* DOMRangeImpl::traverseLeftBoundary( DOMNode*root, int how ) +{ + DOMNode*next = getSelectedNode( getStartContainer(), (int)getStartOffset() ); + bool isFullySelected = ( next!=getStartContainer() ); + + if ( next==root ) + return traverseNode( next, isFullySelected, true, how ); + + DOMNode* parent = next->getParentNode(); + DOMNode* clonedParent = traverseNode( parent, false, true, how ); + + while( parent!=0 ) + { + while( next!=0 ) + { + DOMNode* nextSibling = next->getNextSibling(); + DOMNode* clonedChild = + traverseNode( next, isFullySelected, true, how ); + if ( how!=DELETE_CONTENTS ) + clonedParent->appendChild(clonedChild); + isFullySelected = true; + next = nextSibling; + } + if ( parent==root ) + return clonedParent; + + next = parent->getNextSibling(); + parent = parent->getParentNode(); + DOMNode* clonedGrandParent = traverseNode( parent, false, true, how ); + if ( how!=DELETE_CONTENTS ) + clonedGrandParent->appendChild( clonedParent ); + clonedParent = clonedGrandParent; + + } + + // should never occur + return 0; + +} + +/** + * Utility method for traversing a single node. + * Does not properly handle a text node containing both the + * start and end offsets. Such nodes should + * have been previously detected and been routed to traverseTextNode. + * + */ +DOMNode* DOMRangeImpl::traverseNode( DOMNode* n, bool isFullySelected, bool isLeft, int how ) +{ + if ( isFullySelected ) + return traverseFullySelected( n, how ); + + short type = n->getNodeType(); + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + return traverseTextNode( n, isLeft, how ); + + return traversePartiallySelected( n, how ); +} + +/** + * Utility method for traversing a single node when + * we know a-priori that the node if fully + * selected. + * + */ +DOMNode* DOMRangeImpl::traverseFullySelected( DOMNode* n, int how ) +{ + switch( how ) + { + case CLONE_CONTENTS: + return n->cloneNode( true ); + case EXTRACT_CONTENTS: + return n; + case DELETE_CONTENTS: + // revisit: + // should I release the removed node? + // not released in case user still referencing it externally + n->getParentNode()->removeChild(n); + return 0; + } + return 0; +} + +/** + * Utility method for traversing a single node when + * we know a-priori that the node if partially + * selected and is not a text node. + * + */ +DOMNode* DOMRangeImpl::traversePartiallySelected( DOMNode*n, int how ) +{ + switch( how ) + { + case DELETE_CONTENTS: + return 0; + case CLONE_CONTENTS: + case EXTRACT_CONTENTS: + return n->cloneNode( false ); + } + return 0; +} + +/** + * Utility method for traversing a text node that we know + * a-priori to be on a left or right boundary of the range. + * This method does not properly handle text nodes that contain + * both the start and end points of the range. + * + */ +DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) +{ + XMLCh* txtValue = XMLString::replicate(n->getNodeValue(), fMemoryManager); + ArrayJanitor janValue(txtValue, fMemoryManager); + + if ( isLeft ) + { + XMLSize_t startLen = XMLString::stringLen(fStartContainer->getNodeValue()); + XMLSize_t offset = getStartOffset(); + + if (offset == 0) { + if ( how != CLONE_CONTENTS ) + n->setNodeValue(XMLUni::fgZeroLenString); + } + else { + XMLCh* oldNodeValue; + XMLCh oldTemp[4000]; + + if (offset >= 3999) { + oldNodeValue = (XMLCh*) fMemoryManager->allocate + ( + (offset+1) * sizeof(XMLCh) + );//new XMLCh[offset+1]; + } + else { + oldNodeValue = oldTemp; + } + XMLString::subString(oldNodeValue, txtValue, 0, offset, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + + if ( how != CLONE_CONTENTS ) + n->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(oldNodeValue) ); + + if (offset>= 3999) + fMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; + } + + if ( how==DELETE_CONTENTS ) + return 0; + + DOMNode* newNode = n->cloneNode( false ); + + if (startLen == offset) { + newNode->setNodeValue(XMLUni::fgZeroLenString); + } + else { + XMLCh* newNodeValue; + XMLCh newTemp[4000]; + + if (offset >= 3999) { + newNodeValue = (XMLCh*) fMemoryManager->allocate + ( + (offset+1) * sizeof(XMLCh) + );//new XMLCh[offset+1]; + } + else { + newNodeValue = newTemp; + } + XMLString::subString(newNodeValue, txtValue, offset, startLen, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + newNode->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(newNodeValue) ); + + if (offset>= 3999) + fMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; + + } + return newNode; + } + else + { + XMLSize_t endLen = XMLString::stringLen(fEndContainer->getNodeValue()); + XMLSize_t offset = getEndOffset(); + + if (endLen == offset) { + if ( how != CLONE_CONTENTS ) + n->setNodeValue(XMLUni::fgZeroLenString); + } + else { + XMLCh* oldNodeValue; + XMLCh oldTemp[4000]; + + if (offset >= 3999) { + oldNodeValue = (XMLCh*) fMemoryManager->allocate + ( + (offset+1) * sizeof(XMLCh) + );//new XMLCh[offset+1]; + } + else { + oldNodeValue = oldTemp; + } + XMLString::subString(oldNodeValue, txtValue, offset, endLen, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + + if ( how != CLONE_CONTENTS ) + n->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(oldNodeValue) ); + + if (offset>= 3999) + fMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; + } + + if ( how==DELETE_CONTENTS ) + return 0; + + DOMNode* newNode = n->cloneNode( false ); + + if (offset == 0) { + newNode->setNodeValue(XMLUni::fgZeroLenString); + } + else { + XMLCh* newNodeValue; + XMLCh newTemp[4000]; + + if (offset >= 3999) { + newNodeValue = (XMLCh*) fMemoryManager->allocate + ( + (offset+1) * sizeof(XMLCh) + );//new XMLCh[offset+1]; + } + else { + newNodeValue = newTemp; + } + XMLString::subString(newNodeValue, txtValue, 0, offset, ((DOMDocumentImpl *)fDocument)->getMemoryManager()); + newNode->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(newNodeValue) ); + + if (offset>= 3999) + fMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; + + } + return newNode; + } +} + +/** + * Utility method to retrieve a child node by index. This method + * assumes the caller is trying to find out which node is + * selected by the given index. Note that if the index is + * greater than the number of children, this implies that the + * first node selected is the parent node itself. + * + */ +DOMNode* DOMRangeImpl::getSelectedNode( DOMNode*container, int offset ) +{ + short type = container->getNodeType(); + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + return container; + + // This case is an important convenience for + // traverseRightBoundary() + if ( offset<0 ) + return container; + + DOMNode*child = container->getFirstChild(); + while( child!=0 && offset > 0 ) + { + --offset; + child = child->getNextSibling(); + } + if ( child!=0 ) + return child; + return container; +} + +void DOMRangeImpl::checkReadOnly(DOMNode* start, DOMNode* end, + XMLSize_t startOffset, XMLSize_t endOffset) +{ + if ((start == 0) || (end == 0) ) return; + DOMNode*sNode = 0; + + short type = start->getNodeType(); + if ( type == DOMNode::DOCUMENT_TYPE_NODE ) + { + throw DOMException( + DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager); + } + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (castToNodeImpl(start)->isReadOnly()) { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager); + } + //if both start and end are text check and return + if (start == end) + return; + + sNode = start; + } else { + //set the start and end nodes to check + sNode = start->getFirstChild(); + for(XMLSize_t i = 0; igetNextSibling(); + } + + DOMNode* eNode; + type = end->getNodeType(); + if ( type == DOMNode::DOCUMENT_TYPE_NODE ) + { + throw DOMException( + DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager); + } + + if((type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + eNode = end; //need to check only till this node + } + else { //need to check all the kids that fall before the end offset value + eNode = end->getFirstChild(); + if (endOffset > 0) { + for (XMLSize_t i = 0; igetNextSibling(); + } + } + //recursivly search if any node is readonly + recurseTreeAndCheck(sNode, eNode); +} + +void DOMRangeImpl::recurseTreeAndCheck(DOMNode* start, DOMNode* end) +{ + for(DOMNode* node=start; node != 0 && node !=end; node=node->getNextSibling()) + { + if ( node->getNodeType()== DOMNode::DOCUMENT_TYPE_NODE ) + { + throw DOMException( + DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager); + } + + if (castToNodeImpl(node)->isReadOnly()) { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager); + } + + if (node->hasChildNodes()) { + node = node->getFirstChild(); + recurseTreeAndCheck(node, end); + } + } +} + + +DOMNode* DOMRangeImpl::removeChild(DOMNode* parent, DOMNode* child) +{ + fRemoveChild = child; //only a precaution measure not to update this range data before removal + DOMNode*n = parent->removeChild(child); + fRemoveChild = 0; + return n; +} + + +// +// Mutation functions +// + + +/* This function is called from DOM. +* The text has already been replaced. +* Fix-up any offsets. +*/ +void DOMRangeImpl::receiveReplacedText(DOMNode* node) +{ + if (node == 0) return; + + short type = fStartContainer->getNodeType(); + if (node == fStartContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + fStartOffset = 0; + } + type = fEndContainer->getNodeType(); + if (node == fEndContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + fEndOffset = 0; + } +} + + +/** This function is called from DOM. +* The text has already been deleted. +* Fix-up any offsets. +*/ +void DOMRangeImpl::updateRangeForDeletedText(DOMNode* node, XMLSize_t offset, XMLSize_t count) +{ + if (node == 0) return; + + short type = fStartContainer->getNodeType(); + if (node == fStartContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fStartOffset > offset+count) { + fStartOffset = fStartOffset-count; + } else if (fStartOffset > offset) { + fStartOffset = offset; + } + } + type = fEndContainer->getNodeType(); + if (node == fEndContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fEndOffset > offset+count) { + fEndOffset = fEndOffset-count; + } else if (fEndOffset > offset) { + fEndOffset = offset; + } + } +} + + + +/** This function is called from DOM. +* The text has already beeen inserted. +* Fix-up any offsets. +*/ +void DOMRangeImpl::updateRangeForInsertedText(DOMNode* node, XMLSize_t offset, XMLSize_t count) +{ + if (node == 0) return; + + short type = fStartContainer->getNodeType(); + if (node == fStartContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fStartOffset > offset) { + fStartOffset = offset; + } + } + type = fEndContainer->getNodeType(); + if (node == fEndContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fEndOffset > offset) { + fEndOffset = fEndOffset+count; + } + } +} + + + +/** This function must be called by the DOM _BEFORE_ +* a node is deleted, because at that time it is +* connected in the DOM tree, which we depend on. +*/ +void DOMRangeImpl::updateRangeForDeletedNode(DOMNode* node) +{ + + if (node == 0) return; + if (fRemoveChild == node) return; + + if (node->getParentNode() == fStartContainer) { + XMLSize_t index = indexOf(node, fStartContainer); + if ( fStartOffset > index) { + fStartOffset--; + } + } + + if (node->getParentNode() == fEndContainer) { + XMLSize_t index = indexOf(node, fEndContainer); + if ( fEndOffset > index) { + fEndOffset--; + } + } + + if (node->getParentNode() != fStartContainer + || node->getParentNode() != fEndContainer) { + if (isAncestorOf(node, fStartContainer)) { + DOMNode* tpNode = node->getParentNode(); + setStartContainer( tpNode ); + fStartOffset = indexOf( node, tpNode); + } + if (isAncestorOf(node, fEndContainer)) { + DOMNode* tpNode = node->getParentNode(); + setEndContainer( tpNode ); + fEndOffset = indexOf( node, tpNode); + } + } + +} + +void DOMRangeImpl::updateRangeForInsertedNode(DOMNode* node) { + if (node == 0) return; + + if (node->getParentNode() == fStartContainer) { + XMLSize_t index = indexOf(node, fStartContainer); + if (index < fStartOffset) { + fStartOffset++; + } + } + + if (node->getParentNode() == fEndContainer) { + XMLSize_t index = indexOf(node, fEndContainer); + if (index < fEndOffset) { + fEndOffset++; + } + } +} + + +void DOMRangeImpl::updateSplitInfo(DOMNode* oldNode, DOMNode* startNode, XMLSize_t offset) +{ + if (startNode == 0) return; + + short type = fStartContainer->getNodeType(); + if (oldNode == fStartContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fStartOffset > offset) { + fStartOffset = fStartOffset - offset; + fStartContainer = startNode; + } + } + + type = fEndContainer->getNodeType(); + if (oldNode == fEndContainer + && (type == DOMNode::TEXT_NODE + || type == DOMNode::CDATA_SECTION_NODE + || type == DOMNode::COMMENT_NODE + || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) + { + if (fEndOffset > offset) { + fEndContainer = startNode; + fEndOffset = fEndOffset - offset; + } + } +} + + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.hpp new file mode 100644 index 000000000..fcb68c933 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMRangeImpl.hpp @@ -0,0 +1,176 @@ +/* + * 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: DOMRangeImpl.hpp 641193 2008-03-26 08:06:57Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGEIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMRANGEIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + + +class DOMNode; +class DOMDocumentFragment; +class DOMDocument; +class DOMText; +class MemoryManager; + +class CDOM_EXPORT DOMRangeImpl: public DOMRange { +protected: + enum TraversalType { + EXTRACT_CONTENTS = 1, + CLONE_CONTENTS = 2, + DELETE_CONTENTS = 3 + }; + + enum TraversePoint { + BEFORE = -1, + START = 0, + AFTER = 1 + }; + + //private data + + DOMNode* fStartContainer; + XMLSize_t fStartOffset; + DOMNode* fEndContainer; + XMLSize_t fEndOffset; + bool fCollapsed; + DOMDocument* fDocument; + bool fDetached; + + DOMNode* fRemoveChild; + MemoryManager* fMemoryManager; + +public: + //c'tor + DOMRangeImpl(DOMDocument* doc, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + DOMRangeImpl(const DOMRangeImpl& other); + + //d'tor + ~DOMRangeImpl(); + + //getter functions + virtual DOMNode* getStartContainer() const; + virtual XMLSize_t getStartOffset() const; + virtual DOMNode* getEndContainer() const; + virtual XMLSize_t getEndOffset() const; + virtual bool getCollapsed() const; + virtual const DOMNode* getCommonAncestorContainer() const; + + //setter functions + virtual void setStart(const DOMNode *parent, XMLSize_t offset); + virtual void setEnd(const DOMNode *parent, XMLSize_t offset); + + virtual void setStartBefore(const DOMNode *refNode); + virtual void setStartAfter(const DOMNode *refNode); + virtual void setEndBefore(const DOMNode *refNode); + virtual void setEndAfter(const DOMNode *refNode); + + //misc functions + virtual void collapse(bool toStart); + virtual void selectNode(const DOMNode *node); + virtual void selectNodeContents(const DOMNode *node); + + //Functions related to comparing range Boundrary-Points + virtual short compareBoundaryPoints(CompareHow how, const DOMRange* range) const; + virtual void deleteContents(); + virtual DOMDocumentFragment* extractContents(); + virtual DOMDocumentFragment* cloneContents() const; + virtual void insertNode(DOMNode* node); + + //Misc functions + virtual void surroundContents(DOMNode *node); + virtual DOMRange* cloneRange() const; + virtual const XMLCh* toString() const; + virtual void detach(); + virtual void release(); + + //getter functions + DOMDocument* getDocument(); + + // functions to inform all existing valid ranges about a change + void updateSplitInfo(DOMNode* oldNode, DOMNode* startNode, XMLSize_t offset); + void updateRangeForInsertedNode(DOMNode* node); + void receiveReplacedText(DOMNode* node); + void updateRangeForDeletedText(DOMNode* node, XMLSize_t offset, XMLSize_t count); + void updateRangeForInsertedText(DOMNode* node, XMLSize_t offset, XMLSize_t count); + void updateRangeForDeletedNode(DOMNode* node); + +protected: + //setter functions + void setStartContainer(const DOMNode* node); + void setStartOffset(XMLSize_t offset) ; + void setEndContainer(const DOMNode* node); + void setEndOffset(XMLSize_t offset) ; + + //misc functions + void validateNode(const DOMNode* node) const; + bool isValidAncestorType(const DOMNode* node) const; + bool hasLegalRootContainer(const DOMNode* node) const; + bool isLegalContainedNode(const DOMNode* node ) const; + void checkIndex(const DOMNode* node, XMLSize_t offset) const; + static bool isAncestorOf(const DOMNode* a, const DOMNode* b); + + XMLSize_t indexOf(const DOMNode* child, const DOMNode* parent) const; + + const DOMNode* commonAncestorOf(const DOMNode* pointA, const DOMNode* pointB) const; + DOMNode* nextNode(const DOMNode* node, bool visitChildren) const; + DOMDocumentFragment* traverseContents(TraversalType type); + void checkReadOnly(DOMNode* start, DOMNode* end, + XMLSize_t starOffset, XMLSize_t endOffset); + void recurseTreeAndCheck(DOMNode* start, DOMNode* end); + DOMNode* removeChild(DOMNode* parent, DOMNode* child); + + DOMDocumentFragment* traverseSameContainer( int how ); + DOMDocumentFragment* traverseCommonStartContainer( DOMNode *endAncestor, int how ); + DOMDocumentFragment* traverseCommonEndContainer( DOMNode *startAncestor, int how ); + DOMDocumentFragment* traverseCommonAncestors( DOMNode *startAncestor, DOMNode *endAncestor, int how ); + DOMNode* traverseRightBoundary( DOMNode *root, int how ); + DOMNode* traverseLeftBoundary( DOMNode *root, int how ); + DOMNode* traverseNode( DOMNode *n, bool isFullySelected, bool isLeft, int how ); + DOMNode* traverseFullySelected( DOMNode *n, int how ); + DOMNode* traversePartiallySelected( DOMNode *n, int how ); + DOMNode* traverseTextNode( DOMNode *n, bool isLeft, int how ); + DOMNode* getSelectedNode( DOMNode *container, int offset ); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMRangeImpl & operator = (const DOMRangeImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.cpp new file mode 100644 index 000000000..0af5d4b43 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.cpp @@ -0,0 +1,64 @@ +/* + * 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: DOMStringListImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMStringListImpl.hpp" +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMStringListImpl::DOMStringListImpl(int nInitialSize, MemoryManager* manager) +{ + fList=new (manager) RefVectorOf(nInitialSize, false, manager); +} + +DOMStringListImpl::~DOMStringListImpl() +{ + delete fList; +} + + +void DOMStringListImpl::add(const XMLCh* str) { + fList->addElement((XMLCh*)str); +} + +XMLSize_t DOMStringListImpl::getLength() const{ + return fList->size(); +} + + +const XMLCh* DOMStringListImpl::item(XMLSize_t index) const{ + if(indexsize()) + return fList->elementAt(index); + return 0; +} + +bool DOMStringListImpl::contains(const XMLCh* str) const{ + for(XMLSize_t i=0;isize();i++) + if(XMLString::equals(fList->elementAt(i), str)) + return true; + return false; +} + +void DOMStringListImpl::release() { + delete this; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.hpp new file mode 100644 index 000000000..3ea2796cc --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMStringListImpl.hpp @@ -0,0 +1,56 @@ +/* + * 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: DOMStringListImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMSTRINGLISTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMSTRINGLISTIMPL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMStringListImpl: public XMemory, + public DOMStringList +{ +protected: + RefVectorOf *fList; + +private: + // Unused, and unimplemented constructors, operators, etc. + DOMStringListImpl(const DOMStringListImpl & other); + DOMStringListImpl & operator = (const DOMStringListImpl & other); + +public: + DOMStringListImpl(int nInitialSize, MemoryManager* manager); + void add(const XMLCh* impl); + + virtual ~DOMStringListImpl(); + virtual const XMLCh* item(XMLSize_t index) const; + virtual XMLSize_t getLength() const; + virtual bool contains(const XMLCh* str) const; + virtual void release(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.cpp new file mode 100644 index 000000000..7352f4db9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.cpp @@ -0,0 +1,62 @@ +/* + * 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: DOMStringPool.cpp 678766 2008-07-22 14:00:16Z borisk $ + */ + +#include +#include + +#include "DOMStringPool.hpp" +#include "DOMDocumentImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +DOMBuffer:: +DOMBuffer(DOMDocumentImpl *doc, XMLSize_t capacity) : + fBuffer(0) + , fIndex(0) + , fCapacity(capacity) + , fDoc(doc) +{ + // Buffer is one larger than capacity, to allow for zero term + fBuffer = (XMLCh*) doc->allocate((fCapacity+1)*sizeof(XMLCh)); + + // Keep it null terminated + fBuffer[0] = XMLCh(0); +} + +// --------------------------------------------------------------------------- +// DOMBuffer: Private helper methods +// --------------------------------------------------------------------------- +void DOMBuffer::expandCapacity(const XMLSize_t extraNeeded) +{ + //not enough room. Calc new capacity and allocate new buffer + const XMLSize_t newCap = (XMLSize_t)((fIndex + extraNeeded) * 1.25); + XMLCh* newBuf = (XMLCh*) fDoc->allocate((newCap+1)*sizeof(XMLCh)); + + // Copy over the old stuff + memcpy(newBuf, fBuffer, fCapacity * sizeof(XMLCh)); + + // revisit: Leave the old buffer in document heap, yes, this is a leak, but live with it! + // store new stuff + fBuffer = newBuf; + fCapacity = newCap; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.hpp new file mode 100644 index 000000000..92a30ab60 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMStringPool.hpp @@ -0,0 +1,211 @@ +/* + * 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: DOMStringPool.hpp 678766 2008-07-22 14:00:16Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMSTRINGPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMSTRINGPOOL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMDocumentImpl; + +// +// DStringPoolEntry - one of these structs is allocated for each +// XMLCh String in the pool. Each slot in the +// hash table array itself is a pointer to the head +// of a singly-linked list of these structs. +// +// Although this struct is delcared with a string length of one, +// the factory method allocates enough storage to hold the full +// string length. +// +struct DOMStringPoolEntry +{ + DOMStringPoolEntry *fNext; + XMLCh fString[1]; +}; + +// +// DOMBuffer is a lightweight text buffer +// The buffer is not nul terminated until some asks to see the raw buffer +// contents. This also avoids overhead during append operations. +class DOMBuffer +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DOMBuffer(DOMDocumentImpl *doc, XMLSize_t capacity = 31); + + ~DOMBuffer() + { + } + + // ----------------------------------------------------------------------- + // Buffer Management + // ----------------------------------------------------------------------- + void append (const XMLCh* const chars); + void append (const XMLCh* const chars, const XMLSize_t count); + + void set (const XMLCh* const chars); + void set (const XMLCh* const chars, const XMLSize_t count); + + const XMLCh* getRawBuffer() const + { + fBuffer[fIndex] = 0; + return fBuffer; + } + + void reset() + { + fIndex = 0; + fBuffer[0] = 0; + } + + void chop + ( + const XMLSize_t count + ) + { + fBuffer[count] = 0; + fIndex = count; + } + + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + XMLSize_t getLen() const + { + return fIndex; + } + + XMLSize_t getCapacity() const + { + return fCapacity; + } + + // ----------------------------------------------------------------------- + // Private helpers + // ----------------------------------------------------------------------- + void expandCapacity(const XMLSize_t extraNeeded); + + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fBuffer + // The pointer to the buffer data. Its grown as needed. Its always + // one larger than fCapacity, to leave room for the null terminator. + // + // fIndex + // The current index into the buffer, as characters are appended + // to it. If its zero, then the buffer is empty. + // + // fCapacity + // The current capacity of the buffer. Its actually always one + // larger, to leave room for the null terminator. + // + // fDoc + // For allocating memory + // ----------------------------------------------------------------------- + XMLCh* fBuffer; + XMLSize_t fIndex; + XMLSize_t fCapacity; + DOMDocumentImpl* fDoc; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMBuffer(const DOMBuffer &); + DOMBuffer & operator = (const DOMBuffer &); +}; + +inline void DOMBuffer:: +append (const XMLCh* const chars) +{ + XMLSize_t count = XMLString::stringLen(chars); + if (fIndex + count >= fCapacity) + expandCapacity(count); + + memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh)); + fIndex += count; + + // Keep it null terminated + fBuffer[fIndex] = 0; +} + +inline void DOMBuffer:: +append (const XMLCh* const chars, const XMLSize_t count) +{ + if (fIndex + count >= fCapacity) + expandCapacity(count); + + memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh)); + fIndex += count; + + // Keep it null terminated + fBuffer[fIndex] = 0; +} + +inline void DOMBuffer:: +set (const XMLCh* const chars) +{ + XMLSize_t count = XMLString::stringLen(chars); + fIndex = 0; + if (count >= fCapacity) + expandCapacity(count); + + memcpy(fBuffer, chars, count * sizeof(XMLCh)); + fIndex = count; + + // Keep it null terminated + fBuffer[fIndex] = 0; +} + +inline void DOMBuffer:: +set (const XMLCh* const chars, const XMLSize_t count) +{ + fIndex = 0; + if (count >= fCapacity) + expandCapacity(count); + + memcpy(fBuffer, chars, count * sizeof(XMLCh)); + fIndex = count; + + // Keep it null terminated + fBuffer[fIndex] = 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.cpp new file mode 100644 index 000000000..62895b58a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.cpp @@ -0,0 +1,326 @@ +/* + * 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: DOMTextImpl.cpp 678709 2008-07-22 10:56:56Z borisk $ + */ + + +#include + +#include +#include +#include +#include +#include +#include + +#include "DOMDocumentImpl.hpp" +#include "DOMStringPool.hpp" +#include "DOMTextImpl.hpp" +#include "DOMCharacterDataImpl.hpp" +#include "DOMChildNode.hpp" +#include "DOMRangeImpl.hpp" +#include "DOMCasts.hpp" + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMDocument; + +DOMTextImpl::DOMTextImpl(DOMDocument *ownerDoc, const XMLCh *dat) + : fNode(ownerDoc), fCharacterData(ownerDoc, dat) +{ + fNode.setIsLeafNode(true); +} + +DOMTextImpl:: +DOMTextImpl(DOMDocument *ownerDoc, const XMLCh* dat, XMLSize_t n) + : fNode(ownerDoc), fCharacterData(ownerDoc, dat, n) +{ + fNode.setIsLeafNode(true); +} + +DOMTextImpl::DOMTextImpl(const DOMTextImpl &other, bool) + : DOMText(other) + , fNode(other.fNode) + , fCharacterData(other.fCharacterData) +{ + fNode.setIsLeafNode(true); +} + +DOMTextImpl::~DOMTextImpl() +{ +} + + +DOMNode *DOMTextImpl::cloneNode(bool deep) const +{ + DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::TEXT_OBJECT) DOMTextImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +const XMLCh * DOMTextImpl::getNodeName() const { + static const XMLCh gtext[] = {chPound, chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull}; + return gtext; +} + +DOMNode::NodeType DOMTextImpl::getNodeType() const { + return DOMNode::TEXT_NODE; +} + + +DOMText *DOMTextImpl::splitText(XMLSize_t offset) +{ + if (fNode.isReadOnly()) + { + throw DOMException( + DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + XMLSize_t len = fCharacterData.fDataBuf->getLen(); + if (offset > len) + throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager); + + DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument(); + DOMText *newText = doc->createTextNode( + this->substringData(offset, len - offset)); + + DOMNode *parent = getParentNode(); + if (parent != 0) + parent->insertBefore(newText, getNextSibling()); + + fCharacterData.fDataBuf->chop(offset); + + if (doc != 0) { + Ranges* ranges = doc->getRanges(); + if (ranges != 0) { + XMLSize_t sz = ranges->size(); + if (sz != 0) { + for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset); + } + } + } + } + + return newText; +} + + +bool DOMTextImpl::isIgnorableWhitespace() const +{ + return fNode.ignorableWhitespace(); +} + + + +void DOMTextImpl::setIgnorableWhitespace(bool ignorable) +{ + fNode.ignorableWhitespace(ignorable); +} + + +bool DOMTextImpl::getIsElementContentWhitespace() const +{ + return isIgnorableWhitespace(); +} + +const XMLCh* DOMTextImpl::getWholeText() const +{ + DOMDocument *doc = getOwnerDocument(); + DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true); + pWalker->setCurrentNode((DOMNode*)this); + // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in + // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) + { + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + } + XMLBuffer buff(1023, GetDOMNodeMemoryManager); + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE) + buff.append(nextNode->getNodeValue()); + } + pWalker->release(); + + XMLCh* wholeString = (XMLCh*) (GetDOMNodeMemoryManager->allocate((buff.getLen()+1)*sizeof(XMLCh))); + XMLString::copyString(wholeString, buff.getRawBuffer()); + return wholeString; +} + +DOMText* DOMTextImpl::replaceWholeText(const XMLCh* newText) +{ + DOMDocument *doc = getOwnerDocument(); + DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true); + pWalker->setCurrentNode((DOMNode*)this); + // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in + // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. + DOMNode* pFirstTextNode=this; + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) + { + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + pFirstTextNode=prevNode; + } + // before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text + DOMNode* pCurrentNode=pWalker->getCurrentNode(); + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE) + { + DOMTreeWalker* pInnerWalker=doc->createTreeWalker(nextNode, DOMNodeFilter::SHOW_ALL, NULL, true); + while(pInnerWalker->nextNode()) + { + short nodeType=pInnerWalker->getCurrentNode()->getNodeType(); + if(nodeType!=ENTITY_REFERENCE_NODE && nodeType!=TEXT_NODE && nodeType!=CDATA_SECTION_NODE) + throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager); + } + pInnerWalker->release(); + } + } + DOMText* retVal=NULL; + // if the first node in the chain is a text node, replace its content, otherwise create a new node + if(newText && *newText) + { + if(!castToNodeImpl(pFirstTextNode)->isReadOnly() && (pFirstTextNode->getNodeType()==TEXT_NODE || pFirstTextNode->getNodeType()==CDATA_SECTION_NODE)) + { + pFirstTextNode->setNodeValue(newText); + retVal=(DOMText*)pFirstTextNode; + } + else + { + if(getNodeType()==TEXT_NODE) + retVal=doc->createTextNode(newText); + else + retVal=doc->createCDATASection(newText); + pFirstTextNode->getParentNode()->insertBefore(retVal, pFirstTextNode); + } + } + // now delete all the following text nodes + pWalker->setCurrentNode(pCurrentNode); + while((nextNode=pWalker->nextNode())!=NULL) + { + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + break; + if(nextNode!=retVal) + { + // keep the tree walker valid + pWalker->previousNode(); + nextNode->getParentNode()->removeChild(nextNode); + nextNode->release(); + } + } + pWalker->release(); + return retVal; +} + + +void DOMTextImpl::release() +{ + if (fNode.isOwned() && !fNode.isToBeReleased()) + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + + DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument(); + if (doc) { + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0); + fCharacterData.releaseBuffer(); + doc->release(this, DOMMemoryManager::TEXT_OBJECT); + } + else { + // shouldn't reach here + throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager); + } +} + +// +// Delegation functions +// + DOMNode* DOMTextImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); } + DOMNamedNodeMap* DOMTextImpl::getAttributes() const {return fNode.getAttributes (); } + DOMNodeList* DOMTextImpl::getChildNodes() const {return fNode.getChildNodes (); } + DOMNode* DOMTextImpl::getFirstChild() const {return fNode.getFirstChild (); } + DOMNode* DOMTextImpl::getLastChild() const {return fNode.getLastChild (); } + const XMLCh* DOMTextImpl::getLocalName() const {return fNode.getLocalName (); } + const XMLCh* DOMTextImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); } + DOMNode* DOMTextImpl::getNextSibling() const {return fChild.getNextSibling (); } + const XMLCh* DOMTextImpl::getNodeValue() const {return fCharacterData.getNodeValue (); } + DOMDocument* DOMTextImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); } + const XMLCh* DOMTextImpl::getPrefix() const {return fNode.getPrefix (); } + DOMNode* DOMTextImpl::getParentNode() const {return fChild.getParentNode (this); } + DOMNode* DOMTextImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); } + bool DOMTextImpl::hasChildNodes() const {return fNode.hasChildNodes (); } + DOMNode* DOMTextImpl::insertBefore(DOMNode *newChild, DOMNode *refChild) + {return fNode.insertBefore (newChild, refChild); } + void DOMTextImpl::normalize() {fNode.normalize (); } + DOMNode* DOMTextImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); } + DOMNode* DOMTextImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild) + {return fNode.replaceChild (newChild, oldChild); } + bool DOMTextImpl::isSupported(const XMLCh *feature, const XMLCh *version) const + {return fNode.isSupported (feature, version); } + void DOMTextImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); } + bool DOMTextImpl::hasAttributes() const {return fNode.hasAttributes(); } + bool DOMTextImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); } + bool DOMTextImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); } + void* DOMTextImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) + {return fNode.setUserData(key, data, handler); } + void* DOMTextImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); } + const XMLCh* DOMTextImpl::getBaseURI() const {return fNode.getBaseURI(); } + short DOMTextImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); } + const XMLCh* DOMTextImpl::getTextContent() const {return fNode.getTextContent(); } + void DOMTextImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); } + const XMLCh* DOMTextImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); } + bool DOMTextImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); } + const XMLCh* DOMTextImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); } + void* DOMTextImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); } + + + +// +// Delegation of CharacerData functions. +// + + + const XMLCh* DOMTextImpl::getData() const {return fCharacterData.getData();} + XMLSize_t DOMTextImpl::getLength() const {return fCharacterData.getLength();} + const XMLCh* DOMTextImpl::substringData(XMLSize_t offset, XMLSize_t count) const + {return fCharacterData.substringData(this, offset, count);} + void DOMTextImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);} + void DOMTextImpl::insertData(XMLSize_t offset, const XMLCh *arg) + {fCharacterData.insertData(this, offset, arg);} + void DOMTextImpl::deleteData(XMLSize_t offset, XMLSize_t count) + {fCharacterData.deleteData(this, offset, count);} + void DOMTextImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg) + {fCharacterData.replaceData(this, offset, count, arg);} + void DOMTextImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);} + void DOMTextImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); } + + void DOMTextImpl::appendData(const XMLCh *arg, XMLSize_t n) {fCharacterData.appendData(this, arg, n);} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.hpp new file mode 100644 index 000000000..deb47ee05 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTextImpl.hpp @@ -0,0 +1,103 @@ +/* + * 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: DOMTextImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTEXTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTEXTIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + + +#include +#include + +#include "DOMChildNode.hpp" +#include "DOMNodeImpl.hpp" +#include "DOMCharacterDataImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMTextImpl: public DOMText { +public: + DOMNodeImpl fNode; + DOMChildNode fChild; + DOMCharacterDataImpl fCharacterData; + +public: + DOMTextImpl(DOMDocument* ownerDoc, const XMLCh* data); + DOMTextImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n); + DOMTextImpl(const DOMTextImpl& other, bool deep=false); + + virtual ~DOMTextImpl(); + virtual DOMText* splitText(XMLSize_t offset); + // DOM Level 3 + virtual bool getIsElementContentWhitespace() const; + virtual const XMLCh* getWholeText() const; + virtual DOMText* replaceWholeText(const XMLCh* content); + + // non-standard extension + virtual bool isIgnorableWhitespace() const; + +public: + // Declare the functions coming from DOMNode. + DOMNODE_FUNCTIONS; + +public: + // All of the functions coming from DOMCharacterData + virtual const XMLCh* getData() const; + virtual XMLSize_t getLength() const; + virtual const XMLCh* substringData(XMLSize_t offset, + XMLSize_t count) const; + virtual void appendData(const XMLCh *arg); + virtual void insertData(XMLSize_t offset, const XMLCh *arg); + virtual void deleteData(XMLSize_t offset, + XMLSize_t count); + virtual void replaceData(XMLSize_t offset, + XMLSize_t count, + const XMLCh *arg); + virtual void setData(const XMLCh *data); + + // Non-standard extension. + // + virtual void appendData(const XMLCh *arg, XMLSize_t n); + +protected: + virtual void setIgnorableWhitespace(bool ignorable); + friend class AbstractDOMParser; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMTextImpl & operator = (const DOMTextImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp new file mode 100644 index 000000000..9fe5dc436 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp @@ -0,0 +1,484 @@ +/* + * 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: DOMTreeWalkerImpl.cpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#include "DOMTreeWalkerImpl.hpp" +#include "DOMDocumentImpl.hpp" + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** constructor */ +DOMTreeWalkerImpl::DOMTreeWalkerImpl ( + DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* nodeFilter, + bool expandEntityRef) +: fWhatToShow(whatToShow), + fNodeFilter(nodeFilter), + fCurrentNode(root), + fRoot(root), + fExpandEntityReferences(expandEntityRef) +{ +} + + +DOMTreeWalkerImpl::DOMTreeWalkerImpl (const DOMTreeWalkerImpl& twi) +: DOMTreeWalker(twi), + fWhatToShow(twi.fWhatToShow), + fNodeFilter(twi.fNodeFilter), + fCurrentNode(twi.fCurrentNode), + fRoot(twi.fRoot), + fExpandEntityReferences(twi.fExpandEntityReferences) +{ +} + + +DOMTreeWalkerImpl& DOMTreeWalkerImpl::operator= (const DOMTreeWalkerImpl& twi) { + if (this != &twi) + { + fCurrentNode = twi.fCurrentNode; + fRoot = twi.fRoot; + fWhatToShow = twi.fWhatToShow; + fNodeFilter = twi.fNodeFilter; + fExpandEntityReferences = twi.fExpandEntityReferences; + } + + return *this; +} + + + +/** Return the root node */ +DOMNode* DOMTreeWalkerImpl::getRoot () { + return fRoot; +} + + +/** Return the whatToShow value */ +DOMNodeFilter::ShowType DOMTreeWalkerImpl::getWhatToShow () { + return fWhatToShow; +} + + +/** Return the NodeFilter */ +DOMNodeFilter* DOMTreeWalkerImpl::getFilter () { + return fNodeFilter; +} + +/** Get the expandEntity reference flag. */ +bool DOMTreeWalkerImpl::getExpandEntityReferences() { + return fExpandEntityReferences; +} + + + +/** Return the current Node. */ +DOMNode* DOMTreeWalkerImpl::getCurrentNode () { + + return fCurrentNode; +} + + +/** Return the current Node. */ +void DOMTreeWalkerImpl::setCurrentNode (DOMNode* node) { + + if (!node) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMTreeWalkerMemoryManager); + + fCurrentNode = node; +} + + +/** Return the parent Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ +DOMNode* DOMTreeWalkerImpl::parentNode () { + + if (!fCurrentNode) return 0; + + DOMNode* node = getParentNode(fCurrentNode); + if (node != 0) { + fCurrentNode = node; + } + return node; + +} + + +/** Return the first child Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ +DOMNode* DOMTreeWalkerImpl::firstChild () { + + if (!fCurrentNode) return 0; + + if(!fExpandEntityReferences && fCurrentNode->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + return 0; + + DOMNode* node = getFirstChild(fCurrentNode); + + if (node != 0) { + fCurrentNode = node; + } + return node; +} + + +/** Return the last child Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ +DOMNode* DOMTreeWalkerImpl::lastChild () { + + if (!fCurrentNode) return 0; + + if(!fExpandEntityReferences && fCurrentNode->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + return 0; + + DOMNode* node = getLastChild(fCurrentNode); + if (node != 0) { + fCurrentNode = node; + } + return node; +} + + +/** Return the previous sibling Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ + +DOMNode* DOMTreeWalkerImpl::previousSibling () { + + if (!fCurrentNode) return 0; + + DOMNode* node = getPreviousSibling(fCurrentNode); + if (node != 0) { + fCurrentNode = node; + } + return node; +} + + +/** Return the next sibling Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ + +DOMNode* DOMTreeWalkerImpl::nextSibling () { + + if (!fCurrentNode) return 0; + + DOMNode* node = getNextSibling(fCurrentNode); + if (node != 0) { + fCurrentNode = node; + } + return node; +} + + +/** Return the previous Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ + +DOMNode* DOMTreeWalkerImpl::previousNode () { + + if (!fCurrentNode) return 0; + + // get sibling + DOMNode* node = getPreviousSibling(fCurrentNode); + if (node == 0) { + node = getParentNode(fCurrentNode); + if ( node != 0) { + fCurrentNode = node; + } + return node; + } + else { + + // get the lastChild of result. + DOMNode* lastChild = getLastChild(node); + + // if there is a lastChild which passes filters return it. + if (lastChild != 0) { + fCurrentNode = lastChild; + } + else { + fCurrentNode = node; + } + return fCurrentNode; + } +} + + +/** Return the next Node from the current node, + * after applying filter, whatToshow. + * If result is not null, set the current Node. + */ + +DOMNode* DOMTreeWalkerImpl::nextNode () { + + if (!fCurrentNode) return 0; + + DOMNode* node = getFirstChild(fCurrentNode); + + if (node != 0) { + fCurrentNode = node; + return node; + } + else { + + node = getNextSibling(fCurrentNode); + + if (node != 0) { + fCurrentNode = node; + return node; + } + else { + + // return parent's 1st sibling. + DOMNode* parent = getParentNode(fCurrentNode); + while ( parent != 0) { + node = getNextSibling(parent); + if (node != 0) { + fCurrentNode = node; + return node; + } else { + parent = getParentNode(parent); + } + } + return node; + } + } +} + + +/** Internal function. + * Return the parent Node, from the input node + * after applying filter, whatToshow. + * The current node is not consulted or set. + */ + +DOMNode* DOMTreeWalkerImpl::getParentNode (DOMNode* node) { + + if (!node || node == fRoot) return 0; + + DOMNode* newNode = node->getParentNode(); + if (!newNode) return 0; + + short accept = acceptNode(newNode); + + if (accept == DOMNodeFilter::FILTER_ACCEPT) + return newNode; + + return getParentNode(newNode); + +} + + +/** Internal function. + * Return the nextSibling Node, from the input node + * after applying filter, whatToshow. + * The current node is not consulted or set. + */ + +DOMNode* DOMTreeWalkerImpl::getNextSibling (DOMNode* node) { + + if (!node || node == fRoot) return 0; + + DOMNode* newNode = node->getNextSibling(); + if (!newNode) { + + newNode = node->getParentNode(); + + if (!newNode || node == fRoot) return 0; + + short parentAccept = acceptNode(newNode); + + if (parentAccept == DOMNodeFilter::FILTER_SKIP) { + return getNextSibling(newNode); + } + + return 0; + } + + short accept = acceptNode(newNode); + + if (accept == DOMNodeFilter::FILTER_ACCEPT) + return newNode; + else + if (accept == DOMNodeFilter::FILTER_SKIP) { + DOMNode* fChild = getFirstChild(newNode); + if (!fChild && !newNode->hasChildNodes()) { + return getNextSibling(newNode); + } + return fChild; + } + return getNextSibling(newNode); + +} + + +/** Internal function. + * Return the previous sibling Node, from the input node + * after applying filter, whatToshow. + * The current node is not consulted or set. + */ + +DOMNode* DOMTreeWalkerImpl::getPreviousSibling (DOMNode* node) { + + if (!node || node == fRoot) return 0; + + DOMNode* newNode = node->getPreviousSibling(); + if (!newNode) { + + newNode = node->getParentNode(); + if (!newNode || node == fRoot) return 0; + + short parentAccept = acceptNode(newNode); + + if (parentAccept == DOMNodeFilter::FILTER_SKIP) { + return getPreviousSibling(newNode); + } + + return 0; + } + + short accept = acceptNode(newNode); + + if (accept == DOMNodeFilter::FILTER_ACCEPT) + return newNode; + else + if (accept == DOMNodeFilter::FILTER_SKIP) { + DOMNode* fChild = getLastChild(newNode); + if (!fChild && !newNode->hasChildNodes()) { + return getPreviousSibling(newNode); + } + return fChild; + } + return getPreviousSibling(newNode); + +} + + +/** Internal function. + * Return the first child Node, from the input node + * after applying filter, whatToshow. + * The current node is not consulted or set. + */ + +DOMNode* DOMTreeWalkerImpl::getFirstChild (DOMNode* node) { + + if (!node) return 0; + + if(!fExpandEntityReferences && node->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + return 0; + + DOMNode* newNode = node->getFirstChild(); + if (!newNode) return 0; + + short accept = acceptNode(newNode); + + if (accept == DOMNodeFilter::FILTER_ACCEPT) + return newNode; + else + if (accept == DOMNodeFilter::FILTER_SKIP + && newNode->hasChildNodes()) + { + return getFirstChild(newNode); + } + return getNextSibling(newNode); + +} + + +/** Internal function. + * Return the last child Node, from the input node + * after applying filter, whatToshow. + * The current node is not consulted or set. + */ + +DOMNode* DOMTreeWalkerImpl::getLastChild (DOMNode* node) { + + if (!node) return 0; + + if(!fExpandEntityReferences && node->getNodeType()==DOMNode::ENTITY_REFERENCE_NODE) + return 0; + + DOMNode* newNode = node->getLastChild(); + if (!newNode) return 0; + + short accept = acceptNode(newNode); + + if (accept == DOMNodeFilter::FILTER_ACCEPT) + return newNode; + else + if (accept == DOMNodeFilter::FILTER_SKIP + && newNode->hasChildNodes()) + { + return getLastChild(newNode); + } + return getPreviousSibling(newNode); + +} + + +/** The node is accepted if it passes the whatToShow and the filter. */ + +short DOMTreeWalkerImpl::acceptNode (DOMNode* node) { + + if (fNodeFilter == 0) { + if ( ( fWhatToShow & (1 << (node->getNodeType() - 1))) != 0) + { + return DOMNodeFilter::FILTER_ACCEPT; + } + else + { + return DOMNodeFilter::FILTER_SKIP; + } + } else { + // REVISIT: This logic is unclear from the spec! + if ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0 ) { + return fNodeFilter->acceptNode(node); + } else { + // what to show has failed! + if (fNodeFilter->acceptNode(node) == DOMNodeFilter::FILTER_REJECT) { + return DOMNodeFilter::FILTER_REJECT; + } else { + return DOMNodeFilter::FILTER_SKIP; + } + } + } +} + + +void DOMTreeWalkerImpl::release() +{ + // for performance reason, do not recycle pointer + // chance that this is allocated again and again is not usual +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.hpp new file mode 100644 index 000000000..c36ba1e7f --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTreeWalkerImpl.hpp @@ -0,0 +1,168 @@ +/* + * 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: DOMTreeWalkerImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTREEWALKERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTREEWALKERIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class CDOM_EXPORT DOMTreeWalkerImpl : public DOMTreeWalker { +protected: + // The whatToShow mask. + DOMNodeFilter::ShowType fWhatToShow; + + // The NodeFilter reference. + DOMNodeFilter* fNodeFilter; + + // The current Node. + DOMNode* fCurrentNode; + + // The root Node. + DOMNode* fRoot; + + // The expandEntity reference flag. + bool fExpandEntityReferences; + +public: + // Implementation Note: No state is kept except the data above + // (fWhatToShow, fNodeFilter, fCurrentNode, fRoot) such that + // setters could be created for these data values and the + // implementation will still work. + + /** Public constructor */ + DOMTreeWalkerImpl ( + DOMNode* root, + DOMNodeFilter::ShowType whatToShow, + DOMNodeFilter* nodeFilter, + bool expandEntityRef); + DOMTreeWalkerImpl (const DOMTreeWalkerImpl& twi); + DOMTreeWalkerImpl& operator= (const DOMTreeWalkerImpl& twi); + + // Return the root node. + virtual DOMNode* getRoot (); + + // Return the whatToShow value. + virtual DOMNodeFilter::ShowType getWhatToShow (); + + // Return the NodeFilter. + virtual DOMNodeFilter* getFilter (); + + + // Return the current DOMNode. + virtual DOMNode* getCurrentNode (); + + // Return the current Node. + virtual void setCurrentNode (DOMNode* node); + + // Return the parent Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* parentNode (); + + // Return the first child Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* firstChild (); + + // Return the last child Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* lastChild (); + + // Return the previous sibling Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* previousSibling (); + + // Return the next sibling Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + + virtual DOMNode* nextSibling (); + // Return the previous Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* previousNode (); + + // Return the next Node from the current node, + // after applying filter, whatToshow. + // If result is not null, set the current Node. + virtual DOMNode* nextNode (); + + // Get the expandEntity reference flag. + virtual bool getExpandEntityReferences(); + + // release the resource + virtual void release(); + +protected: + + // Internal function. + // Return the parent Node, from the input node + // after applying filter, whatToshow. + // The current node is not consulted or set. + DOMNode* getParentNode (DOMNode* node); + + // Internal function. + // Return the nextSibling Node, from the input node + // after applying filter, whatToshow. + // The current node is not consulted or set. + DOMNode* getNextSibling (DOMNode* node); + + // Internal function. + // Return the previous sibling Node, from the input node + // after applying filter, whatToshow. + // The current node is not consulted or set. + DOMNode* getPreviousSibling (DOMNode* node); + + // Internal function. + // Return the first child Node, from the input node + // after applying filter, whatToshow. + // The current node is not consulted or set. + DOMNode* getFirstChild (DOMNode* node); + + // Internal function. + // Return the last child Node, from the input node + // after applying filter, whatToshow. + // The current node is not consulted or set. + DOMNode* getLastChild (DOMNode* node); + + // The node is accepted if it passes the whatToShow and the filter. + short acceptNode (DOMNode* node); + + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp new file mode 100644 index 000000000..90786b12b --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.cpp @@ -0,0 +1,186 @@ +/* + * 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. + */ + +#include "DOMTypeInfoImpl.hpp" +#include "DOMDocumentImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedElement; +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdNotValidatedAttribute; +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedCDATAAttribute(XMLUni::fgInfosetURIName, XMLUni::fgCDATAString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedIDAttribute(XMLUni::fgInfosetURIName, XMLUni::fgIDString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedIDREFAttribute(XMLUni::fgInfosetURIName, XMLUni::fgIDRefString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedIDREFSAttribute(XMLUni::fgInfosetURIName, XMLUni::fgIDRefsString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedENTITYAttribute(XMLUni::fgInfosetURIName, XMLUni::fgEntityString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedENTITIESAttribute(XMLUni::fgInfosetURIName, XMLUni::fgEntitiesString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedNMTOKENAttribute(XMLUni::fgInfosetURIName, XMLUni::fgNmTokenString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedNMTOKENSAttribute(XMLUni::fgInfosetURIName, XMLUni::fgNmTokensString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedNOTATIONAttribute(XMLUni::fgInfosetURIName, XMLUni::fgNotationString); +/*static*/ DOMTypeInfoImpl DOMTypeInfoImpl::g_DtdValidatedENUMERATIONAttribute(XMLUni::fgInfosetURIName, XMLUni::fgEnumerationString); + +DOMTypeInfoImpl::DOMTypeInfoImpl(const XMLCh* namespaceUri/*=0*/, const XMLCh* name/*=0*/) +: fBitFields(0), + fTypeName(name), + fTypeNamespace(namespaceUri), + fMemberTypeName(0), + fMemberTypeNamespace(0), + fDefaultValue(0), + fNormalizedValue(0) +{ + // by setting the fBitField to 0 we are also setting: + // - [validity]=VALIDITY_NOTKNOWN + // - [validitation attempted]=VALIDATION_NONE + // - [schema specified]=false +} + +DOMTypeInfoImpl::DOMTypeInfoImpl(DOMDocumentImpl* ownerDoc, const DOMPSVITypeInfo* sourcePSVI) +: fBitFields(0), + fTypeName(0), + fTypeNamespace(0), + fMemberTypeName(0), + fMemberTypeNamespace(0), + fDefaultValue(0), + fNormalizedValue(0) +{ + setNumericProperty(DOMPSVITypeInfo::PSVI_Validity, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Validity)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Nil, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Nil)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous)); + setNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified, + sourcePSVI->getNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified)); + + setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name))); + setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace))); + setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name))); + setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace))); + setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default))); + setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value, + ownerDoc->getPooledString(sourcePSVI->getStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value))); +} + +const XMLCh* DOMTypeInfoImpl::getTypeName() const { + // if it's a DTD, return the data that was stored + if(!getNumericProperty(PSVI_Schema_Specified)) + return fTypeName; + // if [validity] is "invalid" or "notKnown", the {target namespace} and {name} properties of the declared type if available, otherwise null. + if(!getNumericProperty(PSVI_Validity)) + return fTypeName; + if(fMemberTypeName) + return fMemberTypeName; + return fTypeName; +} + +const XMLCh* DOMTypeInfoImpl::getTypeNamespace() const { + // if it's a DTD, return the data that was stored + if(!getNumericProperty(PSVI_Schema_Specified)) + return fTypeNamespace; + // if [validity] is "invalid" or "notKnown", the {target namespace} and {name} properties of the declared type if available, otherwise null. + if(!getNumericProperty(PSVI_Validity)) + return fTypeNamespace; + if(fMemberTypeName) // we check on the name, as the URI can be NULL + return fMemberTypeNamespace; + return fTypeNamespace; +} + +bool DOMTypeInfoImpl::isDerivedFrom(const XMLCh* typeNamespaceArg, const XMLCh* typeNameArg, DerivationMethods) const +{ + // if it's a DTD, return false + if(!getNumericProperty(PSVI_Schema_Specified)) + return false; + if(XMLString::equals(typeNamespaceArg, getTypeNamespace()) && XMLString::equals(typeNameArg, getTypeName())) + return true; + // TODO: need a pointer to the Grammar object + return false; +} + +const XMLCh* DOMTypeInfoImpl::getStringProperty(PSVIProperty prop) const { + switch(prop) + { + case PSVI_Type_Definition_Name: return fTypeName; + case PSVI_Type_Definition_Namespace: return fTypeNamespace; + case PSVI_Member_Type_Definition_Name: return fMemberTypeName; + case PSVI_Member_Type_Definition_Namespace: return fMemberTypeNamespace; + case PSVI_Schema_Default: return fDefaultValue; + case PSVI_Schema_Normalized_Value: return fNormalizedValue; + default: assert(false); /* it's not a string property */ + } + return 0; +} + +int DOMTypeInfoImpl::getNumericProperty(PSVIProperty prop) const { + switch(prop) + { + case PSVI_Validity: return (PSVIItem::VALIDITY_STATE)(fBitFields & 0x0003); + case PSVI_Validation_Attempted: return (PSVIItem::ASSESSMENT_TYPE)((fBitFields >> 2) & 0x0003); + case PSVI_Type_Definition_Type: return (fBitFields & (1 << 5))?XSTypeDefinition::COMPLEX_TYPE:XSTypeDefinition::SIMPLE_TYPE; + case PSVI_Type_Definition_Anonymous: return (fBitFields & (1 << 6))?true:false; + case PSVI_Nil: return (fBitFields & (1 << 7))?true:false; + case PSVI_Member_Type_Definition_Anonymous: return (fBitFields & (1 << 8))?true:false; + case PSVI_Schema_Specified: return (fBitFields & (1 << 9))?true:false; + default: assert(false); /* it's not a numeric property */ + } + return 0; +} + +void DOMTypeInfoImpl::setStringProperty(PSVIProperty prop, const XMLCh* value) { + switch(prop) + { + case PSVI_Type_Definition_Name: fTypeName=value; break; + case PSVI_Type_Definition_Namespace: fTypeNamespace=value; break; + case PSVI_Member_Type_Definition_Name: fMemberTypeName=value; break; + case PSVI_Member_Type_Definition_Namespace: fMemberTypeNamespace=value; break; + case PSVI_Schema_Default: fDefaultValue=value; break; + case PSVI_Schema_Normalized_Value: fNormalizedValue=value; break; + default: assert(false); /* it's not a string property */ + } +} + +void DOMTypeInfoImpl::setNumericProperty(PSVIProperty prop, int value) { + switch(prop) + { + case PSVI_Validity: fBitFields |= (value & 0x0003); break; + case PSVI_Validation_Attempted: fBitFields |= ((value & 0x0003) << 2); break; + case PSVI_Type_Definition_Type: fBitFields |= (value==XSTypeDefinition::COMPLEX_TYPE)?(1 << 5):0; break; + case PSVI_Type_Definition_Anonymous: fBitFields |= (value!=0)?(1 << 6):0; break; + case PSVI_Nil: fBitFields |= (value!=0)?(1 << 7):0; break; + case PSVI_Member_Type_Definition_Anonymous: fBitFields |= (value!=0)?(1 << 8):0; break; + case PSVI_Schema_Specified: fBitFields |= (value!=0)?(1 << 9):0; break; + default: assert(false); /* it's not a numeric property */ + } +} + + +XERCES_CPP_NAMESPACE_END +/** + * End of file DOMTypeInfo.cpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.hpp new file mode 100644 index 000000000..f290fe1fe --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMTypeInfoImpl.hpp @@ -0,0 +1,106 @@ +/* + * 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. + */ + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#if !defined(XERCESC_INCLUDE_GUARD_DOMTYPEINFOIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMTYPEINFOIMPL_HPP + +//------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------ +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMDocumentImpl; + +class CDOM_EXPORT DOMTypeInfoImpl : public DOMTypeInfo, public DOMPSVITypeInfo +{ +public: + + //----------------------------------------------------------------------------------- + // Constructor + //----------------------------------------------------------------------------------- + DOMTypeInfoImpl(const XMLCh* namespaceUri=0, const XMLCh* name=0); + DOMTypeInfoImpl(DOMDocumentImpl* ownerDoc, const DOMPSVITypeInfo* sourcePSVI); + + static DOMTypeInfoImpl g_DtdValidatedElement; + static DOMTypeInfoImpl g_DtdNotValidatedAttribute; + static DOMTypeInfoImpl g_DtdValidatedCDATAAttribute; + static DOMTypeInfoImpl g_DtdValidatedIDAttribute; + static DOMTypeInfoImpl g_DtdValidatedIDREFAttribute; + static DOMTypeInfoImpl g_DtdValidatedIDREFSAttribute; + static DOMTypeInfoImpl g_DtdValidatedENTITYAttribute; + static DOMTypeInfoImpl g_DtdValidatedENTITIESAttribute; + static DOMTypeInfoImpl g_DtdValidatedNMTOKENAttribute; + static DOMTypeInfoImpl g_DtdValidatedNMTOKENSAttribute; + static DOMTypeInfoImpl g_DtdValidatedNOTATIONAttribute; + static DOMTypeInfoImpl g_DtdValidatedENUMERATIONAttribute; + + // ----------------------------------------------------------------------- + // DOMTypeInfo interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getTypeName() const; + virtual const XMLCh* getTypeNamespace() const; + virtual bool isDerivedFrom(const XMLCh* typeNamespaceArg, const XMLCh* typeNameArg, DerivationMethods derivationMethod) const; + + // ----------------------------------------------------------------------- + // DOMPSVITypeInfo interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getStringProperty(PSVIProperty prop) const; + virtual int getNumericProperty(PSVIProperty prop) const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + virtual void setStringProperty(PSVIProperty prop, const XMLCh* value); + virtual void setNumericProperty(PSVIProperty prop, int value); + +protected: + int fBitFields; + const XMLCh* fTypeName; + const XMLCh* fTypeNamespace; + const XMLCh* fMemberTypeName; + const XMLCh* fMemberTypeNamespace; + const XMLCh* fDefaultValue; + const XMLCh* fNormalizedValue; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMTypeInfoImpl (const DOMTypeInfoImpl&); + DOMTypeInfoImpl & operator = (const DOMTypeInfoImpl &); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DOMTypeInfo.hpp + */ diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp new file mode 100644 index 000000000..f832d8a87 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.cpp @@ -0,0 +1,216 @@ +/* + * 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. + */ + +#include "DOMXPathExpressionImpl.hpp" +#include "DOMXPathResultImpl.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class WrapperForXPathNSResolver : public XercesNamespaceResolver +{ +public: + WrapperForXPathNSResolver(XMLStringPool* pool, const DOMXPathNSResolver *resolver, MemoryManager* const manager) : + fStringPool(pool), + fResolver(resolver), + fMemoryManager(manager) + { + } + + virtual unsigned int getNamespaceForPrefix(const XMLCh* const prefix) const + { + if(fResolver==NULL) + throw DOMException(DOMException::NAMESPACE_ERR, 0, fMemoryManager); + const XMLCh* nsUri=fResolver->lookupNamespaceURI(prefix); + if(nsUri==NULL) + throw DOMException(DOMException::NAMESPACE_ERR, 0, fMemoryManager); + return fStringPool->addOrFind(nsUri); + } + +protected: + XMLStringPool* fStringPool; + const DOMXPathNSResolver * fResolver; + MemoryManager* const fMemoryManager; +}; + + +typedef JanitorMemFunCall CleanupType; + +DOMXPathExpressionImpl::DOMXPathExpressionImpl(const XMLCh *expression, const DOMXPathNSResolver *resolver, MemoryManager* const manager) : + fStringPool(NULL), + fParsedExpression(NULL), + fExpression(NULL), + fMoveToRoot(false), + fMemoryManager(manager) +{ + if(expression==NULL || *expression==0) + throw DOMXPathException(DOMXPathException::INVALID_EXPRESSION_ERR, 0, fMemoryManager); + + CleanupType cleanup(this, &DOMXPathExpressionImpl::cleanUp); + fStringPool = new (fMemoryManager) XMLStringPool(109, fMemoryManager); + // XercesPath will complain if the expression starts with '/', add a "." in front of it and start from the document root + if(*expression==chForwardSlash) + { + fExpression=(XMLCh*)fMemoryManager->allocate((XMLString::stringLen(expression)+2)*sizeof(XMLCh)); + *fExpression = chPeriod; + *(fExpression+1) = chNull; + XMLString::catString(fExpression, expression); + fMoveToRoot=true; + } + else + fExpression=XMLString::replicate(expression); + + try + { + WrapperForXPathNSResolver wrappedResolver(fStringPool, resolver, fMemoryManager); + fParsedExpression = new (fMemoryManager) XercesXPath(fExpression, fStringPool, &wrappedResolver, 0, true, fMemoryManager); + } + catch(const XPathException& ) + { + throw DOMXPathException(DOMXPathException::INVALID_EXPRESSION_ERR, 0, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +DOMXPathExpressionImpl::~DOMXPathExpressionImpl() +{ + cleanUp(); +} + +void DOMXPathExpressionImpl::cleanUp() +{ + XMLString::release(&fExpression, fMemoryManager); + delete fParsedExpression; + delete fStringPool; +} + +DOMXPathResult* DOMXPathExpressionImpl::evaluate(const DOMNode *contextNode, + DOMXPathResult::ResultType type, + DOMXPathResult* result) const +{ + if(type!=DOMXPathResult::FIRST_ORDERED_NODE_TYPE && type!=DOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE && + type!=DOMXPathResult::ANY_UNORDERED_NODE_TYPE && type!=DOMXPathResult::UNORDERED_NODE_SNAPSHOT_TYPE) + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); + + if(contextNode==NULL || contextNode->getNodeType()!=DOMNode::ELEMENT_NODE) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); + + JanitorMemFunCall r_cleanup ( + 0, &DOMXPathResultImpl::release); + DOMXPathResultImpl* r=(DOMXPathResultImpl*)result; + if(r==NULL) + { + r=new (fMemoryManager) DOMXPathResultImpl(type, fMemoryManager); + r_cleanup.reset (r); + } + else + r->reset(type); + + XPathMatcher matcher(fParsedExpression, fMemoryManager); + matcher.startDocumentFragment(); + + if(fMoveToRoot) + { + contextNode=contextNode->getOwnerDocument(); + if(contextNode==NULL) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager); + + QName qName(contextNode->getNodeName(), 0, fMemoryManager); + SchemaElementDecl elemDecl(&qName); + RefVectorOf attrList(0, true, fMemoryManager); + matcher.startElement(elemDecl, 0, XMLUni::fgZeroLenString, attrList, 0); + DOMNode* child=contextNode->getFirstChild(); + while(child) + { + if(child->getNodeType()==DOMNode::ELEMENT_NODE) + testNode(&matcher, r, (DOMElement*)child); + child=child->getNextSibling(); + } + matcher.endElement(elemDecl, XMLUni::fgZeroLenString); + } + else + testNode(&matcher, r, (DOMElement*)contextNode); + + r_cleanup.release (); + return r; +} + +bool DOMXPathExpressionImpl::testNode(XPathMatcher* matcher, DOMXPathResultImpl* result, DOMElement *node) const +{ + int uriId=fStringPool->addOrFind(node->getNamespaceURI()); + QName qName(node->getNodeName(), uriId, fMemoryManager); + SchemaElementDecl elemDecl(&qName); + DOMNamedNodeMap* attrMap=node->getAttributes(); + XMLSize_t attrCount = attrMap->getLength(); + RefVectorOf attrList(attrCount, true, fMemoryManager); + for(XMLSize_t i=0;iitem(i); + attrList.addElement(new (fMemoryManager) XMLAttr(fStringPool->addOrFind(attr->getNamespaceURI()), + attr->getNodeName(), + attr->getNodeValue(), + XMLAttDef::CData, + attr->getSpecified(), + fMemoryManager, + NULL, + true)); + } + matcher->startElement(elemDecl, uriId, node->getPrefix(), attrList, attrCount); + unsigned char nMatch=matcher->isMatched(); + if(nMatch!=0 && nMatch!=XPathMatcher::XP_MATCHED_DP) + { + result->addResult(node); + if(result->getResultType()==DOMXPathResult::ANY_UNORDERED_NODE_TYPE || result->getResultType()==DOMXPathResult::FIRST_ORDERED_NODE_TYPE) + return true; // abort navigation, we found one result + } + + if(nMatch==0 || nMatch==XPathMatcher::XP_MATCHED_D || nMatch==XPathMatcher::XP_MATCHED_DP) + { + DOMNode* child=node->getFirstChild(); + while(child) + { + if(child->getNodeType()==DOMNode::ELEMENT_NODE) + if(testNode(matcher, result, (DOMElement*)child)) + return true; + child=child->getNextSibling(); + } + } + matcher->endElement(elemDecl, XMLUni::fgZeroLenString); + return false; +} + +void DOMXPathExpressionImpl::release() +{ + DOMXPathExpressionImpl* me = this; + delete me; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.hpp new file mode 100644 index 000000000..efeec369c --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathExpressionImpl.hpp @@ -0,0 +1,69 @@ +/* + * 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: DOMXPathExpressionImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSIONIMPL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElement; +class XercesXPath; +class XPathMatcher; +class DOMXPathResultImpl; +class DOMXPathNSResolver; +class XMLStringPool; + +class CDOM_EXPORT DOMXPathExpressionImpl : public XMemory, + public DOMXPathExpression +{ +public: + DOMXPathExpressionImpl(const XMLCh *expression, + const DOMXPathNSResolver *resolver, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~DOMXPathExpressionImpl(); + + virtual DOMXPathResult* evaluate(const DOMNode *contextNode, + DOMXPathResult::ResultType type, + DOMXPathResult* result) const; + + virtual void release(); + +protected: + bool testNode(XPathMatcher* matcher, + DOMXPathResultImpl* result, + DOMElement *node) const; + void cleanUp(); + + XMLStringPool* fStringPool; + XercesXPath* fParsedExpression; + XMLCh* fExpression; + bool fMoveToRoot; + + MemoryManager* const fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp new file mode 100644 index 000000000..960046e7a --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.cpp @@ -0,0 +1,109 @@ +/* + * 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. + */ + +#include "DOMXPathNSResolverImpl.hpp" +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMXPathNSResolverImpl::DOMXPathNSResolverImpl(const DOMNode *nodeResolver, MemoryManager* const manager) : + fNamespaceBindings(0), + fResolverNode(nodeResolver), + fManager(manager) +{ + fNamespaceBindings = new (fManager) RefHashTableOf(7, true, fManager); +} + +DOMXPathNSResolverImpl::~DOMXPathNSResolverImpl() +{ + delete fNamespaceBindings; +} + +const XMLCh* DOMXPathNSResolverImpl::lookupNamespaceURI(const XMLCh* prefix) const +{ + if(prefix == 0) prefix = XMLUni::fgZeroLenString; + + if(XMLString::equals(prefix, XMLUni::fgXMLString)) + return XMLUni::fgXMLURIName; + + const KVStringPair *pair = fNamespaceBindings->get((void*)prefix); + if(pair) { + + // An empty namespace URI indicated that this binding was removed + // by the user. + // + if(*pair->getValue() == 0) return NULL; + + return pair->getValue(); + } + + if(fResolverNode) + return fResolverNode->lookupNamespaceURI( + *prefix == 0 ? 0 : prefix); // Expects 0 for default namespace. + + return NULL; +} + +const XMLCh* DOMXPathNSResolverImpl::lookupPrefix(const XMLCh* uri) const +{ + if (uri == 0 || *uri == 0) + return 0; + + if(XMLString::equals(uri, XMLUni::fgXMLURIName)) + return XMLUni::fgXMLString; + + RefHashTableOfEnumerator enumerator((RefHashTableOf*)fNamespaceBindings); + while(enumerator.hasMoreElements()) { + KVStringPair &pair = enumerator.nextElement(); + if(XMLString::equals(pair.getValue(), uri)) { + return pair.getKey(); + } + } + + if(fResolverNode) + { + const XMLCh* r = fResolverNode->lookupPrefix(uri); + + if (r == 0 && fResolverNode->isDefaultNamespace(uri)) + r = XMLUni::fgZeroLenString; + + return r; + } + + return 0; +} + +void DOMXPathNSResolverImpl::addNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) +{ + if(prefix == 0) prefix = XMLUni::fgZeroLenString; + if(uri == 0) uri = XMLUni::fgZeroLenString; + + KVStringPair* pair = new (fManager) KVStringPair(prefix, uri, fManager); + + fNamespaceBindings->put((void*)pair->getKey(), pair); +} + +void DOMXPathNSResolverImpl::release() +{ + DOMXPathNSResolverImpl* me=(DOMXPathNSResolverImpl*)this; + delete me; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.hpp new file mode 100644 index 000000000..c27d88c35 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathNSResolverImpl.hpp @@ -0,0 +1,58 @@ +/* + * 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: DOMXPathNSResolverImpl.hpp 657774 2008-05-19 09:59:33Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVERIMPL_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMNode; + +class CDOM_EXPORT DOMXPathNSResolverImpl : public XMemory, + public DOMXPathNSResolver +{ +public: + DOMXPathNSResolverImpl(const DOMNode* nodeResolver = 0, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMXPathNSResolverImpl(); + + virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const; + virtual const XMLCh* lookupPrefix(const XMLCh* URI) const; + virtual void addNamespaceBinding(const XMLCh* prefix, const XMLCh* uri); + + virtual void release(); + +protected: + RefHashTableOf* fNamespaceBindings; + const DOMNode* fResolverNode; + MemoryManager* fManager; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + + diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.cpp new file mode 100644 index 000000000..ffaf4f665 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.cpp @@ -0,0 +1,138 @@ +/* + * 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. + */ + +#include "DOMXPathResultImpl.hpp" +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMXPathResultImpl::DOMXPathResultImpl(ResultType type, + MemoryManager* const manager) + : fType(type), + fMemoryManager(manager), + fIndex (0) +{ + fSnapshot = new (fMemoryManager) RefVectorOf(13, false, fMemoryManager); +} + +DOMXPathResultImpl::~DOMXPathResultImpl() +{ + delete fSnapshot; +} + +// +// +DOMXPathResult::ResultType DOMXPathResultImpl::getResultType() const +{ + return fType; +} + +const DOMTypeInfo* DOMXPathResultImpl::getTypeInfo() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +bool DOMXPathResultImpl::isNode() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +bool DOMXPathResultImpl::getBooleanValue() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +int DOMXPathResultImpl::getIntegerValue() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +double DOMXPathResultImpl::getNumberValue() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +const XMLCh* DOMXPathResultImpl::getStringValue() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +DOMNode* DOMXPathResultImpl::getNodeValue() const +{ + if(fType == ANY_UNORDERED_NODE_TYPE || fType == FIRST_ORDERED_NODE_TYPE) + { + return fSnapshot->size() > 0 ? fSnapshot->elementAt(0) : 0; + } + else if (fType==UNORDERED_NODE_SNAPSHOT_TYPE || fType==ORDERED_NODE_SNAPSHOT_TYPE) + { + return fIndex < fSnapshot->size() ? fSnapshot->elementAt(fIndex) : 0; + } + else + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +bool DOMXPathResultImpl::iterateNext() +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +bool DOMXPathResultImpl::getInvalidIteratorState() const +{ + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +bool DOMXPathResultImpl::snapshotItem(XMLSize_t index) +{ + if(fType==UNORDERED_NODE_SNAPSHOT_TYPE || fType==ORDERED_NODE_SNAPSHOT_TYPE) + { + fIndex = index; + return fIndex < fSnapshot->size(); + } + else + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +XMLSize_t DOMXPathResultImpl::getSnapshotLength() const +{ + if(fType==UNORDERED_NODE_SNAPSHOT_TYPE || fType==ORDERED_NODE_SNAPSHOT_TYPE) + return fSnapshot->size(); + else + throw DOMXPathException(DOMXPathException::TYPE_ERR, 0, fMemoryManager); +} + +void DOMXPathResultImpl::release() +{ + DOMXPathResultImpl* me = this; + delete me; +} + +// +// +void DOMXPathResultImpl::reset(ResultType type) +{ + fType = type; + fSnapshot->removeAllElements(); + fIndex = 0; +} + +void DOMXPathResultImpl::addResult(DOMNode* node) +{ + fSnapshot->addElement(node); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.hpp new file mode 100644 index 000000000..4033f4808 --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/DOMXPathResultImpl.hpp @@ -0,0 +1,66 @@ +/* + * 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: DOMXPathResultImpl.hpp 671894 2008-06-26 13:29:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHRESULTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMXPATHRESULTIMPL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CDOM_EXPORT DOMXPathResultImpl : public XMemory, + public DOMXPathResult +{ +public: + DOMXPathResultImpl(ResultType type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~DOMXPathResultImpl(); + + virtual ResultType getResultType() const; + virtual const DOMTypeInfo *getTypeInfo() const; + virtual bool isNode() const; + virtual bool getBooleanValue() const; + virtual int getIntegerValue() const; + virtual double getNumberValue() const; + virtual const XMLCh* getStringValue() const; + virtual DOMNode* getNodeValue() const; + virtual bool iterateNext(); + virtual bool getInvalidIteratorState() const; + virtual bool snapshotItem(XMLSize_t); + virtual XMLSize_t getSnapshotLength() const; + + virtual void release(); + +public: + void reset(ResultType type); + void addResult(DOMNode* node); + +protected: + ResultType fType; + MemoryManager* const fMemoryManager; + RefVectorOf* fSnapshot; + XMLSize_t fIndex; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.cpp b/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.cpp new file mode 100644 index 000000000..bdfc35e0e --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.cpp @@ -0,0 +1,63 @@ +/* + * 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: XSDElementNSImpl.cpp 678381 2008-07-21 10:15:01Z borisk $ + */ +#include +#include + +#include "DOMDocumentImpl.hpp" +#include "XSDElementNSImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +XSDElementNSImpl::XSDElementNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) : + DOMElementNSImpl(ownerDoc, nam) + , fLineNo(0) + , fColumnNo(0) +{ +} + +//Introduced in DOM Level 2 +XSDElementNSImpl::XSDElementNSImpl(DOMDocument *ownerDoc, + const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + const XMLFileLoc lineNo, + const XMLFileLoc columnNo) : + DOMElementNSImpl(ownerDoc, namespaceURI, qualifiedName) + , fLineNo(lineNo) + , fColumnNo(columnNo) +{ +} + +XSDElementNSImpl::XSDElementNSImpl(const XSDElementNSImpl &other, bool deep) : + DOMElementNSImpl(other, deep) +{ + this->fLineNo = other.fLineNo; + this->fColumnNo =other.fColumnNo; +} + +DOMNode * XSDElementNSImpl::cloneNode(bool deep) const { + DOMNode* newNode = new (fParent.fOwnerDocument) XSDElementNSImpl(*this, deep); + fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode); + return newNode; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.hpp b/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.hpp new file mode 100644 index 000000000..e746a403d --- /dev/null +++ b/project/jni/xerces/src/xercesc/dom/impl/XSDElementNSImpl.hpp @@ -0,0 +1,71 @@ +/* + * 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: XSDElementNSImpl.hpp 672232 2008-06-27 10:16:38Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSDELEMENTNSIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_XSDELEMENTNSIMPL_HPP + +// +// This file is part of the internal implementation of the C++ XML DOM. +// It is used by TraverseSchema to store line/column information. +// It should NOT be included or used directly by application programs. +// +// Applications should include the file for the entire +// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class +// name is substituded for the *. +// + + +#include "DOMElementNSImpl.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + + +class CDOM_EXPORT XSDElementNSImpl: public DOMElementNSImpl { +protected: + XMLFileLoc fLineNo; //Line number + XMLFileLoc fColumnNo; //Column number + + +public: + XSDElementNSImpl(DOMDocument *ownerDoc, const XMLCh *name); + XSDElementNSImpl(DOMDocument *ownerDoc, //DOM Level 2 + const XMLCh *namespaceURI, + const XMLCh *qualifiedName, + const XMLFileLoc lineNo, + const XMLFileLoc columnNo); + XSDElementNSImpl(const XSDElementNSImpl &other, bool deep=false); + + virtual DOMNode * cloneNode(bool deep) const; + + XMLFileLoc getLineNo() const { return fLineNo; } + XMLFileLoc getColumnNo() const { return fColumnNo; } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSDElementNSImpl& operator=(const XSDElementNSImpl&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/BinOutputStream.cpp b/project/jni/xerces/src/xercesc/framework/BinOutputStream.cpp new file mode 100644 index 000000000..16ed99777 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/BinOutputStream.cpp @@ -0,0 +1,45 @@ +/* + * 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: BinOutputStream.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BinOutputStream: Virtual destructor! +// --------------------------------------------------------------------------- +BinOutputStream::~BinOutputStream() +{ +} + + +// --------------------------------------------------------------------------- +// BinOutputStream: Hidden Constructors +// --------------------------------------------------------------------------- +BinOutputStream::BinOutputStream() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/BinOutputStream.hpp b/project/jni/xerces/src/xercesc/framework/BinOutputStream.hpp new file mode 100644 index 000000000..25dddab07 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/BinOutputStream.hpp @@ -0,0 +1,65 @@ +/* + * 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: BinOutputStream.hpp 553915 2007-07-06 14:57:08Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BIN_OUTPUT_STREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BIN_OUTPUT_STREAM_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinOutputStream : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Virtual destructor for derived classes + // ----------------------------------------------------------------------- + virtual ~BinOutputStream(); + + // ----------------------------------------------------------------------- + // The virtual output stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const = 0; + + virtual void writeBytes + ( + const XMLByte* const toGo + , const XMLSize_t maxToWrite + ) = 0; + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + BinOutputStream(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented Constructors + // ----------------------------------------------------------------------- + BinOutputStream(const BinOutputStream&); + BinOutputStream& operator=(const BinOutputStream&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.cpp b/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.cpp new file mode 100644 index 000000000..d291fb227 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.cpp @@ -0,0 +1,149 @@ +/* + * 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: LocalFileFormatTarget.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const XMLSize_t MAX_BUFFER_SIZE = 65536; + +LocalFileFormatTarget::LocalFileFormatTarget( const XMLCh* const fileName + , MemoryManager* const manager) +: fSource(0) +, fDataBuf(0) +, fIndex(0) +, fCapacity(1024) +, fMemoryManager(manager) +{ + fSource = XMLPlatformUtils::openFileToWrite(fileName, manager); + + if (fSource == (FileHandle) XERCES_Invalid_File_Handle) + ThrowXMLwithMemMgr1(IOException, XMLExcepts::File_CouldNotOpenFile, fileName, fMemoryManager); + + fDataBuf = (XMLByte*) fMemoryManager->allocate ( + fCapacity * sizeof(XMLByte)); +} + +LocalFileFormatTarget::LocalFileFormatTarget( const char* const fileName + , MemoryManager* const manager) +: fSource(0) +, fDataBuf(0) +, fIndex(0) +, fCapacity(1024) +, fMemoryManager(manager) +{ + fSource = XMLPlatformUtils::openFileToWrite(fileName, manager); + + if (fSource == (FileHandle) XERCES_Invalid_File_Handle) + ThrowXMLwithMemMgr1(IOException, XMLExcepts::File_CouldNotOpenFile, fileName, fMemoryManager); + + fDataBuf = (XMLByte*) fMemoryManager->allocate ( + fCapacity * sizeof(XMLByte)); +} + +LocalFileFormatTarget::~LocalFileFormatTarget() +{ + try + { + // flush remaining buffer before destroy + XMLPlatformUtils::writeBufferToFile(fSource, fIndex, fDataBuf, fMemoryManager); + + if (fSource) + XMLPlatformUtils::closeFile(fSource, fMemoryManager); + } + catch (...) + { + // There is nothing we can do about it here. + } + + fMemoryManager->deallocate(fDataBuf);//delete [] fDataBuf; +} + +void LocalFileFormatTarget::flush() +{ + XMLPlatformUtils::writeBufferToFile(fSource, fIndex, fDataBuf, fMemoryManager); + fIndex = 0; +} + +void LocalFileFormatTarget::writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter * const) +{ + if (count) + { + if (count < MAX_BUFFER_SIZE) + { + // If we don't have enough space, see if we can grow the buffer. + // + if (fIndex + count > fCapacity && fCapacity < MAX_BUFFER_SIZE) + ensureCapacity (count); + + // If still not enough space, flush the buffer. + // + if (fIndex + count > fCapacity) + { + XMLPlatformUtils::writeBufferToFile(fSource, fIndex, fDataBuf, fMemoryManager); + fIndex = 0; + } + + memcpy(&fDataBuf[fIndex], toWrite, count * sizeof(XMLByte)); + fIndex += count; + } + else + { + if (fIndex) + { + XMLPlatformUtils::writeBufferToFile(fSource, fIndex, fDataBuf, fMemoryManager); + fIndex = 0; + } + + XMLPlatformUtils::writeBufferToFile(fSource, count, toWrite, fMemoryManager); + } + } + + return; +} + +void LocalFileFormatTarget::ensureCapacity(const XMLSize_t extraNeeded) +{ + XMLSize_t newCap = fCapacity * 2; + + while (fIndex + extraNeeded > newCap) + newCap *= 2; + + XMLByte* newBuf = (XMLByte*) fMemoryManager->allocate ( + newCap * sizeof(XMLByte)); + + // Copy over the old stuff + memcpy(newBuf, fDataBuf, fIndex * sizeof(XMLByte)); + + // Clean up old buffer and store new stuff + fMemoryManager->deallocate(fDataBuf); + fDataBuf = newBuf; + fCapacity = newCap; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.hpp b/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.hpp new file mode 100644 index 000000000..e7cc279df --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/LocalFileFormatTarget.hpp @@ -0,0 +1,99 @@ +/* + * 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: LocalFileFormatTarget.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP) +#define XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget { +public: + + /** @name constructors and destructor */ + //@{ + LocalFileFormatTarget + ( + const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + LocalFileFormatTarget + ( + const char* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~LocalFileFormatTarget(); + //@} + + // ----------------------------------------------------------------------- + // Implementations of the format target interface + // ----------------------------------------------------------------------- + virtual void writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter* const formatter); + + virtual void flush(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + LocalFileFormatTarget(const LocalFileFormatTarget&); + LocalFileFormatTarget& operator=(const LocalFileFormatTarget&); + + // ----------------------------------------------------------------------- + // Private helpers + // ----------------------------------------------------------------------- + void ensureCapacity(const XMLSize_t extraNeeded); + + // ----------------------------------------------------------------------- + // Private data members + // + // fSource + // The source file that we represent. The FileHandle type is defined + // per platform. + // + // fDataBuf + // The pointer to the buffer data. Its always + // one larger than fCapacity, to leave room for the null terminator. + // + // fIndex + // The current index into the buffer, as characters are appended + // to it. If its zero, then the buffer is empty. + // + // fCapacity + // The current capacity of the buffer. Its actually always one + // larger, to leave room for the null terminator. + // ----------------------------------------------------------------------- + FileHandle fSource; + XMLByte* fDataBuf; + XMLSize_t fIndex; + XMLSize_t fCapacity; + MemoryManager* fMemoryManager; +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.cpp b/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.cpp new file mode 100644 index 000000000..f5adce895 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.cpp @@ -0,0 +1,172 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * + * Originated by Chris larsson + * + * Issue: + * + * There is an inconsistency in URI resolution in the case where the file itself is a + * symbolic link to another path (or the path has path segment which is a symbolic + * link to another path). So, is the base path the directory where the symbolic link resides + * or the directory where the real file resides? I'm sure one could argue either way, + * but I think that having the base path be the directory where the symbolic link resides + * is more intuitive. + * + * Defining it this way would then make the behavior consistent with using an absolute + * path as well as with the java behavior. + * + * Proposal: + * + * The URI is resolved within the parser code, and is somewhat independant of the OS. + * + * A relative path is resolved by querying the current directory and appending the + * relative part onto the returned current directory string to obtain the base URI. + * An absolute path is simply used as the base URI. + * Then remove all "./" and "../" path segments using an algorithm like weavepath to obtain + * the resolved base URI. + * + * When you need to access another file such as a dtd, use the resolved base URI and add on + * the relative URI of the dtd file. Then resolve it using the same weavepath algorithm. + * + * Note: + * + * Java parser behaves differently for a path containning symbolic path segment. When + * it is given an absolute path, it can locate the primary instance document, while given + * relative path, it might not. + * + * It is because Java parser uses URI solution where "/segment/../" is required to be removed + * from the resultant path if a relative URI is merged to a baseURI. While this is NOT required + * for an absolute URI. + * + * So if a path segment, which is symbolic link, happen to be followed by the '/../', it is + * NOT removed from the path if it is given in absolute form, and the underlying file system + * will locate the file, if in relative form, that symbolic link path segment together with + * '../' is removed from the resultant path, and the file system may NOT be able to locate + * the file, if there is a one, it is definitely not the one expected, in fact by accident. + * + * Therefore, to keep consistent with Java parser, for now, we do not apply removeDotDotSlash() + * for absolute path. + * + ***/ + +// --------------------------------------------------------------------------- +// LocalFileInputSource: Constructors and Destructor +// --------------------------------------------------------------------------- +LocalFileInputSource::LocalFileInputSource( const XMLCh* const basePath + , const XMLCh* const relativePath + , MemoryManager* const manager) + : InputSource(manager) +{ + // + // If the relative part is really relative, then weave it together + // with the base path. If not, just take the relative path as the + // entire path. + // + if (XMLPlatformUtils::isRelative(relativePath, manager)) + { + XMLCh* tmpBuf = XMLPlatformUtils::weavePaths(basePath, relativePath, manager); + setSystemId(tmpBuf); + manager->deallocate(tmpBuf); //delete [] tmpBuf; + } + else + { + XMLCh* tmpBuf = XMLString::replicate(relativePath, manager); + XMLPlatformUtils::removeDotSlash(tmpBuf, manager); + setSystemId(tmpBuf); + manager->deallocate(tmpBuf);//delete [] tmpBuf; + } + +} + +LocalFileInputSource::LocalFileInputSource(const XMLCh* const filePath, + MemoryManager* const manager) + : InputSource(manager) +{ + + // + // If the path is relative, then complete it acording to the current + // working directory rules of the current platform. Else, just take + // it as is. + // + if (XMLPlatformUtils::isRelative(filePath, manager)) + { + XMLCh* curDir = XMLPlatformUtils::getCurrentDirectory(manager); + + XMLSize_t curDirLen = XMLString::stringLen(curDir); + XMLSize_t filePathLen = XMLString::stringLen(filePath); + XMLCh* fullDir = (XMLCh*) manager->allocate + ( + (curDirLen + filePathLen + 2) * sizeof(XMLCh) + );//new XMLCh [ curDirLen + filePathLen + 2]; + + XMLString::copyString(fullDir, curDir); + fullDir[curDirLen] = chForwardSlash; + XMLString::copyString(&fullDir[curDirLen+1], filePath); + + XMLPlatformUtils::removeDotSlash(fullDir, manager); + XMLPlatformUtils::removeDotDotSlash(fullDir, manager); + + setSystemId(fullDir); + + manager->deallocate(curDir);//delete [] curDir; + manager->deallocate(fullDir);//delete [] fullDir; + } + else + { + XMLCh* tmpBuf = XMLString::replicate(filePath, manager); + XMLPlatformUtils::removeDotSlash(tmpBuf, manager); + setSystemId(tmpBuf); + manager->deallocate(tmpBuf);//delete [] tmpBuf; + } + +} + +LocalFileInputSource::~LocalFileInputSource() +{ +} + + +// --------------------------------------------------------------------------- +// LocalFileInputSource: InputSource interface implementation +// --------------------------------------------------------------------------- +BinInputStream* LocalFileInputSource::makeStream() const +{ + BinFileInputStream* retStrm = new (getMemoryManager()) BinFileInputStream(getSystemId(), getMemoryManager()); + if (!retStrm->getIsOpen()) + { + delete retStrm; + return 0; + } + return retStrm; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.hpp b/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.hpp new file mode 100644 index 000000000..4f121175f --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/LocalFileInputSource.hpp @@ -0,0 +1,152 @@ +/* + * 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: LocalFileInputSource.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + + +#if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + +/** + * This class is a derivative of the standard InputSource class. It provides + * for the parser access to data which is referenced via a local file path, + * as apposed to remote file or URL. This is the most efficacious mechanism + * by which local files can be parsed, since the parse knows that it refers + * to a local file and will make no other attempts to interpret the passed + * path. + * + * The path provided can either be a fully qualified path or a relative path. + * If relative, it will be completed either relative to a passed base path + * or relative to the current working directory of the process. + * + * As with all InputSource derivatives. The primary objective of an input + * source is to create an input stream via which the parser can spool in + * data from the referenced source. + */ +class XMLPARSER_EXPORT LocalFileInputSource : public InputSource +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors */ + //@{ + + /** + * A local file input source requires a path to the file to load. This + * can be provided either as a fully qualified path, a path relative to + * the current working directly, or a path relative to a provided base + * path. + * + * The completed path will become the system id of this input source. + * The constructors don't take any public id for local files, but you + * still set them via the parent class' setPublicId() method of course. + * + * This constructor takes an explicit base path and a possibly relative + * path. If the relative path is seen to be fully qualified, it is used + * as is. Otherwise, it is made relative to the passed base path. + * + * @param basePath The base path from which the passed relative path + * will be based, if the relative part is indeed + * relative. + * + * @param relativePath The relative part of the path. It can actually + * be fully qualified, in which case it is taken + * as is. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + * @exception XMLException If the path is relative and doesn't properly + * resolve to a file. + */ + LocalFileInputSource + ( + const XMLCh* const basePath + , const XMLCh* const relativePath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * This constructor takes a single parameter which is the fully qualified + * or relative path. If it is fully qualified, it is taken as is. If it is + * relative, then it is completed relative to the current working directory + * (or the equivalent on the local host machine.) + * + * The completed path will become the system id of this input source. + * The constructors don't take any public id for local files, but you + * still set them via the parent class' setPublicId() method of course. + * + * @param filePath The relative or fully qualified path. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + * @exception XMLException If the path is relative and doesn't properly + * resolve to a file. + */ + LocalFileInputSource + ( + const XMLCh* const filePath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + ~LocalFileInputSource(); + //@} + + + // ----------------------------------------------------------------------- + // Virtual input source interface + // ----------------------------------------------------------------------- + + /** @name Virtual methods */ + //@{ + + /** + * This method will return a binary input stream derivative that will + * parse from the local file indicatedby the system id. + * + * @return A dynamically allocated binary input stream derivative that + * can parse from the file indicated by the system id. + */ + virtual BinInputStream* makeStream() const; + + //@} +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + LocalFileInputSource(const LocalFileInputSource&); + LocalFileInputSource& operator=(const LocalFileInputSource&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.cpp b/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.cpp new file mode 100644 index 000000000..512cd87d7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.cpp @@ -0,0 +1,105 @@ +/* + * 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: MemBufFormatTarget.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MemBufFormatTarget::MemBufFormatTarget( XMLSize_t initCapacity + , MemoryManager* const manager) + : fMemoryManager(manager) + , fDataBuf(0) + , fIndex(0) + , fCapacity(initCapacity) +{ + // Buffer is one larger than capacity, to allow for zero term + fDataBuf = (XMLByte*) fMemoryManager->allocate + ( + (fCapacity + 4) * sizeof(XMLByte) + );//new XMLByte[fCapacity+4]; + + // Keep it null terminated + fDataBuf[0] = XMLByte(0); +} + +MemBufFormatTarget::~MemBufFormatTarget() +{ + fMemoryManager->deallocate(fDataBuf);//delete [] fDataBuf; +} + +void MemBufFormatTarget::writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter * const) +{ + + if (count) + { + if (fIndex + count >= fCapacity) + ensureCapacity(count); + + memcpy(&fDataBuf[fIndex], toWrite, count * sizeof(XMLByte)); + fIndex += count; + } + +} + +const XMLByte* MemBufFormatTarget::getRawBuffer() const +{ + fDataBuf[fIndex] = 0; + fDataBuf[fIndex + 1] = 0; + fDataBuf[fIndex + 2] = 0; + fDataBuf[fIndex + 3] = 0; + return fDataBuf; +} + +void MemBufFormatTarget::reset() +{ + fIndex = 0; + fDataBuf[0] = 0; + fDataBuf[fIndex + 1] = 0; + fDataBuf[fIndex + 2] = 0; + fDataBuf[fIndex + 3] = 0; +} + +// --------------------------------------------------------------------------- +// MemBufFormatTarget: Private helper methods +// --------------------------------------------------------------------------- +void MemBufFormatTarget::ensureCapacity(const XMLSize_t extraNeeded) +{ + // Oops, not enough room. Calc new capacity and allocate new buffer + const XMLSize_t newCap = ((fIndex + extraNeeded) * 2); + XMLByte* newBuf = (XMLByte*) fMemoryManager->allocate + ( + (newCap+4) * sizeof(XMLByte) + );//new XMLByte[newCap+4]; + + // Copy over the old stuff + memcpy(newBuf, fDataBuf, fIndex * sizeof(XMLByte)); + + // Clean up old buffer and store new stuff + fMemoryManager->deallocate(fDataBuf); //delete [] fDataBuf; + fDataBuf = newBuf; + fCapacity = newCap; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.hpp b/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.hpp new file mode 100644 index 000000000..27da938db --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/MemBufFormatTarget.hpp @@ -0,0 +1,136 @@ +/* + * 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: MemBufFormatTarget.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MEMBUFFORMATTARGET_HPP) +#define XERCESC_INCLUDE_GUARD_MEMBUFFORMATTARGET_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + * The MemBufFormatTarget is a derivative from XMLFormatTarget, which user code + * may plug into DOMLSSerializer to retrieve the serialized XML stream (from DOM Tree) + * in a memory buffer. + * + * The MemBufFormatTarget is initialized to have a memory buffer of 1023 upon + * construction, which grows as needed. The buffer will be deleted when + * MemBufFormatTarget is destructed; or will be reset when the reset() function + * is called. + * + * The MemBufFormatTarget returns a NULL terminated XMLByte stream upon request, + * through the method getRawBuffer(), and user should make its own copy of the + * returned buffer if it intends to keep it independent on the state of the + * MemBufFormatTarget. + */ + +class XMLPARSER_EXPORT MemBufFormatTarget : public XMLFormatTarget { +public: + + /** @name constructors and destructor */ + //@{ + MemBufFormatTarget + ( + XMLSize_t initCapacity = 1023 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) ; + ~MemBufFormatTarget(); + //@} + + // ----------------------------------------------------------------------- + // Implementations of the format target interface + // ----------------------------------------------------------------------- + virtual void writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter* const formatter); + + // ----------------------------------------------------------------------- + // Getter + // ----------------------------------------------------------------------- + /** @name getRawBuffer */ + //@{ + /** + * Returned the internal raw buffer. + * + */ + //@} + const XMLByte* getRawBuffer() const; + + /** @name getLen */ + //@{ + /** + * Returned the length of the raw buffer. + * + */ + //@} + XMLSize_t getLen() const + { + return fIndex; + } + + /** @name reset */ + //@{ + /** + * Reset the internal string buffer. + * + */ + void reset(); + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + MemBufFormatTarget(const MemBufFormatTarget&); + MemBufFormatTarget& operator=(const MemBufFormatTarget&); + + // ----------------------------------------------------------------------- + // Private helpers + // ----------------------------------------------------------------------- + void ensureCapacity(const XMLSize_t extraNeeded); + + // ----------------------------------------------------------------------- + // Private data members + // + // fDataBuf + // The pointer to the buffer data. Its grown as needed. Its always + // one larger than fCapacity, to leave room for the null terminator. + // + // fIndex + // The current index into the buffer, as characters are appended + // to it. If its zero, then the buffer is empty. + // + // fCapacity + // The current capacity of the buffer. Its actually always one + // larger, to leave room for the null terminator. + // + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + XMLByte* fDataBuf; + XMLSize_t fIndex; + XMLSize_t fCapacity; + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/framework/MemBufInputSource.cpp b/project/jni/xerces/src/xercesc/framework/MemBufInputSource.cpp new file mode 100644 index 000000000..d39f80bfe --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/MemBufInputSource.cpp @@ -0,0 +1,94 @@ +/* + * 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: MemBufInputSource.cpp 553941 2007-07-06 16:14:22Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// MemBufInputSource: Constructors and Destructor +// --------------------------------------------------------------------------- +MemBufInputSource::MemBufInputSource( const XMLByte* const srcDocBytes + , const XMLSize_t byteCount + , const XMLCh* const bufId + , const bool adoptBuffer + , MemoryManager* const manager) : + InputSource(bufId, manager) + , fAdopted(adoptBuffer) + , fByteCount(byteCount) + , fCopyBufToStream(true) + , fSrcBytes(srcDocBytes) +{ +} + +MemBufInputSource::MemBufInputSource( const XMLByte* const srcDocBytes + , const XMLSize_t byteCount + , const char* const bufId + , const bool adoptBuffer + , MemoryManager* const manager) : + InputSource(bufId, manager) + , fAdopted(adoptBuffer) + , fByteCount(byteCount) + , fCopyBufToStream(true) + , fSrcBytes(srcDocBytes) +{ +} + +MemBufInputSource::~MemBufInputSource() +{ + if (fAdopted) + delete [] (XMLByte*)fSrcBytes; +} + +void MemBufInputSource::resetMemBufInputSource(const XMLByte* const srcDocBytes + , const XMLSize_t byteCount) +{ + fByteCount = byteCount; + fSrcBytes = srcDocBytes; +} + +// --------------------------------------------------------------------------- +// MemBufInputSource: InputSource interface implementation +// --------------------------------------------------------------------------- +BinInputStream* MemBufInputSource::makeStream() const +{ + // + // Create a memory input stream over our buffer. According to our + // fCopyBufToStream flag, we either tell it to copy the buffer or to + // just reference it. + // + return new (getMemoryManager()) BinMemInputStream + ( + fSrcBytes + , fByteCount + , fCopyBufToStream ? BinMemInputStream::BufOpt_Copy + : BinMemInputStream::BufOpt_Reference + , getMemoryManager() + ); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/MemBufInputSource.hpp b/project/jni/xerces/src/xercesc/framework/MemBufInputSource.hpp new file mode 100644 index 000000000..5ccf5286a --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/MemBufInputSource.hpp @@ -0,0 +1,230 @@ +/* + * 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: MemBufInputSource.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + + +#if !defined(XERCESC_INCLUDE_GUARD_MEMBUFINPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_MEMBUFINPUTSOURCE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + + +/** + * This class is a derivative of the standard InputSource class. It provides + * for the parser access to data stored in a memory buffer. The type of + * buffer and its host specific attributes are of little concern here. The + * only real requirement is that the memory be readable by the current + * process. + * + * Note that the memory buffer size is expressed in bytes, not in + * characters. If you pass it text data, you must account for the bytes + * per character when indicating the buffer size. + * + * As with all InputSource derivatives. The primary objective of an input + * source is to create an input stream via which the parser can spool in + * data from the referenced source. In this case, there are two options + * available. + * + * The passed buffer can be adopted or merely referenced. If it is adopted, + * then it must be dynamically allocated and will be destroyed when the + * input source is destroyed (no reference counting!.) If not adopted, the + * caller must insure that it remains valid until the input source object + * is destroyed. + * + * The other option indicates whether each stream created for this input + * source should get its own copy of the data, or whether it should just + * stream the data directly from this object's copy of the data. The same + * rules apply here, in that the buffer must either be copied by the + * stream or it must remain valid until the stream is destroyed. + */ +class XMLPARSER_EXPORT MemBufInputSource : public InputSource +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors */ + //@{ + + /** + * A memory buffer input source is constructed from a buffer of byte + * data, and the count of bytes in that buffer. The parser will parse + * from this memory buffer until it has eaten the indicated number of + * bytes. + * + * Note that the system id provided serves two purposes. Firstly it is + * going to be displayed in error messages as the source of the error. + * And secondly, any entities which are referred to from this entity + * via relative paths/URLs will be relative to this fake system id. + * + * @param srcDocBytes The actual data buffer to be parsed from. + * @param byteCount The count of bytes (not characters, bytes!) + * in the buffer. + * @param bufId A fake system id for the buffer. + * @param adoptBuffer Indicates whether this object should adopt + * the buffer (i.e. become responsible for + * deletion) or just + * use it in place. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + MemBufInputSource + ( + const XMLByte* const srcDocBytes + , const XMLSize_t byteCount + , const XMLCh* const bufId + , const bool adoptBuffer = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * This constructor is identical to the previous one, except that it takes + * the fake system id in local code page form and transcodes it internally. + */ + MemBufInputSource + ( + const XMLByte* const srcDocBytes + , const XMLSize_t byteCount + , const char* const bufId + , const bool adoptBuffer = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + /** + * If the buffer was adopted, the copy made during construction is deleted + * at this point. + */ + ~MemBufInputSource(); + //@} + + + // ----------------------------------------------------------------------- + // Virtual input source interface + // ----------------------------------------------------------------------- + + /** @name Virtual methods */ + //@{ + + /** + * This method will return a binary input stream derivative that will + * parse from the memory buffer. If setCopyBufToStream() has been set, + * then the stream will make its own copy. Otherwise, it will use the + * buffer as is (in which case it must remain valid until the stream + * is no longer in use, i.e. the parse completes.) + * + * @return A dynamically allocated binary input stream derivative that + * can parse from the memory buffer. + */ + BinInputStream* makeStream() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + + //@{ + + /** + * By default, for safety's sake, each newly created stream from this + * input source will make its own copy of the buffer to stream from. This + * avoids having to deal with aliasing of the buffer for simple work. But, + * for higher performance applications or for large buffers, this is + * obviously not optimal. + * + * In such cases, you can call this method to turn off that default + * action. Once turned off, the streams will just get a pointer to the + * buffer and parse directly from that. In this case, you must insure that + * the buffer remains valid for as long as any parse events are still + * using it. + * + * @param newState The new boolean flag state to set. + */ + void setCopyBufToStream(const bool newState); + + /** + * This methods allows the MemBufInputSource to be used for more than + * one input source, instead of destructing/constructing another + * MemBufInputSource. + * + * @param srcDocBytes The actual data buffer to be parsed from. + * @param byteCount The count of bytes (not characters, bytes!) + * in the buffer. + */ + void resetMemBufInputSource(const XMLByte* const srcDocBytes + , const XMLSize_t byteCount); + //@} + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MemBufInputSource(const MemBufInputSource&); + MemBufInputSource& operator=(const MemBufInputSource&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fAdopted + // Indicates whether the buffer is adopted or not. If so, then it + // is destroyed when the input source is destroyed. + // + // fByteCount + // The size of the source document. + // + // fCopyBufToStream + // This defaults to true (the safe option), which causes it to + // give a copy of the buffer to any streams it creates. If you set + // it to false, it will allow the streams to just reference the + // buffer (in which case this input source must stay alive as long + // as the buffer is in use by the stream.) + // + // fSrcBytes + // The source memory buffer that is being spooled from. Whether it + // belongs to the this input source or not is controlled by the + // fAdopted flag. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fByteCount; + bool fCopyBufToStream; + const XMLByte* fSrcBytes; +}; + + +inline void MemBufInputSource::setCopyBufToStream(const bool newState) +{ + fCopyBufToStream = newState; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/MemoryManager.hpp b/project/jni/xerces/src/xercesc/framework/MemoryManager.hpp new file mode 100644 index 000000000..6b6c1866e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/MemoryManager.hpp @@ -0,0 +1,125 @@ +/* + * 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: MemoryManager.hpp 673975 2008-07-04 09:23:56Z borisk $ + */ + + +#if !defined(XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP) +#define XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP + +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Configurable memory manager + * + *

This interface allows outside applications to plug in their own memory + * manager to be used by Xerces for memory allocation/deallocation.

+ */ +class XMLPARSER_EXPORT MemoryManager +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, only the virtual destructor is exposed + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + + /** + * Default destructor + */ + virtual ~MemoryManager() + { + } + //@} + + + /** + * This method is called to obtain the memory manager that should be + * used to allocate memory used in exceptions. If the same memory + * manager can be used, simply return 'this' from this function. + * Note, however, that if there is a possibility that an exception + * thrown can outlive the memory manager (for example, because the + * memory manager object is allocated on the stack or is managed by + * a stack-bound object), it is recommended that you return + * XMLPlatformUtils::fgMemoryManager. + * + * @return A pointer to the memory manager + */ + virtual MemoryManager* getExceptionMemoryManager() = 0; + + + // ----------------------------------------------------------------------- + // The virtual memory manager interface + // ----------------------------------------------------------------------- + /** @name The pure virtual methods in this interface. */ + //@{ + + /** + * This method allocates requested memory. + * + * @param size The requested memory size + * + * @return A pointer to the allocated memory + */ + virtual void* allocate(XMLSize_t size) = 0; + + /** + * This method deallocates memory + * + * @param p The pointer to the allocated memory to be deleted + */ + virtual void deallocate(void* p) = 0; + + //@} + + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + /** @name Constructor */ + //@{ + + /** + * Protected default constructor + */ + MemoryManager() + { + } + //@} + + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MemoryManager(const MemoryManager&); + MemoryManager& operator=(const MemoryManager&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/StdInInputSource.cpp b/project/jni/xerces/src/xercesc/framework/StdInInputSource.cpp new file mode 100644 index 000000000..93ac7fd19 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/StdInInputSource.cpp @@ -0,0 +1,52 @@ +/* + * 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: StdInInputSource.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// StdInInputSource: Implementation of the input source interface +// --------------------------------------------------------------------------- +BinInputStream* StdInInputSource::makeStream() const +{ + // Open a binary file stream for the standard input file handle + BinFileInputStream* retStream = new (getMemoryManager()) BinFileInputStream + ( + XMLPlatformUtils::openStdInHandle(getMemoryManager()) + ); + + if (!retStream->getIsOpen()) + { + delete retStream; + return 0; + } + return retStream; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/StdInInputSource.hpp b/project/jni/xerces/src/xercesc/framework/StdInInputSource.hpp new file mode 100644 index 000000000..765b963ff --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/StdInInputSource.hpp @@ -0,0 +1,108 @@ +/* + * 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: StdInInputSource.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + + +#if !defined(XERCESC_INCLUDE_GUARD_STDININPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_STDININPUTSOURCE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + + +/** + * This class is a derivative of the standard InputSource class. It provides + * for the parser access to data via the standard input. This input source + * is not commonly used, but can be useful when implementing such things + * as pipe based tools which exchange XML data. + * + * As with all InputSource derivatives. The primary objective of an input + * source is to create an input stream via which the parser can spool in + * data from the referenced source. + */ +class XMLPARSER_EXPORT StdInInputSource : public InputSource +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructor */ + //@{ + + /** + * Since the standard input is a canned source, the constructor is very + * simple. It just uses local platform services to open up the standard + * input source as file, a new handleof which it gives to each new stream + * it creates. + */ + StdInInputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + //@} + + /** @name Destructor */ + //@{ + ~StdInInputSource(); + //@} + + + // ----------------------------------------------------------------------- + // Virtual input source interface + // ----------------------------------------------------------------------- + + + /** @name Virtual methods */ + //@{ + + /** + * This method will return a binary input stream derivative that will + * parse from the standard input of the local host. + * + * @return A dynamically allocated binary input stream derivative that + * can parse from the standardinput. + */ + BinInputStream* makeStream() const; + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + StdInInputSource(const StdInInputSource&); + StdInInputSource& operator=(const StdInInputSource&); + +}; + +inline StdInInputSource::StdInInputSource(MemoryManager* const manager) : + + InputSource("stdin", manager) +{ +} + +inline StdInInputSource::~StdInInputSource() +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.cpp b/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.cpp new file mode 100644 index 000000000..18114ec6c --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.cpp @@ -0,0 +1,51 @@ +/* + * 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: StdOutFormatTarget.cpp 881225 2009-11-17 10:19:57Z borisk $ + */ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +StdOutFormatTarget::StdOutFormatTarget() +{} + +StdOutFormatTarget::~StdOutFormatTarget() +{ + flush (); +} + +void StdOutFormatTarget::flush() +{ + fflush(stdout); +} + +void StdOutFormatTarget::writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter* const) +{ + XMLSize_t written=fwrite(toWrite, sizeof(XMLByte), count, stdout); + if(written!=count) + ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile); + fflush(stdout); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.hpp b/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.hpp new file mode 100644 index 000000000..c58e0d6d7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/StdOutFormatTarget.hpp @@ -0,0 +1,57 @@ +/* + * 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: StdOutFormatTarget.hpp 553937 2007-07-06 16:02:19Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_STDOUTFORMATTARGET_HPP) +#define XERCESC_INCLUDE_GUARD_STDOUTFORMATTARGET_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT StdOutFormatTarget : public XMLFormatTarget { +public: + + /** @name constructors and destructor */ + //@{ + StdOutFormatTarget() ; + ~StdOutFormatTarget(); + //@} + + // ----------------------------------------------------------------------- + // Implementations of the format target interface + // ----------------------------------------------------------------------- + virtual void writeChars(const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter* const formatter); + + virtual void flush(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + StdOutFormatTarget(const StdOutFormatTarget&); + StdOutFormatTarget& operator=(const StdOutFormatTarget&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/URLInputSource.cpp b/project/jni/xerces/src/xercesc/framework/URLInputSource.cpp new file mode 100644 index 000000000..4ab22e6dc --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/URLInputSource.cpp @@ -0,0 +1,100 @@ +/* + * 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: URLInputSource.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// URLInputSource: Constructors and Destructor +// --------------------------------------------------------------------------- +URLInputSource::URLInputSource( const XMLURL& urlId + , MemoryManager* const manager) : + + InputSource(manager) + , fURL(urlId) +{ + setSystemId(fURL.getURLText()); +} + +URLInputSource::URLInputSource( const XMLCh* const baseId + , const XMLCh* const systemId + , MemoryManager* const manager) : + InputSource(manager) + , fURL(baseId, systemId) +{ + // Create a URL that will build up the full URL and store as the system id + setSystemId(fURL.getURLText()); +} + +URLInputSource::URLInputSource( const XMLCh* const baseId + , const XMLCh* const systemId + , const XMLCh* const publicId + , MemoryManager* const manager) : + InputSource(0, publicId, manager) + , fURL(baseId, systemId) +{ + setSystemId(fURL.getURLText()); +} + +URLInputSource::URLInputSource( const XMLCh* const baseId + , const char* const systemId + , MemoryManager* const manager) : + InputSource(manager) + , fURL(baseId, systemId) +{ + setSystemId(fURL.getURLText()); +} + +URLInputSource::URLInputSource( const XMLCh* const baseId + , const char* const systemId + , const char* const publicId + , MemoryManager* const manager) : + InputSource(0, publicId, manager) + , fURL(baseId, systemId) +{ + setSystemId(fURL.getURLText()); +} + +URLInputSource::~URLInputSource() +{ +} + + +// --------------------------------------------------------------------------- +// URLInputSource: Implementation of the input source interface +// --------------------------------------------------------------------------- +BinInputStream* URLInputSource::makeStream() const +{ + // Ask the URL to create us an appropriate input stream + return fURL.makeNewStream(); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/URLInputSource.hpp b/project/jni/xerces/src/xercesc/framework/URLInputSource.hpp new file mode 100644 index 000000000..f264bcf8e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/URLInputSource.hpp @@ -0,0 +1,236 @@ +/* + * 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: URLInputSource.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + +/** + * This class is a derivative of the standard InputSource class. It provides + * for the parser access to data which is referenced via a URL, as apposed to + * a local file name. The URL can be provided via an XMLURL class, as a fully + * qualified system id, or a base system id and a system id which may be + * fully qualified or may be relative to the base. + * + * As with all InputSource derivatives. The primary objective of an input + * source is to create an input stream via which the parser can spool in + * data from the referenced source. + * + * Note that the parse system does not necessarily support URL based XML + * entities out of the box. Support for socket based access is optional and + * controlled by the per-platform support. + */ +class XMLPARSER_EXPORT URLInputSource : public InputSource +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors */ + //@{ + + /** + * This constructor accepts an already built URL. It is assumed that + * it is correct and it will be used as is. In this case, no public id + * accepted, but it can still be set via the parent class' setPublicId() + * method. + * + * @param urlId The URL which holds the system id of the entity + * to parse. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + URLInputSource + ( + const XMLURL& urlId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + /** + * This constructor takes a base system id URL and a possibly relative + * system id. The relative part is parsed and, if it is indeed relative, + * it will be made relative to the passed base id. Otherwise, it will be + * taken as is. + * + * @param baseId The base system id URL which provides the base + * for any relative id part. + * + * @param systemId The possibly relative system id URL. If its relative + * its based on baseId, else its taken as is. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + URLInputSource + ( + const XMLCh* const baseId + , const XMLCh* const systemId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * This constructor is identical to the previous one, except that it also + * allows you to set a public id if you want to. + * + * @param baseId The base system id URL which provides the base + * for any relative id part. + * + * @param systemId The possibly relative system id URL. If its relative + * its based on baseId, else its taken as is. + * + * @param publicId The optional public id to set. This is just passed + * on to the parent class for storage. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + URLInputSource + ( + const XMLCh* const baseId + , const XMLCh* const systemId + , const XMLCh* const publicId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + /** + * This constructor is identical to the second constructor above, except that + * it accepts the relative system id part as a local code page string and + * just transcodes it internally, as a convenience. + * + * @param baseId The base system id URL which provides the base + * for any relative id part. + * + * @param systemId The possibly relative system id URL. If its relative + * its based on baseId, else its taken as is. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + URLInputSource + ( + const XMLCh* const baseId + , const char* const systemId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * This constructor is identical to the third constructor above, except that + * it accepts the relative and public ids as local code page strings and just + * transcodes them internally, as a convenience. + * + * @param baseId The base system id URL which provides the base + * for any relative id part. + * + * @param systemId The possibly relative system id URL. If its relative + * its based on baseId, else its taken as is. + * + * @param publicId The optional public id to set. This is just passed + * on to the parent class for storage. + * on to the parent class for storage. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + URLInputSource + ( + const XMLCh* const baseId + , const char* const systemId + , const char* const publicId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** @name Destructor */ + //@{ + ~URLInputSource(); + //@} + + + // ----------------------------------------------------------------------- + // Virtual input source interface + // ----------------------------------------------------------------------- + + /** @name Virtual methods */ + //@{ + + /** + * This method will return a binary input stream derivative that will + * parse from the source referred to by the URL system id. + */ + BinInputStream* makeStream() const; + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** + * This method will return a const reference to the URL member which + * contains the system id in pre-parsed URL form. If you just want the + * string format, call getSystemId() on the parent class. + * + * @return A const reference to a URL object that contains the current + * system id set for this input source. + */ + const XMLURL& urlSrc() const; + + //@} + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + URLInputSource(const URLInputSource&); + URLInputSource& operator=(const URLInputSource&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fURL + // This is the URL created from the passed ids. + // ----------------------------------------------------------------------- + XMLURL fURL; +}; + + +inline const XMLURL& URLInputSource::urlSrc() const +{ + return fURL; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/ValidationContext.hpp b/project/jni/xerces/src/xercesc/framework/ValidationContext.hpp new file mode 100644 index 000000000..b238a1493 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/ValidationContext.hpp @@ -0,0 +1,139 @@ +/* + * 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: ValidationContext.hpp 729944 2008-12-29 17:03:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXT_HPP) +#define XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXT_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLRefInfo; +class DTDEntityDecl; +class DatatypeValidator; +class ElemStack; +class NamespaceScope; +class XMLScanner; + +class XMLPARSER_EXPORT ValidationContext : public XMemory +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + + /** + * virtual destructor + * + */ + virtual ~ValidationContext(){}; + //@} + + // ----------------------------------------------------------------------- + /** @name The ValidationContext Interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * IDRefList + * + */ + virtual RefHashTableOf* getIdRefList() const = 0; + + virtual void setIdRefList(RefHashTableOf* const) = 0; + + virtual void clearIdRefList() = 0; + + virtual void addId(const XMLCh * const ) = 0; + + virtual void addIdRef(const XMLCh * const ) = 0; + + virtual void toCheckIdRefList(bool) = 0; + + /** + * EntityDeclPool + * + */ + virtual const NameIdPool* getEntityDeclPool() const = 0; + + virtual const NameIdPool* setEntityDeclPool(const NameIdPool* const) = 0; + + virtual void checkEntity(const XMLCh * const ) const = 0 ; + + /** + * Union datatype handling + * + */ + + virtual DatatypeValidator * getValidatingMemberType() const = 0 ; + virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) = 0 ; + + /** + * QName datatype handling + * Create default implementations for source code compatibility + */ + virtual bool isPrefixUnknown(XMLCh* /* prefix */) { return true; }; + virtual void setElemStack(ElemStack* /* elemStack */) {}; + virtual const XMLCh* getURIForPrefix(XMLCh* /*prefix */) { return 0; }; + virtual void setScanner(XMLScanner* /* scanner */) { }; + virtual void setNamespaceScope(NamespaceScope* /* nsStack */) { }; + + //@} + + +protected : + // ----------------------------------------------------------------------- + /** Hidden Constructors */ + // ----------------------------------------------------------------------- + //@{ + ValidationContext(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager) + :fMemoryManager(memMgr) + { + }; + //@} + + // ----------------------------------------------------------------------- + // Data members + // + // fMemoryManager + // Pluggable memory manager for dynamic allocation/deallocation. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + ValidationContext(const ValidationContext& ); + ValidationContext& operator=(const ValidationContext& ); + //@} + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.cpp b/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.cpp new file mode 100644 index 000000000..bbaab7fab --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.cpp @@ -0,0 +1,160 @@ +/* + * 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: Wrapper4DOMLSInput.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Wrapper4DOMLSInput: Constructor and Destructor +// --------------------------------------------------------------------------- +Wrapper4DOMLSInput::Wrapper4DOMLSInput(DOMLSInput* const inputSource, + DOMLSResourceResolver* entityResolver, + const bool adoptFlag, + MemoryManager* const manager) : + InputSource(manager) + , fAdoptInputSource(adoptFlag) + , fForceXMLChEncoding(false) + , fInputSource(inputSource) + , fEntityResolver(entityResolver) +{ + if (!inputSource) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, getMemoryManager()); +} + +Wrapper4DOMLSInput::~Wrapper4DOMLSInput() +{ + if (fAdoptInputSource) + delete fInputSource; +} + + +// --------------------------------------------------------------------------- +// Wrapper4DOMLSInput: Getter methods +// --------------------------------------------------------------------------- +bool Wrapper4DOMLSInput::getIssueFatalErrorIfNotFound() const +{ + return fInputSource->getIssueFatalErrorIfNotFound(); +} + +const XMLCh* Wrapper4DOMLSInput::getEncoding() const +{ + if(fForceXMLChEncoding) + return XMLUni::fgXMLChEncodingString; + return fInputSource->getEncoding(); +} + +const XMLCh* Wrapper4DOMLSInput::getSystemId() const +{ + return fInputSource->getSystemId(); +} + +const XMLCh* Wrapper4DOMLSInput::getPublicId() const +{ + return fInputSource->getPublicId(); +} + + +// --------------------------------------------------------------------------- +// Wrapper4DOMLSInput: Setter methods +// --------------------------------------------------------------------------- +void Wrapper4DOMLSInput::setIssueFatalErrorIfNotFound(const bool flag) +{ + fInputSource->setIssueFatalErrorIfNotFound(flag); +} + + +void Wrapper4DOMLSInput::setEncoding(const XMLCh* const encodingStr) +{ + fInputSource->setEncoding(encodingStr); +} + + +void Wrapper4DOMLSInput::setPublicId(const XMLCh* const publicId) +{ + fInputSource->setPublicId(publicId); +} + + +void Wrapper4DOMLSInput::setSystemId(const XMLCh* const systemId) +{ + fInputSource->setSystemId(systemId); +} + + +// --------------------------------------------------------------------------- +// Wrapper4DOMLSInput: Stream methods +// --------------------------------------------------------------------------- +BinInputStream* Wrapper4DOMLSInput::makeStream() const +{ + // The LSParser will use the LSInput object to determine how to read data. The LSParser will look at the different inputs specified in the + // LSInput in the following order to know which one to read from, the first one that is not null and not an empty string will be used: + // 1. LSInput.characterStream + // 2. LSInput.byteStream + // 3. LSInput.stringData + // 4. LSInput.systemId + // 5. LSInput.publicId + InputSource* binStream=fInputSource->getByteStream(); + if(binStream) + return binStream->makeStream(); + const XMLCh* xmlString=fInputSource->getStringData(); + if(xmlString) + { + MemBufInputSource is((const XMLByte*)xmlString, XMLString::stringLen(xmlString)*sizeof(XMLCh), "", false, getMemoryManager()); + is.setCopyBufToStream(false); + return is.makeStream(); + } + const XMLCh* szSystemId=fInputSource->getSystemId(); + if(szSystemId) + { + XMLURL urlTmp(getMemoryManager()); + if (urlTmp.setURL(szSystemId, fInputSource->getBaseURI(), urlTmp) && !urlTmp.isRelative()) + { + URLInputSource src(urlTmp, getMemoryManager()); + return src.makeStream(); + } + LocalFileInputSource src(szSystemId, getMemoryManager()); + return src.makeStream(); + } + const XMLCh* szPublicId=fInputSource->getPublicId(); + if(szPublicId && fEntityResolver) + { + DOMLSInput* is = fEntityResolver->resolveResource(XMLUni::fgDOMDTDType, 0, szPublicId, 0, fInputSource->getBaseURI()); + if (is) + return Wrapper4DOMLSInput(is, fEntityResolver, true, getMemoryManager()).makeStream(); + } + + return 0; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.hpp b/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.hpp new file mode 100644 index 000000000..98f2af676 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/Wrapper4DOMLSInput.hpp @@ -0,0 +1,230 @@ +/* + * 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: Wrapper4DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP) +#define XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMLSInput; +class DOMLSResourceResolver; + +/** + * Wrap a DOMLSInput object and make it behave like a SAX InputSource. + */ +class XMLPARSER_EXPORT Wrapper4DOMLSInput: public InputSource +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** + * Constructor + * + * Wrap a DOMLSInput and make it behave like a SAX InputSource. + * By default, the wrapper will adopt the DOMLSInput that is wrapped. + * + * @param inputSource The DOMLSInput to be wrapped + * @param entityResolver The DOMLSResourceResolver to be used when resolving publicID entries + * @param adoptFlag Indicates if the wrapper should adopt the wrapped + * DOMLSInput. Default is true. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + Wrapper4DOMLSInput + ( + DOMLSInput* const inputSource + , DOMLSResourceResolver* entityResolver = 0 + , const bool adoptFlag = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Destructor + * + */ + virtual ~Wrapper4DOMLSInput(); + //@} + + + // ----------------------------------------------------------------------- + /** @name Virtual input source interface */ + //@{ + /** + * + * Makes the byte stream for this input source. + * + *

The function will call the makeStream of the wrapped input source. + * The returned stream becomes the parser's property.

+ * + * @see BinInputStream + */ + BinInputStream* makeStream() const; + + //@} + + // ----------------------------------------------------------------------- + /** @name Getter methods */ + //@{ + /** + * + * An input source can be set to force the parser to assume a particular + * encoding for the data that input source reprsents, via the setEncoding() + * method. This method will delegate to the wrapped input source to return + * name of the encoding that is to be forced. If the encoding has never + * been forced, it returns a null pointer. + * + * @return The forced encoding, or null if none was supplied. + * @see #setEncoding + */ + const XMLCh* getEncoding() const; + + + /** + * + * Get the public identifier for this input source. Delegated to the + * wrapped input source object. + * + * @return The public identifier, or null if none was supplied. + * @see #setPublicId + */ + const XMLCh* getPublicId() const; + + + /** + * + * Get the system identifier for this input source. Delegated to the + * wrapped input source object. + * + *

If the system ID is a URL, it will be fully resolved.

+ * + * @return The system identifier. + * @see #setSystemId + */ + const XMLCh* getSystemId() const; + + /** + * + * Get the flag that indicates if the parser should issue fatal error if + * this input source is not found. Delegated to the wrapped input source + * object. + * + * @return True if the parser should issue fatal error if this input source + * is not found. + * False if the parser issue warning message instead. + * @see #setIssueFatalErrorIfNotFound + */ + bool getIssueFatalErrorIfNotFound() const; + + //@} + + + // ----------------------------------------------------------------------- + /** @name Setter methods */ + //@{ + + /** + * + * Set the encoding which will be required for use with the XML text read + * via a stream opened by this input source. This will update the wrapped + * input source object. + * + *

This is usually not set, allowing the encoding to be sensed in the + * usual XML way. However, in some cases, the encoding in the file is known + * to be incorrect because of intermediate transcoding, for instance + * encapsulation within a MIME document. + * + * @param encodingStr The name of the encoding to force. + */ + void setEncoding(const XMLCh* const encodingStr); + + + /** + * + * Set the public identifier for this input source. This will update the + * wrapped input source object. + * + *

The public identifier is always optional: if the application writer + * includes one, it will be provided as part of the location information.

+ * + * @param publicId The public identifier as a string. + * @see Locator#getPublicId + * @see SAXParseException#getPublicId + * @see #getPublicId + */ + void setPublicId(const XMLCh* const publicId); + + /** + * + * Set the system identifier for this input source. This will update the + * wrapped input source object. + * + *

The system id is always required. The public id may be used to map + * to another system id, but the system id must always be present as a fall + * back.

+ * + *

If the system ID is a URL, it must be fully resolved.

+ * + * @param systemId The system identifier as a string. + * @see #getSystemId + * @see Locator#getSystemId + * @see SAXParseException#getSystemId + */ + void setSystemId(const XMLCh* const systemId); + + /** + * + * Indicates if the parser should issue fatal error if this input source + * is not found. If set to false, the parser issue warning message instead. + * This will update the wrapped input source object. + * + * @param flag True if the parser should issue fatal error if this input source is not found. + * If set to false, the parser issue warning message instead. (Default: true) + * + * @see #getIssueFatalErrorIfNotFound + */ + void setIssueFatalErrorIfNotFound(const bool flag); + + //@} + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Wrapper4DOMLSInput(const Wrapper4DOMLSInput&); + Wrapper4DOMLSInput& operator=(const Wrapper4DOMLSInput&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fAdoptInputSource, + fForceXMLChEncoding; + DOMLSInput* fInputSource; + DOMLSResourceResolver* fEntityResolver; +}; + +XERCES_CPP_NAMESPACE_END + + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.cpp b/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.cpp new file mode 100644 index 000000000..480378398 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.cpp @@ -0,0 +1,121 @@ +/* + * 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: Wrapper4InputSource.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Constructor and Destructor +// --------------------------------------------------------------------------- +Wrapper4InputSource::Wrapper4InputSource(InputSource* const inputSource, + const bool adoptFlag + , MemoryManager* const manager) : + fAdoptInputSource(adoptFlag) + , fInputSource(inputSource) +{ + if (!inputSource) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, manager); +} + +Wrapper4InputSource::~Wrapper4InputSource() +{ + if (fAdoptInputSource) + delete fInputSource; +} + + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Getter methods +// --------------------------------------------------------------------------- +bool Wrapper4InputSource::getIssueFatalErrorIfNotFound() const +{ + return fInputSource->getIssueFatalErrorIfNotFound(); +} + +const XMLCh* Wrapper4InputSource::getEncoding() const +{ + return fInputSource->getEncoding(); +} + +const XMLCh* Wrapper4InputSource::getSystemId() const +{ + return fInputSource->getSystemId(); +} + +const XMLCh* Wrapper4InputSource::getPublicId() const +{ + return fInputSource->getPublicId(); +} + + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Setter methods +// --------------------------------------------------------------------------- +void Wrapper4InputSource::setIssueFatalErrorIfNotFound(bool flag) +{ + fInputSource->setIssueFatalErrorIfNotFound(flag); +} + + +void Wrapper4InputSource::setEncoding(const XMLCh* const encodingStr) +{ + fInputSource->setEncoding(encodingStr); +} + + +void Wrapper4InputSource::setPublicId(const XMLCh* const publicId) +{ + fInputSource->setPublicId(publicId); +} + + +void Wrapper4InputSource::setSystemId(const XMLCh* const systemId) +{ + fInputSource->setSystemId(systemId); +} + + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Stream methods +// --------------------------------------------------------------------------- +InputSource* Wrapper4InputSource::getByteStream() const +{ + return fInputSource; +} + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Memory methods +// --------------------------------------------------------------------------- +void Wrapper4InputSource::release() +{ + Wrapper4InputSource* src = (Wrapper4InputSource*) this; + delete src; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.hpp b/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.hpp new file mode 100644 index 000000000..c7295a15b --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/Wrapper4InputSource.hpp @@ -0,0 +1,290 @@ +/* + * 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: Wrapper4InputSource.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4INPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_WRAPPER4INPUTSOURCE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; + + +/** + * Wrap a SAX InputSource object and make it behave like DOMLSInput. + */ +class XMLPARSER_EXPORT Wrapper4InputSource: public DOMLSInput +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** + * Constructor + * + * Wrap a SAX InputSource and make it behave like a DOMLSInput. + * By default, the wrapper will adopt the SAX InputSource that is wrapped. + * + * @param inputSource The SAX InputSource to be wrapped + * @param adoptFlag Indicates if the wrapper should adopt the wrapped + * SAX InputSource. Default is true. + * @param manager The MemoryManager to use to allocate objects + */ + Wrapper4InputSource(InputSource* const inputSource + , const bool adoptFlag = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Destructor + * + */ + virtual ~Wrapper4InputSource(); + //@} + + + // ----------------------------------------------------------------------- + /** @name Virtual input source interface */ + //@{ + /** + * This wrapper doesn't support string data + * + */ + virtual const XMLCh* getStringData() const; + + /** + * Makes the byte stream for this input source. + * + *

The function will call the makeStream of the wrapped input source. + * The returned stream becomes the parser's property.

+ * + * @see InputSource + */ + virtual InputSource* getByteStream() const; + //@} + + // ----------------------------------------------------------------------- + /** @name Getter methods */ + //@{ + /** + * An input source can be set to force the parser to assume a particular + * encoding for the data that input source represents, via the setEncoding() + * method. This method will delegate to the wrapped input source to return + * name of the encoding that is to be forced. If the encoding has never + * been forced, it returns a null pointer. + * + * @return The forced encoding, or null if none was supplied. + * @see #setEncoding + */ + virtual const XMLCh* getEncoding() const; + + + /** + * Get the public identifier for this input source. Delegated to the + * wrapped input source object. + * + * @return The public identifier, or null if none was supplied. + * @see #setPublicId + */ + const XMLCh* getPublicId() const; + + + /** + * Get the system identifier for this input source. Delegated to the + * wrapped input source object. + * + *

If the system ID is a URL, it will be fully resolved.

+ * + * @return The system identifier. + * @see #setSystemId + */ + const XMLCh* getSystemId() const; + + /** + * Get the base URI to be used for resolving relative URIs to absolute + * URIs. If the baseURI is itself a relative URI, the behavior is + * implementation dependent. Delegated to the wrapped intput source + * object. + * + * @return The base URI. + * @see #setBaseURI + * @since DOM Level 3 + */ + const XMLCh* getBaseURI() const; + + /** + * Get the flag that indicates if the parser should issue fatal error if this input source + * is not found. Delegated to the wrapped input source object. + * + * @return True if the parser should issue fatal error if this input source is not found. + * False if the parser issue warning message instead. + * @see #setIssueFatalErrorIfNotFound + */ + bool getIssueFatalErrorIfNotFound() const; + + //@} + + + // ----------------------------------------------------------------------- + /** @name Setter methods */ + //@{ + /** + * This wrapper only exposes the given InputSource, no setting allowed + * + */ + virtual void setStringData(const XMLCh* data); + + /** + * This wrapper only exposes the given InputSource, no setting allowed + * + */ + virtual void setByteStream(InputSource* stream); + + /** + * Set the encoding which will be required for use with the XML text read + * via a stream opened by this input source. This will update the wrapped + * input source object. + * + *

This is usually not set, allowing the encoding to be sensed in the + * usual XML way. However, in some cases, the encoding in the file is known + * to be incorrect because of intermediate transcoding, for instance + * encapsulation within a MIME document. + * + * @param encodingStr The name of the encoding to force. + */ + void setEncoding(const XMLCh* const encodingStr); + + + /** + * Set the public identifier for this input source. This will update the + * wrapped input source object. + * + *

The public identifier is always optional: if the application writer + * includes one, it will be provided as part of the location information.

+ * + * @param publicId The public identifier as a string. + * @see Locator#getPublicId + * @see SAXParseException#getPublicId + * @see #getPublicId + */ + void setPublicId(const XMLCh* const publicId); + + /** + * Set the system identifier for this input source. This will update the + * wrapped input source object. + * + *

The system id is always required. The public id may be used to map + * to another system id, but the system id must always be present as a fall + * back.

+ * + *

If the system ID is a URL, it must be fully resolved.

+ * + * @param systemId The system identifier as a string. + * @see #getSystemId + * @see Locator#getSystemId + * @see SAXParseException#getSystemId + */ + void setSystemId(const XMLCh* const systemId); + + /** + * Set the base URI to be used for resolving relative URIs to absolute + * URIs. If the baseURI is itself a relative URI, the behavior is + * implementation dependent. This will update the wrapped input source + * object. + * + * @param baseURI The base URI. + * @see #getBaseURI + * @since DOM Level 3 + */ + void setBaseURI(const XMLCh* const baseURI); + + /** + * Indicates if the parser should issue fatal error if this input source + * is not found. If set to false, the parser issue warning message + * instead. This will update the wrapped input source object. + * + * @param flag True if the parser should issue fatal error if this input + * source is not found. + * If set to false, the parser issue warning message instead. + * (Default: true) + * + * @see #getIssueFatalErrorIfNotFound + */ + void setIssueFatalErrorIfNotFound(bool flag); + + /** + * Called to indicate that this DOMInputSource is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + * Access to a released object will lead to unexpected result. + */ + void release(); + + //@} + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Wrapper4InputSource(const Wrapper4InputSource&); + Wrapper4InputSource& operator=(const Wrapper4InputSource&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fAdoptInputSource; + InputSource* fInputSource; +}; + + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* Wrapper4InputSource::getBaseURI() const +{ + return 0; // REVISIT - should we return an empty string? +} + +inline const XMLCh* Wrapper4InputSource::getStringData() const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// Wrapper4InputSource: Setter methods +// --------------------------------------------------------------------------- +inline void Wrapper4InputSource::setBaseURI(const XMLCh* const) +{ +} + +inline void Wrapper4InputSource::setStringData(const XMLCh*) +{ +} + +inline void Wrapper4InputSource::setByteStream(InputSource*) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttDef.cpp b/project/jni/xerces/src/xercesc/framework/XMLAttDef.cpp new file mode 100644 index 000000000..a25094235 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttDef.cpp @@ -0,0 +1,220 @@ +/* + * 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: XMLAttDef.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// +// gAttTypeStrings +// A list of strings which are used to map attribute type numbers to +// attribute type names. +// +// gDefAttTypesStrings +// A list of strings which are used to map default attribute type +// numbers to default attribute type names. +// --------------------------------------------------------------------------- +const XMLCh* const gAttTypeStrings[XMLAttDef::AttTypes_Count] = +{ + XMLUni::fgCDATAString + , XMLUni::fgIDString + , XMLUni::fgIDRefString + , XMLUni::fgIDRefsString + , XMLUni::fgEntityString + , XMLUni::fgEntitiesString + , XMLUni::fgNmTokenString + , XMLUni::fgNmTokensString + , XMLUni::fgNotationString + , XMLUni::fgEnumerationString + , XMLUni::fgCDATAString + , XMLUni::fgCDATAString + , XMLUni::fgCDATAString + , XMLUni::fgCDATAString + +}; + +const XMLCh* const gDefAttTypeStrings[XMLAttDef::DefAttTypes_Count] = +{ + XMLUni::fgDefaultString + , XMLUni::fgFixedString + , XMLUni::fgRequiredString + , XMLUni::fgImpliedString + , XMLUni::fgImpliedString + , XMLUni::fgImpliedString + , XMLUni::fgImpliedString + , XMLUni::fgImpliedString + , XMLUni::fgImpliedString +}; + + + +// --------------------------------------------------------------------------- +// XMLAttDef: Public, static data members +// --------------------------------------------------------------------------- +const unsigned int XMLAttDef::fgInvalidAttrId = 0xFFFFFFFE; + + +// --------------------------------------------------------------------------- +// XMLAttDef: Public, static methods +// --------------------------------------------------------------------------- +const XMLCh* XMLAttDef::getAttTypeString(const XMLAttDef::AttTypes attrType + , MemoryManager* const manager) +{ + // Check for an invalid attribute type and return a null + if ((attrType < AttTypes_Min) || (attrType > AttTypes_Max)) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttDef_BadAttType, manager); + return gAttTypeStrings[attrType]; +} + +const XMLCh* XMLAttDef::getDefAttTypeString(const XMLAttDef::DefAttTypes attrType + , MemoryManager* const manager) +{ + // Check for an invalid attribute type and return a null + if ((attrType < DefAttTypes_Min) || (attrType > DefAttTypes_Max)) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttDef_BadDefAttType, manager); + return gDefAttTypeStrings[attrType]; +} + + +// --------------------------------------------------------------------------- +// XMLAttDef: Destructor +// --------------------------------------------------------------------------- +XMLAttDef::~XMLAttDef() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// XMLAttDef: Hidden constructors +// --------------------------------------------------------------------------- +XMLAttDef::XMLAttDef( const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , MemoryManager* const manager) : + + fDefaultType(defType) + , fType(type) + , fCreateReason(XMLAttDef::NoReason) + , fExternalAttribute(false) + , fId(XMLAttDef::fgInvalidAttrId) + , fValue(0) + , fEnumeration(0) + , fMemoryManager(manager) +{ +} + +typedef JanitorMemFunCall CleanupType; + +XMLAttDef::XMLAttDef( const XMLCh* const attrValue + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , const XMLCh* const enumValues + , MemoryManager* const manager) : + + fDefaultType(defType) + , fType(type) + , fCreateReason(XMLAttDef::NoReason) + , fExternalAttribute(false) + , fId(XMLAttDef::fgInvalidAttrId) + , fValue(0) + , fEnumeration(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLAttDef::cleanUp); + + try + { + fValue = XMLString::replicate(attrValue, fMemoryManager); + fEnumeration = XMLString::replicate(enumValues, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +// --------------------------------------------------------------------------- +// XMLAttDef: Private helper methods +// --------------------------------------------------------------------------- +void XMLAttDef::cleanUp() +{ + if (fEnumeration) + fMemoryManager->deallocate(fEnumeration); + + if (fValue) + fMemoryManager->deallocate(fValue); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLAttDef) + +void XMLAttDef::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<<(int)fDefaultType; + serEng<<(int)fType; + serEng<<(int)fCreateReason; + serEng<>i; + fDefaultType = (DefAttTypes) i; + + serEng>>i; + fType = (AttTypes)i; + + serEng>>i; + fCreateReason = (CreateReasons)i; + + serEng>>fExternalAttribute; + serEng.readSize (fId); + + serEng.readString(fValue); + serEng.readString(fEnumeration); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttDef.hpp b/project/jni/xerces/src/xercesc/framework/XMLAttDef.hpp new file mode 100644 index 000000000..f65f96bd5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttDef.hpp @@ -0,0 +1,539 @@ +/* + * 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: XMLAttDef.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEF_HPP) +#define XERCESC_INCLUDE_GUARD_XMLATTDEF_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLAttr; + +/** Represents the core information of an attribute definition + * + * This class defines the basic characteristics of an attribute, no matter + * what type of validator is used. If a particular schema associates more + * information with an attribute it will create a derivative of this class. + * So this class provides an abstract way to get basic information on + * attributes from any type of validator. + * + * This class supports keyed collection semantics on the fully qualified + * attribute name, by providing a getKey() method to extract the key string. + * getKey(), in this case, just calls the virtual method getFullName() to + * get the fully qualified name, as defined by the derived class. + * + * Note that the 'value' of an attribute type definition is the default or + * of fixed value given to it in its definition. If the attribute is of the + * enumerated or notation type, it will have an 'enumeration value' as well + * which is a space separated list of its possible vlaues. + */ +class XMLPARSER_EXPORT XMLAttDef : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Class specific types + // + // AttTypes + // The list of possible types that an attribute can have, according + // to the XML 1.0 spec and schema. + // + // DefAttTypes + // The modifiers that an attribute decl can have, which indicates + // whether instances of that attributes are required, implied, etc.. + // + // CreateReasons + // This type is used to store how an attribute declaration got into + // the elementdecl's attribute pool. + // + // ----------------------------------------------------------------------- + enum AttTypes + { + CData = 0 + , ID = 1 + , IDRef = 2 + , IDRefs = 3 + , Entity = 4 + , Entities = 5 + , NmToken = 6 + , NmTokens = 7 + , Notation = 8 + , Enumeration = 9 + , Simple = 10 + , Any_Any = 11 + , Any_Other = 12 + , Any_List = 13 + + , AttTypes_Count + , AttTypes_Min = 0 + , AttTypes_Max = 13 + , AttTypes_Unknown = -1 + }; + + enum DefAttTypes + { + Default = 0 + , Fixed = 1 + , Required = 2 + , Required_And_Fixed = 3 + , Implied = 4 + , ProcessContents_Skip = 5 + , ProcessContents_Lax = 6 + , ProcessContents_Strict = 7 + , Prohibited = 8 + + , DefAttTypes_Count + , DefAttTypes_Min = 0 + , DefAttTypes_Max = 8 + , DefAttTypes_Unknown = -1 + }; + + enum CreateReasons + { + NoReason + , JustFaultIn + }; + + // ----------------------------------------------------------------------- + // Public static data members + // ----------------------------------------------------------------------- + static const unsigned int fgInvalidAttrId; + + + // ----------------------------------------------------------------------- + // Public, static methods + // ----------------------------------------------------------------------- + + /** @name Public, static methods */ + //@{ + + /** Get a string representation of the passed attribute type enum + * + * This method allows you to get a textual representation of an attribute + * type, mostly for debug or display. + * + * @param attrType The attribute type value to get the string for. + * @param manager The MemoryManager to use to allocate objects + * @return A const pointer to the static string that holds the text + * description of the passed type. + */ + static const XMLCh* getAttTypeString(const AttTypes attrType + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Get a string representation of the passed def attribute type enum + * + * This method allows you to get a textual representation of an default + * attributetype, mostly for debug or display. + * + * @param attrType The default attribute type value to get the string for. + * @param manager The MemoryManager to use to allocate objects + * @return A const pointer to the static string that holds the text + * description of the passed default type. + */ + static const XMLCh* getDefAttTypeString(const DefAttTypes attrType + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + + /** + * Destructor + */ + virtual ~XMLAttDef(); + //@} + + + // ----------------------------------------------------------------------- + // The virtual attribute def interface + // ----------------------------------------------------------------------- + + /** @name Virtual interface */ + //@{ + + /** Get the full name of this attribute type + * + * The derived class should return a const pointer to the full name of + * this attribute. This will vary depending on the type of validator in + * use. + * + * @return A const pointer to the full name of this attribute type. + */ + virtual const XMLCh* getFullName() const = 0; + + /** + * The derived class should implement any cleaning up required between + * each use of an instance of this class for validation + */ + virtual void reset() = 0; + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** Get the default type of this attribute type + * + * This method returns the 'default type' of the attribute. Default + * type in this case refers to the XML concept of a default type for + * an attribute, i.e. \#FIXED, \#IMPLIED, etc... + * + * @return The default type enum for this attribute type. + */ + DefAttTypes getDefaultType() const; + + /** Get the enumeration value (if any) of this attribute type + * + * If the attribute is of an enumeration or notation type, then this + * method will return a const reference to a string that contains the + * space separated values that can the attribute can have. + * + * @return A const pointer to a string that contains the space separated + * legal values for this attribute. + */ + const XMLCh* getEnumeration() const; + + /** Get the pool id of this attribute type + * + * This method will return the id of this attribute in the validator's + * attribute pool. It was set by the validator when this attribute was + * created. + * + * @return The pool id of this attribute type. + */ + XMLSize_t getId() const; + + /** Get the type of this attribute + * + * Gets the type of this attribute. This type is represented by an enum + * that converts the types of attributes allowed by XML, e.g. CDATA, NMTOKEN, + * NOTATION, etc... + * + * @return The attribute type enumeration value for this type of + * attribute. + */ + AttTypes getType() const; + + /** Get the default/fixed value of this attribute (if any.) + * + * If the attribute defined a default/fixed value, then it is stored + * and this method will retrieve it. If it has non, then a null pointer + * is returned. + * + * @return A const pointer to the default/fixed value for this attribute + * type. + */ + const XMLCh* getValue() const; + + /** Get the create reason for this attribute + * + * This method returns an enumeration which indicates why this attribute + * declaration exists. + * + * @return An enumerated value that indicates the reason why this attribute + * was added to the attribute table. + */ + CreateReasons getCreateReason() const; + + /** Indicate whether this attribute has been declared externally + * + * This method returns a boolean that indicates whether this attribute + * has been declared externally. + * + * @return true if this attribute has been declared externally, else false. + */ + bool isExternal() const; + + /** Get the plugged-in memory manager + * + * This method returns the plugged-in memory manager user for dynamic + * memory allocation/deallocation. + * + * @return the plugged-in memory manager + */ + MemoryManager* getMemoryManager() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** Set the default attribute type + * + * This method sets the default attribute type for this attribute. + * This setting controls whether the attribute is required, fixed, + * implied, etc... + * + * @param newValue The new default attribute to set + */ + void setDefaultType(const XMLAttDef::DefAttTypes newValue); + + /** Set the pool id for this attribute type. + * + * This method sets the pool id of this attribute type. This is usually + * called by the validator that creates the actual instance (which is of + * a derived type known only by the validator.) + * + * @param newId The new pool id to set. + */ + void setId(const XMLSize_t newId); + + /** Set the type of this attribute type. + * + * This method will set the type of the attribute. The type of an attribute + * controls how it is normalized and what kinds of characters it can hold. + * + * @param newValue The new attribute type to set + */ + void setType(const XMLAttDef::AttTypes newValue); + + /** Set the default/fixed value of this attribute type. + * + * This method set the fixed/default value for the attribute. This value + * will be used when instances of this attribute type are faulted in. It + * must be a valid value for the type set by setType(). If the + * type is enumeration or notation, this must be one of the valid values + * set in the setEnumeration() call. + * + * @param newValue The new fixed/default value to set. + */ + void setValue(const XMLCh* const newValue); + + /** Set the enumerated value of this attribute type. + * + * This method sets the enumerated/notation value list for this attribute + * type. It is a space separated set of possible values. These values must + * meet the constrains of the XML spec for such values of this type of + * attribute. This should only be set if the setType() method is used to + * set the type to the enumeration or notation types. + * + * @param newValue The new enumerated/notation value list to set. + */ + void setEnumeration(const XMLCh* const newValue); + + /** Update the create reason for this attribute type. + * + * This method will update the 'create reason' field for this attribute + * decl object. + * + * @param newReason The new create reason. + */ + void setCreateReason(const CreateReasons newReason); + + /** + * Set the attribute decl to indicate external declaration + * + * @param aValue The new value to indicate external declaration. + */ + void setExternalAttDeclaration(const bool aValue); + + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLAttDef) + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLAttDef + ( + const AttTypes type = CData + , const DefAttTypes defType= Implied + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLAttDef + ( + const XMLCh* const attValue + , const AttTypes type + , const DefAttTypes defType + , const XMLCh* const enumValues = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLAttDef(const XMLAttDef&); + XMLAttDef& operator=(const XMLAttDef&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fDefaultType + // Indicates what, if any, default stuff this attribute has. + // + // fEnumeration + // If its an enumeration, this is the list of values as space + // separated values. + // + // fId + // This is the unique id of this attribute, given to it when its put + // into the validator's attribute decl pool. It defaults to the + // special value XMLAttrDef::fgInvalidAttrId. + // + // fType + // The type of attribute, which is one of the AttTypes values. + // + // fValue + // This is the value of the attribute, which is the default value + // given in the attribute declaration. + // + // fCreateReason + // This flag tells us how this attribute got created. Sometimes even + // the attribute was not declared for the element, we want to fault + // fault it into the pool to avoid lots of redundant errors. + // + // fExternalAttribute + // This flag indicates whether or not the attribute was declared externally. + // ----------------------------------------------------------------------- + DefAttTypes fDefaultType; + AttTypes fType; + CreateReasons fCreateReason; + bool fExternalAttribute; + XMLSize_t fId; + XMLCh* fValue; + XMLCh* fEnumeration; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// Getter methods +// --------------------------------------------------------------------------- +inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const +{ + return fDefaultType; +} + +inline const XMLCh* XMLAttDef::getEnumeration() const +{ + return fEnumeration; +} + +inline XMLSize_t XMLAttDef::getId() const +{ + return fId; +} + +inline XMLAttDef::AttTypes XMLAttDef::getType() const +{ + return fType; +} + +inline const XMLCh* XMLAttDef::getValue() const +{ + return fValue; +} + +inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const +{ + return fCreateReason; +} + +inline bool XMLAttDef::isExternal() const +{ + return fExternalAttribute; +} + +inline MemoryManager* XMLAttDef::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// XMLAttDef: Setter methods +// --------------------------------------------------------------------------- +inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue) +{ + fDefaultType = newValue; +} + +inline void XMLAttDef::setEnumeration(const XMLCh* const newValue) +{ + if (fEnumeration) + fMemoryManager->deallocate(fEnumeration); + + fEnumeration = XMLString::replicate(newValue, fMemoryManager); +} + +inline void XMLAttDef::setId(const XMLSize_t newId) +{ + fId = newId; +} + +inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue) +{ + fType = newValue; +} + +inline void XMLAttDef::setValue(const XMLCh* const newValue) +{ + if (fValue) + fMemoryManager->deallocate(fValue); + + fValue = XMLString::replicate(newValue, fMemoryManager); +} + +inline void +XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason) +{ + fCreateReason = newReason; +} + +inline void XMLAttDef::setExternalAttDeclaration(const bool aValue) +{ + fExternalAttribute = aValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttDefList.cpp b/project/jni/xerces/src/xercesc/framework/XMLAttDefList.cpp new file mode 100644 index 000000000..63df5c7b9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttDefList.cpp @@ -0,0 +1,42 @@ +/* + * 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: XMLAttDefList.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLAttDefList) + +void XMLAttDefList::serialize(XSerializeEngine&) +{ + //no data +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttDefList.hpp b/project/jni/xerces/src/xercesc/framework/XMLAttDefList.hpp new file mode 100644 index 000000000..142f47892 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttDefList.hpp @@ -0,0 +1,171 @@ +/* + * 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: XMLAttDefList.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP) +#define XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLAttDef; + +/** + * This class defines an abstract interface that all validators must support. + * When the scanner scans the attributes in a start tag, it must have a list + * of the defined attributes for that element. This is used to fault in + * defaulted and fixed attributes, to know which ones are required, and to + * know the their types in order to do the correct normalization. + * + * Since each validator will have its own derivatives of XMLAttDef and will + * have its own specialized storage mechanisms for elements and the att + * defs that they own, there must be an abstracted way for the scanner to + * deal with this list. + * + * It does not derive from the generic Enumerator template class, because + * there are portability issues with deriving from a template class in a + * DLL. It does though provide a similar enumerator interface. + */ + +class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + virtual ~XMLAttDefList(); + //@} + + + // ----------------------------------------------------------------------- + // The virtual interface + // ----------------------------------------------------------------------- + + virtual bool isEmpty() const = 0; + virtual XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ) = 0; + virtual const XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ) const = 0; + virtual XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ) = 0; + virtual const XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ) const = 0; + + /** + * return total number of attributes in this list + */ + virtual XMLSize_t getAttDefCount() const = 0; + + /** + * return attribute at the index-th position in the list. + */ + virtual XMLAttDef &getAttDef(XMLSize_t index) = 0; + + /** + * return attribute at the index-th position in the list. + */ + virtual const XMLAttDef &getAttDef(XMLSize_t index) const = 0; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLAttDefList) + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** Get the memory manager + * + * This method returns the configurable memory manager used by the + * element declaration for dynamic allocation/deallocation. + * + * @return the memory manager + */ + MemoryManager* getMemoryManager() const; + + //@} + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors and operators + // ----------------------------------------------------------------------- + XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // unimplemented + XMLAttDefList(const XMLAttDefList&); + XMLAttDefList& operator=(const XMLAttDefList&); + + MemoryManager* fMemoryManager; +}; + + + +// --------------------------------------------------------------------------- +// XMLAttDefList: Getter methods +// --------------------------------------------------------------------------- + +inline MemoryManager* XMLAttDefList::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// XMLAttDefList: Constructors and Destructor +// --------------------------------------------------------------------------- +inline XMLAttDefList::~XMLAttDefList() +{ +} + + +// --------------------------------------------------------------------------- +// XMLAttDefList: Protected Constructor +// --------------------------------------------------------------------------- +inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager): +fMemoryManager(manager) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttr.cpp b/project/jni/xerces/src/xercesc/framework/XMLAttr.cpp new file mode 100644 index 000000000..cee3d05c6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttr.cpp @@ -0,0 +1,172 @@ +/* + * 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: XMLAttr.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLAttr: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLAttr::XMLAttr(MemoryManager* const manager) : + + fSpecified(false) + , fType(XMLAttDef::CData) + , fValueBufSz(0) + , fValue(0) + , fAttName(0) + , fMemoryManager(manager) +{ + fAttName = new (fMemoryManager) QName(fMemoryManager); +} + +typedef JanitorMemFunCall CleanupType; + +XMLAttr::XMLAttr( const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type + , const bool specified + , MemoryManager* const manager + , DatatypeValidator* + , const bool /*isSchema*/ ): + + fSpecified(specified) + , fType(type) + , fValueBufSz(0) + , fValue(0) + , fAttName(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLAttr::cleanUp); + + try + { + // + // Just call the local setters to set up everything. Too much + // work is required to replicate that functionality here. + // + fAttName = new (fMemoryManager) QName(attrPrefix, attrName, uriId, fMemoryManager); + setValue(attrValue); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLAttr::XMLAttr( const unsigned int uriId + , const XMLCh* const rawName + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type + , const bool specified + , MemoryManager* const manager + , DatatypeValidator * + , const bool /*isSchema*/ ): + + fSpecified(specified) + , fType(type) + , fValueBufSz(0) + , fValue(0) + , fAttName(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLAttr::cleanUp); + + try + { + // Just call the local setters to set up everything. Too much + // work is required to replicate that functionality here. + fAttName = new (fMemoryManager) QName(rawName, uriId, fMemoryManager); + setValue(attrValue); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +// --------------------------------------------------------------------------- +// XMLAttr: Getter methods +// --------------------------------------------------------------------------- +const XMLCh* XMLAttr::getQName() const +{ + return fAttName->getRawName(); +} + + +// --------------------------------------------------------------------------- +// XMLAttr: Setter methods +// --------------------------------------------------------------------------- +void XMLAttr::setName( const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix) +{ + fAttName->setName(attrPrefix, attrName, uriId); +} + + +void XMLAttr::setURIId(const unsigned int uriId) +{ + fAttName->setURI(uriId); +} + + +void XMLAttr::setValue(const XMLCh* const newValue) +{ + const XMLSize_t newLen = XMLString::stringLen(newValue); + if (!fValueBufSz || (newLen > fValueBufSz)) + { + fMemoryManager->deallocate(fValue); //delete [] fValue; + fValue = 0; + fValueBufSz = newLen + 8; + fValue = (XMLCh*) fMemoryManager->allocate((fValueBufSz+1) * sizeof(XMLCh)); //new XMLCh[fValueBufSz + 1]; + } + XMLString::moveChars(fValue, newValue, newLen + 1); +} + + +// --------------------------------------------------------------------------- +// XMLAttr: Private, helper methods +// --------------------------------------------------------------------------- +void XMLAttr::cleanUp() +{ + delete fAttName; + fMemoryManager->deallocate(fValue); //delete [] fValue; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLAttr.hpp b/project/jni/xerces/src/xercesc/framework/XMLAttr.hpp new file mode 100644 index 000000000..4db3cf59e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLAttr.hpp @@ -0,0 +1,501 @@ +/* + * 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: XMLAttr.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLATTR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLATTR_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class defines the information about an attribute that will come out + * of the scanner during parsing. This information does not depend upon the + * type of validator because it is not tied to any scheme/DTD type info. Its + * just the raw XML 1.0 information that will be reported about an attribute + * in the startElement() callback method of the XMLDocumentHandler class. + * Hence it is not intended to be extended or derived from. Its designed to + * be used as is. + * + * The 'specified' field of this class indicates whether the attribute was + * actually present or whether it was faulted in because it had a fixed or + * default value. + * + * The code receiving this information can ask its validator for more info + * about the attribute, i.e. get its declaration from the DTD/Schema info. + * + * Because of the heavy use (and reuse) of instances of this class, and the + * number of string members it has, this class takes pains to not reallocate + * string members unless it has to. It keeps up with how long each buffer + * is and only reallocates if the new value won't fit. + */ +class XMLPARSER_EXPORT XMLAttr : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor just setsup an empty attribute to be filled + * in the later. Though the initial state is a reasonable one, it is + * not documented because it should not be depended on. + * + * @param manager The configurable memory manager + */ + XMLAttr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * This is the primary constructor which takes all of the information + * required to construct a complete attribute object. + * + * @param uriId The id into the validator's URI pool of the URI + * that the prefix mapped to. Only used if namespaces + * are enabled/supported. + * + * @param attrName The base name of the attribute, i.e. the part + * after any prefix. + * + * @param attrPrefix The prefix, if any, of this attribute's name. If + * this is empty, then uriID is meaningless as well. + * + * @param attrValue The value string of the attribute, which should + * be fully normalized by XML rules! + * + * @param type The type of the attribute. This will indicate + * the type of normalization done and constrains + * the value content. Make sure that the value + * set meets the constraints! + * + * @param specified Indicates whether the attribute was explicitly + * specified or not. If not, then it was faulted + * in from a FIXED or DEFAULT value. + * + * @param manager The configurable memory manager + * @param datatypeValidator type used to validate the attribute, + * if it was validated by an XML Schema + * @param isSchema true if and only if this attribute was validated + * by an XML Schema + */ + XMLAttr + ( + const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type = XMLAttDef::CData + , const bool specified = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , DatatypeValidator * datatypeValidator = 0 + , const bool isSchema = false + ); + + /** + * This is the primary constructor which takes all of the information + * required to construct a complete attribute object. + * + * @param uriId The id into the validator's URI pool of the URI + * that the prefix mapped to. Only used if namespaces + * are enabled/supported. + * + * @param rawName The raw name of the attribute. + * + * @param attrValue The value string of the attribute, which should + * be fully normalized by XML rules! + * + * @param type The type of the attribute. This will indicate + * the type of normalization done and constrains + * the value content. Make sure that the value + * set meets the constraints! + * + * @param specified Indicates whether the attribute was explicitly + * specified or not. If not, then it was faulted + * in from a FIXED or DEFAULT value. + * + * @param manager The configurable memory manager + * @param datatypeValidator type used to validate the attribute, + * if it was validated by an XML Schema + * @param isSchema true if and only if this attribute was validated + * by an XML Schema + */ + XMLAttr + ( + const unsigned int uriId + , const XMLCh* const rawName + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type = XMLAttDef::CData + , const bool specified = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , DatatypeValidator * datatypeValidator = 0 + , const bool isSchema = false + ); + + //@} + + /** @name Destructor */ + //@{ + ~XMLAttr(); + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** + * This method returns the attribute name in a QName format. + */ + QName* getAttName() const; + + /** + * This method gets a const pointer to the name of the attribute. The + * form of this name is defined by the validator in use. + */ + const XMLCh* getName() const; + + /** + * This method will get a const pointer to the prefix string of this + * attribute. Since prefixes are optional, it may be zero. + */ + const XMLCh* getPrefix() const; + + /** + * This method will get the QName of this attribute, which will be the + * prefix if any, then a colon, then the base name. If there was no + * prefix, its the same as the getName() method. + */ + const XMLCh* getQName() const; + + /** + * This method will get the specified flag, which indicates whether + * the attribute was explicitly specified or just faulted in. + */ + bool getSpecified() const; + + /** + * This method will get the type of the attribute. The available types + * are defined by the XML specification. + */ + XMLAttDef::AttTypes getType() const; + + /** + * This method will get the value of the attribute. The value can be + * be an empty string, but never null if the object is correctly + * set up. + */ + const XMLCh* getValue() const; + + /** + * This method will get the id of the URI that this attribute's prefix + * mapped to. If namespaces are not on, then its value is meaningless. + */ + unsigned int getURIId() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** + * This method is called to set up a default constructed object after + * the fact, or to reuse a previously used object. + * + * @param uriId The id into the validator's URI pool of the URI + * that the prefix mapped to. Only used if namespaces + * are enabled/supported. + * + * @param attrName The base name of the attribute, i.e. the part + * after any prefix. + * + * @param attrPrefix The prefix, if any, of this attribute's name. If + * this is empty, then uriID is meaningless as well. + * + * @param attrValue The value string of the attribute, which should + * be fully normalized by XML rules according to the + * attribute type. + * + * @param type The type of the attribute. This will indicate + * the type of normalization done and constrains + * the value content. Make sure that the value + * set meets the constraints! + * @param datatypeValidator type used to validate the attribute, + * if it was validated by an XML Schema + * @param isSchema true if and only if this attribute was validated + * by an XML Schema + * + */ + void set + ( + const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type = XMLAttDef::CData + , DatatypeValidator * datatypeValidator = 0 + , const bool isSchema = false + ); + + /** + * This method is called to set up a default constructed object after + * the fact, or to reuse a previously used object. + * + * @param uriId The id into the validator's URI pool of the URI + * that the prefix mapped to. Only used if namespaces + * are enabled/supported. + * + * @param attrRawName The raw name of the attribute. + * + * @param attrValue The value string of the attribute, which should + * be fully normalized by XML rules according to the + * attribute type. + * + * @param type The type of the attribute. This will indicate + * the type of normalization done and constrains + * the value content. Make sure that the value + * set meets the constraints! + * @param datatypeValidator type used to validate the attribute, + * if it was validated by an XML Schema + * @param isSchema true if and only if this attribute was validated + * by an XML Schema + */ + void set + ( + const unsigned int uriId + , const XMLCh* const attrRawName + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type = XMLAttDef::CData + , DatatypeValidator * datatypeValidator = 0 + , const bool isSchema = false + ); + + /** + * This method will update just the name related fields of the + * attribute object. The other fields are left as is. + * + * @param uriId The id into the validator's URI pool of the URI + * that the prefix mapped to. Only used if namespaces + * are enabled/supported. + * + * @param attrName The base name of the attribute, i.e. the part + * after any prefix. + * + * @param attrPrefix The prefix, if any, of this attribute's name. If + * this is empty, then uriID is meaningless as well. + */ + void setName + ( + const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix + ); + + /** + * This method will update the specified state of the object. + * + * @param newValue Indicates whether the attribute was explicitly + * specified or not. If not, then it was faulted + * in from a FIXED or DEFAULT value. + */ + void setSpecified(const bool newValue); + + /** + * This method will update the attribute type of the object. + * + * @param newType The type of the attribute. This will indicate + * the type of normalization done and constrains + * the value content. Make sure that the value + * set meets the constraints! + */ + void setType(const XMLAttDef::AttTypes newType); + + /** + * This method will update the value field of the attribute. + * + * @param newValue The value string of the attribute, which should + * be fully normalized by XML rules according to the + * attribute type. + */ + void setValue(const XMLCh* const newValue); + + /** + * This method will set the URI id field of this attribute. This is + * generally only ever called internally by the parser itself during + * the parsing process. + * + * @param uriId The uriId of the attribute. + */ + void setURIId(const unsigned int uriId); + + //@} + + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLAttr(const XMLAttr&); + XMLAttr& operator=(const XMLAttr&); + + + // ----------------------------------------------------------------------- + // Private, helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + + // ----------------------------------------------------------------------- + // Private instance variables + // + // fAttName + // The Attribute Name; + // + // fSpecified + // True if this attribute appeared in the element; else, false if + // it was defaulted from an AttDef. + // + // fType + // The attribute type enum value for this attribute. Indicates what + // type of attribute it was. + // + // fValue + // fValueBufSz + // The attribute value that was given in the attribute instance, and + // its current buffer size (minus one, where the null is.) + // + // fMemoryManager + // The memory manager used for dynamic memory allocation/deallocation + // ----------------------------------------------------------------------- + bool fSpecified; + XMLAttDef::AttTypes fType; + XMLSize_t fValueBufSz; + XMLCh* fValue; + QName* fAttName; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XMLAttr: Constructors and Destructor +// --------------------------------------------------------------------------- +inline XMLAttr::~XMLAttr() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// XMLAttr: Getter methods +// --------------------------------------------------------------------------- +inline QName* XMLAttr::getAttName() const +{ + return fAttName; +} + +inline const XMLCh* XMLAttr::getName() const +{ + return fAttName->getLocalPart(); +} + +inline const XMLCh* XMLAttr::getPrefix() const +{ + return fAttName->getPrefix(); +} + +inline bool XMLAttr::getSpecified() const +{ + return fSpecified; +} + +inline XMLAttDef::AttTypes XMLAttr::getType() const +{ + return fType; +} + +inline const XMLCh* XMLAttr::getValue() const +{ + return fValue; +} + +inline unsigned int XMLAttr::getURIId() const +{ + return fAttName->getURI(); +} + +// --------------------------------------------------------------------------- +// XMLAttr: Setter methods +// --------------------------------------------------------------------------- +inline void XMLAttr::set(const unsigned int uriId + , const XMLCh* const attrName + , const XMLCh* const attrPrefix + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type + , DatatypeValidator * /*datatypeValidator */ + , const bool /*isSchema*/ ) +{ + // Set the name info and the value via their respective calls + fAttName->setName(attrPrefix, attrName, uriId); + setValue(attrValue); + + // And store the type + fType = type; +} + +inline void XMLAttr::set(const unsigned int uriId + , const XMLCh* const attrRawName + , const XMLCh* const attrValue + , const XMLAttDef::AttTypes type + , DatatypeValidator * /*datatypeValidator */ + , const bool /*isSchema*/ ) +{ + // Set the name info and the value via their respective calls + fAttName->setName(attrRawName, uriId); + setValue(attrValue); + + // And store the type + fType = type; +} + +inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue) +{ + fType = newValue; +} + +inline void XMLAttr::setSpecified(const bool newValue) +{ + fSpecified = newValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLBuffer.cpp b/project/jni/xerces/src/xercesc/framework/XMLBuffer.cpp new file mode 100644 index 000000000..22e0f08f7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLBuffer.cpp @@ -0,0 +1,86 @@ +/* + * 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: XMLBuffer.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLBuffer: Buffer management +// --------------------------------------------------------------------------- + +void XMLBuffer::ensureCapacity(const XMLSize_t extraNeeded) +{ + // If we can't handle it, try doubling the buffer size. + XMLSize_t newCap = (fIndex + extraNeeded) * 2; + + // If a maximum size is set, and double the current buffer size exceeds that + // maximum, first check if the maximum size will accomodate the extra needed. + if (fFullHandler && (newCap > fFullSize)) + { + // If the maximum buffer size accomodates the extra needed, resize to + // the maximum + if (fIndex + extraNeeded <= fFullSize) + { + newCap = fFullSize; + } + + // Otherwise, allow the registered full-handler to try to empty the buffer. + // If it claims success, and we can accommodate the extra needed in the buffer + // to be expanded, resize to the maximum + // Note the order of evaluation: bufferFull() has the intentional side-effect + // of modifying fIndex. + else if (fFullHandler->bufferFull(*this) && (fIndex + extraNeeded <= fFullSize)) + { + newCap = fFullSize; + } + + // Finally, if the full-handler failed, or the buffer (of maximum size) + // still can't accomodate the extra needed, we must fail. + else + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Array_BadNewSize, fMemoryManager); + } + + // Note the previous if block can modify newCap, so we may not need to allocate + // at all. + if (newCap > fCapacity) + { + // Allocate new buffer + XMLCh* newBuf = (XMLCh*) fMemoryManager->allocate((newCap+1) * sizeof(XMLCh)); //new XMLCh[newCap+1]; + + // Copy over the old stuff + memcpy(newBuf, fBuffer, fIndex * sizeof(XMLCh)); + + // Clean up old buffer and store new stuff + fMemoryManager->deallocate(fBuffer); //delete [] fBuffer; + fBuffer = newBuf; + fCapacity = newCap; + } +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLBuffer.hpp b/project/jni/xerces/src/xercesc/framework/XMLBuffer.hpp new file mode 100644 index 000000000..7b4c711fd --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLBuffer.hpp @@ -0,0 +1,281 @@ +/* + * 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: XMLBuffer.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLBUFFER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLBUFFER_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLBufferFullHandler; + +/** + * XMLBuffer is a lightweight, expandable Unicode text buffer. Since XML is + * inherently theoretically unbounded in terms of the sizes of things, we + * very often need to have expandable buffers. The primary concern here is + * that appends of characters and other buffers or strings be very fast, so + * it always maintains the current buffer size. + * + * The buffer is not null terminated until some asks to see the raw buffer + * contents. This also avoids overhead during append operations. + */ +class XMLPARSER_EXPORT XMLBuffer : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructor */ + //@{ + XMLBuffer(const XMLSize_t capacity = 1023 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : + + fIndex(0) + , fCapacity(capacity) + , fFullSize(0) + , fUsed(false) + , fMemoryManager(manager) + , fFullHandler(0) + , fBuffer(0) + { + // Buffer is one larger than capacity, to allow for zero term + fBuffer = (XMLCh*) manager->allocate((capacity+1) * sizeof(XMLCh)); //new XMLCh[fCapacity+1]; + + // Keep it null terminated + fBuffer[0] = XMLCh(0); + } + //@} + + /** @name Destructor */ + //@{ + ~XMLBuffer() + { + fMemoryManager->deallocate(fBuffer); //delete [] fBuffer; + } + //@} + + // ----------------------------------------------------------------------- + // Buffer Full Handler Management + // ----------------------------------------------------------------------- + void setFullHandler(XMLBufferFullHandler* handler, const XMLSize_t fullSize) + { + if (handler && fullSize) { + fFullHandler = handler; + fFullSize = fullSize; + + // Need to consider the case that the fullsize is less than the current capacity. + // For example, say fullSize = 100 and fCapacity is 1023 (the default). + // If the fIndex is less than the fullSize, then no problem. We can just carry + // on by resetting fCapacity to fullsize and proceed business as usual. + // If the fIndex is already bigger than the fullSize then we call ensureCapacity + // to see if it can handle emptying the current buffer (it will throw an + // exception if it can't). + if (fullSize < fCapacity) { + fCapacity = fullSize; + if (fIndex >= fullSize) { + ensureCapacity(0); + } + } + } + else { + // reset fFullHandler to zero because setFullHandler had bad input + fFullHandler = 0; + } + } + + // ----------------------------------------------------------------------- + // Buffer Management + // ----------------------------------------------------------------------- + void append(const XMLCh toAppend) + { + // Put in char and bump the index + if (fIndex == fCapacity) + ensureCapacity(1); + fBuffer[fIndex++] = toAppend; + } + + void append (const XMLCh* const chars, const XMLSize_t count) + { + if (count) { + if (fIndex + count >= fCapacity) { + ensureCapacity(count); + } + memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh)); + fIndex += count; + } + else { + append(chars); + } + } + + void append (const XMLCh* const chars) + { + if (chars != 0 && *chars != 0) { + // get length of chars + XMLSize_t count = 0; + for (; *(chars+count); count++ ) /*noop*/; + + if (fIndex + count >= fCapacity) { + ensureCapacity(count); + } + memcpy(&fBuffer[fIndex], chars, count * sizeof(XMLCh)); + fIndex += count; + } + } + + void set (const XMLCh* const chars, const XMLSize_t count) + { + fIndex = 0; + append(chars, count); + } + + void set (const XMLCh* const chars) + { + fIndex = 0; + if (chars != 0 && *chars != 0) + append(chars); + } + + const XMLCh* getRawBuffer() const + { + fBuffer[fIndex] = 0; + return fBuffer; + } + + XMLCh* getRawBuffer() + { + fBuffer[fIndex] = 0; + return fBuffer; + } + + void reset() + { + fIndex = 0; + } + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + bool getInUse() const + { + return fUsed; + } + + XMLSize_t getLen() const + { + return fIndex; + } + + bool isEmpty() const + { + return (fIndex == 0); + } + + // ----------------------------------------------------------------------- + // Setters + // ----------------------------------------------------------------------- + void setInUse(const bool newValue) + { + fUsed = newValue; + } + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLBuffer(const XMLBuffer&); + XMLBuffer& operator=(const XMLBuffer&); + + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class XMLBufBid; + + // ----------------------------------------------------------------------- + // Private helpers + // ----------------------------------------------------------------------- + void ensureCapacity(const XMLSize_t extraNeeded); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fBuffer + // The pointer to the buffer data. Its grown as needed. Its always + // one larger than fCapacity, to leave room for the null terminator. + // + // fIndex + // The current index into the buffer, as characters are appended + // to it. If its zero, then the buffer is empty. + // + // fCapacity + // The current capacity of the buffer. Its actually always one + // larger, to leave room for the null terminator. + // + // fUsed + // Indicates whether this buffer is in use or not. + // + // fFullHandler, fFullSize + // If fFullHandler is non-null, the buffer has a maximum size + // indicated by fFullSize. If writing to the buffer would exceed the + // buffer's maximum size, fFullHandler's bufferFull callback is + // invoked, to empty the buffer. + // ----------------------------------------------------------------------- + XMLSize_t fIndex; + XMLSize_t fCapacity; + XMLSize_t fFullSize; + bool fUsed; + MemoryManager* const fMemoryManager; + XMLBufferFullHandler* fFullHandler; + XMLCh* fBuffer; +}; + +/** + * XMLBufferFullHandler is a callback interface for clients of + * XMLBuffers that impose a size restriction (e.g. XMLScanner). + * Note that this is intended solely as a mix-in for internal + * use, and therefore does not derive from XMemory (to avoid + * the ambiguous base class problem). + */ +class XMLPARSER_EXPORT XMLBufferFullHandler +{ +public : + + virtual ~XMLBufferFullHandler() {} + + /** + * Callback method, intended to allow clients of an XMLBuffer which has + * become full to empty it appropriately. + * @return true if the handler was able to empty the buffer (either + * partially or completely), otherwise false to indicate an error. + */ + virtual bool bufferFull(XMLBuffer&) = 0; + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.cpp b/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.cpp new file mode 100644 index 000000000..327f8deb2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.cpp @@ -0,0 +1,114 @@ +/* + * 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: XMLBufferMgr.cpp 673679 2008-07-03 13:50:10Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +//#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +XMLBufferMgr::XMLBufferMgr(MemoryManager* const manager) : + + fBufCount(32) + , fMemoryManager(manager) + , fBufList(0) +{ + // Allocate the buffer list and zero it out + fBufList = (XMLBuffer**) fMemoryManager->allocate(fBufCount * sizeof(XMLBuffer*)); // new XMLBuffer*[fBufCount]; + for (XMLSize_t index = 0; index < fBufCount; index++) + fBufList[index] = 0; +} + +XMLBufferMgr::~XMLBufferMgr() +{ + // Delete any buffers that got allocated + for (XMLSize_t index = 0; index < fBufCount; index++) + delete fBufList[index]; + + // And then the buffer list + fMemoryManager->deallocate(fBufList); //delete [] fBufList; +} + + +// --------------------------------------------------------------------------- +// Buffer management +// --------------------------------------------------------------------------- +XMLBuffer& XMLBufferMgr::bidOnBuffer() +{ + // + // Look for a buffer that is not in use. If we hit a null entry, then + // we have to add one. + // + for (XMLSize_t index = 0; index < fBufCount; index++) + { + // No more buffers available, so create one and take it + if (!fBufList[index]) + { + fBufList[index] = new (fMemoryManager) XMLBuffer(1023, fMemoryManager); + fBufList[index]->setInUse(true); + return *fBufList[index]; + } + + // + // There's one here, so see if its use. If not, mark it, reset it, + // and take it + // + if (!fBufList[index]->getInUse()) + { + fBufList[index]->reset(); + fBufList[index]->setInUse(true); + return *(fBufList[index]); + } + } + + // We did not find one, so freak out + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::BufMgr_NoMoreBuffers, fMemoryManager); + + // NOTE: Dummy return to make some compilers happy. Never really gets called! + return *fBufList[0]; +} + + +void XMLBufferMgr::releaseBuffer(XMLBuffer& toRelease) +{ + // Look for this buffer in the list + for (XMLSize_t index = 0; index < fBufCount; index++) + { + if (fBufList[index] == &toRelease) + { + // Unmark it + toRelease.setInUse(false); + return; + } + } + + // It was not a legal buffer + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::BufMgr_BufferNotInPool, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.hpp b/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.hpp new file mode 100644 index 000000000..82a581749 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLBufferMgr.hpp @@ -0,0 +1,212 @@ +/* + * 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: XMLBufferMgr.hpp 673679 2008-07-03 13:50:10Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLBUFFERMGR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLBUFFERMGR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLBufBid; + +/** + * There are many places where XMLBuffer objects are needed. In order to + * avoid either constantly creating and destroying them or maintaining a + * fixed set and worrying about accidental reuse, a buffer manager can + * provide a pool of buffers which can be temporarily used and then put + * back into the pool. This provides a good compromise between performance + * and easier maintenance. + */ +class XMLPARSER_EXPORT XMLBufferMgr : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructor */ + //@{ + XMLBufferMgr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + //@} + + /** @name Destructor */ + //@{ + ~XMLBufferMgr(); + //@} + + + // ----------------------------------------------------------------------- + // Buffer management + // ----------------------------------------------------------------------- + XMLBuffer& bidOnBuffer(); + void releaseBuffer(XMLBuffer& toRelease); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t getBufferCount() const; + XMLSize_t getAvailableBufferCount() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLBufferMgr(const XMLBufferMgr&); + XMLBufferMgr& operator=(const XMLBufferMgr&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fBufCount + // The count of buffers that have been allocated so far. + // + // fBufList; + // The list of pointers to buffers that are loaned out. There will + // never be a lot of them, so a flat list is good enough. + // ----------------------------------------------------------------------- + XMLSize_t fBufCount; + MemoryManager* fMemoryManager; + XMLBuffer** fBufList; +}; + +inline XMLSize_t XMLBufferMgr::getBufferCount() const +{ + return fBufCount; +} + +inline XMLSize_t XMLBufferMgr::getAvailableBufferCount() const +{ + XMLSize_t available = fBufCount; + for (XMLSize_t index = 0; index < fBufCount && fBufList[index]; index++) + { + if (fBufList[index]->getInUse()) + --available; + } + return available; +} + + +/** + * XMLBufBid is a scoped based janitor that allows the scanner code to ask + * for a buffer on a scoped basis and then insure that it gets freed back + * into the pool no matter how the scope is exited (exception or normal exit.) + */ +class XMLBufBid : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLBufBid(XMLBufferMgr* const srcMgr) : + + fBuffer(srcMgr->bidOnBuffer()) + , fMgr(srcMgr) + { + } + + ~XMLBufBid() + { + fMgr->releaseBuffer(fBuffer); + } + + + + // ----------------------------------------------------------------------- + // Buffer access + // ----------------------------------------------------------------------- + void append(const XMLCh toAppend) + { + fBuffer.append(toAppend); + } + + void append(const XMLCh* const toAppend, const XMLSize_t count = 0) + { + fBuffer.append(toAppend, count); + } + + const XMLBuffer& getBuffer() const + { + return fBuffer; + } + + XMLBuffer& getBuffer() + { + return fBuffer; + } + + const XMLCh* getRawBuffer() const + { + fBuffer.fBuffer[fBuffer.fIndex] = 0; + return fBuffer.fBuffer; + } + + XMLCh* getRawBuffer() + { + fBuffer.fBuffer[fBuffer.fIndex] = 0; + return fBuffer.fBuffer; + } + + XMLSize_t getLen() const + { + return fBuffer.fIndex; + } + + bool isEmpty() const + { + return (fBuffer.fIndex == 0); + } + + void reset() + { + fBuffer.reset(); + } + + void set(const XMLCh* const chars, const XMLSize_t count = 0) + { + fBuffer.set(chars, count); + } + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLBufBid(const XMLBufBid&); + XMLBufBid& operator=(const XMLBufBid&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fBuffer + // This is the buffer we got, and which we will release. + // + // fMgr + // This is the buffer manager we got the buffer from. This is needed + // to release the buffer later. + // ----------------------------------------------------------------------- + XMLBuffer& fBuffer; + XMLBufferMgr* const fMgr; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLContentModel.cpp b/project/jni/xerces/src/xercesc/framework/XMLContentModel.cpp new file mode 100644 index 000000000..0545185c4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLContentModel.cpp @@ -0,0 +1,38 @@ +/* + * 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: XMLContentModel.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// public static data +// --------------------------------------------------------------------------- +const unsigned int XMLContentModel::gInvalidTrans = 0xFFFFFFFF; +const unsigned int XMLContentModel::gEOCFakeId = 0xFFFFFFF1; +const unsigned int XMLContentModel::gEpsilonFakeId = 0xFFFFFFF2; + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLContentModel.hpp b/project/jni/xerces/src/xercesc/framework/XMLContentModel.hpp new file mode 100644 index 000000000..44fed2389 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLContentModel.hpp @@ -0,0 +1,145 @@ +/* + * 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: XMLContentModel.hpp 677705 2008-07-17 20:15:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLCONTENTMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLCONTENTMODEL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentLeafNameTypeVector; +class GrammarResolver; +class XMLStringPool; +class XMLValidator; +class SchemaGrammar; +class SubstitutionGroupComparator; + +/** + * This class defines the abstract interface for all content models. All + * elements have a content model against which (if validating) its content + * is checked. Each type of validator (DTD, Schema, etc...) can have + * different types of content models, and even with each type of validator + * there can be specialized content models. So this simple class provides + * the abstract API via which all the types of contents models are dealt + * with generically. Its pretty simple. + */ +class XMLPARSER_EXPORT XMLContentModel : public XMemory +{ +public: + // --------------------------------------------------------------------------- + // Public static data + // + // gInvalidTrans + // This value represents an invalid transition in each line of the + // transition table. + // + // gEOCFakeId + // gEpsilonFakeId + // We have to put in a couple of special CMLeaf nodes to represent + // special values, using fake element ids that we know won't conflict + // with real element ids. + // + // + // --------------------------------------------------------------------------- + static const unsigned int gInvalidTrans; + static const unsigned int gEOCFakeId; + static const unsigned int gEpsilonFakeId; + + // ----------------------------------------------------------------------- + // Constructors are hidden, only the virtual Destructor is exposed + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + virtual ~XMLContentModel() + { + } + //@} + + + // ----------------------------------------------------------------------- + // The virtual content model interface provided by derived classes + // ----------------------------------------------------------------------- + virtual bool validateContent + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const = 0; + + virtual bool validateContentSpecial + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const =0; + + virtual void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName = 0 + ) =0; + + virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() + const = 0; + + virtual unsigned int getNextState(unsigned int currentState, + XMLSize_t elementIndex) const = 0; + + virtual bool handleRepetitions( const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elementIndex, + SubstitutionGroupComparator * comparator) const = 0; + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + XMLContentModel() + { + } + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLContentModel(const XMLContentModel&); + XMLContentModel& operator=(const XMLContentModel&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.cpp b/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.cpp new file mode 100644 index 000000000..238a289f1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.cpp @@ -0,0 +1,54 @@ +/* + * 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: XMLDTDDescription.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLDTDDescription::~XMLDTDDescription() +{ +} + +XMLDTDDescription::XMLDTDDescription(MemoryManager* const memMgr) +:XMLGrammarDescription(memMgr) +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLDTDDescription) + +void XMLDTDDescription::serialize(XSerializeEngine& serEng) +{ + + XMLGrammarDescription::serialize(serEng); + + //no data +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.hpp b/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.hpp new file mode 100644 index 000000000..455a1ca84 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLDTDDescription.hpp @@ -0,0 +1,103 @@ +/* + * 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: XMLDTDDescription.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT XMLDTDDescription : public XMLGrammarDescription +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + /** + * virtual destructor + * + */ + virtual ~XMLDTDDescription(); + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of Grammar Description Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * getGrammarType + * + */ + virtual Grammar::GrammarType getGrammarType() const + { + return Grammar::DTDGrammarType; + } + //@} + + // ----------------------------------------------------------------------- + /** @name The DTDDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * Getter + * + */ + virtual const XMLCh* getRootName() const = 0; + virtual const XMLCh* getSystemId() const {return 0;}; + + /** + * Setter + * + */ + virtual void setRootName(const XMLCh* const) = 0; + virtual void setSystemId(const XMLCh* const) {}; + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLDTDDescription) + +protected : + // ----------------------------------------------------------------------- + /** Hidden Constructors */ + // ----------------------------------------------------------------------- + //@{ + XMLDTDDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + //@} + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLDTDDescription(const XMLDTDDescription& ); + XMLDTDDescription& operator=(const XMLDTDDescription& ); + //@} + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLDocumentHandler.hpp b/project/jni/xerces/src/xercesc/framework/XMLDocumentHandler.hpp new file mode 100644 index 000000000..58855aa0b --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLDocumentHandler.hpp @@ -0,0 +1,283 @@ +/* + * 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: XMLDocumentHandler.hpp 673679 2008-07-03 13:50:10Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLDOCUMENTHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLDOCUMENTHANDLER_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLElementDecl; +class XMLEntityDecl; + +/** + * This abstract class provides the interface for the scanner to return + * XML document information up to the parser as it scans through the + * document. + * + * The interface is very similar to org.sax.DocumentHandler, but + * has some extra methods required to get all the data out. + */ +class XMLPARSER_EXPORT XMLDocumentHandler +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, just the virtual destructor is exposed + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + virtual ~XMLDocumentHandler() + { + } + //@} + + /** @name The document handler interface */ + //@{ + /** Receive notification of character data. + * + *

The scanner will call this method to report each chunk of + * character data. The scanner may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * will come from the same external entity, so that the Locator + * provides useful information.

+ * + *

The parser must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The content (characters) between markup from the XML + * document. + * @param length The number of characters to read from the array. + * @param cdataSection Indicates that this data is inside a CDATA + * section. + * @see #ignorableWhitespace + * @see Locator + */ + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ) = 0; + + /** Receive notification of comments in the XML content being parsed. + * + * This scanner will call this method for any comments found in the + * content of the document. + * + * @param comment The text of the comment. + */ + virtual void docComment + ( + const XMLCh* const comment + ) = 0; + + /** Receive notification of PI's parsed in the XML content. + * + * The scanner will call this method for any PIs it finds within the + * content of the document. + * + * @param target The name of the PI. + * @param data The body of the PI. This may be an empty string since + * the body is optional. + */ + virtual void docPI + ( + const XMLCh* const target + , const XMLCh* const data + ) = 0; + + /** Receive notification after the scanner has parsed the end of the + * document. + * + * The scanner will call this method when the current document has been + * fully parsed. The handler may use this opportunity to do something with + * the data, clean up temporary data, etc... + */ + virtual void endDocument() = 0; + + /** Receive notification of the end of an element. + * + * This method is called when scanner encounters the end of element tag. + * There will be a corresponding startElement() event for every + * endElement() event, but not necessarily the other way around. For + * empty tags, there is only a startElement() call. + * + * @param elemDecl The name of the element whose end tag was just + * parsed. + * @param uriId The ID of the URI in the URI pool (only valid if + * name spaces is enabled) + * @param isRoot Indicates if this is the root element. + * @param prefixName The string representing the prefix name + */ + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int uriId + , const bool isRoot + , const XMLCh* const prefixName = 0 + ) = 0; + + /** Receive notification when a referenced entity's content ends + * + * This method is called when scanner encounters the end of an entity + * reference. + * + * @param entDecl The name of the entity reference just scanned. + */ + virtual void endEntityReference + ( + const XMLEntityDecl& entDecl + ) = 0; + + /** Receive notification of ignorable whitespace in element content. + * + *

Validating Parsers must use this method to report each chunk + * of ignorable whitespace (see the W3C XML 1.0 recommendation, + * section 2.10): non-validating parsers may also use this method + * if they are capable of parsing and using content models.

+ * + *

The scanner may return all contiguous whitespace in a single + * chunk, or it may split it into several chunks; however, all of + * the characters in any single event will come from the same + * external entity, so that the Locator provides useful + * information.

+ * + *

The parser must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The whitespace characters from the XML document. + * @param length The number of characters to read from the array. + * @param cdataSection Indicates that this data is inside a CDATA + * section. + * @see #docCharacters + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ) = 0; + + /** Reset the document handler's state, if required + * + * This method is used to give the registered document handler a + * chance to reset itself. Its called by the scanner at the start of + * every parse. + */ + virtual void resetDocument() = 0; + + /** Receive notification of the start of a new document + * + * This method is the first callback called the scanner at the + * start of every parse. This is before any content is parsed. + */ + virtual void startDocument() = 0; + + /** Receive notification of a new start tag + * + * This method is called when scanner encounters the start of an element tag. + * All elements must always have a startElement() tag. Empty tags will + * only have the startElement() tag and no endElement() tag. + * + * @param elemDecl The name of the element whose start tag was just + * parsed. + * @param uriId The ID of the URI in the URI pool (only valid if + * name spaces is enabled) + * @param prefixName The string representing the prefix name + * @param attrList List of attributes in the element + * @param attrCount Count of the attributes in the element + * @param isEmpty Indicates if the element is empty, in which case + * you should not expect an endElement() event. + * @param isRoot Indicates if this is the root element. + */ + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int uriId + , const XMLCh* const prefixName + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ) = 0; + + /** Receive notification when the scanner hits an entity reference. + * + * This is currently useful only to DOM parser configurations as SAX + * does not provide any api to return this information. + * + * @param entDecl The name of the entity that was referenced. + */ + virtual void startEntityReference(const XMLEntityDecl& entDecl) = 0; + + /** Receive notification of an XML declaration + * + * Currently neither DOM nor SAX provide API's to return back this + * information. + * + * @param versionStr The value of the version pseudoattribute + * of the XML decl. + * @param encodingStr The value of the encoding pseudoattribute + * of the XML decl. + * @param standaloneStr The value of the standalone + * pseudoattribute of the XML decl. + * @param autoEncodingStr The encoding string auto-detected by the + * scanner. In absence of any 'encoding' attribute in the + * XML decl, the XML standard specifies how a parser can + * auto-detect. If there is no encodingStr + * this is what will be used to try to decode the file. + */ + virtual void XMLDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const autoEncodingStr + ) = 0; + + //@} + + + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + XMLDocumentHandler() + { + } + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLDocumentHandler(const XMLDocumentHandler&); + XMLDocumentHandler& operator=(const XMLDocumentHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLElementDecl.cpp b/project/jni/xerces/src/xercesc/framework/XMLElementDecl.cpp new file mode 100644 index 000000000..2e31c006c --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLElementDecl.cpp @@ -0,0 +1,170 @@ +/* + * 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: XMLElementDecl.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLElementDecl: Public, static data +// --------------------------------------------------------------------------- +const unsigned int XMLElementDecl::fgInvalidElemId = 0xFFFFFFFE; +const unsigned int XMLElementDecl::fgPCDataElemId = 0xFFFFFFFF; +const XMLCh XMLElementDecl::fgPCDataElemName[] = +{ + chPound, chLatin_P, chLatin_C, chLatin_D, chLatin_A + , chLatin_T, chLatin_A, chNull +}; + + + +// --------------------------------------------------------------------------- +// XMLElementDecl: Destructor +// --------------------------------------------------------------------------- +XMLElementDecl::~XMLElementDecl() +{ + delete fElementName; +} + +// --------------------------------------------------------------------------- +// XMLElementDecl: Setter Methods +// --------------------------------------------------------------------------- +void +XMLElementDecl::setElementName(const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId ) +{ + if (fElementName) + fElementName->setName(prefix, localPart, uriId); + else + fElementName = new (fMemoryManager) QName(prefix, localPart, uriId, fMemoryManager); +} + +void +XMLElementDecl::setElementName(const XMLCh* const rawName + , const int uriId ) +{ + if (fElementName) + fElementName->setName(rawName, uriId); + else + fElementName = new (fMemoryManager) QName(rawName, uriId, fMemoryManager); +} + +void +XMLElementDecl::setElementName(const QName* const elementName) +{ + if (fElementName) + fElementName->setValues(*elementName); + else + fElementName = new (fMemoryManager) QName(*elementName); +} + +// --------------------------------------------------------------------------- +// ElementDecl: Hidden constructors +// --------------------------------------------------------------------------- +XMLElementDecl::XMLElementDecl(MemoryManager* const manager) : + + fMemoryManager(manager) + , fElementName(0) + , fCreateReason(XMLElementDecl::NoReason) + , fId(XMLElementDecl::fgInvalidElemId) + , fExternalElement(false) +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLElementDecl) + +void XMLElementDecl::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<>fElementName; + + int i; + serEng>>i; + fCreateReason=(CreateReasons)i; + + serEng.readSize (fId); + serEng>>fExternalElement; + } + +} + +void +XMLElementDecl::storeElementDecl(XSerializeEngine& serEng + , XMLElementDecl* const element) +{ + if (element) + { + serEng<<(int) element->getObjectType(); + serEng<>type; + + switch((XMLElementDecl::objectType)type) + { + case Schema: + SchemaElementDecl* schemaElementDecl; + serEng>>schemaElementDecl; + return schemaElementDecl; + case DTD: + DTDElementDecl* dtdElementDecl; + serEng>>dtdElementDecl; + return dtdElementDecl; + case UnKnown: + //fall through + default: + return 0; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLElementDecl.hpp b/project/jni/xerces/src/xercesc/framework/XMLElementDecl.hpp new file mode 100644 index 000000000..4589c71ec --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLElementDecl.hpp @@ -0,0 +1,552 @@ +/* + * 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: XMLElementDecl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLELEMENTDECL_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; +class XMLContentModel; + +/** + * This class defines the core information of an element declaration. Each + * validator (DTD, Schema, etc...) will have its own information that it + * associations with the declaration of an element, but they must all share + * at least this core information, i.e. they must all derive from this + * class. The set of info enforced at this level is driven by the needs of + * XML 1.0 spec validation and well formedness checks. + * + * This class defines some special element id values for invalid elements + * and PCDATA elements, as well as a string for the special PCDATA element + * name. All validators must honor these special values in order to allow + * content models to work generically (i.e. to let code know when its dealing + * with invalid or PCDATA element ids without having to know what type of + * validator its messing with.) + */ +class XMLPARSER_EXPORT XMLElementDecl : public XSerializable, public XMemory +{ + public: + // ----------------------------------------------------------------------- + // Class specific types + // + // CreateReasons + // This type is used to store how an element declaration got into + // the grammar's element pool. They are faulted in for various + // reasons. + // + // LookupOpts + // These are the values used by the attribute lookup methods. + // + // CharDataOpts + // This is used to indicate how this type of element reacts to + // character data as content. + // ----------------------------------------------------------------------- + enum CreateReasons + { + NoReason + , Declared + , AttList + , InContentModel + , AsRootElem + , JustFaultIn + }; + + enum CharDataOpts + { + NoCharData + , SpacesOk + , AllCharData + }; + + + // ----------------------------------------------------------------------- + // Public static data + // + // fgInvalidElemId + // A value to represent an invalid element node id. + // + // fgPCDataElemId + // This is the value to use to represent a PCDATA node when an + // element id is required. + // + // fgPCDataElemName + // This is the value to use to represent a PCDATA node when an + // element name is required. + // ----------------------------------------------------------------------- + static const unsigned int fgInvalidElemId; + static const unsigned int fgPCDataElemId; + static const XMLCh fgPCDataElemName[]; + + + + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + virtual ~XMLElementDecl(); + //@} + + + // ----------------------------------------------------------------------- + // The virtual element decl interface + // ----------------------------------------------------------------------- + + /** @name Virual ElementDecl interface */ + //@{ + + /** Get a list of attributes defined for this element. + * + * The derived class should return a reference to some member object which + * implements the XMLAttDefList interface. This object gives the scanner the + * ability to look through the attributes defined for this element. + * + * It is done this way for efficiency, though of course this is not thread + * safe. The scanner guarantees that it won't ever call this method in any + * nested way, but the outside world must be careful about when it calls + * this method, and optimally never would. + */ + virtual XMLAttDefList& getAttDefList() const = 0; + + /** The character data options for this element type + * + * The derived class should return an appropriate character data opts value + * which correctly represents its tolerance towards whitespace or character + * data inside of its instances. This allows the scanner to do all of the + * validation of character data. + */ + virtual CharDataOpts getCharDataOpts() const = 0; + + /** Indicate whether this element type defined any attributes + * + * The derived class should return a boolean that indicates whether this + * element has any attributes defined for it or not. This is an optimization + * that allows the scanner to skip some work if no attributes exist. + */ + virtual bool hasAttDefs() const = 0; + + /** Get a pointer to the content spec node + * + * This method will return a const pointer to the content spec node object + * of this element. + * + * @return A const pointer to the element's content spec node + */ + virtual const ContentSpecNode* getContentSpec() const = 0; + + /** Get a pointer to the content spec node + * + * This method is identical to the previous one, except that it is non + * const. + */ + virtual ContentSpecNode* getContentSpec() = 0; + + /** Set the content spec node object for this element type + * + * This method will adopt the based content spec node object. This is called + * by the actual validator which is parsing its DTD or Schema or whatever + * and store it on the element decl object via this method. + * + * @param toAdopt This method will adopt the passed content node spec + * object. Any previous object is destroyed. + */ + virtual void setContentSpec(ContentSpecNode* toAdopt) = 0; + + /** Get a pointer to the abstract content model + * + * This method will return a const pointer to the content model object + * of this element. This class is a simple abstraction that allows an + * element to define and use multiple, specialized content model types + * internally but still allow the outside world to do simple stuff with + * them. + * + * @return A pointer to the element's content model, via the basic + * abstract content model type. + */ + virtual XMLContentModel* getContentModel() = 0; + + /** Set the content model object for this element type + * + * This method will adopt the based content model object. This is called + * by the actual validator which is parsing its DTD or Schema or whatever + * a creating an element decl. It will build what it feels is the correct + * content model type object and store it on the element decl object via + * this method. + * + * @param newModelToAdopt This method will adopt the passed content model + * object. Any previous object is destroyed. + */ + virtual void setContentModel(XMLContentModel* const newModelToAdopt) = 0; + + /** Geta formatted string of the content model + * + * This method is a convenience method which will create a formatted + * representation of the content model of the element. It will not always + * exactly recreate the original model, since some normalization or + * or reformatting may occur. But, it will be a technically accurate + * representation of the original content model. + * + * @return A pointer to an internal buffer which contains the formatted + * content model. The caller does not own this buffer and should + * copy it if it needs to be kept around. + */ + virtual const XMLCh* getFormattedContentModel () const = 0; + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** Get the base name of this element type. + * + * Return the base name part of the element's name. This is the + * same regardless of whether namespaces are enabled or not. + * + * @return A const pointer to the base name of the element decl. + */ + const XMLCh* getBaseName() const; + XMLCh* getBaseName(); + + /** Get the URI id of this element type. + * + * Return the URI Id of this element. + * + * @return The URI Id of the element decl, or the emptyNamespaceId if not applicable. + */ + unsigned int getURI() const; + + /** Get the QName of this element type. + * + * Return the QName part of the element's name. This is the + * same regardless of whether namespaces are enabled or not. + * + * @return A const pointer to the QName of the element decl. + */ + const QName* getElementName() const; + QName* getElementName(); + + /** Get the full name of this element type. + * + * Return the full name of the element. If namespaces + * are not enabled, then this is the qName. Else it is the {uri}baseName + * form. For those validators that always require namespace processing, it + * will always be in the latter form because namespace processing will always + * be on. + */ + const XMLCh* getFullName() const; + + /** Get the create reason for this element type + * + * This method returns an enumeration which indicates why this element + * declaration exists. Elements can be used before they are actually + * declared, so they will often be faulted into the pool and marked as + * to why they are there. + * + * @return An enumerated value that indicates the reason why this element + * was added to the element decl pool. + */ + + CreateReasons getCreateReason() const; + + /** Get the element decl pool id for this element type + * + * This method will return the element decl pool id of this element + * declaration. This uniquely identifies this element type within the + * parse event that it is declared within. This value is assigned by the + * grammar whose decl pool this object belongs to. + * + * @return The element decl id of this element declaration. + */ + XMLSize_t getId() const; + + /** Indicate whether this element type has been declared yet + * + * This method returns a boolean that indicates whether this element + * has been declared yet. There are a number of reasons why an element + * declaration can be faulted in, but eventually it must be declared or + * its an error. See the CreateReasons enumeration. + * + * @return true if this element has been declared, else false. + */ + bool isDeclared() const; + + /** Indicate whether this element type has been declared externally + * + * This method returns a boolean that indicates whether this element + * has been declared externally. + * + * @return true if this element has been declared externally, else false. + */ + + bool isExternal() const; + + /** Get the memory manager + * + * This method returns the configurable memory manager used by the + * element declaration for dynamic allocation/deallocation. + * + * @return the memory manager + */ + MemoryManager* getMemoryManager() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** Set the element name object for this element type + * + * This method will adopt the based content spec node object. This is called + * by the actual validator which is parsing its DTD or Schema or whatever + * and store it on the element decl object via this method. + * + * @param prefix Prefix of the element + * @param localPart Base Name of the element + * @param uriId The uriId of the element + */ + void setElementName(const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId ); + + /** Set the element name object for this element type + * + * This method will adopt the based content spec node object. This is called + * by the actual validator which is parsing its DTD or Schema or whatever + * and store it on the element decl object via this method. + * + * @param rawName Full Name of the element + * @param uriId The uriId of the element + */ + void setElementName(const XMLCh* const rawName + , const int uriId ); + + /** Set the element name object for this element type + * + * This method will adopt the based content spec node object. This is called + * by the actual validator which is parsing its DTD or Schema or whatever + * and store it on the element decl object via this method. + * + * @param elementName QName of the element + */ + void setElementName(const QName* const elementName); + + /** Update the create reason for this element type. + * + * This method will update the 'create reason' field for this element + * decl object. As the validator parses its DTD, Schema, etc... it will + * encounter various references to an element declaration, which will + * cause the element declaration to either be declared or to be faulted + * into the pool in preparation for some future declaration. As it does + * so,it will update this field to indicate the current status of the + * decl object. + */ + void setCreateReason(const CreateReasons newReason); + + /** Set the element decl pool id for this element type + * + * This method will set the pool id of this element decl. This is called + * by the grammar which created this object, and will provide this + * decl object with a unique id within the parse event that created it. + */ + void setId(const XMLSize_t newId); + + + /** Set the element decl to indicate external declaration + * + */ + void setExternalElemDeclaration(const bool aValue); + + //@} + + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + + /** @name Miscellaneous methods */ + //@{ + + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLElementDecl) + + enum objectType + { + Schema + , DTD + , UnKnown + }; + + virtual XMLElementDecl::objectType getObjectType() const = 0; + + static void storeElementDecl(XSerializeEngine& serEng + , XMLElementDecl* const element); + + static XMLElementDecl* loadElementDecl(XSerializeEngine& serEng); + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLElementDecl(const XMLElementDecl&); + XMLElementDecl& operator=(const XMLElementDecl&); + + + // ----------------------------------------------------------------------- + // Data members + // + // fElementName + // This is the name of the element decl. + // + // fCreateReason + // We sometimes have to put an element decl object into the elem + // decl pool before the element's declaration is seen, such as when + // its used in another element's content model or an att list is + // seen for it. This flag tells us whether its been declared, and + // if not why it had to be created. + // + // fId + // The unique id of this element. This is created by the derived + // class, or more accurately the grammar that owns the objects + // of the derived types. But, since they all have to have them, we + // let them all store the id here. It is defaulted to have the + // value fgInvalidElem until explicitly set. + // + // fExternalElement + // This flag indicates whether or the element was declared externally. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + QName* fElementName; + CreateReasons fCreateReason; + XMLSize_t fId; + bool fExternalElement; +}; + + +// --------------------------------------------------------------------------- +// XMLElementDecl: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* XMLElementDecl::getBaseName() const +{ + return fElementName->getLocalPart(); +} + +inline XMLCh* XMLElementDecl::getBaseName() +{ + return fElementName->getLocalPart(); +} + +inline unsigned int XMLElementDecl::getURI() const +{ + return fElementName->getURI(); +} + +inline const QName* XMLElementDecl::getElementName() const +{ + return fElementName; +} + +inline QName* XMLElementDecl::getElementName() +{ + return fElementName; +} + +inline const XMLCh* XMLElementDecl::getFullName() const +{ + return fElementName->getRawName(); +} + +inline XMLElementDecl::CreateReasons XMLElementDecl::getCreateReason() const +{ + return fCreateReason; +} + +inline XMLSize_t XMLElementDecl::getId() const +{ + return fId; +} + +inline bool XMLElementDecl::isDeclared() const +{ + return (fCreateReason == Declared); +} + + +inline bool XMLElementDecl::isExternal() const +{ + return fExternalElement; +} + +inline MemoryManager* XMLElementDecl::getMemoryManager() const +{ + return fMemoryManager; +} + + +// --------------------------------------------------------------------------- +// XMLElementDecl: Setter methods +// --------------------------------------------------------------------------- +inline void +XMLElementDecl::setCreateReason(const XMLElementDecl::CreateReasons newReason) +{ + fCreateReason = newReason; +} + +inline void XMLElementDecl::setId(const XMLSize_t newId) +{ + fId = newId; +} + + +inline void XMLElementDecl::setExternalElemDeclaration(const bool aValue) +{ + fExternalElement = aValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.cpp b/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.cpp new file mode 100644 index 000000000..b0c0cecf2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.cpp @@ -0,0 +1,200 @@ +/* + * 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: XMLEntityDecl.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLEntityDecl::XMLEntityDecl(MemoryManager* const manager) : + + fId(0) + , fValueLen(0) + , fValue(0) + , fName(0) + , fNotationName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fIsExternal(false) + , fMemoryManager(manager) +{ +} + +XMLEntityDecl::XMLEntityDecl(const XMLCh* const entName, + MemoryManager* const manager) : + + fId(0) + , fValueLen(0) + , fValue(0) + , fName(0) + , fNotationName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fIsExternal(false) + , fMemoryManager(manager) +{ + fName = XMLString::replicate(entName, fMemoryManager); +} + +typedef JanitorMemFunCall CleanupType; + +XMLEntityDecl::XMLEntityDecl(const XMLCh* const entName + , const XMLCh* const value + , MemoryManager* const manager) : + fId(0) + , fValueLen(XMLString::stringLen(value)) + , fValue(0) + , fName(0) + , fNotationName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fIsExternal(false) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLEntityDecl::cleanUp); + + try + { + fValue = XMLString::replicate(value, fMemoryManager); + fName = XMLString::replicate(entName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLEntityDecl::XMLEntityDecl(const XMLCh* const entName + , const XMLCh value + , MemoryManager* const manager) : + fId(0) + , fValueLen(1) + , fValue(0) + , fName(0) + , fNotationName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fIsExternal(false) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLEntityDecl::cleanUp); + + try + { + XMLCh dummy[2] = { chNull, chNull }; + dummy[0] = value; + fValue = XMLString::replicate(dummy, fMemoryManager); + fName = XMLString::replicate(entName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLEntityDecl::~XMLEntityDecl() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Setter methods +// --------------------------------------------------------------------------- +void XMLEntityDecl::setName(const XMLCh* const entName) +{ + // Clean up the current name stuff + if (fName) + fMemoryManager->deallocate(fName); + + fName = XMLString::replicate(entName, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Private helper methods +// --------------------------------------------------------------------------- +void XMLEntityDecl::cleanUp() +{ + fMemoryManager->deallocate(fName); + fMemoryManager->deallocate(fNotationName); + fMemoryManager->deallocate(fValue); + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + fMemoryManager->deallocate(fBaseURI); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLEntityDecl) + +void XMLEntityDecl::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng.writeSize (fId); + serEng.writeSize (fValueLen); + serEng.writeString(fValue); + serEng.writeString(fName); + serEng.writeString(fNotationName); + serEng.writeString(fPublicId); + serEng.writeString(fSystemId); + serEng.writeString(fBaseURI); + serEng<>fIsExternal; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.hpp b/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.hpp new file mode 100644 index 000000000..cf00fc119 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLEntityDecl.hpp @@ -0,0 +1,512 @@ +/* + * 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: XMLEntityDecl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLENTITYDECL_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class defines that core information that defines an XML entity, no + * matter what validator is used. Each validator will create a derivative + * of this class which adds any extra information it requires. + * + * This class supports keyed collection semantics via the getKey() method + * which extracts the key field, the entity name in this case. The name will + * have whatever form is deemed appropriate for the type of validator in + * use. + * + * When setting the fields of this class, you must make sure that you do + * not set conflicting values. For instance, an internal entity cannot have + * a notation name. And an external entity cannot have a value string. + * These rules are defined by the XML specification. In most cases, these + * objects are created by validator objects as they parse a DTD or Schema + * or whatever, at which time they confirm the correctness of the data before + * creating the entity decl object. + */ +class XMLPARSER_EXPORT XMLEntityDecl : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors */ + //@{ + + /** + * Default Constructor + */ + XMLEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Constructor with a const entity name + * + * @param entName The new name to give to this entity. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XMLEntityDecl + ( + const XMLCh* const entName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Constructor with a const entity name and value + * + * @param entName The new name to give to this entity. + * @param value The new value to give to this entity name. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XMLEntityDecl + ( + const XMLCh* const entName + , const XMLCh* const value + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Constructor with a const entity name and single XMLCh value + * + * @param entName The new name to give to this entity. + * @param value The new value to give to this entity name. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XMLEntityDecl + ( + const XMLCh* const entName + , const XMLCh value + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + + /** + * Default destructor + */ + virtual ~XMLEntityDecl(); + + //@} + + + // ----------------------------------------------------------------------- + // Virtual entity decl interface + // ----------------------------------------------------------------------- + + /** @name The pure virtual methods in this interface. */ + //@{ + + /** Get the 'declared in internal subset' flag + * + * Gets the state of the flag which indicates whether the entity was + * declared in the internal or external subset. Some structural + * description languages might not have an internal subset concept, in + * which case this will always return false. + */ + virtual bool getDeclaredInIntSubset() const = 0; + + /** Get the 'is parameter entity' flag + * + * Gets the state of the flag which indicates whether this entity is + * a parameter entity. If not, then its a general entity. + */ + virtual bool getIsParameter() const = 0; + + /** Get the 'is special char entity' flag + * + * Gets the state of the flag that indicates whether this entity is + * one of the special, intrinsically supported character entities. + */ + virtual bool getIsSpecialChar() const = 0; + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** + * Gets the pool id of this entity. Validators maintain all decls in + * pools, from which they can be quickly extracted via id. + */ + XMLSize_t getId() const; + + /** + * Returns a const pointer to the name of this entity decl. This name + * will be in whatever format is appropriate for the type of validator + * in use. + */ + const XMLCh* getName() const; + + /** + * Gets the notation name, if any, declared for this entity. If this + * entity is not a notation type entity, it will be a null pointer. + */ + const XMLCh* getNotationName() const; + + /** + * Gets the public id declared for this entity. Public ids are optional + * so it can be a null pointer. + */ + const XMLCh* getPublicId() const; + + /** + * Gets the system id declared for this entity. The system id is required + * so this method should never return a null pointers. + */ + const XMLCh* getSystemId() const; + + /** + * Gets the base URI for this entity. + */ + const XMLCh* getBaseURI() const; + + /** + * This method returns the value of an internal entity. If this is not + * an internal entity (i.e. its external), then this will be a null + * pointer. + */ + const XMLCh* getValue() const; + + /** + * This method returns the number of characters in the value returned + * by getValue(). If this entity is external, this will be zero since + * an external entity has no internal value. + */ + XMLSize_t getValueLen() const; + + /** + * Indicates that this entity is an external entity. If not, then it is + * assumed to be an internal entity, surprise. + */ + bool isExternal() const; + + /** + * Indicates whether this entity is unparsed. This is meaningless for + * internal entities. Some external entities are unparsed in that they + * refer to something other than XML source. + */ + bool isUnparsed() const; + + /** Get the plugged-in memory manager + * + * This method returns the plugged-in memory manager user for dynamic + * memory allocation/deallocation. + * + * @return the plugged-in memory manager + */ + MemoryManager* getMemoryManager() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** + * This method will set the entity name. The format of this name is + * defined by the particular validator in use, since it will be the + * one who creates entity definitions as it parses the DTD, Schema, + * ect... + * + * @param entName The new name to give to this entity. + */ + void setName + ( + const XMLCh* const entName + ); + + /** + * This method will mark whether the entity is external. + * + * @param value The new value for the 'is external' flag. + */ + void setIsExternal(bool value); + + /** + * This method will set the notation name for this entity. By setting + * this, you are indicating that this is an unparsed external entity. + * + * @param newName The new notation name to give to this entity. + */ + void setNotationName(const XMLCh* const newName); + + /** + * This method will set a new public id on this entity. The public id + * has no particular form and is purely for client consumption. + * + * @param newId The new public id to give to this entity. + */ + void setPublicId(const XMLCh* const newId); + + /** + * This method will set a new sysetm id on this entity. This will + * then control where the source for this entity lives. If it is + * an internal entity, then the system id is only for bookkeeping + * purposes, and to allow any external entities referenced from + * within the entity to be correctly resolved. + * + * @param newId The new system id to give to the entity. + */ + void setSystemId(const XMLCh* const newId); + + /** + * This method will set a new baseURI on this entity. This will + * then control the URI used to resolve the relative system Id. + * + * @param newId The new base URI to give to the entity. + */ + void setBaseURI(const XMLCh* const newId); + + /** + * This method will set a new value for this entity. This is only + * valid if the entity is to be an internal entity. By setting this + * field, you are indicating that the entity is internal. + * + * @param newValue The new value to give to this entity. + */ + void setValue(const XMLCh* const newValue); + + //@} + + /* For internal use only */ + void setId(const XMLSize_t newId); + + + // ----------------------------------------------------------------------- + // Support named pool syntax + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** + * This method allows objects of this class to be used within a standard + * keyed collection used commonly within the parser system. The collection + * calls this method to get the key (usually to hash it) by which the + * object is to be stored. + */ + const XMLCh* getKey() const; + + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLEntityDecl) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLEntityDecl(const XMLEntityDecl&); + XMLEntityDecl& operator=(XMLEntityDecl&); + + + // ----------------------------------------------------------------------- + // XMLEntityDecl: Private helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fId + // This is the unique id given to this entity decl. + // + // fName + // The name of the entity. Entity names are never namespace based. + // + // fNotationName + // The optional notation of the entity. If there was none, then its + // empty. + // + // fPublicId + // The public id of the entity, which can be empty. + // + // fSystemId + // The system id of the entity. + // + // fValue + // fValueLen + // The entity's value and length, which is only valid if its an + // internal style entity. + // + // fBaseURI + // The base URI of the entity. According to XML InfoSet, such value + // is the URI where it is declared (NOT referenced). + // ----------------------------------------------------------------------- + XMLSize_t fId; + XMLSize_t fValueLen; + XMLCh* fValue; + XMLCh* fName; + XMLCh* fNotationName; + XMLCh* fPublicId; + XMLCh* fSystemId; + XMLCh* fBaseURI; + bool fIsExternal; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t XMLEntityDecl::getId() const +{ + return fId; +} + +inline const XMLCh* XMLEntityDecl::getName() const +{ + return fName; +} + +inline const XMLCh* XMLEntityDecl::getNotationName() const +{ + return fNotationName; +} + +inline const XMLCh* XMLEntityDecl::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* XMLEntityDecl::getSystemId() const +{ + return fSystemId; +} + +inline const XMLCh* XMLEntityDecl::getBaseURI() const +{ + return fBaseURI; +} + +inline const XMLCh* XMLEntityDecl::getValue() const +{ + return fValue; +} + +inline XMLSize_t XMLEntityDecl::getValueLen() const +{ + return fValueLen; +} + +inline bool XMLEntityDecl::isExternal() const +{ + return fIsExternal; +} + +inline bool XMLEntityDecl::isUnparsed() const +{ + // If it has a notation, its unparsed + return (fNotationName != 0); +} + +inline MemoryManager* XMLEntityDecl::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Setter methods +// --------------------------------------------------------------------------- +inline void XMLEntityDecl::setId(const XMLSize_t newId) +{ + fId = newId; +} + +inline void XMLEntityDecl::setIsExternal(bool value) +{ + fIsExternal = value; +} + +inline void XMLEntityDecl::setNotationName(const XMLCh* const newName) +{ + if (fNotationName) + fMemoryManager->deallocate(fNotationName); + + fNotationName = XMLString::replicate(newName, fMemoryManager); +} + +inline void XMLEntityDecl::setPublicId(const XMLCh* const newId) +{ + if (fPublicId) + fMemoryManager->deallocate(fPublicId); + + fPublicId = XMLString::replicate(newId, fMemoryManager); +} + +inline void XMLEntityDecl::setSystemId(const XMLCh* const newId) +{ + if (fSystemId) + fMemoryManager->deallocate(fSystemId); + + fSystemId = XMLString::replicate(newId, fMemoryManager); +} + +inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId) +{ + if (fBaseURI) + fMemoryManager->deallocate(fBaseURI); + + fBaseURI = XMLString::replicate(newId, fMemoryManager); +} + +inline void XMLEntityDecl::setValue(const XMLCh* const newValue) +{ + if (fValue) + fMemoryManager->deallocate(fValue); + + fValue = XMLString::replicate(newValue, fMemoryManager); + fValueLen = XMLString::stringLen(newValue); +} + + +// --------------------------------------------------------------------------- +// XMLEntityDecl: Support named pool syntax +// --------------------------------------------------------------------------- +inline const XMLCh* XMLEntityDecl::getKey() const +{ + return fName; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLEntityHandler.hpp b/project/jni/xerces/src/xercesc/framework/XMLEntityHandler.hpp new file mode 100644 index 000000000..58ef6894b --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLEntityHandler.hpp @@ -0,0 +1,157 @@ +/* + * 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: XMLEntityHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; +class XMLBuffer; +class XMLResourceIdentifier; + +/** + * This abstract class is a callback mechanism for the scanner. By creating + * a derivative of this class and plugging into the scanner, the scanner + * will call back on the object's methods to entity events. + * + * This class is primarily for use by those writing their own parser classes. + * If you use the standard parser classes, DOMParser and SAXParser, you won't + * use this API. You will instead use a similar mechanism defined by the SAX + * API, called EntityResolver. + */ +class XMLPARSER_EXPORT XMLEntityHandler +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, only the virtual destructor is exposed + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + + /** + * Default destructor + */ + virtual ~XMLEntityHandler() + { + } + //@} + + + // ----------------------------------------------------------------------- + // The virtual entity handler interface + // ----------------------------------------------------------------------- + /** @name The pure virtual methods in this interface. */ + //@{ + + /** + * This method get called after the scanner has finished reading from + * the given input source while processing external entity references. + * + * @param inputSource The input source for the entity + */ + virtual void endInputSource(const InputSource& inputSource) = 0; + + /** + * This method allows the passes the scanned systemId to the entity + * handler, thereby giving it a chance to provide any customized + * handling like resolving relative path names. The scanner first + * calls this method before calling resolveEntity. + * + * @param systemId The system id extracted by the scanner from the + * input source. + * @param toFill The buffer in which the fully expanded system id needs + * to be stored. + */ + virtual bool expandSystemId + ( + const XMLCh* const systemId + , XMLBuffer& toFill + ) = 0; + + /** + * This method allows the entity handler to reset itself, so that + * it can be used again. It is called prior to a new document parse + * operation. + */ + virtual void resetEntities() = 0; + + /** + * This method allows the entity handler to provide customized + * application specific entity resolution. + * + * Only one resolveEntity method will be used. If both setEntityResolver and + * setXMLEntityResolver are called, then the last one is used. + * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return The value returned by the resolveEntity method or + * NULL otherwise to indicate no processing was done. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ) = 0; + + /** + * This method will be called before the scanner starts reading + * from an input source while processing external entity references. + * + * @param inputSource The external input source. + */ + virtual void startInputSource(const InputSource& inputSource) = 0; + //@} + + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + /** @name Constructor */ + //@{ + + /** + * Protected default constructor + */ + XMLEntityHandler() + { + } + //@} + + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and destructor + // ----------------------------------------------------------------------- + XMLEntityHandler(const XMLEntityHandler&); + XMLEntityHandler& operator=(const XMLEntityHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLErrorCodes.hpp b/project/jni/xerces/src/xercesc/framework/XMLErrorCodes.hpp new file mode 100644 index 000000000..ea3a6294d --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLErrorCodes.hpp @@ -0,0 +1,351 @@ +// This file is generated, don't edit it!! + +#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs) +#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLErrs +{ +public : + enum Codes + { + NoError = 0 + , W_LowBounds = 1 + , NotationAlreadyExists = 2 + , AttListAlreadyExists = 3 + , ContradictoryEncoding = 4 + , UndeclaredElemInCM = 5 + , UndeclaredElemInAttList = 6 + , XMLException_Warning = 7 + , XIncludeResourceErrorWarning = 8 + , XIncludeCannotOpenFile = 9 + , XIncludeIncludeFailedResourceError = 10 + , W_HighBounds = 11 + , E_LowBounds = 12 + , FeatureUnsupported = 13 + , TopLevelNoNameComplexType = 14 + , TopLevelNoNameAttribute = 15 + , NoNameRefAttribute = 16 + , NoNameRefElement = 17 + , NoNameRefGroup = 18 + , NoNameRefAttGroup = 19 + , AnonComplexTypeWithName = 20 + , AnonSimpleTypeWithName = 21 + , InvalidElementContent = 22 + , SimpleTypeContentError = 23 + , ExpectedSimpleTypeInList = 24 + , ListUnionRestrictionError = 25 + , SimpleTypeDerivationByListError = 26 + , ExpectedSimpleTypeInRestriction = 27 + , DuplicateFacet = 28 + , ExpectedSimpleTypeInUnion = 29 + , EmptySimpleTypeContent = 30 + , InvalidSimpleContent = 31 + , UnspecifiedBase = 32 + , InvalidComplexContent = 33 + , SchemaElementContentError = 34 + , ContentError = 35 + , UnknownSimpleType = 36 + , UnknownComplexType = 37 + , UnresolvedPrefix = 38 + , RefElementNotFound = 39 + , TypeNotFound = 40 + , TopLevelAttributeNotFound = 41 + , InvalidChildInComplexType = 42 + , BaseTypeNotFound = 43 + , DatatypeValidatorCreationError = 44 + , InvalidChildFollowingSimpleContent = 45 + , InvalidChildFollowingConplexContent = 46 + , AttributeDefaultFixedValue = 47 + , NotOptionalDefaultAttValue = 48 + , DuplicateAttribute = 49 + , AttributeWithTypeAndSimpleType = 50 + , AttributeSimpleTypeNotFound = 51 + , ElementWithFixedAndDefault = 52 + , InvalidDeclarationName = 53 + , ElementWithTypeAndAnonType = 54 + , NotSimpleOrMixedElement = 55 + , DisallowedSimpleTypeExtension = 56 + , InvalidSimpleContentBase = 57 + , InvalidComplexTypeBase = 58 + , InvalidChildInSimpleContent = 59 + , InvalidChildInComplexContent = 60 + , AnnotationError = 61 + , DisallowedBaseDerivation = 62 + , InvalidBlockValue = 63 + , InvalidFinalValue = 64 + , InvalidSubstitutionGroupElement = 65 + , SubstitutionGroupTypeMismatch = 66 + , DuplicateElementDeclaration = 67 + , InvalidAttValue = 68 + , AttributeRefContentError = 69 + , DuplicateRefAttribute = 70 + , ForbiddenDerivationByRestriction = 71 + , ForbiddenDerivationByExtension = 72 + , BaseNotComplexType = 73 + , ImportNamespaceDifference = 74 + , DeclarationNoSchemaLocation = 75 + , IncludeNamespaceDifference = 76 + , OnlyAnnotationExpected = 77 + , InvalidAttributeContent = 78 + , AttributeRequiredGlobal = 79 + , AttributeRequiredLocal = 80 + , AttributeDisallowedGlobal = 81 + , AttributeDisallowedLocal = 82 + , InvalidMin2MaxOccurs = 83 + , AnyAttributeContentError = 84 + , NoNameGlobalElement = 85 + , NoCircularDefinition = 86 + , DuplicateGlobalType = 87 + , DuplicateGlobalDeclaration = 88 + , WS_CollapseExpected = 89 + , Import_1_1 = 90 + , Import_1_2 = 91 + , ElemIDValueConstraint = 92 + , NoNotationType = 93 + , EmptiableMixedContent = 94 + , EmptyComplexRestrictionDerivation = 95 + , MixedOrElementOnly = 96 + , InvalidContentRestriction = 97 + , ForbiddenDerivation = 98 + , AtomicItemType = 99 + , GroupContentError = 100 + , AttGroupContentError = 101 + , MinMaxOnGroupChild = 102 + , DeclarationNotFound = 103 + , AllContentLimited = 104 + , BadMinMaxAllCT = 105 + , BadMinMaxAllElem = 106 + , DuplicateAttInDerivation = 107 + , NotExpressibleWildCardIntersection = 108 + , BadAttDerivation_1 = 109 + , BadAttDerivation_2 = 110 + , BadAttDerivation_3 = 111 + , BadAttDerivation_4 = 112 + , BadAttDerivation_5 = 113 + , BadAttDerivation_6 = 114 + , BadAttDerivation_7 = 115 + , BadAttDerivation_8 = 116 + , BadAttDerivation_9 = 117 + , AllContentError = 118 + , RedefineNamespaceDifference = 119 + , Redefine_InvalidSimpleType = 120 + , Redefine_InvalidSimpleTypeBase = 121 + , Redefine_InvalidComplexType = 122 + , Redefine_InvalidComplexTypeBase = 123 + , Redefine_InvalidGroupMinMax = 124 + , Redefine_DeclarationNotFound = 125 + , Redefine_GroupRefCount = 126 + , Redefine_AttGroupRefCount = 127 + , Redefine_InvalidChild = 128 + , Notation_DeclNotFound = 129 + , IC_DuplicateDecl = 130 + , IC_BadContent = 131 + , IC_KeyRefReferNotFound = 132 + , IC_KeyRefCardinality = 133 + , IC_XPathExprMissing = 134 + , AttUseCorrect = 135 + , AttDeclPropCorrect3 = 136 + , AttDeclPropCorrect5 = 137 + , AttGrpPropCorrect3 = 138 + , InvalidTargetNSValue = 139 + , XMLException_Error = 140 + , InvalidRedefine = 141 + , InvalidNSReference = 142 + , NotAllContent = 143 + , InvalidAnnotationContent = 144 + , InvalidFacetName = 145 + , InvalidXMLSchemaRoot = 146 + , CircularSubsGroup = 147 + , ELTSchemaNS = 148 + , InvalidAttTNS = 149 + , NSDeclInvalid = 150 + , DOMLevel1Node = 151 + , DuplicateAnyAttribute = 152 + , AnyAttributeBeforeAttribute = 153 + , E_HighBounds = 154 + , F_LowBounds = 155 + , EntityExpansionLimitExceeded = 156 + , ExpectedCommentOrCDATA = 157 + , ExpectedAttrName = 158 + , ExpectedNotationName = 159 + , NoRepInMixed = 160 + , ExpectedDefAttrDecl = 161 + , ExpectedEqSign = 162 + , ExpectedElementName = 163 + , CommentsMustStartWith = 164 + , InvalidDocumentStructure = 165 + , ExpectedDeclString = 166 + , BadXMLVersion = 167 + , UnsupportedXMLVersion = 168 + , UnterminatedXMLDecl = 169 + , BadXMLEncoding = 170 + , BadStandalone = 171 + , UnterminatedComment = 172 + , PINameExpected = 173 + , UnterminatedPI = 174 + , InvalidCharacter = 175 + , UnterminatedStartTag = 176 + , ExpectedAttrValue = 177 + , UnterminatedEndTag = 178 + , ExpectedAttributeType = 179 + , ExpectedEndOfTagX = 180 + , ExpectedMarkup = 181 + , NotValidAfterContent = 182 + , ExpectedComment = 183 + , ExpectedCommentOrPI = 184 + , ExpectedWhitespace = 185 + , NoRootElemInDOCTYPE = 186 + , ExpectedQuotedString = 187 + , ExpectedPublicId = 188 + , InvalidPublicIdChar = 189 + , UnterminatedDOCTYPE = 190 + , InvalidCharacterInIntSubset = 191 + , UnexpectedWhitespace = 192 + , InvalidCharacterInAttrValue = 193 + , ExpectedMarkupDecl = 194 + , TextDeclNotLegalHere = 195 + , ConditionalSectInIntSubset = 196 + , ExpectedPEName = 197 + , UnterminatedEntityDecl = 198 + , InvalidCharacterRef = 199 + , UnterminatedCharRef = 200 + , ExpectedEntityRefName = 201 + , EntityNotFound = 202 + , NoUnparsedEntityRefs = 203 + , UnterminatedEntityRef = 204 + , RecursiveEntity = 205 + , PartialMarkupInEntity = 206 + , UnterminatedElementDecl = 207 + , ExpectedContentSpecExpr = 208 + , ExpectedAsterisk = 209 + , UnterminatedContentModel = 210 + , ExpectedSystemOrPublicId = 211 + , UnterminatedNotationDecl = 212 + , ExpectedSeqChoiceLeaf = 213 + , ExpectedChoiceOrCloseParen = 214 + , ExpectedSeqOrCloseParen = 215 + , ExpectedEnumValue = 216 + , ExpectedEnumSepOrParen = 217 + , UnterminatedEntityLiteral = 218 + , MoreEndThanStartTags = 219 + , ExpectedOpenParen = 220 + , AttrAlreadyUsedInSTag = 221 + , BracketInAttrValue = 222 + , Expected2ndSurrogateChar = 223 + , ExpectedEndOfConditional = 224 + , ExpectedIncOrIgn = 225 + , ExpectedINCLUDEBracket = 226 + , UnexpectedEOE = 227 + , PEPropogated = 228 + , ExtraCloseSquare = 229 + , PERefInMarkupInIntSubset = 230 + , EntityPropogated = 231 + , ExpectedNumericalCharRef = 232 + , ExpectedOpenSquareBracket = 233 + , BadSequenceInCharData = 234 + , IllegalSequenceInComment = 235 + , UnterminatedCDATASection = 236 + , ExpectedNDATA = 237 + , NDATANotValidForPE = 238 + , HexRadixMustBeLowerCase = 239 + , DeclStringRep = 240 + , DeclStringsInWrongOrder = 241 + , NoExtRefsInAttValue = 242 + , XMLDeclMustBeLowerCase = 243 + , ExpectedEntityValue = 244 + , BadDigitForRadix = 245 + , EndedWithTagsOnStack = 246 + , NestedCDATA = 247 + , UnknownPrefix = 248 + , PartialTagMarkupError = 249 + , EmptyMainEntity = 250 + , CDATAOutsideOfContent = 251 + , Unexpected2ndSurrogateChar = 252 + , NoPIStartsWithXML = 253 + , XMLDeclMustBeFirst = 254 + , XMLVersionRequired = 255 + , StandaloneNotLegal = 256 + , EncodingRequired = 257 + , ColonNotLegalWithNS = 258 + , XMLException_Fatal = 259 + , BadSchemaLocation = 260 + , SchemaScanFatalError = 261 + , IllegalRefInStandalone = 262 + , PEBetweenDecl = 263 + , NoEmptyStrNamespace = 264 + , NoUseOfxmlnsAsPrefix = 265 + , NoUseOfxmlnsURI = 266 + , PrefixXMLNotMatchXMLURI = 267 + , XMLURINotMatchXMLPrefix = 268 + , NoXMLNSAsElementPrefix = 269 + , CT_SimpleTypeChildRequired = 270 + , InvalidRootElemInDOCTYPE = 271 + , InvalidElementName = 272 + , InvalidAttrName = 273 + , InvalidEntityRefName = 274 + , DuplicateDocTypeDecl = 275 + , XIncludeOrphanFallback = 276 + , XIncludeNoHref = 277 + , XIncludeXPointerNotSupported = 278 + , XIncludeInvalidParseVal = 279 + , XIncludeMultipleFallbackElems = 280 + , XIncludeIncludeFailedNoFallback = 281 + , XIncludeCircularInclusionLoop = 282 + , XIncludeCircularInclusionDocIncludesSelf = 283 + , XIncludeDisallowedChild = 284 + , XIncludeConflictingNotation = 285 + , XIncludeConflictingEntity = 286 + , F_HighBounds = 287 + }; + + static bool isFatal(const XMLErrs::Codes toCheck) + { + return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)); + } + + static bool isWarning(const XMLErrs::Codes toCheck) + { + return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)); + } + + static bool isError(const XMLErrs::Codes toCheck) + { + return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)); + } + + static XMLErrorReporter::ErrTypes errorType(const XMLErrs::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return XMLErrorReporter::ErrType_Warning; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return XMLErrorReporter::ErrType_Fatal; + else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)) + return XMLErrorReporter::ErrType_Error; + return XMLErrorReporter::ErrTypes_Unknown; + } + static DOMError::ErrorSeverity DOMErrorType(const XMLErrs::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return DOMError::DOM_SEVERITY_WARNING; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return DOMError::DOM_SEVERITY_FATAL_ERROR; + else return DOMError::DOM_SEVERITY_ERROR; + } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLErrs(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/framework/XMLErrorReporter.hpp b/project/jni/xerces/src/xercesc/framework/XMLErrorReporter.hpp new file mode 100644 index 000000000..c29076a1e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLErrorReporter.hpp @@ -0,0 +1,162 @@ +/* + * 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: XMLErrorReporter.hpp 672273 2008-06-27 13:57:00Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * This abstract class defines a callback mechanism for the scanner. By + * creating a class that implements this interface and plugging an instance + * of that class into the scanner, the scanner will call back on the object's + * virtual methods to report error events. This class is also used with the + * validator, to allow it to report errors. + * + * This class is primarily for use by those writing their own parser classes. + * If you use the standard parser classes, DOMParser and SAXParser, you won't + * use this API. You will instead use a similar mechanism defined by the SAX + * API, called ErrorHandler. + */ +class XMLPARSER_EXPORT XMLErrorReporter +{ +public: + // ----------------------------------------------------------------------- + // The types of errors we can issue + // ----------------------------------------------------------------------- + enum ErrTypes + { + ErrType_Warning + , ErrType_Error + , ErrType_Fatal + + , ErrTypes_Unknown + }; + + + // ----------------------------------------------------------------------- + // Constructors are hidden, only the virtual destructor is exposed + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + + /** + * Default destructor + */ + virtual ~XMLErrorReporter() + { + } + //@} + + + // ----------------------------------------------------------------------- + // The error handler interface + // ----------------------------------------------------------------------- + + /** @name Error Handler interface */ + //@{ + + /** Called to report errors from the scanner or validator + * + * This method is called back on by the scanner or validator (or any other + * internal parser component which might need to report an error in the + * future.) It contains all the information that the client code might + * need to report or log the error. + * + * @param errCode The error code of the error being reported. What + * this means is dependent on the domain it is from. + * + * @param errDomain The domain from which the error occured. The domain + * is a means of providing a hierarchical layering to + * the error system, so that a single set of error id + * numbers don't have to be split up. + * + * @param type The error type, which is defined mostly by XML which + * categorizes errors into warning, errors and validity + * constraints. + * + * @param errorText The actual text of the error. This is translatable, + * so can possibly be in the local language if a + * translation has been provided. + * + * @param systemId The system id of the entity where the error occured, + * fully qualified. + * + * @param publicId The optional public id of the entity were the error + * occured. It can be an empty string if non was provided. + * + * @param lineNum The line number within the source XML of the error. + * + * @param colNum The column number within the source XML of the error. + * Because of the parsing style, this is usually just + * after the actual offending text. + */ + virtual void error + ( + const unsigned int errCode + , const XMLCh* const errDomain + , const ErrTypes type + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ) = 0; + + /** Called before a new parse event to allow the handler to reset + * + * This method is called by the scanner before a new parse event is + * about to start. It gives the error handler a chance to reset its + * internal state. + */ + virtual void resetErrors() = 0; + + //@} + + +protected : + + /** @name Constructor */ + //@{ + + /** + * Default constructor + */ + XMLErrorReporter() + { + } + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and destructor + // ----------------------------------------------------------------------- + XMLErrorReporter(const XMLErrorReporter&); + XMLErrorReporter& operator=(const XMLErrorReporter&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLFormatter.cpp b/project/jni/xerces/src/xercesc/framework/XMLFormatter.cpp new file mode 100644 index 000000000..f37ab0a5e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLFormatter.cpp @@ -0,0 +1,705 @@ +/* + * 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: XMLFormatter.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local data +// +// gXXXRef +// These are hard coded versions of the char refs we put out for the +// standard char refs. +// +// gEscapeChars +// For each style of escape, we have a list of the chars that must +// be escaped for that style. The first null hit in each list indicates +// no more valid entries in that list. The first entry is a dummy for +// the NoEscapes style. +// --------------------------------------------------------------------------- +static const XMLCh gAmpRef[] = +{ + chAmpersand, chLatin_a, chLatin_m, chLatin_p, chSemiColon, chNull +}; + +static const XMLCh gAposRef[] = +{ + chAmpersand, chLatin_a, chLatin_p, chLatin_o, chLatin_s, chSemiColon, chNull +}; + +static const XMLCh gGTRef[] = +{ + chAmpersand, chLatin_g, chLatin_t, chSemiColon, chNull +}; + +static const XMLCh gLTRef[] = +{ + chAmpersand, chLatin_l, chLatin_t, chSemiColon, chNull +}; + +static const XMLCh gQuoteRef[] = +{ + chAmpersand, chLatin_q, chLatin_u, chLatin_o, chLatin_t, chSemiColon, chNull +}; + +static const unsigned int kEscapeCount = 7; +static const XMLCh gEscapeChars[XMLFormatter::EscapeFlags_Count][kEscapeCount] = +{ + { chNull , chNull , chNull , chNull , chNull , chNull , chNull } + , { chAmpersand , chCloseAngle , chDoubleQuote , chOpenAngle , chSingleQuote , chNull , chNull } + , { chAmpersand , chOpenAngle , chDoubleQuote , chLF , chCR , chHTab , chNull } + , { chAmpersand , chOpenAngle , chCloseAngle , chNull , chNull , chNull , chNull } +}; + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- +bool XMLFormatter::inEscapeList(const XMLFormatter::EscapeFlags escStyle + , const XMLCh toCheck) +{ + const XMLCh* escList = gEscapeChars[escStyle]; + while (*escList) + { + if (*escList++ == toCheck) + return true; + } + + /*** + * XML1.1 + * + * Finally, there is considerable demand to define a standard representation of + * arbitrary Unicode characters in XML documents. Therefore, XML 1.1 allows the + * use of character references to the control characters #x1 through #x1F, + * most of which are forbidden in XML 1.0. For reasons of robustness, however, + * these characters still cannot be used directly in documents. + * In order to improve the robustness of character encoding detection, the + * additional control characters #x7F through #x9F, which were freely allowed in + * XML 1.0 documents, now must also appear only as character references. + * (Whitespace characters are of course exempt.) The minor sacrifice of backward + * compatibility is considered not significant. + * Due to potential problems with APIs, #x0 is still forbidden both directly and + * as a character reference. + * + ***/ + if (fIsXML11) + { + // for XML11 + if ( XMLChar1_1::isControlChar(toCheck, 0) && + !XMLChar1_1::isWhitespace(toCheck, 0) ) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + +} + + +// --------------------------------------------------------------------------- +// XMLFormatter: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLFormatter::XMLFormatter( const char* const outEncoding + , const char* const docVersion + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags + , const UnRepFlags unrepFlags + , MemoryManager* const manager) + : fEscapeFlags(escapeFlags) + , fOutEncoding(0) + , fTarget(target) + , fUnRepFlags(unrepFlags) + , fXCoder(0) + , fAposRef(0) + , fAposLen(0) + , fAmpRef(0) + , fAmpLen(0) + , fGTRef(0) + , fGTLen(0) + , fLTRef(0) + , fLTLen(0) + , fQuoteRef(0) + , fQuoteLen(0) + , fIsXML11(false) + , fMemoryManager(manager) +{ + // Transcode the encoding string + fOutEncoding = XMLString::transcode(outEncoding, fMemoryManager); + + // Try to create a transcoder for this encoding + XMLTransService::Codes resCode; + fXCoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fOutEncoding + , resCode + , kTmpBufSize + , fMemoryManager + ); + + if (!fXCoder) + { + fMemoryManager->deallocate(fOutEncoding); //delete [] fOutEncoding; + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , outEncoding + , fMemoryManager + ); + } + + XMLCh* const tmpDocVer = XMLString::transcode(docVersion, fMemoryManager); + ArrayJanitor jname(tmpDocVer, fMemoryManager); + fIsXML11 = XMLString::equals(tmpDocVer, XMLUni::fgVersion1_1); +} + + +XMLFormatter::XMLFormatter( const XMLCh* const outEncoding + , const XMLCh* const docVersion + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags + , const UnRepFlags unrepFlags + , MemoryManager* const manager) + : fEscapeFlags(escapeFlags) + , fOutEncoding(0) + , fTarget(target) + , fUnRepFlags(unrepFlags) + , fXCoder(0) + , fAposRef(0) + , fAposLen(0) + , fAmpRef(0) + , fAmpLen(0) + , fGTRef(0) + , fGTLen(0) + , fLTRef(0) + , fLTLen(0) + , fQuoteRef(0) + , fQuoteLen(0) + , fIsXML11(false) + , fMemoryManager(manager) +{ + // Try to create a transcoder for this encoding + XMLTransService::Codes resCode; + fXCoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + outEncoding + , resCode + , kTmpBufSize + , fMemoryManager + ); + + if (!fXCoder) + { + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , outEncoding + , fMemoryManager + ); + } + + // Copy the encoding string + fOutEncoding = XMLString::replicate(outEncoding, fMemoryManager); + + + fIsXML11 = XMLString::equals(docVersion, XMLUni::fgVersion1_1); +} + +XMLFormatter::XMLFormatter( const char* const outEncoding + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags + , const UnRepFlags unrepFlags + , MemoryManager* const manager) + : fEscapeFlags(escapeFlags) + , fOutEncoding(0) + , fTarget(target) + , fUnRepFlags(unrepFlags) + , fXCoder(0) + , fAposRef(0) + , fAposLen(0) + , fAmpRef(0) + , fAmpLen(0) + , fGTRef(0) + , fGTLen(0) + , fLTRef(0) + , fLTLen(0) + , fQuoteRef(0) + , fQuoteLen(0) + , fIsXML11(false) + , fMemoryManager(manager) +{ + // this constructor uses "1.0" for the docVersion + + // Transcode the encoding string + fOutEncoding = XMLString::transcode(outEncoding, fMemoryManager); + + // Try to create a transcoder for this encoding + XMLTransService::Codes resCode; + fXCoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fOutEncoding + , resCode + , kTmpBufSize + , fMemoryManager + ); + + if (!fXCoder) + { + fMemoryManager->deallocate(fOutEncoding); //delete [] fOutEncoding; + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , outEncoding + , fMemoryManager + ); + } + + //XMLCh* const tmpDocVer = XMLString::transcode("1.0", fMemoryManager); + //ArrayJanitor jname(tmpDocVer, fMemoryManager); + //fIsXML11 = XMLString::equals(tmpDocVer, XMLUni::fgVersion1_1); + fIsXML11 = false; // docVersion 1.0 is not 1.1! +} + + +XMLFormatter::XMLFormatter( const XMLCh* const outEncoding + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags + , const UnRepFlags unrepFlags + , MemoryManager* const manager) + : fEscapeFlags(escapeFlags) + , fOutEncoding(0) + , fTarget(target) + , fUnRepFlags(unrepFlags) + , fXCoder(0) + , fAposRef(0) + , fAposLen(0) + , fAmpRef(0) + , fAmpLen(0) + , fGTRef(0) + , fGTLen(0) + , fLTRef(0) + , fLTLen(0) + , fQuoteRef(0) + , fQuoteLen(0) + , fIsXML11(false) + , fMemoryManager(manager) +{ + // this constructor uses XMLUni::fgVersion1_0 for the docVersion + + // Try to create a transcoder for this encoding + XMLTransService::Codes resCode; + fXCoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + outEncoding + , resCode + , kTmpBufSize + , fMemoryManager + ); + + if (!fXCoder) + { + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , outEncoding + , fMemoryManager + ); + } + + // Copy the encoding string + fOutEncoding = XMLString::replicate(outEncoding, fMemoryManager); + + //fIsXML11 = XMLString::equals(docVersion, XMLUni::fgVersion1_1); + fIsXML11 = false; // docVersion 1.0 is not 1.1! +} + +XMLFormatter::~XMLFormatter() +{ + fMemoryManager->deallocate(fAposRef); //delete [] fAposRef; + fMemoryManager->deallocate(fAmpRef); //delete [] fAmpRef; + fMemoryManager->deallocate(fGTRef); //delete [] fGTRef; + fMemoryManager->deallocate(fLTRef); //delete [] fLTRef; + fMemoryManager->deallocate(fQuoteRef); //delete [] fQuoteRef; + fMemoryManager->deallocate(fOutEncoding); //delete [] fOutEncoding; + delete fXCoder; + + // We DO NOT own the target object! +} + + +// --------------------------------------------------------------------------- +// XMLFormatter: Formatting methods +// --------------------------------------------------------------------------- +void +XMLFormatter::formatBuf(const XMLCh* const toFormat + , const XMLSize_t count + , const EscapeFlags escapeFlags + , const UnRepFlags unrepFlags) +{ + // + // Figure out the actual escape flag value. If the parameter is not + // the default, then take it. Else take the current default. + // + const EscapeFlags actualEsc = (escapeFlags == DefaultEscape) + ? fEscapeFlags : escapeFlags; + + // And do the same for the unrep flags + const UnRepFlags actualUnRep = (unrepFlags == DefaultUnRep) + ? fUnRepFlags : unrepFlags; + + // + // If the actual unrep action is that they want to provide char refs + // for unrepresentable chars, then this one is a much more difficult + // one to do cleanly, and we handle it separately. + // + if (actualUnRep == UnRep_CharRef) + { + specialFormat(toFormat, count, actualEsc); + return; + } + + // + // If we don't have any escape flags set, then we can do the most + // efficient loop, else we have to do it the hard way. + // + const XMLCh* srcPtr = toFormat; + const XMLCh* endPtr = toFormat + count; + if (actualEsc == NoEscapes) + { + // + // Just do a whole buffer at a time into the temp buffer, cap + // it off, and send it to the target. + // + if (srcPtr < endPtr) + srcPtr += handleUnEscapedChars(srcPtr, endPtr - srcPtr, actualUnRep); + } + else + { + // + // Escape chars that require it according tot he scale flags + // we were given. For the others, try to accumulate them and + // format them in as big as bulk as we can. + // + while (srcPtr < endPtr) + { + // + // Run a temp pointer up until we hit a character that we have + // to escape. Then we can convert all the chars between our + // current source pointer and here all at once. + // + const XMLCh* tmpPtr = srcPtr; + while ((tmpPtr < endPtr) && !inEscapeList(actualEsc, *tmpPtr)) + tmpPtr++; + + // + // If we got any chars, then lets convert them and write them + // out. + // + if (tmpPtr > srcPtr) + srcPtr += handleUnEscapedChars(srcPtr, tmpPtr - srcPtr, + actualUnRep); + + else if (tmpPtr < endPtr) + { + // + // Ok, so we've hit a char that must be escaped. So do + // this one specially. + // + const XMLByte * theChars; + switch (*srcPtr) { + case chAmpersand : + theChars = getCharRef(fAmpLen, fAmpRef, gAmpRef); + fTarget->writeChars(theChars, fAmpLen, this); + break; + + case chSingleQuote : + theChars = getCharRef(fAposLen, fAposRef, gAposRef); + fTarget->writeChars(theChars, fAposLen, this); + break; + + case chDoubleQuote : + theChars = getCharRef(fQuoteLen, fQuoteRef, gQuoteRef); + fTarget->writeChars(theChars, fQuoteLen, this); + break; + + case chCloseAngle : + theChars = getCharRef(fGTLen, fGTRef, gGTRef); + fTarget->writeChars(theChars, fGTLen, this); + break; + + case chOpenAngle : + theChars = getCharRef(fLTLen, fLTRef, gLTRef); + fTarget->writeChars(theChars, fLTLen, this); + break; + + default: + // control characters + writeCharRef(*srcPtr); + break; + } + srcPtr++; + } + } + } +} + + +XMLSize_t +XMLFormatter::handleUnEscapedChars(const XMLCh * srcPtr, + const XMLSize_t oCount, + const UnRepFlags actualUnRep) +{ + // + // Use that to figure out what I should pass to the transcoder. If we + // are doing character references or failing for unrepresentable chars, + // then we just throw, since we should never get a call for something + // we cannot represent. Else, we tell it to just use the replacement + // char. + // + const XMLTranscoder::UnRepOpts unRepOpts = (actualUnRep == UnRep_Replace) + ? XMLTranscoder::UnRep_RepChar + : XMLTranscoder::UnRep_Throw; + + XMLSize_t charsEaten; + XMLSize_t count = oCount; + + while (count) { + const XMLSize_t srcChars = (count > XMLSize_t (kTmpBufSize)) + ? XMLSize_t (kTmpBufSize) : count; + + const XMLSize_t outBytes + = fXCoder->transcodeTo(srcPtr, srcChars, + fTmpBuf, kTmpBufSize, + charsEaten, unRepOpts); + + if (outBytes) { + fTmpBuf[outBytes] = 0; fTmpBuf[outBytes + 1] = 0; + fTmpBuf[outBytes + 2] = 0; fTmpBuf[outBytes + 3] = 0; + fTarget->writeChars(fTmpBuf, outBytes, this); + } + + srcPtr += charsEaten; + count -= charsEaten; + } + + return oCount; // This should be an assertion that count == 0. +} + + +XMLFormatter& XMLFormatter::operator<<(const XMLCh* const toFormat) +{ + const XMLSize_t len = XMLString::stringLen(toFormat); + formatBuf(toFormat, len); + return *this; +} + +XMLFormatter& XMLFormatter::operator<<(const XMLCh toFormat) +{ + // Make a temp string format that + XMLCh szTmp[2]; + szTmp[0] = toFormat; + szTmp[1] = 0; + + formatBuf(szTmp, 1); + return *this; +} + +/** + * the parameter, count, is needed since stringLen() + * does not work on a BOM like "0xFE0xFF0x000x00" or + * "0x000x000xFF0xFE" + **/ +void XMLFormatter::writeBOM(const XMLByte* const toFormat + , const XMLSize_t count) +{ + fTarget->writeChars(toFormat, count, this); +} + +// --------------------------------------------------------------------------- +// XMLFormatter: Private helper methods +// --------------------------------------------------------------------------- +void XMLFormatter::writeCharRef(const XMLCh &toWrite) +{ + XMLCh tmpBuf[32]; + tmpBuf[0] = chAmpersand; + tmpBuf[1] = chPound; + tmpBuf[2] = chLatin_x; + + // Build a char ref for the current char + XMLString::binToText(toWrite, &tmpBuf[3], 8, 16, fMemoryManager); + const XMLSize_t bufLen = XMLString::stringLen(tmpBuf); + tmpBuf[bufLen] = chSemiColon; + tmpBuf[bufLen+1] = chNull; + + // write it out + formatBuf(tmpBuf + , bufLen + 1 + , XMLFormatter::NoEscapes + , XMLFormatter::UnRep_Fail); + +} + +void XMLFormatter::writeCharRef(XMLSize_t toWrite) +{ + XMLCh tmpBuf[64]; + tmpBuf[0] = chAmpersand; + tmpBuf[1] = chPound; + tmpBuf[2] = chLatin_x; + + // Build a char ref for the current char + XMLString::sizeToText(toWrite, &tmpBuf[3], 32, 16, fMemoryManager); + const XMLSize_t bufLen = XMLString::stringLen(tmpBuf); + tmpBuf[bufLen] = chSemiColon; + tmpBuf[bufLen+1] = chNull; + + // write it out + formatBuf(tmpBuf + , bufLen + 1 + , XMLFormatter::NoEscapes + , XMLFormatter::UnRep_Fail); + +} + + +const XMLByte* XMLFormatter::getCharRef(XMLSize_t &count, + XMLByte* &ref, + const XMLCh * stdRef) +{ + if (!ref) { + + XMLSize_t charsEaten; + const XMLSize_t outBytes = + fXCoder->transcodeTo(stdRef, XMLString::stringLen(stdRef), + fTmpBuf, kTmpBufSize, charsEaten, + XMLTranscoder::UnRep_Throw); + + fTmpBuf[outBytes] = 0; + fTmpBuf[outBytes + 1] = 0; + fTmpBuf[outBytes + 2] = 0; + fTmpBuf[outBytes + 3] = 0; + + ref = (XMLByte*) fMemoryManager->allocate + ( + (outBytes + 4) * sizeof(XMLByte) + );//new XMLByte[outBytes + 4]; + memcpy(ref, fTmpBuf, outBytes + 4); + count = outBytes; + } + + return ref; +} + +void XMLFormatter::specialFormat(const XMLCh* const toFormat + , const XMLSize_t count + , const EscapeFlags escapeFlags) +{ + // + // We have to check each character and see if it could be represented. + // As long as it can, we just keep up with where we started and how + // many chars we've checked. When we hit an unrepresentable one, we + // stop, transcode everything we've collected, then start handling + // the unrepresentables via char refs. We repeat this until we get all + // the chars done. + // + const XMLCh* srcPtr = toFormat; + const XMLCh* endPtr = toFormat + count; + + while (srcPtr < endPtr) + { + const XMLCh* tmpPtr = srcPtr; + while (tmpPtr < endPtr) + { + if (fXCoder->canTranscodeTo(*tmpPtr)) + tmpPtr++; + else + break; + } + + if (tmpPtr > srcPtr) + { + // We got at least some chars that can be done normally + formatBuf + ( + srcPtr + , tmpPtr - srcPtr + , escapeFlags + , XMLFormatter::UnRep_Fail + ); + + // Update the source pointer to our new spot + srcPtr = tmpPtr; + } + else + { + + // We hit something unrepresentable. So continue forward doing + // char refs until we hit something representable again or the + // end of input. + // + while (srcPtr < endPtr) + { + if ((*srcPtr & 0xFC00) == 0xD800) { + // we have encountered a surrogate, need to recombine before printing out + // use writeCharRef that takes XMLSize_t to get values larger than + // hex 0xFFFF printed. + tmpPtr = srcPtr; + tmpPtr++; // point at low surrogate + writeCharRef((XMLSize_t) (0x10000+((*srcPtr-0xD800)<<10)+*tmpPtr-0xDC00)); + srcPtr++; // advance to low surrogate (will advance again below) + } + else { + writeCharRef(*srcPtr); + } + + // Move up the source pointer and break out if needed + srcPtr++; + if (fXCoder->canTranscodeTo(*srcPtr)) + break; + } + } + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLFormatter.hpp b/project/jni/xerces/src/xercesc/framework/XMLFormatter.hpp new file mode 100644 index 000000000..49354dafa --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLFormatter.hpp @@ -0,0 +1,538 @@ +/* + * 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: XMLFormatter.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLFORMATTER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLFORMATTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLFormatTarget; +class XMLTranscoder; + +/** + * This class provides the basic formatting capabilities that are required + * to turn the Unicode based XML data from the parsers into a form that can + * be used on non-Unicode based systems, that is, into local or generic text + * encodings. + * + * A number of flags are provided to control whether various optional + * formatting operations are performed. + */ +class XMLPARSER_EXPORT XMLFormatter : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** @name Public Constants */ + //@{ + /** + * EscapeFlags - Different styles of escape flags to control various formatting. + * + *

NoEscapes: + * No character needs to be escaped. Just write them out as is.

+ *

StdEscapes: + * The following characters need to be escaped:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
charactershould be escaped and written as
&&amp;
>&gt;
"&quot;
<&lt;
'&apos;
+ *

AttrEscapes: + * The following characters need to be escaped:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
charactershould be escaped and written as
&&amp;
>&gt;
"&quot;
+ *

CharEscapes: + * The following characters need to be escaped:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
charactershould be escaped and written as
&&amp;
>&gt;
+ *

EscapeFlags_Count: + * Special value, do not use directly.

+ *

DefaultEscape: + * Special value, do not use directly.

+ * + */ + enum EscapeFlags + { + NoEscapes + , StdEscapes + , AttrEscapes + , CharEscapes + + // Special values, don't use directly + , EscapeFlags_Count + , DefaultEscape = 999 + }; + + /** + * UnRepFlags + * + * The unrepresentable flags that indicate how to react when a + * character cannot be represented in the target encoding. + * + *

UnRep_Fail: + * Fail the operation.

+ *

UnRep_CharRef: + * Display the unrepresented character as reference.

+ *

UnRep_Replace: + * Replace the unrepresented character with the replacement character.

+ *

DefaultUnRep: + * Special value, do not use directly.

+ * + */ + enum UnRepFlags + { + UnRep_Fail + , UnRep_CharRef + , UnRep_Replace + + , DefaultUnRep = 999 + }; + //@} + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructor and Destructor */ + //@{ + /** + * @param outEncoding the encoding for the formatted content. + * @param docVersion the document version. + * @param target the formatTarget where the formatted content is written to. + * @param escapeFlags the escape style for certain character. + * @param unrepFlags the reaction to unrepresentable character. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XMLFormatter + ( + const XMLCh* const outEncoding + , const XMLCh* const docVersion + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags = NoEscapes + , const UnRepFlags unrepFlags = UnRep_Fail + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLFormatter + ( + const char* const outEncoding + , const char* const docVersion + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags = NoEscapes + , const UnRepFlags unrepFlags = UnRep_Fail + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLFormatter + ( + const XMLCh* const outEncoding + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags = NoEscapes + , const UnRepFlags unrepFlags = UnRep_Fail + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLFormatter + ( + const char* const outEncoding + , XMLFormatTarget* const target + , const EscapeFlags escapeFlags = NoEscapes + , const UnRepFlags unrepFlags = UnRep_Fail + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~XMLFormatter(); + //@} + + + // ----------------------------------------------------------------------- + // Formatting methods + // ----------------------------------------------------------------------- + /** @name Formatting methods */ + //@{ + /** + * @param toFormat the string to be formatted + * @param count length of the string + * @param escapeFlags the escape style for formatting toFormat + * @param unrepFlags the reaction for any unrepresentable character in toFormat + * + */ + void formatBuf + ( + const XMLCh* const toFormat + , const XMLSize_t count + , const EscapeFlags escapeFlags = DefaultEscape + , const UnRepFlags unrepFlags = DefaultUnRep + ); + + /** + * @see formatBuf + */ + XMLFormatter& operator<< + ( + const XMLCh* const toFormat + ); + + XMLFormatter& operator<< + ( + const XMLCh toFormat + ); + + void writeBOM(const XMLByte* const toFormat + , const XMLSize_t count); + + //@} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter methods */ + //@{ + /** + * @return return the encoding set for the formatted content + */ + + const XMLCh* getEncodingName() const; + + /** + * @return return constant transcoder used internally for transcoding the formatter conent + */ + inline const XMLTranscoder* getTranscoder() const; + + /** + * @return return the transcoder used internally for transcoding the formatter content + */ + inline XMLTranscoder* getTranscoder(); + + //@} + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + /** @name Setter methods */ + //@{ + /** + * @param newFlags set the escape style for the follow-on formatted content + */ + void setEscapeFlags + ( + const EscapeFlags newFlags + ); + + /** + * @param newFlags set the reaction for unrepresentable character + */ + void setUnRepFlags + ( + const UnRepFlags newFlags + ); + + /** + * @param newFlags set the escape style for the follow-on formatted content + * @see setEscapeFlags + */ + XMLFormatter& operator<< + ( + const EscapeFlags newFlags + ); + + /** + * @param newFlags set the reaction for unrepresentable character + * @see setUnRepFlags + */ + XMLFormatter& operator<< + ( + const UnRepFlags newFlags + ); + //@} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Setter methods */ + //@{ + /** + * @return return the escape style for the formatted content + */ + EscapeFlags getEscapeFlags() const; + + /** + * @return return the reaction for unrepresentable character + */ + UnRepFlags getUnRepFlags() const; + //@} + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLFormatter(); + XMLFormatter(const XMLFormatter&); + XMLFormatter& operator=(const XMLFormatter&); + + + // ----------------------------------------------------------------------- + // Private class constants + // ----------------------------------------------------------------------- + enum Constants + { + kTmpBufSize = 16 * 1024 + }; + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + const XMLByte* getCharRef(XMLSize_t &count, + XMLByte* &ref, + const XMLCh * stdRef); + + void writeCharRef(const XMLCh &toWrite); + void writeCharRef(XMLSize_t toWrite); + + bool inEscapeList(const XMLFormatter::EscapeFlags escStyle + , const XMLCh toCheck); + + + XMLSize_t handleUnEscapedChars(const XMLCh * srcPtr, + const XMLSize_t count, + const UnRepFlags unrepFlags); + + void specialFormat + ( + const XMLCh* const toFormat + , const XMLSize_t count + , const EscapeFlags escapeFlags + ); + + + // ----------------------------------------------------------------------- + // Private, non-virtual methods + // + // fEscapeFlags + // The escape flags we were told to use in formatting. These are + // defaults set in the ctor, which can be overridden on a particular + // call. + // + // fOutEncoding + // This the name of the output encoding. Saved mainly for meaningful + // error messages. + // + // fTarget + // This is the target object for the formatting operation. + // + // fUnRepFlags + // The unrepresentable flags that indicate how to react when a + // character cannot be represented in the target encoding. + // + // fXCoder + // This the transcoder that we will use. It is created using the + // encoding name we were told to use. + // + // fTmpBuf + // An output buffer that we use to transcode chars into before we + // send them off to be output. + // + // fAposRef + // fAmpRef + // fGTRef + // fLTRef + // fQuoteRef + // These are character refs for the standard char refs, in the + // output encoding. They are faulted in as required, by transcoding + // them from fixed Unicode versions. + // + // fIsXML11 + // for performance reason, we do not store the actual version string + // and do the string comparison again and again. + // + // ----------------------------------------------------------------------- + EscapeFlags fEscapeFlags; + XMLCh* fOutEncoding; + XMLFormatTarget* fTarget; + UnRepFlags fUnRepFlags; + XMLTranscoder* fXCoder; + XMLByte fTmpBuf[kTmpBufSize + 4]; + XMLByte* fAposRef; + XMLSize_t fAposLen; + XMLByte* fAmpRef; + XMLSize_t fAmpLen; + XMLByte* fGTRef; + XMLSize_t fGTLen; + XMLByte* fLTRef; + XMLSize_t fLTLen; + XMLByte* fQuoteRef; + XMLSize_t fQuoteLen; + bool fIsXML11; + MemoryManager* fMemoryManager; +}; + + +class XMLPARSER_EXPORT XMLFormatTarget : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + virtual ~XMLFormatTarget() {} + + + // ----------------------------------------------------------------------- + // Virtual interface + // ----------------------------------------------------------------------- + virtual void writeChars + ( + const XMLByte* const toWrite + , const XMLSize_t count + , XMLFormatter* const formatter + ) = 0; + + virtual void flush() {}; + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors and operators + // ----------------------------------------------------------------------- + XMLFormatTarget() {}; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLFormatTarget(const XMLFormatTarget&); + XMLFormatTarget& operator=(const XMLFormatTarget&); +}; + + +// --------------------------------------------------------------------------- +// XMLFormatter: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* XMLFormatter::getEncodingName() const +{ + return fOutEncoding; +} + +inline const XMLTranscoder* XMLFormatter::getTranscoder() const +{ + return fXCoder; +} + +inline XMLTranscoder* XMLFormatter::getTranscoder() +{ + return fXCoder; +} + +// --------------------------------------------------------------------------- +// XMLFormatter: Setter methods +// --------------------------------------------------------------------------- +inline void XMLFormatter::setEscapeFlags(const EscapeFlags newFlags) +{ + fEscapeFlags = newFlags; +} + +inline void XMLFormatter::setUnRepFlags(const UnRepFlags newFlags) +{ + fUnRepFlags = newFlags; +} + + +inline XMLFormatter& XMLFormatter::operator<<(const EscapeFlags newFlags) +{ + fEscapeFlags = newFlags; + return *this; +} + +inline XMLFormatter& XMLFormatter::operator<<(const UnRepFlags newFlags) +{ + fUnRepFlags = newFlags; + return *this; +} + +// --------------------------------------------------------------------------- +// XMLFormatter: Getter methods +// --------------------------------------------------------------------------- +inline XMLFormatter::EscapeFlags XMLFormatter::getEscapeFlags() const +{ + return fEscapeFlags; +} + +inline XMLFormatter::UnRepFlags XMLFormatter::getUnRepFlags() const +{ + return fUnRepFlags; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.cpp b/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.cpp new file mode 100644 index 000000000..43f54d7c9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.cpp @@ -0,0 +1,51 @@ +/* + * 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: XMLGrammarDescription.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLGrammarDescription::~XMLGrammarDescription() +{ +} + +XMLGrammarDescription::XMLGrammarDescription(MemoryManager* const memMgr) +:fMemMgr(memMgr) +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLGrammarDescription) + +void XMLGrammarDescription::serialize(XSerializeEngine&) +{ + //no data +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.hpp b/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.hpp new file mode 100644 index 000000000..55ad60d2e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLGrammarDescription.hpp @@ -0,0 +1,105 @@ +/* + * 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: XMLGrammarDescription.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARDESCRIPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XMLGRAMMARDESCRIPTION_HPP + +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT XMLGrammarDescription : public XSerializable, public XMemory +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + /** + * virtual destructor + * + */ + virtual ~XMLGrammarDescription(); + //@} + + // ----------------------------------------------------------------------- + /** @name The Grammar Description Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * getGrammarType + * + */ + virtual Grammar::GrammarType getGrammarType() const = 0; + + /** + * getGrammarKey + * + */ + virtual const XMLCh* getGrammarKey() const = 0; + //@} + + inline MemoryManager* getMemoryManager() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLGrammarDescription) + +protected : + // ----------------------------------------------------------------------- + /** Hidden Constructors */ + // ----------------------------------------------------------------------- + //@{ + XMLGrammarDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + //@} + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLGrammarDescription(const XMLGrammarDescription& ); + XMLGrammarDescription& operator=(const XMLGrammarDescription& ); + //@} + + // ----------------------------------------------------------------------- + // + // fMemMgr: plugged-in (or defaulted-in) memory manager, + // not owned + // no reset after initialization + // allow derivatives to access directly + // + // ----------------------------------------------------------------------- + MemoryManager* const fMemMgr; +}; + +inline MemoryManager* XMLGrammarDescription::getMemoryManager() const +{ + return fMemMgr; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLGrammarPool.hpp b/project/jni/xerces/src/xercesc/framework/XMLGrammarPool.hpp new file mode 100644 index 000000000..3c2dfc841 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLGrammarPool.hpp @@ -0,0 +1,322 @@ +/* + * 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: XMLGrammarPool.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOL_HPP + +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +class Grammar; +class XMLGrammarDescription; +class DTDGrammar; +class SchemaGrammar; +class XMLDTDDescription; +class XMLSchemaDescription; +class XMLStringPool; +class BinInputStream; +class BinOutputStream; + +class XMLPARSER_EXPORT XMLGrammarPool : public XMemory +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + + /** + * virtual destructor + * + */ + virtual ~XMLGrammarPool(){}; + //@} + + // ----------------------------------------------------------------------- + /** @name The Grammar Pool Interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * cacheGrammar + * + * Provide the grammar pool with an opportunity + * to cache the given grammar. If the pool does not choose to do so, + * it should return false; otherwise, it should return true, so that + * the caller knows whether the grammar has been adopted. + * + * @param gramToCache the Grammar to be cached in the grammar pool + * @return true if the grammar pool has elected to cache the grammar (in which case + * it is assumed to have adopted it); false if it does not cache it + * + */ + virtual bool cacheGrammar(Grammar* const gramToCache) = 0; + + /** + * retrieveGrammar + * + * @param gramDesc the Grammar Description used to search for grammar + * cached in the grammar pool + * + */ + virtual Grammar* retrieveGrammar(XMLGrammarDescription* const gramDesc) = 0; + + + /** + * orphanGrammar + * + * grammar removed from the grammar pool and owned by the caller + * + * @param nameSpaceKey Key used to search for grammar in the grammar pool + * @return the grammar that was removed from the pool (0 if none) + */ + virtual Grammar* orphanGrammar(const XMLCh* const nameSpaceKey) = 0; + + + /** + * Get an enumeration of the cached Grammars in the Grammar pool + * + * @return enumeration of the cached Grammars in Grammar pool + */ + virtual RefHashTableOfEnumerator getGrammarEnumerator() const = 0; + + /** + * clear + * + * all grammars are removed from the grammar pool and deleted. + * @return true if the grammar pool was cleared. false if it did not. + */ + virtual bool clear() = 0; + + /** + * lockPool + * + * When this method is called by the application, the + * grammar pool should stop adding new grammars to the cache. + * This should result in the grammar pool being sharable + * among parsers operating in different threads. + * + */ + virtual void lockPool() = 0; + + /** + * unlockPool + * + * After this method has been called, the grammar pool implementation + * should return to its default behaviour when cacheGrammars(...) is called. + * One effect, depending on the underlying implementation, is that the grammar pool + * may no longer be thread-safe (even on read operations). + * + * For PSVI support any previous XSModel that was produced will be deleted. + */ + virtual void unlockPool() = 0; + + //@} + + // ----------------------------------------------------------------------- + /** @name Factory interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * createDTDGrammar + * + */ + virtual DTDGrammar* createDTDGrammar() = 0; + + /** + * createSchemaGrammar + * + */ + virtual SchemaGrammar* createSchemaGrammar() = 0; + + /** + * createDTDDescription + * + */ + virtual XMLDTDDescription* createDTDDescription(const XMLCh* const systemId) = 0; + /** + * createSchemaDescription + * + */ + virtual XMLSchemaDescription* createSchemaDescription(const XMLCh* const targetNamespace) = 0; + + //@} + + // ----------------------------------------------------------------------- + /** @name schema component model support */ + // ----------------------------------------------------------------------- + //@{ + + /*** + * Return an XSModel derived from the components of all SchemaGrammars + * in the grammar pool. If the pool is locked, this should + * be a thread-safe operation. + * + * NOTE: The function should NEVER return NULL. If there are no grammars in + * the pool it should return an XSModel containing the Schema for Schema. + * + * Calling getXSModel() on an unlocked grammar pool may result in the + * creation of a new XSModel with the old XSModel being deleted. + * The bool parameter will indicate if the XSModel was changed. + * + */ + virtual XSModel *getXSModel(bool& XSModelWasChanged) = 0; + + // @} + + // ----------------------------------------------------------------------- + /** @name Getter */ + // ----------------------------------------------------------------------- + //@{ + + /** + * getMemoryManager + * + */ + inline MemoryManager* getMemoryManager() + { + return fMemMgr; + } + + /** + * Return an XMLStringPool for use by validation routines. + * Implementations should not create a string pool on each call to this + * method, but should maintain one string pool for all grammars + * for which this pool is responsible. + */ + virtual XMLStringPool *getURIStringPool() = 0; + //@} + + // ----------------------------------------------------------------------- + /** serialization and deserialization support */ + // ----------------------------------------------------------------------- + + /*** + * + * 1. Context: Serialize/Deserialize All Grammars In One Session + * + * Since it is common that a declaration in one grammar may reference + * to definitions in other grammars, it is required to serialize those + * related (or interdependent) grammars in to one persistent data store + * in one serialization session (storing), and deserialize them from the + * persistent data store in one deserialization session (loading) back + * to the grammar pool. + * + * 2. Multiple serializations + * + * It is acceptable that client application requests more than one + * grammar serialization on a particular grammar pool, to track the + * different grammars cached, or for whatever reasons that client + * application is interested in. + * + * 3. Multiple deserializations + * + * Request for grammar deserialization either after the grammar pool has + * its own cached grammars, or request for more than one grammar + * deserialization, may cause undesired and unpredictable consequence + * and therefore client application shall be aware that individual + * implementationis may NOT support this. + * + * However it is strongly recommended that the client application requests + * no more than one grammar deserialization even a particular implementation + * may allow multiple deserializations. + * + * 4. Locking + * + * Both serialization and deserialization requires to lock the grammar pool + * before operation and unlock after operation. In the case the grammar pool + * is locked by a third party, the request for serialization/deserialization + * will NOT be entertained. + * + * 5. Versioning + * + * The Persistent data store has a version tag to be verified during + * deserialization, thus a grammar pool may decide if it supports + * a binary data created by a different release of Xerces. + * + * 6. Clean up + * + * The client application shall be aware that in the event of an exception + * thrown due to a corrupted data store during deserialization, implementation + * may not be able to clean up all resources allocated, and therefore it is + * client application's responsibility to clean up those unreleased resources. + * + * + */ + virtual void serializeGrammars(BinOutputStream* const) = 0; + virtual void deserializeGrammars(BinInputStream* const) = 0; + + /* + * Set/get a flag to not create XSAnnotations when deserializing the grammar. + * Defaults to false (create XSAnnotations when deserializing the grammar). + */ + inline void setIgnoreSerializedAnnotations(const bool flag) + { + fIgnoreSerializedAnnotations = flag; + }; + inline bool getIgnoreSerializedAnnotations() const + { + return fIgnoreSerializedAnnotations; + }; + +protected : + // ----------------------------------------------------------------------- + /** Hidden Constructors */ + // ----------------------------------------------------------------------- + //@{ + XMLGrammarPool(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager) + :fMemMgr(memMgr) + ,fIgnoreSerializedAnnotations(false) + { + }; + //@} + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLGrammarPool(const XMLGrammarPool& ); + XMLGrammarPool& operator=(const XMLGrammarPool& ); + //@} + + // ----------------------------------------------------------------------- + // + // fMemMgr: plugged-in (or defaulted-in) memory manager + // not owned + // no reset after initialization + // + // ----------------------------------------------------------------------- + + MemoryManager* const fMemMgr; + bool fIgnoreSerializedAnnotations; + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.cpp b/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.cpp new file mode 100644 index 000000000..869e095e3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.cpp @@ -0,0 +1,364 @@ +/* + * 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: XMLGrammarPoolImpl.cpp 676823 2008-07-15 07:57:44Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// private function used to update fXSModel +void XMLGrammarPoolImpl::createXSModel() +{ + delete fXSModel; + fXSModel = 0; + fXSModel = new (getMemoryManager()) XSModel(this, getMemoryManager()); + fXSModelIsValid = true; +} + +// --------------------------------------------------------------------------- +// XMLGrammarPoolImpl: constructor and destructor +// --------------------------------------------------------------------------- +XMLGrammarPoolImpl::~XMLGrammarPoolImpl() +{ + delete fGrammarRegistry; + delete fStringPool; + if(fSynchronizedStringPool) + delete fSynchronizedStringPool; + if(fXSModel) + delete fXSModel; +} + +XMLGrammarPoolImpl::XMLGrammarPoolImpl(MemoryManager* const memMgr) +:XMLGrammarPool(memMgr) +,fGrammarRegistry(0) +,fStringPool(0) +,fSynchronizedStringPool(0) +,fXSModel(0) +,fLocked(false) +,fXSModelIsValid(false) +{ + fGrammarRegistry = new (memMgr) RefHashTableOf(29, true, memMgr); + fStringPool = new (memMgr) XMLStringPool(109, memMgr); +} + +// ----------------------------------------------------------------------- +// Implementation of Grammar Pool Interface +// ----------------------------------------------------------------------- +bool XMLGrammarPoolImpl::cacheGrammar(Grammar* const gramToCache ) +{ + if(fLocked || !gramToCache) + return false; + + const XMLCh* grammarKey = gramToCache->getGrammarDescription()->getGrammarKey(); + + if (fGrammarRegistry->containsKey(grammarKey)) + { + return false; + } + + fGrammarRegistry->put((void*) grammarKey, gramToCache); + + if (fXSModelIsValid && gramToCache->getGrammarType() == Grammar::SchemaGrammarType) + { + fXSModelIsValid = false; + } + return true; +} + +Grammar* XMLGrammarPoolImpl::retrieveGrammar(XMLGrammarDescription* const gramDesc) +{ + if (!gramDesc) + return 0; + + /*** + * This implementation simply use GrammarKey + */ + return fGrammarRegistry->get(gramDesc->getGrammarKey()); +} + +Grammar* XMLGrammarPoolImpl::orphanGrammar(const XMLCh* const nameSpaceKey) +{ + if (!fLocked) + { + Grammar* grammar = fGrammarRegistry->orphanKey(nameSpaceKey); + if (fXSModelIsValid && grammar && grammar->getGrammarType() == Grammar::SchemaGrammarType) + { + fXSModelIsValid = false; + } + return grammar; + } + return 0; +} + +RefHashTableOfEnumerator +XMLGrammarPoolImpl::getGrammarEnumerator() const +{ + return RefHashTableOfEnumerator(fGrammarRegistry, false, fGrammarRegistry->getMemoryManager()); +} + + +bool XMLGrammarPoolImpl::clear() +{ + if (!fLocked) + { + fGrammarRegistry->removeAll(); + + fXSModelIsValid = false; + if (fXSModel) + { + delete fXSModel; + fXSModel = 0; + } + return true; + } + return false; +} + +void XMLGrammarPoolImpl::lockPool() +{ + if (!fLocked) + { + fLocked = true; + MemoryManager *memMgr = getMemoryManager(); + if(!fSynchronizedStringPool) + { + fSynchronizedStringPool = new (memMgr) XMLSynchronizedStringPool(fStringPool, 109, memMgr); + } + if (!fXSModelIsValid) + { + createXSModel(); + } + } +} + +void XMLGrammarPoolImpl::unlockPool() +{ + if (fLocked) + { + fLocked = false; + if(fSynchronizedStringPool) + { + fSynchronizedStringPool->flushAll(); + // if user calls Lock again, need to have null fSynchronizedStringPool + delete fSynchronizedStringPool; + fSynchronizedStringPool = 0; + } + fXSModelIsValid = false; + if (fXSModel) + { + delete fXSModel; + fXSModel = 0; + } + } +} + +// ----------------------------------------------------------------------- +// Implementation of Factory Interface +// ----------------------------------------------------------------------- +DTDGrammar* XMLGrammarPoolImpl::createDTDGrammar() +{ + return new (getMemoryManager()) DTDGrammar(getMemoryManager()); +} + +SchemaGrammar* XMLGrammarPoolImpl::createSchemaGrammar() +{ + return new (getMemoryManager()) SchemaGrammar(getMemoryManager()); +} + +XMLDTDDescription* XMLGrammarPoolImpl::createDTDDescription(const XMLCh* const systemId) +{ + return new (getMemoryManager()) XMLDTDDescriptionImpl(systemId, getMemoryManager()); +} + +XMLSchemaDescription* XMLGrammarPoolImpl::createSchemaDescription(const XMLCh* const targetNamespace) +{ + return new (getMemoryManager()) XMLSchemaDescriptionImpl(targetNamespace, getMemoryManager()); +} + +XSModel *XMLGrammarPoolImpl::getXSModel(bool& XSModelWasChanged) +{ + XSModelWasChanged = false; + if (fLocked || fXSModelIsValid) + return fXSModel; + + createXSModel(); + XSModelWasChanged = true; + return fXSModel; +} + +XMLStringPool *XMLGrammarPoolImpl::getURIStringPool() +{ + if(fLocked) + return fSynchronizedStringPool; + return fStringPool; +} + +// ----------------------------------------------------------------------- +// serialization and deserialization support +// ----------------------------------------------------------------------- +/*** + * + * don't serialize + * + * XMLSynchronizedStringPool* fSynchronizedStringPool; + */ + +/*** + * .non-empty gramamrRegistry + ***/ +void XMLGrammarPoolImpl::serializeGrammars(BinOutputStream* const binOut) +{ + RefHashTableOfEnumerator grammarEnum(fGrammarRegistry, false, getMemoryManager()); + if (!(grammarEnum.hasMoreElements())) + { + ThrowXMLwithMemMgr(XSerializationException, XMLExcepts::XSer_GrammarPool_Empty, getMemoryManager()); + } + + XSerializeEngine serEng(binOut, this); + + //version information + serEng<<(unsigned int)XERCES_GRAMMAR_SERIALIZATION_LEVEL; + + //lock status + serEng<serialize(serEng); + + /*** + * Serialize RefHashTableOf* fGrammarRegistry; + ***/ + XTemplateSerializer::storeObject(fGrammarRegistry, serEng); +} + +/*** + * .empty stringPool + * .empty gramamrRegistry + ***/ +void XMLGrammarPoolImpl::deserializeGrammars(BinInputStream* const binIn) +{ + MemoryManager *memMgr = getMemoryManager(); + unsigned int stringCount = fStringPool->getStringCount(); + if (stringCount) + { + /*** + * it contains only the four predefined one, that is ok + * but we need to reset the string before deserialize it + * + ***/ + if ( stringCount <= 4 ) + { + fStringPool->flushAll(); + } + else + { + ThrowXMLwithMemMgr(XSerializationException, XMLExcepts::XSer_StringPool_NotEmpty, memMgr); + } + } + + RefHashTableOfEnumerator grammarEnum(fGrammarRegistry, false, memMgr); + if (grammarEnum.hasMoreElements()) + { + ThrowXMLwithMemMgr(XSerializationException, XMLExcepts::XSer_GrammarPool_NotEmpty, memMgr); + } + + // This object will take care of cleaning up if an exception is + // thrown during deserialization. + JanitorMemFunCall cleanup(this, &XMLGrammarPoolImpl::cleanUp); + + try + { + XSerializeEngine serEng(binIn, this); + + //version information + unsigned int StorerLevel; + serEng>>StorerLevel; + serEng.fStorerLevel = StorerLevel; + + // The storer level must match the loader level. + // + if (StorerLevel != (unsigned int)XERCES_GRAMMAR_SERIALIZATION_LEVEL) + { + XMLCh StorerLevelChar[5]; + XMLCh LoaderLevelChar[5]; + XMLString::binToText(StorerLevel, StorerLevelChar, 4, 10, memMgr); + XMLString::binToText(XERCES_GRAMMAR_SERIALIZATION_LEVEL, LoaderLevelChar, 4, 10, memMgr); + + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_Storer_Loader_Mismatch + , StorerLevelChar + , LoaderLevelChar + , memMgr); + } + + //lock status + serEng>>fLocked; + + //StringPool, don't use >> + fStringPool->serialize(serEng); + + /*** + * Deserialize RefHashTableOf* fGrammarRegistry; + ***/ + XTemplateSerializer::loadObject(&fGrammarRegistry, 29, true, serEng); + + } + catch(const OutOfMemoryException&) + { + // This is a special case, because we don't want + // to execute cleanup code on out-of-memory + // conditions. + cleanup.release(); + + throw; + } + + // Everything is OK, so we can release the cleanup object. + cleanup.release(); + + if (fLocked) + { + createXSModel(); + } +} + + +void +XMLGrammarPoolImpl::cleanUp() +{ + fLocked = false; + + clear(); +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.hpp b/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.hpp new file mode 100644 index 000000000..7b8b74697 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLGrammarPoolImpl.hpp @@ -0,0 +1,279 @@ +/* + * 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: XMLGrammarPoolImpl.hpp 671531 2008-06-25 12:38:28Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOLIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLGRAMMARPOOLIMPL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLSynchronizedStringPool; + +class XMLUTIL_EXPORT XMLGrammarPoolImpl : public XMLGrammarPool +{ +public : + // ----------------------------------------------------------------------- + /** @name constructor and destructor */ + // ----------------------------------------------------------------------- + //@{ + + XMLGrammarPoolImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + + ~XMLGrammarPoolImpl(); + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of Grammar Pool Interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * cacheGrammar + * + * Provide the grammar pool with an opportunity + * to cache the given grammar. If the pool does not choose to do so, + * it should return false; otherwise, it should return true, so that + * the caller knows whether the grammar has been adopted. + * + * @param gramToCache: the Grammar to be cached in the grammar pool + * @return true if the grammar pool has elected to cache the grammar (in which case + * it is assumed to have adopted it); false if it does not cache it + * + */ + virtual bool cacheGrammar(Grammar* const gramToCache); + + + /** + * retrieveGrammar + * + * @param gramDesc: the Grammar Description used to search for grammar + * cached in the grammar pool + * + */ + virtual Grammar* retrieveGrammar(XMLGrammarDescription* const gramDesc); + + + /** + * orphanGrammar + * + * grammar removed from the grammar pool and owned by the caller + * + * @param nameSpaceKey: Key used to search for grammar in the grammar pool + * + */ + virtual Grammar* orphanGrammar(const XMLCh* const nameSpaceKey); + + + /** + * Get an enumeration of the cached Grammars in the Grammar pool + * + * @return enumeration of the cached Grammars in Grammar pool + */ + virtual RefHashTableOfEnumerator getGrammarEnumerator() const; + + /** + * clear + * + * all grammars are removed from the grammar pool and deleted. + * @return true if the grammar pool was cleared. false if it did not. + */ + virtual bool clear(); + + /** + * lockPool + * + * When this method is called by the application, the + * grammar pool should stop adding new grammars to the cache. + */ + virtual void lockPool(); + + /** + * unlockPool + * + * After this method has been called, the grammar pool implementation + * should return to its default behaviour when cacheGrammars(...) is called. + * + * For PSVI support any previous XSModel that was produced will be deleted. + */ + virtual void unlockPool(); + + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of Factory interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * createDTDGrammar + * + */ + virtual DTDGrammar* createDTDGrammar(); + + /** + * createSchemaGrammar + * + */ + virtual SchemaGrammar* createSchemaGrammar(); + + /** + * createDTDDescription + * + */ + virtual XMLDTDDescription* createDTDDescription(const XMLCh* const systemId); + /** + * createSchemaDescription + * + */ + virtual XMLSchemaDescription* createSchemaDescription(const XMLCh* const targetNamespace); + //@} + + // ----------------------------------------------------------------------- + /** @name schema component model support */ + // ----------------------------------------------------------------------- + //@{ + + /*** + * Return an XSModel derived from the components of all SchemaGrammars + * in the grammar pool. If the pool is locked, this should + * be a thread-safe operation. + * + * NOTE: The function should NEVER return NULL. If there are no grammars in + * the pool it should return an XSModel containing the Schema for Schema. + * + * Calling getXSModel() on an unlocked grammar pool may result in the + * creation of a new XSModel with the old XSModel being deleted. + * The bool parameter will indicate if the XSModel was changed. + * + * In this implementation, when the pool is not locked a new XSModel will be + * computed each this time the pool is called if the pool has changed (and the + * previous one will be destroyed at that time). When the lockPool() + * method is called, an XSModel will be generated and returned whenever this method is called + * while the pool is in the locked state. This will be destroyed if the unlockPool() + * operation is called. The XSModel will not be serialized, + * but will be recreated if a deserialized pool is in the + * locked state. + * + */ + virtual XSModel *getXSModel(bool& XSModelWasChanged); + + // @} + // ----------------------------------------------------------------------- + /** @name Getter */ + // ----------------------------------------------------------------------- + //@{ + + /** + * Return an XMLStringPool for use by validation routines. + * Implementations should not create a string pool on each call to this + * method, but should maintain one string pool for all grammars + * for which this pool is responsible. + */ + virtual XMLStringPool *getURIStringPool(); + + // @} + + // ----------------------------------------------------------------------- + // serialization and deserialization support + // ----------------------------------------------------------------------- + + /*** + * + * Multiple serializations + * + * For multiple serializations, if the same file name is given, then the + * last result will be in the file (overwriting mode), if different file + * names are given, then there are multiple data stores for each serialization. + * + * Multiple deserializations + * + * Not supported + * + * Versioning + * + * Only binary data serialized with the current XercesC Version and + * SerializationLevel is supported. + * + * Clean up + * + * In the event of an exception thrown due to a corrupted data store during + * deserialization, this implementation may not be able to clean up all resources + * allocated, and therefore it is the client application's responsibility to + * clean up those unreleased resources. + * + * Coupling of Grammars and StringPool + * + * This implementation assumes that StringPool shall always be + * serialized/deserialized together with the grammars. In the case that such a + * coupling is not desired, client application can modify this behaviour by + * either derivate from this imlementation and overwrite the serializeGrammars() + * and/or deserializeGrammars() to decouple grammars and string pool, or + * Once deserializeGrammars() is done, insert another StringPool through + * setStringPool(). + * + * Client application shall be aware of the unpredicatable/undefined consequence + * of this decoupling. + */ + + virtual void serializeGrammars(BinOutputStream* const); + virtual void deserializeGrammars(BinInputStream* const); + +private: + + virtual void createXSModel(); + + void + cleanUp(); + + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLGrammarPoolImpl(const XMLGrammarPoolImpl& ); + XMLGrammarPoolImpl& operator=(const XMLGrammarPoolImpl& ); + //@} + + // ----------------------------------------------------------------------- + // + // fGrammarRegistry: + // + // container + // fStringPool + // grammars need a string pool for URI -> int mappings + // fSynchronizedStringPool + // When the grammar pool is locked, provide a string pool + // that can be updated in a thread-safe manner. + // fLocked + // whether the pool has been locked + // + // ----------------------------------------------------------------------- + RefHashTableOf* fGrammarRegistry; + XMLStringPool* fStringPool; + XMLSynchronizedStringPool* fSynchronizedStringPool; + XSModel* fXSModel; + bool fLocked; + bool fXSModelIsValid; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.cpp b/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.cpp new file mode 100644 index 000000000..e6d5d570c --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.cpp @@ -0,0 +1,140 @@ +/* + * 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: XMLNotationDecl.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLNotationDecl: Constructors and operators +// --------------------------------------------------------------------------- +XMLNotationDecl::XMLNotationDecl(MemoryManager* const manager) : + + fId(0) + , fNameSpaceId(0) + , fName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fMemoryManager(manager) +{ +} + +typedef JanitorMemFunCall CleanupType; + +XMLNotationDecl::XMLNotationDecl( const XMLCh* const notName + , const XMLCh* const pubId + , const XMLCh* const sysId + , const XMLCh* const baseURI + , MemoryManager* const manager) : + fId(0) + , fNameSpaceId(0) + , fName(0) + , fPublicId(0) + , fSystemId(0) + , fBaseURI(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLNotationDecl::cleanUp); + + try + { + fName = XMLString::replicate(notName, fMemoryManager); + fPublicId = XMLString::replicate(pubId, fMemoryManager); + fSystemId = XMLString::replicate(sysId, fMemoryManager); + fBaseURI = XMLString::replicate(baseURI, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLNotationDecl::~XMLNotationDecl() +{ + cleanUp(); +} + + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +void XMLNotationDecl::setName(const XMLCh* const notName) +{ + // Clean up the current name stuff and replicate the passed name + if (fName) + fMemoryManager->deallocate(fName); + + fName = XMLString::replicate(notName, fMemoryManager); +} + + + +// --------------------------------------------------------------------------- +// XMLNotationDecl: Private helper methods +// --------------------------------------------------------------------------- +void XMLNotationDecl::cleanUp() +{ + fMemoryManager->deallocate(fName); + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + fMemoryManager->deallocate(fBaseURI); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLNotationDecl) + +void XMLNotationDecl::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + serEng.writeSize (fId); + serEng<>fNameSpaceId; + serEng.readString(fName); + serEng.readString(fPublicId); + serEng.readString(fSystemId); + serEng.readString(fBaseURI); + } +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.hpp b/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.hpp new file mode 100644 index 000000000..61b48016e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLNotationDecl.hpp @@ -0,0 +1,231 @@ +/* + * 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: XMLNotationDecl.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class represents the core information about a notation declaration + * that all validators must at least support. Each validator will create a + * derivative of this class which adds any information it requires for its + * own extra needs. + * + * At this common level, the information supported is the notation name + * and the public and sysetm ids indicated in the notation declaration. + */ +class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors */ + //@{ + XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XMLNotationDecl + ( + const XMLCh* const notName + , const XMLCh* const pubId + , const XMLCh* const sysId + , const XMLCh* const baseURI = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + ~XMLNotationDecl(); + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t getId() const; + const XMLCh* getName() const; + const XMLCh* getPublicId() const; + const XMLCh* getSystemId() const; + const XMLCh* getBaseURI() const; + unsigned int getNameSpaceId() const; + MemoryManager* getMemoryManager() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setId(const XMLSize_t newId); + void setName + ( + const XMLCh* const notName + ); + void setPublicId(const XMLCh* const newId); + void setSystemId(const XMLCh* const newId); + void setBaseURI(const XMLCh* const newId); + void setNameSpaceId(const unsigned int newId); + + // ----------------------------------------------------------------------- + // Support named collection element semantics + // ----------------------------------------------------------------------- + const XMLCh* getKey() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLNotationDecl) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLNotationDecl(const XMLNotationDecl&); + XMLNotationDecl& operator=(const XMLNotationDecl&); + + + // ----------------------------------------------------------------------- + // XMLNotationDecl: Private helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fId + // This is the unique id given to this notation decl. + // + // fName + // The notation's name, which identifies the type of notation it + // applies to. + // + // fPublicId + // The text of the notation's public id, if any. + // + // fSystemId + // The text of the notation's system id, if any. + // + // fBaseURI + // The text of the notation's base URI + // ----------------------------------------------------------------------- + XMLSize_t fId; + unsigned int fNameSpaceId; + XMLCh* fName; + XMLCh* fPublicId; + XMLCh* fSystemId; + XMLCh* fBaseURI; + MemoryManager* fMemoryManager; +}; + + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- +inline XMLSize_t XMLNotationDecl::getId() const +{ + return fId; +} + +inline const XMLCh* XMLNotationDecl::getName() const +{ + return fName; +} + +inline unsigned int XMLNotationDecl::getNameSpaceId() const +{ + return fNameSpaceId; +} + +inline const XMLCh* XMLNotationDecl::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* XMLNotationDecl::getSystemId() const +{ + return fSystemId; +} + +inline const XMLCh* XMLNotationDecl::getBaseURI() const +{ + return fBaseURI; +} + +inline MemoryManager* XMLNotationDecl::getMemoryManager() const +{ + return fMemoryManager; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +inline void XMLNotationDecl::setId(const XMLSize_t newId) +{ + fId = newId; +} + +inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId) +{ + fNameSpaceId = newId; +} + +inline void XMLNotationDecl::setPublicId(const XMLCh* const newId) +{ + if (fPublicId) + fMemoryManager->deallocate(fPublicId); + + fPublicId = XMLString::replicate(newId, fMemoryManager); +} + +inline void XMLNotationDecl::setSystemId(const XMLCh* const newId) +{ + if (fSystemId) + fMemoryManager->deallocate(fSystemId); + + fSystemId = XMLString::replicate(newId, fMemoryManager); +} + +inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId) +{ + if (fBaseURI) + fMemoryManager->deallocate(fBaseURI); + + fBaseURI = XMLString::replicate(newId, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// XMLNotationDecl: Support named pool element semantics +// --------------------------------------------------------------------------- +inline const XMLCh* XMLNotationDecl::getKey() const +{ + return fName; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLPScanToken.hpp b/project/jni/xerces/src/xercesc/framework/XMLPScanToken.hpp new file mode 100644 index 000000000..84adacbe3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLPScanToken.hpp @@ -0,0 +1,151 @@ +/* + * 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: XMLPScanToken.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLScanner; + +/** + * This simple class is used as a sanity check when the scanner is used to + * do progressive parsing. It insures that things are not done out of + * sequence and that sequences of scan calls are made correctly to the + * right scanner instances. + * + * To client code, it is just a magic cookie which is obtained when a + * progressive parse is begun, and which is passed back in on each subsequent + * call of the progressive parse. + */ +class XMLPARSER_EXPORT XMLPScanToken : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructor */ + //@{ + XMLPScanToken(); + XMLPScanToken(const XMLPScanToken& toCopy); + //@} + + /** @name Destructor */ + //@{ + ~XMLPScanToken(); + //@} + + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + XMLPScanToken& operator=(const XMLPScanToken& toCopy); + + +protected : + // ----------------------------------------------------------------------- + // XMLScanner is our friend, can you say friend? Sure... + // ----------------------------------------------------------------------- + friend class XMLScanner; + + + // ----------------------------------------------------------------------- + // Hidden methods for use by XMLScanner + // ----------------------------------------------------------------------- + void set + ( + const XMLUInt32 scannerId + , const XMLUInt32 sequenceId + ); + + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fScannerId + // This field is set to the id of the scanner, to catch problems + // where a token is gotten from one scanner and passed to another. + // Each scanner is assigned an incrementing id. + // + // fSequenceId + // In order to avoid problems such as calling scanNext() without + // a call to scanFirst() and such, this value is set when scanFirst() + // is called and matches this token to the current sequence id of + // the scanner. + // ----------------------------------------------------------------------- + XMLUInt32 fScannerId; + XMLUInt32 fSequenceId; +}; + + +// --------------------------------------------------------------------------- +// XMLPScanToken: Constructors and Operators +// --------------------------------------------------------------------------- +inline XMLPScanToken::XMLPScanToken() : + + fScannerId(0) + , fSequenceId(0) +{ +} + +inline XMLPScanToken::XMLPScanToken(const XMLPScanToken& toCopy) : + XMemory(toCopy) + , fScannerId(toCopy.fScannerId) + , fSequenceId(toCopy.fSequenceId) +{ +} + +inline XMLPScanToken::~XMLPScanToken() +{ +} + + +// --------------------------------------------------------------------------- +// XMLPScanToken: Public operators +// --------------------------------------------------------------------------- +inline XMLPScanToken& XMLPScanToken::operator=(const XMLPScanToken& toCopy) +{ + if (this == &toCopy) + return *this; + + fScannerId = toCopy.fScannerId; + fSequenceId = toCopy.fSequenceId; + + return *this; +} + + +// --------------------------------------------------------------------------- +// XMLPScanToken: Hidden methods +// --------------------------------------------------------------------------- +inline void XMLPScanToken::set( const XMLUInt32 scannerId + , const XMLUInt32 sequenceId) +{ + fScannerId = scannerId; + fSequenceId = sequenceId; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLRecognizer.cpp b/project/jni/xerces/src/xercesc/framework/XMLRecognizer.cpp new file mode 100644 index 000000000..a56948675 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLRecognizer.cpp @@ -0,0 +1,270 @@ +/* + * 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: XMLRecognizer.cpp 555320 2007-07-11 16:05:13Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local data +// +// gEncodingNameMap +// This array maps the Encodings enum values to their canonical names. +// Be sure to keep this in sync with that enum! +// --------------------------------------------------------------------------- +static const XMLCh* gEncodingNameMap[XMLRecognizer::Encodings_Count] = +{ + XMLUni::fgEBCDICEncodingString + , XMLUni::fgUCS4BEncodingString + , XMLUni::fgUCS4LEncodingString + , XMLUni::fgUSASCIIEncodingString + , XMLUni::fgUTF8EncodingString + , XMLUni::fgUTF16BEncodingString + , XMLUni::fgUTF16LEncodingString + , XMLUni::fgXMLChEncodingString +}; + + + +// --------------------------------------------------------------------------- +// XMLRecognizer: Public, const static data +// +// gXXXPre +// gXXXPreLen +// The byte sequence prefixes for all of the encodings that we can +// auto sense. Also included is the length of each sequence. +// --------------------------------------------------------------------------- +const char XMLRecognizer::fgASCIIPre[] = { 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20 }; +const XMLSize_t XMLRecognizer::fgASCIIPreLen = 6; +const XMLByte XMLRecognizer::fgEBCDICPre[] = { 0x4C, 0x6F, 0xA7, 0x94, 0x93, 0x40 }; +const XMLSize_t XMLRecognizer::fgEBCDICPreLen = 6; +const XMLByte XMLRecognizer::fgUTF16BPre[] = { 0x00, 0x3C, 0x00, 0x3F, 0x00, 0x78, 0x00, 0x6D, 0x00, 0x6C, 0x00, 0x20 }; +const XMLByte XMLRecognizer::fgUTF16LPre[] = { 0x3C, 0x00, 0x3F, 0x00, 0x78, 0x00, 0x6D, 0x00, 0x6C, 0x00, 0x20, 0x00 }; +const XMLSize_t XMLRecognizer::fgUTF16PreLen = 12; +const XMLByte XMLRecognizer::fgUCS4BPre[] = +{ + 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3F + , 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x6D + , 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x20 +}; +const XMLByte XMLRecognizer::fgUCS4LPre[] = +{ + 0x3C, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00 + , 0x78, 0x00, 0x00, 0x00, 0x6D, 0x00, 0x00, 0x00 + , 0x6C, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 +}; +const XMLSize_t XMLRecognizer::fgUCS4PreLen = 24; + +const char XMLRecognizer::fgUTF8BOM[] = {(char)0xEF, (char)0xBB, (char)0xBF}; +const XMLSize_t XMLRecognizer::fgUTF8BOMLen = 3; + +// --------------------------------------------------------------------------- +// XMLRecognizer: Encoding recognition methods +// --------------------------------------------------------------------------- +XMLRecognizer::Encodings +XMLRecognizer::basicEncodingProbe( const XMLByte* const rawBuffer + , const XMLSize_t rawByteCount) +{ + // + // As an optimization to check the 90% case, check first for the ASCII + // sequence '= fgASCIIPreLen) + { + if (!memcmp(rawBuffer, fgASCIIPre, fgASCIIPreLen)) + return UTF_8; + } + + // + // If the count of raw bytes is less than 2, it cannot be anything + // we understand, so return UTF-8 as a fallback. + // + if (rawByteCount < 2) + return UTF_8; + + // + // We have two to four bytes, so lets check for a UTF-16 BOM. That + // is quick to check and enough to identify two major encodings. + // + + if (rawByteCount < 4) + { + if ((rawBuffer[0] == 0xFE) && (rawBuffer[1] == 0xFF)) + return UTF_16B; + else if ((rawBuffer[0] == 0xFF) && (rawBuffer[1] == 0xFE)) + return UTF_16L; + else + return UTF_8; + } + + /*** + * F.1 Detection Without External Encoding Information + * + * Because each XML entity not accompanied by external encoding information and + * not in UTF-8 or UTF-16 encoding must begin with an XML encoding declaration, + * in which the first characters must be '= fgUCS4PreLen && !memcmp(rawBuffer, fgUCS4BPre, fgUCS4PreLen)) + return UCS_4B; + else if (rawByteCount >= fgUCS4PreLen && !memcmp(rawBuffer, fgUCS4LPre, fgUCS4PreLen)) + return UCS_4L; + else if (rawByteCount >= fgUTF16PreLen && !memcmp(rawBuffer, fgUTF16BPre, fgUTF16PreLen)) + return UTF_16B; + else if (rawByteCount >= fgUTF16PreLen && !memcmp(rawBuffer, fgUTF16LPre, fgUTF16PreLen)) + return UTF_16L; + } + + // + // See if we have enough bytes to possibly match the EBCDIC prefix. + // If so, try it. + // + if (rawByteCount > fgEBCDICPreLen) + { + if (!memcmp(rawBuffer, fgEBCDICPre, fgEBCDICPreLen)) + return EBCDIC; + } + + // + // Does not seem to be anything we know, so go with UTF-8 to get at + // least through the first line and see what it really is. + // + return UTF_8; +} + + +XMLRecognizer::Encodings +XMLRecognizer::encodingForName(const XMLCh* const encName) +{ + // + // Compare the passed string, assume input string is already uppercased, + // to the variations that we recognize. + // + // !!NOTE: Note that we don't handle EBCDIC here because we don't handle + // that one ourselves. It is allowed to fall into 'other'. + // + if (encName == XMLUni::fgXMLChEncodingString || + !XMLString::compareString(encName, XMLUni::fgXMLChEncodingString)) + { + return XMLRecognizer::XERCES_XMLCH; + } + else if (!XMLString::compareString(encName, XMLUni::fgUTF8EncodingString) + || !XMLString::compareString(encName, XMLUni::fgUTF8EncodingString2)) + { + return XMLRecognizer::UTF_8; + } + else if (!XMLString::compareString(encName, XMLUni::fgUSASCIIEncodingString) + || !XMLString::compareString(encName, XMLUni::fgUSASCIIEncodingString2) + || !XMLString::compareString(encName, XMLUni::fgUSASCIIEncodingString3) + || !XMLString::compareString(encName, XMLUni::fgUSASCIIEncodingString4)) + { + return XMLRecognizer::US_ASCII; + } + else if (!XMLString::compareString(encName, XMLUni::fgUTF16LEncodingString) + || !XMLString::compareString(encName, XMLUni::fgUTF16LEncodingString2)) + { + return XMLRecognizer::UTF_16L; + } + else if (!XMLString::compareString(encName, XMLUni::fgUTF16BEncodingString) + || !XMLString::compareString(encName, XMLUni::fgUTF16BEncodingString2)) + { + return XMLRecognizer::UTF_16B; + } + else if (!XMLString::compareString(encName, XMLUni::fgUTF16EncodingString)) + { + return XMLPlatformUtils::fgXMLChBigEndian?XMLRecognizer::UTF_16B:XMLRecognizer::UTF_16L; + } + else if (!XMLString::compareString(encName, XMLUni::fgUCS4LEncodingString) + || !XMLString::compareString(encName, XMLUni::fgUCS4LEncodingString2)) + { + return XMLRecognizer::UCS_4L; + } + else if (!XMLString::compareString(encName, XMLUni::fgUCS4BEncodingString) + || !XMLString::compareString(encName, XMLUni::fgUCS4BEncodingString2)) + { + return XMLRecognizer::UCS_4B; + } + else if (!XMLString::compareString(encName, XMLUni::fgUCS4EncodingString)) + { + return XMLPlatformUtils::fgXMLChBigEndian?XMLRecognizer::UCS_4B:XMLRecognizer::UCS_4L; + } + + // Return 'other' since we don't recognizer it + return XMLRecognizer::OtherEncoding; +} + + +const XMLCh* +XMLRecognizer::nameForEncoding(const XMLRecognizer::Encodings theEncoding + , MemoryManager* const manager) +{ + if (theEncoding >= Encodings_Count) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::XMLRec_UnknownEncoding, manager); + + return gEncodingNameMap[theEncoding]; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLRecognizer.hpp b/project/jni/xerces/src/xercesc/framework/XMLRecognizer.hpp new file mode 100644 index 000000000..68938e108 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLRecognizer.hpp @@ -0,0 +1,138 @@ +/* + * 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: XMLRecognizer.hpp 555320 2007-07-11 16:05:13Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLRECOGNIZER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLRECOGNIZER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class provides some simple code to recognize the encodings of + * XML files. This recognition only does very basic sensing of the encoding + * in a broad sense. Basically its just enough to let us get started and + * read the XMLDecl line. The scanner, once it reads the XMLDecl, will + * tell the reader any actual encoding string it found and the reader can + * update itself to be more specific at that point. + */ +class XMLPARSER_EXPORT XMLRecognizer +{ +public : + // ----------------------------------------------------------------------- + // Class types + // + // This enum represents the various encoding families that we have to + // deal with individually at the scanner level. This does not indicate + // the exact encoding, just the rough family that would let us scan + // the XML/TextDecl to find the encoding string. + // + // The 'L's and 'B's stand for little or big endian. + // + // OtherEncoding means that its some transcoder based encoding, i.e. not + // one of the ones that we do internally. Its a special case and should + // never be used directly outside of the reader. + // + // NOTE: Keep this in sync with the name map array in the Cpp file!! + // ----------------------------------------------------------------------- + enum Encodings + { + EBCDIC = 0 + , UCS_4B = 1 + , UCS_4L = 2 + , US_ASCII = 3 + , UTF_8 = 4 + , UTF_16B = 5 + , UTF_16L = 6 + , XERCES_XMLCH = 7 + + , Encodings_Count + , Encodings_Min = EBCDIC + , Encodings_Max = XERCES_XMLCH + + , OtherEncoding = 999 + }; + + + // ----------------------------------------------------------------------- + // Public, const static data + // + // These are the byte sequences for each of the encodings that we can + // auto sense, and their lengths. + // ----------------------------------------------------------------------- + static const char fgASCIIPre[]; + static const XMLSize_t fgASCIIPreLen; + static const XMLByte fgEBCDICPre[]; + static const XMLSize_t fgEBCDICPreLen; + static const XMLByte fgUTF16BPre[]; + static const XMLByte fgUTF16LPre[]; + static const XMLSize_t fgUTF16PreLen; + static const XMLByte fgUCS4BPre[]; + static const XMLByte fgUCS4LPre[]; + static const XMLSize_t fgUCS4PreLen; + static const char fgUTF8BOM[]; + static const XMLSize_t fgUTF8BOMLen; + + + // ----------------------------------------------------------------------- + // Encoding recognition methods + // ----------------------------------------------------------------------- + static Encodings basicEncodingProbe + ( + const XMLByte* const rawBuffer + , const XMLSize_t rawByteCount + ); + + static Encodings encodingForName + ( + const XMLCh* const theEncName + ); + + static const XMLCh* nameForEncoding(const Encodings theEncoding + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + +protected : + // ----------------------------------------------------------------------- + // Unimplemented constructors, operators, and destructor + // + // This class is effectively being used as a namespace for some static + // methods. + // + // (these functions are protected rather than private only to get rid of + // some annoying compiler warnings.) + // + // ----------------------------------------------------------------------- + XMLRecognizer(); + ~XMLRecognizer(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLRecognizer(const XMLRecognizer&); + XMLRecognizer& operator=(const XMLRecognizer&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLRefInfo.cpp b/project/jni/xerces/src/xercesc/framework/XMLRefInfo.cpp new file mode 100644 index 000000000..36094c082 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLRefInfo.cpp @@ -0,0 +1,60 @@ +/* + * 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: XMLRefInfo.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLRefInfo) + +void XMLRefInfo::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + serEng<>fDeclared; + serEng>>fUsed; + serEng.readString(fRefName); + } + +} + +XMLRefInfo::XMLRefInfo(MemoryManager* const manager) +:fDeclared(false) +,fUsed(false) +,fRefName(0) +,fMemoryManager(manager) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLRefInfo.hpp b/project/jni/xerces/src/xercesc/framework/XMLRefInfo.hpp new file mode 100644 index 000000000..e2559e51a --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLRefInfo.hpp @@ -0,0 +1,181 @@ +/* + * 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: XMLRefInfo.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLREFINFO_HPP) +#define XERCESC_INCLUDE_GUARD_XMLREFINFO_HPP + +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class provides a simple means to track ID Ref usage. Since id/idref + * semantics are part of XML 1.0, any validator will likely to be able to + * track them. Instances of this class represent a reference and two markers, + * one for its being declared and another for its being used. When the + * document is done, one can look at each instance and, if used but not + * declared, its an error. + * + * The getKey() method allows it to support keyed collection semantics. It + * returns the referenced name, so these objects will be stored via the hash + * of the name. This name will either be a standard QName if namespaces are + * not enabled/supported by the validator, or it will be in the form + * {url}name if namespace processing is enabled. + */ +class XMLPARSER_EXPORT XMLRefInfo : public XSerializable, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructor */ + //@{ + XMLRefInfo + ( + const XMLCh* const refName + , const bool fDeclared = false + , const bool fUsed = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + ~XMLRefInfo(); + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getDeclared() const; + const XMLCh* getRefName() const; + bool getUsed() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setDeclared(const bool newValue); + void setUsed(const bool newValue); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLRefInfo) + + XMLRefInfo + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLRefInfo(const XMLRefInfo&); + XMLRefInfo& operator=(XMLRefInfo&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fDeclared + // The name was declared somewhere as an ID attribute. + // + // fRefName + // The name of the ref that this object represents. This is not a + // name of the attribute, but of the value of an ID or IDREF attr + // in content. + // + // fUsed + // The name was used somewhere in an IDREF/IDREFS attribute. If this + // is true, but fDeclared is false, then the ref does not refer to + // a declared ID. + // ----------------------------------------------------------------------- + bool fDeclared; + bool fUsed; + XMLCh* fRefName; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// XMLRefInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +inline XMLRefInfo::XMLRefInfo( const XMLCh* const refName + , const bool declared + , const bool used + , MemoryManager* const manager) : + fDeclared(declared) + , fUsed(used) + , fRefName(0) + , fMemoryManager(manager) +{ + fRefName = XMLString::replicate(refName, fMemoryManager); +} + +inline XMLRefInfo::~XMLRefInfo() +{ + fMemoryManager->deallocate(fRefName); +} + + +// --------------------------------------------------------------------------- +// XMLRefInfo: Getter methods +// --------------------------------------------------------------------------- +inline bool XMLRefInfo::getDeclared() const +{ + return fDeclared; +} + +inline const XMLCh* XMLRefInfo::getRefName() const +{ + return fRefName; +} + +inline bool XMLRefInfo::getUsed() const +{ + return fUsed; +} + + +// --------------------------------------------------------------------------- +// XMLRefInfo: Setter methods +// --------------------------------------------------------------------------- +inline void XMLRefInfo::setDeclared(const bool newValue) +{ + fDeclared = newValue; +} + +inline void XMLRefInfo::setUsed(const bool newValue) +{ + fUsed = newValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.cpp b/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.cpp new file mode 100644 index 000000000..9a73a8fbc --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.cpp @@ -0,0 +1,53 @@ +/* + * 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: XMLSchemaDescription.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLSchemaDescription::~XMLSchemaDescription() +{ +} + +XMLSchemaDescription::XMLSchemaDescription(MemoryManager* const memMgr) +:XMLGrammarDescription(memMgr) +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLSchemaDescription) + +void XMLSchemaDescription::serialize(XSerializeEngine& serEng) +{ + XMLGrammarDescription::serialize(serEng); + + //no data +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.hpp b/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.hpp new file mode 100644 index 000000000..bff9f54e8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLSchemaDescription.hpp @@ -0,0 +1,178 @@ +/* + * 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: XMLSchemaDescription.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef const XMLCh* const LocationHint; + +class XMLPARSER_EXPORT XMLSchemaDescription : public XMLGrammarDescription +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + /** + * virtual destructor + * + */ + virtual ~XMLSchemaDescription(); + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of Grammar Description Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * getGrammarType + * + */ + virtual Grammar::GrammarType getGrammarType() const + { + return Grammar::SchemaGrammarType; + } + //@} + + // ----------------------------------------------------------------------- + /** @name The SchemaDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + + enum ContextType + { + CONTEXT_INCLUDE, + CONTEXT_REDEFINE, + CONTEXT_IMPORT, + CONTEXT_PREPARSE, + CONTEXT_INSTANCE, + CONTEXT_ELEMENT, + CONTEXT_ATTRIBUTE, + CONTEXT_XSITYPE, + CONTEXT_UNKNOWN + }; + + /** + * getContextType + * + */ + virtual ContextType getContextType() const = 0; + + /** + * getTargetNamespace + * + */ + virtual const XMLCh* getTargetNamespace() const = 0; + + /** + * getLocationHints + * + */ + virtual const RefArrayVectorOf* getLocationHints() const = 0; + + /** + * getTriggeringComponent + * + */ + virtual const QName* getTriggeringComponent() const = 0; + + /** + * getenclosingElementName + * + */ + virtual const QName* getEnclosingElementName() const = 0; + + /** + * getAttributes + * + */ + virtual const XMLAttDef* getAttributes() const = 0; + + /** + * setContextType + * + */ + virtual void setContextType(ContextType) = 0; + + /** + * setTargetNamespace + * + */ + virtual void setTargetNamespace(const XMLCh* const) = 0; + + /** + * setLocationHints + * + */ + virtual void setLocationHints(const XMLCh* const) = 0; + + /** + * setTriggeringComponent + * + */ + virtual void setTriggeringComponent(QName* const) = 0; + + /** + * getenclosingElementName + * + */ + virtual void setEnclosingElementName(QName* const) = 0; + + /** + * setAttributes + * + */ + virtual void setAttributes(XMLAttDef* const) = 0; + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLSchemaDescription) + +protected : + // ----------------------------------------------------------------------- + /** Hidden Constructors */ + // ----------------------------------------------------------------------- + //@{ + XMLSchemaDescription(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + //@} + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLSchemaDescription(const XMLSchemaDescription& ); + XMLSchemaDescription& operator=(const XMLSchemaDescription& ); + //@} + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLValidator.cpp b/project/jni/xerces/src/xercesc/framework/XMLValidator.cpp new file mode 100644 index 000000000..dd032d8b7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLValidator.cpp @@ -0,0 +1,296 @@ +/* + * 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: XMLValidator.cpp 635560 2008-03-10 14:10:09Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static XMLMsgLoader* sMsgLoader = 0; + +void XMLInitializer::initializeXMLValidator() +{ + sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgValidityDomain); + + if (!sMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); +} + +void XMLInitializer::terminateXMLValidator() +{ + delete sMsgLoader; + sMsgLoader = 0; +} + +// --------------------------------------------------------------------------- +// XMLValidator: Error emitting methods +// --------------------------------------------------------------------------- + +// +// These methods are called whenever the scanner wants to emit an error. +// It handles getting the message loaded, doing token replacement, etc... +// and then calling the error handler, if its installed. +// +void XMLValidator::emitError(const XMLValid::Codes toEmit) +{ + // Bump the error count if it is not a warning + if (XMLValid::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + fScanner->incrementErrorCount(); + + // Call error reporter if we have one + if (fErrorReporter) + { + // Load the message into a local for display + const XMLSize_t msgSize = 1023; + XMLCh errText[msgSize + 1]; + + // load the text + if (!sMsgLoader->loadMsg(toEmit, errText, msgSize)) + { + // Probably should load a default msg here + } + + // + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + // + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgValidityDomain + , XMLValid::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal()) + || XMLValid::isFatal(toEmit)) + && fScanner->getExitOnFirstFatal() + && !fScanner->getInException()) + { + throw toEmit; + } +} + +void XMLValidator::emitError(const XMLValid::Codes toEmit + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4) +{ + // Bump the error count if it is not a warning + if (XMLValid::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + fScanner->incrementErrorCount(); + + // Call error reporter if we have one + if (fErrorReporter) + { + // + // Load the message into alocal and replace any tokens found in + // the text. + // + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + // load the text + if (!sMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fScanner->getMemoryManager())) + { + // Should probably load a default message here + } + + // + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + // + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgValidityDomain + , XMLValid::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal()) + || XMLValid::isFatal(toEmit)) + && fScanner->getExitOnFirstFatal() + && !fScanner->getInException()) + { + throw toEmit; + } +} + +void XMLValidator::emitError(const XMLValid::Codes toEmit + , const char* const text1 + , const char* const text2 + , const char* const text3 + , const char* const text4) +{ + // Bump the error count if it is not a warning + if (XMLValid::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + fScanner->incrementErrorCount(); + + // Call error reporter if we have one + if (fErrorReporter) + { + // + // Load the message into alocal and replace any tokens found in + // the text. + // + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + // load the text + if (!sMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fScanner->getMemoryManager())) + { + // Should probably load a default message here + } + + // + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + // + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgValidityDomain + , XMLValid::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal()) + || XMLValid::isFatal(toEmit)) + && fScanner->getExitOnFirstFatal() + && !fScanner->getInException()) + { + throw toEmit; + } +} + +void XMLValidator::emitError(const XMLValid::Codes toEmit + , const XMLExcepts::Codes originalExceptCode + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4) +{ + // Bump the error count if it is not a warning + if (XMLValid::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + fScanner->incrementErrorCount(); + + // Call error reporter if we have one + if (fErrorReporter) + { + // + // Load the message into alocal and replace any tokens found in + // the text. + // + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + // load the text + if (!sMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fScanner->getMemoryManager())) + { + // Should probably load a default message here + } + + // + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + // + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + originalExceptCode + , XMLUni::fgExceptDomain //XMLUni::fgValidityDomain + , XMLValid::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal()) + || XMLValid::isFatal(toEmit)) + && fScanner->getExitOnFirstFatal() + && !fScanner->getInException()) + { + throw toEmit; + } +} + +// --------------------------------------------------------------------------- +// XMLValidator: Hidden Constructors +// --------------------------------------------------------------------------- +XMLValidator::XMLValidator(XMLErrorReporter* const errReporter) : + + fBufMgr(0) + , fErrorReporter(errReporter) + , fReaderMgr(0) + , fScanner(0) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/XMLValidator.hpp b/project/jni/xerces/src/xercesc/framework/XMLValidator.hpp new file mode 100644 index 000000000..440d7b1e8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLValidator.hpp @@ -0,0 +1,426 @@ +/* + * 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: XMLValidator.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ReaderMgr; +class XMLBufferMgr; +class XMLElementDecl; +class XMLScanner; +class Grammar; + + +/** + * This abstract class provides the interface for all validators. This is + * the simple amount of API that all validators must honor, in order for + * the scanner to use them to do validation. All validators will actually + * contain much more functionality than is accessible via this common API, + * but that functionality requires that you know what type of validator you + * are dealing with. + * + * Basically, at this level, the primary concern is to be able to query + * core information about elements and attributes. Adding decls to the + * validator requires that you go through the derived interface because they + * all have their own decl types. At this level, we can return information + * via the base decl classes, from which each validator derives its own + * decl classes. + */ +class XMLPARSER_EXPORT XMLValidator : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, just the virtual destructor is exposed + // ----------------------------------------------------------------------- + + /** @name Destructor */ + //@{ + + /** + * The derived class should clean up its allocated data, then this class + * will do the same for data allocated at this level. + */ + virtual ~XMLValidator() + { + } + //@} + + + // ----------------------------------------------------------------------- + // The virtual validator interface + // ----------------------------------------------------------------------- + + /** @name Virtual validator interface */ + //@{ + + /** + * The derived class should look up its declaration of the passed element + * from its element pool. It should then use the content model description + * contained in that element declaration to validate that the passed list + * of child elements are valid for that content model. The count can be + * zero, indicating no child elements. + * + * Note that whitespace and text content are not validated here. Those are + * handled by the scanner. So only element ids are provided here. + * + * @param elemDecl The element whose content is to be checked. + * + * @param children An array of element QName which represent the elements + * found within the parent element, i.e. the content + * to be validated. + * + * @param childCount The number of elements in the childIds array. It can + * be zero if the element had none. + * + * @param indexFailingChild On return, it will contain the index of the + * children failing validation, if the retun value + * is false + * + */ + virtual bool checkContent + ( + XMLElementDecl* const elemDecl + , QName** const children + , XMLSize_t childCount + , XMLSize_t* indexFailingChild + ) = 0; + + /** + * The derived class should fault in the passed XMLAttr value. It should + * use the passeed attribute definition (which is passed via the base + * type so it must often be downcast to the appropriate type for the + * derived validator class), to fill in the passed attribute. This is done + * as a performance enhancement since the derived class has more direct + * access to the information. + */ + virtual void faultInAttr + ( + XMLAttr& toFill + , const XMLAttDef& attDef + ) const = 0; + + /** + * This method is called by the scanner after a Grammar is scanned. + */ + virtual void preContentValidation(bool reuseGrammar, + bool validateDefAttr = false) = 0; + + /** + * This method is called by the scanner after the parse has completed. It + * gives the validator a chance to check certain things that can only be + * checked after the whole document has been parsed, such as referential + * integrity of ID/IDREF pairs and so forth. The validator should just + * issue errors for any problems it finds. + */ + virtual void postParseValidation() = 0; + + /** + * This method is called by the scanner before a new document is about + * to start. It gives the validator a change to reset itself in preparation + * for another validation pass. + */ + virtual void reset() = 0; + + /** + * The derived class should return a boolean that indicates whether it + * requires namespace processing or not. Some do and some allow it to be + * optional. This flag is used to control whether the client code's + * requests to disable namespace processing can be honored or not. + */ + virtual bool requiresNamespaces() const = 0; + + /** + * The derived class should apply any rules to the passed attribute value + * that are above and beyond those defined by XML 1.0. The scanner itself + * will impose XML 1.0 rules, based on the type of the attribute. This + * will generally be used to check things such as range checks and other + * datatype related validation. + * + * If the value breaks any rules as defined by the derived class, it + * should just issue errors as usual. + */ + virtual void validateAttrValue + ( + const XMLAttDef* attDef + , const XMLCh* const attrValue + , bool preValidation = false + , const XMLElementDecl* elemDecl = 0 + ) = 0; + + /** + * The derived class should apply any rules to the passed element decl + * that are above and beyond those defined by XML 1.0. + * + * If the value breaks any rules as defined by the derived class, it + * should just issue errors as usual. + */ + virtual void validateElement + ( + const XMLElementDecl* elemDef + ) = 0; + + /** + * Retrieve the Grammar used + */ + virtual Grammar* getGrammar() const =0; + + /** + * Set the Grammar + */ + virtual void setGrammar(Grammar* aGrammar) =0; + + + //@} + + // ----------------------------------------------------------------------- + // Virtual DTD handler interface. + // ----------------------------------------------------------------------- + + /** @name Virtual DTD handler interface */ + //@{ + + /** + * This method allows the scanner to ask the validator if it handles + * DTDs or not. + */ + virtual bool handlesDTD() const = 0; + + // ----------------------------------------------------------------------- + // Virtual Schema handler interface. + // ----------------------------------------------------------------------- + + /** @name Virtual Schema handler interface */ + + /** + * This method allows the scanner to ask the validator if it handles + * Schema or not. + */ + virtual bool handlesSchema() const = 0; + + //@} + + // ----------------------------------------------------------------------- + // Setter methods + // + // setScannerInfo() is called by the scanner to tell the validator + // about the stuff it needs to have access to. + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** + * @param owningScanner This is a pointer to the scanner to which the + * validator belongs. The validator will often + * need to query state data from the scanner. + * + * @param readerMgr This is a pointer to the reader manager that is + * being used by the scanner. + * + * @param bufMgr This is the buffer manager of the scanner. This + * is provided as a convenience so that the validator + * doesn't have to create its own buffer manager + * during the parse process. + */ + void setScannerInfo + ( + XMLScanner* const owningScanner + , ReaderMgr* const readerMgr + , XMLBufferMgr* const bufMgr + ); + + /** + * This method is called to set an error reporter on the validator via + * which it will report any errors it sees during parsing or validation. + * This is generally called by the owning scanner. + * + * @param errorReporter A pointer to the error reporter to use. This + * is not adopted, just referenced so the caller + * remains responsible for its cleanup, if any. + */ + void setErrorReporter + ( + XMLErrorReporter* const errorReporter + ); + + //@} + + + // ----------------------------------------------------------------------- + // Error emitter methods + // ----------------------------------------------------------------------- + + /** @name Error emittor methods */ + //@{ + + /** + * This call is a convenience by which validators can emit errors. Most + * of the grunt work of loading the text, getting the current source + * location, ect... is handled here. + * + * If the loaded text has replacement parameters, then text strings can be + * passed. These will be used to replace the tokens {0}, {1}, {2}, and {3} + * in the order passed. So text1 will replace {0}, text2 will replace {1}, + * and so forth. + * + * textX Up to four replacement parameters. They can be provided + * as either XMLCh strings, or local code page strings which + * will be transcoded internally. + * + * @param toEmit The error code to emit. it must be one of the defined + * validator error codes. + * + */ + void emitError(const XMLValid::Codes toEmit); + void emitError + ( + const XMLValid::Codes toEmit + , const XMLCh* const text1 + , const XMLCh* const text2 = 0 + , const XMLCh* const text3 = 0 + , const XMLCh* const text4 = 0 + ); + void emitError + ( + const XMLValid::Codes toEmit + , const char* const text1 + , const char* const text2 = 0 + , const char* const text3 = 0 + , const char* const text4 = 0 + ); + void emitError + ( + const XMLValid::Codes toEmit + , const XMLExcepts::Codes originalErrorCode + , const XMLCh* const text1 = 0 + , const XMLCh* const text2 = 0 + , const XMLCh* const text3 = 0 + , const XMLCh* const text4 = 0 + + ); + + //@} + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLValidator + ( + XMLErrorReporter* const errReporter = 0 + ); + + + // ----------------------------------------------------------------------- + // Protected getters + // ----------------------------------------------------------------------- + const XMLBufferMgr* getBufMgr() const; + XMLBufferMgr* getBufMgr(); + const ReaderMgr* getReaderMgr() const; + ReaderMgr* getReaderMgr(); + const XMLScanner* getScanner() const; + XMLScanner* getScanner(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented Constructors and Operators + // ----------------------------------------------------------------------- + XMLValidator(const XMLValidator&); + XMLValidator& operator=(const XMLValidator&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fErrorReporter + // The error reporter we are to use, if any. + // + // ----------------------------------------------------------------------- + XMLBufferMgr* fBufMgr; + XMLErrorReporter* fErrorReporter; + ReaderMgr* fReaderMgr; + XMLScanner* fScanner; +}; + + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +inline void +XMLValidator::setScannerInfo(XMLScanner* const owningScanner + , ReaderMgr* const readerMgr + , XMLBufferMgr* const bufMgr) +{ + // We don't own any of these, we just reference them + fScanner = owningScanner; + fReaderMgr = readerMgr; + fBufMgr = bufMgr; +} + +inline void +XMLValidator::setErrorReporter(XMLErrorReporter* const errorReporter) +{ + fErrorReporter = errorReporter; +} + + +// --------------------------------------------------------------------------- +// XMLValidator: Protected getter +// --------------------------------------------------------------------------- +inline const XMLBufferMgr* XMLValidator::getBufMgr() const +{ + return fBufMgr; +} + +inline XMLBufferMgr* XMLValidator::getBufMgr() +{ + return fBufMgr; +} + +inline const ReaderMgr* XMLValidator::getReaderMgr() const +{ + return fReaderMgr; +} + +inline ReaderMgr* XMLValidator::getReaderMgr() +{ + return fReaderMgr; +} + +inline const XMLScanner* XMLValidator::getScanner() const +{ + return fScanner; +} + +inline XMLScanner* XMLValidator::getScanner() +{ + return fScanner; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/XMLValidityCodes.hpp b/project/jni/xerces/src/xercesc/framework/XMLValidityCodes.hpp new file mode 100644 index 000000000..aed00fbee --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/XMLValidityCodes.hpp @@ -0,0 +1,147 @@ +// This file is generated, don't edit it!! + +#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid) +#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLValid +{ +public : + enum Codes + { + NoError = 0 + , E_LowBounds = 1 + , ElementNotDefined = 2 + , AttNotDefined = 3 + , NotationNotDeclared = 4 + , RootElemNotLikeDocType = 5 + , RequiredAttrNotProvided = 6 + , ElementNotValidForContent = 7 + , BadIDAttrDefType = 8 + , InvalidEmptyAttValue = 9 + , ElementAlreadyExists = 10 + , MultipleIdAttrs = 11 + , ReusedIDValue = 12 + , IDNotDeclared = 13 + , UnknownNotRefAttr = 14 + , UndeclaredElemInDocType = 15 + , EmptyNotValidForContent = 16 + , AttNotDefinedForElement = 17 + , BadEntityRefAttr = 18 + , UnknownEntityRefAttr = 19 + , ColonNotValidWithNS = 20 + , NotEnoughElemsForCM = 21 + , NoCharDataInCM = 22 + , DoesNotMatchEnumList = 23 + , AttrValNotName = 24 + , NoMultipleValues = 25 + , NotSameAsFixedValue = 26 + , RepElemInMixed = 27 + , FeatureUnsupported = 28 + , GroupContentRestricted = 29 + , UnknownBaseDatatype = 30 + , NoContentForRef = 31 + , DatatypeError = 32 + , ProhibitedAttributePresent = 33 + , IllegalXMLSpace = 34 + , WrongTargetNamespace = 35 + , SimpleTypeHasChild = 36 + , NoDatatypeValidatorForSimpleType = 37 + , GrammarNotFound = 38 + , DisplayErrorMessage = 39 + , NillNotAllowed = 40 + , NilAttrNotEmpty = 41 + , FixedDifferentFromActual = 42 + , NoDatatypeValidatorForAttribute = 43 + , GenericError = 44 + , ElementNotQualified = 45 + , ElementNotUnQualified = 46 + , VC_IllegalRefInStandalone = 47 + , NoDefAttForStandalone = 48 + , NoAttNormForStandalone = 49 + , NoWSForStandalone = 50 + , VC_EntityNotFound = 51 + , PartialMarkupInPE = 52 + , DatatypeValidationFailure = 53 + , UniqueParticleAttributionFail = 54 + , NoAbstractInXsiType = 55 + , NoDirectUseAbstractElement = 56 + , NoUseAbstractType = 57 + , BadXsiType = 58 + , NonDerivedXsiType = 59 + , ElemNoSubforBlock = 60 + , TypeNoSubforBlock = 61 + , AttributeNotQualified = 62 + , AttributeNotUnQualified = 63 + , IC_FieldMultipleMatch = 64 + , IC_UnknownField = 65 + , IC_AbsentKeyValue = 66 + , IC_KeyNotEnoughValues = 67 + , IC_KeyMatchesNillable = 68 + , IC_DuplicateUnique = 69 + , IC_DuplicateKey = 70 + , IC_KeyRefOutOfScope = 71 + , IC_KeyNotFound = 72 + , NonWSContent = 73 + , EmptyElemNotationAttr = 74 + , EmptyElemHasContent = 75 + , ElemOneNotationAttr = 76 + , AttrDupToken = 77 + , ElemChildrenHasInvalidWS = 78 + , E_HighBounds = 79 + , W_LowBounds = 80 + , W_HighBounds = 81 + , F_LowBounds = 82 + , F_HighBounds = 83 + }; + + static bool isFatal(const XMLValid::Codes toCheck) + { + return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)); + } + + static bool isWarning(const XMLValid::Codes toCheck) + { + return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)); + } + + static bool isError(const XMLValid::Codes toCheck) + { + return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)); + } + + static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return XMLErrorReporter::ErrType_Warning; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return XMLErrorReporter::ErrType_Fatal; + else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)) + return XMLErrorReporter::ErrType_Error; + return XMLErrorReporter::ErrTypes_Unknown; + } + static DOMError::ErrorSeverity DOMErrorType(const XMLValid::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return DOMError::DOM_SEVERITY_WARNING; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return DOMError::DOM_SEVERITY_FATAL_ERROR; + else return DOMError::DOM_SEVERITY_ERROR; + } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLValid(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.cpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.cpp new file mode 100644 index 000000000..fefb4049f --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.cpp @@ -0,0 +1,71 @@ +/* + * 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: PSVIAttribute.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +PSVIAttribute::PSVIAttribute( MemoryManager* const manager ): + PSVIItem(manager) + , fAttributeDecl(0) + , fDV(0) +{ +} + +void PSVIAttribute::reset( + const XMLCh * const valContext + , PSVIItem::VALIDITY_STATE state + , PSVIItem::ASSESSMENT_TYPE assessmentType + , XSSimpleTypeDefinition * validatingType + , XSSimpleTypeDefinition * memberType + , const XMLCh * const defaultValue + , const bool isSpecified + , XSAttributeDeclaration * attrDecl + , DatatypeValidator *dv + ) +{ + fValidationContext = valContext; + fValidityState = state; + fAssessmentType = assessmentType; + fType = validatingType; + fMemberType = memberType; + fDefaultValue = defaultValue; + fIsSpecified = isSpecified; + fMemoryManager->deallocate((void *)fCanonicalValue); + fCanonicalValue = 0; + fNormalizedValue = 0; + fAttributeDecl = attrDecl; + fDV = dv; +} + +void PSVIAttribute::setValue(const XMLCh * const normalizedValue) +{ + if(normalizedValue) + { + fNormalizedValue = normalizedValue; + if(fDV && fValidityState == PSVIItem::VALIDITY_VALID) + fCanonicalValue = (XMLCh *)fDV->getCanonicalRepresentation(normalizedValue, fMemoryManager); + } +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.hpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.hpp new file mode 100644 index 000000000..e11b014f7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttribute.hpp @@ -0,0 +1,179 @@ +/* + * 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: PSVIAttribute.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Represent the PSVI contributions for one attribute information item. + * This is *always* owned by the scanner/parser object from which + * it is obtained. The validator will specify + * under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class XSAttributeDeclaration; + +class XMLPARSER_EXPORT PSVIAttribute : public PSVIItem +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param manager The configurable memory manager + */ + PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@}; + + /** @name Destructor */ + //@{ + ~PSVIAttribute(); + //@} + + //--------------------- + /** @name PSVIAttribute methods */ + + //@{ + + /** + * An item isomorphic to the attribute declaration used to validate + * this attribute. + * + * @return an attribute declaration + */ + XSAttributeDeclaration *getAttributeDeclaration(); + + /** + * An item isomorphic to the type definition used to validate this element. + * + * @return a type declaration + */ + XSTypeDefinition *getTypeDefinition(); + + /** + * If and only if that type definition is a simple type definition + * with {variety} union, or a complex type definition whose {content type} + * is a simple thype definition with {variety} union, then an item isomorphic + * to that member of the union's {member type definitions} which actually + * validated the element item's normalized value. + * + * @return a simple type declaration + */ + XSSimpleTypeDefinition *getMemberTypeDefinition(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + /** + * reset this object. Intended to be called by + * the implementation. + */ + void reset( + const XMLCh * const valContext + , PSVIItem::VALIDITY_STATE state + , PSVIItem::ASSESSMENT_TYPE assessmentType + , XSSimpleTypeDefinition * validatingType + , XSSimpleTypeDefinition * memberType + , const XMLCh * const defaultValue + , const bool isSpecified + , XSAttributeDeclaration * attrDecl + , DatatypeValidator * dv + ); + + /** + * set the schema normalized value (and + * implicitly the canonical value) of this object; intended to be used + * by the implementation. + */ + void setValue(const XMLCh * const normalizedValue); + + /** + * set VALIDITY_STATE to specified value; intended to be + * called by implementation. + */ + void updateValidity(VALIDITY_STATE newValue); + + //@} + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + PSVIAttribute(const PSVIAttribute&); + PSVIAttribute & operator=(const PSVIAttribute &); + + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fAttributeDecl + // attribute declaration component that validated this attribute + // fDV + // implementation-specific datatype validator used to validate this attribute + XSAttributeDeclaration * fAttributeDecl; + DatatypeValidator * fDV; +}; +inline PSVIAttribute::~PSVIAttribute() +{ + fMemoryManager->deallocate((void *)fCanonicalValue); +} + +inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration() +{ + return fAttributeDecl; +} + +inline XSTypeDefinition* PSVIAttribute::getTypeDefinition() +{ + return fType; +} + +inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition() +{ + return fMemberType; +} + +inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue) +{ + fValidityState = newValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.cpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.cpp new file mode 100644 index 000000000..26f2ffaae --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.cpp @@ -0,0 +1,110 @@ +/* + * 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: PSVIAttributeList.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +PSVIAttributeList::PSVIAttributeList( MemoryManager* const manager ): + fMemoryManager(manager) + , fAttrList(0) + , fAttrPos(0) +{ + fAttrList= new (fMemoryManager) RefVectorOf (10, true, fMemoryManager); +} + +/* + * Get the number of attributes whose PSVI contributions + * are contained in this list. + */ +XMLSize_t PSVIAttributeList::getLength() const +{ + return fAttrPos; +} + +/* + * Get the PSVI contribution of attribute at position i + * in this list. Indeces start from 0. + * @param index index from which the attribute PSVI contribution + * is to come. + * @return PSVIAttribute containing the attributes PSVI contributions; + * null is returned if the index is out of range. + */ +PSVIAttribute *PSVIAttributeList::getAttributePSVIAtIndex(const XMLSize_t index) +{ + if(index >= fAttrPos) + return 0; + return fAttrList->elementAt(index)->fPSVIAttribute; +} + +/* + * Get local part of attribute name at position index in the list. + * Indeces start from 0. + * @param index index from which the attribute name + * is to come. + * @return local part of the attribute's name; null is returned if the index + * is out of range. + */ +const XMLCh *PSVIAttributeList::getAttributeNameAtIndex(const XMLSize_t index) +{ + + if(index >= fAttrPos) + return 0; + return fAttrList->elementAt(index)->fAttributeName; +} + +/* + * Get namespace of attribute at position index in the list. + * Indeces start from 0. + * @param index index from which the attribute namespace + * is to come. + * @return namespace of the attribute; + * null is returned if the index is out of range. + */ +const XMLCh *PSVIAttributeList::getAttributeNamespaceAtIndex(const XMLSize_t index) +{ + if(index >= fAttrPos) + return 0; + return fAttrList->elementAt(index)->fAttributeNamespace; +} + +/* + * Get the PSVI contribution of attribute with given + * local name and namespace. + * @param attrName local part of the attribute's name + * @param attrNamespace namespace of the attribute + * @return null if the attribute PSVI does not exist + */ +PSVIAttribute *PSVIAttributeList::getAttributePSVIByName(const XMLCh *attrName + , const XMLCh * attrNamespace) +{ + for (XMLSize_t index=0; index < fAttrPos; index++) { + PSVIAttributeStorage* storage = fAttrList->elementAt(index); + if (XMLString::equals(attrName,storage->fAttributeName) && + XMLString::equals(attrNamespace,storage->fAttributeNamespace)) + return storage->fPSVIAttribute; + } + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.hpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.hpp new file mode 100644 index 000000000..f5b892ce7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIAttributeList.hpp @@ -0,0 +1,215 @@ +/* + * 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: PSVIAttributeList.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * A container for the PSVI contributions to attributes that occur + * on a particular element. + * This is always owned by the parser/validator from + * which it is obtained. The parser/validator will specify + * under what conditions it may be relied upon to have meaningful contents. + */ + +class XMLPARSER_EXPORT PSVIAttributeStorage : public XMemory +{ +public: + PSVIAttributeStorage() : + fPSVIAttribute(0) + , fAttributeName(0) + , fAttributeNamespace(0) + { + } + + ~PSVIAttributeStorage() + { + delete fPSVIAttribute; + } + + PSVIAttribute* fPSVIAttribute; + const XMLCh* fAttributeName; + const XMLCh* fAttributeNamespace; +}; + +class XMLPARSER_EXPORT PSVIAttributeList : public XMemory +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param manager The configurable memory manager + */ + PSVIAttributeList( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@}; + + /** @name Destructor */ + //@{ + ~PSVIAttributeList(); + //@} + + //--------------------- + /** @name PSVIAttributeList methods */ + + //@{ + + /* + * Get the number of attributes whose PSVI contributions + * are contained in this list. + */ + XMLSize_t getLength() const; + + /* + * Get the PSVI contribution of attribute at position i + * in this list. Indices start from 0. + * @param index index from which the attribute PSVI contribution + * is to come. + * @return PSVIAttribute containing the attributes PSVI contributions; + * null is returned if the index is out of range. + */ + PSVIAttribute *getAttributePSVIAtIndex(const XMLSize_t index); + + /* + * Get local part of attribute name at position index in the list. + * Indices start from 0. + * @param index index from which the attribute name + * is to come. + * @return local part of the attribute's name; null is returned if the index + * is out of range. + */ + const XMLCh *getAttributeNameAtIndex(const XMLSize_t index); + + /* + * Get namespace of attribute at position index in the list. + * Indices start from 0. + * @param index index from which the attribute namespace + * is to come. + * @return namespace of the attribute; + * null is returned if the index is out of range. + */ + const XMLCh *getAttributeNamespaceAtIndex(const XMLSize_t index); + + /* + * Get the PSVI contribution of attribute with given + * local name and namespace. + * @param attrName local part of the attribute's name + * @param attrNamespace namespace of the attribute + * @return null if the attribute PSVI does not exist + */ + PSVIAttribute *getAttributePSVIByName(const XMLCh *attrName + , const XMLCh * attrNamespace); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + /** + * returns a PSVI attribute of undetermined state and given name/namespace and + * makes that object part of the internal list. Intended to be called + * during validation of an element. + * @param attrName name of this attribute + * @param attrNS URI of the attribute + * @return new, uninitialized, PSVIAttribute object + */ + PSVIAttribute *getPSVIAttributeToFill( + const XMLCh * attrName + , const XMLCh * attrNS); + + /** + * reset the list + */ + void reset(); + + //@} + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + PSVIAttributeList(const PSVIAttributeList&); + PSVIAttributeList & operator=(const PSVIAttributeList &); + + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fMemoryManager + // handler to provide dynamically-need memory + // fAttrList + // list of PSVIAttributes contained by this object + // fAttrPos + // current number of initialized PSVIAttributes in fAttrList + MemoryManager* fMemoryManager; + RefVectorOf* fAttrList; + XMLSize_t fAttrPos; +}; + +inline PSVIAttributeList::~PSVIAttributeList() +{ + delete fAttrList; +} + +inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill( + const XMLCh *attrName + , const XMLCh * attrNS) +{ + PSVIAttributeStorage* storage = 0; + if(fAttrPos == fAttrList->size()) + { + storage = new (fMemoryManager) PSVIAttributeStorage(); + storage->fPSVIAttribute = new (fMemoryManager) PSVIAttribute(fMemoryManager); + fAttrList->addElement(storage); + } + else + { + storage = fAttrList->elementAt(fAttrPos); + } + storage->fAttributeName = attrName; + storage->fAttributeNamespace = attrNS; + fAttrPos++; + return storage->fPSVIAttribute; +} + +inline void PSVIAttributeList::reset() +{ + fAttrPos = 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.cpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.cpp new file mode 100644 index 000000000..adc8edff6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.cpp @@ -0,0 +1,93 @@ +/* + * 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: PSVIElement.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +PSVIElement::PSVIElement(MemoryManager* const manager): + PSVIItem(manager), + fElementDecl(0), + fNotationDecl(0), + fSchemaInfo(0) +{ +} + +PSVIElement::~PSVIElement() +{ + fMemoryManager->deallocate(fCanonicalValue); +} + +XSTypeDefinition* PSVIElement::getTypeDefinition() +{ + return fType; +} + + /** + * If and only if that type definition is a simple type definition + * with {variety} union, or a complex type definition whose {content type} + * is a simple type definition with {variety} union, + + * then an item isomorphic + * to that member of the union's {member type definitions} which actually + * validated the element item's normalized value. + * + * @return a simple type declaration + */ +XSSimpleTypeDefinition* PSVIElement::getMemberTypeDefinition() +{ + return fMemberType; +} + +void PSVIElement::reset( const VALIDITY_STATE validityState + , const ASSESSMENT_TYPE assessmentType + , const XMLCh* const validationContext + , bool isSpecified + , XSElementDeclaration* const elemDecl + , XSTypeDefinition* const typeDef + , XSSimpleTypeDefinition* const memberType + , XSModel* const schemaInfo + , const XMLCh* const defaultValue + , const XMLCh* const normalizedValue + , XMLCh* const canonicalValue + , XSNotationDeclaration* const notationDecl) +{ + fValidationContext = validationContext; + fValidityState = validityState; + fAssessmentType = assessmentType; + fIsSpecified = isSpecified; + fType = typeDef; + fMemberType = memberType; + fElementDecl = elemDecl; + fNotationDecl = notationDecl; + fSchemaInfo = schemaInfo; + fDefaultValue = defaultValue; + fNormalizedValue = normalizedValue; + fMemoryManager->deallocate(fCanonicalValue); + fCanonicalValue = canonicalValue; +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.hpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.hpp new file mode 100644 index 000000000..58735c501 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIElement.hpp @@ -0,0 +1,174 @@ +/* + * 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: PSVIElement.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIELEMENT_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIELEMENT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Represent the PSVI contributions for one element information item. + * This is *always* owned by the scanner/parser object from which + * it is obtained. The validator will specify + * under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class XSElementDeclaration; +class XSNotationDeclaration; +class XSModel; + +class XMLPARSER_EXPORT PSVIElement : public PSVIItem +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param manager The configurable memory manager + */ + PSVIElement( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@}; + + /** @name Destructor */ + //@{ + ~PSVIElement(); + //@} + + //--------------------- + /** @name PSVIElement methods */ + + //@{ + + /** + * An item isomorphic to the element declaration used to validate + * this element. + * + * @return an element declaration + */ + XSElementDeclaration *getElementDeclaration(); + + /** + * [notation] + * @see XML Schema Part 1: Structures [notation] + * @return The notation declaration. + */ + XSNotationDeclaration *getNotationDeclaration(); + + /** + * [schema information] + * @see XML Schema Part 1: Structures [schema information] + * @return The schema information property if it's the validation root, + * null otherwise. + */ + XSModel *getSchemaInformation(); + + /** + * An item isomorphic to the type definition used to validate this element. + * + * @return a type declaration + */ + XSTypeDefinition *getTypeDefinition(); + + /** + * If and only if that type definition is a simple type definition + * with {variety} union, or a complex type definition whose {content type} + * is a simple type definition with {variety} union, then an item isomorphic + * to that member of the union's {member type definitions} which actually + * validated the element item's normalized value. + * + * @return a simple type declaration + */ + XSSimpleTypeDefinition *getMemberTypeDefinition(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + void reset + ( + const VALIDITY_STATE validityState + , const ASSESSMENT_TYPE assessmentType + , const XMLCh* const validationContext + , bool isSpecified + , XSElementDeclaration* const elemDecl + , XSTypeDefinition* const typeDef + , XSSimpleTypeDefinition* const memberType + , XSModel* const schemaInfo + , const XMLCh* const defaultValue + , const XMLCh* const normalizedValue = 0 + , XMLCh* const canonicalValue = 0 + , XSNotationDeclaration* const notationDecl = 0 + ); + + //@} + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + PSVIElement(const PSVIElement&); + PSVIElement & operator=(const PSVIElement &); + + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fElementDecl + // element declaration component that validated this element + // fNotationDecl + // (optional) notation decl associated with this element + // fSchemaInfo + // Schema Information Item with which this validation episode is associated + XSElementDeclaration *fElementDecl; + XSNotationDeclaration *fNotationDecl; + XSModel *fSchemaInfo; +}; + +inline XSElementDeclaration *PSVIElement::getElementDeclaration() +{ + return fElementDecl; +} + +inline XSNotationDeclaration* PSVIElement::getNotationDeclaration() +{ + return fNotationDecl; +} + +inline XSModel* PSVIElement::getSchemaInformation() +{ + return fSchemaInfo; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIHandler.hpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIHandler.hpp new file mode 100644 index 000000000..7a8521618 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIHandler.hpp @@ -0,0 +1,148 @@ +/* + * 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: PSVIHandler.hpp 676796 2008-07-15 05:04:13Z dbertoni $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIHANDLER_HPP + + +XERCES_CPP_NAMESPACE_BEGIN + + +class PSVIElement; +class PSVIAttributeList; + + +/** + * This abstract class provides the interface for the scanner to return + * PSVI information to the application. + * + */ +class XMLPARSER_EXPORT PSVIHandler +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, just the virtual destructor is exposed + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + virtual ~PSVIHandler() + { + } + //@} + + /** @name The PSVI handler interface */ + //@{ + /** Receive notification of the PSVI properties of an element. + * The scanner will issue this call after the XMLDocumentHandler + * endElement call. Since the scanner will issue the psviAttributes + * call immediately after reading the start tag of an element, all element + * content will be effectively bracketed by these two calls. + * @param localName The name of the element whose end tag was just + * parsed. + * @param uri The namespace to which the element is bound + * @param elementInfo Object containing the element's PSVI properties + */ + virtual void handleElementPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo + ) = 0; + + /** + * Receive notification of partial PSVI properties of an element. + * This callback is made right after the psviAttributes + * call for non-empty element. + * + * The PSVIElement passed in has all fields properly set and it + * can be safely accessed the same way as the one passed in handleElementPSVI. + * However, fields listed below always have default values. + * + * getValidity() PSVIItem::VALIDITY_NOTKNOWN + * getValidationAttemped() PSVIItem::VALIDATION_NONE + * getMemberTypeDefinition() 0 + * getSchemaNormalizedValue() 0 + * getCanonicalRepresentation() 0 + * getNotationDeclaration() 0 + * + * + * @param localName The name of the element upon which start tag + * these attributes were encountered. + * @param uri The namespace to which the element is bound + * @param elementInfo Object containing the element's partial PSVI properties + */ + virtual void handlePartialElementPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo + ); + + /** + * Enables PSVI information about attributes to be passed back to the + * application. This callback will be made on *all* + * elements; on elements with no attributes, the final parameter will + * be null. + * @param localName The name of the element upon which start tag + * these attributes were encountered. + * @param uri The namespace to which the element is bound + * @param psviAttributes Object containing the attributes' PSVI properties + * with information to identify them. + */ + virtual void handleAttributesPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIAttributeList * psviAttributes + ) = 0; + + + //@} + + + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + PSVIHandler() + { + } + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + PSVIHandler(const PSVIHandler&); + PSVIHandler& operator=(const PSVIHandler&); +}; + +inline void PSVIHandler::handlePartialElementPSVI(const XMLCh* const /*localName*/ + , const XMLCh* const /*uri*/ + , PSVIElement * /*elementInfo*/ + ) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.cpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.cpp new file mode 100644 index 000000000..ef4faa912 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.cpp @@ -0,0 +1,145 @@ +/* + * 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: PSVIItem.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +PSVIItem::PSVIItem( MemoryManager* const manager ): + fMemoryManager(manager), + fValidationContext(0), + fNormalizedValue(0), + fDefaultValue(0), + fCanonicalValue(0), + fValidityState(VALIDITY_NOTKNOWN), + fAssessmentType(VALIDATION_FULL), + fIsSpecified(false), + fType(0), + fMemberType(0) +{ +} + +void PSVIItem::reset( + const XMLCh* const validationContext + , const XMLCh* const normalizedValue + , const VALIDITY_STATE validityState + , const ASSESSMENT_TYPE assessmentType + ) +{ + // this is just a wrapper method; fValidationContext will + // be valid as long as and no longer than the thing to which + // validationContext points + fValidationContext = validationContext; + fNormalizedValue = normalizedValue; + fValidityState = validityState; + fAssessmentType = assessmentType; +} + +void PSVIItem::setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType) +{ + fAssessmentType = attemptType; +} + +void PSVIItem::setValidity(PSVIItem::VALIDITY_STATE validity) +{ + fValidityState = validity; +} + +XSValue* PSVIItem::getActualValue() const +{ + /*** + * assessment + * VALIDATION_PARTIAL + * VALIDATION_FULL + * validity + * VALIDITY_VALID + ***/ + if ((fAssessmentType==VALIDATION_NONE) || (fValidityState!=VALIDITY_VALID)) + return 0; + + /*** + * XSSimpleType or + * XSComplexType's CONTENTTYPE_SIMPLE + * allowed + ***/ + if ((!fType) || + ((fType->getTypeCategory() == XSTypeDefinition::COMPLEX_TYPE) && + (((XSComplexTypeDefinition*)fType)->getContentType() != XSComplexTypeDefinition::CONTENTTYPE_SIMPLE))) + return 0; + + /*** + * Resolve dv + * + * 1. If fMemberType is not null, use the fMemberType->fDataTypeValidator + * 2. If fType is XSSimpleType, use fType->fDataTypeValidator + * 3. If fType is XSComplexType, use fType->fXSSimpleTypeDefinition-> fDataTypeValidator + * + ***/ + + DatatypeValidator *dv = 0; + + if (fMemberType) + { + /*** + * Now that fType is either XSSimpleTypeDefinition or + * XSComlextTypeDefinition with CONTENTTYPE_SIMPLE, the + * fMemberType must be XSSimpleTypeDefinition if present + ***/ + dv=((XSSimpleTypeDefinition*) fMemberType)->getDatatypeValidator(); + } + else if (fType->getTypeCategory() == XSTypeDefinition::SIMPLE_TYPE) + { + dv=((XSSimpleTypeDefinition*) fType)->getDatatypeValidator(); + } + else + { + XSSimpleTypeDefinition* simType = ((XSComplexTypeDefinition*)fType)->getSimpleType(); + if (simType) + dv = simType->getDatatypeValidator(); + } + + if (!dv) return 0; + + /*** + * Get the ultimate base dv in the datatype registry + ***/ + DatatypeValidator *basedv = DatatypeValidatorFactory::getBuiltInBaseValidator(dv); + + if (!basedv) return 0; + + XSValue::Status status=XSValue::st_Init; + + return XSValue::getActualValue(fNormalizedValue + , XSValue::getDataType(basedv->getTypeLocalName()) + , status + , XSValue::ver_10 + , false + , fMemoryManager); + + +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.hpp b/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.hpp new file mode 100644 index 000000000..784ceaa56 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/PSVIItem.hpp @@ -0,0 +1,309 @@ +/* + * 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: PSVIItem.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIITEM_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIITEM_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Represent the PSVI contributions for one element or one attribute information item. + * This is *always* owned by the validator /parser object from which + * it is obtained. It is designed to be subclassed; subclasses will + * specify under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class XSTypeDefinition; +class XSSimpleTypeDefinition; +class XSValue; + +class XMLPARSER_EXPORT PSVIItem : public XMemory +{ +public: + + enum VALIDITY_STATE { + /** Validity value indicating that validation has either not + been performed or that a strict assessment of validity could + not be performed + */ + VALIDITY_NOTKNOWN = 0, + + /** Validity value indicating that validation has been strictly + assessed and the element in question is invalid according to the + rules of schema validation. + */ + VALIDITY_INVALID = 1, + + /** Validity value indicating that validation has been strictly + assessed and the element in question is valid according to the rules + of schema validation. + */ + VALIDITY_VALID = 2 + }; + + enum ASSESSMENT_TYPE { + /** Validation status indicating that schema validation has been + performed and the element in question has specifically been skipped. + */ + VALIDATION_NONE = 0, + + /** Validation status indicating that schema validation has been + performed on the element in question under the rules of lax validation. + */ + VALIDATION_PARTIAL = 1, + + /** Validation status indicating that full schema validation has been + performed on the element. */ + VALIDATION_FULL = 2 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param manager The configurable memory manager + */ + PSVIItem(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@}; + + /** @name Destructor */ + //@{ + virtual ~PSVIItem(); + //@} + + //--------------------- + /** @name PSVIItem methods */ + + //@{ + + /** + * [validation context] + * + * @return A string identifying the nearest ancestor element + * information item with a [schema information] property + * (or this element item itself if it has such a property) + * (form to be determined) + * @see XML Schema Part 1: Structures [validation context] + */ + const XMLCh *getValidationContext(); + + /** + * Determine the validity of the node with respect + * to the validation being attempted + * + * @return return the [validity] property. Possible values are: + * VALIDITY_UNKNOWN, VALIDITY_INVALID, VALIDITY_VALID + */ + VALIDITY_STATE getValidity() const; + + /** + * Determines the extent to which the item has been validated + * + * @return return the [validation attempted] property. The possible values are + * VALIDATION_NONE, VALIDATION_ORDERED_PARTIAL and VALIDATION_FULL + */ + ASSESSMENT_TYPE getValidationAttempted() const; + + /** + * A list of error codes generated from validation attempts. + * Need to find all the possible sub-clause reports that need reporting + * + * @return list of error codes + */ + /*** + const XMLCh ** getErrorCodes(); + ****/ + + /** + * [schema normalized value] + * + * @see XML Schema Part 1: Structures [schema normalized value] + * @return the normalized value of this item after validation + */ + const XMLCh *getSchemaNormalizedValue(); + + /** + * An item isomorphic to the type definition used to validate this element. + * + * @return a type declaration + */ + virtual XSTypeDefinition *getTypeDefinition() = 0; + + /** + * If and only if that type definition is a simple type definition + * with {variety} union, or a complex type definition whose {content type} + * is a simple thype definition with {variety} union, then an item isomorphic + * to that member of the union's {member type definitions} which actually + * validated the element item's normalized value. + * + * @return a simple type declaration + */ + virtual XSSimpleTypeDefinition *getMemberTypeDefinition() = 0; + + /** + * [schema default] + * + * @return The canonical lexical representation of the declaration's {value constraint} value. + * @see XML Schema Part 1: Structures [schema default] + */ + const XMLCh *getSchemaDefault(); + + /** + * [schema specified] + * @see XML Schema Part 1: Structures [schema specified] + * @return true - value was specified in schema, false - value comes from the infoset + */ + bool getIsSchemaSpecified() const; + + /** + * Return the canonical representation of this value. + * Note that, formally, this is not a PSVI property. + * @return string representing the canonical representation, if this item + * was validated by a simple type definition for which canonical + * representations of values are defined. + */ + const XMLCh *getCanonicalRepresentation() const; + + //@} + + /** + * + * Get actual value in the form of XSValue, + * caller needs to delete the object returned. + * + * @return an XSValue + */ + virtual XSValue *getActualValue() const; + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + void setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType); + void setValidity(PSVIItem::VALIDITY_STATE validity); + + /** reset the object + * @param validationContext corresponds to schema validation context property + * @param normalizedValue corresponds to schema normalized value property + * @param validityState state of item's validity + * @param assessmentType type of assessment carried out on item + */ + void reset( + const XMLCh* const validationContext + , const XMLCh* const normalizedValue + , const VALIDITY_STATE validityState + , const ASSESSMENT_TYPE assessmentType + ); + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + PSVIItem(const PSVIItem&); + PSVIItem & operator=(const PSVIItem &); + + +protected: + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fMemoryManager: + // used for any memory allocations + // fValidationContext + // corresponds to the schema [validation context] property + // fNormalizedValue + // The schema normalized value (when present) + // fDefaultValue + // default value specified in the schema, if any + // fCanonicalValue + // canonicalized version of normalizedValue + // fValidityState + // Whether this item is valid or not + // fAssessmentType + // The kind of assessment that produced the given validity outcome + // fIsSpecified + // Whether this item exists because a default was specified in the schema + // fType + // type responsible for validating this item + // fMemberType + // If fType is a union type, the member type that validated this item + MemoryManager* const fMemoryManager; + const XMLCh* fValidationContext; + const XMLCh* fNormalizedValue; + const XMLCh* fDefaultValue; + XMLCh* fCanonicalValue; + VALIDITY_STATE fValidityState; + ASSESSMENT_TYPE fAssessmentType; + bool fIsSpecified; + XSTypeDefinition * fType; + XSSimpleTypeDefinition* fMemberType; +}; + +inline PSVIItem::~PSVIItem() {} + +inline const XMLCh *PSVIItem::getValidationContext() +{ + return fValidationContext; +} + +inline const XMLCh* PSVIItem::getSchemaNormalizedValue() +{ + return fNormalizedValue; +} + +inline const XMLCh* PSVIItem::getSchemaDefault() +{ + return fDefaultValue; +} + +inline const XMLCh* PSVIItem::getCanonicalRepresentation() const +{ + return fCanonicalValue; +} + +inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const +{ + return fValidityState; +} + +inline bool PSVIItem::getIsSchemaSpecified() const +{ + return fIsSpecified; +} + +inline PSVIItem::ASSESSMENT_TYPE PSVIItem::getValidationAttempted() const +{ + return fAssessmentType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.cpp new file mode 100644 index 000000000..6367d4e96 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.cpp @@ -0,0 +1,190 @@ +/* + * 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: XSAnnotation.cpp 679296 2008-07-24 08:13:42Z borisk $ + */ + +#include +#include + +#include + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XSAnnotation::XSAnnotation(const XMLCh* const content, + MemoryManager * const manager) +:XSObject(XSConstants::ANNOTATION, 0, manager) +,fContents(XMLString::replicate(content, manager)) +,fNext(0) +,fSystemId(0) +,fLine(0) +,fCol(0) +{ +} + +XSAnnotation::XSAnnotation(MemoryManager * const manager) +:XSObject(XSConstants::ANNOTATION, 0, manager) +,fContents(0) +,fNext(0) +,fSystemId(0) +,fLine(0) +,fCol(0) +{ +} + +XSAnnotation::~XSAnnotation() +{ + fMemoryManager->deallocate(fContents); + + if (fNext) + delete fNext; + + fMemoryManager->deallocate(fSystemId); +} + +// XSAnnotation methods +void XSAnnotation::writeAnnotation(DOMNode* node, ANNOTATION_TARGET targetType) +{ + XercesDOMParser *parser = new (fMemoryManager) XercesDOMParser(0, fMemoryManager); + parser->setDoNamespaces(true); + parser->setValidationScheme(XercesDOMParser::Val_Never); + + DOMDocument* futureOwner = (targetType == W3C_DOM_ELEMENT) ? + ((DOMElement*)node)->getOwnerDocument() : + (DOMDocument*)node; + + MemBufInputSource* memBufIS = new (fMemoryManager) MemBufInputSource + ( + (const XMLByte*)fContents + , XMLString::stringLen(fContents)*sizeof(XMLCh) + , "" + , false + , fMemoryManager + ); + memBufIS->setEncoding(XMLUni::fgXMLChEncodingString); + memBufIS->setCopyBufToStream(false); + + try + { + parser->parse(*memBufIS); + } + catch (const XMLException&) + { + // REVISIT: should we really eat this? + } + + DOMNode* newElem = futureOwner->importNode((parser->getDocument())->getDocumentElement(), true); + node->insertBefore(newElem, node->getFirstChild()); + + delete parser; + delete memBufIS; +} + + +void XSAnnotation::writeAnnotation(ContentHandler* handler) +{ + SAX2XMLReader* parser = XMLReaderFactory::createXMLReader(fMemoryManager); + parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); + parser->setFeature(XMLUni::fgSAX2CoreValidation, false); + parser->setContentHandler(handler); + + MemBufInputSource* memBufIS = new (fMemoryManager) MemBufInputSource + ( + (const XMLByte*)fContents + , XMLString::stringLen(fContents)*sizeof(XMLCh) + , "" + , false + , fMemoryManager + ); + memBufIS->setEncoding(XMLUni::fgXMLChEncodingString); + memBufIS->setCopyBufToStream(false); + + try + { + parser->parse(*memBufIS); + } + catch (const XMLException&) + { + } + + delete parser; + delete memBufIS; +} + + +void XSAnnotation::setNext(XSAnnotation* const nextAnnotation) +{ + if (fNext) + fNext->setNext(nextAnnotation); + else + fNext = nextAnnotation; +} + +XSAnnotation* XSAnnotation::getNext() +{ + return fNext; +} + +void XSAnnotation::setSystemId(const XMLCh* const systemId) +{ + if (fSystemId) + { + fMemoryManager->deallocate(fSystemId); + fSystemId = 0; + } + + if (systemId) + fSystemId = XMLString::replicate(systemId, fMemoryManager); + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XSAnnotation) + +void XSAnnotation::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng.writeString(fContents); + serEng<>fNext; + serEng.readString(fSystemId); + + serEng.readUInt64 (fLine); + serEng.readUInt64 (fCol); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.hpp new file mode 100644 index 000000000..0e34401a1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAnnotation.hpp @@ -0,0 +1,195 @@ +/* + * 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: XSAnnotation.hpp 672273 2008-06-27 13:57:00Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP) +#define XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Annotation + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class DOMNode; +class ContentHandler; + +class XMLPARSER_EXPORT XSAnnotation : public XSerializable, public XSObject +{ +public: + + // TargetType + enum ANNOTATION_TARGET { + /** + * The object type is org.w3c.dom.Element. + */ + W3C_DOM_ELEMENT = 1, + /** + * The object type is org.w3c.dom.Document. + */ + W3C_DOM_DOCUMENT = 2 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param contents The string that is to be the content of this XSAnnotation + * @param manager The configurable memory manager + */ + XSAnnotation + ( + const XMLCh* const contents + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSAnnotation(); + //@} + + //--------------------- + /** @name XSAnnotation methods */ + + //@{ + + /** + * Write contents of the annotation to the specified DOM object. In-scope + * namespace declarations for annotation element are added as + * attribute nodes of the serialized annotation. + * @param node A target pointer to the annotation target object, i.e. + * either DOMDocument or DOMElement cast as + * DOMNode. + * @param targetType A target type. + */ + + void writeAnnotation(DOMNode* node, ANNOTATION_TARGET targetType); + + /** + * Write contents of the annotation to the specified object. + * The corresponding events for all in-scope namespace declarations are + * sent via the specified document handler. + * @param handler A target pointer to the annotation target object, i.e. + * ContentHandler. + */ + void writeAnnotation(ContentHandler* handler); + + /** + * A text representation of annotation. + */ + const XMLCh *getAnnotationString() const; + XMLCh *getAnnotationString(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + //@{ + void setNext(XSAnnotation* const nextAnnotation); + XSAnnotation* getNext(); + //@} + + //----------------------------- + /** Getter */ + //@{ + inline void getLineCol(XMLFileLoc& line, XMLFileLoc& col) const; + inline const XMLCh* getSystemId() const; + //@} + + //----------------------------- + /** Setter */ + //@{ + inline void setLineCol(XMLFileLoc line, XMLFileLoc col); + void setSystemId(const XMLCh* const systemId); + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XSAnnotation) + XSAnnotation(MemoryManager* const manager); + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSAnnotation(const XSAnnotation&); + XSAnnotation & operator=(const XSAnnotation &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XMLCh* fContents; + XSAnnotation* fNext; + +private: + + XMLCh* fSystemId; + XMLFileLoc fLine; + XMLFileLoc fCol; + +}; + +inline const XMLCh *XSAnnotation::getAnnotationString() const +{ + return fContents; +} + +inline XMLCh *XSAnnotation::getAnnotationString() +{ + return fContents; +} + +inline void XSAnnotation::getLineCol(XMLFileLoc& line, XMLFileLoc& col) const +{ + line = fLine; + col = fCol; +} + +inline const XMLCh* XSAnnotation::getSystemId() const +{ + return fSystemId; +} + +inline void XSAnnotation::setLineCol(XMLFileLoc line, XMLFileLoc col) +{ + fLine = line; + fCol = col; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp new file mode 100644 index 000000000..e521d67d7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp @@ -0,0 +1,112 @@ +/* + * 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: XSAttributeDeclaration.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSAttributeDeclaration: Constructors and Destructor +// --------------------------------------------------------------------------- +XSAttributeDeclaration::XSAttributeDeclaration(SchemaAttDef* const attDef, + XSSimpleTypeDefinition* const typeDef, + XSAnnotation* const annot, + XSModel* const xsModel, + XSConstants::SCOPE scope, + XSComplexTypeDefinition* enclosingCTDefinition, + MemoryManager * const manager) + : XSObject(XSConstants::ATTRIBUTE_DECLARATION, xsModel, manager) + , fAttDef(attDef) + , fTypeDefinition(typeDef) + , fAnnotation(annot) + , fScope(scope) + , fEnclosingCTDefinition(enclosingCTDefinition) +{ +} + +XSAttributeDeclaration::~XSAttributeDeclaration() +{ + // don't delete fTypeDefinition - deleted by XSModel +} + +// --------------------------------------------------------------------------- +// XSAttributeDeclaration: XSObject virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSAttributeDeclaration::getName() const +{ + return fAttDef->getAttName()->getLocalPart(); +} + +const XMLCh *XSAttributeDeclaration::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fAttDef->getAttName()->getURI()); +} + +XSNamespaceItem *XSAttributeDeclaration::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + +// --------------------------------------------------------------------------- +// XSAttributeDeclaration: access methods +// --------------------------------------------------------------------------- + +XSConstants::VALUE_CONSTRAINT XSAttributeDeclaration::getConstraintType() const +{ + if (fScope != XSConstants::SCOPE_GLOBAL) + return XSConstants::VALUE_CONSTRAINT_NONE; + + if (fAttDef->getDefaultType() == XMLAttDef::Default) + return XSConstants::VALUE_CONSTRAINT_DEFAULT; + + if ((fAttDef->getDefaultType() == XMLAttDef::Fixed) || + (fAttDef->getDefaultType() == XMLAttDef::Required_And_Fixed)) + return XSConstants::VALUE_CONSTRAINT_FIXED; + + return XSConstants::VALUE_CONSTRAINT_NONE; +} + +const XMLCh *XSAttributeDeclaration::getConstraintValue() +{ + if (fScope == XSConstants::SCOPE_GLOBAL) + return fAttDef->getValue(); + + return 0; +} + +bool XSAttributeDeclaration::getRequired() const +{ + if (fAttDef->getDefaultType() == XMLAttDef::Required || + fAttDef->getDefaultType() == XMLAttDef::Required_And_Fixed) + return true; + + return false; +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp new file mode 100644 index 000000000..54085c242 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp @@ -0,0 +1,210 @@ +/* + * 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: XSAttributeDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP) +#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Attribute + * Declaration component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XSComplexTypeDefinition; +class XSSimpleTypeDefinition; +class SchemaAttDef; + +class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param attDef + * @param typeDef + * @param annot + * @param xsModel + * @param scope + * @param enclosingCTDefinition + * @param manager The configurable memory manager + */ + XSAttributeDeclaration + ( + SchemaAttDef* const attDef + , XSSimpleTypeDefinition* const typeDef + , XSAnnotation* const annot + , XSModel* const xsModel + , XSConstants::SCOPE scope + , XSComplexTypeDefinition* enclosingCTDefinition + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSAttributeDeclaration(); + //@} + + //--------------------- + /** @name overridden XSObject methods */ + + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem* getNamespaceItem(); + + //@} + + /** @name XSAttributeDeclaration methods **/ + + //@{ + + /** + * [type definition]: A simple type definition + */ + XSSimpleTypeDefinition *getTypeDefinition() const; + + /** + * Optional. One of SCOPE_GLOBAL, SCOPE_LOCAL, + * or SCOPE_ABSENT. If the scope is local, then the + * enclosingCTDefinition is present. + */ + XSConstants::SCOPE getScope() const; + + /** + * The complex type definition for locally scoped declarations (see + * scope). + */ + XSComplexTypeDefinition *getEnclosingCTDefinition(); + + /** + * Value constraint: one of VC_NONE, VC_DEFAULT, VC_FIXED. + */ + XSConstants::VALUE_CONSTRAINT getConstraintType() const; + + /** + * Value constraint: The actual value with respect to the [type definition + * ]. + */ + const XMLCh *getConstraintValue(); + + /** + * Optional. Annotation. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + bool getRequired() const; + //@} + +private: + + void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); + friend class XSObjectFactory; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSAttributeDeclaration(const XSAttributeDeclaration&); + XSAttributeDeclaration & operator=(const XSAttributeDeclaration &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + SchemaAttDef* fAttDef; + XSSimpleTypeDefinition* fTypeDefinition; + XSAnnotation* fAnnotation; + XSConstants::SCOPE fScope; + XSComplexTypeDefinition* fEnclosingCTDefinition; +}; + +// --------------------------------------------------------------------------- +// XSAttributeDeclaration: inline methods +// --------------------------------------------------------------------------- +inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const +{ + return fTypeDefinition; +} + +inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const +{ + return fAnnotation; +} + +inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const +{ + return fScope; +} + +inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition() +{ + return fEnclosingCTDefinition; +} + +inline void XSAttributeDeclaration::setEnclosingCTDefinition +( + XSComplexTypeDefinition* const toSet +) +{ + fEnclosingCTDefinition = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp new file mode 100644 index 000000000..6df57af09 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp @@ -0,0 +1,76 @@ +/* + * 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: XSAttributeGroupDefinition.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSAttributeGroupDefinition: Constructors and Destructor +// --------------------------------------------------------------------------- +XSAttributeGroupDefinition::XSAttributeGroupDefinition +( + XercesAttGroupInfo* const xercesAttGroupInfo + , XSAttributeUseList* const xsAttList + , XSWildcard* const xsWildcard + , XSAnnotation* const xsAnnot + , XSModel* const xsModel + , MemoryManager * const manager +) + : XSObject(XSConstants::ATTRIBUTE_GROUP_DEFINITION, xsModel, manager) + , fXercesAttGroupInfo(xercesAttGroupInfo) + , fXSAttributeUseList(xsAttList) + , fXSWildcard(xsWildcard) + , fAnnotation(xsAnnot) +{ +} + +XSAttributeGroupDefinition::~XSAttributeGroupDefinition() +{ + if (fXSAttributeUseList) + delete fXSAttributeUseList; + + // don't delete fXSWildcard - deleted by XSModel +} + +// XSObject methods +const XMLCh *XSAttributeGroupDefinition::getName() const +{ + return fXSModel->getURIStringPool()->getValueForId(fXercesAttGroupInfo->getNameId()); +} + +const XMLCh *XSAttributeGroupDefinition::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fXercesAttGroupInfo->getNamespaceId()); +} + +XSNamespaceItem *XSAttributeGroupDefinition::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp new file mode 100644 index 000000000..8dfacdb82 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp @@ -0,0 +1,167 @@ +/* + * 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: XSAttributeGroupDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEGROUPDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEGROUPDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Attribute + * Group Definition component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XSAttributeUse; +class XSWildcard; +class XercesAttGroupInfo; + +class XMLPARSER_EXPORT XSAttributeGroupDefinition : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param xercesAttGroupInfo + * @param xsAttList + * @param xsWildcard + * @param xsAnnot + * @param xsModel + * @param manager The configurable memory manager + */ + XSAttributeGroupDefinition + ( + XercesAttGroupInfo* const xercesAttGroupInfo + , XSAttributeUseList* const xsAttList + , XSWildcard* const xsWildcard + , XSAnnotation* const xsAnnot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSAttributeGroupDefinition(); + //@} + + //--------------------- + /** @name overridden XSObject methods */ + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem* getNamespaceItem(); + + //@} + + //--------------------- + /** @name XSAttributeGroupDefinition methods */ + + //@{ + + /** + * A set of [attribute uses]. + */ + XSAttributeUseList *getAttributeUses(); + + /** + * Optional. A [wildcard]. + */ + XSWildcard *getAttributeWildcard() const; + + /** + * Optional. An [annotation]. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSAttributeGroupDefinition(const XSAttributeGroupDefinition&); + XSAttributeGroupDefinition & operator=(const XSAttributeGroupDefinition &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XercesAttGroupInfo* fXercesAttGroupInfo; + XSAttributeUseList* fXSAttributeUseList; + XSWildcard* fXSWildcard; + XSAnnotation* fAnnotation; +}; + +inline XSAttributeUseList* XSAttributeGroupDefinition::getAttributeUses() +{ + return fXSAttributeUseList; +} + +inline XSWildcard* XSAttributeGroupDefinition::getAttributeWildcard() const +{ + return fXSWildcard; +} + +inline XSAnnotation* XSAttributeGroupDefinition::getAnnotation() const +{ + return fAnnotation; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.cpp new file mode 100644 index 000000000..a6ff9fcdf --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.cpp @@ -0,0 +1,61 @@ +/* + * 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: XSAttributeUse.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSAttributeUse: Constructors and Destructor +// --------------------------------------------------------------------------- +XSAttributeUse::XSAttributeUse(XSAttributeDeclaration* const xsAttDecl, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::ATTRIBUTE_USE, xsModel, manager) + , fRequired(false) + , fConstraintType(XSConstants::VALUE_CONSTRAINT_NONE) + , fConstraintValue(0) + , fXSAttributeDeclaration(xsAttDecl) +{ +} + + +XSAttributeUse::~XSAttributeUse() +{ + // don't delete fXSAttributeDeclaration - deleted by XSModel +} + + +// --------------------------------------------------------------------------- +// XSAttributeUse: helper methods +// --------------------------------------------------------------------------- +void XSAttributeUse::set(const bool isRequired, + XSConstants::VALUE_CONSTRAINT constraintType, + const XMLCh* const constraintValue) +{ + fRequired = isRequired; + fConstraintType = constraintType; + fConstraintValue = constraintValue; +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.hpp new file mode 100644 index 000000000..5696098eb --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSAttributeUse.hpp @@ -0,0 +1,156 @@ +/* + * 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: XSAttributeUse.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEUSE_HPP) +#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEUSE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Attribute + * Use component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAttributeDeclaration; + +class XMLPARSER_EXPORT XSAttributeUse : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * @param xsAttDecl + * @param xsModel + * @param manager The configurable memory manager + */ + XSAttributeUse + ( + XSAttributeDeclaration* const xsAttDecl, + XSModel* const xsModel, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSAttributeUse(); + //@} + + //--------------------- + /** @name XSAttributeUse methods */ + + //@{ + + /** + * [required]: determines whether this use of an attribute declaration + * requires an appropriate attribute information item to be present, or + * merely allows it. + */ + bool getRequired() const; + + /** + * [attribute declaration]: provides the attribute declaration itself, + * which will in turn determine the simple type definition used. + */ + XSAttributeDeclaration *getAttrDeclaration() const; + + /** + * Value Constraint: one of default, fixed. + */ + XSConstants::VALUE_CONSTRAINT getConstraintType() const; + + /** + * Value Constraint: The actual value. + */ + const XMLCh *getConstraintValue(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} + +private: + + // set data + void set + ( + const bool isRequired + , XSConstants::VALUE_CONSTRAINT constraintType + , const XMLCh* const constraintValue + ); + + friend class XSObjectFactory; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSAttributeUse(const XSAttributeUse&); + XSAttributeUse & operator=(const XSAttributeUse &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + bool fRequired; + XSConstants::VALUE_CONSTRAINT fConstraintType; + const XMLCh* fConstraintValue; + XSAttributeDeclaration* fXSAttributeDeclaration; +}; + +inline XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration() const +{ + return fXSAttributeDeclaration; +} + +inline bool XSAttributeUse::getRequired() const +{ + return fRequired; +} + +inline XSConstants::VALUE_CONSTRAINT XSAttributeUse::getConstraintType() const +{ + return fConstraintType; +} + +inline const XMLCh *XSAttributeUse::getConstraintValue() +{ + return fConstraintValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp new file mode 100644 index 000000000..de6a0ae3d --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp @@ -0,0 +1,207 @@ +/* + * 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: XSComplexTypeDefinition.cpp 594002 2007-11-12 01:05:09Z cargilld $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSComplexTypeDefinition: Constructors and Destructor +// --------------------------------------------------------------------------- +XSComplexTypeDefinition::XSComplexTypeDefinition +( + ComplexTypeInfo* const complexTypeInfo + , XSWildcard* const xsWildcard + , XSSimpleTypeDefinition* const xsSimpleType + , XSAttributeUseList* const xsAttList + , XSTypeDefinition* const xsBaseType + , XSParticle* const xsParticle + , XSAnnotation* const headAnnot + , XSModel* const xsModel + , MemoryManager* const manager +) + : XSTypeDefinition(COMPLEX_TYPE, xsBaseType, xsModel, manager) + , fComplexTypeInfo(complexTypeInfo) + , fXSWildcard(xsWildcard) + , fXSAttributeUseList(xsAttList) + , fXSSimpleTypeDefinition(xsSimpleType) + , fXSAnnotationList(0) + , fParticle(xsParticle) + , fProhibitedSubstitution(0) +{ + int blockset = fComplexTypeInfo->getBlockSet(); + if (blockset) + { + if (blockset & SchemaSymbols::XSD_EXTENSION) + fProhibitedSubstitution |= XSConstants::DERIVATION_EXTENSION; + + if (blockset & SchemaSymbols::XSD_RESTRICTION) + fProhibitedSubstitution |= XSConstants::DERIVATION_RESTRICTION; + } + + int finalSet = fComplexTypeInfo->getFinalSet(); + if (finalSet) + { + if (finalSet & SchemaSymbols::XSD_EXTENSION) + fFinal |= XSConstants::DERIVATION_EXTENSION; + + if (finalSet & SchemaSymbols::XSD_RESTRICTION) + fFinal |= XSConstants::DERIVATION_RESTRICTION; + } + + if (headAnnot) + { + fXSAnnotationList = new (manager) RefVectorOf(1, false, manager); + XSAnnotation* annot = headAnnot; + + do + { + fXSAnnotationList->addElement(annot); + annot = annot->getNext(); + } while (annot); + } +} + +XSComplexTypeDefinition::~XSComplexTypeDefinition() +{ + // don't delete fXSWildcard - deleted by XSModel + // don't delete fXSSimpleTypeDefinition - deleted by XSModel + if (fXSAttributeUseList) + delete fXSAttributeUseList; + + if (fXSAnnotationList) + delete fXSAnnotationList; + + if (fParticle) + delete fParticle; +} + +// --------------------------------------------------------------------------- +// XSComplexTypeDefinition: access methods +// --------------------------------------------------------------------------- +XSConstants::DERIVATION_TYPE XSComplexTypeDefinition::getDerivationMethod() const +{ + if(fComplexTypeInfo->getDerivedBy() == SchemaSymbols::XSD_EXTENSION) + return XSConstants::DERIVATION_EXTENSION; + return XSConstants::DERIVATION_RESTRICTION; +} + +bool XSComplexTypeDefinition::getAbstract() const +{ + return fComplexTypeInfo->getAbstract(); +} + + +XSComplexTypeDefinition::CONTENT_TYPE XSComplexTypeDefinition::getContentType() const +{ + switch(fComplexTypeInfo->getContentType()) { + case SchemaElementDecl::Simple: + return CONTENTTYPE_SIMPLE; + case SchemaElementDecl::Empty: + case SchemaElementDecl::ElementOnlyEmpty: + return CONTENTTYPE_EMPTY; + case SchemaElementDecl::Children: + return CONTENTTYPE_ELEMENT; + default: + //case SchemaElementDecl::Mixed_Complex: + //case SchemaElementDecl::Mixed_Simple: + //case SchemaElementDecl::Any: + return CONTENTTYPE_MIXED; + } +} + +bool XSComplexTypeDefinition::isProhibitedSubstitution(XSConstants::DERIVATION_TYPE toTest) +{ + if (fProhibitedSubstitution & toTest) + return true; + + return false; +} + +XSAnnotationList *XSComplexTypeDefinition::getAnnotations() +{ + return fXSAnnotationList; +} + +// --------------------------------------------------------------------------- +// XSComplexTypeDefinition: virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSComplexTypeDefinition::getName() const +{ + return fComplexTypeInfo->getTypeLocalName(); +} + +const XMLCh *XSComplexTypeDefinition::getNamespace() +{ + return fComplexTypeInfo->getTypeUri(); +} + +XSNamespaceItem *XSComplexTypeDefinition::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + +bool XSComplexTypeDefinition::getAnonymous() const +{ + return fComplexTypeInfo->getAnonymous(); +} + +XSTypeDefinition *XSComplexTypeDefinition::getBaseType() +{ + return fBaseType; +} + +bool XSComplexTypeDefinition::derivedFromType(const XSTypeDefinition * const ancestorType) +{ + if (!ancestorType) + return false; + + XSTypeDefinition* type = (XSTypeDefinition*) ancestorType; + + if (ancestorType == type->getBaseType()) + { + // ancestor is anytype + return true; + } + + type = this; + XSTypeDefinition* lastType = 0; // anytype has a basetype of anytype so will have infinite loop... + + while (type && (type != ancestorType) && (type != lastType)) + { + lastType = type; + type = type->getBaseType(); + } + + return (type == ancestorType); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp new file mode 100644 index 000000000..2b0a688e8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp @@ -0,0 +1,294 @@ +/* + * 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: XSComplexTypeDefinition.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSCOMPLEXTYPEDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSCOMPLEXTYPEDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class represents a complexType definition + * schema component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + * + */ + +// forward declarations +class XSAnnotation; +class XSAttributeUse; +class XSSimpleTypeDefinition; +class XSParticle; +class XSWildcard; +class ComplexTypeInfo; + +class XMLPARSER_EXPORT XSComplexTypeDefinition : public XSTypeDefinition +{ +public: + + // Content Model Types + enum CONTENT_TYPE { + /** + * Represents an empty content type. A content type with the distinguished + * value empty validates elements with no character or element + * information item children. + */ + CONTENTTYPE_EMPTY = 0, + /** + * Represents a simple content type. A content type which is a simple + * validates elements with character-only children. + */ + CONTENTTYPE_SIMPLE = 1, + /** + * Represents an element-only content type. An element-only content type + * validates elements with children that conform to the supplied content + * model. + */ + CONTENTTYPE_ELEMENT = 2, + /** + * Represents a mixed content type. + */ + CONTENTTYPE_MIXED = 3 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param complexTypeInfo + * @param xsWildcard + * @param xsSimpleType + * @param xsAttList + * @param xsBaseType + * @param xsParticle + * @param headAnnot + * @param xsModel + * @param manager The configurable memory manager + */ + XSComplexTypeDefinition + ( + ComplexTypeInfo* const complexTypeInfo + , XSWildcard* const xsWildcard + , XSSimpleTypeDefinition* const xsSimpleType + , XSAttributeUseList* const xsAttList + , XSTypeDefinition* const xsBaseType + , XSParticle* const xsParticle + , XSAnnotation* const headAnnot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSComplexTypeDefinition(); + //@} + + //--------------------- + /** @name XSComplexTypeDefinition methods */ + + //@{ + + /** + * [derivation method]: either DERIVATION_EXTENSION, + * DERIVATION_RESTRICTION, or DERIVATION_NONE + * (see XSObject). + */ + XSConstants::DERIVATION_TYPE getDerivationMethod() const; + + /** + * [abstract]: a boolean. Complex types for which abstract is + * true must not be used as the type definition for the validation of + * element information items. + */ + bool getAbstract() const; + + /** + * A set of attribute uses. + */ + XSAttributeUseList *getAttributeUses(); + + /** + * Optional.An attribute wildcard. + */ + XSWildcard *getAttributeWildcard() const; + + /** + * [content type]: one of empty (CONTENTTYPE_EMPTY), a simple + * type definition (CONTENTTYPE_SIMPLE), mixed ( + * CONTENTTYPE_MIXED), or element-only ( + * CONTENTTYPE_ELEMENT). + */ + CONTENT_TYPE getContentType() const; + + /** + * A simple type definition corresponding to simple content model, + * otherwise null + */ + XSSimpleTypeDefinition *getSimpleType() const; + + /** + * A particle for mixed or element-only content model, otherwise + * null + */ + XSParticle *getParticle() const; + + /** + * [prohibited substitutions]: a subset of {extension, restriction} + * @param toTest Extension or restriction constants (see + * XSObject). + * @return True if toTest is a prohibited substitution, otherwise + * false. + */ + bool isProhibitedSubstitution(XSConstants::DERIVATION_TYPE toTest); + + /** + * [prohibited substitutions]: A subset of {extension, restriction} or + * DERIVATION_NONE represented as a bit flag (see + * XSObject). + */ + short getProhibitedSubstitutions() const; + + /** + * A set of [annotations]. + */ + XSAnnotationList *getAnnotations(); + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + /** + * A boolean that specifies if the type definition is + * anonymous. Convenience attribute. + */ + bool getAnonymous() const; + + /** + * {base type definition}: either a simple type definition or a complex + * type definition. + */ + XSTypeDefinition *getBaseType(); + + /** + * Convenience method: check if this type is derived from the given + * ancestorType. + * @param ancestorType An ancestor type definition. + * @return Return true if this type is derived from + * ancestorType. + */ + bool derivedFromType(const XSTypeDefinition* const ancestorType); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + + //@} + +private: + + /** + * Set the base type + */ + void setBaseType(XSTypeDefinition* const xsBaseType); + friend class XSObjectFactory; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSComplexTypeDefinition(const XSComplexTypeDefinition&); + XSComplexTypeDefinition & operator=(const XSComplexTypeDefinition &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + ComplexTypeInfo* fComplexTypeInfo; + XSWildcard* fXSWildcard; + XSAttributeUseList* fXSAttributeUseList; + XSSimpleTypeDefinition* fXSSimpleTypeDefinition; + XSAnnotationList* fXSAnnotationList; + XSParticle* fParticle; + short fProhibitedSubstitution; +}; + + +inline XSAttributeUseList* XSComplexTypeDefinition::getAttributeUses() +{ + return fXSAttributeUseList; +} + +inline XSWildcard* XSComplexTypeDefinition::getAttributeWildcard() const +{ + return fXSWildcard; +} + +inline XSSimpleTypeDefinition* XSComplexTypeDefinition::getSimpleType() const +{ + return fXSSimpleTypeDefinition; +} + +inline short XSComplexTypeDefinition::getProhibitedSubstitutions() const +{ + return fProhibitedSubstitution; +} + +inline XSParticle *XSComplexTypeDefinition::getParticle() const +{ + return fParticle; +} + +inline void +XSComplexTypeDefinition::setBaseType(XSTypeDefinition* const xsBaseType) +{ + fBaseType = xsBaseType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSConstants.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSConstants.hpp new file mode 100644 index 000000000..2ae20bca5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSConstants.hpp @@ -0,0 +1,196 @@ +/* + * 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: XSConstants.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSCONSTANTS_HPP) +#define XERCESC_INCLUDE_GUARD_XSCONSTANTS_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This contains constants needed in the schema component model. + */ + +// forward definitions for typedefs +class XSAnnotation; +class XSAttributeUse; +class XSFacet; +class XSMultiValueFacet; +class XSNamespaceItem; +class XSParticle; +class XSSimpleTypeDefinition; + +// these typedefs are intended to help hide dependence on utility +// classes, as well as to define more intuitive names for commonly +// used concepts. + +typedef RefVectorOf XSAnnotationList; +typedef RefVectorOf XSAttributeUseList; +typedef RefVectorOf XSFacetList; +typedef RefVectorOf XSMultiValueFacetList; +typedef RefVectorOf XSNamespaceItemList; +typedef RefVectorOf XSParticleList; +typedef RefVectorOf XSSimpleTypeDefinitionList; +typedef RefArrayVectorOf StringList; + +class XMLPARSER_EXPORT XSConstants +{ +public: + + // XML Schema Components + enum COMPONENT_TYPE { + /** + * The object describes an attribute declaration. + */ + ATTRIBUTE_DECLARATION = 1, + /** + * The object describes an element declaration. + */ + ELEMENT_DECLARATION = 2, + /** + * The object describes a complex type or simple type definition. + */ + TYPE_DEFINITION = 3, + /** + * The object describes an attribute use definition. + */ + ATTRIBUTE_USE = 4, + /** + * The object describes an attribute group definition. + */ + ATTRIBUTE_GROUP_DEFINITION= 5, + /** + * The object describes a model group definition. + */ + MODEL_GROUP_DEFINITION = 6, + /** + * A model group. + */ + MODEL_GROUP = 7, + /** + * The object describes a particle. + */ + PARTICLE = 8, + /** + * The object describes a wildcard. + */ + WILDCARD = 9, + /** + * The object describes an identity constraint definition. + */ + IDENTITY_CONSTRAINT = 10, + /** + * The object describes a notation declaration. + */ + NOTATION_DECLARATION = 11, + /** + * The object describes an annotation. + */ + ANNOTATION = 12, + /** + * The object describes a constraining facet. + */ + FACET = 13, + + /** + * The object describes enumeration/pattern facets. + */ + MULTIVALUE_FACET = 14 + }; + + // Derivation constants + enum DERIVATION_TYPE { + /** + * No constraint is available. + */ + DERIVATION_NONE = 0, + /** + * XSTypeDefinition final set or + * XSElementDeclaration disallowed substitution group. + */ + DERIVATION_EXTENSION = 1, + /** + * XSTypeDefinition final set or + * XSElementDeclaration disallowed substitution group. + */ + DERIVATION_RESTRICTION = 2, + /** + * XSTypeDefinition final set. + */ + DERIVATION_SUBSTITUTION = 4, + /** + * XSTypeDefinition final set. + */ + DERIVATION_UNION = 8, + /** + * XSTypeDefinition final set. + */ + DERIVATION_LIST = 16 + }; + + // Scope + enum SCOPE { + /** + * The scope of a declaration within named model groups or attribute + * groups is absent. The scope of such declaration is + * determined when it is used in the construction of complex type + * definitions. + */ + SCOPE_ABSENT = 0, + /** + * A scope of global identifies top-level declarations. + */ + SCOPE_GLOBAL = 1, + /** + * Locally scoped declarations are available for use only + * within the complex type. + */ + SCOPE_LOCAL = 2 + }; + + // Value Constraint + enum VALUE_CONSTRAINT { + /** + * Indicates that the component does not have any value constraint. + */ + VALUE_CONSTRAINT_NONE = 0, + /** + * Indicates that there is a default value constraint. + */ + VALUE_CONSTRAINT_DEFAULT = 1, + /** + * Indicates that there is a fixed value constraint for this attribute. + */ + VALUE_CONSTRAINT_FIXED = 2 + }; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSConstants(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.cpp new file mode 100644 index 000000000..bb9859a3e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.cpp @@ -0,0 +1,163 @@ +/* + * 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: XSElementDeclaration.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSElementDeclaration: Constructors and Destructor +// --------------------------------------------------------------------------- +XSElementDeclaration::XSElementDeclaration +( + SchemaElementDecl* const schemaElementDecl + , XSTypeDefinition* const typeDefinition + , XSElementDeclaration* const substitutionGroupAffiliation + , XSAnnotation* const annot + , XSNamedMap* const identityConstraints + , XSModel* const xsModel + , XSConstants::SCOPE elemScope + , XSComplexTypeDefinition* const enclosingTypeDefinition + , MemoryManager* const manager +) + : XSObject(XSConstants::ELEMENT_DECLARATION, xsModel, manager) + , fDisallowedSubstitutions(0) + , fSubstitutionGroupExclusions(0) + , fScope(elemScope) + , fSchemaElementDecl(schemaElementDecl) + , fTypeDefinition(typeDefinition) + , fEnclosingTypeDefinition(enclosingTypeDefinition) + , fSubstitutionGroupAffiliation(substitutionGroupAffiliation) + , fAnnotation(annot) + , fIdentityConstraints(identityConstraints) +{ + // set block and final information + // NOTE: rest of setup will be taken care of in construct() + int blockFinalSet = fSchemaElementDecl->getBlockSet(); + if (blockFinalSet) + { + if (blockFinalSet & SchemaSymbols::XSD_EXTENSION) + fDisallowedSubstitutions |= XSConstants::DERIVATION_EXTENSION; + + if (blockFinalSet & SchemaSymbols::XSD_RESTRICTION) + fDisallowedSubstitutions |= XSConstants::DERIVATION_RESTRICTION; + + if (blockFinalSet & SchemaSymbols::XSD_SUBSTITUTION) + fDisallowedSubstitutions |= XSConstants::DERIVATION_SUBSTITUTION; + } + + if (0 != (blockFinalSet = fSchemaElementDecl->getFinalSet())) + { + if (blockFinalSet & SchemaSymbols::XSD_EXTENSION) + fSubstitutionGroupExclusions |= XSConstants::DERIVATION_EXTENSION; + + if (blockFinalSet & SchemaSymbols::XSD_RESTRICTION) + fSubstitutionGroupExclusions |= XSConstants::DERIVATION_RESTRICTION; + } +} + +XSElementDeclaration::~XSElementDeclaration() +{ + // don't delete fTypeDefinition - deleted by XSModel + // don't delete fSubstitutionGroupAffiliation - deleted by XSModel + if (fIdentityConstraints) + delete fIdentityConstraints; +} + +// --------------------------------------------------------------------------- +// XSElementDeclaration: XSObject virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSElementDeclaration::getName() const +{ + return fSchemaElementDecl->getElementName()->getLocalPart(); +} + +const XMLCh *XSElementDeclaration::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fSchemaElementDecl->getURI()); +} + +XSNamespaceItem *XSElementDeclaration::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + + +// --------------------------------------------------------------------------- +// XSElementDeclaration: access methods +// --------------------------------------------------------------------------- +XSConstants::VALUE_CONSTRAINT XSElementDeclaration::getConstraintType() const +{ + if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_FIXED) + return XSConstants::VALUE_CONSTRAINT_FIXED; + + if (fSchemaElementDecl->getDefaultValue()) + return XSConstants::VALUE_CONSTRAINT_DEFAULT; + + return XSConstants::VALUE_CONSTRAINT_NONE; +} + +const XMLCh *XSElementDeclaration::getConstraintValue() +{ + return fSchemaElementDecl->getDefaultValue(); +} + +bool XSElementDeclaration::getNillable() const +{ + if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_NILLABLE) + return true; + + return false; +} + +bool XSElementDeclaration::isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion) +{ + if (fSubstitutionGroupExclusions & exclusion) + return true; + + return false; +} + + +bool XSElementDeclaration::isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed) +{ + if (fDisallowedSubstitutions & disallowed) + return true; + + return false; +} + + +bool XSElementDeclaration::getAbstract() const +{ + if (fSchemaElementDecl->getMiscFlags() & SchemaSymbols::XSD_ABSTRACT) + return true; + + return false; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.hpp new file mode 100644 index 000000000..472219d68 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSElementDeclaration.hpp @@ -0,0 +1,307 @@ +/* + * 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: XSElementDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP) +#define XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Element Declaration + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XSComplexTypeDefinition; +class XSIDCDefinition; +class XSTypeDefinition; +class SchemaElementDecl; + +class XMLPARSER_EXPORT XSElementDeclaration : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param schemaElementDecl + * @param typeDefinition + * @param substitutionGroupAffiliation + * @param annot + * @param identityConstraints + * @param xsModel + * @param elemScope + * @param enclosingTypeDefinition + * @param manager The configurable memory manager + */ + XSElementDeclaration + ( + SchemaElementDecl* const schemaElementDecl + , XSTypeDefinition* const typeDefinition + , XSElementDeclaration* const substitutionGroupAffiliation + , XSAnnotation* const annot + , XSNamedMap* const identityConstraints + , XSModel* const xsModel + , XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT + , XSComplexTypeDefinition* const enclosingTypeDefinition = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSElementDeclaration(); + //@} + + //--------------------- + /** @name overridden XSXSObject methods */ + + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + //@} + + //--------------------- + /** @name XSElementDeclaration methods */ + + //@{ + + /** + * [type definition]: either a simple type definition or a complex type + * definition. + */ + XSTypeDefinition *getTypeDefinition() const; + + /** + * Optional. One of SCOPE_GLOBAL, SCOPE_LOCAL, + * or SCOPE_ABSENT. If the scope is local, then the + * enclosingCTDefinition is present. + */ + XSConstants::SCOPE getScope() const; + + /** + * The complex type definition for locally scoped declarations (see + * scope). + */ + XSComplexTypeDefinition *getEnclosingCTDefinition() const; + + /** + * [Value constraint]: one of VC_NONE, VC_DEFAULT, VC_FIXED. + */ + XSConstants::VALUE_CONSTRAINT getConstraintType() const; + + /** + * [Value constraint]: the actual value with respect to the [type + * definition]. + */ + const XMLCh *getConstraintValue(); + + /** + * If nillable is true, then an element may also be valid if it carries + * the namespace qualified attribute with local name nil + * from namespace http://www.w3.org/2001/XMLSchema-instance + * and value true (xsi:nil) even if it has no text or + * element content despite a content type which would + * otherwise require content. + */ + bool getNillable() const; + + /** + * identity-constraint definitions: a set of constraint definitions. + */ + XSNamedMap *getIdentityConstraints(); + + /** + * [substitution group affiliation]: optional. A top-level element + * definition. + */ + XSElementDeclaration *getSubstitutionGroupAffiliation() const; + + /** + * Convenience method. Check if exclusion is a substitution + * group exclusion for this element declaration. + * @param exclusion + * DERIVATION_EXTENSION, DERIVATION_RESTRICTION or + * DERIVATION_NONE. Represents final set for the element. + * @return True if exclusion is a part of the substitution + * group exclusion subset. + */ + bool isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion); + + /** + * [substitution group exclusions]: the returned value is a bit + * combination of the subset of { + * DERIVATION_EXTENSION, DERIVATION_RESTRICTION} or + * DERIVATION_NONE. + */ + short getSubstitutionGroupExclusions() const; + + /** + * Convenience method. Check if disallowed is a disallowed + * substitution for this element declaration. + * @param disallowed { + * DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION + * } or DERIVATION_NONE. Represents a block set for the + * element. + * @return True if disallowed is a part of the substitution + * group exclusion subset. + */ + bool isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed); + + /** + * [disallowed substitutions]: the returned value is a bit combination of + * the subset of { + * DERIVATION_SUBSTITUTION, DERIVATION_EXTENSION, DERIVATION_RESTRICTION + * } corresponding to substitutions disallowed by this + * XSElementDeclaration or DERIVATION_NONE. + */ + short getDisallowedSubstitutions() const; + + /** + * {abstract} A boolean. + */ + bool getAbstract() const; + + /** + * Optional. Annotation. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + void setTypeDefinition(XSTypeDefinition* typeDefinition); + + //@} +private: + + void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); + friend class XSObjectFactory; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSElementDeclaration(const XSElementDeclaration&); + XSElementDeclaration & operator=(const XSElementDeclaration &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + short fDisallowedSubstitutions; + short fSubstitutionGroupExclusions; + XSConstants::SCOPE fScope; + SchemaElementDecl* fSchemaElementDecl; + XSTypeDefinition* fTypeDefinition; + XSComplexTypeDefinition* fEnclosingTypeDefinition; + XSElementDeclaration* fSubstitutionGroupAffiliation; + XSAnnotation* fAnnotation; + XSNamedMap* fIdentityConstraints; +}; + +inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const +{ + return fTypeDefinition; +} + +inline XSNamedMap* XSElementDeclaration::getIdentityConstraints() +{ + return fIdentityConstraints; +} + +inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const +{ + return fSubstitutionGroupAffiliation; +} + +inline short XSElementDeclaration::getSubstitutionGroupExclusions() const +{ + return fSubstitutionGroupExclusions; +} + +inline short XSElementDeclaration::getDisallowedSubstitutions() const +{ + return fDisallowedSubstitutions; +} + +inline XSAnnotation *XSElementDeclaration::getAnnotation() const +{ + return fAnnotation; +} + +inline XSConstants::SCOPE XSElementDeclaration::getScope() const +{ + return fScope; +} + +inline XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const +{ + return fEnclosingTypeDefinition; +} + +inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* typeDefinition) +{ + fTypeDefinition = typeDefinition; +} + +inline void XSElementDeclaration::setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet) +{ + fEnclosingTypeDefinition = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.cpp new file mode 100644 index 000000000..f46962fb9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.cpp @@ -0,0 +1,49 @@ +/* + * 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: XSFacet.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSFacet: Constructors and Destructor +// --------------------------------------------------------------------------- +XSFacet::XSFacet(XSSimpleTypeDefinition::FACET facetKind, + const XMLCh* const lexicalValue, + bool isFixed, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::FACET, xsModel, manager) + , fFacetKind(facetKind) + , fIsFixed(isFixed) + , fLexicalValue(lexicalValue) + , fAnnotation(annot) +{ +} + +XSFacet::~XSFacet() +{ +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.hpp new file mode 100644 index 000000000..3765fb8a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSFacet.hpp @@ -0,0 +1,151 @@ +/* + * 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: XSFacet.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSFACET_HPP) +#define XERCESC_INCLUDE_GUARD_XSFACET_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This represents all Schema Facet components with the exception + * of Enumeration and Pattern Facets, which are represented by the + * XSMultiValueFacet interface. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; + +class XMLPARSER_EXPORT XSFacet : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param facetKind + * @param lexicalValue + * @param isFixed + * @param annot + * @param xsModel + * @param manager The configurable memory manager + */ + XSFacet + ( + XSSimpleTypeDefinition::FACET facetKind + , const XMLCh* const lexicalValue + , bool isFixed + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSFacet(); + //@} + + //--------------------- + /** @name XSFacet methods */ + + //@{ + + /** + * @return An indication as to the facet's type; see XSSimpleTypeDefinition::FACET + */ + XSSimpleTypeDefinition::FACET getFacetKind() const; + + /** + * @return Returns a value of a constraining facet. + */ + const XMLCh *getLexicalFacetValue() const; + + /** + * Check whether a facet value is fixed. + */ + bool isFixed() const; + + /** + * @return an annotation + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSFacet(const XSFacet&); + XSFacet & operator=(const XSFacet &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XSSimpleTypeDefinition::FACET fFacetKind; + bool fIsFixed; + const XMLCh* fLexicalValue; + XSAnnotation* fAnnotation; +}; + +inline XSSimpleTypeDefinition::FACET XSFacet::getFacetKind() const +{ + return fFacetKind; +} + +inline const XMLCh* XSFacet::getLexicalFacetValue() const +{ + return fLexicalValue; +} + +inline bool XSFacet::isFixed() const +{ + return fIsFixed; +} + +inline XSAnnotation* XSFacet::getAnnotation() const +{ + return fAnnotation; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.cpp new file mode 100644 index 000000000..ac2e5d432 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.cpp @@ -0,0 +1,122 @@ +/* + * 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: XSIDCDefinition.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSIDCDefinition: Constructors and Destructor +// --------------------------------------------------------------------------- +XSIDCDefinition::XSIDCDefinition(IdentityConstraint* const identityConstraint, + XSIDCDefinition* const keyIC, + XSAnnotation* const headAnnot, + StringList* const stringList, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::IDENTITY_CONSTRAINT, xsModel, manager) + , fIdentityConstraint(identityConstraint) + , fKey(keyIC) + , fStringList(stringList) + , fXSAnnotationList(0) +{ + if (headAnnot) + { + fXSAnnotationList = new (manager) RefVectorOf(1, false, manager); + + XSAnnotation* annot = headAnnot; + do + { + fXSAnnotationList->addElement(annot); + annot = annot->getNext(); + } while (annot); + } + +} + +XSIDCDefinition::~XSIDCDefinition() +{ + if (fStringList) + delete fStringList; + + // don't delete fKey - deleted by XSModel + if (fXSAnnotationList) + delete fXSAnnotationList; +} + +// --------------------------------------------------------------------------- +// XSIDCDefinition: XSObject virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSIDCDefinition::getName() const +{ + return fIdentityConstraint->getIdentityConstraintName(); +} + +const XMLCh *XSIDCDefinition::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fIdentityConstraint->getNamespaceURI()); +} + +XSNamespaceItem *XSIDCDefinition::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + +// --------------------------------------------------------------------------- +// XSIDCDefinition: access methods +// --------------------------------------------------------------------------- +XSIDCDefinition::IC_CATEGORY XSIDCDefinition::getCategory() const +{ + switch(fIdentityConstraint->getType()) { + case IdentityConstraint::ICType_UNIQUE: + return IC_UNIQUE; + case IdentityConstraint::ICType_KEY: + return IC_KEY; + case IdentityConstraint::ICType_KEYREF: + return IC_KEYREF; + default: + // REVISIT: + // should never really get here... IdentityConstraint::Unknown is the other + // choice so need a default case for completeness; should issues error? + return IC_KEY; + } +} + +const XMLCh *XSIDCDefinition::getSelectorStr() +{ + return fIdentityConstraint->getSelector()->getXPath()->getExpression(); +} + + +XSAnnotationList *XSIDCDefinition::getAnnotations() +{ + return fXSAnnotationList; +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.hpp new file mode 100644 index 000000000..813eca37f --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSIDCDefinition.hpp @@ -0,0 +1,190 @@ +/* + * 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: XSIDCDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSIDCDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSIDCDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Identity Constraint + * Definition component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class IdentityConstraint; + +class XMLPARSER_EXPORT XSIDCDefinition : public XSObject +{ +public: + + // Identity Constraints + enum IC_CATEGORY { + /** + * + */ + IC_KEY = 1, + /** + * + */ + IC_KEYREF = 2, + /** + * + */ + IC_UNIQUE = 3 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param identityConstraint + * @param keyIC + * @param headAnnot + * @param stringList + * @param xsModel + * @param manager The configurable memory manager + */ + XSIDCDefinition + ( + IdentityConstraint* const identityConstraint + , XSIDCDefinition* const keyIC + , XSAnnotation* const headAnnot + , StringList* const stringList + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSIDCDefinition(); + //@} + + //--------------------- + /** @name overridden XSXSObject methods */ + + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + //@} + + //--------------------- + /** @name XSIDCDefinition methods */ + + //@{ + + /** + * [identity-constraint category]: one of IC_KEY, IC_KEYREF or IC_UNIQUE. + */ + IC_CATEGORY getCategory() const; + + /** + * [selector]: a restricted XPath expression. + */ + const XMLCh *getSelectorStr(); + + /** + * [fields]: a non-empty list of restricted XPath ([XPath]) expressions. + */ + StringList *getFieldStrs(); + + /** + * [referenced key]: required if [identity-constraint category] is IC_KEYREF, + * forbidden otherwise (when an identity-constraint definition with [ + * identity-constraint category] equal to IC_KEY or IC_UNIQUE). + */ + XSIDCDefinition *getRefKey() const; + + /** + * A set of [annotations]. + */ + XSAnnotationList *getAnnotations(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSIDCDefinition(const XSIDCDefinition&); + XSIDCDefinition & operator=(const XSIDCDefinition &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + IdentityConstraint* fIdentityConstraint; + XSIDCDefinition* fKey; + StringList* fStringList; + XSAnnotationList* fXSAnnotationList; +}; + + +inline StringList* XSIDCDefinition::getFieldStrs() +{ + return fStringList; +} + +inline XSIDCDefinition* XSIDCDefinition::getRefKey() const +{ + return fKey; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModel.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModel.cpp new file mode 100644 index 000000000..6b55a4f9e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModel.cpp @@ -0,0 +1,799 @@ +/* + * 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: XSModel.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSModel: Constructors and Destructor +// --------------------------------------------------------------------------- +XSModel::XSModel( XMLGrammarPool *grammarPool + , MemoryManager* const manager) + : fMemoryManager(manager) + , fNamespaceStringList(0) + , fXSNamespaceItemList(0) + , fURIStringPool(0) + , fXSAnnotationList(0) + , fHashNamespace(0) + , fObjFactory(0) + , fDeleteNamespace(0) + , fParent(0) + , fDeleteParent(false) + , fAddedS4SGrammar(false) +{ + fURIStringPool = grammarPool->getURIStringPool(); + fObjFactory = new (fMemoryManager) XSObjectFactory(manager); + + // Populate XSNamedMaps by going through the components + for (XMLSize_t i=0; i + ( + 20, // size + 29, // modulus + fURIStringPool, + false, // adoptElems + fMemoryManager + ); + break; + default: + // ATTRIBUTE_USE + // MODEL_GROUP + // PARTICLE + // IDENTITY_CONSTRAINT + // WILDCARD + // ANNOTATION + // FACET + // MULTIVALUE + fComponentMap[i] = 0; + break; + } + fIdVector[i] = new (fMemoryManager) RefVectorOf(30, false, fMemoryManager); + } + + fNamespaceStringList = new (manager) RefArrayVectorOf (10, true, manager); + fXSNamespaceItemList = new (manager) RefVectorOf (10, true, manager); + fXSAnnotationList = new (manager) RefVectorOf (10, false, manager); + fHashNamespace = new (manager) RefHashTableOf (11, false, manager); + + // Loop through all grammars in the grammar pool to create the XSNamespaceItem's + // which will have access to Annotation Information which can be used later when + // we create all the XS components. + XSNamespaceItem* namespaceItem = 0; + RefHashTableOfEnumerator grammarEnum = grammarPool->getGrammarEnumerator(); + while (grammarEnum.hasMoreElements()) + { + SchemaGrammar& sGrammar = (SchemaGrammar&) grammarEnum.nextElement(); + if (sGrammar.getGrammarType() != Grammar::SchemaGrammarType || + XMLString::equals(sGrammar.getTargetNamespace(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) + continue; + + // NOTE: In the grammarpool, preprocessed grammars without targetnamespace + // will use an empty string... + XMLCh* NameSpace = XMLString::replicate(sGrammar.getTargetNamespace(), manager); + fNamespaceStringList->addElement(NameSpace); + namespaceItem = new (manager) XSNamespaceItem(this, &sGrammar, manager); + fXSNamespaceItemList->addElement(namespaceItem); + fHashNamespace->put(NameSpace, namespaceItem); + } + + // Now loop through all of the NamespaceItem's + // First, we add S4S namespace (irrespective of whether we have any grammars) + namespaceItem = new (manager) XSNamespaceItem + ( + this, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, manager + ); + + fNamespaceStringList->addElement + ( + XMLString::replicate(SchemaSymbols::fgURI_SCHEMAFORSCHEMA,manager) + ); + fXSNamespaceItemList->addElement(namespaceItem); + fHashNamespace->put + ( + (void*) SchemaSymbols::fgURI_SCHEMAFORSCHEMA + , namespaceItem + ); + + DatatypeValidatorFactory dvFactory(manager); + addS4SToXSModel + ( + namespaceItem + , dvFactory.getBuiltInRegistry() + ); + // don't include S4S (thus the -1) + XMLSize_t numberOfNamespaces = fXSNamespaceItemList->size() -1; + for (XMLSize_t j = 0; j < numberOfNamespaces; j++) + addGrammarToXSModel(fXSNamespaceItemList->elementAt(j)); +} + +XSModel::XSModel( XSModel *baseModel + , GrammarResolver *grammarResolver + , MemoryManager* const manager) + : fMemoryManager(manager) + , fNamespaceStringList(0) + , fXSNamespaceItemList(0) + , fURIStringPool(0) + , fXSAnnotationList(0) + , fHashNamespace(0) + , fObjFactory(0) + , fDeleteNamespace(0) + , fParent(baseModel) + , fDeleteParent(true) + , fAddedS4SGrammar(false) +{ + fURIStringPool = grammarResolver->getStringPool(); + fObjFactory = new (manager) XSObjectFactory(manager); + + XMLSize_t i; + // Populate XSNamedMaps by going through the components + for (i=0; i + ( + 20, // size + 29, // modulus + fURIStringPool, + false, // adoptElems + fMemoryManager + ); + break; + default: + // ATTRIBUTE_USE + // MODEL_GROUP + // PARTICLE + // IDENTITY_CONSTRAINT + // WILDCARD + // ANNOTATION + // FACET + // MULTIVALUE + fComponentMap[i] = 0; + break; + } + fIdVector[i] = new (fMemoryManager) RefVectorOf(30, false, fMemoryManager); + } + + fNamespaceStringList = new (manager) RefArrayVectorOf (10, true, manager); + fXSNamespaceItemList = new (manager) RefVectorOf (10, false, manager); + fDeleteNamespace = new (manager) RefVectorOf (10, true, manager); + fXSAnnotationList = new (manager) RefVectorOf (10, false, manager); + fHashNamespace = new (manager) RefHashTableOf (11, false, manager); + + if (fParent) + { + if (fParent->fAddedS4SGrammar) + fAddedS4SGrammar = true; + + // Need to copy information from parent so it can be returned in this object... + for (i=0; ifXSNamespaceItemList->size(); i++) + { + XSNamespaceItem* namespaceItem = fParent->fXSNamespaceItemList->elementAt(i); + fXSNamespaceItemList->addElement(namespaceItem); + fNamespaceStringList->addElement + ( + XMLString::replicate + ( + namespaceItem->getSchemaNamespace(), manager + ) + ); + } + + for (i=0; ifComponentMap[i]->getLength(); j++) + { + XSObject* copyObj = fParent->fComponentMap[i]->item(j); + fComponentMap[i]->addElement(copyObj, + copyObj->getName(), + copyObj->getNamespace()); + } + break; + } + for (XMLSize_t j=0; jfIdVector[i]->size(); j++) + { + fIdVector[i]->addElement(fParent->fIdVector[i]->elementAt(j)); + } + } + + for (i=0; ifXSAnnotationList->size(); i++) + { + fXSAnnotationList->addElement(fParent->fXSAnnotationList->elementAt(i)); + } + + } // end of copying parent info + + // Now add information from the new grammars but first create the + // XSNamespaceItem's so we can have access to the XSAnnotations... + ValueVectorOf* grammarsToAdd = grammarResolver->getGrammarsToAddToXSModel(); + XMLSize_t numberOfNamespaces = fXSNamespaceItemList->size(); + XMLSize_t numberOfNamespacesToAdd = 0; + for (i=0; i < grammarsToAdd->size(); i++) + { + SchemaGrammar* lGrammar = grammarsToAdd->elementAt(i); + if (lGrammar->getGrammarType() != Grammar::SchemaGrammarType || + XMLString::equals(lGrammar->getTargetNamespace(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) + continue; + + XMLCh* NameSpace = XMLString::replicate(lGrammar->getTargetNamespace(), manager); + fNamespaceStringList->addElement(NameSpace); + + XSNamespaceItem* namespaceItem = new (manager) XSNamespaceItem(this, lGrammar, manager); + fXSNamespaceItemList->addElement(namespaceItem); + fHashNamespace->put(NameSpace, namespaceItem); + fDeleteNamespace->addElement(namespaceItem); + ++numberOfNamespacesToAdd; + } + + // Add S4S namespace if needed + if (!fAddedS4SGrammar) + { + DatatypeValidatorFactory dvFactory(manager); + + XSNamespaceItem* namespaceItem = new (manager) XSNamespaceItem + ( + this, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, manager + ); + + fNamespaceStringList->addElement + ( + XMLString::replicate(SchemaSymbols::fgURI_SCHEMAFORSCHEMA,manager) + ); + fXSNamespaceItemList->addElement(namespaceItem); + fHashNamespace->put + ( + (void*) SchemaSymbols::fgURI_SCHEMAFORSCHEMA , namespaceItem + ); + fDeleteNamespace->addElement(namespaceItem); + addS4SToXSModel + ( + namespaceItem + , dvFactory.getBuiltInRegistry() + ); + } + + // Now loop through all of the newly created NamespaceItem's + for (i=numberOfNamespaces; i<(numberOfNamespaces+numberOfNamespacesToAdd); i++) + { + addGrammarToXSModel(fXSNamespaceItemList->elementAt(i)); + } // end of namespaceItem loop +} + +XSModel::~XSModel() +{ + for (XMLSize_t i=0; ifDeleteParent) + delete fParent; +} + +// --------------------------------------------------------------------------- +// XSModel: Helper methods +// --------------------------------------------------------------------------- +void XSModel::addComponentToIdVector(XSObject* const component, + XMLSize_t componentIndex) +{ + component->setId(fIdVector[componentIndex]->size()); + fIdVector[componentIndex]->addElement(component); +} + + +void XSModel::addComponentToNamespace(XSNamespaceItem* const namespaceItem, + XSObject* const component, + XMLSize_t componentIndex, + bool addToXSModel) +{ + namespaceItem->fComponentMap[componentIndex]->addElement + ( + component, component->getName(), namespaceItem->getSchemaNamespace() + ); + namespaceItem->fHashMap[componentIndex]->put + ( + (void *) component->getName(), component + ); + + if (addToXSModel) + { + fComponentMap[componentIndex]->addElement + ( + component, component->getName(), namespaceItem->getSchemaNamespace() + ); + } +} + +void +XSModel::addS4SToXSModel(XSNamespaceItem* const namespaceItem, + RefHashTableOf* const builtInDV) +{ + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind + ( + ComplexTypeInfo::getAnyType + ( + fURIStringPool->getId(XMLUni::fgZeroLenString) + ) + , this + ) + , XSConstants::TYPE_DEFINITION - 1 + ); + + // Loop through built-in simple types + // First add 'anySimpleType' which is the base for the other built-ins + DatatypeValidator* dv = builtInDV->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind(dv, this, true) + , XSConstants::TYPE_DEFINITION - 1 + ); + + // add remaining built-in + RefHashTableOfEnumerator simpleEnum = + RefHashTableOfEnumerator (builtInDV, false, fMemoryManager); + while (simpleEnum.hasMoreElements()) + { + DatatypeValidator& curSimple = simpleEnum.nextElement(); + if (&curSimple == dv) + continue; + + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind(&curSimple, this) + , XSConstants::TYPE_DEFINITION - 1 + ); + } + + // Set flag to indicate that we have added S4S grammar info + fAddedS4SGrammar = true; +} + + +void XSModel::addGrammarToXSModel(XSNamespaceItem* namespaceItem) +{ + // Loop through top-level attribute declarations in the grammar... + RefHashTableOf* attDeclRegistry = namespaceItem->fGrammar->getAttributeDeclRegistry(); + if(attDeclRegistry) { + RefHashTableOfEnumerator attrEnum = RefHashTableOfEnumerator (attDeclRegistry, false, fMemoryManager); + while (attrEnum.hasMoreElements()) + { + XSAttributeDeclaration* xsAttrDecl = fObjFactory->addOrFind + ( + (SchemaAttDef*) &(attrEnum.nextElement()), this + ); + + addComponentToNamespace + ( + namespaceItem, xsAttrDecl, XSConstants::ATTRIBUTE_DECLARATION - 1 + ); + } // end of attribute loop + } + + // Loop through top-level elements in the grammar... + RefHash3KeysIdPoolEnumerator elemEnum = namespaceItem->fGrammar->getElemEnumerator(); + while (elemEnum.hasMoreElements()) + { + SchemaElementDecl& curElem = elemEnum.nextElement(); + if (curElem.getEnclosingScope() == Grammar::TOP_LEVEL_SCOPE) + { + XSElementDeclaration* xsElemDecl = fObjFactory->addOrFind + ( + &curElem, this + ); + + addComponentToNamespace + ( + namespaceItem, xsElemDecl, XSConstants::ELEMENT_DECLARATION -1 + ); + } + } // end of element loop + + // Now loop through top-level User Defined simple type definitions in the grammar... + DVHashTable* dvHT = namespaceItem->fGrammar->getDatatypeRegistry()->getUserDefinedRegistry(); + if (dvHT) + { + RefHashTableOfEnumerator simpleUserEnum = RefHashTableOfEnumerator (dvHT, false, fMemoryManager); + while (simpleUserEnum.hasMoreElements()) + { + DatatypeValidator& curSimple = simpleUserEnum.nextElement(); + if (!curSimple.getAnonymous()) + { + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind(&curSimple, this) + , XSConstants::TYPE_DEFINITION - 1 + ); + } + } // end of simple User loop + } + + // Loop through top-level COMPLEX type definitions in the grammar... + RefHashTableOf* complexTypeRegistry = namespaceItem->fGrammar->getComplexTypeRegistry(); + if(complexTypeRegistry) { + RefHashTableOfEnumerator complexEnum = RefHashTableOfEnumerator (complexTypeRegistry, false, fMemoryManager); + while (complexEnum.hasMoreElements()) + { + ComplexTypeInfo& curComplex = complexEnum.nextElement(); + if (!curComplex.getAnonymous()) + { + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind(&curComplex, this) + , XSConstants::TYPE_DEFINITION - 1 + ); + } + } // end of type definition loop + } + + // Loop through top-level attribute group definitions in the grammar... + RefHashTableOf* attGroupInfoRegistry = namespaceItem->fGrammar->getAttGroupInfoRegistry(); + if(attGroupInfoRegistry) { + RefHashTableOfEnumerator attrGroupEnum = RefHashTableOfEnumerator (attGroupInfoRegistry, false, fMemoryManager); + while (attrGroupEnum.hasMoreElements()) + { + addComponentToNamespace + ( + namespaceItem + , fObjFactory->createXSAttGroupDefinition + ( + &(attrGroupEnum.nextElement()), this + ) + , XSConstants::ATTRIBUTE_GROUP_DEFINITION - 1 + ); + } // end of attribute group loop + } + + // Loop through top-level model group definitions in the grammar... + RefHashTableOf* groupInfoRegistry = namespaceItem->fGrammar->getGroupInfoRegistry(); + if(groupInfoRegistry) { + RefHashTableOfEnumerator modelGroupEnum = RefHashTableOfEnumerator (groupInfoRegistry, false, fMemoryManager); + while (modelGroupEnum.hasMoreElements()) + { + addComponentToNamespace + ( + namespaceItem + , fObjFactory->createXSModelGroupDefinition + ( + &(modelGroupEnum.nextElement()), this + ) + , XSConstants::MODEL_GROUP_DEFINITION - 1 + ); + } // end of model group loop + } + + // Loop through notations in the grammar... + NameIdPoolEnumerator notationEnum = namespaceItem->fGrammar->getNotationEnumerator(); + while (notationEnum.hasMoreElements()) + { + addComponentToNamespace + ( + namespaceItem + , fObjFactory->addOrFind(&(notationEnum.nextElement()), this) + , XSConstants::NOTATION_DECLARATION - 1 + ); + } // end of notation loop + + // Loop through annotations in the grammar... + // As annotations are already created as XSAnnotations no need to create them + // or store them in the XercesToXSMap. + XSAnnotation* annot = namespaceItem->fGrammar->getAnnotation(); + while (annot) + { + fXSAnnotationList->addElement(annot); + namespaceItem->fXSAnnotationList->addElement(annot); + addComponentToIdVector(annot, XSConstants::ANNOTATION -1); + annot = annot->getNext(); + } // end of annotation loop +} + + + + +// --------------------------------------------------------------------------- +// XSModel: Access methods +// --------------------------------------------------------------------------- +/** + * [schema components]: a list of top-level components, i.e. element + * declarations, attribute declarations, etc. + * @param objectType The type of the declaration, i.e. + * ELEMENT_DECLARATION, + * TYPE_DEFINITION and any other component type that + * may be a property of a schema component. + * @return A list of top-level definition of the specified type in + * objectType or null. + */ +XSNamedMap *XSModel::getComponents(XSConstants::COMPONENT_TYPE objectType) +{ + return fComponentMap[objectType -1]; +} + +/** + * Convenience method. Returns a list of top-level component declarations + * that are defined within the specified namespace, i.e. element + * declarations, attribute declarations, etc. + * @param objectType The type of the declaration, i.e. + * ELEMENT_DECLARATION. + * @param compNamespace The namespace to which declaration belong or + * null (for components with no target namespace). + * @return A list of top-level definitions of the specified type in + * objectType and defined in the specified + * namespace or null. + */ +XSNamedMap *XSModel::getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType, + const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getComponents(objectType); + + return 0; +} + +/** + * [annotations]: a set of annotations. + */ +XSAnnotationList *XSModel::getAnnotations() +{ + return fXSAnnotationList; +} + +/** + * Convenience method. Returns a top-level element declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level element declaration or null if such + * declaration does not exist. + */ +XSElementDeclaration *XSModel::getElementDeclaration(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getElementDeclaration(name); + + return 0; +} + +/** + * Convenience method. Returns a top-level attribute declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level attribute declaration or null if such + * declaration does not exist. + */ +XSAttributeDeclaration *XSModel::getAttributeDeclaration(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getAttributeDeclaration(name); + + return 0; +} + +/** + * Convenience method. Returns a top-level simple or complex type + * definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return An XSTypeDefinition or null if such + * definition does not exist. + */ +XSTypeDefinition *XSModel::getTypeDefinition(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getTypeDefinition(name); + + return 0; +} + +/** + * Convenience method. Returns a top-level attribute group definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level attribute group definition or null if + * such definition does not exist. + */ +XSAttributeGroupDefinition *XSModel::getAttributeGroup(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getAttributeGroup(name); + + return 0; +} + +/** + * Convenience method. Returns a top-level model group definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level model group definition definition or + * null if such definition does not exist. + */ +XSModelGroupDefinition *XSModel::getModelGroupDefinition(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getModelGroupDefinition(name); + + return 0; +} + +/** + * Convenience method. Returns a top-level notation declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level notation declaration or null if such + * declaration does not exist. + */ +XSNotationDeclaration *XSModel::getNotationDeclaration(const XMLCh *name + , const XMLCh *compNamespace) +{ + XSNamespaceItem* namespaceItem; + if (compNamespace) + namespaceItem = getNamespaceItem(compNamespace); + else + namespaceItem = getNamespaceItem(XMLUni::fgZeroLenString); + + if (namespaceItem) + return namespaceItem->getNotationDeclaration(name); + + return 0; +} + +/** + * Optional. Return a component given a component type and a unique Id. + * May not be supported for all component types. + * @param compId unique Id of the component within its type + * @param compType type of the component + * @return the component of the given type with the given Id, or 0 + * if no such component exists or this is unsupported for + * this type of component. + */ +XSObject *XSModel::getXSObjectById(XMLSize_t compId + , XSConstants::COMPONENT_TYPE compType) +{ + if (compId < fIdVector[compType -1]->size()) + return fIdVector[compType -1]->elementAt(compId); + + return 0; +} + +XSNamespaceItem* XSModel::getNamespaceItem(const XMLCh* const key) +{ + XSNamespaceItem* xsName = fHashNamespace->get(key); + if (xsName) + return xsName; + if (fParent) + return fParent->getNamespaceItem(key); + return 0; +} + +XSObject* XSModel::getXSObject(void* key) +{ + XSObject* xsObj = fObjFactory->getObjectFromMap(key); + + if (!xsObj && fParent) + xsObj = fParent->getXSObject(key); + + return xsObj; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModel.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModel.hpp new file mode 100644 index 000000000..c1cd63a76 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModel.hpp @@ -0,0 +1,338 @@ +/* + * 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: XSModel.hpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_XSMODEL_HPP + +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class contains all properties of the Schema infoitem as determined + * after an entire validation episode. That is, it contains all the properties + * of all the Schema Namespace Information objects that went into + * the validation episode. + * Since it is not like other components, it does not + * inherit from the XSObject interface. + * This is *always* owned by the validator /parser object from which + * it is obtained. It is designed to be subclassed; subclasses will + * specify under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class Grammar; +class XMLGrammarPool; +class XSAnnotation; +class XSAttributeDeclaration; +class XSAttributeGroupDefinition; +class XSElementDeclaration; +class XSModelGroupDefinition; +class XSNamespaceItem; +class XSNotationDeclaration; +class XSTypeDefinition; +class XSObjectFactory; + +class XMLPARSER_EXPORT XSModel : public XMemory +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The constructor to be used when a grammar pool contains all needed info + * @param grammarPool the grammar pool containing the underlying data structures + * @param manager The configurable memory manager + */ + XSModel( XMLGrammarPool *grammarPool + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * The constructor to be used when the XSModel must represent all + * components in the union of an existing XSModel and a newly-created + * Grammar(s) from the GrammarResolver + * + * @param baseModel the XSModel upon which this one is based + * @param grammarResolver the grammar(s) whose components are to be merged + * @param manager The configurable memory manager + */ + XSModel( XSModel *baseModel + , GrammarResolver *grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@}; + + /** @name Destructor */ + //@{ + ~XSModel(); + //@} + + //--------------------- + /** @name XSModel methods */ + + //@{ + + /** + * Convenience method. Returns a list of all namespaces that belong to + * this schema. The value null is not a valid namespace + * name, but if there are components that don't have a target namespace, + * null is included in this list. + */ + StringList *getNamespaces(); + + /** + * A set of namespace schema information information items ( of type + * XSNamespaceItem), one for each namespace name which + * appears as the target namespace of any schema component in the schema + * used for that assessment, and one for absent if any schema component + * in the schema had no target namespace. For more information see + * schema information. + */ + XSNamespaceItemList *getNamespaceItems(); + + /** + * [schema components]: a list of top-level components, i.e. element + * declarations, attribute declarations, etc. + * @param objectType The type of the declaration, i.e. + * ELEMENT_DECLARATION, + * TYPE_DEFINITION and any other component type that + * may be a property of a schema component. + * @return A list of top-level definition of the specified type in + * objectType or null. + */ + XSNamedMap *getComponents(XSConstants::COMPONENT_TYPE objectType); + + /** + * Convenience method. Returns a list of top-level component declarations + * that are defined within the specified namespace, i.e. element + * declarations, attribute declarations, etc. + * @param objectType The type of the declaration, i.e. + * ELEMENT_DECLARATION. + * @param compNamespace The namespace to which declaration belongs or + * null (for components with no target namespace). + * @return A list of top-level definitions of the specified type in + * objectType and defined in the specified + * namespace or null. + */ + XSNamedMap *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType, + const XMLCh *compNamespace); + + /** + * [annotations]: a set of annotations. + */ + XSAnnotationList *getAnnotations(); + + /** + * Convenience method. Returns a top-level element declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level element declaration or null if such + * declaration does not exist. + */ + XSElementDeclaration *getElementDeclaration(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Convenience method. Returns a top-level attribute declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level attribute declaration or null if such + * declaration does not exist. + */ + XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Convenience method. Returns a top-level simple or complex type + * definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return An XSTypeDefinition or null if such + * definition does not exist. + */ + XSTypeDefinition *getTypeDefinition(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Convenience method. Returns a top-level attribute group definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level attribute group definition or null if + * such definition does not exist. + */ + XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Convenience method. Returns a top-level model group definition. + * @param name The name of the definition. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level model group definition definition or + * null if such definition does not exist. + */ + XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Convenience method. Returns a top-level notation declaration. + * @param name The name of the declaration. + * @param compNamespace The namespace of the declaration, null if absent. + * @return A top-level notation declaration or null if such + * declaration does not exist. + */ + XSNotationDeclaration *getNotationDeclaration(const XMLCh *name + , const XMLCh *compNamespace); + + /** + * Optional. Return a component given a component type and a unique Id. + * May not be supported for all component types. + * @param compId unique Id of the component within its type + * @param compType type of the component + * @return the component of the given type with the given Id, or 0 + * if no such component exists or this is unsupported for + * this type of component. + */ + XSObject *getXSObjectById(XMLSize_t compId, + XSConstants::COMPONENT_TYPE compType); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + XMLStringPool* getURIStringPool(); + + XSNamespaceItem* getNamespaceItem(const XMLCh* const key); + + /** + * Get the XSObject (i.e. XSElementDeclaration) that corresponds to + * to a schema grammar component (i.e. SchemaElementDecl) + * @param key schema component object + * + * @return the corresponding XSObject + */ + XSObject* getXSObject(void* key); + + //@} +private: + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void addGrammarToXSModel + ( + XSNamespaceItem* namespaceItem + ); + void addS4SToXSModel + ( + XSNamespaceItem* const namespaceItem + , RefHashTableOf* const builtInDV + ); + void addComponentToNamespace + ( + XSNamespaceItem* const namespaceItem + , XSObject* const component + , XMLSize_t componentIndex + , bool addToXSModel = true + ); + + void addComponentToIdVector + ( + XSObject* const component + , XMLSize_t componentIndex + ); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSModel(const XSModel&); + XSModel & operator=(const XSModel &); + +protected: + friend class XSObjectFactory; + friend class XSObject; + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fMemoryManager: + // used for any memory allocations + MemoryManager* const fMemoryManager; + + StringList* fNamespaceStringList; + XSNamespaceItemList* fXSNamespaceItemList; + + RefVectorOf* fIdVector[XSConstants::MULTIVALUE_FACET]; + + /* Need a XSNamedMap for each component top-level? + ATTRIBUTE_DECLARATION = 1, + ELEMENT_DECLARATION = 2, + TYPE_DEFINITION = 3, + ATTRIBUTE_USE = 4, no + ATTRIBUTE_GROUP_DEFINITION= 5, + MODEL_GROUP_DEFINITION = 6, + MODEL_GROUP = 7, no + PARTICLE = 8, no + WILDCARD = 9, no + IDENTITY_CONSTRAINT = 10, no + NOTATION_DECLARATION = 11, + ANNOTATION = 12, no + FACET = 13, no + MULTIVALUE_FACET = 14 no + */ + XSNamedMap* fComponentMap[XSConstants::MULTIVALUE_FACET]; + XMLStringPool* fURIStringPool; + XSAnnotationList* fXSAnnotationList; + RefHashTableOf* fHashNamespace; + XSObjectFactory* fObjFactory; + RefVectorOf* fDeleteNamespace; + XSModel* fParent; + bool fDeleteParent; + bool fAddedS4SGrammar; +}; + +inline XMLStringPool* XSModel::getURIStringPool() +{ + return fURIStringPool; +} + +inline StringList *XSModel::getNamespaces() +{ + return fNamespaceStringList; +} + +inline XSNamespaceItemList *XSModel::getNamespaceItems() +{ + return fXSNamespaceItemList; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.cpp new file mode 100644 index 000000000..d4087cd29 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.cpp @@ -0,0 +1,50 @@ +/* + * 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: XSModelGroup.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSModelGroup: Constructors and Destructor +// --------------------------------------------------------------------------- +XSModelGroup::XSModelGroup(COMPOSITOR_TYPE compositorType, + XSParticleList* const particleList, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager * const manager) + : XSObject(XSConstants::MODEL_GROUP, xsModel, manager) + , fCompositorType(compositorType) + , fParticleList(particleList) + , fAnnotation(annot) +{ +} + +XSModelGroup::~XSModelGroup() +{ + if (fParticleList) + delete fParticleList; +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.hpp new file mode 100644 index 000000000..cac1d709f --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroup.hpp @@ -0,0 +1,156 @@ +/* + * 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: XSModelGroup.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSMODELGROUP_HPP) +#define XERCESC_INCLUDE_GUARD_XSMODELGROUP_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Model Group + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XSParticle; + +class XMLPARSER_EXPORT XSModelGroup : public XSObject +{ +public: + + // Content model compositors + enum COMPOSITOR_TYPE { + /** + * This constant value signifies a sequence operator. + */ + COMPOSITOR_SEQUENCE = 1, + /** + * This constant value signifies a choice operator. + */ + COMPOSITOR_CHOICE = 2, + /** + * This content model represents a simplified version of the SGML + * &-Connector and is limited to the top-level of any content model. + * No element in the all content model may appear more than once. + */ + COMPOSITOR_ALL = 3 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param compositorType + * @param particleList + * @param annot + * @param xsModel + * @param manager The configurable memory manager + */ + XSModelGroup + ( + COMPOSITOR_TYPE compositorType + , XSParticleList* const particleList + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSModelGroup(); + //@} + + //--------------------- + /** @name XSModelGroup methods */ + //@{ + + /** + * [compositor]: one of all, choice or sequence. The valid constants + * values are: + * COMPOSITOR_SEQUENCE, COMPOSITOR_CHOICE, COMPOSITOR_ALL. + */ + COMPOSITOR_TYPE getCompositor() const; + + /** + * A list of [particles]. + */ + XSParticleList *getParticles() const; + + /** + * Optional. An [annotation]. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSModelGroup(const XSModelGroup&); + XSModelGroup & operator=(const XSModelGroup &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + COMPOSITOR_TYPE fCompositorType; + XSParticleList* fParticleList; + XSAnnotation* fAnnotation; +}; + +inline XSModelGroup::COMPOSITOR_TYPE XSModelGroup::getCompositor() const +{ + return fCompositorType; +} + +inline XSParticleList* XSModelGroup::getParticles() const +{ + return fParticleList; +} + +inline XSAnnotation* XSModelGroup::getAnnotation() const +{ + return fAnnotation; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp new file mode 100644 index 000000000..c184b67fc --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.cpp @@ -0,0 +1,83 @@ +/* + * 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: XSModelGroupDefinition.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: Constructors and Destructors +// --------------------------------------------------------------------------- +XSModelGroupDefinition::XSModelGroupDefinition(XercesGroupInfo* const groupInfo, + XSParticle* const groupParticle, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::MODEL_GROUP_DEFINITION, xsModel, manager) + , fGroupInfo(groupInfo) + , fModelGroupParticle(groupParticle) + , fAnnotation(annot) +{ +} + +XSModelGroupDefinition::~XSModelGroupDefinition() +{ + if (fModelGroupParticle) // Not owned by XSModel + delete fModelGroupParticle; +} + +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: XSModel virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSModelGroupDefinition::getName() const +{ + return fXSModel->getURIStringPool()->getValueForId(fGroupInfo->getNameId()); +} + +const XMLCh *XSModelGroupDefinition::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fGroupInfo->getNamespaceId()); +} + +XSNamespaceItem *XSModelGroupDefinition::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + +// --------------------------------------------------------------------------- +// XSModelGroupDefinition: access methods +// --------------------------------------------------------------------------- +XSModelGroup* XSModelGroupDefinition::getModelGroup() +{ + if (fModelGroupParticle) + return fModelGroupParticle->getModelGroupTerm(); + + return 0; +} + + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp new file mode 100644 index 000000000..ce249e378 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSModelGroupDefinition.hpp @@ -0,0 +1,150 @@ +/* + * 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: XSModelGroupDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSMODELGROUPDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSMODELGROUPDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Model Group + * Definition component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XSModelGroup; +class XSParticle; +class XercesGroupInfo; + +class XMLPARSER_EXPORT XSModelGroupDefinition : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param groupInfo + * @param groupParticle + * @param annot + * @param xsModel + * @param manager The configurable memory manager + */ + XSModelGroupDefinition + ( + XercesGroupInfo* const groupInfo + , XSParticle* const groupParticle + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSModelGroupDefinition(); + //@} + + //--------------------- + /** @name overridden XSXSObject methods */ + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + //@} + + //--------------------- + /** @name XSModelGroupDefinition methods */ + + //@{ + + /** + * A model group. + */ + XSModelGroup *getModelGroup(); + + /** + * Optional. An [annotation]. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSModelGroupDefinition(const XSModelGroupDefinition&); + XSModelGroupDefinition & operator=(const XSModelGroupDefinition &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XercesGroupInfo* fGroupInfo; + XSParticle* fModelGroupParticle; + XSAnnotation* fAnnotation; +}; + +inline XSAnnotation* XSModelGroupDefinition::getAnnotation() const +{ + return fAnnotation; +} + + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.cpp new file mode 100644 index 000000000..a3148647f --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.cpp @@ -0,0 +1,64 @@ +/* + * 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: XSMultiValueFacet.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSMultiValueFacet: Constructors and Destructors +// --------------------------------------------------------------------------- +XSMultiValueFacet::XSMultiValueFacet(XSSimpleTypeDefinition::FACET facetKind, + StringList* lexicalValues, + bool isFixed, + XSAnnotation* const headAnnot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::MULTIVALUE_FACET, xsModel, manager) + , fFacetKind(facetKind) + , fIsFixed(isFixed) + , fLexicalValues(lexicalValues) + , fXSAnnotationList(0) +{ + if (headAnnot) + { + fXSAnnotationList = new (manager) RefVectorOf(1, false, manager); + + XSAnnotation* annot = headAnnot; + do + { + fXSAnnotationList->addElement(annot); + annot = annot->getNext(); + } while (annot); + } +} + +XSMultiValueFacet::~XSMultiValueFacet() +{ + if (fXSAnnotationList) + delete fXSAnnotationList; +} + + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.hpp new file mode 100644 index 000000000..37de670db --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSMultiValueFacet.hpp @@ -0,0 +1,152 @@ +/* + * 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: XSMultiValueFacet.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSMULTIVALUEFACET_HPP) +#define XERCESC_INCLUDE_GUARD_XSMULTIVALUEFACET_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class represents all Schema Facets which may possess multiple + * lexical values/annotations (i.e., Pattern and Enumeration facets). + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; + +class XMLPARSER_EXPORT XSMultiValueFacet : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param facetKind + * @param lexicalValues + * @param isFixed + * @param headAnnot + * @param xsModel + * @param manager The configurable memory manager + */ + XSMultiValueFacet + ( + XSSimpleTypeDefinition::FACET facetKind + , StringList* lexicalValues + , bool isFixed + , XSAnnotation* const headAnnot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSMultiValueFacet(); + //@} + + //--------------------- + /** @name XSMultiValueFacet methods */ + + //@{ + + /** + * @return An indication as to the facet's type; see XSSimpleTypeDefinition::FACET + */ + XSSimpleTypeDefinition::FACET getFacetKind() const; + + /** + * @return Returns the values of a constraining facet. + */ + StringList *getLexicalFacetValues(); + + /** + * Check whether a facet value is fixed. + */ + bool isFixed() const; + + /** + * @return the annotations belonging to this facet's values + */ + XSAnnotationList *getAnnotations(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSMultiValueFacet(const XSMultiValueFacet&); + XSMultiValueFacet & operator=(const XSMultiValueFacet &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XSSimpleTypeDefinition::FACET fFacetKind; + bool fIsFixed; + StringList* fLexicalValues; // not owned by this class + XSAnnotationList* fXSAnnotationList; +}; + + +inline XSSimpleTypeDefinition::FACET XSMultiValueFacet::getFacetKind() const +{ + return fFacetKind; +} + +inline bool XSMultiValueFacet::isFixed() const +{ + return fIsFixed; +} + +inline StringList *XSMultiValueFacet::getLexicalFacetValues() +{ + return fLexicalValues; +} + +inline XSAnnotationList *XSMultiValueFacet::getAnnotations() +{ + return fXSAnnotationList; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.c b/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.c new file mode 100644 index 000000000..f0e606fc1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.c @@ -0,0 +1,124 @@ +/* + * 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: XSNamedMap.c 674012 2008-07-04 11:18:21Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSNamedMap: Constructors and Destructor +// --------------------------------------------------------------------------- +template +XSNamedMap::XSNamedMap(const XMLSize_t maxElems, + const XMLSize_t modulus, + XMLStringPool* uriStringPool, + const bool adoptElems, + MemoryManager* const manager) + : fMemoryManager(manager) + , fURIStringPool(uriStringPool) +{ + // allow one of the Vector or Hash to own the data... but not both... + fVector = new (manager) RefVectorOf (maxElems, false, manager); + fHash = new (manager) RefHash2KeysTableOf (modulus, adoptElems, manager); +} +template XSNamedMap::~XSNamedMap() +{ + delete fVector; + delete fHash; +} + + +/** + * The number of XSObjects in the XSObjectList. + * The range of valid child object indices is 0 to + * mapLength-1 inclusive. + */ +template +XMLSize_t XSNamedMap::getLength() const +{ + return fVector->size(); +} + +/** + * Returns the indexth item in the collection. The index + * starts at 0. If index is greater than or equal to the + * number of objects in the list, this returns null. + * @param index index into the collection. + * @return The XSObject at the indexth + * position in the XSObjectList, or null if + * that is not a valid index. + */ +template +TVal* XSNamedMap::item(XMLSize_t index) +{ + if (index >= fVector->size()) + { + return 0; + } + return fVector->elementAt(index); +} + +template +const TVal* XSNamedMap::item(XMLSize_t index) const +{ + if (index >= fVector->size()) + { + return 0; + } + return fVector->elementAt(index); +} + +/** + * Retrieves a component specified by local name and namespace URI. + *
applications must use the value null as the + * compNamespace parameter for components whose targetNamespace property + * is absent. + * @param compNamespace The namespace URI of the component to retrieve. + * @param localName The local name of the component to retrieve. + * @return A component (of any type) with the specified local + * name and namespace URI, or null if they do not + * identify any node in this map. + */ +template +TVal *XSNamedMap::itemByName(const XMLCh *compNamespace, + const XMLCh *localName) +{ + return fHash->get((void*)localName, fURIStringPool->getId(compNamespace)); +} + + +template +void XSNamedMap::addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2) +{ + fVector->addElement(toAdd); + fHash->put((void*)key1, fURIStringPool->getId(key2), toAdd); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.hpp new file mode 100644 index 000000000..899df915b --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNamedMap.hpp @@ -0,0 +1,138 @@ +/* + * 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: XSNamedMap.hpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP) +#define XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP + + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLStringPool; + +/* + * This template provides convenient mappings between name,namespace + * pairs and individual components, as well as means to iterate through all the + * named components on some object. + */ + +template class XSNamedMap: public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + XSNamedMap(const XMLSize_t maxElems, + const XMLSize_t modulus, + XMLStringPool* uriStringPool, + const bool adoptElems, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Destructor */ + //@{ + ~XSNamedMap(); + + //@} + + // ----------------------------------------------------------------------- + // XSNamedMap methods + // ----------------------------------------------------------------------- + /** @name XSNamedMap methods */ + //@{ + + /** + * The number of XSObjects in the XSObjectList. + * The range of valid child object indices is 0 to + * mapLength-1 inclusive. + */ + XMLSize_t getLength() const; + + /** + * Returns the indexth item in the collection. The index + * starts at 0. If index is greater than or equal to the + * number of objects in the list, this returns null. + * @param index index into the collection. + * @return The XSObject at the indexth + * position in the XSObjectList, or null if + * that is not a valid index. + */ + TVal *item(XMLSize_t index); + const TVal *item(XMLSize_t index) const; + + /** + * Retrieves a component specified by local name and namespace URI. + *
applications must use the value null as the + * compNamespace parameter for components whose targetNamespace property + * is absent. + * @param compNamespace The namespace URI of the component to retrieve. + * @param localName The local name of the component to retrieve. + * @return A component (of any type) with the specified local + * name and namespace URI, or null if they do not + * identify any node in this map. + */ + TVal *itemByName(const XMLCh *compNamespace, + const XMLCh *localName); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + void addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2); + //@} + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSNamedMap(const XSNamedMap&); + XSNamedMap& operator=(const XSNamedMap&); + + // ----------------------------------------------------------------------- + // Data members + // + // fMemoryManager + // manager used to allocate memory needed by this object + MemoryManager *const fMemoryManager; + XMLStringPool* fURIStringPool; + RefVectorOf* fVector; + RefHash2KeysTableOf* fHash; +}; + + + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.cpp new file mode 100644 index 000000000..24538a63b --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.cpp @@ -0,0 +1,218 @@ +/* + * 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: XSNamespaceItem.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSNamespaceItem: Constructors and Destructors +// --------------------------------------------------------------------------- +XSNamespaceItem::XSNamespaceItem(XSModel* const xsModel, + SchemaGrammar* const grammar, + MemoryManager* const manager) + : fMemoryManager(manager) + , fGrammar(grammar) + , fXSModel(xsModel) + , fXSAnnotationList(0) + , fSchemaNamespace(grammar->getTargetNamespace()) +{ + // Populate XSNamedMaps by going through the components + for (XMLSize_t i=0; i + ( + 20, // size + 29, // modulus + fXSModel->getURIStringPool(), + false, // adoptElems + fMemoryManager + ); + fHashMap[i] = new (fMemoryManager) RefHashTableOf + ( + 29, + false, + fMemoryManager + ); + break; + default: + // ATTRIBUTE_USE + // MODEL_GROUP + // PARTICLE + // IDENTITY_CONSTRAINT + // WILDCARD + // ANNOTATION + // FACET + // MULTIVALUE + fComponentMap[i] = 0; + fHashMap[i] = 0; + break; + } + } + + fXSAnnotationList = new (manager) RefVectorOf (5, false, manager); +} + +XSNamespaceItem::XSNamespaceItem(XSModel* const xsModel, + const XMLCh* const schemaNamespace, + MemoryManager* const manager) + : fMemoryManager(manager) + , fGrammar(0) + , fXSModel(xsModel) + , fXSAnnotationList(0) + , fSchemaNamespace(schemaNamespace) +{ + // Populate XSNamedMaps by going through the components + for (XMLSize_t i=0; i + ( + 20, // size + 29, // modulus + fXSModel->getURIStringPool(), + false, // adoptElems + fMemoryManager + ); + fHashMap[i] = new (fMemoryManager) RefHashTableOf + ( + 29, + false, + fMemoryManager + ); + break; + default: + // ATTRIBUTE_USE + // MODEL_GROUP + // PARTICLE + // IDENTITY_CONSTRAINT + // WILDCARD + // ANNOTATION + // FACET + // MULTIVALUE + fComponentMap[i] = 0; + fHashMap[i] = 0; + break; + } + } + + fXSAnnotationList = new (manager) RefVectorOf (5, false, manager); +} + +XSNamespaceItem::~XSNamespaceItem() +{ + for (XMLSize_t i=0; i *XSNamespaceItem::getComponents(XSConstants::COMPONENT_TYPE objectType) +{ + return fComponentMap[objectType -1]; +} + +XSElementDeclaration *XSNamespaceItem::getElementDeclaration(const XMLCh *name) +{ + if (name) + return (XSElementDeclaration*) fHashMap[XSConstants::ELEMENT_DECLARATION -1]->get(name); + return 0; +} + +XSAttributeDeclaration *XSNamespaceItem::getAttributeDeclaration(const XMLCh *name) +{ + if (name) + return (XSAttributeDeclaration*) fHashMap[XSConstants::ATTRIBUTE_DECLARATION -1]->get(name); + return 0; +} + +XSTypeDefinition *XSNamespaceItem::getTypeDefinition(const XMLCh *name) +{ + if (name) + return (XSTypeDefinition*) fHashMap[XSConstants::TYPE_DEFINITION -1]->get(name); + return 0; +} + +XSAttributeGroupDefinition *XSNamespaceItem::getAttributeGroup(const XMLCh *name) +{ + if (name) + return (XSAttributeGroupDefinition*) fHashMap[XSConstants::ATTRIBUTE_GROUP_DEFINITION -1]->get(name); + return 0; +} + +XSModelGroupDefinition *XSNamespaceItem::getModelGroupDefinition(const XMLCh *name) +{ + if (name) + return (XSModelGroupDefinition*) fHashMap[XSConstants::MODEL_GROUP_DEFINITION -1]->get(name); + return 0; +} + +XSNotationDeclaration *XSNamespaceItem::getNotationDeclaration(const XMLCh *name) +{ + if (name) + return (XSNotationDeclaration*) fHashMap[XSConstants::NOTATION_DECLARATION -1]->get(name); + return 0; +} + +const StringList *XSNamespaceItem::getDocumentLocations() +{ + if (fGrammar) + return ((XMLSchemaDescriptionImpl*) fGrammar->getGrammarDescription())->getLocationHints(); + + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.hpp new file mode 100644 index 000000000..bfc63779c --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNamespaceItem.hpp @@ -0,0 +1,245 @@ +/* + * 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: XSNamespaceItem.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP) +#define XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class contains all properties of the Schema Namespace Information infoitem. + * These items correspond to the result of processing a schema document + * and all its included/redefined schema documents. It corresponds to the + * schema component discussed in the schema specifications, but since it + * is not like other components does not inherit from the XSObject interface. + * This is *always* owned by the validator /parser object from which + * it is obtained. It is designed to be subclassed; subclasses will + * specify under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class XSAnnotation; +class XSAttributeDeclaration; +class XSAttributeGroupDefinition; +class XSElementDeclaration; +class XSModelGroupDefinition; +class XSNotationDeclaration; +class XSTypeDefinition; +class SchemaGrammar; +class XSModel; + +class XMLPARSER_EXPORT XSNamespaceItem : public XMemory +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param xsModel + * @param grammar + * @param manager The configurable memory manager + */ + XSNamespaceItem + ( + XSModel* const xsModel + , SchemaGrammar* const grammar + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XSNamespaceItem + ( + XSModel* const xsModel + , const XMLCh* const schemaNamespace + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSNamespaceItem(); + //@} + + //--------------------- + /** @name XSNamespaceItem methods */ + + //@{ + + /** + * [schema namespace]: A namespace name or null + * corresponding to the target namespace of the schema document. + */ + const XMLCh *getSchemaNamespace() const; + + /** + * [schema components]: a list of top-level components, i.e. element + * declarations, attribute declarations, etc. + * @param objectType The type of the declaration, i.e. + * ELEMENT_DECLARATION, + * TYPE_DEFINITION and any other component type that + * may be a property of a schema component. + * @return A list of top-level definition of the specified type in + * objectType or null. + */ + XSNamedMap *getComponents(XSConstants::COMPONENT_TYPE objectType); + + /** + * [annotations]: a set of annotations. + */ + XSAnnotationList *getAnnotations(); + const XSAnnotationList *getAnnotations() const; + + /** + * Convenience method. Returns a top-level element declaration. + * @param name The name of the declaration. + * @return A top-level element declaration or null if such + * declaration does not exist. + */ + XSElementDeclaration *getElementDeclaration(const XMLCh *name); + + /** + * Convenience method. Returns a top-level attribute declaration. + * @param name The name of the declaration. + * @return A top-level attribute declaration or null if such + * declaration does not exist. + */ + XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name); + + /** + * Convenience method. Returns a top-level simple or complex type + * definition. + * @param name The name of the definition. + * @return An XSTypeDefinition or null if such + * definition does not exist. + */ + XSTypeDefinition *getTypeDefinition(const XMLCh *name); + + /** + * Convenience method. Returns a top-level attribute group definition. + * @param name The name of the definition. + * @return A top-level attribute group definition or null if + * such definition does not exist. + */ + XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name); + + /** + * Convenience method. Returns a top-level model group definition. + * @param name The name of the definition. + * @return A top-level model group definition definition or + * null if such definition does not exist. + */ + XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name); + + /** + * Convenience method. Returns a top-level notation declaration. + * @param name The name of the declaration. + * @return A top-level notation declaration or null if such + * declaration does not exist. + */ + XSNotationDeclaration *getNotationDeclaration(const XMLCh *name); + + /** + * [document location] - a list of locations URI for the documents that + * contributed to the XSModel. + */ + const StringList *getDocumentLocations(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSNamespaceItem(const XSNamespaceItem&); + XSNamespaceItem & operator=(const XSNamespaceItem &); + +protected: + friend class XSModel; + friend class XSObjectFactory; + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fMemoryManager: + // used for any memory allocations + MemoryManager* const fMemoryManager; + SchemaGrammar* fGrammar; + XSModel* fXSModel; + + /* Need a XSNamedMap for each component top-level? + that is top level. + ATTRIBUTE_DECLARATION = 1, + ELEMENT_DECLARATION = 2, + TYPE_DEFINITION = 3, + ATTRIBUTE_USE = 4, no + ATTRIBUTE_GROUP_DEFINITION= 5, + MODEL_GROUP_DEFINITION = 6, + MODEL_GROUP = 7, no + PARTICLE = 8, no + WILDCARD = 9, no + IDENTITY_CONSTRAINT = 10, no + NOTATION_DECLARATION = 11, + ANNOTATION = 12, no + FACET = 13, no + MULTIVALUE_FACET = 14 no + */ + XSNamedMap* fComponentMap[XSConstants::MULTIVALUE_FACET]; + XSAnnotationList* fXSAnnotationList; + RefHashTableOf* fHashMap[XSConstants::MULTIVALUE_FACET]; + const XMLCh* fSchemaNamespace; +}; + +inline XSAnnotationList* XSNamespaceItem::getAnnotations() +{ + return fXSAnnotationList; +} + +inline const XSAnnotationList* XSNamespaceItem::getAnnotations() const +{ + return fXSAnnotationList; +} + +inline const XMLCh *XSNamespaceItem::getSchemaNamespace() const +{ + return fSchemaNamespace; +} + + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.cpp new file mode 100644 index 000000000..a6a5b371c --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.cpp @@ -0,0 +1,83 @@ +/* + * 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: XSNotationDeclaration.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSNotationDeclaration: Constructors and Destructors +// --------------------------------------------------------------------------- +XSNotationDeclaration::XSNotationDeclaration +( + XMLNotationDecl* const xmlNotationDecl + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager * const manager +) + : XSObject(XSConstants::NOTATION_DECLARATION, xsModel, manager) + , fXMLNotationDecl(xmlNotationDecl) + , fAnnotation(annot) +{ +} + +XSNotationDeclaration::~XSNotationDeclaration() +{ +} + +// --------------------------------------------------------------------------- +// XSNotationDeclaration: XSModel virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSNotationDeclaration::getName() const +{ + return fXMLNotationDecl->getName(); +} + +const XMLCh *XSNotationDeclaration::getNamespace() +{ + return fXSModel->getURIStringPool()->getValueForId(fXMLNotationDecl->getNameSpaceId()); +} + +XSNamespaceItem *XSNotationDeclaration::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + + +// --------------------------------------------------------------------------- +// XSNotationDeclaration: access methods +// --------------------------------------------------------------------------- +const XMLCh *XSNotationDeclaration::getSystemId() +{ + return fXMLNotationDecl->getSystemId(); +} + +const XMLCh *XSNotationDeclaration::getPublicId() +{ + return fXMLNotationDecl->getPublicId(); +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.hpp new file mode 100644 index 000000000..6ea267db8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSNotationDeclaration.hpp @@ -0,0 +1,154 @@ +/* + * 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: XSNotationDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSNOTATIONDECLARATION_HPP) +#define XERCESC_INCLUDE_GUARD_XSNOTATIONDECLARATION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Notation Declaration + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class XMLNotationDecl; + +class XMLPARSER_EXPORT XSNotationDeclaration : public XSObject +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param xmlNotationDecl + * @param annot + * @param xsModel + * @param manager The configurable memory manager + */ + XSNotationDeclaration + ( + XMLNotationDecl* const xmlNotationDecl + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSNotationDeclaration(); + //@} + + //--------------------- + /** @name overridden XSXSObject methods */ + + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + //@} + + //--------------------- + /** @name XSNotationDeclaration methods */ + + //@{ + + /** + * The URI reference representing the system identifier for the notation + * declaration, if present, null otherwise. + */ + const XMLCh *getSystemId(); + + /** + * The string representing the public identifier for this notation + * declaration, if present; null otherwise. + */ + const XMLCh *getPublicId(); + + /** + * Optional. An [annotation]. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSNotationDeclaration(const XSNotationDeclaration&); + XSNotationDeclaration & operator=(const XSNotationDeclaration &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + XMLNotationDecl* fXMLNotationDecl; + XSAnnotation* fAnnotation; +}; + +inline XSAnnotation* XSNotationDeclaration::getAnnotation() const +{ + return fAnnotation; +} + + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSObject.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSObject.cpp new file mode 100644 index 000000000..c602914a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSObject.cpp @@ -0,0 +1,76 @@ +/* + * 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: XSObject.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSObject: Constructors and Destructor +// --------------------------------------------------------------------------- +XSObject::XSObject(XSConstants::COMPONENT_TYPE compType, + XSModel* const xsModel, + MemoryManager* const manager) + : fComponentType(compType) + , fXSModel(xsModel) + , fMemoryManager(manager) + , fId(0) +{ + if (xsModel) + { + xsModel->addComponentToIdVector(this, compType-1); + } +} + +XSObject::~XSObject() +{ +} + +// --------------------------------------------------------------------------- +// XSObject: Virtual interface methods +// --------------------------------------------------------------------------- +const XMLCh *XSObject::getName() const +{ + return 0; +} + +const XMLCh *XSObject::getNamespace() +{ + return 0; +} + +XSNamespaceItem *XSObject::getNamespaceItem() +{ + return 0; +} + +XMLSize_t XSObject::getId() const +{ + return fId; +} + +void XSObject::setId(XMLSize_t id) +{ + fId = id; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSObject.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSObject.hpp new file mode 100644 index 000000000..4e6061105 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSObject.hpp @@ -0,0 +1,152 @@ +/* + * 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: XSObject.hpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSOBJECT_HPP) +#define XERCESC_INCLUDE_GUARD_XSOBJECT_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The XSObject forms the base of the Schema Component Model. It contains + * all properties common to the majority of XML Schema components. + * This is *always* owned by the validator /parser object from which + * it is obtained. It is designed to be subclassed; subclasses will + * specify under what conditions it may be relied upon to have meaningful contents. + */ + +// forward declarations +class XSNamespaceItem; +class XSModel; + +class XMLPARSER_EXPORT XSObject : public XMemory +{ +public: + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param compType + * @param xsModel + * @param manager The configurable memory manager + */ + XSObject + ( + XSConstants::COMPONENT_TYPE compType + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + virtual ~XSObject(); + //@} + + //--------------------- + /** @name XSObject methods */ + + //@{ + + /** + * The type of this object, i.e. + * ELEMENT_DECLARATION. + */ + XSConstants::COMPONENT_TYPE getType() const; + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + virtual const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + virtual const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + virtual XSNamespaceItem *getNamespaceItem(); + + /** + * Optional. Return a unique identifier for a component within this XSModel, to + * optimize querying. May not be defined for all types of component. + * @return id unique for this type of component within this XSModel or 0 + * to indicate that this is not supported for this type of component. + */ + virtual XMLSize_t getId() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + /** + * Set the id to be returned on getId(). + */ + void setId(XMLSize_t id); + //@} + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSObject(const XSObject&); + XSObject & operator=(const XSObject &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fMemoryManager: + // used for any memory allocations + // fComponentType + // the type of the actual component + XSConstants::COMPONENT_TYPE fComponentType; + XSModel* fXSModel; + MemoryManager* fMemoryManager; + XMLSize_t fId; +}; + +inline XSConstants::COMPONENT_TYPE XSObject::getType() const +{ + return fComponentType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.cpp new file mode 100644 index 000000000..85a8f9b8e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.cpp @@ -0,0 +1,81 @@ +/* + * 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: XSParticle.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSParticle: Constructors and Destructor +// --------------------------------------------------------------------------- +XSParticle::XSParticle(TERM_TYPE termType, + XSModel* const xsModel, + XSObject* const particleTerm, + XMLSize_t minOccurs, + XMLSize_t maxOccurs, + bool unbounded, + MemoryManager* const manager) + : XSObject(XSConstants::PARTICLE, xsModel, manager) + , fTermType(termType) + , fMinOccurs(minOccurs) + , fMaxOccurs(maxOccurs) + , fUnbounded (unbounded) + , fTerm(particleTerm) +{ +} + +XSParticle::~XSParticle() +{ + if (fTerm && (fTermType == TERM_MODELGROUP)) + delete ((XSModelGroup*) fTerm); +} + +// --------------------------------------------------------------------------- +// XSParticle: methods +// --------------------------------------------------------------------------- +XSElementDeclaration *XSParticle::getElementTerm() +{ + if (fTermType == TERM_ELEMENT) + return (XSElementDeclaration*) fTerm; + + return 0; +} + +XSModelGroup *XSParticle::getModelGroupTerm() +{ + if (fTermType == TERM_MODELGROUP) + return (XSModelGroup*) fTerm; + + return 0; +} + +XSWildcard *XSParticle::getWildcardTerm() +{ + if (fTermType == TERM_WILDCARD) + return (XSWildcard*) fTerm; + + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.hpp new file mode 100644 index 000000000..4481c2d7a --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSParticle.hpp @@ -0,0 +1,198 @@ +/* + * 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: XSParticle.hpp 883665 2009-11-24 11:41:38Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP) +#define XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Particle + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSElementDeclaration; +class XSModelGroup; +class XSWildcard; + +class XMLPARSER_EXPORT XSParticle : public XSObject +{ +public: + + // possible terms of this particle + enum TERM_TYPE { + /* + * an empty particle + */ + TERM_EMPTY = 0, + /* + * the particle has element content + */ + TERM_ELEMENT = XSConstants::ELEMENT_DECLARATION, + /* + * the particle's content is a model group + */ + TERM_MODELGROUP = XSConstants::MODEL_GROUP_DEFINITION, + /* + * the particle's content is a wildcard + */ + TERM_WILDCARD = XSConstants::WILDCARD + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param termType + * @param xsModel + * @param particleTerm + * @param minOccurs + * @param maxOccurs + * @param unbounded + * @param manager The configurable memory manager + */ + XSParticle + ( + TERM_TYPE termType + , XSModel* const xsModel + , XSObject* const particleTerm + , XMLSize_t minOccurs + , XMLSize_t maxOccurs + , bool unbounded + , MemoryManager* const manager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSParticle(); + //@} + + //--------------------- + /** @name XSParticle methods */ + //@{ + + /** + * [min occurs]: determines the minimum number of terms that can occur. + */ + XMLSize_t getMinOccurs() const; + + /** + * [max occurs] determines the maximum number of terms that can occur. To + * query for value of unbounded use maxOccursUnbounded. + */ + XMLSize_t getMaxOccurs() const; + + /** + * [max occurs] whether the maxOccurs value is unbounded. + */ + bool getMaxOccursUnbounded() const; + + /** + * Returns the type of the [term]: one of + * TERM_EMPTY, TERM_ELEMENT, TERM_MODELGROUP, or TERM_WILDCARD. + */ + TERM_TYPE getTermType() const; + + /** + * If this particle has an [element declaration] for its term, + * this method returns that declaration; otherwise, it returns 0. + * @returns The element declaration that is the [term] of this Particle + * if and only if getTermType() == TERM_ELEMENT. + */ + XSElementDeclaration *getElementTerm(); + + /** + * If this particle has a [model group] for its term, + * this method returns that definition; otherwise, it returns 0. + * @returns The model group that is the [term] of this Particle + * if and only if getTermType() == TERM_MODELGROUP. + */ + XSModelGroup *getModelGroupTerm(); + + /** + * If this particle has an [wildcard] for its term, + * this method returns that declaration; otherwise, it returns 0. + * @returns The wildcard declaration that is the [term] of this Particle + * if and only if getTermType() == TERM_WILDCARD. + */ + XSWildcard *getWildcardTerm(); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSParticle(const XSParticle&); + XSParticle & operator=(const XSParticle &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + TERM_TYPE fTermType; + XMLSize_t fMinOccurs; + XMLSize_t fMaxOccurs; + bool fUnbounded; + XSObject* fTerm; +}; + +inline XMLSize_t XSParticle::getMinOccurs() const +{ + return fMinOccurs; +} + +inline XMLSize_t XSParticle::getMaxOccurs() const +{ + return fMaxOccurs; +} + +inline bool XSParticle::getMaxOccursUnbounded() const +{ + return fUnbounded; +} + +inline XSParticle::TERM_TYPE XSParticle::getTermType() const +{ + return fTermType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp new file mode 100644 index 000000000..bc53ead99 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp @@ -0,0 +1,249 @@ +/* + * 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: XSSimpleTypeDefinition.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local, static functions +// --------------------------------------------------------------------------- +static bool XSSimpleTypeDefinitionTestFlag(int flag) +{ + if (flag) + return true; + return false; +} + + +// --------------------------------------------------------------------------- +// XSSimpleTypeDefinition: Constructors and Destructors +// --------------------------------------------------------------------------- +XSSimpleTypeDefinition::XSSimpleTypeDefinition +( + DatatypeValidator* const datatypeValidator + , VARIETY stVariety + , XSTypeDefinition* const xsBaseType + , XSSimpleTypeDefinition* const primitiveOrItemType + , XSSimpleTypeDefinitionList* const memberTypes + , XSAnnotation* headAnnot + , XSModel* const xsModel + , MemoryManager* const manager +) + : XSTypeDefinition(SIMPLE_TYPE, xsBaseType, xsModel, manager) + , fDefinedFacets(0) + , fFixedFacets(0) + , fVariety(stVariety) + , fDatatypeValidator(datatypeValidator) + , fXSFacetList(0) + , fXSMultiValueFacetList(0) + , fPatternList(0) + , fPrimitiveOrItemType(primitiveOrItemType) + , fMemberTypes(memberTypes) + , fXSAnnotationList(0) +{ + int finalset = fDatatypeValidator->getFinalSet(); + if (finalset) + { + if (finalset & SchemaSymbols::XSD_EXTENSION) + fFinal |= XSConstants::DERIVATION_EXTENSION; + + if (finalset & SchemaSymbols::XSD_RESTRICTION) + fFinal |= XSConstants::DERIVATION_RESTRICTION; + + if (finalset & SchemaSymbols::XSD_LIST) + fFinal |= XSConstants::DERIVATION_LIST; + + if (finalset & SchemaSymbols::XSD_UNION) + fFinal |= XSConstants::DERIVATION_UNION; + } + + if (headAnnot) + { + XSAnnotation* annot = headAnnot; + + fXSAnnotationList = new (manager) RefVectorOf(3, false, manager); + do + { + fXSAnnotationList->addElement(annot); + annot = annot->getNext(); + } while (annot); + } +} + +XSSimpleTypeDefinition::~XSSimpleTypeDefinition() +{ + if (fXSFacetList) + delete fXSFacetList; + + if (fXSMultiValueFacetList) + delete fXSMultiValueFacetList; + + if (fPatternList) + delete fPatternList; + + // don't delete fPrimitiveOrItemType -> deleted by XSModel + if (fMemberTypes) + delete fMemberTypes; + + if (fXSAnnotationList) + delete fXSAnnotationList; +} + + +// --------------------------------------------------------------------------- +// XSSimpleTypeDefinition: access methods +// --------------------------------------------------------------------------- +bool XSSimpleTypeDefinition::isDefinedFacet(FACET facetName) +{ + return XSSimpleTypeDefinitionTestFlag(fDefinedFacets & facetName); +} + +bool XSSimpleTypeDefinition::isFixedFacet(FACET facetName) +{ + return XSSimpleTypeDefinitionTestFlag(fFixedFacets & facetName); +} + +const XMLCh *XSSimpleTypeDefinition::getLexicalFacetValue(FACET facetName) +{ + XMLSize_t size = fXSFacetList->size(); + for (XMLSize_t i=0; ielementAt(i))->getFacetKind()) == facetName) + return (fXSFacetList->elementAt(i))->getLexicalFacetValue(); + } + return 0; +} + +StringList *XSSimpleTypeDefinition::getLexicalEnumeration() +{ + return (RefArrayVectorOf*) fDatatypeValidator->getEnumString(); +} + +XSSimpleTypeDefinition::ORDERING XSSimpleTypeDefinition::getOrdered() const +{ + return fDatatypeValidator->getOrdered(); +} + +bool XSSimpleTypeDefinition::getFinite() const +{ + return fDatatypeValidator->getFinite(); +} + +bool XSSimpleTypeDefinition::getBounded() const +{ + return fDatatypeValidator->getBounded(); +} + +bool XSSimpleTypeDefinition::getNumeric() const +{ + return fDatatypeValidator->getNumeric(); +} + + +// --------------------------------------------------------------------------- +// XSSimpleTypeDefinition: virtual methods +// --------------------------------------------------------------------------- +const XMLCh *XSSimpleTypeDefinition::getName() const +{ + return fDatatypeValidator->getTypeLocalName(); +} + +const XMLCh *XSSimpleTypeDefinition::getNamespace() +{ + return fDatatypeValidator->getTypeUri(); +} + +XSNamespaceItem *XSSimpleTypeDefinition::getNamespaceItem() +{ + return fXSModel->getNamespaceItem(getNamespace()); +} + +bool XSSimpleTypeDefinition::getAnonymous() const +{ + return fDatatypeValidator->getAnonymous(); +} + +XSTypeDefinition *XSSimpleTypeDefinition::getBaseType() +{ + return fBaseType; +} + +bool XSSimpleTypeDefinition::derivedFromType(const XSTypeDefinition * const ancestorType) +{ + if (!ancestorType) + return false; + + XSTypeDefinition* type; + + if (ancestorType->getTypeCategory() == XSTypeDefinition::COMPLEX_TYPE) + { + type = (XSTypeDefinition*) ancestorType; + if (ancestorType == type->getBaseType()) + { + // ancestor is anytype + return true; + } + return false; + } + + type = this; + XSTypeDefinition* lastType = 0; // anysimple type has a base type of anytype + // anytype has a basetype of anytype so will have infinite loop... + + while (type && (type != ancestorType) && (type != lastType)) + { + lastType = type; + type = type->getBaseType(); + } + + return (type == ancestorType); +} + +// --------------------------------------------------------------------------- +// XSSimpleTypeDefinition: helper methods +// --------------------------------------------------------------------------- +void XSSimpleTypeDefinition::setFacetInfo +( + int definedFacets + , int fixedFacets + , XSFacetList* const xsFacetList + , XSMultiValueFacetList* const xsMultiValueFacetList + , StringList* const patternList +) +{ + fDefinedFacets = definedFacets; + fFixedFacets = fixedFacets; + fXSFacetList = xsFacetList; + fXSMultiValueFacetList = xsMultiValueFacetList; + fPatternList = patternList; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.hpp new file mode 100644 index 000000000..44997ff79 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSSimpleTypeDefinition.hpp @@ -0,0 +1,458 @@ +/* + * 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: XSSimpleTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class represents a simpleType definition + * schema component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + * + */ + +// forward declarations +class XSAnnotation; +class XSFacet; +class XSMultiValueFacet; +class DatatypeValidator; + +class XMLPARSER_EXPORT XSSimpleTypeDefinition : public XSTypeDefinition +{ +public: + + // Variety definitions + enum VARIETY { + /** + * The variety is absent for the anySimpleType definition. + */ + VARIETY_ABSENT = 0, + /** + * Atomic type. + */ + VARIETY_ATOMIC = 1, + /** + * List type. + */ + VARIETY_LIST = 2, + /** + * Union type. + */ + VARIETY_UNION = 3 + }; + + // Facets + enum FACET { + /** + * No facets defined. + */ + FACET_NONE = 0, + /** + * 4.3.1 Length + */ + FACET_LENGTH = 1, + /** + * 4.3.2 minLength. + */ + FACET_MINLENGTH = 2, + /** + * 4.3.3 maxLength. + */ + FACET_MAXLENGTH = 4, + /** + * 4.3.4 pattern. + */ + FACET_PATTERN = 8, + /** + * 4.3.5 whitespace. + */ + FACET_WHITESPACE = 16, + /** + * 4.3.7 maxInclusive. + */ + FACET_MAXINCLUSIVE = 32, + /** + * 4.3.9 maxExclusive. + */ + FACET_MAXEXCLUSIVE = 64, + /** + * 4.3.9 minExclusive. + */ + FACET_MINEXCLUSIVE = 128, + /** + * 4.3.10 minInclusive. + */ + FACET_MININCLUSIVE = 256, + /** + * 4.3.11 totalDigits . + */ + FACET_TOTALDIGITS = 512, + /** + * 4.3.12 fractionDigits. + */ + FACET_FRACTIONDIGITS = 1024, + /** + * 4.3.5 enumeration. + */ + FACET_ENUMERATION = 2048 + }; + + // possible order relations + enum ORDERING { + /** + * A constant defined for the 'ordered' fundamental facet: Not ordered. + */ + ORDERED_FALSE = 0, + /** + * A constant defined for the 'ordered' fundamental facet: partially + * ordered. + */ + ORDERED_PARTIAL = 1, + /** + * A constant defined for the 'ordered' fundamental facet: total ordered. + */ + ORDERED_TOTAL = 2 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param datatypeValidator + * @param stVariety + * @param xsBaseType + * @param primitiveOrItemType + * @param memberTypes + * @param headAnnot + * @param xsModel + * @param manager The configurable memory manager + */ + XSSimpleTypeDefinition + ( + DatatypeValidator* const datatypeValidator + , VARIETY stVariety + , XSTypeDefinition* const xsBaseType + , XSSimpleTypeDefinition* const primitiveOrItemType + , XSSimpleTypeDefinitionList* const memberTypes + , XSAnnotation* headAnnot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + ~XSSimpleTypeDefinition(); + //@} + + //--------------------- + /** @name XSSimpleTypeDefinition methods */ + + //@{ + + /** + * [variety]: one of {atomic, list, union} or absent + */ + VARIETY getVariety() const; + + /** + * If variety is atomic the primitive type definition (a + * built-in primitive datatype definition or the simple ur-type + * definition) is available, otherwise null. + */ + XSSimpleTypeDefinition *getPrimitiveType(); + + /** + * If variety is list the item type definition (an atomic or + * union simple type definition) is available, otherwise + * null. + */ + XSSimpleTypeDefinition *getItemType(); + + /** + * If variety is union the list of member type definitions (a + * non-empty sequence of simple type definitions) is available, + * otherwise null. + */ + XSSimpleTypeDefinitionList *getMemberTypes() const; + + /** + * [facets]: get all facets defined on this type. The value is a bit + * combination of FACET_XXX constants of all defined facets. + */ + int getDefinedFacets() const; + + /** + * Convenience method. [Facets]: check whether a facet is defined on this + * type. + * @param facetName The name of the facet. + * @return True if the facet is defined, false otherwise. + */ + bool isDefinedFacet(FACET facetName); + + /** + * [facets]: get all facets defined and fixed on this type. + */ + int getFixedFacets() const; + + /** + * Convenience method. [Facets]: check whether a facet is defined and + * fixed on this type. + * @param facetName The name of the facet. + * @return True if the facet is fixed, false otherwise. + */ + bool isFixedFacet(FACET facetName); + + /** + * Convenience method. Returns a value of a single constraining facet for + * this simple type definition. This method must not be used to retrieve + * values for enumeration and pattern facets. + * @param facetName The name of the facet, i.e. + * FACET_LENGTH, FACET_TOTALDIGITS (see + * XSConstants).To retrieve value for pattern or + * enumeration, see enumeration and pattern. + * @return A value of the facet specified in facetName for + * this simple type definition or null. + */ + const XMLCh *getLexicalFacetValue(FACET facetName); + + /** + * Returns a list of enumeration values. + */ + StringList *getLexicalEnumeration(); + + /** + * Returns a list of pattern values. + */ + StringList *getLexicalPattern(); + + /** + * Fundamental Facet: ordered + */ + ORDERING getOrdered() const; + + /** + * Fundamental Facet: cardinality. + */ + bool getFinite() const; + + /** + * Fundamental Facet: bounded. + */ + bool getBounded() const; + + /** + * Fundamental Facet: numeric. + */ + bool getNumeric() const; + + /** + * Optional. A set of [annotation]s. + */ + XSAnnotationList *getAnnotations(); + /** + * @return list of constraining facets. + * This method must not be used to retrieve + * values for enumeration and pattern facets. + */ + XSFacetList *getFacets(); + + /** + * @return list of enumeration and pattern facets. + */ + XSMultiValueFacetList *getMultiValueFacets(); + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + const XMLCh* getName() const; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + const XMLCh* getNamespace(); + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + XSNamespaceItem *getNamespaceItem(); + + /** + * A boolean that specifies if the type definition is + * anonymous. Convenience attribute. + */ + bool getAnonymous() const; + + /** + * {base type definition}: either a simple type definition or a complex + * type definition. + */ + XSTypeDefinition *getBaseType(); + + /** + * Convenience method: check if this type is derived from the given + * ancestorType. + * @param ancestorType An ancestor type definition. + * @return Return true if this type is derived from + * ancestorType. + */ + bool derivedFromType(const XSTypeDefinition* const ancestorType); + + /** + * + */ + inline DatatypeValidator* getDatatypeValidator() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + + //@} + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSSimpleTypeDefinition(const XSSimpleTypeDefinition&); + XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &); + + /** + * Helper method for construct + */ + void setFacetInfo + ( + int definedFacets + , int fixedFacets + , XSFacetList* const xsFacetList + , XSMultiValueFacetList* const xsMultiValueFacetList + , StringList* const patternList + ); + void setPrimitiveType(XSSimpleTypeDefinition* const toSet); + + friend class XSObjectFactory; + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + int fDefinedFacets; + int fFixedFacets; + VARIETY fVariety; + DatatypeValidator* fDatatypeValidator; + XSFacetList* fXSFacetList; + XSMultiValueFacetList* fXSMultiValueFacetList; + StringList* fPatternList; + XSSimpleTypeDefinition* fPrimitiveOrItemType; + XSSimpleTypeDefinitionList* fMemberTypes; + XSAnnotationList* fXSAnnotationList; +}; + +inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const +{ + return fVariety; +} + +inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType() +{ + if (fVariety == VARIETY_ATOMIC) + return fPrimitiveOrItemType; + + return 0; +} + +inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType() +{ + if (fVariety == VARIETY_LIST) + return fPrimitiveOrItemType; + + return 0; +} + +inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const +{ + return fMemberTypes; +} + +inline int XSSimpleTypeDefinition::getDefinedFacets() const +{ + return fDefinedFacets; +} + +inline int XSSimpleTypeDefinition::getFixedFacets() const +{ + return fFixedFacets; +} + +inline StringList* XSSimpleTypeDefinition::getLexicalPattern() +{ + return fPatternList; +} + +inline XSFacetList* XSSimpleTypeDefinition::getFacets() +{ + return fXSFacetList; +} + +inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets() +{ + return fXSMultiValueFacetList; +} + +inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations() +{ + return fXSAnnotationList; +} + +inline void +XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet) +{ + fPrimitiveOrItemType = toSet; +} + +inline DatatypeValidator* +XSSimpleTypeDefinition::getDatatypeValidator() const +{ + return fDatatypeValidator; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.cpp new file mode 100644 index 000000000..505d983f2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.cpp @@ -0,0 +1,74 @@ +/* + * 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: XSTypeDefinition.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSTypeDefinition: Constructors and Destructor +// --------------------------------------------------------------------------- +XSTypeDefinition::XSTypeDefinition(TYPE_CATEGORY typeCategory, + XSTypeDefinition* const xsBaseType, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::TYPE_DEFINITION, xsModel, manager) + , fTypeCategory(typeCategory) + , fFinal(0) + , fBaseType(xsBaseType) +{ +} + +XSTypeDefinition::~XSTypeDefinition() +{ +} + +// --------------------------------------------------------------------------- +// XSTypeDefinition: access methods +// --------------------------------------------------------------------------- +bool XSTypeDefinition::isFinal(short toTest) +{ + if (fFinal & toTest) + return true; + + return false; + +} + +bool XSTypeDefinition::derivedFrom(const XMLCh *typeNamespace, + const XMLCh *name) +{ + if (!name) + return false; + + XSTypeDefinition* type = fXSModel->getTypeDefinition(name, typeNamespace); + + if (!type) + return false; + + return derivedFromType(type); +} + +XERCES_CPP_NAMESPACE_END + + diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.hpp new file mode 100644 index 000000000..81236fe17 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSTypeDefinition.hpp @@ -0,0 +1,214 @@ +/* + * 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: XSTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP) +#define XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// forward declarations +class XSNamespaceItem; + +/** + * This class represents a complexType or simpleType definition. + * This is *always* owned by the validator /parser object from which + * it is obtained. + * + */ + +class XMLPARSER_EXPORT XSTypeDefinition : public XSObject +{ +public: + + enum TYPE_CATEGORY { + /** + * This constant value signifies a complex type. + */ + COMPLEX_TYPE = 15, + /** + * This constant value signifies a simple type. + */ + SIMPLE_TYPE = 16 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param typeCategory + * @param xsBaseType + * @param xsModel + * @param manager The configurable memory manager + */ + XSTypeDefinition + ( + TYPE_CATEGORY typeCategory + , XSTypeDefinition* const xsBaseType + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + /** @name Destructor */ + //@{ + virtual ~XSTypeDefinition(); + //@} + + //--------------------- + /** @name overloaded XSObject methods */ + //@{ + + /** + * The name of type NCName of this declaration as defined in + * XML Namespaces. + */ + virtual const XMLCh* getName() const = 0; + + /** + * The [target namespace] of this object, or null if it is + * unspecified. + */ + virtual const XMLCh* getNamespace() = 0; + + /** + * A namespace schema information item corresponding to the target + * namespace of the component, if it's globally declared; or null + * otherwise. + */ + virtual XSNamespaceItem *getNamespaceItem() = 0; + + //@} + + //--------------------- + /** @name XSTypeDefinition methods */ + + //@{ + + /** + * Return whether this type definition is a simple type or complex type. + */ + TYPE_CATEGORY getTypeCategory() const; + + /** + * {base type definition}: either a simple type definition or a complex + * type definition. + */ + virtual XSTypeDefinition *getBaseType() = 0; + + /** + * {final}. For complex type definition it is a subset of {extension, + * restriction}. For simple type definition it is a subset of + * {extension, list, restriction, union}. + * @param toTest Extension, restriction, list, union constants + * (defined in XSObject). + * @return True if toTest is in the final set, otherwise false. + */ + bool isFinal(short toTest); + + /** + * For complex types the returned value is a bit combination of the subset + * of {DERIVATION_EXTENSION, DERIVATION_RESTRICTION} + * corresponding to final set of this type or + * DERIVATION_NONE. For simple types the returned value is + * a bit combination of the subset of { + * DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST + * } corresponding to final set of this type or + * DERIVATION_NONE. + */ + short getFinal() const; + + /** + * A boolean that specifies if the type definition is + * anonymous. Convenience attribute. + */ + virtual bool getAnonymous() const = 0; + + /** + * Convenience method: check if this type is derived from the given + * ancestorType. + * @param ancestorType An ancestor type definition. + * @return Return true if this type is derived from + * ancestorType. + */ + virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0; + + /** + * Convenience method: check if this type is derived from the given + * ancestor type. + * @param typeNamespace An ancestor type namespace. + * @param name An ancestor type name. + * @return Return true if this type is derived from + * the ancestor defined by typeNamespace and name. + */ + bool derivedFrom(const XMLCh* typeNamespace, + const XMLCh* name); + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSTypeDefinition(const XSTypeDefinition&); + XSTypeDefinition & operator=(const XSTypeDefinition &); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + // fTypeCategory + // whether this is a simpleType or complexType + // fFinal + // the final properties which is set by the derived class. + TYPE_CATEGORY fTypeCategory; + short fFinal; + XSTypeDefinition* fBaseType; // owned by XSModel +}; + +inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const +{ + return fTypeCategory; +} + +inline short XSTypeDefinition::getFinal() const +{ + return fFinal; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSValue.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSValue.cpp new file mode 100644 index 000000000..5a0028a4e --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSValue.cpp @@ -0,0 +1,1689 @@ +/* + * 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: XSValue.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** issues + * + * 1. For float, double, datetime family, the validation is almost similar to getActualValue + * + * + * DataType DataGroup + * num dtm str validation canonical actual-value + * ====================================================================================================== + * dt_string str [2] Char NA content + * dt_boolean str {true, false, 1, 0} {true, false} bool + * dt_decimal num lexical only yes double + * dt_float num lexical/value yes double + * dt_double num lexical/value yes double + * --------------------------------------------------------------------------------------------------------- + * 5 dt_duration dtm yes NA struct datetime + * dt_dateTime dtm yes yes struct datetime + * dt_time dtm yes yes struct datetime + * dt_date dtm yes NA struct datetime + * dt_gYearMonth dtm yes NA struct datetime + * --------------------------------------------------------------------------------------------------------- + * 10 dt_gYear dtm yes NA struct datetime + * dt_gMonthDay dtm yes NA struct datetime + * dt_gDay dtm yes NA struct datetime + * dt_gMonth dtm yes NA struct datetime + * dt_hexBinary str decoding ([a-f]) unsigned long ? + * --------------------------------------------------------------------------------------------------------- + * 15 dt_base64Binary str decoding NA (errata?) unsigned long ? + * dt_anyURI str yes NA content + * dt_QName str a:b , [6]QName NA content + * dt_NOTATION str [6]QName NA content + * dt_normalizedString str no #xD #xA #x9 NA content + * --------------------------------------------------------------------------------------------------------- + * 20 dt_token str no #xD #xA #x9 traling NA content + * dt_language str language id NA content + * dt_NMTOKEN str [7] Nmtoken NA content + * dt_NMTOKENS str [8] Nmtokens NA content + * dt_Name str [5] Name NA content + * --------------------------------------------------------------------------------------------------------- + * 25 dt_NCName str [4] NCName NA content + * dt_ID str [4] NCName NA content + * dt_IDREF str [4] NCName NA content + * dt_IDREFS str ws seped IDREF NA content + * dt_ENTITY str [4] NCName NA content + * --------------------------------------------------------------------------------------------------------- + * 30 dt_ENTITIES str ws seped ENTITY NA content + * dt_integer num lexical yes long + * dt_nonPositiveInteger num lexical yes long + * dt_negativeInteger num lexical yes long + * dt_long num lexical yes long + * --------------------------------------------------------------------------------------------------------- + * 35 dt_int num lexical yes int + * dt_short num lexical yes short + * dt_byte num lexical yes char + * dt_nonNegativeInteger num lexical yes unsigned long + * dt_unsignedLong num lexical yes unsigned long + * --------------------------------------------------------------------------------------------------------- + * 40 dt_unsignedInt num lexical yes unsigned int + * dt_unsignedShort num lexical yes unsigned short + * dt_unsignedByte num lexical yes unsigned char + * dt_positiveInteger num lexical yes unsigned long + * + ***/ + +const XSValue::DataGroup XSValue::inGroup[XSValue::dt_MAXCOUNT] = +{ + dg_strings, dg_strings, dg_numerics, dg_numerics, dg_numerics, + dg_datetimes, dg_datetimes, dg_datetimes, dg_datetimes, dg_datetimes, + dg_datetimes, dg_datetimes, dg_datetimes, dg_datetimes, dg_strings, + dg_strings, dg_strings, dg_strings, dg_strings, dg_strings, + dg_strings, dg_strings, dg_strings, dg_strings, dg_strings, + dg_strings, dg_strings, dg_strings, dg_strings, dg_strings, + dg_strings, dg_numerics, dg_numerics, dg_numerics, dg_numerics, + dg_numerics, dg_numerics, dg_numerics, dg_numerics, dg_numerics, + dg_numerics, dg_numerics, dg_numerics, dg_numerics +}; + +const bool XSValue::numericSign[XSValue::dt_MAXCOUNT] = +{ + true, true, true, true, true, + true, true, true, true, true, + true, true, true, true, true, + true, true, true, true, true, + true, true, true, true, true, + true, true, true, true, true, + true, true, true, true, true, + true, true, true, false, false, + false, false, false, false +}; + +// --------------------------------------------------------------------------- +// Local static functions +// --------------------------------------------------------------------------- +static RegularExpression* sXSValueRegEx = 0; +ValueHashTableOf* XSValue::fDataTypeRegistry = 0; + +void XMLInitializer::initializeXSValue() +{ + sXSValueRegEx = new RegularExpression( + XMLUni::fgLangPattern, SchemaSymbols::fgRegEx_XOption); + + XSValue::initializeRegistry(); +} + +void XMLInitializer::terminateXSValue() +{ + delete XSValue::fDataTypeRegistry; + XSValue::fDataTypeRegistry = 0; + + delete sXSValueRegEx; + sXSValueRegEx = 0; +} + +XSValue::DataType XSValue::getDataType(const XMLCh* const dtString) +{ + if (fDataTypeRegistry->containsKey(dtString)) { + return fDataTypeRegistry->get(dtString); + } + + return dt_MAXCOUNT; +} + +void XSValue::initializeRegistry() +{ + //using the XMLPlatformUtils::fgMemoryManager + fDataTypeRegistry = new ValueHashTableOf(43); + + if (fDataTypeRegistry) { + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_STRING, XSValue::dt_string); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_BOOLEAN, XSValue::dt_boolean); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DECIMAL, XSValue::dt_decimal); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_FLOAT, XSValue::dt_float); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DOUBLE, XSValue::dt_double); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DURATION, XSValue::dt_duration); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DATETIME, XSValue::dt_dateTime); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_TIME, XSValue::dt_time); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DATE, XSValue::dt_date); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_YEARMONTH, XSValue::dt_gYearMonth); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_YEAR, XSValue::dt_gYear); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_MONTHDAY, XSValue::dt_gMonthDay); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_DAY, XSValue::dt_gDay); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_MONTH, XSValue::dt_gMonth); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_HEXBINARY, XSValue::dt_hexBinary); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_BASE64BINARY, XSValue::dt_base64Binary); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_ANYURI, XSValue::dt_anyURI); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_QNAME, XSValue::dt_QName); + fDataTypeRegistry->put((void*) XMLUni::fgNotationString, XSValue::dt_NOTATION); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NORMALIZEDSTRING, XSValue::dt_normalizedString); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_TOKEN, XSValue::dt_token); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_LANGUAGE, XSValue::dt_language); + fDataTypeRegistry->put((void*) XMLUni::fgNmTokenString, XSValue::dt_NMTOKEN); + fDataTypeRegistry->put((void*) XMLUni::fgNmTokensString, XSValue::dt_NMTOKENS); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NAME, XSValue::dt_Name); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NCNAME, XSValue::dt_NCName); + fDataTypeRegistry->put((void*) XMLUni::fgIDString, XSValue::dt_ID); + fDataTypeRegistry->put((void*) XMLUni::fgIDRefString, XSValue::dt_IDREF); + fDataTypeRegistry->put((void*) XMLUni::fgIDRefsString, XSValue::dt_IDREFS); + fDataTypeRegistry->put((void*) XMLUni::fgEntityString, XSValue::dt_ENTITY); + fDataTypeRegistry->put((void*) XMLUni::fgEntitiesString, XSValue::dt_ENTITIES); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_INTEGER, XSValue::dt_integer); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NONPOSITIVEINTEGER, XSValue::dt_nonPositiveInteger); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NEGATIVEINTEGER, XSValue::dt_negativeInteger); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_LONG, XSValue::dt_long); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_INT, XSValue::dt_int); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_SHORT, XSValue::dt_short); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_BYTE, XSValue::dt_byte); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_NONNEGATIVEINTEGER, XSValue::dt_nonNegativeInteger); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_ULONG, XSValue::dt_unsignedLong); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_UINT, XSValue::dt_unsignedInt); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_USHORT, XSValue::dt_unsignedShort); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_UBYTE, XSValue::dt_unsignedByte); + fDataTypeRegistry->put((void*) SchemaSymbols::fgDT_POSITIVEINTEGER, XSValue::dt_positiveInteger); + } +} + +static bool checkTimeZoneError(XSValue::DataType const &datatype + , SchemaDateTimeException const &e ) +{ + return (((datatype == XSValue::dt_dateTime) || (datatype == XSValue::dt_time) || (datatype == XSValue::dt_date)) && + ((e.getCode() == XMLExcepts::DateTime_tz_noUTCsign) || + (e.getCode() == XMLExcepts::DateTime_tz_stuffAfterZ) || + (e.getCode() == XMLExcepts::DateTime_tz_invalid) || + (e.getCode() == XMLExcepts::DateTime_tz_hh_invalid))); +} + +// --------------------------------------------------------------------------- +// Local Data +// --------------------------------------------------------------------------- + +static const XMLCh Separator_20[] = {chSpace, chNull}; +static const XMLCh Separator_ws[] = {chSpace, chLF, chCR, chHTab, chNull}; + +// --------------------------------------------------------------------------- +// XSValue: Constructors and Destructor +// --------------------------------------------------------------------------- +XSValue::XSValue(DataType const dt + , MemoryManager* const manager) + :fMemAllocated(false) + ,fMemoryManager(manager) +{ + fData.f_datatype = dt; +} + +XSValue::~XSValue() +{ + if (fMemAllocated) + fMemoryManager->deallocate(fData.fValue.f_byteVal); +} + +// --------------------------------------------------------------------------- +// XSValue: Public Interface +// +// No exception is thrown from these methods +// +// --------------------------------------------------------------------------- +bool XSValue::validate(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , MemoryManager* const manager) +{ + if (!content || + !*content || + ((version == ver_10) && (XMLChar1_0::isAllSpaces(content, XMLString::stringLen(content)))) || + ((version == ver_11) && (XMLChar1_1::isAllSpaces(content, XMLString::stringLen(content)))) ) { + + switch (datatype) { + case XSValue::dt_string: + case XSValue::dt_normalizedString: + case XSValue::dt_token: + case XSValue::dt_anyURI: + case XSValue::dt_hexBinary: + case XSValue::dt_base64Binary: + status = st_Init; + return true; + break; + default: + status = st_NoContent; + return false; + break; + } + } + + status = st_Init; + + switch (inGroup[datatype]) { + case XSValue::dg_numerics: + return validateNumerics(content, datatype, status, manager); + break; + case XSValue::dg_datetimes: + return validateDateTimes(content, datatype, status, manager); + break; + case XSValue::dg_strings: + return validateStrings(content, datatype, status, version, manager); + break; + default: + status = st_UnknownType; + + return false; + break; + } + return false; +} + +XMLCh* +XSValue::getCanonicalRepresentation(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager) +{ + if (!content || + !*content || + ((version == ver_10) && (XMLChar1_0::isAllSpaces(content, XMLString::stringLen(content)))) || + ((version == ver_11) && (XMLChar1_1::isAllSpaces(content, XMLString::stringLen(content)))) ) { + status = st_NoContent; + return 0; + } + + status = st_Init; + + switch (inGroup[datatype]) { + case XSValue::dg_numerics: + return getCanRepNumerics(content, datatype, status, toValidate, manager); + break; + case XSValue::dg_datetimes: + return getCanRepDateTimes(content, datatype, status, toValidate, manager); + break; + case XSValue::dg_strings: + return getCanRepStrings(content, datatype, status, version, toValidate, manager); + break; + default: + status = st_UnknownType; + + return 0; + break; + } + return 0; +} + +XSValue* XSValue::getActualValue(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager) +{ + if (!content || + !*content || + ((version == ver_10) && (XMLChar1_0::isAllSpaces(content, XMLString::stringLen(content)))) || + ((version == ver_11) && (XMLChar1_1::isAllSpaces(content, XMLString::stringLen(content)))) ) { + status = st_NoContent; + return 0; + } + + status = st_Init; + + switch (inGroup[datatype]) { + case XSValue::dg_numerics: + return getActValNumerics(content, datatype, status, toValidate, manager); + break; + case XSValue::dg_datetimes: + return getActValDateTimes(content, datatype, status, manager); + break; + case XSValue::dg_strings: + return getActValStrings(content, datatype, status, version, toValidate, manager); + break; + default: + status = st_UnknownType; + return 0; + break; + } + return 0; +} + +// --------------------------------------------------------------------------- +// XSValue: Helpers +// --------------------------------------------------------------------------- + +/*** + * + * Boundary checking is done against Schema Type's lexcial space + ***/ +bool +XSValue::validateNumerics(const XMLCh* const content + , DataType datatype + , Status& status + , MemoryManager* const manager) +{ + + try { + + switch (datatype) { + case XSValue::dt_decimal: + XMLBigDecimal::parseDecimal(content, manager); + break; + case XSValue::dt_float: + { + //XMLFloat takes care of 0, -0, -INF, INF and NaN + //XMLFloat::checkBoundary() handles error and outofbound issues + XMLFloat data(content, manager); + break; + } + case XSValue::dt_double: + { + //XMLDouble takes care of 0, -0, -INF, INF and NaN + //XMLDouble::checkBoundary() handles error and outofbound issues + XMLDouble data(content, manager); + break; + } + /*** + * For all potentially unrepresentable types + * + * For dt_long, dt_unsignedLong, doing lexical space + * checking ensures consistent behaviour on 32/64 boxes + * + ***/ + case XSValue::dt_integer: + case XSValue::dt_negativeInteger: + case XSValue::dt_nonPositiveInteger: + case XSValue::dt_nonNegativeInteger: + case XSValue::dt_positiveInteger: + case XSValue::dt_long: + case XSValue::dt_unsignedLong: + { + XMLCh* compareData = (XMLCh*) manager->allocate((XMLString::stringLen(content) + 1) * sizeof(XMLCh)); + ArrayJanitor janName(compareData, manager); + int signValue = 0; + XMLBigInteger::parseBigInteger(content, compareData, signValue, manager); + + switch (datatype) { + case XSValue::dt_integer: + //error: no + break; + case XSValue::dt_negativeInteger: + // error: > -1 + if (XMLBigInteger::compareValues(compareData + , signValue + , &(XMLUni::fgNegOne[1]) + , -1 + , manager) + == XMLNumber::GREATER_THAN) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_nonPositiveInteger: + // error: > 0 + if (XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgValueZero + , 0 + , manager) + == XMLNumber::GREATER_THAN) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_nonNegativeInteger: + // error: < 0 + if (XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgValueZero + , 0 + , manager) + == XMLNumber::LESS_THAN) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_positiveInteger: + // error: < 1 + if (XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgValueOne + , 1 + , manager) + == XMLNumber::LESS_THAN) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_long: + // error: < -9223372036854775808 || > 9223372036854775807 + if ((XMLBigInteger::compareValues(compareData + , signValue + , &(XMLUni::fgLongMinInc[1]) + , -1 + , manager) + == XMLNumber::LESS_THAN) || + (XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgLongMaxInc + , 1 + , manager) + == XMLNumber::GREATER_THAN)) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_unsignedLong: + // error: < 0 || > 18446744073709551615 + if ((XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgValueZero + , 0 + , manager) + == XMLNumber::LESS_THAN) || + (XMLBigInteger::compareValues(compareData + , signValue + , XMLUni::fgULongMaxInc + , 1 + , manager) + == XMLNumber::GREATER_THAN)) + { + status = st_FOCA0002; + return false; + } + break; + default: + status = st_NotSupported; + return false; + break; + } + break; + } + case XSValue::dt_int: + case XSValue::dt_short: + case XSValue::dt_byte: + case XSValue::dt_unsignedInt: + case XSValue::dt_unsignedShort: + case XSValue::dt_unsignedByte: + { + t_value actVal; + + if ( !getActualNumericValue( + content + , status + , actVal + , manager + , datatype + ) + ) + { + return false; + } + break; + } + default: + return false; + } // end switch + } + catch (const NumberFormatException&) + { + //getActValue()/getCanonical() need to know the failure details + //if validation is required + status = st_FOCA0002; + return false; + } + return true; //both valid chars and within boundary +} + +bool XSValue::validateDateTimes(const XMLCh* const input_content + , DataType datatype + , Status& status + , MemoryManager* const manager) +{ + XMLCh* content = XMLString::replicate(input_content, manager); + ArrayJanitor janTmpName(content, manager); + XMLString::trim(content); + try + { + XMLDateTime coreDate = XMLDateTime(content, manager); + + switch (datatype) { + case XSValue::dt_duration: + coreDate.parseDuration(); + break; + case XSValue::dt_dateTime: + coreDate.parseDateTime(); + break; + case XSValue::dt_time: + coreDate.parseTime(); + break; + case XSValue::dt_date: + coreDate.parseDate(); + break; + case XSValue::dt_gYearMonth: + coreDate.parseYearMonth(); + break; + case XSValue::dt_gYear: + coreDate.parseYear(); + break; + case XSValue::dt_gMonthDay: + coreDate.parseMonthDay(); + break; + case XSValue::dt_gDay: + coreDate.parseDay(); + break; + case XSValue::dt_gMonth: + coreDate.parseMonth(); + break; + default: + return false; + break; + } + } + + catch (const SchemaDateTimeException &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + return false; + } + catch (const NumberFormatException&) + { + //getActValue()/getCanonical() need to know the failure details + //if validation is required + status = st_FOCA0002; + return false; + } + + return true; //parsing succeed +} + +bool XSValue::validateStrings(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , MemoryManager* const manager) +{ + bool isValid = true; + + switch (datatype) { + case XSValue::dt_boolean: + { + XMLSize_t i = 0; + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + for (; i < XMLUni::fgBooleanValueSpaceArraySize; i++) { + if (XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[i])) + break; + } + + if (XMLUni::fgBooleanValueSpaceArraySize == i) { + isValid = false; + } + break; + } + case XSValue::dt_hexBinary: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + if (HexBin::getDataLength(tmpStrValue) == -1) { + isValid = false; + } + } + break; + case XSValue::dt_base64Binary: + if (Base64::getDataLength(content, manager) == -1) { + isValid = false; + } + break; + case XSValue::dt_anyURI: + if (XMLUri::isValidURI(true, content, true) == false) { + isValid = false; + } + break; + case XSValue::dt_QName: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + isValid = (version == ver_10) ? + XMLChar1_0::isValidQName(tmpStrValue, XMLString::stringLen(tmpStrValue)) : + XMLChar1_1::isValidQName(tmpStrValue, XMLString::stringLen(tmpStrValue)); + } + break; + case XSValue::dt_NOTATION: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + if ( XMLString::isValidNOTATION(tmpStrValue, manager) == false) { + isValid = false; + } + } + break; + case XSValue::dt_string: + { + const XMLCh* rawPtr = content; + + if (version == ver_10) { + while (*rawPtr) + if (!XMLChar1_0::isXMLChar(*rawPtr++)) { + isValid = false; + break; + } + } + else { + while (*rawPtr) + if (!XMLChar1_1::isXMLChar(*rawPtr++)) { + isValid = false; + break; + } + } + break; + } + case XSValue::dt_normalizedString: + { + const XMLCh* rawPtr = content; + + if (version == ver_10) { + while (*rawPtr) { + if (!XMLChar1_0::isXMLChar(*rawPtr)) { + isValid = false; + break; + } + else if (*rawPtr == chCR || *rawPtr == chLF || *rawPtr == chHTab) { + isValid = false; + break; + } + else { + rawPtr++; + } + } + } + else { + while (*rawPtr) { + if (!XMLChar1_1::isXMLChar(*rawPtr)) { + isValid = false; + break; + } + else if (*rawPtr == chCR || *rawPtr == chLF || *rawPtr == chHTab) { + isValid = false; + break; + } + else { + rawPtr++; + } + + } + } + break; + } + case XSValue::dt_token: + case XSValue::dt_language: + { + XMLSize_t strLen = XMLString::stringLen(content); + const XMLCh* rawPtr = content; + bool inWS = false; + + if (version == ver_10) { + // Check leading/Trailing white space + if (XMLChar1_0::isWhitespace(content[0]) || + XMLChar1_0::isWhitespace(content[strLen - 1]) ) { + isValid = false; + } + else { + while (*rawPtr) { + if (!XMLChar1_0::isXMLChar(*rawPtr)) { + isValid = false; + break; + } + else if (*rawPtr == chCR || *rawPtr == chLF || *rawPtr == chHTab) { + isValid = false; + break; + } + else if (XMLChar1_0::isWhitespace(*rawPtr)) { + if (inWS) { + isValid = false; + break; + } + else { + inWS = true; + } + } + else { + inWS = false; + } + + rawPtr++; + } + } + } + else { + // Check leading/Trailing white space + if (XMLChar1_1::isWhitespace(content[0]) || + XMLChar1_1::isWhitespace(content[strLen - 1]) ) { + isValid = false; + } + else { + while (*rawPtr) { + if (!XMLChar1_1::isXMLChar(*rawPtr)) { + isValid = false; + break; + } + else if (*rawPtr == chCR || *rawPtr == chLF || *rawPtr == chHTab) { + isValid = false; + break; + } + else if (XMLChar1_1::isWhitespace(*rawPtr)) { + if (inWS) { + isValid = false; + break; + } + else { + inWS = true; + } + } + else { + inWS = false; + } + rawPtr++; + } + } + } + if (isValid == true && datatype == XSValue::dt_language) { + if (!sXSValueRegEx) { + status = st_CantCreateRegEx; + isValid = false; + } + else + { + if (sXSValueRegEx->matches(content, manager) == false) + { + isValid = false; + } + } + } + break; + } + case XSValue::dt_NMTOKEN: + isValid = (version == ver_10) ? + XMLChar1_0::isValidNmtoken(content, XMLString::stringLen(content)) : + XMLChar1_1::isValidNmtoken(content, XMLString::stringLen(content)); + break; + case XSValue::dt_NMTOKENS: + // [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* + { + XMLStringTokenizer tokenizer(content, Separator_20, manager); + + if (version == ver_10) { + while (tokenizer.hasMoreTokens()) { + const XMLCh* token = tokenizer.nextToken(); + + if (!XMLChar1_0::isValidNmtoken(token, XMLString::stringLen(token))) { + isValid = false; + break; + } + } + } + else { + while (tokenizer.hasMoreTokens()) { + const XMLCh* token = tokenizer.nextToken(); + + if (!XMLChar1_1::isValidNmtoken(token, XMLString::stringLen(token))) { + isValid = false; + break; + } + } + } + break; + } + case XSValue::dt_Name: + isValid = (version == ver_10) ? + XMLChar1_0::isValidName(content) : + XMLChar1_1::isValidName(content); + break; + case XSValue::dt_NCName: + case XSValue::dt_ID: + case XSValue::dt_IDREF: + case XSValue::dt_ENTITY: + isValid = (version == ver_10) ? + XMLChar1_0::isValidNCName(content, XMLString::stringLen(content)) : + XMLChar1_1::isValidNCName(content, XMLString::stringLen(content)); + break; + case XSValue::dt_ENTITIES: + case XSValue::dt_IDREFS: + { + XMLStringTokenizer tokenizer(content, Separator_ws, manager); + + if (version == ver_10 ) { + while (tokenizer.hasMoreTokens()) { + const XMLCh* token = tokenizer.nextToken(); + + if (!XMLChar1_0::isValidNCName(token, XMLString::stringLen(token))) { + isValid = false; + break; + } + } + } + else { + while (tokenizer.hasMoreTokens()) { + const XMLCh* token = tokenizer.nextToken(); + + if (!XMLChar1_1::isValidNCName(token, XMLString::stringLen(token))) { + isValid = false; + break; + } + } + } + } + break; + default: + status = st_NotSupported; + isValid = false; + break; + } + + + if (isValid == false && status == st_Init) { + status = st_FOCA0002; + } + + return isValid; +} + + +XMLCh* XSValue::getCanRepNumerics(const XMLCh* const content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager) +{ + try + { + + // getCanonicalRepresentation does lexical space validation only + // (no range checking), therefore if validation is required, + // we need to pass the content to the validate interface for complete checking + if (toValidate && !validateNumerics(content, datatype, status, manager)) + return 0; + + XMLCh* retVal = 0; + + if (datatype == XSValue::dt_decimal) + { + retVal = XMLBigDecimal::getCanonicalRepresentation(content, manager); + + if (!retVal) + status = st_FOCA0002; + + return retVal; + + } + else if (datatype == XSValue::dt_float || datatype == XSValue::dt_double ) + { + // In XML4C, no float or double is treated as out of range + // it gets converted to INF, -INF or zero. + // The getCanonical method should treat double & float the + // same way as the rest of XML4C for consistentcy so need + // to getActualValue and see if it was converted. + XSValue* xsval = getActValNumerics(content, datatype, status, false, manager); + if (!xsval) { + status = st_FOCA0002; + return retVal; + } + + DoubleFloatType enumVal; + if (datatype == XSValue::dt_float) { + enumVal = xsval->fData.fValue.f_floatType.f_floatEnum; + } + else { + enumVal = xsval->fData.fValue.f_doubleType.f_doubleEnum; + } + delete xsval; + + switch(enumVal) { + case DoubleFloatType_NegINF: + retVal = XMLString::replicate(XMLUni::fgNegINFString, manager); + break; + case DoubleFloatType_PosINF: + retVal = XMLString::replicate(XMLUni::fgPosINFString, manager); + break; + case DoubleFloatType_NaN: + retVal = XMLString::replicate(XMLUni::fgNaNString, manager); + break; + case DoubleFloatType_Zero: + retVal = XMLString::replicate(XMLUni::fgPosZeroString, manager); + break; + default: //DoubleFloatType_Normal + retVal = XMLAbstractDoubleFloat::getCanonicalRepresentation(content, manager); + + if (!retVal) + status = st_FOCA0002; + break; + } + return retVal; + } + else + { + retVal = XMLBigInteger::getCanonicalRepresentation(content, manager, datatype == XSValue::dt_nonPositiveInteger); + + if (!retVal) + status = st_FOCA0002; + + return retVal; + } + } + catch (const NumberFormatException&) + { + status = st_FOCA0002; + } + + return 0; +} + +XMLCh* XSValue::getCanRepDateTimes(const XMLCh* const input_content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager) +{ + XMLCh* content = XMLString::replicate(input_content, manager); + ArrayJanitor janTmpName(content, manager); + XMLString::trim(content); + try + { + + XMLDateTime coreDate = XMLDateTime(content, manager); + + switch (datatype) { + case XSValue::dt_dateTime: + //we need this parsing + coreDate.parseDateTime(); + return coreDate.getDateTimeCanonicalRepresentation(manager); + break; + case XSValue::dt_time: + // we need this parsing + coreDate.parseTime(); + return coreDate.getTimeCanonicalRepresentation(manager); + break; + case XSValue::dt_date: + // we need this parsing + coreDate.parseDate(); + return coreDate.getDateCanonicalRepresentation(manager); + break; + case XSValue::dt_duration: + case XSValue::dt_gYearMonth: + case XSValue::dt_gYear: + case XSValue::dt_gMonthDay: + case XSValue::dt_gDay: + case XSValue::dt_gMonth: + { + if (!(toValidate && !validateDateTimes(content, datatype, status, manager))) + status = st_NoCanRep; + + return 0; + } + break; + default: + return 0; + break; + } + } + catch (SchemaDateTimeException &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + } + catch (const NumberFormatException&) + { + status = st_FOCA0002; + } + return 0; +} + +XMLCh* XSValue::getCanRepStrings(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager) +{ + switch (datatype) { + case XSValue::dt_boolean: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + //always validate before getting canRep + if (XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[0]) || + XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[2]) ) + { + return XMLString::replicate(XMLUni::fgBooleanValueSpace[0], manager); + } + else if (XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[1]) || + XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[3]) ) + { + return XMLString::replicate(XMLUni::fgBooleanValueSpace[1], manager); + } + else + { + status = st_FOCA0002; + return 0; + } + } + break; + case XSValue::dt_hexBinary: + { + //HexBin::getCanonicalRepresentation does validation automatically + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + + XMLCh* canRep = HexBin::getCanonicalRepresentation(tmpStrValue, manager); + if (!canRep) + status = st_FOCA0002; + + return canRep; + break; + } + case XSValue::dt_base64Binary: + { + //Base64::getCanonicalRepresentation does validation automatically + XMLCh* canRep = Base64::getCanonicalRepresentation(content, manager); + if (!canRep) + status = st_FOCA0002; + + return canRep; + break; + } + case XSValue::dt_anyURI: + case XSValue::dt_QName: + case XSValue::dt_NOTATION: + case XSValue::dt_string: + case XSValue::dt_normalizedString: + case XSValue::dt_token: + case XSValue::dt_language: + case XSValue::dt_NMTOKEN: + case XSValue::dt_NMTOKENS: + case XSValue::dt_Name: + case XSValue::dt_NCName: + case XSValue::dt_ID: + case XSValue::dt_IDREF: + case XSValue::dt_ENTITY: + case XSValue::dt_ENTITIES: + case XSValue::dt_IDREFS: + if (toValidate && !validateStrings(content, datatype, status, version, manager)) + status = st_FOCA0002; + else + status = st_NoCanRep; + + return 0; + break; + default: + return 0; + break; + } + + return 0; +} + +XSValue* +XSValue::getActValNumerics(const XMLCh* const content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager) +{ + + try { + + switch (datatype) { + case XSValue::dt_decimal: + { + if (toValidate) { + XMLBigDecimal::parseDecimal(content, manager); + } + //Prepare the double value + XMLDouble data(content, manager); + if (data.isDataConverted()) + { + status = st_FOCA0001; + return 0; + } + + XSValue* retVal = new (manager) XSValue(dt_decimal, manager); + retVal->fData.fValue.f_decimal.f_dvalue = data.getValue(); + + return retVal; + break; + } + case XSValue::dt_float: + { + //XMLFloat takes care of 0, -0, -INF, INF and NaN + //XMLFloat::checkBoundary() handles error and outofbound issues + XMLFloat data(content, manager); + XSValue* retVal = new (manager) XSValue(dt_float, manager); + + if (data.isDataConverted()) + { + retVal->fData.fValue.f_floatType.f_float = 0.0; + retVal->fData.fValue.f_floatType.f_floatEnum = DoubleFloatType_Zero; + + switch(data.getType()) { + case XMLAbstractDoubleFloat::NegINF: + retVal->fData.fValue.f_floatType.f_floatEnum = DoubleFloatType_NegINF; + break; + case XMLAbstractDoubleFloat::PosINF: + retVal->fData.fValue.f_floatType.f_floatEnum = DoubleFloatType_PosINF; + break; + case XMLAbstractDoubleFloat::NaN: + retVal->fData.fValue.f_floatType.f_floatEnum = DoubleFloatType_NaN; + break; + default: + break; + } + } + else { + retVal->fData.fValue.f_floatType.f_floatEnum = DoubleFloatType_Normal; + retVal->fData.fValue.f_floatType.f_float = (float) data.getValue(); + } + return retVal; + break; + } + case XSValue::dt_double: + { + //XMLDouble takes care of 0, -0, -INF, INF and NaN + //XMLDouble::checkBoundary() handles error and outofbound issues + XMLDouble data(content, manager); + XSValue* retVal = new (manager) XSValue(dt_double, manager); + + if (data.isDataConverted()) + { + retVal->fData.fValue.f_doubleType.f_double = 0.0; + retVal->fData.fValue.f_doubleType.f_doubleEnum = DoubleFloatType_Zero; + + switch(data.getType()) { + case XMLAbstractDoubleFloat::NegINF: + retVal->fData.fValue.f_doubleType.f_doubleEnum = DoubleFloatType_NegINF; + break; + case XMLAbstractDoubleFloat::PosINF: + retVal->fData.fValue.f_doubleType.f_doubleEnum = DoubleFloatType_PosINF; + break; + case XMLAbstractDoubleFloat::NaN: + retVal->fData.fValue.f_doubleType.f_doubleEnum = DoubleFloatType_NaN; + break; + default: + break; + } + } + else { + retVal->fData.fValue.f_doubleType.f_doubleEnum = DoubleFloatType_Normal; + retVal->fData.fValue.f_doubleType.f_double = data.getValue(); + } + return retVal; + break; + } + case XSValue::dt_integer: + case XSValue::dt_negativeInteger: + case XSValue::dt_nonPositiveInteger: + case XSValue::dt_nonNegativeInteger: + case XSValue::dt_positiveInteger: + case XSValue::dt_long: + case XSValue::dt_int: + case XSValue::dt_short: + case XSValue::dt_byte: + case XSValue::dt_unsignedLong: + case XSValue::dt_unsignedInt: + case XSValue::dt_unsignedShort: + case XSValue::dt_unsignedByte: + { + t_value actVal; + + if ( !getActualNumericValue( + content + , status + , actVal + , manager + , datatype + ) + ) + { + //status has been set by getActualNumericValue + return 0; + } + + XSValue* retVal = new (manager) XSValue(datatype, manager); + + switch (datatype) { + case XSValue::dt_integer: + retVal->fData.fValue.f_long = actVal.f_long; + break; + case XSValue::dt_negativeInteger: + retVal->fData.fValue.f_long = actVal.f_long; + break; + case XSValue::dt_nonPositiveInteger: + retVal->fData.fValue.f_long = actVal.f_long; + break; + case XSValue::dt_nonNegativeInteger: + retVal->fData.fValue.f_long = actVal.f_ulong; + break; + case XSValue::dt_positiveInteger: + retVal->fData.fValue.f_long = actVal.f_ulong; + break; + case XSValue::dt_long: + retVal->fData.fValue.f_long = actVal.f_long; + break; + case XSValue::dt_int: + retVal->fData.fValue.f_int = (int) actVal.f_long; + break; + case XSValue::dt_short: + retVal->fData.fValue.f_short = (short) actVal.f_long; + break; + case XSValue::dt_byte: + retVal->fData.fValue.f_char = (char) actVal.f_long; + break; + case XSValue::dt_unsignedLong: + retVal->fData.fValue.f_ulong = actVal.f_ulong; + break; + case XSValue::dt_unsignedInt: + retVal->fData.fValue.f_uint = (unsigned int) actVal.f_ulong; + break; + case XSValue::dt_unsignedShort: + retVal->fData.fValue.f_ushort = (unsigned short) actVal.f_ulong; + break; + case XSValue::dt_unsignedByte: + retVal->fData.fValue.f_uchar = (unsigned char) actVal.f_ulong; + break; + default: + return 0; + break; + } + return retVal; + break; + } + default: + return 0; + break; + } // end switch + } + catch (const NumberFormatException&) + { + status = st_FOCA0002; + } + return 0; +} + +XSValue* +XSValue::getActValDateTimes(const XMLCh* const input_content + , DataType datatype + , Status& status + , MemoryManager* const manager) +{ + XMLCh* content = XMLString::replicate(input_content, manager); + ArrayJanitor janTmpName(content, manager); + XMLString::trim(content); + try + { + //Need not check if validation is requested since + //parsing functions below does the validation automatically + XMLDateTime coreDate = XMLDateTime(content, manager); + + switch (datatype) { + case XSValue::dt_duration: + coreDate.parseDuration(); + break; + case XSValue::dt_dateTime: + coreDate.parseDateTime(); + break; + case XSValue::dt_time: + coreDate.parseTime(); + coreDate.fValue[XMLDateTime::CentYear] = 0; + coreDate.fValue[XMLDateTime::Month] = 0; + coreDate.fValue[XMLDateTime::Day] = 0; + break; + case XSValue::dt_date: + coreDate.parseDate(); + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + case XSValue::dt_gYearMonth: + coreDate.parseYearMonth(); + coreDate.fValue[XMLDateTime::Day] = 0; + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + case XSValue::dt_gYear: + coreDate.parseYear(); + coreDate.fValue[XMLDateTime::Month] = 0; + coreDate.fValue[XMLDateTime::Day] = 0; + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + case XSValue::dt_gMonthDay: + coreDate.parseMonthDay(); + coreDate.fValue[XMLDateTime::CentYear] = 0; + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + case XSValue::dt_gDay: + coreDate.parseDay(); + coreDate.fValue[XMLDateTime::CentYear] = 0; + coreDate.fValue[XMLDateTime::Month] = 0; + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + case XSValue::dt_gMonth: + coreDate.parseMonth(); + coreDate.fValue[XMLDateTime::CentYear] = 0; + coreDate.fValue[XMLDateTime::Day] = 0; + coreDate.fValue[XMLDateTime::Hour] = 0; + coreDate.fValue[XMLDateTime::Minute] = 0; + break; + default: + return 0; + break; + } + + XSValue* retVal = new (manager) XSValue(datatype, manager); + + retVal->fData.fValue.f_datetime.f_year = coreDate.fValue[XMLDateTime::CentYear]; + retVal->fData.fValue.f_datetime.f_month = coreDate.fValue[XMLDateTime::Month]; + retVal->fData.fValue.f_datetime.f_day = coreDate.fValue[XMLDateTime::Day]; + retVal->fData.fValue.f_datetime.f_hour = coreDate.fValue[XMLDateTime::Hour]; + retVal->fData.fValue.f_datetime.f_min = coreDate.fValue[XMLDateTime::Minute]; + retVal->fData.fValue.f_datetime.f_second = coreDate.fValue[XMLDateTime::Second]; + retVal->fData.fValue.f_datetime.f_milisec = coreDate.fMilliSecond; + + return retVal; + } + catch (SchemaDateTimeException const &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + } + catch (const NumberFormatException&) + { + status = st_FOCA0002; + } + return 0; + +} + +XSValue* +XSValue::getActValStrings(const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager) +{ + switch (datatype) { + case XSValue::dt_boolean: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + //do validation here more efficiently + if (XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[0]) || + XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[2]) ) + { + XSValue* retVal = new (manager) XSValue(dt_boolean, manager); + retVal->fData.fValue.f_bool = false; + return retVal; + } + else if (XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[1]) || + XMLString::equals(tmpStrValue, XMLUni::fgBooleanValueSpace[3]) ) + { + XSValue* retVal = new (manager) XSValue(dt_boolean, manager); + retVal->fData.fValue.f_bool = true; + return retVal; + } + else + { + status = st_FOCA0002; + return 0; + } + } + break; + case XSValue::dt_hexBinary: + { + XMLCh* tmpStrValue = XMLString::replicate(content, manager); + ArrayJanitor janTmpName(tmpStrValue, manager); + XMLString::trim(tmpStrValue); + + XMLByte* decodedData = HexBin::decodeToXMLByte(tmpStrValue, manager); + + if (!decodedData) + { + status = st_FOCA0002; + return 0; + } + + XSValue* retVal = new (manager) XSValue(dt_hexBinary, manager); + retVal->fData.fValue.f_byteVal = decodedData; + retVal->fMemAllocated = true; + return retVal; + break; + } + case XSValue::dt_base64Binary: + { + XMLSize_t len = 0; + XMLByte* decodedData = Base64::decodeToXMLByte(content, &len, manager); + + if (!decodedData) + { + status = st_FOCA0002; + return 0; + } + + XSValue* retVal = new (manager) XSValue(dt_base64Binary, manager); + retVal->fData.fValue.f_byteVal = decodedData; + retVal->fMemAllocated = true; + return retVal; + break; + } + case XSValue::dt_anyURI: + case XSValue::dt_QName: + case XSValue::dt_NOTATION: + case XSValue::dt_string: + case XSValue::dt_normalizedString: + case XSValue::dt_token: + case XSValue::dt_language: + case XSValue::dt_NMTOKEN: + case XSValue::dt_NMTOKENS: + case XSValue::dt_Name: + case XSValue::dt_NCName: + case XSValue::dt_ID: + case XSValue::dt_IDREF: + case XSValue::dt_ENTITY: + case XSValue::dt_ENTITIES: + case XSValue::dt_IDREFS: + if (toValidate && !validateStrings(content, datatype, status, version, manager)) + status = st_FOCA0002; + else + status = st_NoActVal; + + return 0; + break; + default: + return 0; + break; + } + + return 0; +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- +bool XSValue::getActualNumericValue(const XMLCh* const content + , Status& status + , t_value& retVal + , MemoryManager* const manager + , DataType datatype) +{ + char *nptr = XMLString::transcode(content, manager); + ArrayJanitor jan(nptr, manager); + char *endptr = 0; + errno = 0; + + if (XSValue::numericSign[datatype]) + { + retVal.f_long = strtol(nptr, &endptr, (int)10); + } + else + { + if (XMLString::indexOf(content, chDash) != -1) + { + status = st_FOCA0002; //invalid lexcial value + return false; + } + + retVal.f_ulong = strtoul(nptr, &endptr, (int)10); + } + + // need to check out-of-bounds before checking erange... + switch (datatype) { + case XSValue::dt_nonPositiveInteger: + if (retVal.f_long > 0) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_negativeInteger: + if (retVal.f_long >= 0) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_int: + // strtol will set value to LONG_MIN/LONG_MAX if ERANGE error + if ((retVal.f_long < INT_MIN) || + (retVal.f_long > INT_MAX) || + (errno == ERANGE)) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_short: + if ((retVal.f_long < SHRT_MIN) || + (retVal.f_long > SHRT_MAX)) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_byte: + if ((retVal.f_long < SCHAR_MIN) || + (retVal.f_long > SCHAR_MAX)) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_unsignedInt: + // strtoul will set value to LONG_INT if ERANGE error + if ((retVal.f_ulong > UINT_MAX) || + (errno == ERANGE)) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_unsignedShort: + if (retVal.f_ulong > USHRT_MAX) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_unsignedByte: + if (retVal.f_ulong > UCHAR_MAX) + { + status = st_FOCA0002; + return false; + } + break; + case XSValue::dt_positiveInteger: + if (retVal.f_ulong == 0) + { + status = st_FOCA0002; + return false; + } + break; + default: + break; + } // end switch + // check if overflow/underflow occurs + if (errno == ERANGE) + { + status = st_FOCA0003; + return false; + } + + // check if all chars are valid char. If they are, endptr will + // pointer to the null terminator, or all of the remaining + // characters will be whitespace characters. + while (*endptr != '\0') + { + const char ch = *endptr; + + if (ch == '\t' || ch == '\n' || ch == '\r' || ch == ' ') + { + ++endptr; + } + else + { + status = st_FOCA0002; + return false; + } + + } + return true; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSValue.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSValue.hpp new file mode 100644 index 000000000..ac987ee61 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSValue.hpp @@ -0,0 +1,406 @@ +/* + * 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: XSValue.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSVALUE_HPP) +#define XERCESC_INCLUDE_GUARD_XSVALUE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class RegularExpression; + +class XMLPARSER_EXPORT XSValue : public XMemory +{ +public: + + enum DataType { + dt_string = 0, + dt_boolean = 1, + dt_decimal = 2, + dt_float = 3, + dt_double = 4, + dt_duration = 5, + dt_dateTime = 6, + dt_time = 7, + dt_date = 8, + dt_gYearMonth = 9, + dt_gYear = 10, + dt_gMonthDay = 11, + dt_gDay = 12, + dt_gMonth = 13, + dt_hexBinary = 14, + dt_base64Binary = 15, + dt_anyURI = 16, + dt_QName = 17, + dt_NOTATION = 18, + dt_normalizedString = 19, + dt_token = 20, + dt_language = 21, + dt_NMTOKEN = 22, + dt_NMTOKENS = 23, + dt_Name = 24, + dt_NCName = 25, + dt_ID = 26, + dt_IDREF = 27, + dt_IDREFS = 28, + dt_ENTITY = 29, + dt_ENTITIES = 30, + dt_integer = 31, + dt_nonPositiveInteger = 32, + dt_negativeInteger = 33, + dt_long = 34, + dt_int = 35, + dt_short = 36, + dt_byte = 37, + dt_nonNegativeInteger = 38, + dt_unsignedLong = 39, + dt_unsignedInt = 40, + dt_unsignedShort = 41, + dt_unsignedByte = 42, + dt_positiveInteger = 43, + dt_MAXCOUNT = 44 + }; + + enum XMLVersion { + ver_10, + ver_11 + }; + + enum Status { + st_Init, + st_NoContent, + st_NoCanRep, + st_NoActVal, + st_NotSupported, + st_CantCreateRegEx, + st_FOCA0002, //invalid lexical value + st_FOCA0001, //input value too large/too small for decimal + st_FOCA0003, //input value too large for integer + st_FODT0003, //invalid timezone value + st_UnknownType + }; + + enum DataGroup { + dg_numerics, + dg_datetimes, + dg_strings + }; + + enum DoubleFloatType + { + DoubleFloatType_NegINF, + DoubleFloatType_PosINF, + DoubleFloatType_NaN, + DoubleFloatType_Zero, + DoubleFloatType_Normal + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + ~XSValue(); + //@} + + //--------------------------------- + /** @name Externalization methods */ + //@{ + + /** + * Validate a given string of the data type specified + * + * @param content data to be validated + * @param datatype schema datatype + * @param status validation status which is set upon validation fails + * @param version xml version + * @param manager memory manager provided + */ + static + bool validate + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version = ver_10 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Get the canonical representation for a given string of the + * data type specified + * + * @param content raw data + * @param datatype schema datatype + * @param status validation status which is set upon validation fails + * @param version xml version + * @param toValidate to validate the content before generate canonical representation + * @param manager memory manager provided + */ + static + XMLCh* getCanonicalRepresentation + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version = ver_10 + , bool toValidate = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Get the actual value, in the form of XSValue, for a given string of the + * data type specified + * + * Client application is responsible for the deletion of the XSValue returned. + * + * @param content raw data + * @param datatype schema datatype + * @param status validation status which is set upon validation fails + * @param version xml version + * @param toValidate to validate the content before generate actual value + * @param manager memory manager provided + */ + static + XSValue* getActualValue + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version = ver_10 + , bool toValidate = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + static + DataType getDataType (const XMLCh* const dtString); + + //@} + + //---------------------------------- + /** public data */ + + struct XSValue_Data { + + DataType f_datatype; + + union { + bool f_bool; + char f_char; + unsigned char f_uchar; + short f_short; + unsigned short f_ushort; + int f_int; + unsigned int f_uint; + long f_long; + unsigned long f_ulong; + float f_float; + double f_double; + XMLCh* f_strVal; + XMLByte* f_byteVal; + + struct decimal { + double f_dvalue; + } f_decimal; + + struct datetime { + int f_year; + int f_month; + int f_day; + int f_hour; + int f_min; + int f_second; + double f_milisec; + + } f_datetime; + + struct doubletype { + double f_double; + DoubleFloatType f_doubleEnum; + } f_doubleType; + + struct floattype { + float f_float; + DoubleFloatType f_floatEnum; + } f_floatType; + + + + } fValue; + + } fData; + +private: + + typedef union + { + long f_long; + unsigned long f_ulong; + } t_value; + + /** @name Constructors */ + //@{ + /** + * The default constructor + * + */ + XSValue( + DataType const dt + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@}; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSValue(const XSValue&); + XSValue & operator=(const XSValue &); + + //--------------------------------- + /** @name Helpers */ + + //@{ + + static const XSValue::DataGroup inGroup[]; + static const bool numericSign[]; + + //@} + + static + bool validateNumerics + ( + const XMLCh* const content + , DataType datatype + , Status& status + , MemoryManager* const manager + ); + + static + bool validateDateTimes + ( + const XMLCh* const content + , DataType datatype + , Status& status + , MemoryManager* const manager + ); + + static + bool validateStrings + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , MemoryManager* const manager + ); + + static + XMLCh* getCanRepNumerics + ( + const XMLCh* const content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager + ); + + static + XMLCh* getCanRepDateTimes + ( + const XMLCh* const content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager + ); + + static + XMLCh* getCanRepStrings + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager + ); + + static + XSValue* getActValNumerics + ( + const XMLCh* const content + , DataType datatype + , Status& status + , bool toValidate + , MemoryManager* const manager + ); + + static + XSValue* getActValDateTimes + ( + const XMLCh* const content + , DataType datatype + , Status& status + , MemoryManager* const manager + ); + + static + XSValue* getActValStrings + ( + const XMLCh* const content + , DataType datatype + , Status& status + , XMLVersion version + , bool toValidate + , MemoryManager* const manager + ); + + static + bool getActualNumericValue + ( + const XMLCh* const content + , Status& status + , t_value& retVal + , MemoryManager* const manager + , DataType datatype + ); + + static ValueHashTableOf* fDataTypeRegistry; + + // ----------------------------------------------------------------------- + // static helper methods + // ----------------------------------------------------------------------- + static void initializeRegistry(); + friend class XMLInitializer; + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + bool fMemAllocated; + MemoryManager* fMemoryManager; + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.cpp b/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.cpp new file mode 100644 index 000000000..65858a681 --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.cpp @@ -0,0 +1,181 @@ +/* + * 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: XSWildcard.cpp 674012 2008-07-04 11:18:21Z borisk $ + */ + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSWildcard: Constructors and Destructor +// --------------------------------------------------------------------------- +XSWildcard::XSWildcard(SchemaAttDef* const attWildCard, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::WILDCARD, xsModel, manager) + , fConstraintType(NSCONSTRAINT_ANY) + , fProcessContents(PC_STRICT) + , fNsConstraintList(0) + , fAnnotation(annot) +{ + XMLAttDef::AttTypes attType = attWildCard->getType(); + if (attType == XMLAttDef::Any_Other) + { + fConstraintType = NSCONSTRAINT_NOT; + fNsConstraintList = new (manager) RefArrayVectorOf(1, true, manager); + fNsConstraintList->addElement + ( + XMLString::replicate(fXSModel->getURIStringPool()->getValueForId( + attWildCard->getAttName()->getURI()), manager) + ); + } + else if (attType == XMLAttDef::Any_List) + { + fConstraintType = NSCONSTRAINT_DERIVATION_LIST; + ValueVectorOf* nsList = attWildCard->getNamespaceList(); + if (nsList) + { + XMLSize_t nsListSize = nsList->size(); + if (nsListSize) + { + fNsConstraintList = new (manager) RefArrayVectorOf(nsListSize, true, manager); + for (XMLSize_t i=0; i < nsListSize; i++) + { + fNsConstraintList->addElement + ( + XMLString::replicate + ( + fXSModel->getURIStringPool()->getValueForId + ( + nsList->elementAt(i) + ) + , manager + ) + ); + } + } + } + } + + XMLAttDef::DefAttTypes attDefType = attWildCard->getDefaultType(); + if (attDefType == XMLAttDef::ProcessContents_Skip) + fProcessContents = PC_SKIP; + else if (attDefType == XMLAttDef::ProcessContents_Lax) + fProcessContents = PC_LAX; +} + +XSWildcard::XSWildcard(const ContentSpecNode* const elmWildCard, + XSAnnotation* const annot, + XSModel* const xsModel, + MemoryManager* const manager) + : XSObject(XSConstants::WILDCARD, xsModel, manager) + , fConstraintType(NSCONSTRAINT_ANY) + , fProcessContents(PC_STRICT) + , fNsConstraintList(0) + , fAnnotation(annot) +{ + ContentSpecNode::NodeTypes nodeType = elmWildCard->getType(); + if ((nodeType & 0x0f) == ContentSpecNode::Any_Other) + { + fConstraintType = NSCONSTRAINT_NOT; + if (nodeType == ContentSpecNode::Any_Other_Lax) + fProcessContents = PC_LAX; + else if (nodeType == ContentSpecNode::Any_Other_Skip) + fProcessContents = PC_SKIP; + } + else if ((nodeType & 0x0f) == ContentSpecNode::Any_NS) + { + fConstraintType = NSCONSTRAINT_DERIVATION_LIST; + if (nodeType == ContentSpecNode::Any_NS_Lax) + fProcessContents = PC_LAX; + else if (nodeType == ContentSpecNode::Any_NS_Skip) + fProcessContents = PC_SKIP; + } + else if (nodeType == ContentSpecNode::Any_NS_Choice) + { + fConstraintType = NSCONSTRAINT_DERIVATION_LIST; + // inspect the second child, not the first one, as the first could hold another Any_NS_Choice wrapper + // if the choices are more than 2, while the second child is always a leaf node + ContentSpecNode::NodeTypes anyType = elmWildCard->getSecond()->getType(); + + if (anyType == ContentSpecNode::Any_NS_Lax) + fProcessContents = PC_LAX; + else if (anyType == ContentSpecNode::Any_NS_Skip) + fProcessContents = PC_SKIP; + + fNsConstraintList = new (manager) RefArrayVectorOf(4, true, manager); + buildNamespaceList(elmWildCard); + } + // must be any + else + { + if (nodeType == ContentSpecNode::Any_Lax) + fProcessContents = PC_LAX; + else if (nodeType == ContentSpecNode::Any_Skip) + fProcessContents = PC_SKIP; + } + + if (fConstraintType == NSCONSTRAINT_NOT + || (fConstraintType == NSCONSTRAINT_DERIVATION_LIST + && !fNsConstraintList)) + { + fNsConstraintList = new (manager) RefArrayVectorOf(1, true, manager); + fNsConstraintList->addElement + ( + XMLString::replicate(fXSModel->getURIStringPool()->getValueForId( + elmWildCard->getElement()->getURI()), manager) + ); + } +} + +XSWildcard::~XSWildcard() +{ + if (fNsConstraintList) + delete fNsConstraintList; +} + +// --------------------------------------------------------------------------- +// XSWildcard: helper methods +// --------------------------------------------------------------------------- +void XSWildcard::buildNamespaceList(const ContentSpecNode* const rootNode) +{ + ContentSpecNode::NodeTypes nodeType = rootNode->getType(); + if (nodeType == ContentSpecNode::Any_NS_Choice) + { + buildNamespaceList(rootNode->getFirst()); + buildNamespaceList(rootNode->getSecond()); + } + else + { + fNsConstraintList->addElement + ( + XMLString::replicate(fXSModel->getURIStringPool()->getValueForId( + rootNode->getElement()->getURI()), fMemoryManager) + ); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.hpp b/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.hpp new file mode 100644 index 000000000..c1c3fbd3d --- /dev/null +++ b/project/jni/xerces/src/xercesc/framework/psvi/XSWildcard.hpp @@ -0,0 +1,201 @@ +/* + * 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: XSWildcard.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSWILDCARD_HPP) +#define XERCESC_INCLUDE_GUARD_XSWILDCARD_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class describes all properties of a Schema Wildcard + * component. + * This is *always* owned by the validator /parser object from which + * it is obtained. + */ + +// forward declarations +class XSAnnotation; +class SchemaAttDef; +class ContentSpecNode; + +class XMLPARSER_EXPORT XSWildcard : public XSObject +{ +public: + + // Namespace Constraint + enum NAMESPACE_CONSTRAINT { + /** + * Namespace Constraint: any namespace is allowed. + */ + NSCONSTRAINT_ANY = 1, + /** + * Namespace Constraint: namespaces in the list are not allowed. + */ + NSCONSTRAINT_NOT = 2, + /** + * Namespace Constraint: namespaces in the list are allowed. + */ + NSCONSTRAINT_DERIVATION_LIST = 3 + }; + + // Process contents + enum PROCESS_CONTENTS { + /** + * There must be a top-level declaration for the item available, or the + * item must have an xsi:type, and the item must be valid as appropriate. + */ + PC_STRICT = 1, + /** + * No constraints at all: the item must simply be well-formed XML. + */ + PC_SKIP = 2, + /** + * If the item, or any items among its [children] is an element + * information item, has a uniquely determined declaration available, it + * must be valid with respect to that definition, that is, validate + * where you can, don't worry when you can't. + */ + PC_LAX = 3 + }; + + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * The default constructor + * + * @param attWildCard + * @param annot + * @param xsModel + * @param manager The configurable memory manager + */ + XSWildcard + ( + SchemaAttDef* const attWildCard + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XSWildcard + ( + const ContentSpecNode* const elmWildCard + , XSAnnotation* const annot + , XSModel* const xsModel + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** @name Destructor */ + //@{ + ~XSWildcard(); + //@} + + //--------------------- + /** @name XSWildcard methods */ + + //@{ + + /** + * Namespace constraint: A constraint type: any, not, list. + */ + NAMESPACE_CONSTRAINT getConstraintType() const; + + /** + * Namespace constraint. For constraintType + * NSCONSTRAINT_DERIVATION_LIST, the list contains allowed namespaces. + * For constraintType NSCONSTRAINT_NOT, the + * list contains disallowed namespaces. + */ + StringList *getNsConstraintList(); + + /** + * [process contents]: one of skip, lax or strict. Valid constants values + * are: PC_SKIP, PC_LAX, PC_STRICT. + */ + PROCESS_CONTENTS getProcessContents() const; + + /** + * Optional. An [annotation]. + */ + XSAnnotation *getAnnotation() const; + + //@} + + //---------------------------------- + /** methods needed by implementation */ + + //@{ + + //@} +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSWildcard(const XSWildcard&); + XSWildcard & operator=(const XSWildcard &); + + /** + * Build namespace list + */ + void buildNamespaceList(const ContentSpecNode* const rootNode); + +protected: + + // ----------------------------------------------------------------------- + // data members + // ----------------------------------------------------------------------- + NAMESPACE_CONSTRAINT fConstraintType; + PROCESS_CONTENTS fProcessContents; + StringList* fNsConstraintList; + XSAnnotation* fAnnotation; +}; + +inline XSAnnotation *XSWildcard::getAnnotation() const +{ + return fAnnotation; +} + +inline XSWildcard::PROCESS_CONTENTS XSWildcard::getProcessContents() const +{ + return fProcessContents; +} + +inline StringList* XSWildcard::getNsConstraintList() +{ + return fNsConstraintList; +} + +inline XSWildcard::NAMESPACE_CONSTRAINT XSWildcard::getConstraintType() const +{ + return fConstraintType; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.cpp b/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.cpp new file mode 100644 index 000000000..8453b230f --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.cpp @@ -0,0 +1,95 @@ +/* + * 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: BinFileOutputStream.cpp 553915 2007-07-06 14:57:08Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BinFileOutputStream: Constructors and Destructor +// --------------------------------------------------------------------------- +BinFileOutputStream::~BinFileOutputStream() +{ + if (getIsOpen()) + XMLPlatformUtils::closeFile(fSource, fMemoryManager); +} + +BinFileOutputStream::BinFileOutputStream(const XMLCh* const fileName + , MemoryManager* const manager) + +:fSource(XMLPlatformUtils::openFileToWrite(fileName, manager)) +,fMemoryManager(manager) +{ +} + +BinFileOutputStream::BinFileOutputStream(const char* const fileName + , MemoryManager* const manager) +:fSource(XMLPlatformUtils::openFileToWrite(fileName, manager)) +,fMemoryManager(manager) +{ +} + +// --------------------------------------------------------------------------- +// BinFileOutputStream: Getter methods +// --------------------------------------------------------------------------- +XMLFilePos BinFileOutputStream::getSize() const +{ + return XMLPlatformUtils::fileSize(fSource, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// BinFileOutputStream: Stream management methods +// --------------------------------------------------------------------------- +void BinFileOutputStream::reset() +{ + XMLPlatformUtils::resetFile(fSource, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// BinFileOutputStream: Implementation of the input stream interface +// --------------------------------------------------------------------------- +XMLFilePos BinFileOutputStream::curPos() const +{ + return XMLPlatformUtils::curFilePos(fSource, fMemoryManager); +} + + +void BinFileOutputStream::writeBytes( const XMLByte* const toGo + , const XMLSize_t maxToWrite) +{ + // + // Write up to the maximum bytes requested. + // + + XMLPlatformUtils::writeBufferToFile(fSource, maxToWrite, toGo, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.hpp b/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.hpp new file mode 100644 index 000000000..00daf8e46 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/BinFileOutputStream.hpp @@ -0,0 +1,100 @@ +/* + * 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: BinFileOutputStream.hpp 553915 2007-07-06 14:57:08Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BINFILEOUTPUTSTREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BINFILEOUTPUTSTREAM_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinFileOutputStream : public BinOutputStream +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + ~BinFileOutputStream(); + + BinFileOutputStream + ( + const XMLCh* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + BinFileOutputStream + ( + const char* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getIsOpen() const; + XMLFilePos getSize() const; + void reset(); + + + // ----------------------------------------------------------------------- + // Implementation of the input stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const; + + virtual void writeBytes + ( + const XMLByte* const toGo + , const XMLSize_t maxToWrite + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BinFileOutputStream(const BinFileOutputStream&); + BinFileOutputStream& operator=(const BinFileOutputStream&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fSource + // The source file that we represent. The FileHandle type is defined + // per platform. + // ----------------------------------------------------------------------- + FileHandle fSource; + MemoryManager* const fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// BinFileOutputStream: Getter methods +// --------------------------------------------------------------------------- +inline bool BinFileOutputStream::getIsOpen() const +{ + return (fSource != (FileHandle) XERCES_Invalid_File_Handle); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.cpp b/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.cpp new file mode 100644 index 000000000..ad8371e63 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.cpp @@ -0,0 +1,120 @@ +/* + * 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: BinMemOutputStream.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +BinMemOutputStream::BinMemOutputStream( XMLSize_t initCapacity + , MemoryManager* const manager) +: fMemoryManager(manager) +, fDataBuf(0) +, fIndex(0) +, fCapacity(initCapacity) +{ + // Buffer is one larger than capacity, to allow for zero term + fDataBuf = (XMLByte*) fMemoryManager->allocate + ( + (fCapacity + 4) * sizeof(XMLByte) + ); + + // Keep it null terminated + fDataBuf[0] = XMLByte(0); +} + +BinMemOutputStream::~BinMemOutputStream() +{ + fMemoryManager->deallocate(fDataBuf); +} + +void BinMemOutputStream::writeBytes( const XMLByte* const toGo + , const XMLSize_t maxToWrite) +{ + + if (maxToWrite) + { + ensureCapacity(maxToWrite); + memcpy(&fDataBuf[fIndex], toGo, maxToWrite * sizeof(XMLByte)); + fIndex += maxToWrite; + } + +} + +const XMLByte* BinMemOutputStream::getRawBuffer() const +{ + fDataBuf[fIndex] = 0; + fDataBuf[fIndex + 1] = 0; + fDataBuf[fIndex + 2] = 0; + fDataBuf[fIndex + 3] = 0; + return fDataBuf; +} + +void BinMemOutputStream::reset() +{ + fIndex = 0; + for (int i = 0; i < 4; i++) + { + fDataBuf[fIndex + i] = 0; + } +} + +XMLFilePos BinMemOutputStream::curPos() const +{ + return fIndex; +} + +XMLFilePos BinMemOutputStream::getSize() const +{ + return fCapacity; +} + +// --------------------------------------------------------------------------- +// BinMemOutputStream: Private helper methods +// --------------------------------------------------------------------------- +void BinMemOutputStream::ensureCapacity(const XMLSize_t extraNeeded) +{ + // If we can handle it, do nothing yet + if (fIndex + extraNeeded < fCapacity) + return; + + // Oops, not enough room. Calc new capacity and allocate new buffer + const XMLSize_t newCap = ((fIndex + extraNeeded) * 2); + XMLByte* newBuf = (XMLByte*) fMemoryManager->allocate + ( + (newCap+4) * sizeof(XMLByte) + ); + + memset(newBuf, 0, (newCap+4) * sizeof(XMLByte)); + + // Copy over the old stuff + memcpy(newBuf, fDataBuf, fCapacity * sizeof(XMLByte) + 4); + + // Clean up old buffer and store new stuff + fMemoryManager->deallocate(fDataBuf); + fDataBuf = newBuf; + fCapacity = newCap; +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.hpp b/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.hpp new file mode 100644 index 000000000..861c48562 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/BinMemOutputStream.hpp @@ -0,0 +1,103 @@ +/* + * 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: BinMemOutputStream.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BINMEMOUTPUTSTREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BINMEMOUTPUTSTREAM_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinMemOutputStream : public BinOutputStream +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + ~BinMemOutputStream(); + + BinMemOutputStream + ( + XMLSize_t initCapacity = 1023 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // ----------------------------------------------------------------------- + // Implementation of the output stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const; + + virtual void writeBytes + ( + const XMLByte* const toGo + , const XMLSize_t maxToWrite + ) ; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const XMLByte* getRawBuffer() const; + + XMLFilePos getSize() const; + void reset(); + +private : + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + BinMemOutputStream(const BinMemOutputStream&); + BinMemOutputStream& operator=(const BinMemOutputStream&); + + // ----------------------------------------------------------------------- + // Private helpers + // ----------------------------------------------------------------------- + void ensureCapacity(const XMLSize_t extraNeeded); + + // ----------------------------------------------------------------------- + // Private data members + // + // fDataBuf + // The pointer to the buffer data. Its grown as needed. Its always + // one larger than fCapacity, to leave room for the null terminator. + // + // fIndex + // The current index into the buffer, as characters are appended + // to it. If its zero, then the buffer is empty. + // + // fCapacity + // The current capacity of the buffer. Its actually always one + // larger, to leave room for the null terminator. + // + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + XMLByte* fDataBuf; + XMLSize_t fIndex; + XMLSize_t fCapacity; + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/internal/CharTypeTables.hpp b/project/jni/xerces/src/xercesc/internal/CharTypeTables.hpp new file mode 100644 index 000000000..aa5c45f5a --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/CharTypeTables.hpp @@ -0,0 +1,255 @@ +/* + * 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: CharTypeTables.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CHARTYPETABLES_HPP) +#define XERCESC_INCLUDE_GUARD_CHARTYPETABLES_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// These are character type lookup tables. They are included into XMLReader +// but are in their own private header in order to keep from making that +// file unreadable. +// +// THE RANGES and SINGLES MUST BE IN NUMERICAL ORDER, because the lookup +// method will use this info to short circuit the search! +// --------------------------------------------------------------------------- +static const XMLCh gBaseChars[] = +{ + // Ranges + 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6 + , 0x00F8, 0x00FF + , 0x0100, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E + , 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217 + , 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1 + , 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C + , 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4 + , 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5 + , 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA + , 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7 + , 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6 + , 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990 + , 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD + , 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10 + , 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36 + , 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B + , 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3 + , 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28 + , 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D + , 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95 + , 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA + , 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10 + , 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61 + , 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3 + , 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10 + , 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E + , 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88 + , 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB + , 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47 + , 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103 + , 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155 + , 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF + , 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9 + , 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D + , 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC + , 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB + , 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B + , 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C + , 0xAC00, 0xD7A3 + , 0x00 + + // Singles + , 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5 + , 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C + , 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0 + , 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E + , 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E + , 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B + , 0x1F5D, 0x1FBE, 0x2126, 0x212E + , 0x00 +}; + + +static const XMLCh gCombiningChars[] = +{ + // Ranges + 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1 + , 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652 + , 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4 + , 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C + , 0x0951, 0x0954, 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4 + , 0x09C7, 0x09C8, 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42 + , 0x0A47, 0x0A48, 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83 + , 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03 + , 0x0B3E, 0x0B43, 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57 + , 0x0B82, 0x0B83, 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD + , 0x0C01, 0x0C03, 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D + , 0x0C55, 0x0C56, 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8 + , 0x0CCA, 0x0CCD, 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43 + , 0x0D46, 0x0D48, 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E + , 0x0EB4, 0x0EB9, 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19 + , 0x0F71, 0x0F84, 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD + , 0x0FB1, 0x0FB7, 0x20D0, 0x20DC, 0x302A, 0x302F + , 0x00 + + // Singles + , 0x05BF, 0x05C4, 0x0670 + , 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02 + , 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31 + , 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9 + , 0x20E1, 0x3099, 0x309A + , 0x00 +}; + + +static const XMLCh gDigitChars[] = +{ + // Ranges + 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F + , 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F + , 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F + , 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29 + , 0x00 + + // Singles + , 0x00 +}; + + +static const XMLCh gIdeographicChars[] = +{ + // Ranges + 0x3021, 0x3029, 0x4E00, 0x9FA5 + , 0x00 + + // Singles + , 0x3007 + , 0x00 +}; + +static const XMLCh gExtenderChars[] = +{ + // Ranges + 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE + , 0x00 + + // Singles + , 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005 + , 0x00 +}; + + +static const XMLCh gPublicIdChars[] = +{ + // Ranges + 0x0023, 0x0025, 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A + , 0x00 + + // Singles + , 0x000A, 0x000D, 0x0020, 0x0021, 0x003D, 0x005F + , 0x00 +}; + + +static const XMLCh gWhitespaceChars[] = +{ + // Ranges + 0x00 + + , 0x0020, 0x0009, 0x000D, 0x000A + , 0x00 +}; + + +static const XMLCh gXMLChars[] = +{ + // Ranges + 0x0020, 0xD7FF, 0xE000, 0xFFFD + , 0x00 + + , 0x0009, 0x000D, 0x000A + , 0x00 +}; + +// The following are for XML 1.1 +static const XMLCh gWhitespaceChars1_1[] = +{ + // Ranges + 0x00 + + , 0x0020, 0x0009, 0x000D, 0x000A, 0x0085, 0x2028 + , 0x00 +}; + +static const XMLCh gFirstNameChars1_1[] = +{ + // Ranges + // Note: 0x10000 to 0xEFFFF are also allowed, need to separately check + 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6 + , 0x00F8, 0x02FF, 0x0370, 0x037D, 0x037F, 0x1FFF, 0x200C, 0x200D + , 0x2070, 0x218F, 0x2C00, 0x2FEF, 0x3001, 0xD7FF, 0xF900, 0xFDCF + , 0xFDF0, 0xFFFD + , 0x00 + + , 0x003A, 0x005F + , 0x00 + +}; + +static const XMLCh gNameChars1_1[] = +{ + // Ranges + // Note: 0x10000 to 0xEFFFF are also allowed, need to separately check + 0x0030, 0x0039, 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6 + , 0x00D8, 0x00F6, 0x00F8, 0x037D, 0x037F, 0x1FFF, 0x200C, 0x200D + , 0x203F, 0x2040, 0x2070, 0x218F, 0x2C00, 0x2FEF, 0x3001, 0xD7FF + , 0xF900, 0xFDCF, 0xFDF0, 0xFFFD + , 0x00 + + , 0x002D, 0x002E, 0x003A, 0x005F, 0x00B7 + , 0x00 +}; + +static const XMLCh gXMLChars1_1[] = +{ + // Ranges + 0x0020, 0x007E, 0x00A0, 0xD7FF, 0xE000, 0xFFFD + , 0x00 + + , 0x0009, 0x000D, 0x000A, 0x0085 + , 0x00 +}; + +static const XMLCh gControl_Chars1_1[] = +{ + // Ranges + 0x0001, 0x001F, 0x007F, 0x009F + , 0x00 + + , 0x00 +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/DGXMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/DGXMLScanner.cpp new file mode 100644 index 000000000..3f0c73e9b --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/DGXMLScanner.cpp @@ -0,0 +1,3572 @@ +/* + * 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: DGXMLScanner.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ReaderMgrResetType; + + +// --------------------------------------------------------------------------- +// DGXMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +DGXMLScanner::DGXMLScanner(XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(valToAdopt, grammarResolver, manager) + , fAttrNSList(0) + , fDTDValidator(0) + , fDTDGrammar(0) + , fDTDElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) +{ + CleanupType cleanup(this, &DGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +DGXMLScanner::DGXMLScanner( XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errHandler + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt, grammarResolver, manager) + , fAttrNSList(0) + , fDTDValidator(0) + , fDTDGrammar(0) + , fDTDElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) +{ + CleanupType cleanup(this, &DGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +DGXMLScanner::~DGXMLScanner() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- +NameIdPool* DGXMLScanner::getEntityDeclPool() +{ + if(!fGrammar) + return 0; + return ((DTDGrammar*)fGrammar)->getEntityDeclPool(); +} + +const NameIdPool* DGXMLScanner::getEntityDeclPool() const +{ + if(!fGrammar) + return 0; + return ((DTDGrammar*)fGrammar)->getEntityDeclPool(); +} + +// --------------------------------------------------------------------------- +// DGXMLScanner: Main entry point to scan a document +// --------------------------------------------------------------------------- +void DGXMLScanner::scanDocument(const InputSource& src) +{ + // Bump up the sequence id for this parser instance. This will invalidate + // any previous progressive scan tokens. + fSequenceId++; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + // Reset the scanner and its plugged in stuff for a new run. This + // resets all the data structures, creates the initial reader and + // pushes it on the stack, and sets up the base document path. + scanReset(src); + + // If we have a document handler, then call the start document + if (fDocHandler) + fDocHandler->startDocument(); + + // Scan the prolog part, which is everything before the root element + // including the DTD subsets. + scanProlog(); + + // If we got to the end of input, then its not a valid XML file. + // Else, go on to scan the content. + if (fReaderMgr.atEOF()) + { + emitError(XMLErrs::EmptyMainEntity); + } + else + { + // Scan content, and tell it its not an external entity + if (scanContent()) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + if (!fReaderMgr.atEOF()) + scanMiscellaneous(); + } + } + + // If we have a document handler, then call the end document + if (fDocHandler) + fDocHandler->endDocument(); + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } +} + + +bool DGXMLScanner::scanNext(XMLPScanToken& token) +{ + // Make sure this token is still legal + if (!isLegalToken(token)) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_BadPScanToken, fMemoryManager); + + // Find the next token and remember the reader id + XMLSize_t orgReader; + XMLTokens curToken; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + bool retVal = true; + + try + { + while (true) + { + // We have to handle any end of entity exceptions that happen here. + // We could be at the end of X nested entities, each of which will + // generate an end of entity exception as we try to move forward. + try + { + curToken = senseNextToken(orgReader); + break; + } + catch(const EndOfEntityException& toCatch) + { + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + if (curToken == Token_CharData) + { + scanCharData(fCDataBuf); + } + else if (curToken == Token_EOF) + { + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + retVal = false; + } + else + { + // Its some sort of markup + bool gotData = true; + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // If we hit the end, then do the miscellaneous part + if (!gotData) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + scanMiscellaneous(); + + if (fDocHandler) + fDocHandler->endDocument(); + } + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so return failure + retVal = false; + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so return failure + retVal = false; + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + retVal = false; + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + // If we are not at the end, release the object that will + // reset the ReaderMgr. + if (retVal) + resetReaderMgr.release(); + + return retVal; +} + + +// --------------------------------------------------------------------------- +// DGXMLScanner: Private scanning methods +// --------------------------------------------------------------------------- + +// This method will kick off the scanning of the primary content of the +// document, i.e. the elements. +bool DGXMLScanner::scanContent() +{ + // Go into a loop until we hit the end of the root element, or we fall + // out because there is no root element. + // + // We have to do kind of a deeply nested double loop here in order to + // avoid doing the setup/teardown of the exception handler on each + // round. Doing it this way we only do it when an exception actually + // occurs. + bool gotData = true; + bool inMarkup = false; + while (gotData) + { + try + { + while (gotData) + { + // Sense what the next top level token is. According to what + // this tells us, we will call something to handle that kind + // of thing. + XMLSize_t orgReader; + const XMLTokens curToken = senseNextToken(orgReader); + + // Handle character data and end of file specially. Char data + // is not markup so we don't want to handle it in the loop + // below. + if (curToken == Token_CharData) + { + // Scan the character data and call appropriate events. Let + // him use our local character data buffer for efficiency. + scanCharData(fCDataBuf); + continue; + } + else if (curToken == Token_EOF) + { + // The element stack better be empty at this point or we + // ended prematurely before all elements were closed. + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + // Its the end of file, so clear the got data flag + gotData = false; + continue; + } + + // We are in some sort of markup now + inMarkup = true; + + // According to the token we got, call the appropriate + // scanning method. + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // And we are back out of markup again + inMarkup = false; + } + } + catch(const EndOfEntityException& toCatch) + { + // If we were in some markup when this happened, then its a + // partial markup error. + if (inMarkup) + emitError(XMLErrs::PartialMarkupInEntity); + + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + + inMarkup = false; + } + } + + // It went ok, so return success + return true; +} + + +void DGXMLScanner::scanEndTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the end of the root element. + gotData = true; + + // Check if the element stack is empty. If so, then this is an unbalanced + // element (i.e. more ends than starts, perhaps because of bad text + // causing one to be skipped.) + if (fElemStack.isEmpty()) + { + emitError(XMLErrs::MoreEndThanStartTags); + fReaderMgr.skipPastChar(chCloseAngle); + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd, fMemoryManager); + } + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + unsigned int uriId = (fDoNamespaces) + ? fElemStack.getCurrentURI() : fEmptyNamespaceId; + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + const ElemStack::StackElem* topElem = fElemStack.popTop(); + XMLElementDecl *tempElement = topElem->fThisElement; + + // See if it was the root element, to avoid multiple calls below + const bool isRoot = fElemStack.isEmpty(); + + // Make sure that its the end of the element that we expect + if (!fReaderMgr.skippedStringLong(tempElement->getFullName())) + { + emitError + ( + XMLErrs::ExpectedEndOfTagX + , tempElement->getFullName() + ); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Make sure we are back on the same reader as where we started + if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialTagMarkupError); + + // Skip optional whitespace + fReaderMgr.skipPastSpaces(); + + // Make sure we find the closing bracket + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError + ( + XMLErrs::UnterminatedEndTag + , topElem->fThisElement->getFullName() + ); + } + + // If validation is enabled, then lets pass him the list of children and + // this element and let him validate it. + if (fValidate) + { + + // + // XML1.0-3rd + // Validity Constraint: + // The declaration matches EMPTY and the element has no content (not even + // entity references, comments, PIs or white space). + // + if ( (topElem->fCommentOrPISeen) && + (((DTDElementDecl*) topElem->fThisElement)->getModelType() == DTDElementDecl::Empty)) + { + fValidator->emitError + ( + XMLValid::EmptyElemHasContent + , topElem->fThisElement->getFullName() + ); + } + + // + // XML1.0-3rd + // Validity Constraint: + // + // The declaration matches children and the sequence of child elements + // belongs to the language generated by the regular expression in the + // content model, with optional white space, comments and PIs + // (i.e. markup matching production [27] Misc) between the start-tag and + // the first child element, between child elements, or between the last + // child element and the end-tag. + // + // Note that + // a CDATA section containing only white space or + // a reference to an entity whose replacement text is character references + // expanding to white space do not match the nonterminal S, and hence + // cannot appear in these positions; however, + // a reference to an internal entity with a literal value consisting + // of character references expanding to white space does match S, + // since its replacement text is the white space resulting from expansion + // of the character references. + // + if ( (topElem->fReferenceEscaped) && + (((DTDElementDecl*) topElem->fThisElement)->getModelType() == DTDElementDecl::Children)) + { + fValidator->emitError + ( + XMLValid::ElemChildrenHasInvalidWS + , topElem->fThisElement->getFullName() + ); + } + + XMLSize_t failure; + bool res = fValidator->checkContent + ( + topElem->fThisElement + , topElem->fChildren + , topElem->fChildCount + , &failure + ); + + if (!res) + { + // One of the elements is not valid for the content. NOTE that + // if no children were provided but the content model requires + // them, it comes back with a zero value. But we cannot use that + // to index the child array in this case, and have to put out a + // special message. + if (!topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::EmptyNotValidForContent + , topElem->fThisElement->getFormattedContentModel() + ); + } + else if (failure >= topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::NotEnoughElemsForCM + , topElem->fThisElement->getFormattedContentModel() + ); + } + else + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , topElem->fChildren[failure]->getRawName() + , topElem->fThisElement->getFormattedContentModel() + ); + } + } + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + fDocHandler->endElement + ( + *topElem->fThisElement + , uriId + , isRoot + , (fDoNamespaces) + ? topElem->fThisElement->getElementName()->getPrefix() + : XMLUni::fgZeroLenString + ); + } + + // If this was the root, then done with content + gotData = !isRoot; +} + + +// This method handles the high level logic of scanning the DOCType +// declaration. This calls the DTDScanner and kicks off both the scanning of +// the internal subset and the scanning of the external subset, if any. +// +// When we get here the 'resetDocType(); + + // There must be some space after DOCTYPE + bool skippedSomething; + fReaderMgr.skipPastSpaces(skippedSomething); + if (!skippedSomething) + { + emitError(XMLErrs::ExpectedWhitespace); + + // Just skip the Doctype declaration and return + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Get a buffer for the root element + XMLBufBid bbRootName(&fBufMgr); + + // Get a name from the input, which should be the name of the root + // element of the upcoming content. + int colonPosition; + bool validName = fDoNamespaces ? fReaderMgr.getQName(bbRootName.getBuffer(), &colonPosition) : + fReaderMgr.getName(bbRootName.getBuffer()); + if (!validName) + { + if (bbRootName.isEmpty()) + emitError(XMLErrs::NoRootElemInDOCTYPE); + else + emitError(XMLErrs::InvalidRootElemInDOCTYPE, bbRootName.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Store the root element name for later check + setRootElemName(bbRootName.getRawBuffer()); + + // This element obviously is not going to exist in the element decl + // pool yet, but we need to call docTypeDecl. So force it into + // the element decl pool, marked as being there because it was in + // the DOCTYPE. Later, when its declared, the status will be updated. + // + // Only do this if we are not reusing the validator! If we are reusing, + // then look it up instead. It has to exist! + MemoryManager* const rootDeclMgr = + fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager; + + DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl + ( + bbRootName.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , rootDeclMgr + ); + + Janitor rootDeclJanitor(rootDecl); + rootDecl->setCreateReason(DTDElementDecl::AsRootElem); + rootDecl->setExternalElemDeclaration(true); + if(!fUseCachedGrammar) + { + fGrammar->putElemDecl(rootDecl); + rootDeclJanitor.release(); + } else + { + // put this in the undeclared pool so it gets deleted... + XMLElementDecl* elemDecl = fDTDElemNonDeclPool->getByKey(bbRootName.getRawBuffer()); + if (elemDecl) + { + rootDecl->setId(elemDecl->getId()); + } + else + { + rootDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)rootDecl)); + rootDeclJanitor.release(); + } + } + + // Skip any spaces after the name + fReaderMgr.skipPastSpaces(); + + // And now if we are looking at a >, then we are done. It is not + // required to have an internal or external subset, though why you + // would not escapes me. + if (fReaderMgr.skippedChar(chCloseAngle)) { + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) + fDocTypeHandler->doctypeDecl(*rootDecl, 0, 0, false); + return; + } + + // either internal/external subset + if (fValScheme == Val_Auto && !fValidate) + fValidate = true; + + bool hasIntSubset = false; + bool hasExtSubset = false; + XMLCh* sysId = 0; + XMLCh* pubId = 0; + + DTDScanner dtdScanner + ( + (DTDGrammar*) fGrammar + , fDocTypeHandler + , fGrammarPoolMemoryManager + , fMemoryManager + ); + dtdScanner.setScannerInfo(this, &fReaderMgr, &fBufMgr); + + // If the next character is '[' then we have no external subset cause + // there is no system id, just the opening character of the internal + // subset. Else, has to be an id. + // + // Just look at the next char, don't eat it. + if (fReaderMgr.peekNextChar() == chOpenSquare) + { + hasIntSubset = true; + } + else + { + // Indicate we have an external subset + hasExtSubset = true; + fHasNoDTD = false; + + // Get buffers for the ids + XMLBufBid bbPubId(&fBufMgr); + XMLBufBid bbSysId(&fBufMgr); + + // Get the external subset id + if (!dtdScanner.scanId(bbPubId.getBuffer(), bbSysId.getBuffer(), DTDScanner::IDType_External)) + { + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Get copies of the ids we got + pubId = XMLString::replicate(bbPubId.getRawBuffer(), fMemoryManager); + sysId = XMLString::replicate(bbSysId.getRawBuffer(), fMemoryManager); + + // Skip spaces and check again for the opening of an internal subset + fReaderMgr.skipPastSpaces(); + + // Just look at the next char, don't eat it. + if (fReaderMgr.peekNextChar() == chOpenSquare) { + hasIntSubset = true; + } + } + + // Insure that the ids get cleaned up, if they got allocated + ArrayJanitor janSysId(sysId, fMemoryManager); + ArrayJanitor janPubId(pubId, fMemoryManager); + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) + fDocTypeHandler->doctypeDecl(*rootDecl, pubId, sysId, hasIntSubset, hasExtSubset); + + // Ok, if we had an internal subset, we are just past the [ character + // and need to parse that first. + if (hasIntSubset) + { + // Eat the opening square bracket + fReaderMgr.getNextChar(); + + checkInternalDTD(hasExtSubset, sysId, pubId); + + // And try to scan the internal subset. If we fail, try to recover + // by skipping forward tot he close angle and returning. + if (!dtdScanner.scanInternalSubset()) + { + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Do a sanity check that some expanded PE did not propogate out of + // the doctype. This could happen if it was terminated early by bad + // syntax. + if (fReaderMgr.getReaderDepth() > 1) + { + emitError(XMLErrs::PEPropogated); + + // Ask the reader manager to pop back down to the main level + fReaderMgr.cleanStackBackTo(1); + } + + fReaderMgr.skipPastSpaces(); + } + + // And that should leave us at the closing > of the DOCTYPE line + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + // Do a special check for the common scenario of an extra ] char at + // the end. This is easy to recover from. + if (fReaderMgr.skippedChar(chCloseSquare) + && fReaderMgr.skippedChar(chCloseAngle)) + { + emitError(XMLErrs::ExtraCloseSquare); + } + else + { + emitError(XMLErrs::UnterminatedDOCTYPE); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + + // If we had an external subset, then we need to deal with that one + // next. If we are reusing the validator, then don't scan it. + if (hasExtSubset) { + + InputSource* srcUsed=0; + Janitor janSrc(srcUsed); + // If we had an internal subset and we're using the cached grammar, it + // means that the ignoreCachedDTD is set, so we ignore the cached + // grammar + if (fUseCachedGrammar && !hasIntSubset) + { + srcUsed = resolveSystemId(sysId, pubId); + if (srcUsed) { + janSrc.reset(srcUsed); + Grammar* grammar = fGrammarResolver->getGrammar(srcUsed->getSystemId()); + + if (grammar && grammar->getGrammarType() == Grammar::DTDGrammarType) { + + fDTDGrammar = (DTDGrammar*) grammar; + fGrammar = fDTDGrammar; + fValidator->setGrammar(fGrammar); + // If we don't report at least the external subset boundaries, + // an advanced document handler cannot know when the DTD end, + // since we've already sent a doctype decl that indicates there's + // there's an external subset. + if (fDocTypeHandler) + { + fDocTypeHandler->startExtSubset(); + fDocTypeHandler->endExtSubset(); + } + + return; + } + } + } + + if (fLoadExternalDTD || fValidate) + { + // And now create a reader to read this entity + XMLReader* reader; + if(srcUsed) { + reader = fReaderMgr.createReader + ( + *srcUsed + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + } + else { + reader = fReaderMgr.createReader + ( + sysId + , pubId + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , srcUsed + , fCalculateSrcOfs + , fLowWaterMark + , fDisableDefaultEntityResolution + ); + janSrc.reset(srcUsed); + } + // If it failed then throw an exception + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenDTD, srcUsed ? srcUsed->getSystemId() : sysId, fMemoryManager); + + if (fToCacheGrammar) { + + unsigned int stringId = fGrammarResolver->getStringPool()->addOrFind(srcUsed->getSystemId()); + const XMLCh* sysIdStr = fGrammarResolver->getStringPool()->getValueForId(stringId); + + fGrammarResolver->orphanGrammar(XMLUni::fgDTDEntityString); + ((XMLDTDDescription*) (fGrammar->getGrammarDescription()))->setSystemId(sysIdStr); + fGrammarResolver->putGrammar(fGrammar); + } + + // In order to make the processing work consistently, we have to + // make this look like an external entity. So create an entity + // decl and fill it in and push it with the reader, as happens + // with an external entity. Put a janitor on it to insure it gets + // cleaned up. The reader manager does not adopt them. + const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull }; + DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager); + declDTD->setSystemId(sysId); + declDTD->setIsExternal(true); + Janitor janDecl(declDTD); + + // Mark this one as a throw at end + reader->setThrowAtEnd(true); + + // And push it onto the stack, with its pseudo name + fReaderMgr.pushReader(reader, declDTD); + + // Tell it its not in an include section + dtdScanner.scanExtSubsetDecl(false, true); + } + } +} + +bool DGXMLScanner::scanStartTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Get the QName. In this case, we are not doing namespaces, so we just + // use it as is and don't have to break it into parts. + + bool validName = fReaderMgr.getName(fQNameBuf); + if (!validName) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // Assume it won't be an empty tag + bool isEmpty = false; + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Lets try to look up the element in the validator's element decl pool + // We can pass bogus values for the URI id and the base name. We know that + // this can only be called if we are doing a DTD style validator and that + // he will only look at the QName. + // + // We *do not* tell him to fault in a decl if he does not find one - NG. + bool wasAdded = false; + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + + XMLElementDecl* elemDecl = fGrammar->getElemDecl + ( + fEmptyNamespaceId + , 0 + , qnameRawBuf + , Grammar::TOP_LEVEL_SCOPE + ); + // look in the undeclared pool: + if(!elemDecl) + { + elemDecl = fDTDElemNonDeclPool->getByKey(qnameRawBuf); + } + if(!elemDecl) + { + wasAdded = true; + elemDecl = new (fMemoryManager) DTDElementDecl + ( + qnameRawBuf + , fEmptyNamespaceId + , DTDElementDecl::Any + , fMemoryManager + ); + elemDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)elemDecl)); + } + + if (fValidate) { + + if (wasAdded) + { + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the validator pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + fValidator->emitError + ( + XMLValid::ElementNotDefined + , qnameRawBuf + ); + } + // If its not marked declared, then emit an error + else if (!elemDecl->isDeclared()) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , qnameRawBuf + ); + } + + + fValidator->validateElement(elemDecl); + } + + // Expand the element stack and add the new element + fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum()); + + // If this is the first element and we are validating, check the root + // element. + if (isRoot) + { + fRootGrammar = fGrammar; + + if (fValidate) + { + // If a DocType exists, then check if it matches the root name there. + if (fRootElemName && !XMLString::equals(qnameRawBuf, fRootElemName)) + fValidator->emitError(XMLValid::RootElemNotLikeDocType); + } + } + else if (fValidate) + { + // If the element stack is not empty, then add this element as a + // child of the previous top element. If its empty, this is the root + // elem and is not the child of anything. + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // We loop until we either see a /> or >, handling attribute/value + // pairs until we get there. + XMLSize_t attCount = 0; + XMLSize_t curAttListSize = fAttrList->size(); + wasAdded = false; + + fElemCount++; + + while (true) + { + // And get the next non-space character + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + // Ok, skip by them and peek another char + fReaderMgr.skipPastSpaces(); + nextCh = fReaderMgr.peekNextChar(); + } + else + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + + validName = fReaderMgr.getName(fAttNameBuf); + if (!validName) + { + if (fAttNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedAttrName); + else + emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return false; + } + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // See if this attribute is declared for this element. If we are + // not validating of course it will not be at first, but we will + // fault it into the pool (to avoid lots of redundant errors.) + XMLCh * namePtr = fAttNameBuf.getRawBuffer(); + XMLAttDef* attDef = ((DTDElementDecl *)elemDecl)->getAttDef(namePtr); + + // Skip any whitespace before the value and then scan the att + // value. This will come back normalized with entity refs and + // char refs expanded. + fReaderMgr.skipPastSpaces(); + if (!scanAttValue(attDef, namePtr, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // Add this attribute to the attribute list that we use to + // pass them to the handler. We reuse its existing elements + // but expand it as required. + // Note that we want to this first since this will + // make a copy of the namePtr; we can then make use of + // that copy in the hashtable lookup that checks + // for duplicates. This will mean we may have to update + // the type of the XMLAttr later. + XMLAttr* curAtt; + const XMLCh* attrValue = fAttValueBuf.getRawBuffer(); + + if (attCount >= curAttListSize) { + curAtt = new (fMemoryManager) XMLAttr(fMemoryManager); + fAttrList->addElement(curAtt); + } + else { + curAtt = fAttrList->elementAt(attCount); + } + + curAtt->setSpecified(true); + + // NO NAMESPACE CODE + { + curAtt->set( + 0, namePtr, XMLUni::fgZeroLenString, XMLUni::fgZeroLenString + , (attDef)?attDef->getType():XMLAttDef::CData + ); + + // now need to prepare for duplicate detection + if (attDef) { + unsigned int *curCountPtr = fAttDefRegistry->get(attDef); + if (!curCountPtr) { + curCountPtr = getNewUIntPtr(); + *curCountPtr = fElemCount; + fAttDefRegistry->put(attDef, curCountPtr); + } + else if (*curCountPtr < fElemCount) { + *curCountPtr = fElemCount; + } + else { + emitError( + XMLErrs::AttrAlreadyUsedInSTag + , attDef->getFullName(), elemDecl->getFullName() + ); + } + } + else + { + // reset namePtr so it refers to newly-allocated memory + namePtr = (XMLCh *)curAtt->getQName(); + if (!fUndeclaredAttrRegistry->putIfNotPresent(namePtr, 0)) + { + emitError( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr, elemDecl->getFullName() + ); + } + } + } + + if (fValidate) + { + if (attDef) { + // Let the validator pass judgement on the attribute value + fValidator->validateAttrValue( + attDef, fAttValueBuf.getRawBuffer(), false, elemDecl + ); + } + else + { + fValidator->emitError + ( + XMLValid::AttNotDefinedForElement + , fAttNameBuf.getRawBuffer(), qnameRawBuf + ); + } + } + + // must set the newly-minted value on the XMLAttr: + curAtt->setValue(attrValue); + attCount++; + + // And jump back to the top of the loop + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // Now lets get the fAttrList filled in. This involves faulting in any + // defaulted and fixed attributes and normalizing the values of any that + // we got explicitly. + // + // We update the attCount value with the total number of attributes, but + // it goes in with the number of values we got during the raw scan of + // explictly provided attrs above. + attCount = buildAttList(attCount, elemDecl, *fAttrList); + + // If we have a document handler, then tell it about this start tag. We + // don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send + // any prefix since its just one big name if we are not doing namespaces. + unsigned int uriId = fEmptyNamespaceId; + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , uriId + , 0 + , *fAttrList + , attCount + , isEmpty + , isRoot + ); + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , qnameRawBuf + , elemDecl->getFormattedContentModel() + ); + } + } + + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + } + + return true; +} + + +bool DGXMLScanner::scanStartTagNS(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Get the QName. In this case, we are not doing namespaces, so we just + // use it as is and don't have to break it into parts. + + int colonPosition; + bool validName = fReaderMgr.getQName(fQNameBuf, &colonPosition); + if (!validName) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // Assume it won't be an empty tag + bool isEmpty = false; + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Lets try to look up the element in the validator's element decl pool + // We can pass bogus values for the URI id and the base name. We know that + // this can only be called if we are doing a DTD style validator and that + // he will only look at the QName. + // + // We *do not* tell him to fault in a decl if he does not find one - NG. + bool wasAdded = false; + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + + XMLElementDecl* elemDecl = fGrammar->getElemDecl + ( + fEmptyNamespaceId + , 0 + , qnameRawBuf + , Grammar::TOP_LEVEL_SCOPE + ); + // look in the undeclared pool: + if(!elemDecl) + { + elemDecl = fDTDElemNonDeclPool->getByKey(qnameRawBuf); + } + if(!elemDecl) + { + wasAdded = true; + elemDecl = new (fMemoryManager) DTDElementDecl + ( + qnameRawBuf + , fEmptyNamespaceId + , DTDElementDecl::Any + , fMemoryManager + ); + elemDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)elemDecl)); + } + + if (fValidate) { + + if (wasAdded) + { + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the validator pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + fValidator->emitError + ( + XMLValid::ElementNotDefined + , qnameRawBuf + ); + } + // If its not marked declared, then emit an error + else if (!elemDecl->isDeclared()) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , qnameRawBuf + ); + } + + + fValidator->validateElement(elemDecl); + } + + // Expand the element stack and add the new element + fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum()); + + // If this is the first element and we are validating, check the root + // element. + if (isRoot) + { + fRootGrammar = fGrammar; + + if (fValidate) + { + // If a DocType exists, then check if it matches the root name there. + if (fRootElemName && !XMLString::equals(qnameRawBuf, fRootElemName)) + fValidator->emitError(XMLValid::RootElemNotLikeDocType); + } + } + else if (fValidate) + { + // If the element stack is not empty, then add this element as a + // child of the previous top element. If its empty, this is the root + // elem and is not the child of anything. + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // We loop until we either see a /> or >, handling attribute/value + // pairs until we get there. + XMLSize_t attCount = 0; + XMLSize_t curAttListSize = fAttrList->size(); + wasAdded = false; + + fElemCount++; + + while (true) + { + // And get the next non-space character + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + // Ok, skip by them and peek another char + fReaderMgr.skipPastSpaces(); + nextCh = fReaderMgr.peekNextChar(); + } + else + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + + validName = fReaderMgr.getQName(fAttNameBuf, &colonPosition); + if (!validName) + { + if (fAttNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedAttrName); + else + emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return false; + } + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // See if this attribute is declared for this element. If we are + // not validating of course it will not be at first, but we will + // fault it into the pool (to avoid lots of redundant errors.) + XMLCh * namePtr = fAttNameBuf.getRawBuffer(); + XMLAttDef* attDef = ((DTDElementDecl *)elemDecl)->getAttDef(namePtr); + + // Skip any whitespace before the value and then scan the att + // value. This will come back normalized with entity refs and + // char refs expanded. + fReaderMgr.skipPastSpaces(); + if (!scanAttValue(attDef, namePtr, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // Add this attribute to the attribute list that we use to + // pass them to the handler. We reuse its existing elements + // but expand it as required. + // Note that we want to this first since this will + // make a copy of the namePtr; we can then make use of + // that copy in the hashtable lookup that checks + // for duplicates. This will mean we may have to update + // the type of the XMLAttr later. + XMLAttr* curAtt; + const XMLCh* attrValue = fAttValueBuf.getRawBuffer(); + + if (attCount >= curAttListSize) { + curAtt = new (fMemoryManager) XMLAttr(fMemoryManager); + fAttrList->addElement(curAtt); + } + else { + curAtt = fAttrList->elementAt(attCount); + } + + curAtt->setSpecified(true); + // DO NAMESPACES + { + curAtt->set( + fEmptyNamespaceId, namePtr, XMLUni::fgZeroLenString + , (attDef)? attDef->getType() : XMLAttDef::CData + ); + + // each attribute has the prefix:suffix="value" + const XMLCh* attPrefix = curAtt->getPrefix(); + const XMLCh* attLocalName = curAtt->getName(); + + if (attPrefix && *attPrefix) { + if (XMLString::equals(attPrefix, XMLUni::fgXMLString)) { + curAtt->setURIId(fXMLNamespaceId); + } + else if (XMLString::equals(attPrefix, XMLUni::fgXMLNSString)) { + curAtt->setURIId(fXMLNSNamespaceId); + updateNSMap(attPrefix, attLocalName, attrValue); + } + else { + fAttrNSList->addElement(curAtt); + } + } + else if (XMLString::equals(XMLUni::fgXMLNSString, attLocalName)) + { + updateNSMap(attPrefix, XMLUni::fgZeroLenString, attrValue); + } + + // NOTE: duplicate attribute check will be done, when we map + // namespaces to all attributes + if (attDef) { + unsigned int *curCountPtr = fAttDefRegistry->get(attDef); + if (!curCountPtr) { + curCountPtr = getNewUIntPtr(); + *curCountPtr = fElemCount; + fAttDefRegistry->put(attDef, curCountPtr); + } + else if (*curCountPtr < fElemCount) { + *curCountPtr = fElemCount; + } + } + } + + if (fValidate) + { + if (attDef) { + // Let the validator pass judgement on the attribute value + fValidator->validateAttrValue( + attDef, fAttValueBuf.getRawBuffer(), false, elemDecl + ); + } + else + { + fValidator->emitError + ( + XMLValid::AttNotDefinedForElement + , fAttNameBuf.getRawBuffer(), qnameRawBuf + ); + } + } + + // must set the newly-minted value on the XMLAttr: + curAtt->setValue(attrValue); + attCount++; + + // And jump back to the top of the loop + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + // Make an initial pass through the list and find any xmlns attributes. + if (attCount) + scanAttrListforNameSpaces(fAttrList, attCount, elemDecl); + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // Now lets get the fAttrList filled in. This involves faulting in any + // defaulted and fixed attributes and normalizing the values of any that + // we got explicitly. + // + // We update the attCount value with the total number of attributes, but + // it goes in with the number of values we got during the raw scan of + // explictly provided attrs above. + attCount = buildAttList(attCount, elemDecl, *fAttrList); + + // If we have a document handler, then tell it about this start tag. We + // don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send + // any prefix since its just one big name if we are not doing namespaces. + if (fDocHandler) + { + unsigned int uriId = resolvePrefix + ( + elemDecl->getElementName()->getPrefix() + , ElemStack::Mode_Element + ); + + fDocHandler->startElement + ( + *elemDecl + , uriId + , elemDecl->getElementName()->getPrefix() + , *fAttrList + , attCount + , isEmpty + , isRoot + ); + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , qnameRawBuf + , elemDecl->getFormattedContentModel() + ); + } + } + + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + } + + return true; +} + +// --------------------------------------------------------------------------- +// DGXMLScanner: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* DGXMLScanner::loadGrammar(const InputSource& src + , const short grammarType + , const bool toCache) +{ + Grammar* loadedGrammar = 0; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + fGrammarResolver->cacheGrammarFromParse(false); + fGrammarResolver->useCachedGrammarInParse(false); + fRootGrammar = 0; + + if (fValScheme == Val_Auto) { + fValidate = true; + } + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + + if (grammarType == Grammar::DTDGrammarType) { + loadedGrammar = loadDTDGrammar(src, toCache); + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + return loadedGrammar; +} + +Grammar* DGXMLScanner::loadDTDGrammar(const InputSource& src, + const bool toCache) +{ + // Reset the validators + fDTDValidator->reset(); + if (fValidatorFromUser) + fValidator->reset(); + + fDTDGrammar = new (fGrammarPoolMemoryManager) DTDGrammar(fGrammarPoolMemoryManager); + fGrammarResolver->putGrammar(fDTDGrammar); + fGrammar = fDTDGrammar; + fValidator->setGrammar(fGrammar); + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + + if (toCache) { + + unsigned int sysId = fGrammarResolver->getStringPool()->addOrFind(src.getSystemId()); + const XMLCh* sysIdStr = fGrammarResolver->getStringPool()->getValueForId(sysId); + + fGrammarResolver->orphanGrammar(XMLUni::fgDTDEntityString); + ((XMLDTDDescription*) (fGrammar->getGrammarDescription()))->setSystemId(sysIdStr); + fGrammarResolver->putGrammar(fGrammar); + } + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // In order to make the processing work consistently, we have to + // make this look like an external entity. So create an entity + // decl and fill it in and push it with the reader, as happens + // with an external entity. Put a janitor on it to insure it gets + // cleaned up. The reader manager does not adopt them. + const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull }; + DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager); + declDTD->setSystemId(src.getSystemId()); + declDTD->setIsExternal(true); + Janitor janDecl(declDTD); + + // Mark this one as a throw at end + newReader->setThrowAtEnd(true); + + // And push it onto the stack, with its pseudo name + fReaderMgr.pushReader(newReader, declDTD); + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) { + + // Create a dummy root + DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + gDTDStr + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + rootDecl->setCreateReason(DTDElementDecl::AsRootElem); + rootDecl->setExternalElemDeclaration(true); + Janitor janSrc(rootDecl); + + fDocTypeHandler->doctypeDecl(*rootDecl, src.getPublicId(), src.getSystemId(), false, true); + } + + // Create DTDScanner + DTDScanner dtdScanner + ( + (DTDGrammar*)fGrammar + , fDocTypeHandler + , fGrammarPoolMemoryManager + , fMemoryManager + ); + dtdScanner.setScannerInfo(this, &fReaderMgr, &fBufMgr); + + // Tell it its not in an include section + dtdScanner.scanExtSubsetDecl(false, true); + + if (fValidate) { + // validate the DTD scan so far + fValidator->preContentValidation(false, true); + } + + if (toCache) + fGrammarResolver->cacheGrammars(); + + return fDTDGrammar; +} + + +// --------------------------------------------------------------------------- +// DGXMLScanner: Private helper methods +// --------------------------------------------------------------------------- +// This method handles the common initialization, to avoid having to do +// it redundantly in multiple constructors. +void DGXMLScanner::commonInit() +{ + // And we need one for the raw attribute scan. This just stores key/ + // value string pairs (prior to any processing.) + fAttrNSList = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + + // Create the Validator and init them + fDTDValidator = new (fMemoryManager) DTDValidator(); + initValidator(fDTDValidator); + fDTDElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + fAttDefRegistry = new (fMemoryManager) RefHashTableOf + ( + 131, false, fMemoryManager + ); + fUndeclaredAttrRegistry = new (fMemoryManager) Hash2KeysSetOf(7, fMemoryManager); + + if (fValidator) + { + if (!fValidator->handlesDTD()) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + } + else + { + fValidator = fDTDValidator; + } +} + +void DGXMLScanner::cleanUp() +{ + delete fAttrNSList; + delete fDTDValidator; + delete fDTDElemNonDeclPool; + delete fAttDefRegistry; + delete fUndeclaredAttrRegistry; +} + + +// This method is called from scanStartTagNS() to build up the list of +// XMLAttr objects that will be passed out in the start tag callout. We +// get the key/value pairs from the raw scan of explicitly provided attrs, +// which have not been normalized. And we get the element declaration from +// which we will get any defaulted or fixed attribute defs and add those +// in as well. +XMLSize_t +DGXMLScanner::buildAttList(const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill) +{ + // Ask the element to clear the 'provided' flag on all of the att defs + // that it owns, and to return us a boolean indicating whether it has + // any defs. + const bool hasDefs = elemDecl->hasAttDefs(); + + // If there are no expliclitily provided attributes and there are no + // defined attributes for the element, the we don't have anything to do. + // So just return zero in this case. + if (!hasDefs && !attCount) + return 0; + + // Keep up with how many attrs we end up with total + XMLSize_t retCount = attCount; + + // And get the current size of the output vector. This lets us use + // existing elements until we fill it, then start adding new ones. + const XMLSize_t curAttListSize = toFill.size(); + + // Ok, so lets get an enumerator for the attributes of this element + // and run through them for well formedness and validity checks. But + // make sure that we had any attributes before we do it, since the list + // would have have gotten faulted in anyway. + if (hasDefs) + { + XMLAttDefList& attDefList = elemDecl->getAttDefList(); + for(XMLSize_t i=0; iget(&curDef); + if (!attCountPtr || *attCountPtr < fElemCount) + { // did not occur + const XMLAttDef::DefAttTypes defType = curDef.getDefaultType(); + + if (fValidate) + { + // If we are validating and its required, then an error + if (defType == XMLAttDef::Required) + { + fValidator->emitError + ( + XMLValid::RequiredAttrNotProvided + , curDef.getFullName() + ); + } + else if ((defType == XMLAttDef::Default) || + (defType == XMLAttDef::Fixed) ) + { + if (fStandalone && curDef.isExternal()) + { + // XML 1.0 Section 2.9 + // Document is standalone, so attributes must not be defaulted. + fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef.getFullName(), elemDecl->getFullName()); + } + } + } + + // Fault in the value if needed, and bump the att count + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + // Let the validator pass judgement on the attribute value + if (fValidate) + { + fValidator->validateAttrValue + ( + &curDef + , curDef.getValue() + , false + , elemDecl + ); + } + + XMLAttr* curAtt; + if (retCount >= curAttListSize) + { + if (fDoNamespaces) + { + curAtt = new (fMemoryManager) XMLAttr + ( + fEmptyNamespaceId + , curDef.getFullName() + , curDef.getValue() + , curDef.getType() + , false + , fMemoryManager + ); + } + else + { + curAtt = new (fMemoryManager) XMLAttr + ( + 0 + , curDef.getFullName() + , XMLUni::fgZeroLenString + , curDef.getValue() + , curDef.getType() + , false + , fMemoryManager + ); + } + + fAttrList->addElement(curAtt); + } + else + { + curAtt = fAttrList->elementAt(retCount); + if (fDoNamespaces) + { + curAtt->set + ( + fEmptyNamespaceId + , curDef.getFullName() + , curDef.getValue() + , curDef.getType() + ); + } + else + { + curAtt->set + ( + 0 + , curDef.getFullName() + , XMLUni::fgZeroLenString + , curDef.getValue() + , curDef.getType() + ); + } + curAtt->setSpecified(false); + } + + if (fDoNamespaces) + { + // Map the new attribute's prefix to a URI id and store + // that in the attribute object. + const XMLCh* attPrefix = curAtt->getPrefix(); + if (attPrefix && *attPrefix) { + curAtt->setURIId + ( + resolvePrefix(attPrefix, ElemStack::Mode_Attribute) + ); + } + } + + retCount++; + } + } + } + } + + return retCount; +} + + +// This method will reset the scanner data structures, and related plugged +// in stuff, for a new scan session. We get the input source for the primary +// XML entity, create the reader for it, and push it on the stack so that +// upon successful return from here we are ready to go. +void DGXMLScanner::scanReset(const InputSource& src) +{ + + // This call implicitly tells us that we are going to reuse the scanner + // if it was previously used. So tell the validator to reset itself. + // + // But, if the fUseCacheGrammar flag is set, then don't reset it. + // + // NOTE: The ReaderMgr is flushed on the way out, because that is + // required to insure that files are closed. + fGrammarResolver->cacheGrammarFromParse(fToCacheGrammar); + fGrammarResolver->useCachedGrammarInParse(fUseCachedGrammar); + + fDTDGrammar = new (fGrammarPoolMemoryManager) DTDGrammar(fGrammarPoolMemoryManager); + fGrammarResolver->putGrammar(fDTDGrammar); + fGrammar = fDTDGrammar; + fRootGrammar = 0; + fValidator->setGrammar(fGrammar); + + // Reset validation + fValidate = (fValScheme == Val_Always) ? true : false; + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + + // Reset the Root Element Name + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + fRootElemName = 0; + + // Reset the element stack, and give it the latest ids for the special + // URIs it has to know about. + fElemStack.reset + ( + fEmptyNamespaceId + , fUnknownNamespaceId + , fXMLNamespaceId + , fXMLNSNamespaceId + ); + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + + // Reset the validators + fDTDValidator->reset(); + fDTDValidator->setErrorReporter(fErrorReporter); + if (fValidatorFromUser) + fValidator->reset(); + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , true + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // Push this read onto the reader manager + fReaderMgr.pushReader(newReader, 0); + + // and reset security-related things if necessary: + if(fSecurityManager != 0) + { + fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } + if(fUIntPoolRowTotal >= 32) + { // 8 KB tied up with validating attributes... + fAttDefRegistry->removeAll(); + recreateUIntPool(); + } + else + { + // note that this will implicitly reset the values of the hashtables, + // though their buckets will still be tied up + resetUIntPool(); + } + fUndeclaredAttrRegistry->removeAll(); + fAttrNSList->removeAllElements(); +} + + +// This method is called between markup in content. It scans for character +// data that is sent to the document handler. It watches for any markup +// characters that would indicate that the character data has ended. It also +// handles expansion of general and character entities. +// +// sendData() is a local static helper for this method which handles some +// code that must be done in three different places here. +void DGXMLScanner::sendCharData(XMLBuffer& toSend) +{ + // If no data in the buffer, then nothing to do + if (toSend.isEmpty()) + return; + + // We do different things according to whether we are validating or + // not. If not, its always just characters; else, it depends on the + // current element's content model. + if (fValidate) + { + // Get the raw data we need for the callback + const XMLCh* const rawBuf = toSend.getRawBuffer(); + const XMLSize_t len = toSend.getLen(); + + // And see if the current element is a 'Children' style content model + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts(); + + if (charOpts == XMLElementDecl::NoCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + } + else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len)) + { + // Its all spaces. So, if they can take spaces, then send it + // as ignorable whitespace. If they can handle any char data + // send it as characters. + if (charOpts == XMLElementDecl::SpacesOk) { + if (fDocHandler) + fDocHandler->ignorableWhitespace(rawBuf, len, false); + } + else if (charOpts == XMLElementDecl::AllCharData) + { + if (fDocHandler) + fDocHandler->docCharacters(rawBuf, len, false); + } + } + else + { + // If they can take any char data, then send it. Otherwise, they + // can only handle whitespace and can't handle this stuff so + // issue an error. + if (charOpts == XMLElementDecl::AllCharData) + { + if (fDocHandler) + fDocHandler->docCharacters(rawBuf, len, false); + } + else + { + fValidator->emitError(XMLValid::NoCharDataInCM); + } + } + } + else + { + // Always assume its just char data if not validating + if (fDocHandler) + fDocHandler->docCharacters(toSend.getRawBuffer(), toSend.getLen(), false); + } + + // Reset buffer + toSend.reset(); +} + + + +// This method is called with a key/value string pair that represents an +// xmlns="yyy" or xmlns:xxx="yyy" attribute. This method will update the +// current top of the element stack based on this data. We know that when +// we get here, that it is one of these forms, so we don't bother confirming +// it. +// +// But we have to ensure +// 1. xxx is not xmlns +// 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa +// 3. yyy is not XMLUni::fgXMLNSURIName +// 4. if xxx is not null, then yyy cannot be an empty string. +void DGXMLScanner::updateNSMap(const XMLCh* const attrPrefix + , const XMLCh* const attrLocalName + , const XMLCh* const attrValue) +{ + // We either have the default prefix (""), or we point it into the attr + // name parameter. Note that the xmlns is not the prefix we care about + // here. To us, the 'prefix' is really the local part of the attrName + // parameter. + // + // Check 1. xxx is not xmlns + // 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa + // 3. yyy is not XMLUni::fgXMLNSURIName + // 4. if xxx is not null, then yyy cannot be an empty string. + if (attrPrefix && *attrPrefix) { + + if (XMLString::equals(attrLocalName, XMLUni::fgXMLNSString)) + emitError(XMLErrs::NoUseOfxmlnsAsPrefix); + else if (XMLString::equals(attrLocalName, XMLUni::fgXMLString)) { + if (!XMLString::equals(attrValue, XMLUni::fgXMLURIName)) + emitError(XMLErrs::PrefixXMLNotMatchXMLURI); + } + + if (!attrValue) + emitError(XMLErrs::NoEmptyStrNamespace, attrLocalName); + else if(!*attrValue && fXMLVersion == XMLReader::XMLV1_0) + emitError(XMLErrs::NoEmptyStrNamespace, attrLocalName); + } + + if (XMLString::equals(attrValue, XMLUni::fgXMLNSURIName)) + emitError(XMLErrs::NoUseOfxmlnsURI); + else if (XMLString::equals(attrValue, XMLUni::fgXMLURIName)) { + if (!XMLString::equals(attrLocalName, XMLUni::fgXMLString)) + emitError(XMLErrs::XMLURINotMatchXMLPrefix); + } + + // Ok, we have to get the unique id for the attribute value, which is the + // URI that this value should be mapped to. The validator has the + // namespace string pool, so we ask him to find or add this new one. Then + // we ask the element stack to add this prefix to URI Id mapping. + fElemStack.addPrefix + ( + attrLocalName + , fURIStringPool->addOrFind(attrValue) + ); +} + +void DGXMLScanner::scanAttrListforNameSpaces(RefVectorOf* theAttrList, XMLSize_t attCount, + XMLElementDecl* elemDecl) +{ + // Map prefixes to uris + for (XMLSize_t i=0; i < fAttrNSList->size(); i++) { + XMLAttr* providedAttr = fAttrNSList->elementAt(i); + providedAttr->setURIId( + resolvePrefix(providedAttr->getPrefix(), ElemStack::Mode_Attribute) + ); + } + + fAttrNSList->removeAllElements(); + + // Decide if to use hash table to do duplicate checking + bool toUseHashTable = false; + + setAttrDupChkRegistry(attCount, toUseHashTable); + for (XMLSize_t index = 0; index < attCount; index++) + { + // check for duplicate namespace attributes: + // by checking for qualified names with the same local part and with prefixes + // which have been bound to namespace names that are identical. + XMLAttr* curAttr = theAttrList->elementAt(index); + if (!toUseHashTable) + { + XMLAttr* loopAttr; + for (XMLSize_t attrIndex=0; attrIndex < index; attrIndex++) { + loopAttr = theAttrList->elementAt(attrIndex); + if (loopAttr->getURIId() == curAttr->getURIId() && + XMLString::equals(loopAttr->getName(), curAttr->getName())) { + emitError( + XMLErrs::AttrAlreadyUsedInSTag, curAttr->getName() + , elemDecl->getFullName() + ); + } + } + } + else + { + if (fAttrDupChkRegistry->containsKey((void*)curAttr->getName(), curAttr->getURIId())) + { + emitError( + XMLErrs::AttrAlreadyUsedInSTag + , curAttr->getName(), elemDecl->getFullName() + ); + } + + fAttrDupChkRegistry->put((void*)curAttr->getName(), curAttr->getURIId(), curAttr); + } + } +} + +InputSource* DGXMLScanner::resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId) +{ + //Normalize sysId + XMLBufBid nnSys(&fBufMgr); + XMLBuffer& normalizedSysId = nnSys.getBuffer(); + XMLString::removeChar(sysId, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the normalized system id + XMLBufBid bbSys(&fBufMgr); + XMLBuffer& expSysId = bbSys.getBuffer(); + + // Allow the entity handler to expand the system id if they choose + // to do so. + InputSource* srcToFill = 0; + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + expSysId.getRawBuffer(), 0, pubId, lastInfo.systemId, + &fReaderMgr); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + else + { + expSysId.set(normalizedURI); + } + + // If they didn't create a source via the entity handler, then we + // have to create one on our own. + if (!srcToFill) + { + if (fDisableDefaultEntityResolution) + return srcToFill; + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBufBid ddSys(&fBufMgr); + XMLBuffer& resolvedSysId = ddSys.getBuffer(); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + return srcToFill; +} + +// --------------------------------------------------------------------------- +// DGXMLScanner: Private parsing methods +// --------------------------------------------------------------------------- +bool DGXMLScanner::scanAttValue( const XMLAttDef* const attDef + , const XMLCh *const attrName + , XMLBuffer& toFill) +{ + enum States + { + InWhitespace + , InContent + }; + + // Get the type and name + const XMLAttDef::AttTypes type = (attDef) + ?attDef->getType() + :XMLAttDef::CData; + + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // Get attribute def - to check to see if it's declared externally or not + bool isAttExternal = (attDef) + ?attDef->isExternal() + :false; + + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = InContent; + bool firstNonWS = false; + bool gotLeadingSurrogate = false; + bool escaped; + while (true) + { + try + { + while(true) + { + nextCh = fReaderMgr.getNextChar(); + + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Check for our ending quote in the same entity + if (nextCh == quoteCh) + { + if (curReader == fReaderMgr.getCurrentReaderNum()) + return true; + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr.getCurrentReaderNum()) + { + emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // Check for an entity ref now, before we let it affect our + // whitespace normalization logic below. We ignore the empty flag + // in this one. + escaped = false; + if (nextCh == chAmpersand) + { + if (scanEntityRef(true, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacterInAttrValue, attrName, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // If its not escaped, then make sure its not a < character, which + // is not allowed in attribute values. + if (!escaped && (nextCh == chOpenAngle)) + emitError(XMLErrs::BracketInAttrValue, attrName); + + // If the attribute is a CDATA type we do simple replacement of + // tabs and new lines with spaces, if the character is not escaped + // by way of a char ref. + // + // Otherwise, we do the standard non-CDATA normalization of + // compressing whitespace to single spaces and getting rid of leading + // and trailing whitespace. + if (type == XMLAttDef::CData) + { + if (!escaped) + { + if ((nextCh == 0x09) || (nextCh == 0x0A) || (nextCh == 0x0D)) + { + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + } + nextCh = chSpace; + } + } + } + else + { + if (curState == InWhitespace) + { + if ((escaped && nextCh != chSpace) || !fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + if (firstNonWS) + toFill.append(chSpace); + curState = InContent; + firstNonWS = true; + } + else + { + continue; + } + } + else if (curState == InContent) + { + if ((nextCh == chSpace) || + (fReaderMgr.getCurrentReader()->isWhitespace(nextCh) && !escaped)) + { + curState = InWhitespace; + + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace())) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + } + } + continue; + } + firstNonWS = true; + } + } + + // Else add it to the buffer + toFill.append(nextCh); + + if (secondCh) + { + toFill.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException&) + { + // Just eat it and continue. + gotLeadingSurrogate = false; + escaped = false; + } + } + return true; +} + + +// This method scans a CDATA section. It collects the character into one +// of the temp buffers and calls the document handler, if any, with the +// characters. It assumes that the fThisElement->getCharDataOpts(); + + while (true) + { + const XMLCh nextCh = fReaderMgr.getNextChar(); + + // Watch for unexpected end of file + if (!nextCh) + { + emitError(XMLErrs::UnterminatedCDATASection); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + if (fValidate && fStandalone && (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))) + { + // This document is standalone; this ignorable CDATA whitespace is forbidden. + // XML 1.0, Section 2.9 + // And see if the current element is a 'Children' style content model + if (topElem->fThisElement->isExternal()) { + + if (charOpts == XMLElementDecl::SpacesOk) // Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + fValidator->emitError(XMLValid::NoWSForStandalone); + } + } + } + + // If this is a close square bracket it could be our closing + // sequence. + if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose)) + { + // make sure we were not expecting a trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + if (fValidate) { + + if (charOpts != XMLElementDecl::AllCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + } + } + + // If we have a doc handler, call it + if (fDocHandler) + { + fDocHandler->docCharacters + ( + bbCData.getRawBuffer() + , bbCData.getLen() + , true + ); + } + + // And we are done + break; + } + + // Make sure its a valid character. But if we've emitted an error + // already, don't bother with the overhead since we've already told + // them about it. + if (!emittedError) + { + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + emittedError = true; + } + } + gotLeadingSurrogate = false; + } + } + + // Add it to the buffer + bbCData.append(nextCh); + } +} + + +void DGXMLScanner::scanCharData(XMLBuffer& toUse) +{ + // We have to watch for the stupid ]]> sequence, which is illegal in + // character data. So this is a little state machine that handles that. + enum States + { + State_Waiting + , State_GotOne + , State_GotTwo + }; + + // Reset the buffer before we start + toUse.reset(); + + // Turn on the 'throw at end' flag of the reader manager + ThrowEOEJanitor jan(&fReaderMgr, true); + + // In order to be more efficient we have to use kind of a deeply nested + // set of blocks here. The outer block puts on a try and catches end of + // entity exceptions. The inner loop is the per-character loop. If we + // put the try inside the inner loop, it would work but would require + // the exception handling code setup/teardown code to be invoked for + // each character. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = State_Waiting; + bool escaped = false; + bool gotLeadingSurrogate = false; + bool notDone = true; + while (notDone) + { + try + { + while (true) + { + // Eat through as many plain content characters as possible without + // needing special handling. Moving most content characters here, + // in this one call, rather than running the overall loop once + // per content character, is a speed optimization. + if (curState == State_Waiting && !gotLeadingSurrogate) + { + fReaderMgr.movePlainContentChars(toUse); + } + + // Try to get another char from the source + // The code from here on down covers all contengencies, + if (!fReaderMgr.getNextCharIfNot(chOpenAngle, nextCh)) + { + // If we were waiting for a trailing surrogate, its an error + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + notDone = false; + break; + } + + // Watch for a reference. Note that the escapement mechanism + // is ignored in this content. + escaped = false; + if (nextCh == chAmpersand) + { + sendCharData(toUse); + + // Turn off the throwing at the end of entity during this + ThrowEOEJanitor jan(&fReaderMgr, false); + + if (scanEntityRef(false, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + else + { + if (escaped && !fElemStack.isEmpty()) + fElemStack.setReferenceEscaped(); + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Make sure the returned char is a valid XML char + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // Keep the state machine up to date + if (!escaped) + { + if (nextCh == chCloseSquare) + { + if (curState == State_Waiting) + curState = State_GotOne; + else if (curState == State_GotOne) + curState = State_GotTwo; + } + else if (nextCh == chCloseAngle) + { + if (curState == State_GotTwo) + emitError(XMLErrs::BadSequenceInCharData); + curState = State_Waiting; + } + else + { + curState = State_Waiting; + } + } + else + { + curState = State_Waiting; + } + + // Add this char to the buffer + toUse.append(nextCh); + + if (secondCh) + { + toUse.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException& toCatch) + { + // Some entity ended, so we have to send any accumulated + // chars and send an end of entity event. + sendCharData(toUse); + gotLeadingSurrogate = false; + + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + // Check the validity constraints as per XML 1.0 Section 2.9 + if (fValidate && fStandalone) + { + // See if the text contains whitespace + // Get the raw data we need for the callback + const XMLCh* rawBuf = toUse.getRawBuffer(); + const XMLSize_t len = toUse.getLen(); + const bool isSpaces = fReaderMgr.getCurrentReader()->containsWhiteSpace(rawBuf, len); + + if (isSpaces) + { + // And see if the current element is a 'Children' style content model + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + if (topElem->fThisElement->isExternal()) { + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts(); + + if (charOpts == XMLElementDecl::SpacesOk) // => Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + // + fValidator->emitError(XMLValid::NoWSForStandalone); + } + } + } + } + // Send any char data that we accumulated into the buffer + sendCharData(toUse); +} + + +// This method will scan a general/character entity ref. It will either +// expand a char ref and return it directly, or push a reader for a general +// entity. +// +// The return value indicates whether the char parameters hold the value +// or whether the value was pushed as a reader, or that it failed. +// +// The escaped flag tells the caller whether the returned parameter resulted +// from a character reference, which escapes the character in some cases. It +// only makes any difference if the return value indicates the value was +// returned directly. +DGXMLScanner::EntityExpRes +DGXMLScanner::scanEntityRef( const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped) +{ + // Assume no escape + secondCh = 0; + escaped = false; + + // We have to insure that its all in one entity + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // If the next char is a pound, then its a character reference and we + // need to expand it always. + if (fReaderMgr.skippedChar(chPound)) + { + // Its a character reference, so scan it and get back the numeric + // value it represents. + if (!scanCharRef(firstCh, secondCh)) + return EntityExp_Failed; + + escaped = true; + + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + return EntityExp_Returned; + } + + // Expand it since its a normal entity ref + XMLBufBid bbName(&fBufMgr); + + int colonPosition; + bool validName = fDoNamespaces ? fReaderMgr.getQName(bbName.getBuffer(), &colonPosition) : + fReaderMgr.getName(bbName.getBuffer()); + if (!validName) + { + if (bbName.isEmpty()) + emitError(XMLErrs::ExpectedEntityRefName); + else + emitError(XMLErrs::InvalidEntityRefName, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // Next char must be a semi-colon. But if its not, just emit + // an error and try to continue. + if (!fReaderMgr.skippedChar(chSemiColon)) + emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // Make sure we ended up on the same entity reader as the & char + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // Look up the name in the general entity pool + XMLEntityDecl* decl = fDTDGrammar->getEntityDecl(bbName.getRawBuffer()); + + // If it does not exist, then obviously an error + if (!decl) + { + // XML 1.0 Section 4.1 + // Well-formedness Constraint for entity not found: + // In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, + // or a document with "standalone='yes'", for an entity reference that does not occur within the external subset + // or a parameter entity + // + // Else it's Validity Constraint + if (fStandalone || fHasNoDTD) + emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + else { + if (fValidate) + fValidator->emitError(XMLValid::VC_EntityNotFound, bbName.getRawBuffer()); + } + + return EntityExp_Failed; + } + + // XML 1.0 Section 4.1 + // If we are a standalone document, then it has to have been declared + // in the internal subset. + if (fStandalone && !decl->getDeclaredInIntSubset()) + emitError(XMLErrs::IllegalRefInStandalone, bbName.getRawBuffer()); + + if (decl->isExternal()) + { + // If its unparsed, then its not valid here + if (decl->isUnparsed()) + { + emitError(XMLErrs::NoUnparsedEntityRefs, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // If we are in an attribute value, then not valid but keep going + if (inAttVal) + emitError(XMLErrs::NoExtRefsInAttValue); + + // And now create a reader to read this entity + InputSource* srcUsed; + XMLReader* reader = fReaderMgr.createReader + ( + decl->getBaseURI() + , decl->getSystemId() + , decl->getPublicId() + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , srcUsed + , fCalculateSrcOfs + , fLowWaterMark + , fDisableDefaultEntityResolution + ); + + // Put a janitor on the source so it gets cleaned up on exit + Janitor janSrc(srcUsed); + + // If the creation failed, and its not because the source was empty, + // then emit an error and return. + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenExtEntity, srcUsed ? srcUsed->getSystemId() : decl->getSystemId(), fMemoryManager); + + // Push the reader. If its a recursive expansion, then emit an error + // and return an failure. + if (!fReaderMgr.pushReader(reader, decl)) + { + emitError(XMLErrs::RecursiveEntity, decl->getName()); + return EntityExp_Failed; + } + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + // there seems nothing better to do than reset the entity expansion counter + fEntityExpansionCount = 0; + } + + // Do a start entity reference event. + // + // For now, we supress them in att values. Later, when + // the stuff is in place to correctly allow DOM to handle them + // we'll turn this back on. + if (fDocHandler && !inAttVal) + fDocHandler->startEntityReference(*decl); + + // If it starts with the XML string, then parse a text decl + if (checkXMLDecl(true)) + scanXMLDecl(Decl_Text); + } + else + { + // If its one of the special char references, then we can return + // it as a character, and its considered escaped. + if (decl->getIsSpecialChar()) + { + firstCh = decl->getValue()[0]; + escaped = true; + return EntityExp_Returned; + } + + // Create a reader over a memory stream over the entity value + // We force it to assume UTF-16 by passing in an encoding + // string. This way it won't both trying to predecode the + // first line, looking for an XML/TextDecl. + XMLReader* valueReader = fReaderMgr.createIntEntReader + ( + decl->getName() + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , decl->getValue() + , decl->getValueLen() + , false + ); + + // Try to push the entity reader onto the reader manager stack, + // where it will become the subsequent input. If it fails, that + // means the entity is recursive, so issue an error. The reader + // will have just been discarded, but we just keep going. + if (!fReaderMgr.pushReader(valueReader, decl)) + emitError(XMLErrs::RecursiveEntity, decl->getName()); + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + } + + // Do a start entity reference event. + // + // For now, we supress them in att values. Later, when + // the stuff is in place to correctly allow DOM to handle them + // we'll turn this back on. + if (fDocHandler && !inAttVal) + fDocHandler->startEntityReference(*decl); + + // If it starts with the XML string, then it's an error + if (checkXMLDecl(true)) { + emitError(XMLErrs::TextDeclNotLegalHere); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + return EntityExp_Pushed; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/DGXMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/DGXMLScanner.hpp new file mode 100644 index 000000000..db0dacbd7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/DGXMLScanner.hpp @@ -0,0 +1,192 @@ +/* + * 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: DGXMLScanner.hpp 810580 2009-09-02 15:52:22Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DGXMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_DGXMLSCANNER_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DTDElementDecl; +class DTDGrammar; +class DTDValidator; + +// This is an integrated scanner class, which does DTD/XML Schema grammar +// processing. +class XMLPARSER_EXPORT DGXMLScanner : public XMLScanner +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DGXMLScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DGXMLScanner + ( + XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~DGXMLScanner(); + + // ----------------------------------------------------------------------- + // XMLScanner public virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const; + virtual NameIdPool* getEntityDeclPool(); + virtual const NameIdPool* getEntityDeclPool() const; + virtual void scanDocument + ( + const InputSource& src + ); + virtual bool scanNext(XMLPScanToken& toFill); + virtual Grammar* loadGrammar + ( + const InputSource& src + , const short grammarType + , const bool toCache = false + ); + + virtual Grammar::GrammarType getCurrentGrammarType() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DGXMLScanner(); + DGXMLScanner(const DGXMLScanner&); + DGXMLScanner& operator=(const DGXMLScanner&); + + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanCDSection(); + virtual void scanCharData(XMLBuffer& toToUse); + virtual EntityExpRes scanEntityRef + ( + const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped + ); + virtual void scanDocTypeDecl(); + virtual void scanReset(const InputSource& src); + virtual void sendCharData(XMLBuffer& toSend); + virtual InputSource* resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void commonInit(); + void cleanUp(); + + XMLSize_t buildAttList + ( + const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill + ); + void updateNSMap + ( + const XMLCh* const attrPrefix + , const XMLCh* const attrLocalName + , const XMLCh* const attrValue + ); + void scanAttrListforNameSpaces(RefVectorOf* theAttrList, XMLSize_t attCount, XMLElementDecl* elemDecl); + + // ----------------------------------------------------------------------- + // Private scanning methods + // ----------------------------------------------------------------------- + bool scanAttValue + ( + const XMLAttDef* const attDef + , const XMLCh *const attrName + , XMLBuffer& toFill + ); + bool scanContent(); + void scanEndTag(bool& gotData); + bool scanStartTag(bool& gotData); + bool scanStartTagNS(bool& gotData); + + // ----------------------------------------------------------------------- + // Grammar preparsing methods + // ----------------------------------------------------------------------- + Grammar* loadDTDGrammar(const InputSource& src, const bool toCache = false); + + // ----------------------------------------------------------------------- + // Data members + // + // fRawAttrList + // During the initial scan of the attributes we can only do a raw + // scan for key/value pairs. So this vector is used to store them + // until they can be processed (and put into fAttrList.) + // + // fDTDValidator + // The DTD validator instance. + // + // fDTDElemNonDeclPool + // registry of "faulted-in" DTD element decls + // fElemCount + // count of the number of start tags seen so far (starts at 1). + // Used for duplicate attribute detection/processing of required/defaulted attributes + // fAttDefRegistry + // mapping from XMLAttDef instances to the count of the last + // start tag where they were utilized. + // fUndeclaredAttrRegistry + // mapping of attr QNames to detect duplicates + // + // ----------------------------------------------------------------------- + ValueVectorOf* fAttrNSList; + DTDValidator* fDTDValidator; + DTDGrammar* fDTDGrammar; + NameIdPool* fDTDElemNonDeclPool; + unsigned int fElemCount; + RefHashTableOf* fAttDefRegistry; + Hash2KeysSetOf* fUndeclaredAttrRegistry; +}; + +inline const XMLCh* DGXMLScanner::getName() const +{ + return XMLUni::fgDGXMLScanner; +} + +inline Grammar::GrammarType DGXMLScanner::getCurrentGrammarType() const +{ + return Grammar::DTDGrammarType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/ElemStack.cpp b/project/jni/xerces/src/xercesc/internal/ElemStack.cpp new file mode 100644 index 000000000..1ce9a8faf --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ElemStack.cpp @@ -0,0 +1,891 @@ +/* + * 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: ElemStack.cpp 830538 2009-10-28 13:41:11Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ElemStack: Constructors and Destructor +// --------------------------------------------------------------------------- +ElemStack::ElemStack(MemoryManager* const manager) : + + fEmptyNamespaceId(0) + , fGlobalPoolId(0) + , fPrefixPool(109, manager) + , fGlobalNamespaces(0) + , fStack(0) + , fStackCapacity(32) + , fStackTop(0) + , fUnknownNamespaceId(0) + , fXMLNamespaceId(0) + , fXMLPoolId(0) + , fXMLNSNamespaceId(0) + , fXMLNSPoolId(0) + , fNamespaceMap(0) + , fMemoryManager(manager) +{ + // Do an initial allocation of the stack and zero it out + fStack = (StackElem**) fMemoryManager->allocate + ( + fStackCapacity * sizeof(StackElem*) + );//new StackElem*[fStackCapacity]; + memset(fStack, 0, fStackCapacity * sizeof(StackElem*)); + + fNamespaceMap = new (fMemoryManager) ValueVectorOf(16, fMemoryManager); +} + +ElemStack::~ElemStack() +{ + if(fGlobalNamespaces) + { + fMemoryManager->deallocate(fGlobalNamespaces->fMap); + delete fGlobalNamespaces; + } + + // + // Start working from the bottom of the stack and clear it out as we + // go up. Once we hit an uninitialized one, we can break out. + // + for (XMLSize_t stackInd = 0; stackInd < fStackCapacity; stackInd++) + { + // If this entry has been set, then lets clean it up + if (!fStack[stackInd]) + break; + + fMemoryManager->deallocate(fStack[stackInd]->fChildren);//delete [] fStack[stackInd]->fChildren; + fMemoryManager->deallocate(fStack[stackInd]->fMap);//delete [] fStack[stackInd]->fMap; + fMemoryManager->deallocate(fStack[stackInd]->fSchemaElemName); + delete fStack[stackInd]; + } + + // Delete the stack array itself now + fMemoryManager->deallocate(fStack);//delete [] fStack; + delete fNamespaceMap; +} + + +// --------------------------------------------------------------------------- +// ElemStack: Stack access +// --------------------------------------------------------------------------- +XMLSize_t ElemStack::addLevel() +{ + // See if we need to expand the stack + if (fStackTop == fStackCapacity) + expandStack(); + + // If this element has not been initialized yet, then initialize it + if (!fStack[fStackTop]) + { + fStack[fStackTop] = new (fMemoryManager) StackElem; + fStack[fStackTop]->fChildCapacity = 0; + fStack[fStackTop]->fChildren = 0; + fStack[fStackTop]->fMapCapacity = 0; + fStack[fStackTop]->fMap = 0; + fStack[fStackTop]->fSchemaElemName = 0; + fStack[fStackTop]->fSchemaElemNameMaxLen = 0; + } + + // Set up the new top row + fStack[fStackTop]->fThisElement = 0; + fStack[fStackTop]->fReaderNum = 0xFFFFFFFF; + fStack[fStackTop]->fChildCount = 0; + fStack[fStackTop]->fMapCount = 0; + fStack[fStackTop]->fValidationFlag = false; + fStack[fStackTop]->fCommentOrPISeen = false; + fStack[fStackTop]->fReferenceEscaped = false; + fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId; + fStack[fStackTop]->fCurrentScope = Grammar::TOP_LEVEL_SCOPE; + fStack[fStackTop]->fCurrentGrammar = 0; + + // Bump the top of stack + fStackTop++; + + return fStackTop-1; +} + + +XMLSize_t ElemStack::addLevel(XMLElementDecl* const toSet, const XMLSize_t readerNum) +{ + // See if we need to expand the stack + if (fStackTop == fStackCapacity) + expandStack(); + + // If this element has not been initialized yet, then initialize it + if (!fStack[fStackTop]) + { + fStack[fStackTop] = new (fMemoryManager) StackElem; + fStack[fStackTop]->fChildCapacity = 0; + fStack[fStackTop]->fChildren = 0; + fStack[fStackTop]->fMapCapacity = 0; + fStack[fStackTop]->fMap = 0; + fStack[fStackTop]->fSchemaElemName = 0; + fStack[fStackTop]->fSchemaElemNameMaxLen = 0; + } + + // Set up the new top row + fStack[fStackTop]->fThisElement = toSet; + fStack[fStackTop]->fReaderNum = readerNum; + fStack[fStackTop]->fChildCount = 0; + fStack[fStackTop]->fMapCount = 0; + fStack[fStackTop]->fValidationFlag = false; + fStack[fStackTop]->fCommentOrPISeen = false; + fStack[fStackTop]->fReferenceEscaped = false; + fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId; + fStack[fStackTop]->fCurrentScope = Grammar::TOP_LEVEL_SCOPE; + fStack[fStackTop]->fCurrentGrammar = 0; + + // Bump the top of stack + fStackTop++; + + return fStackTop-1; +} + + + +const ElemStack::StackElem* ElemStack::popTop() +{ + // Watch for an underflow error + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_StackUnderflow, fMemoryManager); + + fStackTop--; + return fStack[fStackTop]; +} + + +void +ElemStack::setElement(XMLElementDecl* const toSet, const XMLSize_t readerNum) +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + fStack[fStackTop - 1]->fThisElement = toSet; + fStack[fStackTop - 1]->fReaderNum = readerNum; +} + + +// --------------------------------------------------------------------------- +// ElemStack: Stack top access +// --------------------------------------------------------------------------- +XMLSize_t ElemStack::addChild(QName* const child, const bool toParent) +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + // + // If they want to add to the parent, then we have to have at least two + // elements on the stack. + // + if (toParent && (fStackTop < 2)) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::ElemStack_NoParentPushed, fMemoryManager); + + // Get a convenience pointer to the stack top row + StackElem* curRow = toParent + ? fStack[fStackTop - 2] : fStack[fStackTop - 1]; + + // See if we need to expand this row's child array + if (curRow->fChildCount == curRow->fChildCapacity) + { + // Increase the capacity by a quarter and allocate a new row + const XMLSize_t newCapacity = curRow->fChildCapacity ? + (XMLSize_t)(curRow->fChildCapacity * 1.25) : + 32; + QName** newRow = (QName**) fMemoryManager->allocate + ( + newCapacity * sizeof(QName*) + );//new QName*[newCapacity]; + + // + // Copy over the old contents. We don't have to initialize the new + // part because The current child count is used to know how much of + // it is valid. + // + // Only both doing this if there is any current content, since + // this code also does the initial faulting in of the array when + // both the current capacity and child count are zero. + // + for (XMLSize_t index = 0; index < curRow->fChildCount; index++) + newRow[index] = curRow->fChildren[index]; + + // Clean up the old children and store the new info + fMemoryManager->deallocate(curRow->fChildren);//delete [] curRow->fChildren; + curRow->fChildren = newRow; + curRow->fChildCapacity = newCapacity; + } + + // Add this id to the end of the row's child id array and bump the count + curRow->fChildren[curRow->fChildCount++] = child; + + // Return the level of the index we just filled (before the bump) + return curRow->fChildCount - 1; +} + +const ElemStack::StackElem* ElemStack::topElement() const +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + return fStack[fStackTop - 1]; +} + + +// --------------------------------------------------------------------------- +// ElemStack: Prefix map methods +// --------------------------------------------------------------------------- +void ElemStack::addGlobalPrefix(const XMLCh* const prefixToAdd + , const unsigned int uriId) +{ + if (!fGlobalNamespaces) + { + fGlobalNamespaces = new (fMemoryManager) StackElem; + fGlobalNamespaces->fChildCapacity = 0; + fGlobalNamespaces->fChildren = 0; + fGlobalNamespaces->fMapCapacity = 0; + fGlobalNamespaces->fMap = 0; + fGlobalNamespaces->fMapCount = 0; + fGlobalNamespaces->fSchemaElemName = 0; + fGlobalNamespaces->fSchemaElemNameMaxLen = 0; + fGlobalNamespaces->fThisElement = 0; + fGlobalNamespaces->fReaderNum = 0xFFFFFFFF; + fGlobalNamespaces->fChildCount = 0; + fGlobalNamespaces->fValidationFlag = false; + fGlobalNamespaces->fCommentOrPISeen = false; + fGlobalNamespaces->fReferenceEscaped = false; + fGlobalNamespaces->fCurrentURI = fUnknownNamespaceId; + fGlobalNamespaces->fCurrentScope = Grammar::TOP_LEVEL_SCOPE; + fGlobalNamespaces->fCurrentGrammar = 0; + } + + // Map the prefix to its unique id + const unsigned int prefId = fPrefixPool.addOrFind(prefixToAdd); + + // + // Add a new element to the prefix map for this element. If its full, + // then expand it out. + // + if (fGlobalNamespaces->fMapCount == fGlobalNamespaces->fMapCapacity) + expandMap(fGlobalNamespaces); + + // + // And now add a new element for this prefix. Watch for the special case + // of xmlns=="", and force it to ""=[globalid] + // + fGlobalNamespaces->fMap[fGlobalNamespaces->fMapCount].fPrefId = prefId; + if ((prefId == fGlobalPoolId) && (uriId == fEmptyNamespaceId)) + fGlobalNamespaces->fMap[fGlobalNamespaces->fMapCount].fURIId = fEmptyNamespaceId; + else + fGlobalNamespaces->fMap[fGlobalNamespaces->fMapCount].fURIId = uriId; + + // Bump the map count now + fGlobalNamespaces->fMapCount++; +} + +void ElemStack::addPrefix( const XMLCh* const prefixToAdd + , const unsigned int uriId) +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + // Get a convenience pointer to the stack top row + StackElem* curRow = fStack[fStackTop - 1]; + + // Map the prefix to its unique id + const unsigned int prefId = fPrefixPool.addOrFind(prefixToAdd); + + // + // Add a new element to the prefix map for this element. If its full, + // then expand it out. + // + if (curRow->fMapCount == curRow->fMapCapacity) + expandMap(curRow); + + // + // And now add a new element for this prefix. Watch for the special case + // of xmlns=="", and force it to ""=[globalid] + // + curRow->fMap[curRow->fMapCount].fPrefId = prefId; + if ((prefId == fGlobalPoolId) && (uriId == fEmptyNamespaceId)) + curRow->fMap[curRow->fMapCount].fURIId = fEmptyNamespaceId; + else + curRow->fMap[curRow->fMapCount].fURIId = uriId; + + // Bump the map count now + curRow->fMapCount++; +} + + +unsigned int ElemStack::mapPrefixToURI( const XMLCh* const prefixToMap + , bool& unknown) const +{ + // Assume we find it + unknown = false; + + // + // Map the prefix to its unique id, from the prefix string pool. If its + // not a valid prefix, then its a failure. + // + unsigned int prefixId = (!prefixToMap || !*prefixToMap)?fGlobalPoolId : fPrefixPool.getId(prefixToMap); + if (prefixId == 0) + { + unknown = true; + return fUnknownNamespaceId; + } + // + // Check for the special prefixes 'xml' and 'xmlns' since they cannot + // be overridden. + // + else if (prefixId == fXMLPoolId) + return fXMLNamespaceId; + else if (prefixId == fXMLNSPoolId) + return fXMLNSNamespaceId; + + // + // Start at the stack top and work backwards until we come to some + // element that mapped this prefix. + // + for (XMLSize_t index = fStackTop; index > 0; index--) + { + // Get a convenience pointer to the current element + StackElem* curRow = fStack[index-1]; + + // Search the map at this level for the passed prefix + for (XMLSize_t mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++) + { + if (curRow->fMap[mapIndex].fPrefId == prefixId) + return curRow->fMap[mapIndex].fURIId; + } + } + // If the prefix wasn't found, try in the global namespaces + if(fGlobalNamespaces) + { + for (XMLSize_t mapIndex = 0; mapIndex < fGlobalNamespaces->fMapCount; mapIndex++) + { + if (fGlobalNamespaces->fMap[mapIndex].fPrefId == prefixId) + return fGlobalNamespaces->fMap[mapIndex].fURIId; + } + } + + // + // If the prefix is an empty string, then we will return the special + // global namespace id. This can be overridden, but no one has or we + // would have not gotten here. + // + if (!*prefixToMap) + return fEmptyNamespaceId; + + // Oh well, don't have a clue so return the unknown id + unknown = true; + return fUnknownNamespaceId; +} + + +ValueVectorOf* ElemStack::getNamespaceMap() const +{ + fNamespaceMap->removeAllElements(); + + // Start at the stack top and work backwards until we come to some + // element that mapped this prefix. + for (XMLSize_t index = fStackTop; index > 0; index--) + { + // Get a convenience pointer to the current element + StackElem* curRow = fStack[index-1]; + + // If no prefixes mapped at this level, then go the next one + if (!curRow->fMapCount) + continue; + + // Search the map at this level for the passed prefix + for (XMLSize_t mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++) + fNamespaceMap->addElement(&(curRow->fMap[mapIndex])); + } + // Add the global namespaces + if(fGlobalNamespaces) + { + for (XMLSize_t mapIndex = 0; mapIndex < fGlobalNamespaces->fMapCount; mapIndex++) + fNamespaceMap->addElement(&(fGlobalNamespaces->fMap[mapIndex])); + } + + return fNamespaceMap; +} + +// --------------------------------------------------------------------------- +// ElemStack: Miscellaneous methods +// --------------------------------------------------------------------------- +void ElemStack::reset( const unsigned int emptyId + , const unsigned int unknownId + , const unsigned int xmlId + , const unsigned int xmlNSId) +{ + if(fGlobalNamespaces) + { + fMemoryManager->deallocate(fGlobalNamespaces->fMap); + delete fGlobalNamespaces; + fGlobalNamespaces = 0; + } + + // Reset the stack top to clear the stack + fStackTop = 0; + + // if first time, put in the standard prefixes + if (fXMLPoolId == 0) { + + fGlobalPoolId = fPrefixPool.addOrFind(XMLUni::fgZeroLenString); + fXMLPoolId = fPrefixPool.addOrFind(XMLUni::fgXMLString); + fXMLNSPoolId = fPrefixPool.addOrFind(XMLUni::fgXMLNSString); + } + + // And store the new special URI ids + fEmptyNamespaceId = emptyId; + fUnknownNamespaceId = unknownId; + fXMLNamespaceId = xmlId; + fXMLNSNamespaceId = xmlNSId; +} + + +// --------------------------------------------------------------------------- +// ElemStack: Private helpers +// --------------------------------------------------------------------------- +void ElemStack::expandMap(StackElem* const toExpand) +{ + // For convenience get the old map size + const XMLSize_t oldCap = toExpand->fMapCapacity; + + // + // Expand the capacity by 25%, or initialize it to 16 if its currently + // empty. Then allocate a new temp buffer. + // + const XMLSize_t newCapacity = oldCap ? + (XMLSize_t )(oldCap * 1.25) : 16; + PrefMapElem* newMap = (PrefMapElem*) fMemoryManager->allocate + ( + newCapacity * sizeof(PrefMapElem) + );//new PrefMapElem[newCapacity]; + + // + // Copy over the old stuff. We DON'T have to zero out the new stuff + // since this is a by value map and the current map index controls what + // is relevant. + // + memcpy(newMap, toExpand->fMap, oldCap * sizeof(PrefMapElem)); + + // Delete the old map and store the new stuff + fMemoryManager->deallocate(toExpand->fMap);//delete [] toExpand->fMap; + toExpand->fMap = newMap; + toExpand->fMapCapacity = newCapacity; +} + +void ElemStack::expandStack() +{ + // Expand the capacity by 25% and allocate a new buffer + const XMLSize_t newCapacity = (XMLSize_t)(fStackCapacity * 1.25); + StackElem** newStack = (StackElem**) fMemoryManager->allocate + ( + newCapacity * sizeof(StackElem*) + );//new StackElem*[newCapacity]; + + // Copy over the old stuff + memcpy(newStack, fStack, fStackCapacity * sizeof(StackElem*)); + + // + // And zero out the new stuff. Though we use a stack top, we reuse old + // stack contents so we need to know if elements have been initially + // allocated or not as we push new stuff onto the stack. + // + memset + ( + &newStack[fStackCapacity] + , 0 + , (newCapacity - fStackCapacity) * sizeof(StackElem*) + ); + + // Delete the old array and update our members + fMemoryManager->deallocate(fStack);//delete [] fStack; + fStack = newStack; + fStackCapacity = newCapacity; +} + + + +// --------------------------------------------------------------------------- +// WFElemStack: Constructors and Destructor +// --------------------------------------------------------------------------- +WFElemStack::WFElemStack(MemoryManager* const manager) : + + fEmptyNamespaceId(0) + , fGlobalPoolId(0) + , fStackCapacity(32) + , fStackTop(0) + , fUnknownNamespaceId(0) + , fXMLNamespaceId(0) + , fXMLPoolId(0) + , fXMLNSNamespaceId(0) + , fXMLNSPoolId(0) + , fMapCapacity(0) + , fMap(0) + , fStack(0) + , fPrefixPool(109, manager) + , fMemoryManager(manager) +{ + // Do an initial allocation of the stack and zero it out + fStack = (StackElem**) fMemoryManager->allocate + ( + fStackCapacity * sizeof(StackElem*) + );//new StackElem*[fStackCapacity]; + memset(fStack, 0, fStackCapacity * sizeof(StackElem*)); +} + +WFElemStack::~WFElemStack() +{ + // + // Start working from the bottom of the stack and clear it out as we + // go up. Once we hit an uninitialized one, we can break out. + // + for (XMLSize_t stackInd = 0; stackInd < fStackCapacity; stackInd++) + { + // If this entry has been set, then lets clean it up + if (!fStack[stackInd]) + break; + + fMemoryManager->deallocate(fStack[stackInd]->fThisElement);//delete [] fStack[stackInd]->fThisElement; + delete fStack[stackInd]; + } + + if (fMap) + fMemoryManager->deallocate(fMap);//delete [] fMap; + + // Delete the stack array itself now + fMemoryManager->deallocate(fStack);//delete [] fStack; +} + + +// --------------------------------------------------------------------------- +// WFElemStack: Stack access +// --------------------------------------------------------------------------- +XMLSize_t WFElemStack::addLevel() +{ + // See if we need to expand the stack + if (fStackTop == fStackCapacity) + expandStack(); + + + // If this element has not been initialized yet, then initialize it + if (!fStack[fStackTop]) + { + fStack[fStackTop] = new (fMemoryManager) StackElem; + fStack[fStackTop]->fThisElement = 0; + fStack[fStackTop]->fElemMaxLength = 0; + } + + // Set up the new top row + fStack[fStackTop]->fReaderNum = 0xFFFFFFFF; + fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId; + fStack[fStackTop]->fTopPrefix = -1; + + if (fStackTop != 0) + fStack[fStackTop]->fTopPrefix = fStack[fStackTop - 1]->fTopPrefix; + + // Bump the top of stack + fStackTop++; + + return fStackTop-1; +} + + +XMLSize_t +WFElemStack::addLevel(const XMLCh* const toSet, + const unsigned int toSetLen, + const unsigned int readerNum) +{ + // See if we need to expand the stack + if (fStackTop == fStackCapacity) + expandStack(); + + // If this element has not been initialized yet, then initialize it + if (!fStack[fStackTop]) + { + fStack[fStackTop] = new (fMemoryManager) StackElem; + fStack[fStackTop]->fThisElement = 0; + fStack[fStackTop]->fElemMaxLength = 0; + } + + // Set up the new top row + fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId; + fStack[fStackTop]->fTopPrefix = -1; + + // And store the new stuff + if (toSetLen > fStack[fStackTop]->fElemMaxLength) { + + fMemoryManager->deallocate(fStack[fStackTop]->fThisElement);//delete [] fStack[fStackTop]->fThisElement; + fStack[fStackTop]->fElemMaxLength = toSetLen; + fStack[fStackTop]->fThisElement = (XMLCh*) fMemoryManager->allocate + ( + (toSetLen + 1) * sizeof(XMLCh) + );//new XMLCh[toSetLen + 1]; + } + + XMLString::moveChars(fStack[fStackTop]->fThisElement, toSet, toSetLen + 1); + fStack[fStackTop]->fReaderNum = readerNum; + + if (fStackTop != 0) + fStack[fStackTop]->fTopPrefix = fStack[fStackTop - 1]->fTopPrefix; + + // Bump the top of stack + fStackTop++; + + return fStackTop-1; +} + + + +const WFElemStack::StackElem* WFElemStack::popTop() +{ + // Watch for an underflow error + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_StackUnderflow, fMemoryManager); + + fStackTop--; + return fStack[fStackTop]; +} + + +void +WFElemStack::setElement(const XMLCh* const toSet, + const unsigned int toSetLen, + const unsigned int readerNum) +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + if (toSetLen > fStack[fStackTop - 1]->fElemMaxLength) { + + fMemoryManager->deallocate(fStack[fStackTop - 1]->fThisElement);//delete [] fStack[fStackTop - 1]->fThisElement; + fStack[fStackTop - 1]->fElemMaxLength = toSetLen; + fStack[fStackTop - 1]->fThisElement = (XMLCh*) fMemoryManager->allocate + ( + (toSetLen + 1) * sizeof(XMLCh) + );//new XMLCh[toSetLen + 1]; + } + + XMLString::moveChars(fStack[fStackTop - 1]->fThisElement, toSet, toSetLen + 1); + fStack[fStackTop - 1]->fReaderNum = readerNum; +} + + +// --------------------------------------------------------------------------- +// WFElemStack: Stack top access +// --------------------------------------------------------------------------- +const WFElemStack::StackElem* WFElemStack::topElement() const +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + return fStack[fStackTop - 1]; +} + + +// --------------------------------------------------------------------------- +// WFElemStack: Prefix map methods +// --------------------------------------------------------------------------- +void WFElemStack::addPrefix( const XMLCh* const prefixToAdd + , const unsigned int uriId) +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + // Get a convenience pointer to the stack top row + StackElem* curRow = fStack[fStackTop - 1]; + + // Map the prefix to its unique id + const unsigned int prefId = fPrefixPool.addOrFind(prefixToAdd); + + // + // Add a new element to the prefix map for this element. If its full, + // then expand it out. + // + if ((unsigned int)curRow->fTopPrefix + 1 == fMapCapacity) + expandMap(); + + // + // And now add a new element for this prefix. Watch for the special case + // of xmlns=="", and force it to ""=[globalid] + // + fMap[curRow->fTopPrefix + 1].fPrefId = prefId; + if ((prefId == fGlobalPoolId) && (uriId == fEmptyNamespaceId)) + fMap[curRow->fTopPrefix + 1].fURIId = fEmptyNamespaceId; + else + fMap[curRow->fTopPrefix + 1].fURIId = uriId; + + // Bump the map count now + curRow->fTopPrefix++; +} + + +unsigned int WFElemStack::mapPrefixToURI( const XMLCh* const prefixToMap + , bool& unknown) const +{ + // Assume we find it + unknown = false; + + // + // Map the prefix to its unique id, from the prefix string pool. If its + // not a valid prefix, then its a failure. + // + unsigned int prefixId = fPrefixPool.getId(prefixToMap); + if (!prefixId) + { + unknown = true; + return fUnknownNamespaceId; + } + + // + // Check for the special prefixes 'xml' and 'xmlns' since they cannot + // be overridden. + // + if (prefixId == fXMLPoolId) + return fXMLNamespaceId; + else if (prefixId == fXMLNSPoolId) + return fXMLNSNamespaceId; + + // + // Start at the stack top and work backwards until we come to some + // element that mapped this prefix. + // + // Get a convenience pointer to the stack top row + StackElem* curRow = fStack[fStackTop - 1]; + for (int mapIndex = curRow->fTopPrefix; mapIndex >=0; mapIndex--) + { + if (fMap[mapIndex].fPrefId == prefixId) + return fMap[mapIndex].fURIId; + } + + // + // If the prefix is an empty string, then we will return the special + // global namespace id. This can be overridden, but no one has or we + // would have not gotten here. + // + if (!*prefixToMap) + return fEmptyNamespaceId; + + // Oh well, don't have a clue so return the unknown id + unknown = true; + return fUnknownNamespaceId; +} + + +// --------------------------------------------------------------------------- +// WFElemStack: Miscellaneous methods +// --------------------------------------------------------------------------- +void WFElemStack::reset( const unsigned int emptyId + , const unsigned int unknownId + , const unsigned int xmlId + , const unsigned int xmlNSId) +{ + // Reset the stack top to clear the stack + fStackTop = 0; + + // if first time, put in the standard prefixes + if (fXMLPoolId == 0) { + + fGlobalPoolId = fPrefixPool.addOrFind(XMLUni::fgZeroLenString); + fXMLPoolId = fPrefixPool.addOrFind(XMLUni::fgXMLString); + fXMLNSPoolId = fPrefixPool.addOrFind(XMLUni::fgXMLNSString); + } + + // And store the new special URI ids + fEmptyNamespaceId = emptyId; + fUnknownNamespaceId = unknownId; + fXMLNamespaceId = xmlId; + fXMLNSNamespaceId = xmlNSId; +} + + +// --------------------------------------------------------------------------- +// WFElemStack: Private helpers +// --------------------------------------------------------------------------- +void WFElemStack::expandMap() +{ + // + // Expand the capacity by 25%, or initialize it to 16 if its currently + // empty. Then allocate a new temp buffer. + // + const XMLSize_t newCapacity = fMapCapacity ? + (XMLSize_t)(fMapCapacity * 1.25) : 16; + PrefMapElem* newMap = (PrefMapElem*) fMemoryManager->allocate + ( + newCapacity * sizeof(PrefMapElem) + );//new PrefMapElem[newCapacity]; + + // + // Copy over the old stuff. We DON'T have to zero out the new stuff + // since this is a by value map and the current map index controls what + // is relevant. + // + if (fMapCapacity) { + + memcpy(newMap, fMap, fMapCapacity * sizeof(PrefMapElem)); + fMemoryManager->deallocate(fMap);//delete [] fMap; + } + + fMap = newMap; + fMapCapacity = newCapacity; +} + +void WFElemStack::expandStack() +{ + // Expand the capacity by 25% and allocate a new buffer + const XMLSize_t newCapacity = (XMLSize_t)(fStackCapacity * 1.25); + StackElem** newStack = (StackElem**) fMemoryManager->allocate + ( + newCapacity * sizeof(StackElem*) + );//new StackElem*[newCapacity]; + + // Copy over the old stuff + memcpy(newStack, fStack, fStackCapacity * sizeof(StackElem*)); + + // + // And zero out the new stuff. Though we use a stack top, we reuse old + // stack contents so we need to know if elements have been initially + // allocated or not as we push new stuff onto the stack. + // + memset + ( + &newStack[fStackCapacity] + , 0 + , (newCapacity - fStackCapacity) * sizeof(StackElem*) + ); + + // Delete the old array and update our members + fMemoryManager->deallocate(fStack);//delete [] fStack; + fStack = newStack; + fStackCapacity = newCapacity; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/ElemStack.hpp b/project/jni/xerces/src/xercesc/internal/ElemStack.hpp new file mode 100644 index 000000000..5457c7208 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ElemStack.hpp @@ -0,0 +1,592 @@ +/* + * 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: ElemStack.hpp 830538 2009-10-28 13:41:11Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ELEMSTACK_HPP) +#define XERCESC_INCLUDE_GUARD_ELEMSTACK_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLElementDecl; +class Grammar; + +struct PrefMapElem : public XMemory +{ + unsigned int fPrefId; + unsigned int fURIId; +}; + +// +// During the scan of content, we have to keep up with the nesting of +// elements (for validation and wellformedness purposes) and we have to +// have places to remember namespace (prefix to URI) mappings. +// +// We only have to keep a stack of the current path down through the tree +// that we are currently scanning, and keep track of any children of any +// elements along that path. +// +// So, this data structure is a stack, which represents the current path +// through the tree that we've worked our way down to. For each node in +// the stack, there is an array of element ids that represent the ids of +// the child elements scanned so far. Upon exit from that element, its +// array of child elements is validated. +// +// Since we have the actual XMLElementDecl in the stack nodes, when its time +// to validate, we just extract the content model from that element decl +// and validate. All the required data falls easily to hand. Note that we +// actually have some derivative of XMLElementDecl, which is specific to +// the validator used, but the abstract API is sufficient for the needs of +// the scanner. +// +// Since the namespace support also requires the storage of information on +// a nested element basis, this structure also holds the namespace info. For +// each level, the prefixes defined at that level (and the namespaces that +// they map to) are stored. +// +class XMLPARSER_EXPORT ElemStack : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific data types + // + // These really should be private, but some of the compilers we have to + // support are too dumb to deal with that. + // + // PrefMapElem + // fURIId is the id of the URI from the validator's URI map. The + // fPrefId is the id of the prefix from our own prefix pool. The + // namespace stack consists of these elements. + // + // StackElem + // fThisElement is the basic element decl for the current element. + // The fRowCapacity is how large fChildIds has grown so far. + // fChildCount is how many of them are valid right now. + // + // The fMapCapacity is how large fMap has grown so far. fMapCount + // is how many of them are valid right now. + // + // Note that we store the reader number we were in when we found the + // start tag. We'll use this at the end tag to test for unbalanced + // markup in entities. + // + // MapModes + // When a prefix is mapped to a namespace id, it matters whether the + // QName being mapped is an attribute or name. Attributes are not + // affected by an sibling xmlns attributes, whereas elements are + // affected by its own xmlns attributes. + // ----------------------------------------------------------------------- + struct StackElem : public XMemory + { + XMLElementDecl* fThisElement; + XMLSize_t fReaderNum; + + XMLSize_t fChildCapacity; + XMLSize_t fChildCount; + QName** fChildren; + + PrefMapElem* fMap; + XMLSize_t fMapCapacity; + XMLSize_t fMapCount; + + bool fValidationFlag; + bool fCommentOrPISeen; + bool fReferenceEscaped; + unsigned int fCurrentScope; + Grammar* fCurrentGrammar; + unsigned int fCurrentURI; + XMLCh * fSchemaElemName; + XMLSize_t fSchemaElemNameMaxLen; + + int fPrefixColonPos; + }; + + enum MapModes + { + Mode_Attribute + , Mode_Element + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ElemStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ElemStack(); + + + // ----------------------------------------------------------------------- + // Stack access + // ----------------------------------------------------------------------- + XMLSize_t addLevel(); + XMLSize_t addLevel(XMLElementDecl* const toSet, const XMLSize_t readerNum); + const StackElem* popTop(); + + + // ----------------------------------------------------------------------- + // Stack top access + // ----------------------------------------------------------------------- + XMLSize_t addChild(QName* const child, const bool toParent); + const StackElem* topElement() const; + void setElement(XMLElementDecl* const toSet, const XMLSize_t readerNum); + + void setValidationFlag(bool validationFlag); + bool getValidationFlag(); + + inline void setCommentOrPISeen(); + inline bool getCommentOrPISeen() const; + + inline void setReferenceEscaped(); + inline bool getReferenceEscaped() const; + + void setCurrentScope(int currentScope); + int getCurrentScope(); + + void setCurrentGrammar(Grammar* currentGrammar); + Grammar* getCurrentGrammar(); + + void setCurrentURI(unsigned int uri); + unsigned int getCurrentURI(); + + inline void setCurrentSchemaElemName(const XMLCh * const schemaElemName); + inline XMLCh *getCurrentSchemaElemName(); + + void setPrefixColonPos(int colonPos); + int getPrefixColonPos() const; + + // ----------------------------------------------------------------------- + // Prefix map methods + // ----------------------------------------------------------------------- + void addGlobalPrefix + ( + const XMLCh* const prefixToAdd + , const unsigned int uriId + ); + void addPrefix + ( + const XMLCh* const prefixToAdd + , const unsigned int uriId + ); + unsigned int mapPrefixToURI + ( + const XMLCh* const prefixToMap + , bool& unknown + ) const; + ValueVectorOf* getNamespaceMap() const; + unsigned int getPrefixId(const XMLCh* const prefix) const; + const XMLCh* getPrefixForId(unsigned int prefId) const; + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + bool isEmpty() const; + void reset + ( + const unsigned int emptyId + , const unsigned int unknownId + , const unsigned int xmlId + , const unsigned int xmlNSId + ); + + unsigned int getEmptyNamespaceId(); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ElemStack(const ElemStack&); + ElemStack& operator=(const ElemStack&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void expandMap(StackElem* const toExpand); + void expandStack(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fEmptyNamespaceId + // This is the special URI id for the "" namespace, which is magic + // because of the xmlns="" operation. + // + // fGlobalPoolId + // This is a special URI id that is returned when the namespace + // prefix is "" and no one has explicitly mapped that prefix to an + // explicit URI (or when they explicitly clear any such mapping, + // which they can also do.) And also its prefix pool id, which is + // stored here for fast access. + // + // fPrefixPool + // This is the prefix pool where prefixes are hashed and given unique + // ids. These ids are used to track prefixes in the element stack. + // + // fGlobalNamespaces + // This object contains the namespace bindings that are globally valid + // + // fStack + // fStackCapacity + // fStackTop + // This the stack array. Its an array of pointers to StackElem + // structures. The capacity is the current high water mark of the + // stack. The top is the current top of stack (i.e. the part of it + // being used.) + // + // fUnknownNamespaceId + // This is the URI id for the special URI that is assigned to any + // prefix which has not been mapped. This lets us keep going after + // issuing the error. + // + // fXMLNamespaceId + // fXMLPoolId + // fXMLNSNamespaceId + // fXMLNSPoolId + // These are the URI ids for the special URIs that are assigned to + // the 'xml' and 'xmlns' namespaces. And also its prefix pool id, + // which is stored here for fast access. + // ----------------------------------------------------------------------- + unsigned int fEmptyNamespaceId; + unsigned int fGlobalPoolId; + XMLStringPool fPrefixPool; + StackElem* fGlobalNamespaces; + StackElem** fStack; + XMLSize_t fStackCapacity; + XMLSize_t fStackTop; + unsigned int fUnknownNamespaceId; + unsigned int fXMLNamespaceId; + unsigned int fXMLPoolId; + unsigned int fXMLNSNamespaceId; + unsigned int fXMLNSPoolId; + ValueVectorOf* fNamespaceMap; + MemoryManager* fMemoryManager; +}; + + +class XMLPARSER_EXPORT WFElemStack : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific data types + // + // These really should be private, but some of the compilers we have to + // support are too dumb to deal with that. + // + // PrefMapElem + // fURIId is the id of the URI from the validator's URI map. The + // fPrefId is the id of the prefix from our own prefix pool. The + // namespace stack consists of these elements. + // + // StackElem + // fThisElement is the basic element decl for the current element. + // The fRowCapacity is how large fChildIds has grown so far. + // fChildCount is how many of them are valid right now. + // + // The fMapCapacity is how large fMap has grown so far. fMapCount + // is how many of them are valid right now. + // + // Note that we store the reader number we were in when we found the + // start tag. We'll use this at the end tag to test for unbalanced + // markup in entities. + // + // MapModes + // When a prefix is mapped to a namespace id, it matters whether the + // QName being mapped is an attribute or name. Attributes are not + // affected by an sibling xmlns attributes, whereas elements are + // affected by its own xmlns attributes. + // ----------------------------------------------------------------------- + struct StackElem : public XMemory + { + int fTopPrefix; + unsigned int fCurrentURI; + unsigned int fReaderNum; + unsigned int fElemMaxLength; + XMLCh* fThisElement; + }; + + enum MapModes + { + Mode_Attribute + , Mode_Element + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + WFElemStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~WFElemStack(); + + + // ----------------------------------------------------------------------- + // Stack access + // ----------------------------------------------------------------------- + XMLSize_t addLevel(); + XMLSize_t addLevel(const XMLCh* const toSet, const unsigned int toSetLen, + const unsigned int readerNum); + const StackElem* popTop(); + + + // ----------------------------------------------------------------------- + // Stack top access + // ----------------------------------------------------------------------- + const StackElem* topElement() const; + void setElement(const XMLCh* const toSet, const unsigned int toSetLen, + const unsigned int readerNum); + + void setCurrentURI(unsigned int uri); + unsigned int getCurrentURI(); + + // ----------------------------------------------------------------------- + // Prefix map methods + // ----------------------------------------------------------------------- + void addPrefix + ( + const XMLCh* const prefixToAdd + , const unsigned int uriId + ); + unsigned int mapPrefixToURI + ( + const XMLCh* const prefixToMap + , bool& unknown + ) const; + + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + bool isEmpty() const; + void reset + ( + const unsigned int emptyId + , const unsigned int unknownId + , const unsigned int xmlId + , const unsigned int xmlNSId + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + WFElemStack(const WFElemStack&); + WFElemStack& operator=(const WFElemStack&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void expandMap(); + void expandStack(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fEmptyNamespaceId + // This is the special URI id for the "" namespace, which is magic + // because of the xmlns="" operation. + // + // fGlobalPoolId + // This is a special URI id that is returned when the namespace + // prefix is "" and no one has explicitly mapped that prefix to an + // explicit URI (or when they explicitly clear any such mapping, + // which they can also do.) And also its prefix pool id, which is + // stored here for fast access. + // + // fPrefixPool + // This is the prefix pool where prefixes are hashed and given unique + // ids. These ids are used to track prefixes in the element stack. + // + // fStack + // fStackCapacity + // fStackTop + // This the stack array. Its an array of pointers to StackElem + // structures. The capacity is the current high water mark of the + // stack. The top is the current top of stack (i.e. the part of it + // being used.) + // + // fUnknownNamespaceId + // This is the URI id for the special URI that is assigned to any + // prefix which has not been mapped. This lets us keep going after + // issuing the error. + // + // fXMLNamespaceId + // fXMLPoolId + // fXMLNSNamespaceId + // fXMLNSPoolId + // These are the URI ids for the special URIs that are assigned to + // the 'xml' and 'xmlns' namespaces. And also its prefix pool id, + // which is stored here for fast access. + // ----------------------------------------------------------------------- + unsigned int fEmptyNamespaceId; + unsigned int fGlobalPoolId; + XMLSize_t fStackCapacity; + XMLSize_t fStackTop; + unsigned int fUnknownNamespaceId; + unsigned int fXMLNamespaceId; + unsigned int fXMLPoolId; + unsigned int fXMLNSNamespaceId; + unsigned int fXMLNSPoolId; + XMLSize_t fMapCapacity; + PrefMapElem* fMap; + StackElem** fStack; + XMLStringPool fPrefixPool; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// ElemStack: Miscellaneous methods +// --------------------------------------------------------------------------- +inline bool ElemStack::isEmpty() const +{ + return (fStackTop == 0); +} + +inline bool ElemStack::getValidationFlag() +{ + return fStack[fStackTop-1]->fValidationFlag; +} + +inline void ElemStack::setValidationFlag(bool validationFlag) +{ + fStack[fStackTop-1]->fValidationFlag = validationFlag; +} + +inline bool ElemStack::getCommentOrPISeen() const +{ + return fStack[fStackTop-1]->fCommentOrPISeen; +} + +inline void ElemStack::setCommentOrPISeen() +{ + fStack[fStackTop-1]->fCommentOrPISeen = true; +} + +inline bool ElemStack::getReferenceEscaped() const +{ + return fStack[fStackTop-1]->fReferenceEscaped; +} + +inline void ElemStack::setReferenceEscaped() +{ + fStack[fStackTop-1]->fReferenceEscaped = true; +} + +inline void ElemStack::setCurrentSchemaElemName(const XMLCh * const schemaElemName) +{ + XMLSize_t schemaElemNameLen = XMLString::stringLen(schemaElemName); + XMLSize_t stackPos = fStackTop-1; + + if(fStack[stackPos]->fSchemaElemNameMaxLen <= schemaElemNameLen) + { + XMLCh *tempStr = fStack[stackPos]->fSchemaElemName; + fStack[stackPos]->fSchemaElemNameMaxLen = schemaElemNameLen << 1; + fStack[stackPos]->fSchemaElemName = (XMLCh *)fMemoryManager->allocate((fStack[stackPos]->fSchemaElemNameMaxLen)*sizeof(XMLCh)); + fMemoryManager->deallocate(tempStr); + } + XMLString::copyString(fStack[stackPos]->fSchemaElemName, schemaElemName); +} + +inline XMLCh *ElemStack::getCurrentSchemaElemName() +{ + return fStack[fStackTop-1]->fSchemaElemName; +} + +inline int ElemStack::getCurrentScope() +{ + return fStack[fStackTop-1]->fCurrentScope; +} + +inline void ElemStack::setCurrentScope(int currentScope) +{ + fStack[fStackTop-1]->fCurrentScope = currentScope; +} + +inline Grammar* ElemStack::getCurrentGrammar() +{ + return fStack[fStackTop-1]->fCurrentGrammar; +} + +inline void ElemStack::setCurrentGrammar(Grammar* currentGrammar) +{ + fStack[fStackTop-1]->fCurrentGrammar = currentGrammar; +} + +inline unsigned int ElemStack::getCurrentURI() +{ + return fStack[fStackTop-1]->fCurrentURI; +} + +inline void ElemStack::setCurrentURI(unsigned int uri) +{ + fStack[fStackTop-1]->fCurrentURI = uri; +} + +inline unsigned int ElemStack::getPrefixId(const XMLCh* const prefix) const +{ + return fPrefixPool.getId(prefix); +} + +inline const XMLCh* ElemStack::getPrefixForId(unsigned int prefId) const +{ + return fPrefixPool.getValueForId(prefId); +} + +inline void ElemStack::setPrefixColonPos(int colonPos) +{ + fStack[fStackTop-1]->fPrefixColonPos = colonPos; +} + +inline int ElemStack::getPrefixColonPos() const { + return fStack[fStackTop-1]->fPrefixColonPos; +} + +inline unsigned int ElemStack::getEmptyNamespaceId() { + return fEmptyNamespaceId; +} + +// --------------------------------------------------------------------------- +// WFElemStack: Miscellaneous methods +// --------------------------------------------------------------------------- +inline bool WFElemStack::isEmpty() const +{ + return (fStackTop == 0); +} + +inline unsigned int WFElemStack::getCurrentURI() +{ + return fStack[fStackTop-1]->fCurrentURI; +} + +inline void WFElemStack::setCurrentURI(unsigned int uri) +{ + fStack[fStackTop-1]->fCurrentURI = uri; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/EndOfEntityException.hpp b/project/jni/xerces/src/xercesc/internal/EndOfEntityException.hpp new file mode 100644 index 000000000..7e46ac280 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/EndOfEntityException.hpp @@ -0,0 +1,116 @@ +/* + * 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: EndOfEntityException.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ENDOFENTITYEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_ENDOFENTITYEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLEntityDecl; + +// +// This class is only used internally. Its thrown by the ReaderMgr class, +// when an entity ends, and is caught in the scanner. This tells the scanner +// that an entity has ended, and allows it to do the right thing according +// to what was going on when the entity ended. +// +// Since its internal, it does not bother implementing XMLException. +// +class XMLPARSER_EXPORT EndOfEntityException +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + EndOfEntityException( XMLEntityDecl* entityThatEnded + , const XMLSize_t readerNum) : + + fEntity(entityThatEnded) + , fReaderNum(readerNum) + { + } + + EndOfEntityException(const EndOfEntityException& toCopy) : + + fEntity(toCopy.fEntity) + , fReaderNum(toCopy.fReaderNum) + { + } + + ~EndOfEntityException() + { + } + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLEntityDecl& getEntity(); + const XMLEntityDecl& getEntity() const; + XMLSize_t getReaderNum() const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + EndOfEntityException& operator = (const EndOfEntityException&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEntity + // This is a reference to the entity that ended, causing this + // exception. + // + // fReaderNum + // The unique reader number of the reader that was handling this + // entity. This is used to know whether a particular entity has + // ended. + // ----------------------------------------------------------------------- + XMLEntityDecl* fEntity; + XMLSize_t fReaderNum; +}; + + +// --------------------------------------------------------------------------- +// EndOfEntityException: Getter methods +// --------------------------------------------------------------------------- +inline XMLEntityDecl& EndOfEntityException::getEntity() +{ + return *fEntity; +} + +inline const XMLEntityDecl& EndOfEntityException::getEntity() const +{ + return *fEntity; +} + +inline XMLSize_t EndOfEntityException::getReaderNum() const +{ + return fReaderNum; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/IANAEncodings.hpp b/project/jni/xerces/src/xercesc/internal/IANAEncodings.hpp new file mode 100644 index 000000000..40e089a1d --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/IANAEncodings.hpp @@ -0,0 +1,834 @@ +/* + * 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: IANAEncodings.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IANAENCODINGS_HPP) +#define XERCESC_INCLUDE_GUARD_IANAENCODINGS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// ---------------------------------------------------------------- +// This file was generated from the IANA charset source. +// so do not edit this file directly!! +// ---------------------------------------------------------------- + +const XMLCh gEncodingArray[][46] = +{ + { 0x0041,0x004E,0x0053,0x0049,0x005F,0x0058,0x0033,0x002E,0x0034,0x002D,0x0031,0x0039,0x0036,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0036,0x00 } + , { 0x0041,0x004E,0x0053,0x0049,0x005F,0x0058,0x0033,0x002E,0x0034,0x002D,0x0031,0x0039,0x0038,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0036,0x0034,0x0036,0x002E,0x0069,0x0072,0x0076,0x003A,0x0031,0x0039,0x0039,0x0031,0x00 } + , { 0x0041,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0055,0x0053,0x00 } + , { 0x0055,0x0053,0x002D,0x0041,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0075,0x0073,0x00 } + , { 0x0049,0x0042,0x004D,0x0033,0x0036,0x0037,0x00 } + , { 0x0063,0x0070,0x0033,0x0036,0x0037,0x00 } + , { 0x0063,0x0073,0x0041,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x0055,0x0054,0x0046,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0030,0x0036,0x0034,0x0036,0x0055,0x0054,0x0046,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0036,0x0034,0x0036,0x002E,0x0062,0x0061,0x0073,0x0069,0x0063,0x003A,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0072,0x0065,0x0066,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x0062,0x0061,0x0073,0x0069,0x0063,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0049,0x004E,0x0056,0x0041,0x0052,0x0049,0x0041,0x004E,0x0054,0x00 } + , { 0x0063,0x0073,0x0049,0x004E,0x0056,0x0041,0x0052,0x0049,0x0041,0x004E,0x0054,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0036,0x0034,0x0036,0x002E,0x0069,0x0072,0x0076,0x003A,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0032,0x00 } + , { 0x0069,0x0072,0x0076,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0049,0x006E,0x0074,0x006C,0x0052,0x0065,0x0066,0x0056,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0042,0x0053,0x005F,0x0034,0x0037,0x0033,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0047,0x0042,0x00 } + , { 0x0067,0x0062,0x00 } + , { 0x0075,0x006B,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0034,0x0055,0x006E,0x0069,0x0074,0x0065,0x0064,0x004B,0x0069,0x006E,0x0067,0x0064,0x006F,0x006D,0x00 } + , { 0x004E,0x0041,0x0054,0x0053,0x002D,0x0053,0x0045,0x0046,0x0049,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x004E,0x0041,0x0054,0x0053,0x0053,0x0045,0x0046,0x0049,0x00 } + , { 0x004E,0x0041,0x0054,0x0053,0x002D,0x0053,0x0045,0x0046,0x0049,0x002D,0x0041,0x0044,0x0044,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x004E,0x0041,0x0054,0x0053,0x0053,0x0045,0x0046,0x0049,0x0041,0x0044,0x0044,0x00 } + , { 0x004E,0x0041,0x0054,0x0053,0x002D,0x0044,0x0041,0x004E,0x004F,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x004E,0x0041,0x0054,0x0053,0x0044,0x0041,0x004E,0x004F,0x00 } + , { 0x004E,0x0041,0x0054,0x0053,0x002D,0x0044,0x0041,0x004E,0x004F,0x002D,0x0041,0x0044,0x0044,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x004E,0x0041,0x0054,0x0053,0x0044,0x0041,0x004E,0x004F,0x0041,0x0044,0x0044,0x00 } + , { 0x0053,0x0045,0x004E,0x005F,0x0038,0x0035,0x0030,0x0032,0x0030,0x0030,0x005F,0x0042,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x00 } + , { 0x0046,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0046,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0053,0x0045,0x00 } + , { 0x0073,0x0065,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0030,0x0053,0x0077,0x0065,0x0064,0x0069,0x0073,0x0068,0x00 } + , { 0x0053,0x0045,0x004E,0x005F,0x0038,0x0035,0x0030,0x0032,0x0030,0x0030,0x005F,0x0043,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0053,0x0045,0x0032,0x00 } + , { 0x0073,0x0065,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0031,0x0053,0x0077,0x0065,0x0064,0x0069,0x0073,0x0068,0x0046,0x006F,0x0072,0x004E,0x0061,0x006D,0x0065,0x0073,0x00 } + , { 0x004B,0x0053,0x005F,0x0043,0x005F,0x0035,0x0036,0x0030,0x0031,0x002D,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0039,0x00 } + , { 0x004B,0x0053,0x005F,0x0043,0x005F,0x0035,0x0036,0x0030,0x0031,0x002D,0x0031,0x0039,0x0038,0x0039,0x00 } + , { 0x004B,0x0053,0x0043,0x005F,0x0035,0x0036,0x0030,0x0031,0x00 } + , { 0x006B,0x006F,0x0072,0x0065,0x0061,0x006E,0x00 } + , { 0x0063,0x0073,0x004B,0x0053,0x0043,0x0035,0x0036,0x0030,0x0031,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0032,0x0030,0x0032,0x0032,0x002D,0x004B,0x0052,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0030,0x0032,0x0032,0x004B,0x0052,0x00 } + , { 0x0045,0x0055,0x0043,0x002D,0x004B,0x0052,0x00 } + , { 0x0063,0x0073,0x0045,0x0055,0x0043,0x004B,0x0052,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0032,0x0030,0x0032,0x0032,0x002D,0x004A,0x0050,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0030,0x0032,0x0032,0x004A,0x0050,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0032,0x0030,0x0032,0x0032,0x002D,0x004A,0x0050,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0030,0x0032,0x0032,0x004A,0x0050,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0032,0x0030,0x0032,0x0032,0x002D,0x0043,0x004E,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0032,0x0030,0x0032,0x0032,0x002D,0x0043,0x004E,0x002D,0x0045,0x0058,0x0054,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0030,0x002D,0x0031,0x0039,0x0036,0x0039,0x002D,0x006A,0x0070,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0030,0x002D,0x0031,0x0039,0x0036,0x0039,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0033,0x00 } + , { 0x006B,0x0061,0x0074,0x0061,0x006B,0x0061,0x006E,0x0061,0x00 } + , { 0x0078,0x0030,0x0032,0x0030,0x0031,0x002D,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0033,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0032,0x0030,0x006A,0x0070,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0030,0x002D,0x0031,0x0039,0x0036,0x0039,0x002D,0x0072,0x006F,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x00 } + , { 0x006A,0x0070,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x004A,0x0050,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0034,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0032,0x0030,0x0072,0x006F,0x00 } + , { 0x0049,0x0054,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0049,0x0054,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0049,0x0074,0x0061,0x006C,0x0069,0x0061,0x006E,0x00 } + , { 0x0050,0x0054,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0050,0x0054,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0036,0x0050,0x006F,0x0072,0x0074,0x0075,0x0067,0x0075,0x0065,0x0073,0x0065,0x00 } + , { 0x0045,0x0053,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0037,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0045,0x0053,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0037,0x0053,0x0070,0x0061,0x006E,0x0069,0x0073,0x0068,0x00 } + , { 0x0067,0x0072,0x0065,0x0065,0x006B,0x0037,0x002D,0x006F,0x006C,0x0064,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0038,0x0047,0x0072,0x0065,0x0065,0x006B,0x0037,0x004F,0x006C,0x0064,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0067,0x0072,0x0065,0x0065,0x006B,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0039,0x004C,0x0061,0x0074,0x0069,0x006E,0x0047,0x0072,0x0065,0x0065,0x006B,0x00 } + , { 0x0044,0x0049,0x004E,0x005F,0x0036,0x0036,0x0030,0x0030,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0032,0x0031,0x00 } + , { 0x0064,0x0065,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0044,0x0045,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0031,0x0047,0x0065,0x0072,0x006D,0x0061,0x006E,0x00 } + , { 0x004E,0x0046,0x005F,0x005A,0x005F,0x0036,0x0032,0x002D,0x0030,0x0031,0x0030,0x005F,0x0028,0x0031,0x0039,0x0037,0x0033,0x0029,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0032,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0046,0x0052,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0035,0x0046,0x0072,0x0065,0x006E,0x0063,0x0068,0x00 } + , { 0x004C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0067,0x0072,0x0065,0x0065,0x006B,0x002D,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0032,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0037,0x004C,0x0061,0x0074,0x0069,0x006E,0x0047,0x0072,0x0065,0x0065,0x006B,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0035,0x0034,0x0032,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0033,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0034,0x0032,0x0037,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0036,0x002D,0x0031,0x0039,0x0037,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0034,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0034,0x0032,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0032,0x0036,0x0031,0x0039,0x0037,0x0038,0x00 } + , { 0x0042,0x0053,0x005F,0x0076,0x0069,0x0065,0x0077,0x0064,0x0061,0x0074,0x0061,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0034,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0034,0x0037,0x0042,0x0053,0x0056,0x0069,0x0065,0x0077,0x0064,0x0061,0x0074,0x0061,0x00 } + , { 0x0049,0x004E,0x0049,0x0053,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0034,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0034,0x0039,0x0049,0x004E,0x0049,0x0053,0x00 } + , { 0x0049,0x004E,0x0049,0x0053,0x002D,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0030,0x0049,0x004E,0x0049,0x0053,0x0038,0x00 } + , { 0x0049,0x004E,0x0049,0x0053,0x002D,0x0063,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0031,0x0049,0x004E,0x0049,0x0053,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0035,0x0034,0x0032,0x0037,0x003A,0x0031,0x0039,0x0038,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x0035,0x0034,0x0032,0x0037,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x0031,0x0039,0x0038,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0035,0x0034,0x0032,0x0038,0x003A,0x0031,0x0039,0x0038,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0034,0x0032,0x0038,0x0047,0x0072,0x0065,0x0065,0x006B,0x00 } + , { 0x0047,0x0042,0x005F,0x0031,0x0039,0x0038,0x0038,0x002D,0x0038,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0037,0x00 } + , { 0x0063,0x006E,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0043,0x004E,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0037,0x0047,0x0042,0x0031,0x0039,0x0038,0x0038,0x00 } + , { 0x0047,0x0042,0x005F,0x0032,0x0033,0x0031,0x0032,0x002D,0x0038,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0035,0x0038,0x00 } + , { 0x0063,0x0068,0x0069,0x006E,0x0065,0x0073,0x0065,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0035,0x0038,0x0047,0x0042,0x0032,0x0033,0x0031,0x0032,0x0038,0x0030,0x00 } + , { 0x004E,0x0053,0x005F,0x0034,0x0035,0x0035,0x0031,0x002D,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0036,0x0030,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x004E,0x004F,0x00 } + , { 0x006E,0x006F,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0030,0x0044,0x0061,0x006E,0x0069,0x0073,0x0068,0x004E,0x006F,0x0072,0x0077,0x0065,0x0067,0x0069,0x0061,0x006E,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0030,0x004E,0x006F,0x0072,0x0077,0x0065,0x0067,0x0069,0x0061,0x006E,0x0031,0x00 } + , { 0x004E,0x0053,0x005F,0x0034,0x0035,0x0035,0x0031,0x002D,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x004E,0x004F,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0036,0x0031,0x00 } + , { 0x006E,0x006F,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0031,0x004E,0x006F,0x0072,0x0077,0x0065,0x0067,0x0069,0x0061,0x006E,0x0032,0x00 } + , { 0x004E,0x0046,0x005F,0x005A,0x005F,0x0036,0x0032,0x002D,0x0030,0x0031,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0036,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0046,0x0052,0x00 } + , { 0x0066,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0039,0x0046,0x0072,0x0065,0x006E,0x0063,0x0068,0x00 } + , { 0x0076,0x0069,0x0064,0x0065,0x006F,0x0074,0x0065,0x0078,0x002D,0x0073,0x0075,0x0070,0x0070,0x006C,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0037,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0037,0x0030,0x0056,0x0069,0x0064,0x0065,0x006F,0x0074,0x0065,0x0078,0x0053,0x0075,0x0070,0x0070,0x0031,0x00 } + , { 0x0050,0x0054,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0050,0x0054,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0034,0x0050,0x006F,0x0072,0x0074,0x0075,0x0067,0x0075,0x0065,0x0073,0x0065,0x0032,0x00 } + , { 0x0045,0x0053,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0045,0x0053,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0035,0x0053,0x0070,0x0061,0x006E,0x0069,0x0073,0x0068,0x0032,0x00 } + , { 0x004D,0x0053,0x005A,0x005F,0x0037,0x0037,0x0039,0x0035,0x002E,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0048,0x0055,0x00 } + , { 0x0068,0x0075,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0036,0x0048,0x0075,0x006E,0x0067,0x0061,0x0072,0x0069,0x0061,0x006E,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0036,0x002D,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0037,0x00 } + , { 0x0078,0x0030,0x0032,0x0030,0x0038,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0058,0x0030,0x0032,0x0030,0x0038,0x002D,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0037,0x004A,0x0049,0x0053,0x0058,0x0030,0x0032,0x0030,0x0038,0x00 } + , { 0x0067,0x0072,0x0065,0x0065,0x006B,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0047,0x0072,0x0065,0x0065,0x006B,0x0037,0x00 } + , { 0x0041,0x0053,0x004D,0x004F,0x005F,0x0034,0x0034,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0039,0x0030,0x0033,0x0036,0x00 } + , { 0x0061,0x0072,0x0061,0x0062,0x0069,0x0063,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0038,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0039,0x0041,0x0053,0x004D,0x004F,0x0034,0x0034,0x0039,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0030,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x0061,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0031,0x00 } + , { 0x006A,0x0070,0x002D,0x006F,0x0063,0x0072,0x002D,0x0061,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0031,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0032,0x0039,0x0031,0x0039,0x0038,0x0034,0x0061,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x0062,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x004A,0x0050,0x002D,0x004F,0x0043,0x0052,0x002D,0x0042,0x00 } + , { 0x006A,0x0070,0x002D,0x006F,0x0063,0x0072,0x002D,0x0062,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0032,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0039,0x0039,0x0031,0x0039,0x0038,0x0034,0x0062,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x0062,0x002D,0x0061,0x0064,0x0064,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0033,0x00 } + , { 0x006A,0x0070,0x002D,0x006F,0x0063,0x0072,0x002D,0x0062,0x002D,0x0061,0x0064,0x0064,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0033,0x004A,0x0049,0x0053,0x0036,0x0032,0x0032,0x0039,0x0031,0x0039,0x0038,0x0034,0x0062,0x0061,0x0064,0x0064,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x0068,0x0061,0x006E,0x0064,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0034,0x00 } + , { 0x006A,0x0070,0x002D,0x006F,0x0063,0x0072,0x002D,0x0068,0x0061,0x006E,0x0064,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0034,0x004A,0x0049,0x0053,0x0036,0x0032,0x0032,0x0039,0x0031,0x0039,0x0038,0x0034,0x0068,0x0061,0x006E,0x0064,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x0068,0x0061,0x006E,0x0064,0x002D,0x0061,0x0064,0x0064,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0035,0x00 } + , { 0x006A,0x0070,0x002D,0x006F,0x0063,0x0072,0x002D,0x0068,0x0061,0x006E,0x0064,0x002D,0x0061,0x0064,0x0064,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0035,0x004A,0x0049,0x0053,0x0036,0x0032,0x0032,0x0039,0x0031,0x0039,0x0038,0x0034,0x0068,0x0061,0x006E,0x0064,0x0061,0x0064,0x0064,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0043,0x0036,0x0032,0x0032,0x0039,0x002D,0x0031,0x0039,0x0038,0x0034,0x002D,0x006B,0x0061,0x006E,0x0061,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0036,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0036,0x004A,0x0049,0x0053,0x0043,0x0036,0x0032,0x0032,0x0039,0x0031,0x0039,0x0038,0x0034,0x006B,0x0061,0x006E,0x0061,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0032,0x0030,0x0033,0x0033,0x002D,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0038,0x00 } + , { 0x0065,0x0031,0x0033,0x0062,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0032,0x0030,0x0033,0x0033,0x00 } + , { 0x0041,0x004E,0x0053,0x0049,0x005F,0x0058,0x0033,0x002E,0x0031,0x0031,0x0030,0x002D,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0039,0x0039,0x00 } + , { 0x0043,0x0053,0x0041,0x005F,0x0054,0x0035,0x0030,0x0030,0x002D,0x0031,0x0039,0x0038,0x0033,0x00 } + , { 0x004E,0x0041,0x0050,0x004C,0x0050,0x0053,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0039,0x0039,0x004E,0x0041,0x0050,0x004C,0x0050,0x0053,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x003A,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x0030,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x006C,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0031,0x0039,0x00 } + , { 0x0043,0x0050,0x0038,0x0031,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0032,0x003A,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0032,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0032,0x00 } + , { 0x006C,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0032,0x00 } + , { 0x0054,0x002E,0x0036,0x0031,0x002D,0x0037,0x0062,0x0069,0x0074,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0030,0x0032,0x0054,0x0036,0x0031,0x0037,0x0062,0x0069,0x0074,0x00 } + , { 0x0054,0x002E,0x0036,0x0031,0x002D,0x0038,0x0062,0x0069,0x0074,0x00 } + , { 0x0054,0x002E,0x0036,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0030,0x0033,0x0054,0x0036,0x0031,0x0038,0x0062,0x0069,0x0074,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0033,0x003A,0x0031,0x0039,0x0038,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0030,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0033,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0033,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0033,0x00 } + , { 0x006C,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0033,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0034,0x003A,0x0031,0x0039,0x0038,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0031,0x0030,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0034,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0034,0x00 } + , { 0x006C,0x0034,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0034,0x00 } + , { 0x0045,0x0043,0x004D,0x0041,0x002D,0x0063,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0031,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0031,0x0031,0x0045,0x0043,0x004D,0x0041,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0043,0x0053,0x0041,0x005F,0x005A,0x0032,0x0034,0x0033,0x002E,0x0034,0x002D,0x0031,0x0039,0x0038,0x0035,0x002D,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0043,0x0041,0x00 } + , { 0x0063,0x0073,0x0061,0x0037,0x002D,0x0031,0x00 } + , { 0x0063,0x0061,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0032,0x0031,0x0043,0x0061,0x006E,0x0061,0x0064,0x0069,0x0061,0x006E,0x0031,0x00 } + , { 0x0043,0x0053,0x0041,0x005F,0x005A,0x0032,0x0034,0x0033,0x002E,0x0034,0x002D,0x0031,0x0039,0x0038,0x0035,0x002D,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0043,0x0041,0x0032,0x00 } + , { 0x0063,0x0073,0x0061,0x0037,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0032,0x0032,0x0043,0x0061,0x006E,0x0061,0x0064,0x0069,0x0061,0x006E,0x0032,0x00 } + , { 0x0043,0x0053,0x0041,0x005F,0x005A,0x0032,0x0034,0x0033,0x002E,0x0034,0x002D,0x0031,0x0039,0x0038,0x0035,0x002D,0x0067,0x0072,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0032,0x0033,0x0043,0x0053,0x0041,0x005A,0x0032,0x0034,0x0033,0x0034,0x0031,0x0039,0x0038,0x0035,0x0067,0x0072,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x003A,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0037,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x00 } + , { 0x0045,0x0043,0x004D,0x0041,0x002D,0x0031,0x0031,0x0034,0x00 } + , { 0x0041,0x0053,0x004D,0x004F,0x002D,0x0037,0x0030,0x0038,0x00 } + , { 0x0061,0x0072,0x0061,0x0062,0x0069,0x0063,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0041,0x0072,0x0061,0x0062,0x0069,0x0063,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x002D,0x0045,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0035,0x0039,0x0036,0x0045,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x002D,0x0045,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x002D,0x0049,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0035,0x0039,0x0036,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0036,0x002D,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0037,0x003A,0x0031,0x0039,0x0038,0x0037,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0037,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0037,0x00 } + , { 0x0045,0x004C,0x004F,0x0054,0x005F,0x0039,0x0032,0x0038,0x00 } + , { 0x0045,0x0043,0x004D,0x0041,0x002D,0x0031,0x0031,0x0038,0x00 } + , { 0x0067,0x0072,0x0065,0x0065,0x006B,0x00 } + , { 0x0067,0x0072,0x0065,0x0065,0x006B,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0047,0x0072,0x0065,0x0065,0x006B,0x00 } + , { 0x0054,0x002E,0x0031,0x0030,0x0031,0x002D,0x0047,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0032,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0032,0x0038,0x0054,0x0031,0x0030,0x0031,0x0047,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x003A,0x0031,0x0039,0x0038,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0033,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x00 } + , { 0x0068,0x0065,0x0062,0x0072,0x0065,0x0077,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0048,0x0065,0x0062,0x0072,0x0065,0x0077,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x002D,0x0045,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0035,0x0039,0x0038,0x0045,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x002D,0x0045,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x002D,0x0049,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0035,0x0039,0x0038,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0038,0x002D,0x0049,0x00 } + , { 0x0043,0x0053,0x004E,0x005F,0x0033,0x0036,0x0039,0x0031,0x0030,0x0033,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0033,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0033,0x0039,0x0043,0x0053,0x004E,0x0033,0x0036,0x0039,0x0031,0x0030,0x0033,0x00 } + , { 0x004A,0x0055,0x0053,0x005F,0x0049,0x002E,0x0042,0x0031,0x002E,0x0030,0x0030,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0059,0x0055,0x00 } + , { 0x006A,0x0073,0x00 } + , { 0x0079,0x0075,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0034,0x0031,0x004A,0x0055,0x0053,0x0049,0x0042,0x0031,0x0030,0x0030,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0036,0x0039,0x0033,0x0037,0x002D,0x0032,0x002D,0x0061,0x0064,0x0064,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0054,0x0065,0x0078,0x0074,0x0043,0x006F,0x006D,0x006D,0x00 } + , { 0x0049,0x0045,0x0043,0x005F,0x0050,0x0032,0x0037,0x002D,0x0031,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0034,0x0033,0x0049,0x0045,0x0043,0x0050,0x0032,0x0037,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0035,0x003A,0x0031,0x0039,0x0038,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0035,0x00 } + , { 0x0063,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x004A,0x0055,0x0053,0x005F,0x0049,0x002E,0x0042,0x0031,0x002E,0x0030,0x0030,0x0033,0x002D,0x0073,0x0065,0x0072,0x0062,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0036,0x00 } + , { 0x0073,0x0065,0x0072,0x0062,0x0069,0x0061,0x006E,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0034,0x0036,0x0053,0x0065,0x0072,0x0062,0x0069,0x0061,0x006E,0x00 } + , { 0x004A,0x0055,0x0053,0x005F,0x0049,0x002E,0x0042,0x0031,0x002E,0x0030,0x0030,0x0033,0x002D,0x006D,0x0061,0x0063,0x00 } + , { 0x006D,0x0061,0x0063,0x0065,0x0064,0x006F,0x006E,0x0069,0x0061,0x006E,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0034,0x0037,0x004D,0x0061,0x0063,0x0065,0x0064,0x006F,0x006E,0x0069,0x0061,0x006E,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0039,0x003A,0x0031,0x0039,0x0038,0x0039,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0034,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0039,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0035,0x00 } + , { 0x006C,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0035,0x00 } + , { 0x0067,0x0072,0x0065,0x0065,0x006B,0x002D,0x0063,0x0063,0x0069,0x0074,0x0074,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0030,0x0047,0x0072,0x0065,0x0065,0x006B,0x0043,0x0043,0x0049,0x0054,0x0054,0x00 } + , { 0x004E,0x0043,0x005F,0x004E,0x0043,0x0030,0x0030,0x002D,0x0031,0x0030,0x003A,0x0038,0x0031,0x00 } + , { 0x0063,0x0075,0x0062,0x0061,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0043,0x0055,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0031,0x0043,0x0075,0x0062,0x0061,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0036,0x0039,0x0033,0x0037,0x002D,0x0032,0x002D,0x0032,0x0035,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0039,0x0033,0x0037,0x0041,0x0064,0x0064,0x00 } + , { 0x0047,0x004F,0x0053,0x0054,0x005F,0x0031,0x0039,0x0037,0x0036,0x0038,0x002D,0x0037,0x0034,0x00 } + , { 0x0053,0x0054,0x005F,0x0053,0x0045,0x0056,0x005F,0x0033,0x0035,0x0038,0x002D,0x0038,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0033,0x0047,0x004F,0x0053,0x0054,0x0031,0x0039,0x0037,0x0036,0x0038,0x0037,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0073,0x0075,0x0070,0x0070,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0034,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0031,0x002D,0x0032,0x002D,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0038,0x0038,0x0035,0x0039,0x0053,0x0075,0x0070,0x0070,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0031,0x0030,0x0033,0x0036,0x0037,0x002D,0x0062,0x006F,0x0078,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0030,0x0033,0x0036,0x0037,0x0042,0x006F,0x0078,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0030,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0037,0x00 } + , { 0x006C,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0030,0x003A,0x0031,0x0039,0x0039,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x004C,0x0061,0x0074,0x0069,0x006E,0x0036,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0036,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x002D,0x006C,0x0061,0x0070,0x00 } + , { 0x006C,0x0061,0x0070,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0038,0x004C,0x0061,0x0070,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0058,0x0030,0x0032,0x0031,0x0032,0x002D,0x0031,0x0039,0x0039,0x0030,0x00 } + , { 0x0078,0x0030,0x0032,0x0031,0x0032,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0035,0x0039,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0031,0x0035,0x0039,0x004A,0x0049,0x0053,0x0058,0x0030,0x0032,0x0031,0x0032,0x0031,0x0039,0x0039,0x0030,0x00 } + , { 0x0044,0x0053,0x005F,0x0032,0x0030,0x0038,0x0039,0x00 } + , { 0x0044,0x0053,0x0032,0x0030,0x0038,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x0044,0x004B,0x00 } + , { 0x0064,0x006B,0x00 } + , { 0x0063,0x0073,0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x0044,0x0061,0x006E,0x0069,0x0073,0x0068,0x00 } + , { 0x0075,0x0073,0x002D,0x0064,0x006B,0x00 } + , { 0x0063,0x0073,0x0055,0x0053,0x0044,0x004B,0x00 } + , { 0x0064,0x006B,0x002D,0x0075,0x0073,0x00 } + , { 0x0063,0x0073,0x0044,0x004B,0x0055,0x0053,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0058,0x0030,0x0032,0x0030,0x0031,0x00 } + , { 0x0058,0x0030,0x0032,0x0030,0x0031,0x00 } + , { 0x0063,0x0073,0x0048,0x0061,0x006C,0x0066,0x0057,0x0069,0x0064,0x0074,0x0068,0x004B,0x0061,0x0074,0x0061,0x006B,0x0061,0x006E,0x0061,0x00 } + , { 0x004B,0x0053,0x0043,0x0035,0x0036,0x0033,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x0036,0x0034,0x0036,0x002D,0x004B,0x0052,0x00 } + , { 0x0063,0x0073,0x004B,0x0053,0x0043,0x0035,0x0036,0x0033,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x0055,0x0043,0x0053,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x0055,0x0043,0x0053,0x002D,0x0034,0x00 } + , { 0x0063,0x0073,0x0055,0x0043,0x0053,0x0034,0x00 } + , { 0x0044,0x0045,0x0043,0x002D,0x004D,0x0043,0x0053,0x00 } + , { 0x0064,0x0065,0x0063,0x00 } + , { 0x0063,0x0073,0x0044,0x0045,0x0043,0x004D,0x0043,0x0053,0x00 } + , { 0x0068,0x0070,0x002D,0x0072,0x006F,0x006D,0x0061,0x006E,0x0038,0x00 } + , { 0x0072,0x006F,0x006D,0x0061,0x006E,0x0038,0x00 } + , { 0x0072,0x0038,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x0052,0x006F,0x006D,0x0061,0x006E,0x0038,0x00 } + , { 0x006D,0x0061,0x0063,0x0069,0x006E,0x0074,0x006F,0x0073,0x0068,0x00 } + , { 0x006D,0x0061,0x0063,0x00 } + , { 0x0063,0x0073,0x004D,0x0061,0x0063,0x0069,0x006E,0x0074,0x006F,0x0073,0x0068,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0033,0x0037,0x00 } + , { 0x0063,0x0070,0x0030,0x0033,0x0037,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0075,0x0073,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0063,0x0061,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0077,0x0074,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x006E,0x006C,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0030,0x0033,0x0037,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0033,0x0038,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0049,0x004E,0x0054,0x00 } + , { 0x0063,0x0070,0x0030,0x0033,0x0038,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0030,0x0033,0x0038,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0037,0x0033,0x00 } + , { 0x0043,0x0050,0x0032,0x0037,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0037,0x0033,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0037,0x0034,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0042,0x0045,0x00 } + , { 0x0043,0x0050,0x0032,0x0037,0x0034,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0037,0x0034,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0037,0x0035,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0042,0x0052,0x00 } + , { 0x0063,0x0070,0x0032,0x0037,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0037,0x0035,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0037,0x0037,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0043,0x0050,0x002D,0x0044,0x004B,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0043,0x0050,0x002D,0x004E,0x004F,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0037,0x0037,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0037,0x0038,0x00 } + , { 0x0043,0x0050,0x0032,0x0037,0x0038,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0066,0x0069,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0073,0x0065,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0037,0x0038,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0038,0x0030,0x00 } + , { 0x0043,0x0050,0x0032,0x0038,0x0030,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0069,0x0074,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0038,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0038,0x0031,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x004A,0x0050,0x002D,0x0045,0x00 } + , { 0x0063,0x0070,0x0032,0x0038,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0038,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0038,0x0034,0x00 } + , { 0x0043,0x0050,0x0032,0x0038,0x0034,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0065,0x0073,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0038,0x0034,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0038,0x0035,0x00 } + , { 0x0043,0x0050,0x0032,0x0038,0x0035,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0067,0x0062,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0038,0x0035,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0039,0x0030,0x00 } + , { 0x0063,0x0070,0x0032,0x0039,0x0030,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x004A,0x0050,0x002D,0x006B,0x0061,0x006E,0x0061,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0039,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0032,0x0039,0x0037,0x00 } + , { 0x0063,0x0070,0x0032,0x0039,0x0037,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0066,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0032,0x0039,0x0037,0x00 } + , { 0x0049,0x0042,0x004D,0x0034,0x0032,0x0030,0x00 } + , { 0x0063,0x0070,0x0034,0x0032,0x0030,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0061,0x0072,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0034,0x0032,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0034,0x0032,0x0033,0x00 } + , { 0x0063,0x0070,0x0034,0x0032,0x0033,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0067,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0034,0x0032,0x0033,0x00 } + , { 0x0049,0x0042,0x004D,0x0034,0x0032,0x0034,0x00 } + , { 0x0063,0x0070,0x0034,0x0032,0x0034,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0068,0x0065,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0034,0x0032,0x0034,0x00 } + , { 0x0049,0x0042,0x004D,0x0034,0x0033,0x0037,0x00 } + , { 0x0063,0x0070,0x0034,0x0033,0x0037,0x00 } + , { 0x0034,0x0033,0x0037,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0038,0x0043,0x006F,0x0064,0x0065,0x0050,0x0061,0x0067,0x0065,0x0034,0x0033,0x0037,0x00 } + , { 0x0049,0x0042,0x004D,0x0035,0x0030,0x0030,0x00 } + , { 0x0043,0x0050,0x0035,0x0030,0x0030,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0062,0x0065,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0063,0x0068,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0035,0x0030,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0037,0x0037,0x0035,0x00 } + , { 0x0063,0x0070,0x0037,0x0037,0x0035,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0037,0x0037,0x0035,0x0042,0x0061,0x006C,0x0074,0x0069,0x0063,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0035,0x0030,0x00 } + , { 0x0063,0x0070,0x0038,0x0035,0x0030,0x00 } + , { 0x0038,0x0035,0x0030,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0038,0x0035,0x0030,0x004D,0x0075,0x006C,0x0074,0x0069,0x006C,0x0069,0x006E,0x0067,0x0075,0x0061,0x006C,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0035,0x0031,0x00 } + , { 0x0063,0x0070,0x0038,0x0035,0x0031,0x00 } + , { 0x0038,0x0035,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0035,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0035,0x0032,0x00 } + , { 0x0063,0x0070,0x0038,0x0035,0x0032,0x00 } + , { 0x0038,0x0035,0x0032,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0070,0x0038,0x0035,0x0032,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0035,0x0035,0x00 } + , { 0x0063,0x0070,0x0038,0x0035,0x0035,0x00 } + , { 0x0038,0x0035,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0035,0x0035,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0035,0x0037,0x00 } + , { 0x0063,0x0070,0x0038,0x0035,0x0037,0x00 } + , { 0x0038,0x0035,0x0037,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0035,0x0037,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0030,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0030,0x00 } + , { 0x0038,0x0036,0x0030,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0031,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0031,0x00 } + , { 0x0038,0x0036,0x0031,0x00 } + , { 0x0063,0x0070,0x002D,0x0069,0x0073,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0032,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0032,0x00 } + , { 0x0038,0x0036,0x0032,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0038,0x0036,0x0032,0x004C,0x0061,0x0074,0x0069,0x006E,0x0048,0x0065,0x0062,0x0072,0x0065,0x0077,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0033,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0033,0x00 } + , { 0x0038,0x0036,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0033,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0034,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0034,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0034,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0035,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0035,0x00 } + , { 0x0038,0x0036,0x0035,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0035,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0036,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0036,0x00 } + , { 0x0038,0x0036,0x0036,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0036,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0038,0x00 } + , { 0x0043,0x0050,0x0038,0x0036,0x0038,0x00 } + , { 0x0063,0x0070,0x002D,0x0061,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0038,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0036,0x0039,0x00 } + , { 0x0063,0x0070,0x0038,0x0036,0x0039,0x00 } + , { 0x0038,0x0036,0x0039,0x00 } + , { 0x0063,0x0070,0x002D,0x0067,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0036,0x0039,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0037,0x0030,0x00 } + , { 0x0043,0x0050,0x0038,0x0037,0x0030,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0072,0x006F,0x0065,0x0063,0x0065,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0079,0x0075,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0037,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0037,0x0031,0x00 } + , { 0x0043,0x0050,0x0038,0x0037,0x0031,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0069,0x0073,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0037,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0038,0x0030,0x00 } + , { 0x0063,0x0070,0x0038,0x0038,0x0030,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0043,0x0079,0x0072,0x0069,0x006C,0x006C,0x0069,0x0063,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0038,0x0030,0x00 } + , { 0x0049,0x0042,0x004D,0x0038,0x0039,0x0031,0x00 } + , { 0x0063,0x0070,0x0038,0x0039,0x0031,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0038,0x0039,0x0031,0x00 } + , { 0x0049,0x0042,0x004D,0x0039,0x0030,0x0033,0x00 } + , { 0x0063,0x0070,0x0039,0x0030,0x0033,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0039,0x0030,0x0033,0x00 } + , { 0x0049,0x0042,0x004D,0x0039,0x0030,0x0034,0x00 } + , { 0x0063,0x0070,0x0039,0x0030,0x0034,0x00 } + , { 0x0039,0x0030,0x0034,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x0042,0x004D,0x0039,0x0030,0x0034,0x00 } + , { 0x0049,0x0042,0x004D,0x0039,0x0030,0x0035,0x00 } + , { 0x0043,0x0050,0x0039,0x0030,0x0035,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0074,0x0072,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0039,0x0030,0x0035,0x00 } + , { 0x0049,0x0042,0x004D,0x0039,0x0031,0x0038,0x00 } + , { 0x0043,0x0050,0x0039,0x0031,0x0038,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0063,0x0070,0x002D,0x0061,0x0072,0x0032,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0039,0x0031,0x0038,0x00 } + , { 0x0049,0x0042,0x004D,0x0031,0x0030,0x0032,0x0036,0x00 } + , { 0x0043,0x0050,0x0031,0x0030,0x0032,0x0036,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0031,0x0030,0x0032,0x0036,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0041,0x0054,0x002D,0x0044,0x0045,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0041,0x0054,0x0044,0x0045,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0041,0x0054,0x002D,0x0044,0x0045,0x002D,0x0041,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0041,0x0054,0x0044,0x0045,0x0041,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0043,0x0041,0x002D,0x0046,0x0052,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0043,0x0041,0x0046,0x0052,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0044,0x004B,0x002D,0x004E,0x004F,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0044,0x004B,0x004E,0x004F,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0044,0x004B,0x002D,0x004E,0x004F,0x002D,0x0041,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0044,0x004B,0x004E,0x004F,0x0041,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0046,0x0049,0x002D,0x0053,0x0045,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0046,0x0049,0x0053,0x0045,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0046,0x0049,0x002D,0x0053,0x0045,0x002D,0x0041,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0046,0x0049,0x0053,0x0045,0x0041,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0046,0x0052,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0046,0x0052,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0049,0x0054,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0049,0x0054,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0050,0x0054,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0050,0x0054,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0045,0x0053,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0045,0x0053,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0045,0x0053,0x002D,0x0041,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0045,0x0053,0x0041,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0045,0x0053,0x002D,0x0053,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0045,0x0053,0x0053,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0055,0x004B,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0055,0x004B,0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x002D,0x0055,0x0053,0x00 } + , { 0x0063,0x0073,0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0055,0x0053,0x00 } + , { 0x0055,0x004E,0x004B,0x004E,0x004F,0x0057,0x004E,0x002D,0x0038,0x0042,0x0049,0x0054,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0038,0x0042,0x0069,0x0054,0x00 } + , { 0x004D,0x004E,0x0045,0x004D,0x004F,0x004E,0x0049,0x0043,0x00 } + , { 0x0063,0x0073,0x004D,0x006E,0x0065,0x006D,0x006F,0x006E,0x0069,0x0063,0x00 } + , { 0x004D,0x004E,0x0045,0x004D,0x00 } + , { 0x0063,0x0073,0x004D,0x006E,0x0065,0x006D,0x00 } + , { 0x0056,0x0049,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0063,0x0073,0x0056,0x0049,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0056,0x0049,0x0051,0x0052,0x00 } + , { 0x0063,0x0073,0x0056,0x0049,0x0051,0x0052,0x00 } + , { 0x004B,0x004F,0x0049,0x0038,0x002D,0x0052,0x00 } + , { 0x0063,0x0073,0x004B,0x004F,0x0049,0x0038,0x0052,0x00 } + , { 0x004B,0x004F,0x0049,0x0038,0x002D,0x0055,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0030,0x0038,0x0035,0x0038,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0030,0x0038,0x0035,0x0038,0x00 } + , { 0x0043,0x0050,0x0030,0x0030,0x0038,0x0035,0x0038,0x00 } + , { 0x0050,0x0043,0x002D,0x004D,0x0075,0x006C,0x0074,0x0069,0x006C,0x0069,0x006E,0x0067,0x0075,0x0061,0x006C,0x002D,0x0038,0x0035,0x0030,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0030,0x0039,0x0032,0x0034,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0030,0x0039,0x0032,0x0034,0x00 } + , { 0x0043,0x0050,0x0030,0x0030,0x0039,0x0032,0x0034,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x0039,0x002D,0x002D,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0030,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0030,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0030,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0075,0x0073,0x002D,0x0033,0x0037,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0031,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0031,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0031,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0064,0x0065,0x002D,0x0032,0x0037,0x0033,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0032,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0032,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0032,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0064,0x006B,0x002D,0x0032,0x0037,0x0037,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x006E,0x006F,0x002D,0x0032,0x0037,0x0037,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0033,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0033,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0033,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0066,0x0069,0x002D,0x0032,0x0037,0x0038,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0073,0x0065,0x002D,0x0032,0x0037,0x0038,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0034,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0034,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0034,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0069,0x0074,0x002D,0x0032,0x0038,0x0030,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0035,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0035,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0035,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0065,0x0073,0x002D,0x0032,0x0038,0x0034,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0036,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0036,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0036,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0067,0x0062,0x002D,0x0032,0x0038,0x0035,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0037,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0037,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0037,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0066,0x0072,0x002D,0x0032,0x0039,0x0037,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0038,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0038,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0038,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x002D,0x0035,0x0030,0x0030,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0049,0x0042,0x004D,0x0030,0x0031,0x0031,0x0034,0x0039,0x00 } + , { 0x0043,0x0043,0x0053,0x0049,0x0044,0x0030,0x0031,0x0031,0x0034,0x0039,0x00 } + , { 0x0043,0x0050,0x0030,0x0031,0x0031,0x0034,0x0039,0x00 } + , { 0x0065,0x0062,0x0063,0x0064,0x0069,0x0063,0x002D,0x0069,0x0073,0x002D,0x0038,0x0037,0x0031,0x002B,0x0065,0x0075,0x0072,0x006F,0x00 } + , { 0x0042,0x0069,0x0067,0x0035,0x002D,0x0048,0x004B,0x0053,0x0043,0x0053,0x00 } + , { 0x0055,0x004E,0x0049,0x0043,0x004F,0x0044,0x0045,0x002D,0x0031,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0031,0x0031,0x00 } + , { 0x0053,0x0043,0x0053,0x0055,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0037,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0031,0x0036,0x0042,0x0045,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0031,0x0036,0x004C,0x0045,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0031,0x0036,0x00 } + , { 0x0043,0x0045,0x0053,0x0055,0x002D,0x0038,0x00 } + , { 0x0063,0x0073,0x0043,0x0045,0x0053,0x0055,0x002D,0x0038,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0033,0x0032,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0033,0x0032,0x0042,0x0045,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0033,0x0032,0x004C,0x0045,0x00 } + , { 0x0055,0x004E,0x0049,0x0043,0x004F,0x0044,0x0045,0x002D,0x0031,0x002D,0x0031,0x002D,0x0055,0x0054,0x0046,0x002D,0x0037,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0031,0x0031,0x0055,0x0054,0x0046,0x0037,0x00 } + , { 0x0055,0x0054,0x0046,0x002D,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0033,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0034,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0069,0x0072,0x002D,0x0031,0x0039,0x0039,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0034,0x003A,0x0031,0x0039,0x0039,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0034,0x00 } + , { 0x006C,0x0061,0x0074,0x0069,0x006E,0x0038,0x00 } + , { 0x0069,0x0073,0x006F,0x002D,0x0063,0x0065,0x006C,0x0074,0x0069,0x0063,0x00 } + , { 0x006C,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x005F,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x0036,0x00 } + , { 0x00 } + , { 0x0047,0x0042,0x004B,0x00 } + , { 0x0043,0x0050,0x0039,0x0033,0x0036,0x00 } + , { 0x004D,0x0053,0x0039,0x0033,0x0036,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0039,0x0033,0x0036,0x00 } + , { 0x0047,0x0042,0x0031,0x0038,0x0030,0x0033,0x0030,0x00 } + , { 0x004A,0x0049,0x0053,0x005F,0x0045,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0063,0x0073,0x004A,0x0049,0x0053,0x0045,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0053,0x0068,0x0069,0x0066,0x0074,0x005F,0x004A,0x0049,0x0053,0x00 } + , { 0x004D,0x0053,0x005F,0x004B,0x0061,0x006E,0x006A,0x0069,0x00 } + , { 0x0063,0x0073,0x0053,0x0068,0x0069,0x0066,0x0074,0x004A,0x0049,0x0053,0x00 } + , { 0x0045,0x0078,0x0074,0x0065,0x006E,0x0064,0x0065,0x0064,0x005F,0x0055,0x004E,0x0049,0x0058,0x005F,0x0043,0x006F,0x0064,0x0065,0x005F,0x0050,0x0061,0x0063,0x006B,0x0065,0x0064,0x005F,0x0046,0x006F,0x0072,0x006D,0x0061,0x0074,0x005F,0x0066,0x006F,0x0072,0x005F,0x004A,0x0061,0x0070,0x0061,0x006E,0x0065,0x0073,0x0065,0x00 } + , { 0x0063,0x0073,0x0045,0x0055,0x0043,0x0050,0x006B,0x0064,0x0046,0x006D,0x0074,0x004A,0x0061,0x0070,0x0061,0x006E,0x0065,0x0073,0x0065,0x00 } + , { 0x0045,0x0055,0x0043,0x002D,0x004A,0x0050,0x00 } + , { 0x0045,0x0078,0x0074,0x0065,0x006E,0x0064,0x0065,0x0064,0x005F,0x0055,0x004E,0x0049,0x0058,0x005F,0x0043,0x006F,0x0064,0x0065,0x005F,0x0046,0x0069,0x0078,0x0065,0x0064,0x005F,0x0057,0x0069,0x0064,0x0074,0x0068,0x005F,0x0066,0x006F,0x0072,0x005F,0x004A,0x0061,0x0070,0x0061,0x006E,0x0065,0x0073,0x0065,0x00 } + , { 0x0063,0x0073,0x0045,0x0055,0x0043,0x0046,0x0069,0x0078,0x0057,0x0069,0x0064,0x004A,0x0061,0x0070,0x0061,0x006E,0x0065,0x0073,0x0065,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x0055,0x0043,0x0053,0x002D,0x0042,0x0061,0x0073,0x0069,0x0063,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0041,0x0053,0x0043,0x0049,0x0049,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x004C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0031,0x0030,0x0036,0x0034,0x0036,0x002D,0x004A,0x002D,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x0049,0x0042,0x004D,0x002D,0x0031,0x0032,0x0036,0x0031,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0049,0x0042,0x004D,0x0031,0x0032,0x0036,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x0049,0x0042,0x004D,0x002D,0x0031,0x0032,0x0036,0x0038,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0049,0x0042,0x004D,0x0031,0x0032,0x0036,0x0038,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x0049,0x0042,0x004D,0x002D,0x0031,0x0032,0x0037,0x0036,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0049,0x0042,0x004D,0x0031,0x0032,0x0037,0x0036,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x0049,0x0042,0x004D,0x002D,0x0031,0x0032,0x0036,0x0034,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0049,0x0042,0x004D,0x0031,0x0032,0x0036,0x0034,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x002D,0x0049,0x0042,0x004D,0x002D,0x0031,0x0032,0x0036,0x0035,0x00 } + , { 0x0063,0x0073,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0049,0x0042,0x004D,0x0031,0x0032,0x0036,0x0035,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x002D,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0033,0x002E,0x0030,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x0033,0x0030,0x004C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0031,0x002D,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0033,0x002E,0x0031,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0031,0x00 } + , { 0x0063,0x0073,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x0033,0x0031,0x004C,0x0061,0x0074,0x0069,0x006E,0x0031,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0032,0x002D,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0032,0x00 } + , { 0x0063,0x0073,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x0033,0x0031,0x004C,0x0061,0x0074,0x0069,0x006E,0x0032,0x00 } + , { 0x0049,0x0053,0x004F,0x002D,0x0038,0x0038,0x0035,0x0039,0x002D,0x0039,0x002D,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x004C,0x0061,0x0074,0x0069,0x006E,0x002D,0x0035,0x00 } + , { 0x0063,0x0073,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x0033,0x0031,0x004C,0x0061,0x0074,0x0069,0x006E,0x0035,0x00 } + , { 0x0041,0x0064,0x006F,0x0062,0x0065,0x002D,0x0053,0x0074,0x0061,0x006E,0x0064,0x0061,0x0072,0x0064,0x002D,0x0045,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0063,0x0073,0x0041,0x0064,0x006F,0x0062,0x0065,0x0053,0x0074,0x0061,0x006E,0x0064,0x0061,0x0072,0x0064,0x0045,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x002D,0x0055,0x0053,0x00 } + , { 0x0063,0x0073,0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x0055,0x0053,0x00 } + , { 0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x002D,0x0049,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x00 } + , { 0x0063,0x0073,0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x0049,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x00 } + , { 0x0050,0x0043,0x0038,0x002D,0x0044,0x0061,0x006E,0x0069,0x0073,0x0068,0x002D,0x004E,0x006F,0x0072,0x0077,0x0065,0x0067,0x0069,0x0061,0x006E,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0038,0x0044,0x0061,0x006E,0x0069,0x0073,0x0068,0x004E,0x006F,0x0072,0x0077,0x0065,0x0067,0x0069,0x0061,0x006E,0x00 } + , { 0x0050,0x0043,0x0038,0x002D,0x0054,0x0075,0x0072,0x006B,0x0069,0x0073,0x0068,0x00 } + , { 0x0063,0x0073,0x0050,0x0043,0x0038,0x0054,0x0075,0x0072,0x006B,0x0069,0x0073,0x0068,0x00 } + , { 0x0049,0x0042,0x004D,0x002D,0x0053,0x0079,0x006D,0x0062,0x006F,0x006C,0x0073,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0053,0x0079,0x006D,0x0062,0x006F,0x006C,0x0073,0x00 } + , { 0x0049,0x0042,0x004D,0x002D,0x0054,0x0068,0x0061,0x0069,0x00 } + , { 0x0063,0x0073,0x0049,0x0042,0x004D,0x0054,0x0068,0x0061,0x0069,0x00 } + , { 0x0048,0x0050,0x002D,0x004C,0x0065,0x0067,0x0061,0x006C,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x004C,0x0065,0x0067,0x0061,0x006C,0x00 } + , { 0x0048,0x0050,0x002D,0x0050,0x0069,0x002D,0x0066,0x006F,0x006E,0x0074,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x0050,0x0069,0x0046,0x006F,0x006E,0x0074,0x00 } + , { 0x0048,0x0050,0x002D,0x004D,0x0061,0x0074,0x0068,0x0038,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x004D,0x0061,0x0074,0x0068,0x0038,0x00 } + , { 0x0041,0x0064,0x006F,0x0062,0x0065,0x002D,0x0053,0x0079,0x006D,0x0062,0x006F,0x006C,0x002D,0x0045,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x0050,0x0053,0x004D,0x0061,0x0074,0x0068,0x00 } + , { 0x0048,0x0050,0x002D,0x0044,0x0065,0x0073,0x006B,0x0054,0x006F,0x0070,0x00 } + , { 0x0063,0x0073,0x0048,0x0050,0x0044,0x0065,0x0073,0x006B,0x0074,0x006F,0x0070,0x00 } + , { 0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x002D,0x004D,0x0061,0x0074,0x0068,0x00 } + , { 0x0063,0x0073,0x0056,0x0065,0x006E,0x0074,0x0075,0x0072,0x0061,0x004D,0x0061,0x0074,0x0068,0x00 } + , { 0x004D,0x0069,0x0063,0x0072,0x006F,0x0073,0x006F,0x0066,0x0074,0x002D,0x0050,0x0075,0x0062,0x006C,0x0069,0x0073,0x0068,0x0069,0x006E,0x0067,0x00 } + , { 0x0063,0x0073,0x004D,0x0069,0x0063,0x0072,0x006F,0x0073,0x006F,0x0066,0x0074,0x0050,0x0075,0x0062,0x006C,0x0069,0x0073,0x0068,0x0069,0x006E,0x0067,0x00 } + , { 0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0033,0x0031,0x004A,0x00 } + , { 0x0063,0x0073,0x0057,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x0033,0x0031,0x004A,0x00 } + , { 0x0047,0x0042,0x0032,0x0033,0x0031,0x0032,0x00 } + , { 0x0063,0x0073,0x0047,0x0042,0x0032,0x0033,0x0031,0x0032,0x00 } + , { 0x0042,0x0069,0x0067,0x0035,0x00 } + , { 0x0063,0x0073,0x0042,0x0069,0x0067,0x0035,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0030,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0031,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0032,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0033,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0034,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0035,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0036,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0037,0x00 } + , { 0x0077,0x0069,0x006E,0x0064,0x006F,0x0077,0x0073,0x002D,0x0031,0x0032,0x0035,0x0038,0x00 } + , { 0x0054,0x0049,0x0053,0x002D,0x0036,0x0032,0x0030,0x00 } + , { 0x0048,0x005A,0x002D,0x0047,0x0042,0x002D,0x0032,0x0033,0x0031,0x0032,0x00 } + +}; +const unsigned int gEncodingArraySize = 791; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/internal/IGXMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/IGXMLScanner.cpp new file mode 100644 index 000000000..1e7b4d2dc --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/IGXMLScanner.cpp @@ -0,0 +1,3267 @@ +/* + * 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: IGXMLScanner.cpp 882548 2009-11-20 13:44:14Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ReaderMgrResetType; + + +// --------------------------------------------------------------------------- +// IGXMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +IGXMLScanner::IGXMLScanner( XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(valToAdopt, grammarResolver, manager) + , fSeeXsi(false) + , fGrammarType(Grammar::UnKnown) + , fElemStateSize(16) + , fElemState(0) + , fElemLoopState(0) + , fContent(1023, manager) + , fRawAttrList(0) + , fRawAttrColonListSize(32) + , fRawAttrColonList(0) + , fDTDValidator(0) + , fSchemaValidator(0) + , fDTDGrammar(0) + , fICHandler(0) + , fLocationPairs(0) + , fDTDElemNonDeclPool(0) + , fSchemaElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) + , fPSVIAttrList(0) + , fModel(0) + , fPSVIElement(0) + , fErrorStack(0) + , fSchemaInfoList(0) + , fCachedSchemaInfoList (0) +{ + CleanupType cleanup(this, &IGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +IGXMLScanner::IGXMLScanner( XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errHandler + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt, grammarResolver, manager) + , fSeeXsi(false) + , fGrammarType(Grammar::UnKnown) + , fElemStateSize(16) + , fElemState(0) + , fElemLoopState(0) + , fContent(1023, manager) + , fRawAttrList(0) + , fRawAttrColonListSize(32) + , fRawAttrColonList(0) + , fDTDValidator(0) + , fSchemaValidator(0) + , fDTDGrammar(0) + , fICHandler(0) + , fLocationPairs(0) + , fDTDElemNonDeclPool(0) + , fSchemaElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) + , fPSVIAttrList(0) + , fModel(0) + , fPSVIElement(0) + , fErrorStack(0) + , fSchemaInfoList(0) + , fCachedSchemaInfoList (0) +{ + CleanupType cleanup(this, &IGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +IGXMLScanner::~IGXMLScanner() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- +NameIdPool* IGXMLScanner::getEntityDeclPool() +{ + if(!fDTDGrammar) + return 0; + return fDTDGrammar->getEntityDeclPool(); +} + +const NameIdPool* IGXMLScanner::getEntityDeclPool() const +{ + if(!fDTDGrammar) + return 0; + return fDTDGrammar->getEntityDeclPool(); +} + +// --------------------------------------------------------------------------- +// IGXMLScanner: Main entry point to scan a document +// --------------------------------------------------------------------------- +void IGXMLScanner::scanDocument(const InputSource& src) +{ + // Bump up the sequence id for this parser instance. This will invalidate + // any previous progressive scan tokens. + fSequenceId++; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + // Reset the scanner and its plugged in stuff for a new run. This + // resets all the data structures, creates the initial reader and + // pushes it on the stack, and sets up the base document path. + scanReset(src); + + // If we have a document handler, then call the start document + if (fDocHandler) + fDocHandler->startDocument(); + + // Scan the prolog part, which is everything before the root element + // including the DTD subsets. + scanProlog(); + + // If we got to the end of input, then its not a valid XML file. + // Else, go on to scan the content. + if (fReaderMgr.atEOF()) + { + emitError(XMLErrs::EmptyMainEntity); + } + else + { + // Scan content, and tell it its not an external entity + if (scanContent()) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + if (!fReaderMgr.atEOF()) + scanMiscellaneous(); + } + } + + // If we have a document handler, then call the end document + if (fDocHandler) + fDocHandler->endDocument(); + + //cargill debug: + //fGrammarResolver->getXSModel(); + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } +} + + +bool IGXMLScanner::scanNext(XMLPScanToken& token) +{ + // Make sure this token is still legal + if (!isLegalToken(token)) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_BadPScanToken, fMemoryManager); + + // Find the next token and remember the reader id + XMLSize_t orgReader; + XMLTokens curToken; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + bool retVal = true; + + try + { + while (true) + { + // We have to handle any end of entity exceptions that happen here. + // We could be at the end of X nested entities, each of which will + // generate an end of entity exception as we try to move forward. + try + { + curToken = senseNextToken(orgReader); + break; + } + catch(const EndOfEntityException& toCatch) + { + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + if (curToken == Token_CharData) + { + scanCharData(fCDataBuf); + } + else if (curToken == Token_EOF) + { + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + retVal = false; + } + else + { + // Its some sort of markup + bool gotData = true; + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // If we hit the end, then do the miscellaneous part + if (!gotData) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + scanMiscellaneous(); + + if (toCheckIdentityConstraint()) + fICHandler->endDocument(); + + if (fDocHandler) + fDocHandler->endDocument(); + } + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception so return failure + retVal = false; + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so return failure + retVal = false; + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + retVal = false; + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + // If we are not at the end, release the object that will + // reset the ReaderMgr. + if (retVal) + resetReaderMgr.release(); + + return retVal; +} + + + +// --------------------------------------------------------------------------- +// IGXMLScanner: Private helper methods. Most of these are implemented in +// IGXMLScanner2.Cpp. +// --------------------------------------------------------------------------- + +// This method handles the common initialization, to avoid having to do +// it redundantly in multiple constructors. +void IGXMLScanner::commonInit() +{ + + // Create the element state array + fElemState = (unsigned int*) fMemoryManager->allocate + ( + fElemStateSize * sizeof(unsigned int) + ); //new unsigned int[fElemStateSize]; + fElemLoopState = (unsigned int*) fMemoryManager->allocate + ( + fElemStateSize * sizeof(unsigned int) + ); //new unsigned int[fElemStateSize]; + + // And we need one for the raw attribute scan. This just stores key/ + // value string pairs (prior to any processing.) + fRawAttrList = new (fMemoryManager) RefVectorOf(32, true, fMemoryManager); + fRawAttrColonList = (int*) fMemoryManager->allocate + ( + fRawAttrColonListSize * sizeof(int) + ); + + // Create the Validator and init them + fDTDValidator = new (fMemoryManager) DTDValidator(); + initValidator(fDTDValidator); + fSchemaValidator = new (fMemoryManager) SchemaValidator(0, fMemoryManager); + initValidator(fSchemaValidator); + + // Create IdentityConstraint info + fICHandler = new (fMemoryManager) IdentityConstraintHandler(this, fMemoryManager); + + // Create schemaLocation pair info + fLocationPairs = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + // create pools for undeclared elements + fDTDElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + fSchemaElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + fAttDefRegistry = new (fMemoryManager) RefHashTableOf + ( + 131, false, fMemoryManager + ); + fUndeclaredAttrRegistry = new (fMemoryManager) Hash2KeysSetOf(7, fMemoryManager); + fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager); + + fSchemaInfoList = new (fMemoryManager) RefHash2KeysTableOf(29, fMemoryManager); + fCachedSchemaInfoList = new (fMemoryManager) RefHash2KeysTableOf(29, fMemoryManager); + + // use fDTDValidator as the default validator + if (!fValidator) + fValidator = fDTDValidator; +} + +void IGXMLScanner::cleanUp() +{ + fMemoryManager->deallocate(fElemState); //delete [] fElemState; + fMemoryManager->deallocate(fElemLoopState); //delete [] fElemLoopState; + delete fRawAttrList; + fMemoryManager->deallocate(fRawAttrColonList); + delete fDTDValidator; + delete fSchemaValidator; + delete fICHandler; + delete fLocationPairs; + delete fDTDElemNonDeclPool; + delete fSchemaElemNonDeclPool; + delete fAttDefRegistry; + delete fUndeclaredAttrRegistry; + delete fPSVIAttrList; + delete fPSVIElement; + delete fErrorStack; + delete fSchemaInfoList; + delete fCachedSchemaInfoList; +} + +// --------------------------------------------------------------------------- +// IGXMLScanner: Private scanning methods +// --------------------------------------------------------------------------- + +// This method is called from scanStartTag() to handle the very raw initial +// scan of the attributes. It just fills in the passed collection with +// key/value pairs for each attribute. No processing is done on them at all. +XMLSize_t +IGXMLScanner::rawAttrScan(const XMLCh* const elemName + , RefVectorOf& toFill + , bool& isEmpty) +{ + // Keep up with how many attributes we've seen so far, and how many + // elements are available in the vector. This way we can reuse old + // elements until we run out and then expand it. + XMLSize_t attCount = 0; + XMLSize_t curVecSize = toFill.size(); + + // Assume it is not empty + isEmpty = false; + + // We loop until we either see a /> or >, handling key/value pairs util + // we get there. We place them in the passed vector, which we will expand + // as required to hold them. + while (true) + { + // Get the next character, which should be non-space + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + // + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + bool bFoundSpace; + fReaderMgr.skipPastSpaces(bFoundSpace); + if (!bFoundSpace) + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + // Ok, peek another char + nextCh = fReaderMgr.peekNextChar(); + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume it's going to be an attribute, so get a name from + // the input. + int colonPosition; + if (!fReaderMgr.getQName(fAttNameBuf, &colonPosition)) + { + if (fAttNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedAttrName); + else + emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return attCount; + } + + const XMLCh* curAttNameBuf = fAttNameBuf.getRawBuffer(); + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemName); + return attCount; + } + else + { + // Something went really wrong + return attCount; + } + } + + // Next should be the quoted attribute value. We just do a simple + // and stupid scan of this value. The only thing we do here + // is to expand entity references. + if (!basicAttrValueScan(curAttNameBuf, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemName); + return attCount; + } + else + { + // Something went really wrong + return attCount; + } + } + + // And now lets add it to the passed collection. If we have not + // filled it up yet, then we use the next element. Else we add + // a new one. + KVStringPair* curPair = 0; + if (attCount >= curVecSize) + { + curPair = new (fMemoryManager) KVStringPair + ( + curAttNameBuf + , fAttNameBuf.getLen() + , fAttValueBuf.getRawBuffer() + , fAttValueBuf.getLen() + , fMemoryManager + ); + toFill.addElement(curPair); + } + else + { + curPair = toFill.elementAt(attCount); + curPair->set + ( + curAttNameBuf, + fAttNameBuf.getLen(), + fAttValueBuf.getRawBuffer(), + fAttValueBuf.getLen() + ); + } + + if (attCount >= fRawAttrColonListSize) { + resizeRawAttrColonList(); + } + // Set the position of the colon and bump the count of attributes we've gotten + fRawAttrColonList[attCount++] = colonPosition; + + // And go to the top again for another attribute + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, elemName); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemName); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + return attCount; +} + + +// This method will kick off the scanning of the primary content of the +// document, i.e. the elements. +bool IGXMLScanner::scanContent() +{ + // Go into a loop until we hit the end of the root element, or we fall + // out because there is no root element. + // + // We have to do kind of a deeply nested double loop here in order to + // avoid doing the setup/teardown of the exception handler on each + // round. Doing it this way we only do it when an exception actually + // occurs. + bool gotData = true; + bool inMarkup = false; + while (gotData) + { + try + { + while (gotData) + { + // Sense what the next top level token is. According to what + // this tells us, we will call something to handle that kind + // of thing. + XMLSize_t orgReader; + const XMLTokens curToken = senseNextToken(orgReader); + + // Handle character data and end of file specially. Char data + // is not markup so we don't want to handle it in the loop + // below. + if (curToken == Token_CharData) + { + // Scan the character data and call appropriate events. Let + // him use our local character data buffer for efficiency. + scanCharData(fCDataBuf); + continue; + } + else if (curToken == Token_EOF) + { + // The element stack better be empty at this point or we + // ended prematurely before all elements were closed. + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + // Its the end of file, so clear the got data flag + gotData = false; + continue; + } + + // We are in some sort of markup now + inMarkup = true; + + // According to the token we got, call the appropriate + // scanning method. + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // And we are back out of markup again + inMarkup = false; + } + } + catch(const EndOfEntityException& toCatch) + { + // If we were in some markup when this happened, then its a + // partial markup error. + if (inMarkup) + emitError(XMLErrs::PartialMarkupInEntity); + + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + + inMarkup = false; + } + } + + // It went ok, so return success + return true; +} + + +void IGXMLScanner::scanEndTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the end of the root element. + gotData = true; + + // Check if the element stack is empty. If so, then this is an unbalanced + // element (i.e. more ends than starts, perhaps because of bad text + // causing one to be skipped.) + if (fElemStack.isEmpty()) + { + emitError(XMLErrs::MoreEndThanStartTags); + fReaderMgr.skipPastChar(chCloseAngle); + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd, fMemoryManager); + } + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + unsigned int uriId = (fDoNamespaces) + ? fElemStack.getCurrentURI() : fEmptyNamespaceId; + + // these get initialized below + const ElemStack::StackElem* topElem = 0; + const XMLCh *elemName = 0; + + // Make sure that its the end of the element that we expect + // special case for schema validation, whose element decls, + // obviously don't contain prefix information + if(fGrammarType == Grammar::SchemaGrammarType) + { + elemName = fElemStack.getCurrentSchemaElemName(); + topElem = fElemStack.topElement(); + } + else + { + topElem = fElemStack.topElement(); + elemName = topElem->fThisElement->getFullName(); + } + if (!fReaderMgr.skippedStringLong(elemName)) + { + emitError + ( + XMLErrs::ExpectedEndOfTagX + , elemName + ); + fReaderMgr.skipPastChar(chCloseAngle); + fElemStack.popTop(); + return; + } + + // Make sure we are back on the same reader as where we started + if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialTagMarkupError); + + // Skip optional whitespace + fReaderMgr.skipPastSpaces(); + + // Make sure we find the closing bracket + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError + ( + XMLErrs::UnterminatedEndTag + , topElem->fThisElement->getFullName() + ); + } + + if (fGrammarType == Grammar::SchemaGrammarType) + { + // reset error occurred + fPSVIElemContext.fErrorOccurred = fErrorStack->pop(); + if (fValidate && topElem->fThisElement->isDeclared()) + { + fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + if(!fPSVIElemContext.fCurrentTypeInfo) + fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + else + fPSVIElemContext.fCurrentDV = 0; + if(fPSVIHandler) + { + fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue(); + + if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString)) + fPSVIElemContext.fNormalizedValue = 0; + } + } + else + { + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; + } + } + + // If validation is enabled, then lets pass him the list of children and + // this element and let him validate it. + DatatypeValidator* psviMemberType = 0; + if (fValidate) + { + + // + // XML1.0-3rd + // Validity Constraint: + // The declaration matches EMPTY and the element has no content (not even + // entity references, comments, PIs or white space). + // + if ( (fGrammarType == Grammar::DTDGrammarType) && + (topElem->fCommentOrPISeen) && + (((DTDElementDecl*) topElem->fThisElement)->getModelType() == DTDElementDecl::Empty)) + { + fValidator->emitError + ( + XMLValid::EmptyElemHasContent + , topElem->fThisElement->getFullName() + ); + } + + // + // XML1.0-3rd + // Validity Constraint: + // + // The declaration matches children and the sequence of child elements + // belongs to the language generated by the regular expression in the + // content model, with optional white space, comments and PIs + // (i.e. markup matching production [27] Misc) between the start-tag and + // the first child element, between child elements, or between the last + // child element and the end-tag. + // + // Note that + // a CDATA section containing only white space or + // a reference to an entity whose replacement text is character references + // expanding to white space do not match the nonterminal S, and hence + // cannot appear in these positions; however, + // a reference to an internal entity with a literal value consisting + // of character references expanding to white space does match S, + // since its replacement text is the white space resulting from expansion + // of the character references. + // + if ( (fGrammarType == Grammar::DTDGrammarType) && + (topElem->fReferenceEscaped) && + (((DTDElementDecl*) topElem->fThisElement)->getModelType() == DTDElementDecl::Children)) + { + fValidator->emitError + ( + XMLValid::ElemChildrenHasInvalidWS + , topElem->fThisElement->getFullName() + ); + } + XMLSize_t failure; + bool res = fValidator->checkContent + ( + topElem->fThisElement + , topElem->fChildren + , topElem->fChildCount + , &failure + ); + + if (!res) + { + // One of the elements is not valid for the content. NOTE that + // if no children were provided but the content model requires + // them, it comes back with a zero value. But we cannot use that + // to index the child array in this case, and have to put out a + // special message. + if (!topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::EmptyNotValidForContent + , topElem->fThisElement->getFormattedContentModel() + ); + } + else if (failure >= topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::NotEnoughElemsForCM + , topElem->fThisElement->getFormattedContentModel() + ); + } + else + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , topElem->fChildren[failure]->getRawName() + , topElem->fThisElement->getFormattedContentModel() + ); + } + } + + + if (fGrammarType == Grammar::SchemaGrammarType) { + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + fPSVIElemContext.fErrorOccurred = true; + else if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union) + psviMemberType = fValidationContext->getValidatingMemberType(); + + if (fPSVIHandler) + { + fPSVIElemContext.fIsSpecified = ((SchemaValidator*) fValidator)->getIsElemSpecified(); + if(fPSVIElemContext.fIsSpecified) + fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl *)topElem->fThisElement)->getDefaultValue(); + } + + // call matchers and de-activate context + if (toCheckIdentityConstraint()) + { + fICHandler->deactivateContext + ( + (SchemaElementDecl *) topElem->fThisElement + , fContent.getRawBuffer() + , fValidationContext + , fPSVIElemContext.fCurrentDV + ); + } + + } + } + + // QName dv needed topElem to resolve URIs on the checkContent + fElemStack.popTop(); + + // See if it was the root element, to avoid multiple calls below + const bool isRoot = fElemStack.isEmpty(); + + if (fGrammarType == Grammar::SchemaGrammarType) + { + if (fPSVIHandler) + { + endElementPSVI( + (SchemaElementDecl*)topElem->fThisElement, psviMemberType); + } + // now we can reset the datatype buffer, since the + // application has had a chance to copy the characters somewhere else + ((SchemaValidator *)fValidator)->clearDatatypeBuffer(); + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + if (fGrammarType == Grammar::SchemaGrammarType) { + if (topElem->fPrefixColonPos != -1) + fPrefixBuf.set(elemName, topElem->fPrefixColonPos); + else + fPrefixBuf.reset(); + } + else { + fPrefixBuf.set(topElem->fThisElement->getElementName()->getPrefix()); + } + fDocHandler->endElement + ( + *topElem->fThisElement + , uriId + , isRoot + , fPrefixBuf.getRawBuffer() + ); + } + + if (fGrammarType == Grammar::SchemaGrammarType) { + if (!isRoot) + { + // update error information + fErrorStack->push((fErrorStack->size() && fErrorStack->pop()) || fPSVIElemContext.fErrorOccurred); + + + } + } + + // If this was the root, then done with content + gotData = !isRoot; + + if (gotData) { + if (fDoNamespaces) { + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + if (fGrammarType == Grammar::SchemaGrammarType && !fValidator->handlesSchema()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + else { + fValidator = fSchemaValidator; + } + } + else if (fGrammarType == Grammar::DTDGrammarType && !fValidator->handlesDTD()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + else { + fValidator = fDTDValidator; + } + } + + fValidator->setGrammar(fGrammar); + } + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } +} + + +// This method handles the high level logic of scanning the DOCType +// declaration. This calls the DTDScanner and kicks off both the scanning of +// the internal subset and the scanning of the external subset, if any. +// +// When we get here the 'resetDocType(); + + // There must be some space after DOCTYPE + bool skippedSomething; + fReaderMgr.skipPastSpaces(skippedSomething); + if (!skippedSomething) + { + emitError(XMLErrs::ExpectedWhitespace); + + // Just skip the Doctype declaration and return + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Get a buffer for the root element + XMLBufBid bbRootName(&fBufMgr); + + // Get a name from the input, which should be the name of the root + // element of the upcoming content. + int colonPosition; + bool validName = fDoNamespaces ? fReaderMgr.getQName(bbRootName.getBuffer(), &colonPosition) : + fReaderMgr.getName(bbRootName.getBuffer()); + if (!validName) + { + if (bbRootName.isEmpty()) + emitError(XMLErrs::NoRootElemInDOCTYPE); + else + emitError(XMLErrs::InvalidRootElemInDOCTYPE, bbRootName.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Store the root element name for later check + setRootElemName(bbRootName.getRawBuffer()); + + // This element obviously is not going to exist in the element decl + // pool yet, but we need to call docTypeDecl. So force it into + // the element decl pool, marked as being there because it was in + // the DOCTYPE. Later, when its declared, the status will be updated. + // + // Only do this if we are not reusing the validator! If we are reusing, + // then look it up instead. It has to exist! + MemoryManager* const rootDeclMgr = + fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager; + + DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl + ( + bbRootName.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , rootDeclMgr + ); + + Janitor rootDeclJanitor(rootDecl); + rootDecl->setCreateReason(DTDElementDecl::AsRootElem); + rootDecl->setExternalElemDeclaration(true); + if(!fUseCachedGrammar) + { + fGrammar->putElemDecl(rootDecl); + rootDeclJanitor.release(); + } else + { + // attach this to the undeclared element pool so that it gets deleted + XMLElementDecl* elemDecl = fDTDElemNonDeclPool->getByKey(bbRootName.getRawBuffer()); + if (elemDecl) + { + rootDecl->setId(elemDecl->getId()); + } + else + { + rootDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)rootDecl)); + rootDeclJanitor.release(); + } + } + + // Skip any spaces after the name + fReaderMgr.skipPastSpaces(); + + // And now if we are looking at a >, then we are done. It is not + // required to have an internal or external subset, though why you + // would not escapes me. + if (fReaderMgr.skippedChar(chCloseAngle)) { + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) + fDocTypeHandler->doctypeDecl(*rootDecl, 0, 0, false); + return; + } + + // either internal/external subset + if (fValScheme == Val_Auto && !fValidate) + fValidate = true; + + bool hasIntSubset = false; + bool hasExtSubset = false; + XMLCh* sysId = 0; + XMLCh* pubId = 0; + + DTDScanner dtdScanner + ( + (DTDGrammar*) fGrammar + , fDocTypeHandler + , fGrammarPoolMemoryManager + , fMemoryManager + ); + dtdScanner.setScannerInfo(this, &fReaderMgr, &fBufMgr); + + // If the next character is '[' then we have no external subset cause + // there is no system id, just the opening character of the internal + // subset. Else, has to be an id. + // + // Just look at the next char, don't eat it. + if (fReaderMgr.peekNextChar() == chOpenSquare) + { + hasIntSubset = true; + } + else + { + // Indicate we have an external subset + hasExtSubset = true; + fHasNoDTD = false; + + // Get buffers for the ids + XMLBufBid bbPubId(&fBufMgr); + XMLBufBid bbSysId(&fBufMgr); + + // Get the external subset id + if (!dtdScanner.scanId(bbPubId.getBuffer(), bbSysId.getBuffer(), DTDScanner::IDType_External)) + { + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Get copies of the ids we got + pubId = XMLString::replicate(bbPubId.getRawBuffer(), fMemoryManager); + sysId = XMLString::replicate(bbSysId.getRawBuffer(), fMemoryManager); + + // Skip spaces and check again for the opening of an internal subset + fReaderMgr.skipPastSpaces(); + + // Just look at the next char, don't eat it. + if (fReaderMgr.peekNextChar() == chOpenSquare) { + hasIntSubset = true; + } + } + + // Insure that the ids get cleaned up, if they got allocated + ArrayJanitor janSysId(sysId, fMemoryManager); + ArrayJanitor janPubId(pubId, fMemoryManager); + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) + fDocTypeHandler->doctypeDecl(*rootDecl, pubId, sysId, hasIntSubset, hasExtSubset); + + // Ok, if we had an internal subset, we are just past the [ character + // and need to parse that first. + if (hasIntSubset) + { + // Eat the opening square bracket + fReaderMgr.getNextChar(); + + checkInternalDTD(hasExtSubset, sysId, pubId); + + // And try to scan the internal subset. If we fail, try to recover + // by skipping forward tot he close angle and returning. + if (!dtdScanner.scanInternalSubset()) + { + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Do a sanity check that some expanded PE did not propogate out of + // the doctype. This could happen if it was terminated early by bad + // syntax. + if (fReaderMgr.getReaderDepth() > 1) + { + emitError(XMLErrs::PEPropogated); + + // Ask the reader manager to pop back down to the main level + fReaderMgr.cleanStackBackTo(1); + } + + fReaderMgr.skipPastSpaces(); + } + + // And that should leave us at the closing > of the DOCTYPE line + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + // Do a special check for the common scenario of an extra ] char at + // the end. This is easy to recover from. + if (fReaderMgr.skippedChar(chCloseSquare) + && fReaderMgr.skippedChar(chCloseAngle)) + { + emitError(XMLErrs::ExtraCloseSquare); + } + else + { + emitError(XMLErrs::UnterminatedDOCTYPE); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + + // If we had an external subset, then we need to deal with that one + // next. If we are reusing the validator, then don't scan it. + if (hasExtSubset) { + + InputSource* srcUsed=0; + Janitor janSrc(srcUsed); + // If we had an internal subset and we're using the cached grammar, it + // means that the ignoreCachedDTD is set, so we ignore the cached + // grammar + if (fUseCachedGrammar && !hasIntSubset) + { + srcUsed = resolveSystemId(sysId, pubId); + if (srcUsed) { + janSrc.reset(srcUsed); + Grammar* grammar = fGrammarResolver->getGrammar(srcUsed->getSystemId()); + + if (grammar && grammar->getGrammarType() == Grammar::DTDGrammarType) { + + fDTDGrammar = (DTDGrammar*) grammar; + fGrammar = fDTDGrammar; + fValidator->setGrammar(fGrammar); + // If we don't report at least the external subset boundaries, + // an advanced document handler cannot know when the DTD end, + // since we've already sent a doctype decl that indicates there's + // there's an external subset. + if (fDocTypeHandler) + { + fDocTypeHandler->startExtSubset(); + fDocTypeHandler->endExtSubset(); + } + + return; + } + } + } + + if (fLoadExternalDTD || fValidate) + { + // And now create a reader to read this entity + XMLReader* reader; + if (srcUsed) { + reader = fReaderMgr.createReader + ( + *srcUsed + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + } + else { + reader = fReaderMgr.createReader + ( + sysId + , pubId + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , srcUsed + , fCalculateSrcOfs + , fLowWaterMark + , fDisableDefaultEntityResolution + ); + janSrc.reset(srcUsed); + } + // If it failed then throw an exception + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenDTD, srcUsed ? srcUsed->getSystemId() : sysId, fMemoryManager); + + if (fToCacheGrammar) { + + unsigned int stringId = fGrammarResolver->getStringPool()->addOrFind(srcUsed->getSystemId()); + const XMLCh* sysIdStr = fGrammarResolver->getStringPool()->getValueForId(stringId); + + fGrammarResolver->orphanGrammar(XMLUni::fgDTDEntityString); + ((XMLDTDDescription*) (fGrammar->getGrammarDescription()))->setSystemId(sysIdStr); + fGrammarResolver->putGrammar(fGrammar); + } + + // In order to make the processing work consistently, we have to + // make this look like an external entity. So create an entity + // decl and fill it in and push it with the reader, as happens + // with an external entity. Put a janitor on it to insure it gets + // cleaned up. The reader manager does not adopt them. + const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull }; + DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager); + declDTD->setSystemId(sysId); + declDTD->setIsExternal(true); + Janitor janDecl(declDTD); + + // Mark this one as a throw at end + reader->setThrowAtEnd(true); + + // And push it onto the stack, with its pseudo name + fReaderMgr.pushReader(reader, declDTD); + + // Tell it its not in an include section + dtdScanner.scanExtSubsetDecl(false, true); + } + } +} + +bool IGXMLScanner::scanStartTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Get the QName. In this case, we are not doing namespaces, so we just + // use it as is and don't have to break it into parts. + if (!fReaderMgr.getName(fQNameBuf)) + { + emitError(XMLErrs::ExpectedElementName); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // Assume it won't be an empty tag + bool isEmpty = false; + + // Lets try to look up the element in the validator's element decl pool + // We can pass bogus values for the URI id and the base name. We know that + // this can only be called if we are doing a DTD style validator and that + // he will only look at the QName. + // + // We tell him to fault in a decl if he does not find one. + // Actually, we *don't* tell him to fault in a decl if he does not find one- NG + bool wasAdded = false; + const XMLCh *rawQName = fQNameBuf.getRawBuffer(); + XMLElementDecl* elemDecl = fGrammar->getElemDecl + ( + fEmptyNamespaceId + , 0 + , rawQName + , Grammar::TOP_LEVEL_SCOPE + ); + // look for it in the undeclared pool: + if(!elemDecl) + { + elemDecl = fDTDElemNonDeclPool->getByKey(rawQName); + } + if(!elemDecl) + { + // we're assuming this must be a DTD element. DTD's can be + // used with or without namespaces, but schemas cannot be used without + // namespaces. + wasAdded = true; + elemDecl = new (fMemoryManager) DTDElementDecl + ( + rawQName + , fEmptyNamespaceId + , DTDElementDecl::Any + , fMemoryManager + ); + elemDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)elemDecl)); + } + + // We do something different here according to whether we found the + // element or not. + if (wasAdded) + { + // If validating then emit an error + if (fValidate) + { + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the validator pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + } + } + else + { + // If its not marked declared and validating, then emit an error + if (fValidate && !elemDecl->isDeclared()) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + } + } + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Expand the element stack and add the new element + fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum()); + fElemStack.setValidationFlag(fValidate); + + // Validate the element + if (fValidate) + fValidator->validateElement(elemDecl); + + // If this is the first element and we are validating, check the root + // element. + if (isRoot) + { + fRootGrammar = fGrammar; + + if (fValidate) + { + // If a DocType exists, then check if it matches the root name there. + if (fRootElemName && !XMLString::equals(fQNameBuf.getRawBuffer(), fRootElemName)) + fValidator->emitError(XMLValid::RootElemNotLikeDocType); + } + } + else + { + // If the element stack is not empty, then add this element as a + // child of the previous top element. If its empty, this is the root + // elem and is not the child of anything. + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // We loop until we either see a /> or >, handling attribute/value + // pairs until we get there. + XMLSize_t attCount = 0; + XMLSize_t curAttListSize = fAttrList->size(); + wasAdded = false; + + fElemCount++; + + while (true) + { + // And get the next non-space character + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + bool bFoundSpace; + fReaderMgr.skipPastSpaces(bFoundSpace); + if (!bFoundSpace) + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + // Ok, peek another char + nextCh = fReaderMgr.peekNextChar(); + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + if (!fReaderMgr.getName(fAttNameBuf)) + { + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.skipPastChar(chCloseAngle); + return false; + } + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + // See if this attribute is declared for this element. If we are + // not validating of course it will not be at first, but we will + // fault it into the pool (to avoid lots of redundant errors.) + XMLCh * namePtr = fAttNameBuf.getRawBuffer(); + XMLAttDef* attDef = ((DTDElementDecl *)elemDecl)->getAttDef(namePtr); + + // Add this attribute to the attribute list that we use to + // pass them to the handler. We reuse its existing elements + // but expand it as required. + // Note that we want to this first since this will + // make a copy of the namePtr; we can then make use of + // that copy in the hashtable lookup that checks + // for duplicates. This will mean we may have to update + // the type of the XMLAttr later. + XMLAttr* curAtt; + if (attCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr + ( + 0 + , namePtr + , XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , (attDef)?attDef->getType():XMLAttDef::CData + , true + , fMemoryManager + ); + fAttrList->addElement(curAtt); + } + else + { + curAtt = fAttrList->elementAt(attCount); + curAtt->set + ( + 0 + , namePtr + , XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , (attDef)?attDef->getType():XMLAttDef::CData + ); + curAtt->setSpecified(true); + } + // reset namePtr so it refers to newly-allocated memory + namePtr = (XMLCh *)curAtt->getName(); + + if (!attDef) + { + // If there is a validation handler, then we are validating + // so emit an error. + if (fValidate) + { + fValidator->emitError + ( + XMLValid::AttNotDefinedForElement + , fAttNameBuf.getRawBuffer() + , elemDecl->getFullName() + ); + } + if(!fUndeclaredAttrRegistry->putIfNotPresent(namePtr, 0)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + } + } + else + { + // prepare for duplicate detection + unsigned int *curCountPtr = fAttDefRegistry->get(attDef); + if(!curCountPtr) + { + curCountPtr = getNewUIntPtr(); + *curCountPtr = fElemCount; + fAttDefRegistry->put(attDef, curCountPtr); + } + else if(*curCountPtr < fElemCount) + *curCountPtr = fElemCount; + else + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , attDef->getFullName() + , elemDecl->getFullName() + ); + } + } + + // Skip any whitespace before the value and then scan the att + // value. This will come back normalized with entity refs and + // char refs expanded. + fReaderMgr.skipPastSpaces(); + if (!scanAttValue(attDef, namePtr, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + return false; + } + else + { + // Something went really wrong + return false; + } + } + // must set the newly-minted value on the XMLAttr: + curAtt->setValue(fAttValueBuf.getRawBuffer()); + + // Now that its all stretched out, lets look at its type and + // determine if it has a valid value. It will output any needed + // errors, but we just keep going. We only need to do this if + // we are validating. + if (attDef) + { + // Let the validator pass judgement on the attribute value + if (fValidate) + { + fValidator->validateAttrValue + ( + attDef + , fAttValueBuf.getRawBuffer() + , false + , elemDecl + ); + } + } + + attCount++; + // And jump back to the top of the loop + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // Ok, so lets get an enumerator for the attributes of this element + // and run through them for well formedness and validity checks. But + // make sure that we had any attributes before we do it, since the list + // would have have gotten faulted in anyway. + if (elemDecl->hasAttDefs()) + { + // N.B.: this assumes DTD validation. + XMLAttDefList& attDefList = elemDecl->getAttDefList(); + for(XMLSize_t i=0; iget(&curDef); + if (!attCountPtr || *attCountPtr < fElemCount) + { // did not occur + if (fValidate) + { + // If we are validating and its required, then an error + if (defType == XMLAttDef::Required) + { + fValidator->emitError + ( + XMLValid::RequiredAttrNotProvided + , curDef.getFullName() + ); + } + else if ((defType == XMLAttDef::Default) || + (defType == XMLAttDef::Fixed) ) + { + if (fStandalone && curDef.isExternal()) + { + // XML 1.0 Section 2.9 + // Document is standalone, so attributes must not be defaulted. + fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef.getFullName(), elemDecl->getFullName()); + + } + } + } + + // Fault in the value if needed, and bump the att count + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + // Let the validator pass judgement on the attribute value + if (fValidate) + { + fValidator->validateAttrValue + ( + &curDef + , curDef.getValue() + , false + , elemDecl + ); + } + + XMLAttr* curAtt; + if (attCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr + ( + 0 + , curDef.getFullName() + , XMLUni::fgZeroLenString + , curDef.getValue() + , curDef.getType() + , false + , fMemoryManager + ); + fAttrList->addElement(curAtt); + curAttListSize++; + } + else + { + curAtt = fAttrList->elementAt(attCount); + curAtt->set + ( + 0 + , curDef.getFullName() + , XMLUni::fgZeroLenString + , curDef.getValue() + , curDef.getType() + ); + curAtt->setSpecified(false); + } + attCount++; + } + } + } + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , elemDecl->getFullName() + , elemDecl->getFormattedContentModel() + ); + } + } + + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + else { + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } + } + + // If we have a document handler, then tell it about this start tag. We + // don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send + // any prefix since its just one big name if we are not doing namespaces. + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , fEmptyNamespaceId + , 0 + , *fAttrList + , attCount + , isEmpty + , isRoot + ); + } + + return true; +} + + +// This method is called to scan a start tag when we are processing +// namespaces. There are two different versions of this method, one for +// namespace aware processing and one for non-namespace aware processing. +// +// This method is called after we've scanned the < of a start tag. So we +// have to get the element name, then scan the attributes, after which +// we are either going to see >, />, or attributes followed by one of those +// sequences. +bool IGXMLScanner::scanStartTagNS(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Reset element content buffer + fContent.reset(); + + // The current position is after the open bracket, so we need to read in + // in the element name. + int prefixColonPos; + if (!fReaderMgr.getQName(fQNameBuf, &prefixColonPos)) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // First we have to do the rawest attribute scan. We don't do any + // normalization of them at all, since we don't know yet what type they + // might be (since we need the element decl in order to do that.) + bool isEmpty; + XMLSize_t attCount = rawAttrScan + ( + fQNameBuf.getRawBuffer() + , *fRawAttrList + , isEmpty + ); + + // save the contentleafname and currentscope before addlevel, for later use + ContentLeafNameTypeVector* cv = 0; + XMLContentModel* cm = 0; + unsigned int currentScope = Grammar::TOP_LEVEL_SCOPE; + bool laxThisOne = false; + + if (!isRoot && fGrammarType == Grammar::SchemaGrammarType) + { + // schema validator will have correct type if validating + SchemaElementDecl* tempElement = (SchemaElementDecl*) + fElemStack.topElement()->fThisElement; + SchemaElementDecl::ModelTypes modelType = tempElement->getModelType(); + ComplexTypeInfo *currType = 0; + + if (fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (currType) + modelType = (SchemaElementDecl::ModelTypes)currType->getContentType(); + else // something must have gone wrong + modelType = SchemaElementDecl::Any; + } + else + { + currType = tempElement->getComplexTypeInfo(); + } + + if ((modelType == SchemaElementDecl::Mixed_Simple) + || (modelType == SchemaElementDecl::Mixed_Complex) + || (modelType == SchemaElementDecl::Children)) + { + cm = currType->getContentModel(); + cv = cm->getContentLeafNameTypeVector(); + currentScope = fElemStack.getCurrentScope(); + } + else if (modelType == SchemaElementDecl::Any) { + laxThisOne = true; + } + } + + // Now, since we might have to update the namespace map for this element, + // but we don't have the element decl yet, we just tell the element stack + // to expand up to get ready. + XMLSize_t elemDepth = fElemStack.addLevel(); + fElemStack.setValidationFlag(fValidate); + fElemStack.setPrefixColonPos(prefixColonPos); + + // Check if there is any external schema location specified, and if we are at root, + // go through them first before scanning those specified in the instance document + if (isRoot && fDoSchema + && (fExternalSchemaLocation || fExternalNoNamespaceSchemaLocation)) { + + if (fExternalSchemaLocation) + parseSchemaLocation(fExternalSchemaLocation, true); + if (fExternalNoNamespaceSchemaLocation) + resolveSchemaGrammar(fExternalNoNamespaceSchemaLocation, XMLUni::fgZeroLenString, true); + } + + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + if (attCount) { + scanRawAttrListforNameSpaces(attCount); + } + + // Also find any default or fixed xmlns attributes in DTD defined for + // this element. + XMLElementDecl* elemDecl = 0; + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + + if (fGrammarType == Grammar::DTDGrammarType) { + + if (!fSkipDTDValidation) { + elemDecl = fGrammar->getElemDecl( + fEmptyNamespaceId, 0, qnameRawBuf, Grammar::TOP_LEVEL_SCOPE + ); + + if (elemDecl) { + if (elemDecl->hasAttDefs()) { + XMLAttDefList& attDefList = elemDecl->getAttDefList(); + for(XMLSize_t i=0; igetByKey(qnameRawBuf); + } + } + + // Resolve the qualified name to a URI and name so that we can look up + // the element decl for this element. We have now update the prefix to + // namespace map so we should get the correct element now. + unsigned int uriId = resolveQNameWithColon( + qnameRawBuf, fPrefixBuf, ElemStack::Mode_Element, prefixColonPos + ); + + //if schema, check if we should lax or skip the validation of this element + bool parentValidation = fValidate; + if (cv) { + QName element(fPrefixBuf.getRawBuffer(), &qnameRawBuf[prefixColonPos + 1], uriId, fMemoryManager); + // elementDepth will be > 0, as cv is only constructed if element is not + // root. + laxThisOne = laxElementValidation(&element, cv, cm, elemDepth - 1); + } + + // Look up the element now in the grammar. This will get us back a + // generic element decl object. We tell him to fault one in if he does + // not find it. + bool wasAdded = false; + const XMLCh* nameRawBuf = &qnameRawBuf[prefixColonPos + 1]; + + if (fDoSchema) { + + if (fGrammarType == Grammar::DTDGrammarType) { + if (!switchGrammar(getURIText(uriId))) { + fValidator->emitError( + XMLValid::GrammarNotFound, getURIText(uriId) + ); + } + } + + if (fGrammarType == Grammar::SchemaGrammarType) { + elemDecl = fGrammar->getElemDecl( + uriId, nameRawBuf, qnameRawBuf, currentScope + ); + + // if not found, then it may be a reference, try TOP_LEVEL_SCOPE + if (!elemDecl) { + bool checkTopLevel = (currentScope != Grammar::TOP_LEVEL_SCOPE); + const XMLCh* original_uriStr = fGrammar->getTargetNamespace(); + unsigned int orgGrammarUri = fURIStringPool->getId(original_uriStr); + + if (orgGrammarUri != uriId) { + if (switchGrammar(getURIText(uriId))) { + checkTopLevel = true; + } + else { + // the laxElementValidation routine (called above) will + // set fValidate to false for a "skipped" element + if (!laxThisOne && fValidate) { + fValidator->emitError( + XMLValid::GrammarNotFound, getURIText(uriId) + ); + } + checkTopLevel = false; + } + } + + if (checkTopLevel) { + elemDecl = fGrammar->getElemDecl( + uriId, nameRawBuf, qnameRawBuf, Grammar::TOP_LEVEL_SCOPE + ); + } + + if (!elemDecl && currentScope != Grammar::TOP_LEVEL_SCOPE) { + + if (orgGrammarUri == uriId) { + // still not found in specified uri + // try emptyNamespace see if element should be + // un-qualified. + // Use a temp variable until we decide this is the case + if (uriId != fEmptyNamespaceId) { + XMLElementDecl* tempElemDecl = fGrammar->getElemDecl( + fEmptyNamespaceId, nameRawBuf, qnameRawBuf, currentScope + ); + + if (tempElemDecl && tempElemDecl->getCreateReason() != XMLElementDecl::JustFaultIn && fValidate) { + fValidator->emitError( + XMLValid::ElementNotUnQualified, qnameRawBuf + ); + elemDecl = tempElemDecl; + } + } + } + // still Not found in specified uri + // go to original Grammar again to see if element needs + // to be fully qualified. + // Use a temp variable until we decide this is the case + else if (uriId == fEmptyNamespaceId) { + + if (switchGrammar(original_uriStr)) { + XMLElementDecl* tempElemDecl = fGrammar->getElemDecl( + orgGrammarUri, nameRawBuf, qnameRawBuf, currentScope + ); + if (tempElemDecl && tempElemDecl->getCreateReason() != XMLElementDecl::JustFaultIn && fValidate) { + fValidator->emitError( + XMLValid::ElementNotQualified, qnameRawBuf + ); + elemDecl = tempElemDecl; + } + } + else if (!laxThisOne && fValidate) { + fValidator->emitError( + XMLValid::GrammarNotFound,original_uriStr + ); + } + } + } + + if (!elemDecl) { + // still not found + // switch back to original grammar first if necessary + if (orgGrammarUri != uriId) { + switchGrammar(original_uriStr); + } + + // look in the list of undeclared elements, as would have been + // done before we made grammars stateless: + elemDecl = fSchemaElemNonDeclPool->getByKey( + nameRawBuf, uriId, (int)Grammar::TOP_LEVEL_SCOPE + ); + } + } + } + } + + if (!elemDecl) { + + if (fGrammarType == Grammar::DTDGrammarType) { + elemDecl = new (fMemoryManager) DTDElementDecl( + qnameRawBuf, uriId, DTDElementDecl::Any, fMemoryManager + ); + elemDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)elemDecl)); + } + else if (fGrammarType == Grammar::SchemaGrammarType) { + elemDecl = new (fMemoryManager) SchemaElementDecl( + fPrefixBuf.getRawBuffer(), nameRawBuf, uriId + , SchemaElementDecl::Any, Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + elemDecl->setId( + fSchemaElemNonDeclPool->put((void*)elemDecl->getBaseName() + , uriId, (int)Grammar::TOP_LEVEL_SCOPE, (SchemaElementDecl*)elemDecl) + ); + } + wasAdded = true; + } + + // this info needed for DOMTypeInfo + fPSVIElemContext.fErrorOccurred = false; + + // We do something different here according to whether we found the + // element or not. + bool bXsiTypeSet= (fValidator && fGrammarType == Grammar::SchemaGrammarType)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false; + if (wasAdded) + { + if (laxThisOne && !bXsiTypeSet) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + else if (fValidate) + { + // If validating then emit an error + + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the grammar pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + // xsi:type was specified, don't complain about missing definition + if(!bXsiTypeSet) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + + if(fGrammarType == Grammar::SchemaGrammarType) + { + fPSVIElemContext.fErrorOccurred = true; + } + } + } + } + else + { + // If its not marked declared and validating, then emit an error + if (!elemDecl->isDeclared()) { + if(elemDecl->getCreateReason() == XMLElementDecl::NoReason) { + if(!bXsiTypeSet && fGrammarType == Grammar::SchemaGrammarType) { + fPSVIElemContext.fErrorOccurred = true; + } + } + + if (laxThisOne) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + else if (fValidate && !bXsiTypeSet) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + } + } + } + + // Now we can update the element stack to set the current element + // decl. We expanded the stack above, but couldn't store the element + // decl because we didn't know it yet. + fElemStack.setElement(elemDecl, fReaderMgr.getCurrentReaderNum()); + fElemStack.setCurrentURI(uriId); + + if (isRoot) + { + fRootGrammar = fGrammar; + if (fGrammarType == Grammar::SchemaGrammarType && !fRootElemName) + fRootElemName = XMLString::replicate(qnameRawBuf, fMemoryManager); + } + + if (fGrammarType == Grammar::SchemaGrammarType && fPSVIHandler) + { + + fPSVIElemContext.fElemDepth++; + if (elemDecl->isDeclared()) + { + fPSVIElemContext.fNoneValidationDepth = fPSVIElemContext.fElemDepth; + } + else + { + fPSVIElemContext.fFullValidationDepth = fPSVIElemContext.fElemDepth; + + /****** + * While we report an error for historical reasons, this should + * actually result in lax assessment - NG. + if (isRoot && fValidate) + fPSVIElemContext.fErrorOccurred = true; + *****/ + } + } + + // Validate the element + if (fValidate) + { + fValidator->validateElement(elemDecl); + if (fValidator->handlesSchema()) + { + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + fPSVIElemContext.fErrorOccurred = true; + } + } + + if (fGrammarType == Grammar::SchemaGrammarType) { + + // squirrel away the element's QName, so that we can do an efficient + // end-tag match + fElemStack.setCurrentSchemaElemName(fQNameBuf.getRawBuffer()); + + ComplexTypeInfo* typeinfo = (fValidate) + ? ((SchemaValidator*)fValidator)->getCurrentTypeInfo() + : ((SchemaElementDecl*) elemDecl)->getComplexTypeInfo(); + + if (typeinfo) { + currentScope = typeinfo->getScopeDefined(); + + // switch grammar if the typeinfo has a different grammar (happens when there is xsi:type) + XMLCh* typeName = typeinfo->getTypeName(); + const int comma = XMLString::indexOf(typeName, chComma); + if (comma > 0) { + XMLBuffer prefixBuf(comma+1, fMemoryManager); + prefixBuf.append(typeName, comma); + const XMLCh* uriStr = prefixBuf.getRawBuffer(); + + bool errorCondition = !switchGrammar(uriStr) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + , prefixBuf.getRawBuffer() + ); + } + } + else if (comma == 0) { + bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + , XMLUni::fgZeroLenString + ); + } + } + } + fElemStack.setCurrentScope(currentScope); + + // Set element next state + if (elemDepth >= fElemStateSize) { + resizeElemState(); + } + + fElemState[elemDepth] = 0; + fElemLoopState[elemDepth] = 0; + } + + fElemStack.setCurrentGrammar(fGrammar); + + // If this is the first element and we are validating, check the root + // element. + if (isRoot) + { + if (fValidate) + { + // If a DocType exists, then check if it matches the root name there. + if (fRootElemName && !XMLString::equals(qnameRawBuf, fRootElemName)) + fValidator->emitError(XMLValid::RootElemNotLikeDocType); + } + } + else if (parentValidation) + { + // If the element stack is not empty, then add this element as a + // child of the previous top element. If its empty, this is the root + // elem and is not the child of anything. + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // PSVI handling: even if it turns out there are + // no attributes, we need to reset this list... + if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType ) + fPSVIAttrList->reset(); + + // Now lets get the fAttrList filled in. This involves faulting in any + // defaulted and fixed attributes and normalizing the values of any that + // we got explicitly. + // + // We update the attCount value with the total number of attributes, but + // it goes in with the number of values we got during the raw scan of + // explictly provided attrs above. + attCount = buildAttList(*fRawAttrList, attCount, elemDecl, *fAttrList); + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // activate identity constraints + if (fGrammar && + fGrammarType == Grammar::SchemaGrammarType && + toCheckIdentityConstraint()) + { + fICHandler->activateIdentityConstraint + ( + (SchemaElementDecl*) elemDecl + , (int) elemDepth + , uriId + , fPrefixBuf.getRawBuffer() + , *fAttrList + , attCount + , fValidationContext + ); + } + + // Since the element may have default values, call start tag now regardless if it is empty or not + // If we have a document handler, then tell it about this start tag + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , uriId + , fPrefixBuf.getRawBuffer() + , *fAttrList + , attCount + , false + , isRoot + ); + } + + // if we have a PSVIHandler, now's the time to call + // its handleAttributesPSVI method: + if(fPSVIHandler && fGrammarType == Grammar::SchemaGrammarType) + { + QName *eName = elemDecl->getElementName(); + fPSVIHandler->handleAttributesPSVI + ( + eName->getLocalPart() + , fURIStringPool->getValueForId(eName->getURI()) + , fPSVIAttrList + ); + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // reset current type info + DatatypeValidator* psviMemberType = 0; + if (fGrammarType == Grammar::SchemaGrammarType) + { + if (fValidate && elemDecl->isDeclared()) + { + fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + if(!fPSVIElemContext.fCurrentTypeInfo) + fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + else + fPSVIElemContext.fCurrentDV = 0; + if(fPSVIHandler) + { + fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue(); + + if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString)) + fPSVIElemContext.fNormalizedValue = 0; + } + } + else + { + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; + } + } + + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , elemDecl->getFullName() + , elemDecl->getFormattedContentModel() + ); + } + + if (fGrammarType == Grammar::SchemaGrammarType) { + + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + { + fPSVIElemContext.fErrorOccurred = true; + } + else + { + if (fPSVIHandler) + { + fPSVIElemContext.fIsSpecified = ((SchemaValidator*) fValidator)->getIsElemSpecified(); + if(fPSVIElemContext.fIsSpecified) + fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl *)elemDecl)->getDefaultValue(); + } + // note that if we're empty, won't be a current DV + if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union) + psviMemberType = fValidationContext->getValidatingMemberType(); + } + + // call matchers and de-activate context + if (toCheckIdentityConstraint()) + { + fICHandler->deactivateContext + ( + (SchemaElementDecl *) elemDecl + , fContent.getRawBuffer() + , fValidationContext + , fPSVIElemContext.fCurrentDV + ); + } + + } + } + else if (fGrammarType == Grammar::SchemaGrammarType) { + ((SchemaValidator*)fValidator)->resetNillable(); + } + + if (fGrammarType == Grammar::SchemaGrammarType) + { + if (fPSVIHandler) + { + endElementPSVI((SchemaElementDecl*)elemDecl, psviMemberType); + } + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + fDocHandler->endElement + ( + *elemDecl + , uriId + , isRoot + , fPrefixBuf.getRawBuffer() + ); + } + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + else + { + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + if (fGrammarType == Grammar::SchemaGrammarType && !fValidator->handlesSchema()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + else { + fValidator = fSchemaValidator; + } + } + else if (fGrammarType == Grammar::DTDGrammarType && !fValidator->handlesDTD()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + else { + fValidator = fDTDValidator; + } + } + + fValidator->setGrammar(fGrammar); + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } + } + else if (fGrammarType == Grammar::SchemaGrammarType) + { + // send a partial element psvi + if (fPSVIHandler) + { + + ComplexTypeInfo* curTypeInfo = 0; + DatatypeValidator* curDV = 0; + XSTypeDefinition* typeDef = 0; + + if (fValidate && elemDecl->isDeclared()) + { + curTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + + if (curTypeInfo) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(curTypeInfo); + } + else + { + curDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + + if (curDV) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(curDV); + } + } + } + + fPSVIElement->reset + ( + PSVIElement::VALIDITY_NOTKNOWN + , PSVIElement::VALIDATION_NONE + , fRootElemName + , ((SchemaValidator*) fValidator)->getIsElemSpecified() + , (elemDecl->isDeclared()) ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0 + , typeDef + , 0 //memberType + , fModel + , ((SchemaElementDecl*)elemDecl)->getDefaultValue() + , 0 + , 0 + , 0 + ); + + + fPSVIHandler->handlePartialElementPSVI + ( + elemDecl->getBaseName() + , fURIStringPool->getValueForId(elemDecl->getURI()) + , fPSVIElement + ); + + } + + // not empty + fErrorStack->push(fPSVIElemContext.fErrorOccurred); + } + + return true; +} + + +// --------------------------------------------------------------------------- +// IGXMLScanner: Helper methos +// --------------------------------------------------------------------------- +void IGXMLScanner::resizeElemState() { + + unsigned int newSize = fElemStateSize * 2; + unsigned int* newElemState = (unsigned int*) fMemoryManager->allocate + ( + newSize * sizeof(unsigned int) + ); //new unsigned int[newSize]; + unsigned int* newElemLoopState = (unsigned int*) fMemoryManager->allocate + ( + newSize * sizeof(unsigned int) + ); //new unsigned int[newSize]; + + // Copy the existing values + unsigned int index = 0; + for (; index < fElemStateSize; index++) + { + newElemState[index] = fElemState[index]; + newElemLoopState[index] = fElemLoopState[index]; + } + + for (; index < newSize; index++) + newElemLoopState[index] = newElemState[index] = 0; + + // Delete the old array and udpate our members + fMemoryManager->deallocate(fElemState); //delete [] fElemState; + fMemoryManager->deallocate(fElemLoopState); //delete [] fElemState; + fElemState = newElemState; + fElemLoopState = newElemLoopState; + fElemStateSize = newSize; +} + +void IGXMLScanner::resizeRawAttrColonList() { + + unsigned int newSize = fRawAttrColonListSize * 2; + int* newRawAttrColonList = (int*) fMemoryManager->allocate + ( + newSize * sizeof(int) + ); //new int[newSize]; + + // Copy the existing values + unsigned int index = 0; + for (; index < fRawAttrColonListSize; index++) + newRawAttrColonList[index] = fRawAttrColonList[index]; + + // Delete the old array and udpate our members + fMemoryManager->deallocate(fRawAttrColonList); //delete [] fRawAttrColonList; + fRawAttrColonList = newRawAttrColonList; + fRawAttrColonListSize = newSize; +} + +// --------------------------------------------------------------------------- +// IGXMLScanner: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* IGXMLScanner::loadGrammar(const InputSource& src + , const short grammarType + , const bool toCache) +{ + Grammar* loadedGrammar = 0; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + fGrammarResolver->cacheGrammarFromParse(false); + // if the new grammar has to be cached, better use the already cached + // grammars, or the an exception will be thrown when caching an already + // cached grammar + fGrammarResolver->useCachedGrammarInParse(toCache); + fRootGrammar = 0; + + if (fValScheme == Val_Auto) { + fValidate = true; + } + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fSeeXsi = false; + + if (grammarType == Grammar::SchemaGrammarType) { + loadedGrammar = loadXMLSchemaGrammar(src, toCache); + } + else if (grammarType == Grammar::DTDGrammarType) { + loadedGrammar = loadDTDGrammar(src, toCache); + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + return loadedGrammar; +} + +void IGXMLScanner::resetCachedGrammar () +{ + fCachedSchemaInfoList->removeAll (); +} + +Grammar* IGXMLScanner::loadDTDGrammar(const InputSource& src, + const bool toCache) +{ + // Reset the validators + fDTDValidator->reset(); + if (fValidatorFromUser) + fValidator->reset(); + + if (!fValidator->handlesDTD()) { + if (fValidatorFromUser && fValidate) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + else { + fValidator = fDTDValidator; + } + } + + fDTDGrammar = (DTDGrammar*) fGrammarResolver->getGrammar(XMLUni::fgDTDEntityString); + + if (fDTDGrammar) { + fDTDGrammar->reset(); + } + else { + fDTDGrammar = new (fGrammarPoolMemoryManager) DTDGrammar(fGrammarPoolMemoryManager); + fGrammarResolver->putGrammar(fDTDGrammar); + } + + fGrammar = fDTDGrammar; + fGrammarType = fGrammar->getGrammarType(); + fValidator->setGrammar(fGrammar); + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + // and clear out the darned undeclared DTD element pool... + fDTDElemNonDeclPool->removeAll(); + + if (toCache) { + + unsigned int sysId = fGrammarResolver->getStringPool()->addOrFind(src.getSystemId()); + const XMLCh* sysIdStr = fGrammarResolver->getStringPool()->getValueForId(sysId); + + fGrammarResolver->orphanGrammar(XMLUni::fgDTDEntityString); + ((XMLDTDDescription*) (fGrammar->getGrammarDescription()))->setSystemId(sysIdStr); + fGrammarResolver->putGrammar(fGrammar); + } + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // In order to make the processing work consistently, we have to + // make this look like an external entity. So create an entity + // decl and fill it in and push it with the reader, as happens + // with an external entity. Put a janitor on it to insure it gets + // cleaned up. The reader manager does not adopt them. + const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull }; + DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager); + declDTD->setSystemId(src.getSystemId()); + declDTD->setIsExternal(true); + Janitor janDecl(declDTD); + + // Mark this one as a throw at end + newReader->setThrowAtEnd(true); + + // And push it onto the stack, with its pseudo name + fReaderMgr.pushReader(newReader, declDTD); + + // If we have a doc type handler and advanced callbacks are enabled, + // call the doctype event. + if (fDocTypeHandler) { + + // Create a dummy root + DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + gDTDStr + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + rootDecl->setCreateReason(DTDElementDecl::AsRootElem); + rootDecl->setExternalElemDeclaration(true); + Janitor janSrc(rootDecl); + + fDocTypeHandler->doctypeDecl(*rootDecl, src.getPublicId(), src.getSystemId(), false, true); + } + + // Create DTDScanner + DTDScanner dtdScanner + ( + (DTDGrammar*) fGrammar + , fDocTypeHandler + , fGrammarPoolMemoryManager + , fMemoryManager + ); + dtdScanner.setScannerInfo(this, &fReaderMgr, &fBufMgr); + + // Tell it its not in an include section + dtdScanner.scanExtSubsetDecl(false, true); + + if (fValidate) { + // validate the DTD scan so far + fValidator->preContentValidation(false, true); + } + + if (toCache) + fGrammarResolver->cacheGrammars(); + + return fDTDGrammar; +} + +// --------------------------------------------------------------------------- +// IGXMLScanner: Helper methods +// --------------------------------------------------------------------------- +void IGXMLScanner::processSchemaLocation(XMLCh* const schemaLoc) +{ + XMLCh* locStr = schemaLoc; + XMLReader* curReader = fReaderMgr.getCurrentReader(); + + fLocationPairs->removeAllElements(); + while (*locStr) + { + do { + // Do we have an escaped character ? + if (*locStr == 0xFFFF) + continue; + + if (!curReader->isWhitespace(*locStr)) + break; + + *locStr = chNull; + } while (*++locStr); + + if (*locStr) { + + fLocationPairs->addElement(locStr); + + while (*++locStr) { + // Do we have an escaped character ? + if (*locStr == 0xFFFF) + continue; + if (curReader->isWhitespace(*locStr)) + break; + } + } + } +} + +void IGXMLScanner::endElementPSVI(SchemaElementDecl* const elemDecl, + DatatypeValidator* const memberDV) +{ + PSVIElement::ASSESSMENT_TYPE validationAttempted; + PSVIElement::VALIDITY_STATE validity = PSVIElement::VALIDITY_NOTKNOWN; + + if (fPSVIElemContext.fElemDepth > fPSVIElemContext.fFullValidationDepth) + validationAttempted = PSVIElement::VALIDATION_FULL; + else if (fPSVIElemContext.fElemDepth > fPSVIElemContext.fNoneValidationDepth) + validationAttempted = PSVIElement::VALIDATION_NONE; + else + { + validationAttempted = PSVIElement::VALIDATION_PARTIAL; + fPSVIElemContext.fFullValidationDepth = + fPSVIElemContext.fNoneValidationDepth = fPSVIElemContext.fElemDepth - 1; + } + + if (fValidate && elemDecl->isDeclared()) + { + validity = (fPSVIElemContext.fErrorOccurred) + ? PSVIElement::VALIDITY_INVALID : PSVIElement::VALIDITY_VALID; + } + + XSTypeDefinition* typeDef = 0; + bool isMixed = false; + if (fPSVIElemContext.fCurrentTypeInfo) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentTypeInfo); + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes)fPSVIElemContext.fCurrentTypeInfo->getContentType(); + isMixed = (modelType == SchemaElementDecl::Mixed_Simple + || modelType == SchemaElementDecl::Mixed_Complex); + } + else if (fPSVIElemContext.fCurrentDV) + typeDef = (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentDV); + + XMLCh* canonicalValue = 0; + if (fPSVIElemContext.fNormalizedValue && !isMixed && + validity == PSVIElement::VALIDITY_VALID) + { + if (memberDV) + canonicalValue = (XMLCh*) memberDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager); + else if (fPSVIElemContext.fCurrentDV) + canonicalValue = (XMLCh*) fPSVIElemContext.fCurrentDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager); + } + + fPSVIElement->reset + ( + validity + , validationAttempted + , fRootElemName + , fPSVIElemContext.fIsSpecified + , (elemDecl->isDeclared()) + ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0 + , typeDef + , (memberDV) ? (XSSimpleTypeDefinition*) fModel->getXSObject(memberDV) : 0 + , fModel + , elemDecl->getDefaultValue() + , fPSVIElemContext.fNormalizedValue + , canonicalValue + ); + + fPSVIHandler->handleElementPSVI + ( + elemDecl->getBaseName() + , fURIStringPool->getValueForId(elemDecl->getURI()) + , fPSVIElement + ); + + // decrease element depth + fPSVIElemContext.fElemDepth--; + +} + +void IGXMLScanner::resetPSVIElemContext() +{ + fPSVIElemContext.fIsSpecified = false; + fPSVIElemContext.fErrorOccurred = false; + fPSVIElemContext.fElemDepth = -1; + fPSVIElemContext.fFullValidationDepth = -1; + fPSVIElemContext.fNoneValidationDepth = -1; + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/IGXMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/IGXMLScanner.hpp new file mode 100644 index 000000000..5123f98a6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/IGXMLScanner.hpp @@ -0,0 +1,308 @@ +/* + * 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: IGXMLScanner.hpp 882548 2009-11-20 13:44:14Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IGXMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_IGXMLSCANNER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DTDElementDecl; +class DTDGrammar; +class DTDValidator; +class SchemaValidator; +class IdentityConstraintHandler; +class IdentityConstraint; +class ContentLeafNameTypeVector; +class SchemaAttDef; +class XMLContentModel; +class XSModel; +class PSVIAttributeList; +class PSVIElement; + +// This is an integrated scanner class, which does DTD/XML Schema grammar +// processing. +class XMLPARSER_EXPORT IGXMLScanner : public XMLScanner +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + IGXMLScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + IGXMLScanner + ( + XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~IGXMLScanner(); + + // ----------------------------------------------------------------------- + // XMLScanner public virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const; + virtual NameIdPool* getEntityDeclPool(); + virtual const NameIdPool* getEntityDeclPool() const; + virtual void scanDocument + ( + const InputSource& src + ); + virtual bool scanNext(XMLPScanToken& toFill); + virtual Grammar* loadGrammar + ( + const InputSource& src + , const short grammarType + , const bool toCache = false + ); + + virtual void resetCachedGrammar (); + virtual Grammar::GrammarType getCurrentGrammarType() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IGXMLScanner(); + IGXMLScanner(const IGXMLScanner&); + IGXMLScanner& operator=(const IGXMLScanner&); + + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanCDSection(); + virtual void scanCharData(XMLBuffer& toToUse); + virtual EntityExpRes scanEntityRef + ( + const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped + ); + virtual void scanDocTypeDecl(); + virtual void scanReset(const InputSource& src); + virtual void sendCharData(XMLBuffer& toSend); + virtual InputSource* resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void commonInit(); + void cleanUp(); + + XMLSize_t buildAttList + ( + const RefVectorOf& providedAttrs + , const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill + ); + bool normalizeAttValue + ( + const XMLAttDef* const attDef + , const XMLCh* const name + , const XMLCh* const value + , XMLBuffer& toFill + ); + bool normalizeAttRawValue + ( + const XMLCh* const attrName + , const XMLCh* const value + , XMLBuffer& toFill + ); + void updateNSMap + ( + const XMLCh* const attrName + , const XMLCh* const attrValue + ); + void updateNSMap + ( + const XMLCh* const attrName + , const XMLCh* const attrValue + , const int colonPosition + ); + void scanRawAttrListforNameSpaces(XMLSize_t attCount); + void parseSchemaLocation(const XMLCh* const schemaLocationStr, bool ignoreLoadSchema = false); + void resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri, bool ignoreLoadSchema = false); + bool switchGrammar(const XMLCh* const newGrammarNameSpace); + bool laxElementValidation(QName* element, ContentLeafNameTypeVector* cv, + const XMLContentModel* const cm, + const XMLSize_t parentElemDepth); + bool anyAttributeValidation(SchemaAttDef* attWildCard, + unsigned int uriId, + bool& skipThisOne, + bool& laxThisOne); + void resizeElemState(); + void processSchemaLocation(XMLCh* const schemaLoc); + + void resizeRawAttrColonList(); + + // ----------------------------------------------------------------------- + // Private scanning methods + // ----------------------------------------------------------------------- + bool basicAttrValueScan + ( + const XMLCh* const attrName + , XMLBuffer& toFill + ); + XMLSize_t rawAttrScan + ( + const XMLCh* const elemName + , RefVectorOf& toFill + , bool& isEmpty + ); + bool scanAttValue + ( + const XMLAttDef* const attDef + , const XMLCh* const attrName + , XMLBuffer& toFill + ); + bool scanContent(); + void scanEndTag(bool& gotData); + bool scanStartTag(bool& gotData); + bool scanStartTagNS(bool& gotData); + + // ----------------------------------------------------------------------- + // IdentityConstraints Activation methods + // ----------------------------------------------------------------------- + inline bool toCheckIdentityConstraint() const; + + // ----------------------------------------------------------------------- + // Grammar preparsing methods + // ----------------------------------------------------------------------- + Grammar* loadXMLSchemaGrammar(const InputSource& src, const bool toCache = false); + Grammar* loadDTDGrammar(const InputSource& src, const bool toCache = false); + + // ----------------------------------------------------------------------- + // PSVI handling methods + // ----------------------------------------------------------------------- + void endElementPSVI(SchemaElementDecl* const elemDecl, + DatatypeValidator* const memberDV); + void resetPSVIElemContext(); + + // ----------------------------------------------------------------------- + // Data members + // + // fRawAttrList + // During the initial scan of the attributes we can only do a raw + // scan for key/value pairs. So this vector is used to store them + // until they can be processed (and put into fAttrList.) + // + // fDTDValidator + // The DTD validator instance. + // + // fSchemaValidator + // The Schema validator instance. + // + // fSeeXsi + // This flag indicates a schema has been seen. + // + // fElemState + // fElemLoopState + // fElemStateSize + // Stores an element next state from DFA content model - used for + // wildcard validation + // + // fDTDElemNonDeclPool + // registry of "faulted-in" DTD element decls + // fSchemaElemNonDeclPool + // registry for elements without decls in the grammar + // fElemCount + // count of the number of start tags seen so far (starts at 1). + // Used for duplicate attribute detection/processing of required/defaulted attributes + // fAttDefRegistry + // mapping from XMLAttDef instances to the count of the last + // start tag where they were utilized. + // fUndeclaredAttrRegistry + // set of attr QNames to detect duplicates + // fPSVIAttrList + // PSVI attribute list implementation that needs to be + // filled when a PSVIHandler is registered + // fSchemaInfoList + // Transient schema info list that is passed to TraverseSchema instances. + // fCachedSchemaInfoList + // Cached Schema info list that is passed to TraverseSchema instances. + // + // ----------------------------------------------------------------------- + bool fSeeXsi; + Grammar::GrammarType fGrammarType; + unsigned int fElemStateSize; + unsigned int* fElemState; + unsigned int* fElemLoopState; + XMLBuffer fContent; + RefVectorOf* fRawAttrList; + unsigned int fRawAttrColonListSize; + int* fRawAttrColonList; + DTDValidator* fDTDValidator; + SchemaValidator* fSchemaValidator; + DTDGrammar* fDTDGrammar; + IdentityConstraintHandler* fICHandler; + ValueVectorOf* fLocationPairs; + NameIdPool* fDTDElemNonDeclPool; + RefHash3KeysIdPool* fSchemaElemNonDeclPool; + unsigned int fElemCount; + RefHashTableOf*fAttDefRegistry; + Hash2KeysSetOf* fUndeclaredAttrRegistry; + PSVIAttributeList * fPSVIAttrList; + XSModel* fModel; + PSVIElement* fPSVIElement; + ValueStackOf* fErrorStack; + PSVIElemContext fPSVIElemContext; + RefHash2KeysTableOf* fSchemaInfoList; + RefHash2KeysTableOf* fCachedSchemaInfoList; +}; + +inline const XMLCh* IGXMLScanner::getName() const +{ + return XMLUni::fgIGXMLScanner; +} + +inline bool IGXMLScanner::toCheckIdentityConstraint() const +{ + return fValidate && fIdentityConstraintChecking && fICHandler; +} + +inline Grammar::GrammarType IGXMLScanner::getCurrentGrammarType() const +{ + return fGrammarType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/IGXMLScanner2.cpp b/project/jni/xerces/src/xercesc/internal/IGXMLScanner2.cpp new file mode 100644 index 000000000..3ae34397c --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/IGXMLScanner2.cpp @@ -0,0 +1,3454 @@ +/* + * 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: IGXMLScanner2.cpp 925236 2010-03-19 14:29:47Z borisk $ + */ + +// --------------------------------------------------------------------------- +// This file holds some of the grunt work methods of IGXMLScanner.cpp to keep +// it a little more readable. +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +inline XMLAttDefList& getAttDefList(bool isSchemaGrammar + , ComplexTypeInfo* currType + , XMLElementDecl* elemDecl); + +// --------------------------------------------------------------------------- +// IGXMLScanner: Private helper methods +// --------------------------------------------------------------------------- + +// This method is called from scanStartTagNS() to build up the list of +// XMLAttr objects that will be passed out in the start tag callout. We +// get the key/value pairs from the raw scan of explicitly provided attrs, +// which have not been normalized. And we get the element declaration from +// which we will get any defaulted or fixed attribute defs and add those +// in as well. +XMLSize_t +IGXMLScanner::buildAttList(const RefVectorOf& providedAttrs + , const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill) +{ + // If doing DTD's, Ask the element to clear the 'provided' flag on all of the att defs + // that it owns, and to return us a boolean indicating whether it has + // any defs. If schemas are being validated, the complexType + // at the top of the SchemaValidator's stack will + // know what's best. REVISIT: don't modify grammar at all; eliminate + // this step... + ComplexTypeInfo *currType = 0; + DatatypeValidator *currDV = 0; + if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType && fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (!currType) { + currDV = ((SchemaValidator*)fValidator)->getCurrentDatatypeValidator(); + } + } + + const bool hasDefs = (currType && fValidate) + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); + + // another set of attributes; increment element counter + fElemCount++; + + // If there are no expliclitily provided attributes and there are no + // defined attributes for the element, the we don't have anything to do. + // So just return zero in this case. + if (!hasDefs && !attCount) + return 0; + + // Keep up with how many attrs we end up with total + XMLSize_t retCount = 0; + + // And get the current size of the output vector. This lets us use + // existing elements until we fill it, then start adding new ones. + const XMLSize_t curAttListSize = toFill.size(); + + // We need a buffer into which raw scanned attribute values will be + // normalized. + XMLBufBid bbNormal(&fBufMgr); + XMLBuffer& normBuf = bbNormal.getBuffer(); + + // + // Decide if to use hash table to do duplicate checking + // + bool toUseHashTable = false; + if (fGrammarType == Grammar::DTDGrammarType) + { + setAttrDupChkRegistry(attCount, toUseHashTable); + } + + XMLBufBid bbPrefix(&fBufMgr); + XMLBuffer& prefixBuf = bbPrefix.getBuffer(); + + // Loop through our explicitly provided attributes, which are in the raw + // scanned form, and build up XMLAttr objects. + XMLSize_t index; + const XMLCh* prefPtr, *suffPtr; + for (index = 0; index < attCount; index++) + { + PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID; + PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL; + const KVStringPair* curPair = providedAttrs.elementAt(index); + + // We have to split the name into its prefix and name parts. Then + // we map the prefix to its URI. + const XMLCh* const namePtr = curPair->getKey(); + + const int colonInd = fRawAttrColonList[index]; + unsigned int uriId; + if (colonInd != -1) + { + prefixBuf.set(namePtr, colonInd); + prefPtr = prefixBuf.getRawBuffer(); + suffPtr = namePtr + colonInd + 1; + // Map the prefix to a URI id + uriId = resolvePrefix(prefPtr, ElemStack::Mode_Attribute); + } + else + { + // No colon, so we just have a name with no prefix + prefPtr = XMLUni::fgZeroLenString; + suffPtr = namePtr; + // an empty prefix is always the empty namespace, when dealing with attributes + uriId = fEmptyNamespaceId; + } + + // If the uri comes back as the xmlns or xml URI or its just a name + // and that name is 'xmlns', then we handle it specially. So set a + // boolean flag that lets us quickly below know which we are dealing + // with. + const bool isNSAttr = (uriId == fEmptyNamespaceId)? + XMLString::equals(suffPtr, XMLUni::fgXMLNSString) : + (uriId == fXMLNSNamespaceId || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI)); + + + // If its not a special case namespace attr of some sort, then we + // do normal checking and processing. + XMLAttDef::AttTypes attType = XMLAttDef::CData; + DatatypeValidator *attrValidator = 0; + PSVIAttribute *psviAttr = 0; + bool otherXSI = false; + + if (isNSAttr && fGrammarType == Grammar::SchemaGrammarType) + { + if(!fUndeclaredAttrRegistry->putIfNotPresent(suffPtr, uriId)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + else + { + bool ValueValidate = false; + bool tokenizeBuffer = false; + + if (uriId == fXMLNSNamespaceId) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + } + else if (XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI)) + { + if (XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_BOOLEAN); + + ValueValidate = true; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_SCHEMALOCATION)) + { + // use anyURI as the validator + // tokenize the data and use the anyURI data for each piece + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + //We should validate each value in the schema location however + //this lead to a performance degradation of around 4%. Since + //the first value of each pair needs to match what is in the + //schema document and the second value needs to be valid in + //order to open the document we won't validate it. Need to + //do performance analysis of the anyuri datatype. + //ValueValidate = true; + ValueValidate = false; + tokenizeBuffer = true; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCATION)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + //We should validate this value however + //this lead to a performance degradation of around 4%. Since + //the value needs to be valid in + //order to open the document we won't validate it. Need to + //do performance analysis of the anyuri datatype. + //ValueValidate = true; + ValueValidate = false; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_QNAME); + + ValueValidate = true; + } + else { + otherXSI = true; + } + } + + if (!otherXSI) { + normalizeAttRawValue + ( + namePtr + , curPair->getValue() + , normBuf + ); + + if (fValidate && attrValidator && ValueValidate) + { + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(attrValidator, normBuf.getRawBuffer(), normBuf, true); + + ValidationContext* const theContext = + getValidationContext(); + + if (theContext) + { + try + { + if (tokenizeBuffer) { + XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager); + while (tokenizer.hasMoreTokens()) { + attrValidator->validate( + tokenizer.nextToken(), + theContext, + fMemoryManager); + } + } + else { + attrValidator->validate( + normBuf.getRawBuffer(), + theContext, + fMemoryManager); + } + } + catch (const XMLException& idve) + { + fValidator->emitError (XMLValid::DatatypeError, idve.getCode(), idve.getMessage()); + } + } + } + + if(getPSVIHandler()) + { + psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); + XSSimpleTypeDefinition *validatingType = (attrValidator) + ? (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator) + : 0; + // no attribute declarations for these... + psviAttr->reset( + fRootElemName + , PSVIItem::VALIDITY_NOTKNOWN + , PSVIItem::VALIDATION_NONE + , validatingType + , 0 + , 0 + , false + , 0 + , attrValidator + ); + } + } + } + } + + if (!isNSAttr || fGrammarType == Grammar::DTDGrammarType || otherXSI) + { + // Some checking for attribute wild card first (for schema) + bool laxThisOne = false; + bool skipThisOne = false; + + XMLAttDef* attDefForWildCard = 0; + XMLAttDef* attDef = 0; + + if (fGrammarType == Grammar::SchemaGrammarType) { + + //retrieve the att def + SchemaAttDef* attWildCard = 0; + if (currType) { + attDef = currType->getAttDef(suffPtr, uriId); + attWildCard = currType->getAttWildCard(); + } + else if (!currDV) { // check explicitly-set wildcard + attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, uriId); + attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard(); + } + + // if not found or faulted in - check for a matching wildcard attribute + // if no matching wildcard attribute, check (un)qualifed cases and flag + // appropriate errors + if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) { + + if (attWildCard) { + //if schema, see if we should lax or skip the validation of this attribute + if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) { + + if(!skipThisOne) + { + SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId)); + if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) { + RefHashTableOf* attRegistry = sGrammar->getAttributeDeclRegistry(); + if (attRegistry) { + attDefForWildCard = attRegistry->get(suffPtr); + } + } + } + } + } + else if (currType) { + // not found, see if the attDef should be qualified or not + if (uriId == fEmptyNamespaceId) { + attDef = currType->getAttDef(suffPtr + , fURIStringPool->getId(fGrammar->getTargetNamespace())); + if (fValidate + && attDef + && attDef->getCreateReason() != XMLAttDef::JustFaultIn) { + // the attribute should be qualified + fValidator->emitError + ( + XMLValid::AttributeNotQualified + , attDef->getFullName() + ); + if(fGrammarType == Grammar::SchemaGrammarType) { + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + } + } + else { + attDef = currType->getAttDef(suffPtr + , fEmptyNamespaceId); + if (fValidate + && attDef + && attDef->getCreateReason() != XMLAttDef::JustFaultIn) { + // the attribute should be qualified + fValidator->emitError + ( + XMLValid::AttributeNotUnQualified + , attDef->getFullName() + ); + if(fGrammarType == Grammar::SchemaGrammarType) { + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + } + } + } + } + } + + // Find this attribute within the parent element. We pass both + // the uriID/name and the raw QName buffer, since we don't know + // how the derived validator and its elements store attributes. + else + { + if(fGrammarType == Grammar::DTDGrammarType) + attDef = ((DTDElementDecl *)elemDecl)->getAttDef ( namePtr); + } + + // now need to prepare for duplicate detection + if(attDef) + { + unsigned int *curCountPtr = fAttDefRegistry->get(attDef); + if(!curCountPtr) + { + curCountPtr = getNewUIntPtr(); + *curCountPtr = fElemCount; + fAttDefRegistry->put(attDef, curCountPtr); + } + else if(*curCountPtr < fElemCount) + *curCountPtr = fElemCount; + else + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , attDef->getFullName() + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + } + else + { + if(fGrammarType == Grammar::DTDGrammarType) + { + if(!fUndeclaredAttrRegistry->putIfNotPresent(namePtr, 0)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + } + } + else // schema grammar + { + if(!fUndeclaredAttrRegistry->putIfNotPresent(suffPtr, uriId)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + } + } + + if(fGrammarType == Grammar::SchemaGrammarType ) + { + // if we've found either an attDef or an attDefForWildCard, + // then we're doing full validation and it may still be valid. + if(!attDef && !attDefForWildCard) + { + if(!laxThisOne && !skipThisOne) + { + fPSVIElemContext.fErrorOccurred = true; + } + if(getPSVIHandler()) + { + if(!laxThisOne && !skipThisOne) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + else if(laxThisOne) + { + attrValid = PSVIItem::VALIDITY_NOTKNOWN; + attrAssessed = PSVIItem::VALIDATION_PARTIAL; + } + else + { + attrValid = PSVIItem::VALIDITY_NOTKNOWN; + attrAssessed = PSVIItem::VALIDATION_NONE; + } + } + } + } + + bool errorCondition = fValidate && !attDefForWildCard && !attDef; + if (errorCondition && !skipThisOne && !laxThisOne) + { + // + // Its not valid for this element, so issue an error if we are + // validating. + // + XMLBufBid bbMsg(&fBufMgr); + XMLBuffer& bufMsg = bbMsg.getBuffer(); + if (uriId != fEmptyNamespaceId) { + XMLBufBid bbURI(&fBufMgr); + XMLBuffer& bufURI = bbURI.getBuffer(); + + getURIText(uriId, bufURI); + + bufMsg.append(chOpenCurly); + bufMsg.append(bufURI.getRawBuffer()); + bufMsg.append(chCloseCurly); + } + bufMsg.append(suffPtr); + fValidator->emitError + ( + XMLValid::AttNotDefinedForElement + , bufMsg.getRawBuffer() + , elemDecl->getFullName() + ); + } + + // Now normalize the raw value since we have the attribute type. We + // don't care about the return status here. If it failed, an error + // was issued, which is all we care about. + if (attDefForWildCard) { + normalizeAttValue( + attDefForWildCard, namePtr, curPair->getValue(), normBuf + ); + + // If we found an attdef for this one, then lets validate it. + const XMLCh* xsNormalized = normBuf.getRawBuffer(); + DatatypeValidator* tempDV = ((SchemaAttDef*) attDefForWildCard)->getDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf, true); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + + if (fNormalizeData && fValidate) { + normBuf.set(xsNormalized); + } + } + + if (fValidate ) { + fValidator->validateAttrValue( + attDefForWildCard, xsNormalized, false, elemDecl + ); + attrValidator = ((SchemaValidator*)fValidator)->getMostRecentAttrValidator(); + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + fPSVIElemContext.fErrorOccurred = true; + if(getPSVIHandler()) + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + else { // no decl; default DOMTypeInfo to anySimpleType + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + + // Save the type for later use + attType = attDefForWildCard->getType(); + } + else { + normalizeAttValue( + attDef, namePtr, curPair->getValue(), normBuf + ); + + // If we found an attdef for this one, then lets validate it. + if (attDef) + { + const XMLCh* xsNormalized = normBuf.getRawBuffer(); + if (fGrammarType == Grammar::SchemaGrammarType) + { + DatatypeValidator* tempDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf, true); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + if (fNormalizeData && fValidate && !skipThisOne) { + normBuf.set(xsNormalized); + } + } + } + + if (fValidate && !skipThisOne) + { + fValidator->validateAttrValue( + attDef, xsNormalized, false, elemDecl + ); + + if(fGrammarType == Grammar::SchemaGrammarType) + { + attrValidator = ((SchemaValidator*)fValidator)->getMostRecentAttrValidator(); + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + } + else if(fGrammarType == Grammar::SchemaGrammarType) { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + } + else // no attDef at all; default to anySimpleType + { + if(fGrammarType == Grammar::SchemaGrammarType) { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + } + + // Save the type for later use + if (attDef) + { + attType = attDef->getType(); + } + } + + // now fill in the PSVIAttributes entry for this attribute: + if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType) + { + psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); + SchemaAttDef *actualAttDef = 0; + if(attDef) + actualAttDef = (SchemaAttDef *)attDef; + else if (attDefForWildCard) + actualAttDef = (SchemaAttDef *)attDefForWildCard; + if(actualAttDef) + { + XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); + DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); + XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); + if(attrValid != PSVIItem::VALIDITY_VALID) + { + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , validatingType + , 0 + , actualAttDef->getValue() + , false + , attrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *memberType = 0; + if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , validatingType + , memberType + , actualAttDef->getValue() + , false + , attrDecl + , (memberType)?attrValidator:attrDataType + ); + } + } + else + { + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , 0 + , 0 + , 0 + , false + , 0 + , 0 + ); + } + } + } + + // Add this attribute to the attribute list that we use to pass them + // to the handler. We reuse its existing elements but expand it as + // required. + XMLAttr* curAttr; + + // check for duplicate namespace attributes: + // by checking for qualified names with the same local part and with prefixes + // which have been bound to namespace names that are identical. + if (fGrammarType == Grammar::DTDGrammarType) { + if (!toUseHashTable) + { + for (XMLSize_t attrIndex=0; attrIndex < retCount; attrIndex++) { + curAttr = toFill.elementAt(attrIndex); + if (uriId == curAttr->getURIId() && + XMLString::equals(suffPtr, curAttr->getName())) { + emitError + ( + + XMLErrs::AttrAlreadyUsedInSTag + , curAttr->getName() + , elemDecl->getFullName() + ); + } + } + } + else + { + if (fAttrDupChkRegistry->containsKey((void*)suffPtr, uriId)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , suffPtr + , elemDecl->getFullName() + ); + } + } + } + + if (retCount >= curAttListSize) + { + curAttr = new (fMemoryManager) XMLAttr + ( + uriId + , suffPtr + , prefPtr + , normBuf.getRawBuffer() + , attType + , true + , fMemoryManager + ); + toFill.addElement(curAttr); + } + else + { + curAttr = toFill.elementAt(retCount); + curAttr->set + ( + uriId + , suffPtr + , prefPtr + , normBuf.getRawBuffer() + , attType + ); + curAttr->setSpecified(true); + } + + if (toUseHashTable) + { + fAttrDupChkRegistry->put((void*)suffPtr, uriId, curAttr); + } + + if(psviAttr) + psviAttr->setValue(curAttr->getValue()); + + // Bump the count of attrs in the list + retCount++; + } + + // Now, if there are any attributes declared by this element, let's + // go through them and make sure that any required ones are provided, + // and fault in any fixed ones and defaulted ones that are not provided + // literally. + if (hasDefs) + { + // Check after all specified attrs are scanned + // (1) report error for REQUIRED attrs that are missing (V_TAGc) + // (2) add default attrs if missing (FIXED and NOT_FIXED) + + + XMLAttDefList &attDefList = getAttDefList(fGrammarType == Grammar::SchemaGrammarType, currType, elemDecl); + + for(XMLSize_t i=0; igetDefaultType(); + unsigned int *attCountPtr = fAttDefRegistry->get((void *)curDef); + if (!attCountPtr || *attCountPtr < fElemCount) + { // did not occur + // note that since there is no attribute information + // item present, there is no PSVI infoset to augment here *except* + // that the element is invalid + + //the attribute is not provided + if (fValidate) + { + // If we are validating and its required, then an error + if ((defType == XMLAttDef::Required) || + (defType == XMLAttDef::Required_And_Fixed) ) + + { + fValidator->emitError + ( + XMLValid::RequiredAttrNotProvided + , curDef->getFullName() + ); + if(fGrammarType == Grammar::SchemaGrammarType) + { + fPSVIElemContext.fErrorOccurred = true; + } + } + else if ((defType == XMLAttDef::Default) || + (defType == XMLAttDef::Fixed) ) + { + if (fStandalone && curDef->isExternal()) + { + // XML 1.0 Section 2.9 + // Document is standalone, so attributes must not be defaulted. + fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef->getFullName(), elemDecl->getFullName()); + if(fGrammarType == Grammar::SchemaGrammarType) + { + fPSVIElemContext.fErrorOccurred = true; + } + } + } + } + + // Fault in the value if needed, and bump the att count. + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + // Let the validator pass judgement on the attribute value + if (fValidate) + { + fValidator->validateAttrValue + ( + curDef + , curDef->getValue() + , false + , elemDecl + ); + } + + XMLAttr* curAtt; + if (retCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr(fMemoryManager); + fValidator->faultInAttr(*curAtt, *curDef); + fAttrList->addElement(curAtt); + } + else + { + curAtt = fAttrList->elementAt(retCount); + fValidator->faultInAttr(*curAtt, *curDef); + } + + if (fGrammarType == Grammar::DTDGrammarType) + { + // Map the new attribute's prefix to a URI id and store + // that in the attribute object. + curAtt->setURIId + ( + resolvePrefix(curAtt->getPrefix(), ElemStack::Mode_Attribute) + ); + } + + // Indicate it was not explicitly specified and bump count + curAtt->setSpecified(false); + retCount++; + if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType) + { + QName *attName = ((SchemaAttDef *)curDef)->getAttName(); + PSVIAttribute *defAttrToFill = fPSVIAttrList->getPSVIAttributeToFill + ( + attName->getLocalPart(), fURIStringPool->getValueForId( attName->getURI()) + ); + XSAttributeDeclaration *defAttrDecl = (XSAttributeDeclaration *)fModel->getXSObject((void *)curDef); + DatatypeValidator * attrDataType = ((SchemaAttDef *)curDef)->getDatatypeValidator(); + XSSimpleTypeDefinition *defAttrType = + (XSSimpleTypeDefinition*)fModel->getXSObject(attrDataType); + // would have occurred during validation of default value + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + defAttrToFill->reset( + fRootElemName + , PSVIItem::VALIDITY_INVALID + , PSVIItem::VALIDATION_FULL + , defAttrType + , 0 + , curDef->getValue() + , true + , defAttrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *defAttrMemberType = 0; + if(defAttrType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + { + defAttrMemberType = (XSSimpleTypeDefinition *)fModel->getXSObject + ( + ((SchemaValidator*)fValidator)->getMostRecentAttrValidator() + ); + } + defAttrToFill->reset( + fRootElemName + , PSVIItem::VALIDITY_VALID + , PSVIItem::VALIDATION_FULL + , defAttrType + , defAttrMemberType + , curDef->getValue() + , true + , defAttrDecl + , (defAttrMemberType)?((SchemaValidator *)fValidator)->getMostRecentAttrValidator():attrDataType + ); + } + defAttrToFill->setValue(curDef->getValue()); + } + } + } + else if(attCountPtr) + { + //attribute is provided + // (schema) report error for PROHIBITED attrs that are present (V_TAGc) + if (defType == XMLAttDef::Prohibited && fValidate) + { + fValidator->emitError + ( + XMLValid::ProhibitedAttributePresent + , curDef->getFullName() + ); + if(fGrammarType == Grammar::SchemaGrammarType) + { + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + QName *attQName = ((SchemaAttDef *)curDef)->getAttName(); + // bad luck... + PSVIAttribute *prohibitedAttr = fPSVIAttrList->getAttributePSVIByName + ( + attQName->getLocalPart(), + fURIStringPool->getValueForId(attQName->getURI()) + ); + prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + } + return retCount; +} + + +// This method will take a raw attribute value and normalize it according to +// the rules of the attribute type. It will put the resulting value into the +// passed buffer. +// +// This code assumes that escaped characters in the original value (via char +// refs) are prefixed by a 0xFFFF character. This is because some characters +// are legal if escaped only. And some escape chars are not subject to +// normalization rules. +bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef + , const XMLCh* const attName + , const XMLCh* const value + , XMLBuffer& toFill) +{ + // A simple state value for a whitespace processing state machine + enum States + { + InWhitespace + , InContent + }; + + // Get the type and name + const XMLAttDef::AttTypes type = (attDef)?attDef->getType():XMLAttDef::CData; + + // Assume its going to go fine, and empty the target buffer in preperation + bool retVal = true; + toFill.reset(); + + // Loop through the chars of the source value and normalize it according + // to the type. + XMLCh nextCh; + const XMLCh* srcPtr = value; + + if (type == XMLAttDef::CData || type > XMLAttDef::Notation) { + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + while ((nextCh = *srcPtr++)!=0) + { + switch(nextCh) + { + // Do we have an escaped character ? + case 0xFFFF: + nextCh = *srcPtr++; + break; + case 0x09: + case 0x0A: + case 0x0D: + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && attDef && attDef->isExternal()) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attName); + } + nextCh = chSpace; + break; + case chOpenAngle: + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + emitError(XMLErrs::BracketInAttrValue, attName); + retVal = false; + break; + } + + // Add this char to the target buffer + toFill.append(nextCh); + } + } + else { + States curState = InContent; + bool firstNonWS = false; + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + while ((nextCh = *srcPtr)!=0) + { + // Do we have an escaped character ? + if (nextCh == 0xFFFF) + { + nextCh = *++srcPtr; + } + else if (nextCh == chOpenAngle) { + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + emitError(XMLErrs::BracketInAttrValue, attName); + retVal = false; + } + + if (curState == InWhitespace) + { + if (!fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + if (firstNonWS) + toFill.append(chSpace); + curState = InContent; + firstNonWS = true; + } + else + { + srcPtr++; + continue; + } + } + else if (curState == InContent) + { + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + curState = InWhitespace; + srcPtr++; + + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && attDef && attDef->isExternal()) + { + if (!firstNonWS || (nextCh != chSpace) || (!*srcPtr) || fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr)) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attName); + } + } + continue; + } + firstNonWS = true; + } + + // Add this char to the target buffer + toFill.append(nextCh); + + // And move up to the next character in the source + srcPtr++; + } + } + + return retVal; +} + +// This method will just normalize the input value as CDATA without +// any standalone checking. +bool IGXMLScanner::normalizeAttRawValue( const XMLCh* const attrName + , const XMLCh* const value + , XMLBuffer& toFill) +{ + // Assume its going to go fine, and empty the target buffer in preperation + bool retVal = true; + toFill.reset(); + + // Loop through the chars of the source value and normalize it according + // to the type. + bool escaped; + XMLCh nextCh; + const XMLCh* srcPtr = value; + while (*srcPtr) + { + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + nextCh = *srcPtr; + escaped = (nextCh == 0xFFFF); + if (escaped) + nextCh = *++srcPtr; + + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + if (!escaped && (*srcPtr == chOpenAngle)) + { + emitError(XMLErrs::BracketInAttrValue, attrName); + retVal = false; + } + + if (!escaped) + { + // NOTE: Yes this is a little redundant in that a 0x20 is + // replaced with an 0x20. But its faster to do this (I think) + // than checking for 9, A, and D separately. + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + nextCh = chSpace; + } + + // Add this char to the target buffer + toFill.append(nextCh); + + // And move up to the next character in the source + srcPtr++; + } + return retVal; +} + +// This method will reset the scanner data structures, and related plugged +// in stuff, for a new scan session. We get the input source for the primary +// XML entity, create the reader for it, and push it on the stack so that +// upon successful return from here we are ready to go. +void IGXMLScanner::scanReset(const InputSource& src) +{ + // This call implicitly tells us that we are going to reuse the scanner + // if it was previously used. So tell the validator to reset itself. + // + // But, if the fUseCacheGrammar flag is set, then don't reset it. + // + // NOTE: The ReaderMgr is flushed on the way out, because that is + // required to insure that files are closed. + fGrammarResolver->cacheGrammarFromParse(fToCacheGrammar); + fGrammarResolver->useCachedGrammarInParse(fUseCachedGrammar); + + // Clear transient schema info list. + // + fSchemaInfoList->removeAll (); + + // fModel may need updating, as fGrammarResolver could have cleaned it + if(fModel && getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); + + { + XMLDTDDescriptionImpl theDTDDescription(XMLUni::fgDTDEntityString, fMemoryManager); + fDTDGrammar = (DTDGrammar*) fGrammarResolver->getGrammar(&theDTDDescription); + } + + if (!fDTDGrammar) { + + fDTDGrammar = new (fGrammarPoolMemoryManager) DTDGrammar(fGrammarPoolMemoryManager); + fGrammarResolver->putGrammar(fDTDGrammar); + } + else + fDTDGrammar->reset(); + + fGrammar = fDTDGrammar; + fGrammarType = fGrammar->getGrammarType(); + fRootGrammar = 0; + + if (fValidatorFromUser) { + if (fValidator->handlesDTD()) + fValidator->setGrammar(fGrammar); + else if (fValidator->handlesSchema()) { + + ((SchemaValidator*) fValidator)->setErrorReporter(fErrorReporter); + ((SchemaValidator*) fValidator)->setGrammarResolver(fGrammarResolver); + ((SchemaValidator*) fValidator)->setExitOnFirstFatal(fExitOnFirstFatal); + } + } + else { + // set fValidator as fDTDValidator + fValidator = fDTDValidator; + fValidator->setGrammar(fGrammar); + } + + // Reset validation + fValidate = (fValScheme == Val_Always) ? true : false; + + // Ignore skipDTDValidation flag if no schema processing is taking place */ + fSkipDTDValidation = fSkipDTDValidation && fDoSchema; + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + + // Reset the Root Element Name + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + fRootElemName = 0; + + // Reset IdentityConstraints + if (fICHandler) + fICHandler->reset(); + + // Reset the element stack, and give it the latest ids for the special + // URIs it has to know about. + fElemStack.reset + ( + fEmptyNamespaceId + , fUnknownNamespaceId + , fXMLNamespaceId + , fXMLNSNamespaceId + ); + + if (!fSchemaNamespaceId) + fSchemaNamespaceId = fURIStringPool->addOrFind(SchemaSymbols::fgURI_XSI); + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fSeeXsi = false; + + // Reset PSVI context + // note that we always need this around for DOMTypeInfo + if (!fPSVIElement) + fPSVIElement = new (fMemoryManager) PSVIElement(fMemoryManager); + + if (!fErrorStack) + { + fErrorStack = new (fMemoryManager) ValueStackOf(8, fMemoryManager); + } + else + { + fErrorStack->removeAllElements(); + } + + resetPSVIElemContext(); + + // Reset the validators + fDTDValidator->reset(); + fDTDValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->reset(); + fSchemaValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal); + fSchemaValidator->setGrammarResolver(fGrammarResolver); + if (fValidatorFromUser) + fValidator->reset(); + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , true + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // Push this read onto the reader manager + fReaderMgr.pushReader(newReader, 0); + + // and reset security-related things if necessary: + if(fSecurityManager != 0) + { + fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } + fElemCount = 0; + if(fUIntPoolRowTotal >= 32) + { // 8 KB tied up with validating attributes... + fAttDefRegistry->removeAll(); + recreateUIntPool(); + } + else + { + // note that this will implicitly reset the values of the hashtables, + // though their buckets will still be tied up + resetUIntPool(); + } + fUndeclaredAttrRegistry->removeAll(); + fDTDElemNonDeclPool->removeAll(); +} + + +// This method is called between markup in content. It scans for character +// data that is sent to the document handler. It watches for any markup +// characters that would indicate that the character data has ended. It also +// handles expansion of general and character entities. +// +// sendData() is a local static helper for this method which handles some +// code that must be done in three different places here. +void IGXMLScanner::sendCharData(XMLBuffer& toSend) +{ + // If no data in the buffer, then nothing to do + if (toSend.isEmpty()) + return; + + // We do different things according to whether we are validating or + // not. If not, its always just characters; else, it depends on the + // current element's content model. + if (fValidate) + { + // Get the raw data we need for the callback + const XMLCh* rawBuf = toSend.getRawBuffer(); + XMLSize_t len = toSend.getLen(); + + // And see if the current element is a 'Children' style content model + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; + if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType) + { + // And see if the current element is a 'Children' style content model + ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + else if(modelType == SchemaElementDecl::Empty) + charOpts = XMLElementDecl::NoCharData; + } + } else // DTD grammar + charOpts = topElem->fThisElement->getCharDataOpts(); + + if (charOpts == XMLElementDecl::NoCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + //if(fGrammarType == Grammar::SchemaGrammarType) + //{ + // if (getPSVIHandler()) + // { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + // } + // } + } + else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len)) + { + // Its all spaces. So, if they can take spaces, then send it + // as ignorable whitespace. If they can handle any char data + // send it as characters. + if (charOpts == XMLElementDecl::SpacesOk) { + if (fDocHandler) + fDocHandler->ignorableWhitespace(rawBuf, len, false); + } + else if (charOpts == XMLElementDecl::AllCharData) + { + if (fGrammarType != Grammar::SchemaGrammarType) + { + if (fDocHandler) + fDocHandler->docCharacters(rawBuf, len, false); + } + else + { + XMLSize_t xsLen; + const XMLCh* xsNormalized; + SchemaValidator *schemaValidator = (SchemaValidator *)fValidator; + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + } + else { + xsNormalized = rawBuf; + xsLen = len ; + } + + // tell the schema validation about the character data for checkContent later + schemaValidator->setDatatypeBuffer(xsNormalized); + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + + if (fDocHandler) { + if (fNormalizeData) { + fDocHandler->docCharacters(xsNormalized, xsLen, false); + } + else { + fDocHandler->docCharacters(rawBuf, len, false); + } + } + } + } + } + else + { + // If they can take any char data, then send it. Otherwise, they + // can only handle whitespace and can't handle this stuff so + // issue an error. + if (charOpts == XMLElementDecl::AllCharData) + { + if (fGrammarType != Grammar::SchemaGrammarType) + { + if (fDocHandler) + fDocHandler->docCharacters(rawBuf, len, false); + } + else + { + XMLSize_t xsLen; + const XMLCh* xsNormalized; + SchemaValidator *schemaValidator = (SchemaValidator*)fValidator; + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + } + else { + xsNormalized = rawBuf; + xsLen = len; + } + + // tell the schema validation about the character data for checkContent later + schemaValidator->setDatatypeBuffer(xsNormalized); + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + + if (fDocHandler) { + if (fNormalizeData) { + fDocHandler->docCharacters(xsNormalized, xsLen, false); + } + else { + fDocHandler->docCharacters(rawBuf, len, false); + } + } + } + } + else + { + fValidator->emitError(XMLValid::NoCharDataInCM); + if(fGrammarType == Grammar::SchemaGrammarType) + { + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + else + { + // call all active identity constraints + if (fGrammarType == Grammar::SchemaGrammarType) { + + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) + fContent.append(toSend.getRawBuffer(), toSend.getLen()); + } + + // Always assume its just char data if not validating + if (fDocHandler) + fDocHandler->docCharacters(toSend.getRawBuffer(), toSend.getLen(), false); + } + + // Reset buffer + toSend.reset(); +} + + + +// This method is called with a key/value string pair that represents an +// xmlns="yyy" or xmlns:xxx="yyy" attribute. This method will update the +// current top of the element stack based on this data. We know that when +// we get here, that it is one of these forms, so we don't bother confirming +// it. +// +// But we have to ensure +// 1. xxx is not xmlns +// 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa +// 3. yyy is not XMLUni::fgXMLNSURIName +// 4. if xxx is not null, then yyy cannot be an empty string. +void IGXMLScanner::updateNSMap(const XMLCh* const attrName + , const XMLCh* const attrValue) +{ + updateNSMap(attrName, attrValue, XMLString::indexOf(attrName, chColon)); +} + +void IGXMLScanner::updateNSMap(const XMLCh* const attrName + , const XMLCh* const attrValue + , const int colonOfs) +{ + // We need a buffer to normalize the attribute value into + XMLBufBid bbNormal(&fBufMgr); + XMLBuffer& normalBuf = bbNormal.getBuffer(); + + // Normalize the value into the passed buffer. In this case, we don't + // care about the return value. An error was issued for the error, which + // is all we care about here. + normalizeAttRawValue(attrName, attrValue, normalBuf); + XMLCh* namespaceURI = normalBuf.getRawBuffer(); + + // We either have the default prefix (""), or we point it into the attr + // name parameter. Note that the xmlns is not the prefix we care about + // here. To us, the 'prefix' is really the local part of the attrName + // parameter. + // + // Check 1. xxx is not xmlns + // 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa + // 3. yyy is not XMLUni::fgXMLNSURIName + // 4. if xxx is not null, then yyy cannot be an empty string. + const XMLCh* prefPtr = XMLUni::fgZeroLenString; + if (colonOfs != -1) { + prefPtr = &attrName[colonOfs + 1]; + + if (XMLString::equals(prefPtr, XMLUni::fgXMLNSString)) + emitError(XMLErrs::NoUseOfxmlnsAsPrefix); + else if (XMLString::equals(prefPtr, XMLUni::fgXMLString)) { + if (!XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) + emitError(XMLErrs::PrefixXMLNotMatchXMLURI); + } + + if (!namespaceURI) + emitError(XMLErrs::NoEmptyStrNamespace, attrName); + else if(!*namespaceURI && fXMLVersion == XMLReader::XMLV1_0) + emitError(XMLErrs::NoEmptyStrNamespace, attrName); + } + + if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName)) + emitError(XMLErrs::NoUseOfxmlnsURI); + else if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) { + if (!XMLString::equals(prefPtr, XMLUni::fgXMLString)) + emitError(XMLErrs::XMLURINotMatchXMLPrefix); + } + + // Ok, we have to get the unique id for the attribute value, which is the + // URI that this value should be mapped to. The validator has the + // namespace string pool, so we ask him to find or add this new one. Then + // we ask the element stack to add this prefix to URI Id mapping. + fElemStack.addPrefix + ( + prefPtr + , fURIStringPool->addOrFind(namespaceURI) + ); +} + +void IGXMLScanner::scanRawAttrListforNameSpaces(XMLSize_t attCount) +{ + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + // When we find one, send it off to be used to update the element stack's + // namespace mappings. + for (XMLSize_t index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + + // If either the key begins with "xmlns:" or its just plain + // "xmlns", then use it to update the map. + if (!XMLString::compareNString(rawPtr, XMLUni::fgXMLNSColonString, 6) + || XMLString::equals(rawPtr, XMLUni::fgXMLNSString)) + { + const XMLCh* valuePtr = curPair->getValue(); + + updateNSMap(rawPtr, valuePtr, fRawAttrColonList[index]); + + // if the schema URI is seen in the the valuePtr, set the boolean seeXsi + if (XMLString::equals(valuePtr, SchemaSymbols::fgURI_XSI)) { + fSeeXsi = true; + } + } + } + + // walk through the list again to deal with "xsi:...." + if (fDoSchema && fSeeXsi) + { + // Schema Xsi Type yyyy (e.g. xsi:type="yyyyy") + XMLBufBid bbXsi(&fBufMgr); + XMLBuffer& fXsiType = bbXsi.getBuffer(); + + for (XMLSize_t index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + const XMLCh* prefPtr = XMLUni::fgZeroLenString; + int colonInd = fRawAttrColonList[index]; + + if (colonInd != -1) { + + fURIBuf.set(rawPtr, colonInd); + prefPtr = fURIBuf.getRawBuffer(); + } + + // if schema URI has been seen, scan for the schema location and uri + // and resolve the schema grammar; or scan for schema type + if (resolvePrefix(prefPtr, ElemStack::Mode_Attribute) == fSchemaNamespaceId) { + + const XMLCh* valuePtr = curPair->getValue(); + const XMLCh* suffPtr = &rawPtr[colonInd + 1]; + + if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_SCHEMALOCATION)) + parseSchemaLocation(valuePtr); + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCATION)) + resolveSchemaGrammar(valuePtr, XMLUni::fgZeroLenString); + + if ((!fValidator || !fValidator->handlesSchema()) && + (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE) || + XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL))) + { + // If we are in the DTD mode, try to switch to the Schema + // mode. For that we need to find any XML Schema grammar + // that we can switch to. Such a grammar can only come + // from the cache (if it came from the schemaLocation + // attribute, we would be in the Schema mode already). + // + XMLGrammarPool* pool = fGrammarResolver->getGrammarPool (); + RefHashTableOfEnumerator i = pool->getGrammarEnumerator (); + + while (i.hasMoreElements ()) + { + Grammar& gr (i.nextElement ()); + + if (gr.getGrammarType () == Grammar::SchemaGrammarType) + { + switchGrammar (gr.getTargetNamespace ()); + break; + } + } + } + + if( fValidator && fValidator->handlesSchema() ) + { + if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE)) + { + // normalize the attribute according to schema whitespace facet + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_QNAME); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiType, true); + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL)) + { + // normalize the attribute according to schema whitespace facet + XMLBuffer& fXsiNil = fBufMgr.bidOnBuffer(); + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_BOOLEAN); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiNil, true); + if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_TRUE)) + ((SchemaValidator*)fValidator)->setNillable(true); + else if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_FALSE)) + ((SchemaValidator*)fValidator)->setNillable(false); + else + emitError(XMLErrs::InvalidAttValue, fXsiNil.getRawBuffer(), valuePtr); + fBufMgr.releaseBuffer(fXsiNil); + } + } + } + } + + if (fValidator && fValidator->handlesSchema()) { + if (!fXsiType.isEmpty()) { + int colonPos = -1; + unsigned int uriId = resolveQName ( + fXsiType.getRawBuffer() + , fPrefixBuf + , ElemStack::Mode_Element + , colonPos + ); + ((SchemaValidator*)fValidator)->setXsiType(fPrefixBuf.getRawBuffer(), fXsiType.getRawBuffer() + colonPos + 1, uriId); + } + } + } +} + +void IGXMLScanner::parseSchemaLocation(const XMLCh* const schemaLocationStr, bool ignoreLoadSchema) +{ + XMLCh* locStr = XMLString::replicate(schemaLocationStr, fMemoryManager); + ArrayJanitor janLoc(locStr, fMemoryManager); + + processSchemaLocation(locStr); + XMLSize_t size = fLocationPairs->size(); + + if (size % 2 != 0 ) { + emitError(XMLErrs::BadSchemaLocation); + } else { + // We need a buffer to normalize the attribute value into + XMLBuffer normalBuf(1023, fMemoryManager); + for(XMLSize_t i=0; ielementAt(i), normalBuf); + resolveSchemaGrammar(fLocationPairs->elementAt(i+1), normalBuf.getRawBuffer(), ignoreLoadSchema); + } + } +} + +void IGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri, bool ignoreLoadSchema) { + + Grammar* grammar = 0; + + { + XMLSchemaDescriptionImpl theSchemaDescription(uri, fMemoryManager); + theSchemaDescription.setLocationHints(loc); + grammar = fGrammarResolver->getGrammar(&theSchemaDescription); + } + + // If multi-import is enabled, make sure the existing grammar came + // from the import directive. Otherwise we may end up reloading + // the same schema that came from the external grammar pool. Ideally, + // we would move fSchemaInfoList to XMLGrammarPool so that it survives + // the destruction of the scanner in which case we could rely on the + // same logic we use to weed out duplicate schemas below. + // + if (!grammar || + grammar->getGrammarType() == Grammar::DTDGrammarType || + (getHandleMultipleImports() && + ((XMLSchemaDescription*)grammar->getGrammarDescription())-> + getContextType () == XMLSchemaDescription::CONTEXT_IMPORT)) + { + if (fLoadSchema || ignoreLoadSchema) + { + XSDDOMParser parser(0, fMemoryManager, 0); + + parser.setValidationScheme(XercesDOMParser::Val_Never); + parser.setDoNamespaces(true); + parser.setUserEntityHandler(fEntityHandler); + parser.setUserErrorReporter(fErrorReporter); + + //Normalize loc + XMLBufBid nnSys(&fBufMgr); + XMLBuffer& normalizedSysId = nnSys.getBuffer(); + XMLString::removeChar(loc, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBufBid bbSys(&fBufMgr); + XMLBuffer& expSysId = bbSys.getBuffer(); + + // Allow the entity handler to expand the system id if they choose + // to do so. + InputSource* srcToFill = 0; + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::SchemaGrammar, + expSysId.getRawBuffer(), uri, XMLUni::fgZeroLenString, lastInfo.systemId, + &fReaderMgr); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + else + { + expSysId.set(normalizedURI); + } + + // If they didn't create a source via the entity handler, then we + // have to create one on our own. + if (!srcToFill) + { + if (fDisableDefaultEntityResolution) + return; + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBufBid ddSys(&fBufMgr); + XMLBuffer& resolvedSysId = ddSys.getBuffer(); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + // Put a janitor on the input source + Janitor janSrc(srcToFill); + + // Check if this exact schema has already been seen. + // + const XMLCh* sysId = srcToFill->getSystemId(); + unsigned int uriId = (uri && *uri) ? fURIStringPool->addOrFind(uri) : fEmptyNamespaceId; + SchemaInfo* importSchemaInfo = 0; + + if (fUseCachedGrammar) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, uriId); + + if (!importSchemaInfo && !fToCacheGrammar) + importSchemaInfo = fSchemaInfoList->get(sysId, uriId); + + if (importSchemaInfo) + { + // We haven't added any new grammars so it is safe to just + // return. + // + return; + } + + // Should just issue warning if the schema is not found + bool flag = srcToFill->getIssueFatalErrorIfNotFound(); + srcToFill->setIssueFatalErrorIfNotFound(false); + + parser.parse(*srcToFill); + + // Reset the InputSource + srcToFill->setIssueFatalErrorIfNotFound(flag); + + if (parser.getSawFatal() && fExitOnFirstFatal) + emitError(XMLErrs::SchemaScanFatalError); + + DOMDocument* document = parser.getDocument(); //Our Grammar + + if (document != 0) { + + DOMElement* root = document->getDocumentElement();// This is what we pass to TraverserSchema + if (root != 0) + { + const XMLCh* newUri = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + bool newGrammar = false; + if (!XMLString::equals(newUri, uri)) { + if (fValidate || fValScheme == Val_Auto) { + fValidator->emitError(XMLValid::WrongTargetNamespace, loc, uri); + } + + grammar = fGrammarResolver->getGrammar(newUri); + newGrammar = true; + } + + if (!grammar || + grammar->getGrammarType() == Grammar::DTDGrammarType || + (getHandleMultipleImports() && + ((XMLSchemaDescription*)grammar->getGrammarDescription())-> + getContextType () == XMLSchemaDescription::CONTEXT_IMPORT)) + { + // If we switched namespace URI, recheck the schema info. + // + if (newGrammar) + { + unsigned int newUriId = (newUri && *newUri) ? fURIStringPool->addOrFind(newUri) : fEmptyNamespaceId; + + if (fUseCachedGrammar) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, newUriId); + + if (!importSchemaInfo && !fToCacheGrammar) + importSchemaInfo = fSchemaInfoList->get(sysId, newUriId); + + if (importSchemaInfo) + return; + } + + // Since we have seen a grammar, set our validation flag + // at this point if the validation scheme is auto + if (fValScheme == Val_Auto && !fValidate) { + fValidate = true; + fElemStack.setValidationFlag(fValidate); + } + + // we have seen a schema, so set up the fValidator as fSchemaValidator + if (!fValidator->handlesSchema()) + { + if (fValidatorFromUser) { + // the fValidator is from user + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + } + else { + fValidator = fSchemaValidator; + } + } + + bool grammarFound = grammar && + grammar->getGrammarType() == Grammar::SchemaGrammarType; + + SchemaGrammar* schemaGrammar; + + if (grammarFound) { + schemaGrammar = (SchemaGrammar*) grammar; + } + else { + schemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + } + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) schemaGrammar->getGrammarDescription(); + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE); + gramDesc->setLocationHints(sysId); + + TraverseSchema traverseSchema + ( + root + , fURIStringPool + , schemaGrammar + , fGrammarResolver + , fUseCachedGrammar ? fCachedSchemaInfoList : fSchemaInfoList + , fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList + , this + , sysId + , fEntityHandler + , fErrorReporter + , fMemoryManager + , grammarFound + ); + + // Reset the now invalid schema roots in the collected + // schema info entries. + // + { + RefHash2KeysTableOfEnumerator i ( + fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList); + + while (i.hasMoreElements ()) + i.nextElement().resetRoot (); + } + + if (fGrammarType == Grammar::DTDGrammarType) { + fGrammar = schemaGrammar; + fGrammarType = Grammar::SchemaGrammarType; + fValidator->setGrammar(fGrammar); + } + + if (fValidate) { + // validate the Schema scan so far + fValidator->preContentValidation(false); + } + } + } + } + } + } + else + { + // Since we have seen a grammar, set our validation flag + // at this point if the validation scheme is auto + if (fValScheme == Val_Auto && !fValidate) { + fValidate = true; + fElemStack.setValidationFlag(fValidate); + } + + // we have seen a schema, so set up the fValidator as fSchemaValidator + if (!fValidator->handlesSchema()) + { + if (fValidatorFromUser) { + // the fValidator is from user + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + } + else { + fValidator = fSchemaValidator; + } + } + + if (fGrammarType == Grammar::DTDGrammarType) { + fGrammar = grammar; + fGrammarType = Grammar::SchemaGrammarType; + fValidator->setGrammar(fGrammar); + } + } + + // fModel may need updating: + if(getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); +} + +InputSource* IGXMLScanner::resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId) +{ + //Normalize sysId + XMLBufBid nnSys(&fBufMgr); + XMLBuffer& normalizedSysId = nnSys.getBuffer(); + XMLString::removeChar(sysId, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBufBid bbSys(&fBufMgr); + XMLBuffer& expSysId = bbSys.getBuffer(); + + // Allow the entity handler to expand the system id if they choose + // to do so. + InputSource* srcToFill = 0; + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + expSysId.getRawBuffer(), 0, pubId, lastInfo.systemId, + &fReaderMgr); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + else + { + expSysId.set(normalizedURI); + } + + // If they didn't create a source via the entity handler, then we + // have to create one on our own. + if (!srcToFill) + { + if (fDisableDefaultEntityResolution) + return srcToFill; + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBufBid ddSys(&fBufMgr); + XMLBuffer& resolvedSysId = ddSys.getBuffer(); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + return srcToFill; +} + + +// --------------------------------------------------------------------------- +// IGXMLScanner: Private grammar preparsing methods +// --------------------------------------------------------------------------- +Grammar* IGXMLScanner::loadXMLSchemaGrammar(const InputSource& src, + const bool toCache) +{ + // Reset the validators + fSchemaValidator->reset(); + fSchemaValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal); + fSchemaValidator->setGrammarResolver(fGrammarResolver); + + if (fValidatorFromUser) + fValidator->reset(); + + if (!fValidator->handlesSchema()) { + if (fValidatorFromUser && fValidate) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + else { + fValidator = fSchemaValidator; + } + } + + XSDDOMParser parser(0, fMemoryManager, 0); + + parser.setValidationScheme(XercesDOMParser::Val_Never); + parser.setDoNamespaces(true); + parser.setUserEntityHandler(fEntityHandler); + parser.setUserErrorReporter(fErrorReporter); + + // Should just issue warning if the schema is not found + bool flag = src.getIssueFatalErrorIfNotFound(); + ((InputSource&) src).setIssueFatalErrorIfNotFound(false); + + parser.parse(src); + + // Reset the InputSource + ((InputSource&) src).setIssueFatalErrorIfNotFound(flag); + + if (parser.getSawFatal() && fExitOnFirstFatal) + emitError(XMLErrs::SchemaScanFatalError); + + DOMDocument* document = parser.getDocument(); //Our Grammar + + if (document != 0) { + + DOMElement* root = document->getDocumentElement();// This is what we pass to TraverserSchema + if (root != 0) + { + const XMLCh* nsUri = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + Grammar* grammar = fGrammarResolver->getGrammar(nsUri); + + // Check if this exact schema has already been seen. + // + const XMLCh* sysId = src.getSystemId(); + SchemaInfo* importSchemaInfo = 0; + + if (grammar) + { + if (nsUri && *nsUri) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, fURIStringPool->addOrFind(nsUri)); + else + importSchemaInfo = fCachedSchemaInfoList->get(sysId, fEmptyNamespaceId); + } + + if (!importSchemaInfo) + { + bool grammarFound = grammar && + grammar->getGrammarType() == Grammar::SchemaGrammarType && + getHandleMultipleImports(); + + SchemaGrammar* schemaGrammar; + + if (grammarFound) + schemaGrammar = (SchemaGrammar*) grammar; + else + schemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) schemaGrammar->getGrammarDescription(); + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE); + gramDesc->setLocationHints(sysId); + + TraverseSchema traverseSchema + ( + root + , fURIStringPool + , schemaGrammar + , fGrammarResolver + , fCachedSchemaInfoList + , toCache ? fCachedSchemaInfoList : fSchemaInfoList + , this + , sysId + , fEntityHandler + , fErrorReporter + , fMemoryManager + , grammarFound + ); + + grammar = schemaGrammar; + + // Reset the now invalid schema roots in the collected + // schema info entries. + // + { + RefHash2KeysTableOfEnumerator i ( + toCache ? fCachedSchemaInfoList : fSchemaInfoList); + + while (i.hasMoreElements ()) + i.nextElement().resetRoot (); + } + } + + if (fValidate) { + // validate the Schema scan so far + fValidator->setGrammar(grammar); + fValidator->preContentValidation(false); + } + + if (toCache) { + fGrammarResolver->cacheGrammars(); + } + + if(getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); + + return grammar; + } + } + + return 0; +} + + + +// --------------------------------------------------------------------------- +// IGXMLScanner: Private parsing methods +// --------------------------------------------------------------------------- + +// This method is called to do a raw scan of an attribute value. It does not +// do normalization (since we don't know their types yet.) It just scans the +// value and does entity expansion. +// +// End of entity's must be dealt with here. During DTD scan, they can come +// from external entities. During content, they can come from any entity. +// We just eat the end of entity and continue with our scan until we come +// to the closing quote. If an unterminated value causes us to go through +// subsequent entities, that will cause errors back in the calling code, +// but there's little we can do about it here. +bool IGXMLScanner::basicAttrValueScan(const XMLCh* const attrName, XMLBuffer& toFill) +{ + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + while (true) + { + try + { + while(true) + { + XMLCh nextCh = fReaderMgr.getNextChar(); + + if (nextCh != quoteCh) + { + if (nextCh != chAmpersand) + { + if ((nextCh < 0xD800) || (nextCh > 0xDFFF)) + { + // Its got to at least be a valid XML character + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + if (nextCh == 0) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacterInAttrValue, attrName, tmpBuf); + } + } else // its a surrogate + { + // Deal with surrogate pairs + + // we expect a a leading surrogate. + if (nextCh <= 0xDBFF) + { + toFill.append(nextCh); + + // process the trailing surrogate + nextCh = fReaderMgr.getNextChar(); + + // it should be a trailing surrogate. + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + } else + { + // Its a trailing surrogate, but we are not expecting it + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + } + } else // its a chAmpersand + { + // Check for an entity ref . We ignore the empty flag in + // this one. + + bool escaped; + XMLCh firstCh; + XMLCh secondCh + ; + // If it was not returned directly, then jump back up + if (scanEntityRef(true, firstCh, secondCh, escaped) == EntityExp_Returned) + { + // If it was escaped, then put in a 0xFFFF value. This will + // be used later during validation and normalization of the + // value to know that the following character was via an + // escape char. + if (escaped) + toFill.append(0xFFFF); + + toFill.append(firstCh); + if (secondCh) + toFill.append(secondCh); + } + continue; + } + } else // its a quoteCh + { + // Check for our ending quote. It has to be in the same entity + // as where we started. Quotes in nested entities are ignored. + + if (curReader == fReaderMgr.getCurrentReaderNum()) + { + return true; + } + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr.getCurrentReaderNum()) + { + emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // add it to the buffer + toFill.append(nextCh); + + } + } + catch(const EndOfEntityException&) + { + // Just eat it and continue. + } + } + return true; +} + + +bool IGXMLScanner::scanAttValue( const XMLAttDef* const attDef + , const XMLCh* const attrName + , XMLBuffer& toFill) +{ + enum States + { + InWhitespace + , InContent + }; + + // Get the type and name + const XMLAttDef::AttTypes type = (attDef) + ?attDef->getType() + :XMLAttDef::CData; + + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // Get attribute def - to check to see if it's declared externally or not + bool isAttExternal = (attDef) + ?attDef->isExternal() + :false; + + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = InContent; + bool firstNonWS = false; + bool gotLeadingSurrogate = false; + bool escaped; + while (true) + { + try + { + while(true) + { + nextCh = fReaderMgr.getNextChar(); + + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Check for our ending quote in the same entity + if (nextCh == quoteCh) + { + if (curReader == fReaderMgr.getCurrentReaderNum()) + return true; + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr.getCurrentReaderNum()) + { + emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // Check for an entity ref now, before we let it affect our + // whitespace normalization logic below. We ignore the empty flag + // in this one. + escaped = false; + if (nextCh == chAmpersand) + { + if (scanEntityRef(true, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacterInAttrValue, attrName, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // If its not escaped, then make sure its not a < character, which + // is not allowed in attribute values. + if (!escaped && (nextCh == chOpenAngle)) + emitError(XMLErrs::BracketInAttrValue, attrName); + + // If the attribute is a CDATA type we do simple replacement of + // tabs and new lines with spaces, if the character is not escaped + // by way of a char ref. + // + // Otherwise, we do the standard non-CDATA normalization of + // compressing whitespace to single spaces and getting rid of leading + // and trailing whitespace. + if (type == XMLAttDef::CData) + { + if (!escaped) + { + if ((nextCh == 0x09) || (nextCh == 0x0A) || (nextCh == 0x0D)) + { + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + } + nextCh = chSpace; + } + } + } + else + { + if (curState == InWhitespace) + { + if ((escaped && nextCh != chSpace) || !fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + if (firstNonWS) + toFill.append(chSpace); + curState = InContent; + firstNonWS = true; + } + else + { + continue; + } + } + else if (curState == InContent) + { + if ((nextCh == chSpace) || + (fReaderMgr.getCurrentReader()->isWhitespace(nextCh) && !escaped)) + { + curState = InWhitespace; + + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace())) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + } + } + continue; + } + firstNonWS = true; + } + } + + // Else add it to the buffer + toFill.append(nextCh); + + if (secondCh) + { + toFill.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException&) + { + // Just eat it and continue. + gotLeadingSurrogate = false; + escaped = false; + } + } + return true; +} + + +// This method scans a CDATA section. It collects the character into one +// of the temp buffers and calls the document handler, if any, with the +// characters. It assumes that the getGrammarType() == Grammar::SchemaGrammarType) + { + // And see if the current element is a 'Children' style content model + ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + else if(modelType == SchemaElementDecl::Empty) + charOpts = XMLElementDecl::NoCharData; + } + } else // DTD grammar + charOpts = topElem->fThisElement->getCharDataOpts(); + + while (true) + { + const XMLCh nextCh = fReaderMgr.getNextChar(); + + // Watch for unexpected end of file + if (!nextCh) + { + emitError(XMLErrs::UnterminatedCDATASection); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + if (fValidate && fStandalone && (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))) + { + // This document is standalone; this ignorable CDATA whitespace is forbidden. + // XML 1.0, Section 2.9 + // And see if the current element is a 'Children' style content model + if (topElem->fThisElement->isExternal()) { + + if (charOpts == XMLElementDecl::SpacesOk) // Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + fValidator->emitError(XMLValid::NoWSForStandalone); + if(fGrammarType == Grammar::SchemaGrammarType) + { + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + + // If this is a close square bracket it could be our closing + // sequence. + if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose)) + { + // make sure we were not expecting a trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + if (fGrammarType == Grammar::SchemaGrammarType) { + + XMLSize_t xsLen = bbCData.getLen(); + const XMLCh* xsNormalized = bbCData.getRawBuffer(); + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + if (fNormalizeData && fValidate) { + bbCData.set(xsNormalized); + } + } + + if (fValidate) { + + // tell the schema validation about the character data for checkContent later + ((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized); + + if (charOpts != XMLElementDecl::AllCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + } + else { + if (fValidate) { + + if (charOpts != XMLElementDecl::AllCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + } + } + } + + // If we have a doc handler, call it + if (fDocHandler) + { + fDocHandler->docCharacters( + bbCData.getRawBuffer(), bbCData.getLen(), true + ); + } + + // And we are done + break; + } + + // Make sure its a valid character. But if we've emitted an error + // already, don't bother with the overhead since we've already told + // them about it. + if (!emittedError) + { + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + emittedError = true; + } + } + gotLeadingSurrogate = false; + } + } + + // Add it to the buffer + bbCData.append(nextCh); + } +} + + +void IGXMLScanner::scanCharData(XMLBuffer& toUse) +{ + // We have to watch for the stupid ]]> sequence, which is illegal in + // character data. So this is a little state machine that handles that. + enum States + { + State_Waiting + , State_GotOne + , State_GotTwo + }; + + // Reset the buffer before we start + toUse.reset(); + + // Turn on the 'throw at end' flag of the reader manager + ThrowEOEJanitor jan(&fReaderMgr, true); + + // In order to be more efficient we have to use kind of a deeply nested + // set of blocks here. The outer block puts on a try and catches end of + // entity exceptions. The inner loop is the per-character loop. If we + // put the try inside the inner loop, it would work but would require + // the exception handling code setup/teardown code to be invoked for + // each character. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = State_Waiting; + bool escaped = false; + bool gotLeadingSurrogate = false; + bool notDone = true; + while (notDone) + { + try + { + while (true) + { + // Eat through as many plain content characters as possible without + // needing special handling. Moving most content characters here, + // in this one call, rather than running the overall loop once + // per content character, is a speed optimization. + if (curState == State_Waiting && !gotLeadingSurrogate) + { + fReaderMgr.movePlainContentChars(toUse); + } + + // Try to get another char from the source + // The code from here on down covers all contengencies, + if (!fReaderMgr.getNextCharIfNot(chOpenAngle, nextCh)) + { + // If we were waiting for a trailing surrogate, its an error + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + notDone = false; + break; + } + + // Watch for a reference. Note that the escapement mechanism + // is ignored in this content. + escaped = false; + if (nextCh == chAmpersand) + { + sendCharData(toUse); + + // Turn off the throwing at the end of entity during this + ThrowEOEJanitor jan(&fReaderMgr, false); + + if (scanEntityRef(false, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + else + { + if (escaped && !fElemStack.isEmpty()) + fElemStack.setReferenceEscaped(); + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Make sure the returned char is a valid XML char + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // Keep the state machine up to date + if (!escaped) + { + if (nextCh == chCloseSquare) + { + if (curState == State_Waiting) + curState = State_GotOne; + else if (curState == State_GotOne) + curState = State_GotTwo; + } + else if (nextCh == chCloseAngle) + { + if (curState == State_GotTwo) + emitError(XMLErrs::BadSequenceInCharData); + curState = State_Waiting; + } + else + { + curState = State_Waiting; + } + } + else + { + curState = State_Waiting; + } + + // Add this char to the buffer + toUse.append(nextCh); + + if (secondCh) + { + toUse.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException& toCatch) + { + // Some entity ended, so we have to send any accumulated + // chars and send an end of entity event. + sendCharData(toUse); + gotLeadingSurrogate = false; + + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + // Check the validity constraints as per XML 1.0 Section 2.9 + if (fValidate && fStandalone) + { + // See if the text contains whitespace + // Get the raw data we need for the callback + const XMLCh* rawBuf = toUse.getRawBuffer(); + const XMLSize_t len = toUse.getLen(); + const bool isSpaces = fReaderMgr.getCurrentReader()->containsWhiteSpace(rawBuf, len); + + if (isSpaces) + { + // And see if the current element is a 'Children' style content model + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + if (topElem->fThisElement->isExternal()) { + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; + if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType) + { + // And see if the current element is a 'Children' style content model + ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + else if(modelType == SchemaElementDecl::Empty) + charOpts = XMLElementDecl::NoCharData; + } + } else // DTD grammar + charOpts = topElem->fThisElement->getCharDataOpts(); + + if (charOpts == XMLElementDecl::SpacesOk) // => Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + // + fValidator->emitError(XMLValid::NoWSForStandalone); + if(fGrammarType == Grammar::SchemaGrammarType) + { + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + } + // Send any char data that we accumulated into the buffer + sendCharData(toUse); +} + + +// This method will scan a general/character entity ref. It will either +// expand a char ref and return it directly, or push a reader for a general +// entity. +// +// The return value indicates whether the char parameters hold the value +// or whether the value was pushed as a reader, or that it failed. +// +// The escaped flag tells the caller whether the returned parameter resulted +// from a character reference, which escapes the character in some cases. It +// only makes any difference if the return value indicates the value was +// returned directly. +IGXMLScanner::EntityExpRes +IGXMLScanner::scanEntityRef( const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped) +{ + // Assume no escape + secondCh = 0; + escaped = false; + + // We have to insure that its all in one entity + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // If the next char is a pound, then its a character reference and we + // need to expand it always. + if (fReaderMgr.skippedChar(chPound)) + { + // Its a character reference, so scan it and get back the numeric + // value it represents. + if (!scanCharRef(firstCh, secondCh)) + return EntityExp_Failed; + + escaped = true; + + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + return EntityExp_Returned; + } + + // Expand it since its a normal entity ref + XMLBufBid bbName(&fBufMgr); + int colonPosition; + bool validName = fDoNamespaces ? fReaderMgr.getQName(bbName.getBuffer(), &colonPosition) : + fReaderMgr.getName(bbName.getBuffer()); + if (!validName) + { + if (bbName.isEmpty()) + emitError(XMLErrs::ExpectedEntityRefName); + else + emitError(XMLErrs::InvalidEntityRefName, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // Next char must be a semi-colon. But if its not, just emit + // an error and try to continue. + if (!fReaderMgr.skippedChar(chSemiColon)) + emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // Make sure we ended up on the same entity reader as the & char + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // Look up the name in the general entity pool + XMLEntityDecl* decl = fDTDGrammar->getEntityDecl(bbName.getRawBuffer()); + + // If it does not exist, then obviously an error + if (!decl) + { + // XML 1.0 Section 4.1 + // Well-formedness Constraint for entity not found: + // In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, + // or a document with "standalone='yes'", for an entity reference that does not occur within the external subset + // or a parameter entity + // + // Else it's Validity Constraint + if (fStandalone || fHasNoDTD) + emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + else { + if (fValidate) + fValidator->emitError(XMLValid::VC_EntityNotFound, bbName.getRawBuffer()); + } + + return EntityExp_Failed; + } + + // XML 1.0 Section 4.1 + // If we are a standalone document, then it has to have been declared + // in the internal subset. + if (fStandalone && !decl->getDeclaredInIntSubset()) + emitError(XMLErrs::IllegalRefInStandalone, bbName.getRawBuffer()); + + if (decl->isExternal()) + { + // If its unparsed, then its not valid here + if (decl->isUnparsed()) + { + emitError(XMLErrs::NoUnparsedEntityRefs, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // If we are in an attribute value, then not valid but keep going + if (inAttVal) + emitError(XMLErrs::NoExtRefsInAttValue); + + // And now create a reader to read this entity + InputSource* srcUsed; + XMLReader* reader = fReaderMgr.createReader + ( + decl->getBaseURI() + , decl->getSystemId() + , decl->getPublicId() + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , srcUsed + , fCalculateSrcOfs + , fLowWaterMark + , fDisableDefaultEntityResolution + ); + + // Put a janitor on the source so it gets cleaned up on exit + Janitor janSrc(srcUsed); + + // If the creation failed, and its not because the source was empty, + // then emit an error and return. + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenExtEntity, srcUsed ? srcUsed->getSystemId() : decl->getSystemId(), fMemoryManager); + + // Push the reader. If its a recursive expansion, then emit an error + // and return an failure. + if (!fReaderMgr.pushReader(reader, decl)) + { + emitError(XMLErrs::RecursiveEntity, decl->getName()); + return EntityExp_Failed; + } + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + // there seems nothing better to be done than to reset the entity expansion counter + fEntityExpansionCount = 0; + } + + // Do a start entity reference event. + // + // For now, we supress them in att values. Later, when + // the stuff is in place to correctly allow DOM to handle them + // we'll turn this back on. + if (fDocHandler && !inAttVal) + fDocHandler->startEntityReference(*decl); + + // If it starts with the XML string, then parse a text decl + if (checkXMLDecl(true)) + scanXMLDecl(Decl_Text); + } + else + { + // If its one of the special char references, then we can return + // it as a character, and its considered escaped. + if (decl->getIsSpecialChar()) + { + firstCh = decl->getValue()[0]; + escaped = true; + return EntityExp_Returned; + } + + // Create a reader over a memory stream over the entity value + // We force it to assume UTF-16 by passing in an encoding + // string. This way it won't both trying to predecode the + // first line, looking for an XML/TextDecl. + XMLReader* valueReader = fReaderMgr.createIntEntReader + ( + decl->getName() + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , decl->getValue() + , decl->getValueLen() + , false + ); + + // Try to push the entity reader onto the reader manager stack, + // where it will become the subsequent input. If it fails, that + // means the entity is recursive, so issue an error. The reader + // will have just been discarded, but we just keep going. + if (!fReaderMgr.pushReader(valueReader, decl)) + emitError(XMLErrs::RecursiveEntity, decl->getName()); + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + } + + // Do a start entity reference event. + // + // For now, we supress them in att values. Later, when + // the stuff is in place to correctly allow DOM to handle them + // we'll turn this back on. + if (fDocHandler && !inAttVal) + fDocHandler->startEntityReference(*decl); + + // If it starts with the XML string, then it's an error + if (checkXMLDecl(true)) { + emitError(XMLErrs::TextDeclNotLegalHere); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + return EntityExp_Pushed; +} + + +bool IGXMLScanner::switchGrammar(const XMLCh* const newGrammarNameSpace) +{ + Grammar* tempGrammar = fGrammarResolver->getGrammar(newGrammarNameSpace); + + if (!tempGrammar && !fSkipDTDValidation) { + // This is a case where namespaces is on with a DTD grammar. + tempGrammar = fDTDGrammar; + } + if (!tempGrammar) { + return false; + } + else { + + Grammar::GrammarType tempGrammarType = tempGrammar->getGrammarType(); + if (tempGrammarType == Grammar::SchemaGrammarType && !fValidator->handlesSchema()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + else { + fValidator = fSchemaValidator; + } + } + else if (tempGrammarType == Grammar::DTDGrammarType) { + if (fSkipDTDValidation) { + return false; + } + + if (!fValidator->handlesDTD()) { + if (fValidatorFromUser) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + else { + fValidator = fDTDValidator; + } + } + } + + fGrammarType = tempGrammarType; + fGrammar = tempGrammar; + fValidator->setGrammar(fGrammar); + return true; + } +} + +// check if we should skip or lax the validation of the element +// if skip - no validation +// if lax - validate only if the element if found +bool IGXMLScanner::laxElementValidation(QName* element, ContentLeafNameTypeVector* cv, + const XMLContentModel* const cm, + const XMLSize_t parentElemDepth) +{ + bool skipThisOne = false; + bool laxThisOne = false; + unsigned int elementURI = element->getURI(); + unsigned int currState = fElemState[parentElemDepth]; + unsigned int currLoop = fElemLoopState[parentElemDepth]; + + if (currState == XMLContentModel::gInvalidTrans) { + return laxThisOne; + } + + SubstitutionGroupComparator comparator(fGrammarResolver, fURIStringPool); + + if (cv) { + XMLSize_t i = 0; + XMLSize_t leafCount = cv->getLeafCount(); + unsigned int nextState = 0; + + for (; i < leafCount; i++) { + + QName* fElemMap = cv->getLeafNameAt(i); + unsigned int uri = fElemMap->getURI(); + ContentSpecNode::NodeTypes type = cv->getLeafTypeAt(i); + + if (type == ContentSpecNode::Leaf) { + if (((uri == elementURI) + && XMLString::equals(fElemMap->getLocalPart(), element->getLocalPart())) + || comparator.isEquivalentTo(element, fElemMap)) { + + nextState = cm->getNextState(currState, i); + + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } else if ((type & 0x0f) == ContentSpecNode::Any) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + else if ((type & 0x0f) == ContentSpecNode::Any_Other) { + if (uri != elementURI && elementURI != fEmptyNamespaceId) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f) == ContentSpecNode::Any_NS) { + if (uri == elementURI) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + + } // for + + if (i == leafCount) { // no match + fElemState[parentElemDepth] = XMLContentModel::gInvalidTrans; + fElemLoopState[parentElemDepth] = 0; + return laxThisOne; + } + + unsigned int nextLoop = 0; + if(!cm->handleRepetitions(element, currState, currLoop, nextState, nextLoop, i, &comparator)) { + fElemState[parentElemDepth] = XMLContentModel::gInvalidTrans; + fElemLoopState[parentElemDepth] = 0; + return laxThisOne; + } + + ContentSpecNode::NodeTypes type = cv->getLeafTypeAt(i); + if ((type & 0x0f) == ContentSpecNode::Any || + (type & 0x0f) == ContentSpecNode::Any_Other || + (type & 0x0f) == ContentSpecNode::Any_NS) + { + if (type == ContentSpecNode::Any_Skip || + type == ContentSpecNode::Any_NS_Skip || + type == ContentSpecNode::Any_Other_Skip) { + skipThisOne = true; + } + else if (type == ContentSpecNode::Any_Lax || + type == ContentSpecNode::Any_NS_Lax || + type == ContentSpecNode::Any_Other_Lax) { + laxThisOne = true; + } + } + fElemState[parentElemDepth] = nextState; + fElemLoopState[parentElemDepth] = nextLoop; + } // if + + if (skipThisOne) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + + return laxThisOne; +} + + +// check if there is an AnyAttribute, and if so, see if we should lax or skip +// if skip - no validation +// if lax - validate only if the attribute if found +bool IGXMLScanner::anyAttributeValidation(SchemaAttDef* attWildCard, unsigned int uriId, bool& skipThisOne, bool& laxThisOne) +{ + XMLAttDef::AttTypes wildCardType = attWildCard->getType(); + bool anyEncountered = false; + skipThisOne = false; + laxThisOne = false; + if (wildCardType == XMLAttDef::Any_Any) + anyEncountered = true; + else if (wildCardType == XMLAttDef::Any_Other) { + if (attWildCard->getAttName()->getURI() != uriId + && uriId != fEmptyNamespaceId) + anyEncountered = true; + } + else if (wildCardType == XMLAttDef::Any_List) { + ValueVectorOf* nameURIList = attWildCard->getNamespaceList(); + XMLSize_t listSize = (nameURIList) ? nameURIList->size() : 0; + + if (listSize) { + for (XMLSize_t i=0; i < listSize; i++) { + if (nameURIList->elementAt(i) == uriId) + anyEncountered = true; + } + } + } + + if (anyEncountered) { + XMLAttDef::DefAttTypes defType = attWildCard->getDefaultType(); + if (defType == XMLAttDef::ProcessContents_Skip) { + // attribute should just be bypassed, + skipThisOne = true; + } + else if (defType == XMLAttDef::ProcessContents_Lax) { + laxThisOne = true; + } + } + + return anyEncountered; +} + +inline XMLAttDefList& getAttDefList(bool isSchemaGrammar + , ComplexTypeInfo* currType + , XMLElementDecl* elemDecl) +{ + if (isSchemaGrammar && currType) + return currType->getAttDefList(); + else + return elemDecl->getAttDefList(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.cpp b/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.cpp new file mode 100644 index 000000000..6f7d40a19 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.cpp @@ -0,0 +1,57 @@ +/* + * 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: MemoryManagerImpl.cpp 673975 2008-07-04 09:23:56Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MemoryManager* MemoryManagerImpl::getExceptionMemoryManager() +{ + return this; +} + +void* MemoryManagerImpl::allocate(XMLSize_t size) +{ + void* memptr; + try { + memptr = ::operator new(size); + } + catch(...) { + throw OutOfMemoryException(); + } + if (memptr != NULL) { + return memptr; + } + throw OutOfMemoryException(); +} + +void MemoryManagerImpl::deallocate(void* p) +{ + if (p) + ::operator delete(p); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.hpp b/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.hpp new file mode 100644 index 000000000..1ee5c2c7e --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/MemoryManagerImpl.hpp @@ -0,0 +1,106 @@ +/* + * 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: MemoryManagerImpl.hpp 673975 2008-07-04 09:23:56Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MEMORYMANAGERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_MEMORYMANAGERIMPL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Configurable memory manager + * + *

This is Xerces default implementation of the memory + * manager interface, which will be instantiated and used + * in the absence of an application's memory manager. + *

+ */ + +class XMLUTIL_EXPORT MemoryManagerImpl : public MemoryManager +{ +public: + + /** @name Constructor */ + //@{ + + /** + * Default constructor + */ + MemoryManagerImpl() + { + } + //@} + + /** @name Destructor */ + //@{ + + /** + * Default destructor + */ + virtual ~MemoryManagerImpl() + { + } + //@} + + + /** + * This method is called to obtain the memory manager that should be + * used to allocate memory used in exceptions. + * + * @return A pointer to the memory manager + */ + virtual MemoryManager* getExceptionMemoryManager(); + + + /** @name The virtual methods in MemoryManager */ + //@{ + + /** + * This method allocates requested memory. + * + * @param size The requested memory size + * + * @return A pointer to the allocated memory + */ + virtual void* allocate(XMLSize_t size); + + /** + * This method deallocates memory + * + * @param p The pointer to the allocated memory to be deleted + */ + virtual void deallocate(void* p); + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MemoryManagerImpl(const MemoryManagerImpl&); + MemoryManagerImpl& operator=(const MemoryManagerImpl&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/ReaderMgr.cpp b/project/jni/xerces/src/xercesc/internal/ReaderMgr.cpp new file mode 100644 index 000000000..d3879ce10 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ReaderMgr.cpp @@ -0,0 +1,1120 @@ +/* + * 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: ReaderMgr.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ReaderMgr: Constructors and Destructor +// --------------------------------------------------------------------------- +ReaderMgr::ReaderMgr(MemoryManager* const manager) : + + fCurEntity(0) + , fCurReader(0) + , fEntityHandler(0) + , fEntityStack(0) + , fNextReaderNum(1) + , fReaderStack(0) + , fThrowEOE(false) + , fXMLVersion(XMLReader::XMLV1_0) + , fStandardUriConformant(false) + , fMemoryManager(manager) +{ +} + +ReaderMgr::~ReaderMgr() +{ + // + // Clean up the reader and entity stacks. Note that we don't own the + // entities, so we don't delete the current entity (and the entity stack + // does not own its elements either, so deleting it will not delete the + // entities it still references!) + // + delete fCurReader; + delete fReaderStack; + delete fEntityStack; +} + + +// --------------------------------------------------------------------------- +// ReaderMgr: Getter methods +// --------------------------------------------------------------------------- +bool ReaderMgr::isEmpty() const +{ + return fReaderStack->empty(); +} + + +// --------------------------------------------------------------------------- +// ReaderMgr: Scanning APIs +// --------------------------------------------------------------------------- +XMLCh ReaderMgr::getNextChar() +{ + XMLCh chRet; + if (fCurReader->getNextChar(chRet)) + return chRet; + + // + // Didn't get anything back so this reader is hosed. So lets move to + // the next reader on the stack. If this fails, it will be because + // its the end of the original file, and we just return zero. + // + // If its the end of an entity and fThrowEOE is set, it will throw out + // of here. Otherwise, it will take us down to the next reader and + // we'll have more chars. + // + if (!popReader()) + return XMLCh(0); + + // Else try again and return the new character + fCurReader->getNextChar(chRet); + return chRet; +} + + +void ReaderMgr::getSpaces(XMLBuffer& toFill) +{ + // Reset the buffer before we start + toFill.reset(); + + // + // Get all the spaces from the current reader. If it returns true, + // it hit a non-space and we are done. Else we have to pop a reader + // and keep going. + // + while (!fCurReader->getSpaces(toFill)) + { + // We wore that one out, so lets pop a reader and try again + if (!popReader()) + break; + } +} + + +void ReaderMgr::getUpToCharOrWS(XMLBuffer& toFill, const XMLCh toCheck) +{ + // Reset the target buffer before we start + toFill.reset(); + + // + // Ok, enter a loop where we ask the current reader to get chars until + // it meets the criteria. It returns false if it came back due to eating + // up all of its data. Else it returned because something matched, and + // we are done. + // + while (!fCurReader->getUpToCharOrWS(toFill, toCheck)) + { + // We ate that one up, lets try to pop another. If not, break out + if (!popReader()) + break; + } +} + + +XMLCh ReaderMgr::peekNextChar() +{ + XMLCh chRet; + if (fCurReader->peekNextChar(chRet)) + return chRet; + + // + // Didn't get anything back so this reader is hosed. So lets move to + // the next reader on the stack. If this fails, it will be because + // its the end of the original file, and we just return zero. + // + if (!popReader()) + return XMLCh(0); + + // Else peek again and return the character + fCurReader->peekNextChar(chRet); + return chRet; +} + + +bool ReaderMgr::skippedChar(const XMLCh toCheck) +{ + while (true) + { + // If we get it, then just return true now + if (fCurReader->skippedChar(toCheck)) + return true; + + // + // Check to see if we hit end of input on this reader. If so, then + // lets pop and try again. Else, we failed. If we cannot pop another + // then we failed. + // + if (!fCurReader->getNoMoreFlag()) + break; + + if (!popReader()) + break; + } + return false; +} + + +bool ReaderMgr::skippedSpace() +{ + while (true) + { + // If we get it, then just return true now + if (fCurReader->skippedSpace()) + return true; + + // + // Check to see if we hit end of input on this reader. If so, then + // lets pop and try again. Else, we failed. If we cannot pop another + // then we failed. + // + if (!fCurReader->getNoMoreFlag()) + break; + + if (!popReader()) + break; + } + return false; +} + + +bool ReaderMgr::skipIfQuote(XMLCh& chGotten) +{ + while (true) + { + // If we get it, then just return true now + if (fCurReader->skipIfQuote(chGotten)) + return true; + + // + // Check to see if we hit end of input on this reader. If so, then + // lets pop and try again. Else, we failed. If we cannot pop another + // then we failed. + // + if (!fCurReader->getNoMoreFlag()) + break; + + if (!popReader()) + break; + } + return false; +} + +void ReaderMgr::skipPastSpaces(bool& skippedSomething, bool inDecl /* = false */) +{ + // we rely on the fact that fCurReader->skipSpaces will NOT reset the flag to false, but only + // set it to true if a space is found + skippedSomething = false; + // + // Skip all the spaces in the current reader. If it returned because + // it hit a non-space, break out. Else we have to pop another entity + // and keep going. + // + while (!fCurReader->skipSpaces(skippedSomething, inDecl)) + { + // Try to pop another entity. If we can't then we are done + if (!popReader()) + break; + } +} + +void ReaderMgr::skipPastSpaces() +{ + // we are not using it, so we don't care to initialize it + bool tmpFlag; + // + // Skip all the spaces in the current reader. If it returned because + // it hit a non-space, break out. Else we have to pop another entity + // and keep going. + // + while (!fCurReader->skipSpaces(tmpFlag, false)) + { + // Try to pop another entity. If we can't then we are done + if (!popReader()) + break; + } +} + +void ReaderMgr::skipQuotedString(const XMLCh quoteCh) +{ + XMLCh nextCh; + // If we get an end of file char, then return + while ((nextCh = getNextChar())!=0) + { + // If we get the quote char, then break out + if (nextCh == quoteCh) + break; + } +} + + +XMLCh ReaderMgr::skipUntilIn(const XMLCh* const listToSkip) +{ + XMLCh nextCh; + // If we get an end of file char, then return + while ((nextCh = peekNextChar())!=0) + { + if (XMLString::indexOf(listToSkip, nextCh) != -1) + break; + + // Its one of ours so eat it + getNextChar(); + } + return nextCh; +} + + +XMLCh ReaderMgr::skipUntilInOrWS(const XMLCh* const listToSkip) +{ + XMLCh nextCh; + // If we get an end of file char, then return + while ((nextCh = peekNextChar())!=0) + { + if (fCurReader->isWhitespace(nextCh)) + break; + + if (XMLString::indexOf(listToSkip, nextCh) != -1) + break; + + // Its one of ours, so eat it + getNextChar(); + } + return nextCh; +} + + + +// --------------------------------------------------------------------------- +// ReaderMgr: Control methods +// --------------------------------------------------------------------------- + +// +// If the reader stack is empty, then there is only the original main XML +// entity left. If its empty, then we have no more input. +// +bool ReaderMgr::atEOF() const +{ + return fReaderStack->empty() && fCurReader->getNoMoreFlag(); +} + + +// +// This method is called in the case of errors to clean up the stack when +// entities have been incorrectly left on the stack due to syntax errors. +// It just cleans back the stack, and sends no entity events. +// +void ReaderMgr::cleanStackBackTo(const XMLSize_t readerNum) +{ + // + // Just start popping readers until we find the one with the indicated + // reader number. + // + while (true) + { + if (fCurReader->getReaderNum() == readerNum) + break; + + if (fReaderStack->empty()) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::RdrMgr_ReaderIdNotFound, fMemoryManager); + + delete fCurReader; + fCurReader = fReaderStack->pop(); + fCurEntity = fEntityStack->pop(); + } +} + + +XMLReader* ReaderMgr::createReader( const InputSource& src + , const bool + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , const bool calcSrcOfs + , XMLSize_t lowWaterMark) +{ + // + // Ask the input source to create us an input stream. The particular + // type of input source will know what kind to create. + // + BinInputStream* newStream = src.makeStream(); + if (!newStream) + return 0; + + Janitor streamJanitor(newStream); + + // + // Create a new reader and return it. If the source has an encoding that + // it wants to force, then we call the constructor that does that. + // Otherwise, we just call the one that provides the provisional encoding + // to be possibly updated later by the encoding="" setting. + // + XMLReader* retVal = 0; + + // XMLReader ctor invokes refreshRawBuffer() which calls + // newStream->readBytes(). + // This readBytes() may throw exception, which neither + // refresRawBuffer(), nor XMLReader ctor catches. + // We need to handle this exception to avoid leak on newStream. + + try { + if (src.getEncoding()) + { + retVal = new (fMemoryManager) XMLReader + ( + src.getPublicId() + , src.getSystemId() + , newStream + , src.getEncoding() + , refFrom + , type + , source + , false + , calcSrcOfs + , lowWaterMark + , fXMLVersion + , fMemoryManager + ); + } + else + { + retVal = new (fMemoryManager) XMLReader + ( + src.getPublicId() + , src.getSystemId() + , newStream + , refFrom + , type + , source + , false + , calcSrcOfs + , lowWaterMark + , fXMLVersion + , fMemoryManager + ); + } + } + catch(const OutOfMemoryException&) + { + streamJanitor.release(); + + throw; + } + + assert(retVal); + + streamJanitor.release(); + + // Set the next available reader number on this reader + retVal->setReaderNum(fNextReaderNum++); + return retVal; +} + + +XMLReader* ReaderMgr::createReader( const XMLCh* const sysId + , const XMLCh* const pubId + , const bool xmlDecl + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , InputSource*& srcToFill + , const bool calcSrcOfs + , XMLSize_t lowWaterMark + , const bool disableDefaultEntityResolution) +{ + //Normalize sysId + XMLBuffer normalizedSysId(1023, fMemoryManager); + if(sysId) + XMLString::removeChar(sysId, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBuffer expSysId(1023, fMemoryManager); + + // + // Allow the entity handler to expand the system id if they choose + // to do so. + // + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + } + else + { + expSysId.set(normalizedURI); + } + + // Call the entity resolver interface to get an input source + srcToFill = 0; + if (fEntityHandler) + { + LastExtEntityInfo lastInfo; + getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + expSysId.getRawBuffer(), XMLUni::fgZeroLenString, pubId, lastInfo.systemId, + this); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + + // + // If they didn't create a source via the entity resolver, then we + // have to create one on our own. + // + if (!srcToFill) + { + if (disableDefaultEntityResolution) + return 0; + + LastExtEntityInfo lastInfo; + getLastExtEntityInfo(lastInfo); + +// Keep this #if 0 block as it was exposing a threading problem on AIX. +// Got rid of the problem by changing XMLURL to not throw malformedurl +// exceptions. +#if 0 + try + { + XMLURL urlTmp(lastInfo.systemId, expSysId.getRawBuffer(), fMemoryManager); + if (urlTmp.isRelative()) + { + ThrowXMLwithMemMgr + ( + MalformedURLException + , XMLExcepts::URL_NoProtocolPresent + , fMemoryManager + ); + } + else { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + catch(const MalformedURLException& e) + { + // Its not a URL, so lets assume its a local file name if non-standard uri is allowed + if (!fStandardUriConformant) + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , expSysId.getRawBuffer() + , fMemoryManager + ); + else + throw e; + } +#else + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBuffer resolvedSysId(1023, fMemoryManager); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } +#endif + } + + // Put a janitor on the input source + Janitor janSrc(srcToFill); + + // + // Now call the other version with the input source that we have, and + // return the resulting reader. + // + XMLReader* retVal = createReader + ( + *srcToFill + , xmlDecl + , refFrom + , type + , source + , calcSrcOfs + , lowWaterMark + ); + + // Either way, we can release the input source now + janSrc.orphan(); + + // If it failed for any reason, then return zero. + if (!retVal) + return 0; + + // Give this reader the next available reader number and return it + retVal->setReaderNum(fNextReaderNum++); + return retVal; +} + + +XMLReader* ReaderMgr::createReader( const XMLCh* const baseURI + , const XMLCh* const sysId + , const XMLCh* const pubId + , const bool xmlDecl + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , InputSource*& srcToFill + , const bool calcSrcOfs + , XMLSize_t lowWaterMark + , const bool disableDefaultEntityResolution) +{ + //Normalize sysId + XMLBuffer normalizedSysId(1023, fMemoryManager); + XMLString::removeChar(sysId, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBuffer expSysId(1023, fMemoryManager); + + // + // Allow the entity handler to expand the system id if they choose + // to do so. + // + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + } + else + { + expSysId.set(normalizedURI); + } + + // Call the entity resolver interface to get an input source + srcToFill = 0; + if (fEntityHandler) + { + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + expSysId.getRawBuffer(), XMLUni::fgZeroLenString, pubId, baseURI, + this); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + + // + // If they didn't create a source via the entity resolver, then we + // have to create one on our own. + // + if (!srcToFill) + { + if (disableDefaultEntityResolution) + return 0; + + LastExtEntityInfo lastInfo; + + const XMLCh* baseuri=baseURI; + if(!baseuri || !*baseuri) + { + getLastExtEntityInfo(lastInfo); + baseuri = lastInfo.systemId; + } + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(baseuri, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBuffer resolvedSysId(1023, fMemoryManager); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + baseuri + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + // Put a janitor on the input source + Janitor janSrc(srcToFill); + + // + // Now call the other version with the input source that we have, and + // return the resulting reader. + // + XMLReader* retVal = createReader + ( + *srcToFill + , xmlDecl + , refFrom + , type + , source + , calcSrcOfs + , lowWaterMark + ); + + // Either way, we can release the input source now + janSrc.orphan(); + + // If it failed for any reason, then return zero. + if (!retVal) + return 0; + + // Give this reader the next available reader number and return it + retVal->setReaderNum(fNextReaderNum++); + return retVal; +} + + +XMLReader* +ReaderMgr::createIntEntReader( const XMLCh* const sysId + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLCh* const dataBuf + , const XMLSize_t dataLen + , const bool copyBuf + , const bool calcSrcOfs + , XMLSize_t lowWaterMark) +{ + // + // This one is easy, we just create an input stream for the data and + // provide a few extra goodies. + // + // NOTE: We use a special encoding string that will be recognized + // as a 'do nothing' transcoder for the already internalized XMLCh + // data that makes up an internal entity. + // + BinMemInputStream* newStream = new (fMemoryManager) BinMemInputStream + ( + (const XMLByte*)dataBuf + , dataLen * sizeof(XMLCh) + , copyBuf ? BinMemInputStream::BufOpt_Copy + : BinMemInputStream::BufOpt_Reference + , fMemoryManager + ); + if (!newStream) + return 0; + + XMLReader* retVal = new (fMemoryManager) XMLReader + ( + sysId + , 0 + , newStream + , XMLRecognizer::XERCES_XMLCH + , refFrom + , type + , XMLReader::Source_Internal + , false + , calcSrcOfs + , lowWaterMark + , fXMLVersion + , fMemoryManager + ); + + // If it failed for any reason, then return zero. + if (!retVal) { + delete newStream; + return 0; + } + + // Set the reader number to the next available number + retVal->setReaderNum(fNextReaderNum++); + return retVal; +} + + +const XMLCh* ReaderMgr::getCurrentEncodingStr() const +{ + const XMLEntityDecl* theEntity; + const XMLReader* theReader = getLastExtEntity(theEntity); + + return theReader->getEncodingStr(); +} + + +const XMLEntityDecl* ReaderMgr::getCurrentEntity() const +{ + return fCurEntity; +} + + +XMLEntityDecl* ReaderMgr::getCurrentEntity() +{ + return fCurEntity; +} + + +XMLSize_t ReaderMgr::getReaderDepth() const +{ + // If the stack doesn't exist, its obviously zero + if (!fEntityStack) + return 0; + + // + // The return is the stack size, plus one if there is a current + // reader. So if there is no current reader and none on the stack, + // its zero, else its some non-zero value. + // + XMLSize_t retVal = fEntityStack->size(); + if (fCurReader) + retVal++; + return retVal; +} + +void ReaderMgr::getLastExtEntityInfo(LastExtEntityInfo& lastInfo) const +{ + // + // If the reader stack never got created or we've not managed to open any + // main entity yet, then we can't give this information. + // + if (!fReaderStack || !fCurReader) + { + lastInfo.systemId = XMLUni::fgZeroLenString; + lastInfo.publicId = XMLUni::fgZeroLenString; + lastInfo.lineNumber = 0; + lastInfo.colNumber = 0; + return; + } + + // We have at least one entity so get the data + const XMLEntityDecl* theEntity; + const XMLReader* theReader = getLastExtEntity(theEntity); + + // Fill in the info structure with the reader we found + lastInfo.systemId = theReader->getSystemId(); + lastInfo.publicId = theReader->getPublicId(); + lastInfo.lineNumber = theReader->getLineNumber(); + lastInfo.colNumber = theReader->getColumnNumber(); +} + + +bool ReaderMgr::isScanningPERefOutOfLiteral() const +{ + // If the current reader is not for an entity, then definitely not + if (!fCurEntity) + return false; + + // + // If this is a PE entity, and its not being expanded in a literal + // then its true. + // + if ((fCurReader->getType() == XMLReader::Type_PE) + && (fCurReader->getRefFrom() == XMLReader::RefFrom_NonLiteral)) + { + return true; + } + return false; +} + + +bool ReaderMgr::pushReader( XMLReader* const reader + , XMLEntityDecl* const entity) +{ + // + // First, if an entity was passed, we have to confirm that this entity + // is not already on the entity stack. If so, then this is a recursive + // entity expansion, so we issue an error and refuse to put the reader + // on the stack. + // + // If there is no entity passed, then its not an entity being pushed, so + // nothing to do. If there is no entity stack yet, then of coures it + // cannot already be there. + // + if (entity && fEntityStack) + { + const XMLSize_t count = fEntityStack->size(); + const XMLCh* const theName = entity->getName(); + for (XMLSize_t index = 0; index < count; index++) + { + const XMLEntityDecl* curDecl = fEntityStack->elementAt(index); + if (curDecl) + { + if (XMLString::equals(theName, curDecl->getName())) + { + // Oops, already there so delete reader and return + delete reader; + return false; + } + } + } + } + + // + // Fault in the reader stack. Give it an initial capacity of 16, and + // tell it it does own its elements. + // + if (!fReaderStack) + fReaderStack = new (fMemoryManager) RefStackOf(16, true, fMemoryManager); + + // And the entity stack, which does not own its elements + if (!fEntityStack) + fEntityStack = new (fMemoryManager) RefStackOf(16, false, fMemoryManager); + + // + // Push the current reader and entity onto their respective stacks. + // Note that the the current entity can be null if the current reader + // is not for an entity. + // + if (fCurReader) + { + fReaderStack->push(fCurReader); + fEntityStack->push(fCurEntity); + } + + // + // Make the passed reader and entity the current top of stack. The + // passed entity can (and often is) null. + // + fCurReader = reader; + fCurEntity = entity; + + return true; +} + + +void ReaderMgr::reset() +{ + // Reset all of the flags + fThrowEOE = false; + + // Delete the current reader and flush the reader stack + delete fCurReader; + fCurReader = 0; + if (fReaderStack) + fReaderStack->removeAllElements(); + + // + // And do the same for the entity stack, but don't delete the current + // entity (if any) since we don't own them. + // + fCurEntity = 0; + if (fEntityStack) + fEntityStack->removeAllElements(); +} + + +// --------------------------------------------------------------------------- +// ReaderMgr: Implement the SAX Locator interface +// --------------------------------------------------------------------------- +const XMLCh* ReaderMgr::getPublicId() const +{ + if (!fReaderStack && !fCurReader) + return XMLUni::fgZeroLenString; + + const XMLEntityDecl* theEntity; + return getLastExtEntity(theEntity)->getPublicId(); +} + +const XMLCh* ReaderMgr::getSystemId() const +{ + if (!fReaderStack && !fCurReader) + return XMLUni::fgZeroLenString; + + const XMLEntityDecl* theEntity; + return getLastExtEntity(theEntity)->getSystemId(); +} + +XMLFileLoc ReaderMgr::getColumnNumber() const +{ + if (!fReaderStack && !fCurReader) + return 0; + + const XMLEntityDecl* theEntity; + return getLastExtEntity(theEntity)->getColumnNumber(); +} + +XMLFileLoc ReaderMgr::getLineNumber() const +{ + if (!fReaderStack && !fCurReader) + return 0; + + const XMLEntityDecl* theEntity; + return getLastExtEntity(theEntity)->getLineNumber(); +} + + + +// --------------------------------------------------------------------------- +// ReaderMgr: Private helper methods +// --------------------------------------------------------------------------- +const XMLReader* +ReaderMgr::getLastExtEntity(const XMLEntityDecl*& itsEntity) const +{ + // + // Scan down the reader stack until we find a reader for an entity that + // is external. First check that there is anything in the stack at all, + // in which case the current reader is the main file and that's the one + // that we want. + // + const XMLReader* theReader = fCurReader; + + // + // If there is a current entity and it is not an external entity, then + // search the stack; else, keep the reader that we've got since its + // either an external entity reader or the main file reader. + // + const XMLEntityDecl* curEntity = fCurEntity; + if (curEntity && !curEntity->isExternal()) + { + XMLSize_t index = fReaderStack->size(); + if (index) + { + while (true) + { + // Move down to the previous element and get a pointer to it + index--; + curEntity = fEntityStack->elementAt(index); + + // + // If its null or its an external entity, then this reader + // is what we want, so break out with that one. + // + if (!curEntity) + { + theReader = fReaderStack->elementAt(index); + break; + } + else if (curEntity->isExternal()) + { + theReader = fReaderStack->elementAt(index); + break; + } + + // We hit the end, so leave the main file reader as the one + if (!index) + break; + } + } + } + + itsEntity = curEntity; + return theReader; +} + + +bool ReaderMgr::popReader() +{ + // + // We didn't get any more, so try to pop off a reader. If the reader + // stack is empty, then we are at the end, so return false. + // + if (fReaderStack->empty()) + return false; + + // + // Remember the current entity, before we pop off a new one. We might + // need this to throw the end of entity exception at the end. + // + XMLEntityDecl* prevEntity = fCurEntity; + const bool prevReaderThrowAtEnd = fCurReader->getThrowAtEnd(); + const XMLSize_t readerNum = fCurReader->getReaderNum(); + + // + // Delete the current reader and pop a new reader and entity off + // the stacks. + // + delete fCurReader; + fCurReader = fReaderStack->pop(); + fCurEntity = fEntityStack->pop(); + + // + // If there was a previous entity, and either the fThrowEOE flag is set + // or reader was marked as such, then throw an end of entity. + // + if (prevEntity && (fThrowEOE || prevReaderThrowAtEnd)) + throw EndOfEntityException(prevEntity, readerNum); + + while (true) + { + // + // They don't want us to throw, so lets just return with a new + // reader. Here we have to do a loop because we might have multiple + // readers on these stack that are empty (i.e. the last char in them + // was the ';' at the end of the entity ref that caused the next + // entity to be pushed. + // + // So we loop until we find a non-empty reader, or hit the main + // file entity. If we find one with some chars available, then break + // out and take that one. + // + if (fCurReader->charsLeftInBuffer()) + break; + + fCurReader->refreshCharBuffer(); + if (fCurReader->charsLeftInBuffer()) + break; + + // + // The current one is hosed. So, if the reader stack is empty we + // are dead meat and can give up now. + // + if (fReaderStack->empty()) + return false; + + // Else pop again and try it one more time + delete fCurReader; + fCurReader = fReaderStack->pop(); + fCurEntity = fEntityStack->pop(); + } + return true; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/ReaderMgr.hpp b/project/jni/xerces/src/xercesc/internal/ReaderMgr.hpp new file mode 100644 index 000000000..1d8d78367 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ReaderMgr.hpp @@ -0,0 +1,447 @@ +/* + * 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: ReaderMgr.hpp 833045 2009-11-05 13:21:27Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_READERMGR_HPP) +#define XERCESC_INCLUDE_GUARD_READERMGR_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLEntityDecl; +class XMLEntityHandler; +class XMLDocumentHandler; +class XMLScanner; + + +// --------------------------------------------------------------------------- +// This class is used by the scanner. The scanner must deal with expansion +// of entities, some of which are totally different files (external parsed +// entities.) It does so by pushing readers onto a stack. The top reader is +// the one it wants to read out of, but that one must be popped when it is +// empty. To keep that logic from being all over the place, the scanner +// talks to the reader manager, which handles the stack and popping off +// used up readers. +// --------------------------------------------------------------------------- +class XMLPARSER_EXPORT ReaderMgr : public XMemory + , public Locator +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // ----------------------------------------------------------------------- + struct LastExtEntityInfo : public XMemory + { + const XMLCh* systemId; + const XMLCh* publicId; + XMLFileLoc lineNumber; + XMLFileLoc colNumber; + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ReaderMgr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ReaderMgr(); + + + // ----------------------------------------------------------------------- + // Convenience scanning methods + // + // This are all convenience methods that work in terms of the core + // character spooling methods. + // ----------------------------------------------------------------------- + bool atEOF() const; + bool getName(XMLBuffer& toFill); + bool getQName(XMLBuffer& toFill, int* colonPosition); + bool getNameToken(XMLBuffer& toFill); + XMLCh getNextChar(); + bool getNextCharIfNot(const XMLCh chNotToGet, XMLCh& chGotten); + void movePlainContentChars(XMLBuffer &dest); + void getSpaces(XMLBuffer& toFill); + void getUpToCharOrWS(XMLBuffer& toFill, const XMLCh toCheck); + bool isEmpty() const; + bool lookingAtChar(const XMLCh toCheck); + bool lookingAtSpace(); + XMLCh peekNextChar(); + bool skipIfQuote(XMLCh& chGotten); + void skipPastChar(const XMLCh toSkip); + void skipPastSpaces(bool& skippedSomething, bool inDecl = false); + void skipPastSpaces(); + void skipToChar(const XMLCh toSkipTo); + bool skippedChar(const XMLCh toSkip); + bool skippedSpace(); + bool skippedString(const XMLCh* const toSkip); + bool skippedStringLong(const XMLCh* const toSkip); + void skipQuotedString(const XMLCh quoteCh); + XMLCh skipUntilIn(const XMLCh* const listToSkip); + XMLCh skipUntilInOrWS(const XMLCh* const listToSkip); + bool peekString(const XMLCh* const toPeek); + + + // ----------------------------------------------------------------------- + // Control methods + // ----------------------------------------------------------------------- + void cleanStackBackTo(const XMLSize_t readerNum); + XMLReader* createReader + ( + const InputSource& src + , const bool xmlDecl + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , const bool calcSrsOfs = true + , XMLSize_t lowWaterMark = 100 + ); + XMLReader* createReader + ( + const XMLCh* const sysId + , const XMLCh* const pubId + , const bool xmlDecl + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , InputSource*& srcToFill + , const bool calcSrcOfs = true + , XMLSize_t lowWaterMark = 100 + , const bool disableDefaultEntityResolution = false + ); + XMLReader* createReader + ( + const XMLCh* const baseURI + , const XMLCh* const sysId + , const XMLCh* const pubId + , const bool xmlDecl + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLReader::Sources source + , InputSource*& srcToFill + , const bool calcSrcOfs = true + , XMLSize_t lowWaterMark = 100 + , const bool disableDefaultEntityResolution = false + ); + XMLReader* createIntEntReader + ( + const XMLCh* const sysId + , const XMLReader::RefFrom refFrom + , const XMLReader::Types type + , const XMLCh* const dataBuf + , const XMLSize_t dataLen + , const bool copyBuf + , const bool calcSrcOfs = true + , XMLSize_t lowWaterMark = 100 + ); + bool isScanningPERefOutOfLiteral() const; + bool pushReader + ( + XMLReader* const reader + , XMLEntityDecl* const entity + ); + void reset(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const XMLCh* getCurrentEncodingStr() const; + const XMLEntityDecl* getCurrentEntity() const; + XMLEntityDecl* getCurrentEntity(); + const XMLReader* getCurrentReader() const; + XMLReader* getCurrentReader(); + XMLSize_t getCurrentReaderNum() const; + XMLSize_t getReaderDepth() const; + void getLastExtEntityInfo(LastExtEntityInfo& lastInfo) const; + XMLFilePos getSrcOffset() const; + bool getThrowEOE() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setEntityHandler(XMLEntityHandler* const newHandler); + void setThrowEOE(const bool newValue); + void setXMLVersion(const XMLReader::XMLVersion version); + void setStandardUriConformant(const bool newValue); + + // ----------------------------------------------------------------------- + // Implement the SAX Locator interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getPublicId() const; + virtual const XMLCh* getSystemId() const; + virtual XMLFileLoc getLineNumber() const; + virtual XMLFileLoc getColumnNumber() const; + + +private : + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + const XMLReader* getLastExtEntity(const XMLEntityDecl*& itsEntity) const; + bool popReader(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ReaderMgr(const ReaderMgr&); + ReaderMgr& operator=(const ReaderMgr&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fCurEntity + // This is the current top of stack entity. We pull it off the stack + // and store it here for efficiency. + // + // fCurReader + // This is the current top of stack reader. We pull it off the + // stack and store it here for efficiency. + // + // fEntityHandler + // This is the installed entity handler. Its installed via the + // scanner but he passes it on to us since we need it the most, in + // process of creating external entity readers. + // + // fEntityStack + // We need to keep up with which of the pushed readers are pushed + // entity values that are being spooled. This is done to avoid the + // problem of recursive definitions. This stack consists of refs to + // EntityDecl objects for the pushed entities. + // + // fNextReaderNum + // This is the reader serial number value. Each new reader that is + // created from this reader is given a successive number. This lets + // us catch things like partial markup errors and such. + // + // fReaderStack + // This is the stack of reader references. We own all the readers + // and destroy them when they are used up. + // + // fThrowEOE + // This flag controls whether we throw an exception when we hit an + // end of entity. The scanner doesn't really need to know about ends + // of entities in the int/ext subsets, so it will turn this flag off + // until it gets into the content usually. + // + // fXMLVersion + // Enum to indicate if each Reader should be created as XML 1.1 or + // XML 1.0 conformant + // + // fStandardUriConformant + // This flag controls whether we force conformant URI + // ----------------------------------------------------------------------- + XMLEntityDecl* fCurEntity; + XMLReader* fCurReader; + XMLEntityHandler* fEntityHandler; + RefStackOf* fEntityStack; + unsigned int fNextReaderNum; + RefStackOf* fReaderStack; + bool fThrowEOE; + XMLReader::XMLVersion fXMLVersion; + bool fStandardUriConformant; + MemoryManager* fMemoryManager; +}; + + + +// --------------------------------------------------------------------------- +// ReaderMgr: Inlined methods +// +// NOTE: We cannot put these in alphabetical and type order as we usually +// do because some of the compilers we have to support are too stupid to +// understand out of order inlines! +// --------------------------------------------------------------------------- +inline XMLSize_t ReaderMgr::getCurrentReaderNum() const +{ + return fCurReader->getReaderNum(); +} + +inline const XMLReader* ReaderMgr::getCurrentReader() const +{ + return fCurReader; +} + +inline XMLReader* ReaderMgr::getCurrentReader() +{ + return fCurReader; +} + +inline bool ReaderMgr::getName(XMLBuffer& toFill) +{ + toFill.reset(); + return fCurReader->getName(toFill, false); +} + +inline bool ReaderMgr::getQName(XMLBuffer& toFill, int *colonPosition) +{ + toFill.reset(); + return fCurReader->getQName(toFill, colonPosition); +} + +inline bool ReaderMgr::getNameToken(XMLBuffer& toFill) +{ + toFill.reset(); + return fCurReader->getName(toFill, true); +} + +inline bool ReaderMgr::getNextCharIfNot(const XMLCh chNotToGet, XMLCh& chGotten) +{ + return fCurReader->getNextCharIfNot(chNotToGet, chGotten); +} + +inline void ReaderMgr::movePlainContentChars(XMLBuffer &dest) +{ + fCurReader->movePlainContentChars(dest); +} + +inline bool ReaderMgr::getThrowEOE() const +{ + return fThrowEOE; +} + +inline XMLFilePos ReaderMgr::getSrcOffset() const +{ + return fCurReader? fCurReader->getSrcOffset() : 0; +} + +inline bool ReaderMgr::lookingAtChar(const XMLCh chToCheck) +{ + return (chToCheck == peekNextChar()); +} + +inline bool ReaderMgr::lookingAtSpace() +{ + XMLCh c = peekNextChar(); + return fCurReader->isWhitespace(c); +} + +inline void ReaderMgr::setThrowEOE(const bool newValue) +{ + fThrowEOE = newValue; +} + +inline void ReaderMgr::setStandardUriConformant(const bool newValue) +{ + fStandardUriConformant = newValue; +} + +inline bool ReaderMgr::skippedString(const XMLCh* const toSkip) +{ + return fCurReader->skippedString(toSkip); +} + +inline bool ReaderMgr::skippedStringLong(const XMLCh* const toSkip) +{ + return fCurReader->skippedStringLong(toSkip); +} + +inline void ReaderMgr::skipToChar(const XMLCh toSkipTo) +{ + XMLCh nextCh = 0; + do + { + // Get chars until we find the one to skip + nextCh = getNextChar(); + } + // Break out at end of input or the char to skip + while((nextCh != toSkipTo) && nextCh!=0); +} + +inline void ReaderMgr::skipPastChar(const XMLCh toSkipPast) +{ + XMLCh nextCh = 0; + do + { + // Get chars until we find the one to skip + nextCh = getNextChar(); + } + while((nextCh != toSkipPast) && nextCh!=0); +} + +inline bool ReaderMgr::peekString(const XMLCh* const toPeek) +{ + return fCurReader->peekString(toPeek); +} + +inline void ReaderMgr::setEntityHandler(XMLEntityHandler* const newHandler) +{ + fEntityHandler = newHandler; +} + +inline void ReaderMgr::setXMLVersion(const XMLReader::XMLVersion version) +{ + fXMLVersion = version; + fCurReader->setXMLVersion(version); +} + +// +// This is a simple class to temporarily change the 'throw at end of entity' +// flag of the reader manager. There are some places where we need to +// turn this on and off on a scoped basis. +// +class XMLPARSER_EXPORT ThrowEOEJanitor +{ +public : + // ----------------------------------------------------------------------- + // Constructors and destructor + // ----------------------------------------------------------------------- + ThrowEOEJanitor(ReaderMgr* mgrTarget, const bool newValue) : + + fOld(mgrTarget->getThrowEOE()) + , fMgr(mgrTarget) + { + mgrTarget->setThrowEOE(newValue); + } + + ~ThrowEOEJanitor() + { + fMgr->setThrowEOE(fOld); + }; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ThrowEOEJanitor(const ThrowEOEJanitor&); + ThrowEOEJanitor& operator=(const ThrowEOEJanitor&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fOld + // The previous value of the flag, which we replaced during ctor, + // and will replace during dtor. + // + // fMgr + // A pointer to the reader manager we are going to set/reset the + // flag on. + // ----------------------------------------------------------------------- + bool fOld; + ReaderMgr* fMgr; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/SGXMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/SGXMLScanner.cpp new file mode 100644 index 000000000..11ad77da9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/SGXMLScanner.cpp @@ -0,0 +1,4932 @@ +/* + * 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: SGXMLScanner.cpp 925236 2010-03-19 14:29:47Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +inline XMLAttDefList& getAttDefList(ComplexTypeInfo* currType, XMLElementDecl* elemDecl); + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ReaderMgrResetType; + + +// --------------------------------------------------------------------------- +// SGXMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +SGXMLScanner::SGXMLScanner( XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(valToAdopt, grammarResolver, manager) + , fSeeXsi(false) + , fGrammarType(Grammar::UnKnown) + , fElemStateSize(16) + , fElemState(0) + , fElemLoopState(0) + , fContent(1023, manager) + , fEntityTable(0) + , fRawAttrList(0) + , fRawAttrColonListSize(32) + , fRawAttrColonList(0) + , fSchemaGrammar(0) + , fSchemaValidator(0) + , fICHandler(0) + , fElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) + , fPSVIAttrList(0) + , fModel(0) + , fPSVIElement(0) + , fErrorStack(0) + , fSchemaInfoList(0) + , fCachedSchemaInfoList(0) +{ + CleanupType cleanup(this, &SGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +SGXMLScanner::SGXMLScanner( XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errHandler + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt, grammarResolver, manager) + , fSeeXsi(false) + , fGrammarType(Grammar::UnKnown) + , fElemStateSize(16) + , fElemState(0) + , fElemLoopState(0) + , fContent(1023, manager) + , fEntityTable(0) + , fRawAttrList(0) + , fRawAttrColonListSize(32) + , fRawAttrColonList(0) + , fSchemaGrammar(0) + , fSchemaValidator(0) + , fICHandler(0) + , fElemNonDeclPool(0) + , fElemCount(0) + , fAttDefRegistry(0) + , fUndeclaredAttrRegistry(0) + , fPSVIAttrList(0) + , fModel(0) + , fPSVIElement(0) + , fErrorStack(0) + , fSchemaInfoList(0) + , fCachedSchemaInfoList(0) +{ + CleanupType cleanup(this, &SGXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +SGXMLScanner::~SGXMLScanner() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- +NameIdPool* SGXMLScanner::getEntityDeclPool() +{ + return 0; +} + +const NameIdPool* SGXMLScanner::getEntityDeclPool() const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// SGXMLScanner: Main entry point to scan a document +// --------------------------------------------------------------------------- +void SGXMLScanner::scanDocument(const InputSource& src) +{ + // Bump up the sequence id for this parser instance. This will invalidate + // any previous progressive scan tokens. + fSequenceId++; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + // Reset the scanner and its plugged in stuff for a new run. This + // resets all the data structures, creates the initial reader and + // pushes it on the stack, and sets up the base document path. + scanReset(src); + + // If we have a document handler, then call the start document + if (fDocHandler) + fDocHandler->startDocument(); + + // Scan the prolog part, which is everything before the root element + // including the DTD subsets. + scanProlog(); + + // If we got to the end of input, then its not a valid XML file. + // Else, go on to scan the content. + if (fReaderMgr.atEOF()) + { + emitError(XMLErrs::EmptyMainEntity); + } + else + { + // Scan content, and tell it its not an external entity + if (scanContent()) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + if (!fReaderMgr.atEOF()) + scanMiscellaneous(); + } + } + + // If we have a document handler, then call the end document + if (fDocHandler) + fDocHandler->endDocument(); + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } +} + + +bool SGXMLScanner::scanNext(XMLPScanToken& token) +{ + // Make sure this token is still legal + if (!isLegalToken(token)) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_BadPScanToken, fMemoryManager); + + // Find the next token and remember the reader id + XMLSize_t orgReader; + XMLTokens curToken; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + bool retVal = true; + + try + { + while (true) + { + // We have to handle any end of entity exceptions that happen here. + // We could be at the end of X nested entities, each of which will + // generate an end of entity exception as we try to move forward. + try + { + curToken = senseNextToken(orgReader); + break; + } + catch(const EndOfEntityException& toCatch) + { + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + if (curToken == Token_CharData) + { + scanCharData(fCDataBuf); + } + else if (curToken == Token_EOF) + { + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + retVal = false; + } + else + { + // Its some sort of markup + bool gotData = true; + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // If we hit the end, then do the miscellaneous part + if (!gotData) + { + // Do post-parse validation if required + if (fValidate) + { + // We handle ID reference semantics at this level since + // its required by XML 1.0. + checkIDRefs(); + + // Then allow the validator to do any extra stuff it wants +// fValidator->postParseValidation(); + } + + // That went ok, so scan for any miscellaneous stuff + scanMiscellaneous(); + + if (toCheckIdentityConstraint()) + fICHandler->endDocument(); + + if (fDocHandler) + fDocHandler->endDocument(); + } + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so return failure + retVal = false; + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so return failure + retVal = false; + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + retVal = false; + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + // If we are not at the end, release the object that will + // reset the ReaderMgr. + if (retVal) + resetReaderMgr.release(); + + return retVal; +} + +// --------------------------------------------------------------------------- +// SGXMLScanner: Private scanning methods +// --------------------------------------------------------------------------- + +// This method is called from scanStartTag() to handle the very raw initial +// scan of the attributes. It just fills in the passed collection with +// key/value pairs for each attribute. No processing is done on them at all. +XMLSize_t +SGXMLScanner::rawAttrScan(const XMLCh* const elemName + , RefVectorOf& toFill + , bool& isEmpty) +{ + // Keep up with how many attributes we've seen so far, and how many + // elements are available in the vector. This way we can reuse old + // elements until we run out and then expand it. + XMLSize_t attCount = 0; + XMLSize_t curVecSize = toFill.size(); + + // Assume it is not empty + isEmpty = false; + + // We loop until we either see a /> or >, handling key/value pairs util + // we get there. We place them in the passed vector, which we will expand + // as required to hold them. + while (true) + { + // Get the next character, which should be non-space + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + // + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + // Ok, skip by them and get another char + fReaderMgr.getNextChar(); + fReaderMgr.skipPastSpaces(); + nextCh = fReaderMgr.peekNextChar(); + } + else + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + int colonPosition; + if (!fReaderMgr.getQName(fAttNameBuf, &colonPosition)) + { + if (fAttNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedAttrName); + else + emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return attCount; + } + + const XMLCh* curAttNameBuf = fAttNameBuf.getRawBuffer(); + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemName); + return attCount; + } + else + { + // Something went really wrong + return attCount; + } + } + + // Next should be the quoted attribute value. We just do a simple + // and stupid scan of this value. The only thing we do here + // is to expand entity references. + if (!basicAttrValueScan(curAttNameBuf, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, elemName); + return attCount; + } + else + { + // Something went really wrong + return attCount; + } + } + + // And now lets add it to the passed collection. If we have not + // filled it up yet, then we use the next element. Else we add + // a new one. + KVStringPair* curPair = 0; + if (attCount >= curVecSize) + { + curPair = new (fMemoryManager) KVStringPair + ( + curAttNameBuf + , fAttNameBuf.getLen() + , fAttValueBuf.getRawBuffer() + , fAttValueBuf.getLen() + , fMemoryManager + ); + toFill.addElement(curPair); + } + else + { + curPair = toFill.elementAt(attCount); + curPair->set + ( + curAttNameBuf + , fAttNameBuf.getLen() + , fAttValueBuf.getRawBuffer() + , fAttValueBuf.getLen() + ); + } + if (attCount >= fRawAttrColonListSize) { + resizeRawAttrColonList(); + } + fRawAttrColonList[attCount] = colonPosition; + + // And bump the count of attributes we've gotten + attCount++; + + // And go to the top again for another attribute + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, elemName); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemName); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + return attCount; +} + + +// This method will kick off the scanning of the primary content of the +// document, i.e. the elements. +bool SGXMLScanner::scanContent() +{ + // Go into a loop until we hit the end of the root element, or we fall + // out because there is no root element. + // + // We have to do kind of a deeply nested double loop here in order to + // avoid doing the setup/teardown of the exception handler on each + // round. Doing it this way we only do it when an exception actually + // occurs. + bool gotData = true; + bool inMarkup = false; + while (gotData) + { + try + { + while (gotData) + { + // Sense what the next top level token is. According to what + // this tells us, we will call something to handle that kind + // of thing. + XMLSize_t orgReader; + const XMLTokens curToken = senseNextToken(orgReader); + + // Handle character data and end of file specially. Char data + // is not markup so we don't want to handle it in the loop + // below. + if (curToken == Token_CharData) + { + // Scan the character data and call appropriate events. Let + // him use our local character data buffer for efficiency. + scanCharData(fCDataBuf); + continue; + } + else if (curToken == Token_EOF) + { + // The element stack better be empty at this point or we + // ended prematurely before all elements were closed. + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + // Its the end of file, so clear the got data flag + gotData = false; + continue; + } + + // We are in some sort of markup now + inMarkup = true; + + // According to the token we got, call the appropriate + // scanning method. + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // And we are back out of markup again + inMarkup = false; + } + } + catch(const EndOfEntityException& toCatch) + { + // If we were in some markup when this happened, then its a + // partial markup error. + if (inMarkup) + emitError(XMLErrs::PartialMarkupInEntity); + + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + + inMarkup = false; + } + } + + // It went ok, so return success + return true; +} + + +void SGXMLScanner::scanEndTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the end of the root element. + gotData = true; + + // Check if the element stack is empty. If so, then this is an unbalanced + // element (i.e. more ends than starts, perhaps because of bad text + // causing one to be skipped.) + if (fElemStack.isEmpty()) + { + emitError(XMLErrs::MoreEndThanStartTags); + fReaderMgr.skipPastChar(chCloseAngle); + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd, fMemoryManager); + } + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + unsigned int uriId = (fDoNamespaces) + ? fElemStack.getCurrentURI() : fEmptyNamespaceId; + + // Make sure that its the end of the element that we expect + const XMLCh *elemName = fElemStack.getCurrentSchemaElemName(); + const ElemStack::StackElem* topElem = fElemStack.topElement(); + if (!fReaderMgr.skippedStringLong(elemName)) + { + emitError + ( + XMLErrs::ExpectedEndOfTagX + , elemName + ); + fReaderMgr.skipPastChar(chCloseAngle); + fElemStack.popTop(); + return; + } + + fPSVIElemContext.fErrorOccurred = fErrorStack->pop(); + + // Make sure we are back on the same reader as where we started + if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialTagMarkupError); + + // Skip optional whitespace + fReaderMgr.skipPastSpaces(); + + // Make sure we find the closing bracket + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError + ( + XMLErrs::UnterminatedEndTag + , topElem->fThisElement->getFullName() + ); + } + + if (fValidate && topElem->fThisElement->isDeclared()) + { + fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + if(!fPSVIElemContext.fCurrentTypeInfo) + fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + else + fPSVIElemContext.fCurrentDV = 0; + if (fPSVIHandler) + { + fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue(); + + if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString)) + fPSVIElemContext.fNormalizedValue = 0; + + } + } + else + { + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; + } + + // If validation is enabled, then lets pass him the list of children and + // this element and let him validate it. + DatatypeValidator* psviMemberType = 0; + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent + ( + topElem->fThisElement + , topElem->fChildren + , topElem->fChildCount + , &failure + ); + + if (!res) + { + // One of the elements is not valid for the content. NOTE that + // if no children were provided but the content model requires + // them, it comes back with a zero value. But we cannot use that + // to index the child array in this case, and have to put out a + // special message. + if (!topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::EmptyNotValidForContent + , topElem->fThisElement->getFormattedContentModel() + ); + } + else if (failure >= topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::NotEnoughElemsForCM + , topElem->fThisElement->getFormattedContentModel() + ); + } + else + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , topElem->fChildren[failure]->getRawName() + , topElem->fThisElement->getFormattedContentModel() + ); + } + + } + + // update PSVI info + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + fPSVIElemContext.fErrorOccurred = true; + else if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union) + psviMemberType = fValidationContext->getValidatingMemberType(); + if (fPSVIHandler) + { + fPSVIElemContext.fIsSpecified = ((SchemaValidator*) fValidator)->getIsElemSpecified(); + if(fPSVIElemContext.fIsSpecified) + fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl *)topElem->fThisElement)->getDefaultValue(); + } + + // call matchers and de-activate context + if (toCheckIdentityConstraint()) + { + fICHandler->deactivateContext + ( + (SchemaElementDecl *) topElem->fThisElement + , fContent.getRawBuffer() + , fValidationContext + , fPSVIElemContext.fCurrentDV + ); + } + + } + + // QName dv needed topElem to resolve URIs on the checkContent + fElemStack.popTop(); + + // See if it was the root element, to avoid multiple calls below + const bool isRoot = fElemStack.isEmpty(); + + if (fPSVIHandler) + { + endElementPSVI + ( + (SchemaElementDecl*)topElem->fThisElement, psviMemberType + ); + } + // now we can reset the datatype buffer, since the + // application has had a chance to copy the characters somewhere else + ((SchemaValidator *)fValidator)->clearDatatypeBuffer(); + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + if (fGrammarType == Grammar::SchemaGrammarType) { + if (topElem->fPrefixColonPos != -1) + fPrefixBuf.set(elemName, topElem->fPrefixColonPos); + else + fPrefixBuf.reset(); + } + else { + fPrefixBuf.set(topElem->fThisElement->getElementName()->getPrefix()); + } + fDocHandler->endElement + ( + *topElem->fThisElement + , uriId + , isRoot + , fPrefixBuf.getRawBuffer() + ); + } + + if (!isRoot) + { + // update error information + fErrorStack->push((fErrorStack->size() && fErrorStack->pop()) || fPSVIElemContext.fErrorOccurred); + } + + // If this was the root, then done with content + gotData = !isRoot; + + if (gotData) { + + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + fValidator->setGrammar(fGrammar); + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } +} + + +// This method handles the high level logic of scanning the DOCType +// declaration. This calls the DTDScanner and kicks off both the scanning of +// the internal subset and the scanning of the external subset, if any. +// +// When we get here the ', />, or attributes followed +// by one of those sequences. +bool SGXMLScanner::scanStartTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Reset element content + fContent.reset(); + + // The current position is after the open bracket, so we need to read in + // in the element name. + int prefixColonPos; + if (!fReaderMgr.getQName(fQNameBuf, &prefixColonPos)) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // First we have to do the rawest attribute scan. We don't do any + // normalization of them at all, since we don't know yet what type they + // might be (since we need the element decl in order to do that.) + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + bool isEmpty; + XMLSize_t attCount = rawAttrScan + ( + qnameRawBuf + , *fRawAttrList + , isEmpty + ); + + // save the contentleafname and currentscope before addlevel, for later use + ContentLeafNameTypeVector* cv = 0; + XMLContentModel* cm = 0; + unsigned int currentScope = Grammar::TOP_LEVEL_SCOPE; + bool laxThisOne = false; + if (!isRoot) + { + // schema validator will have correct type if validating + SchemaElementDecl* tempElement = (SchemaElementDecl*) + fElemStack.topElement()->fThisElement; + SchemaElementDecl::ModelTypes modelType = tempElement->getModelType(); + ComplexTypeInfo *currType = 0; + + if (fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (currType) + modelType = (SchemaElementDecl::ModelTypes)currType->getContentType(); + else // something must have gone wrong + modelType = SchemaElementDecl::Any; + } + else + { + currType = tempElement->getComplexTypeInfo(); + } + + if ((modelType == SchemaElementDecl::Mixed_Simple) + || (modelType == SchemaElementDecl::Mixed_Complex) + || (modelType == SchemaElementDecl::Children)) + { + cm = currType->getContentModel(); + cv = cm->getContentLeafNameTypeVector(); + currentScope = fElemStack.getCurrentScope(); + } + else if (modelType == SchemaElementDecl::Any) { + laxThisOne = true; + } + } + + // Now, since we might have to update the namespace map for this element, + // but we don't have the element decl yet, we just tell the element stack + // to expand up to get ready. + XMLSize_t elemDepth = fElemStack.addLevel(); + fElemStack.setValidationFlag(fValidate); + fElemStack.setPrefixColonPos(prefixColonPos); + + // Check if there is any external schema location specified, and if we are at root, + // go through them first before scanning those specified in the instance document + if (isRoot + && (fExternalSchemaLocation || fExternalNoNamespaceSchemaLocation)) { + + if (fExternalSchemaLocation) + parseSchemaLocation(fExternalSchemaLocation, true); + if (fExternalNoNamespaceSchemaLocation) + resolveSchemaGrammar(fExternalNoNamespaceSchemaLocation, XMLUni::fgZeroLenString, true); + } + + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + if (attCount) + scanRawAttrListforNameSpaces(attCount); + + // Resolve the qualified name to a URI and name so that we can look up + // the element decl for this element. We have now update the prefix to + // namespace map so we should get the correct element now. + unsigned int uriId = resolveQNameWithColon + ( + qnameRawBuf + , fPrefixBuf + , ElemStack::Mode_Element + , prefixColonPos + ); + + //if schema, check if we should lax or skip the validation of this element + bool parentValidation = fValidate; + if (cv) { + QName element(fPrefixBuf.getRawBuffer(), &qnameRawBuf[prefixColonPos + 1], uriId, fMemoryManager); + // elementDepth will be > 0, as cv is only constructed if element is not + // root. + laxThisOne = laxElementValidation(&element, cv, cm, elemDepth - 1); + } + + // Look up the element now in the grammar. This will get us back a + // generic element decl object. We tell him to fault one in if he does + // not find it. + XMLElementDecl* elemDecl = 0; + bool wasAdded = false; + const XMLCh* nameRawBuf = &qnameRawBuf[prefixColonPos + 1]; + const XMLCh* original_uriStr = fGrammar->getTargetNamespace(); + + if (uriId != fEmptyNamespaceId) { + + // Check in current grammar before switching if necessary + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , currentScope + ); + if(!elemDecl) + { + // look in the list of undeclared elements, as would have been done + // before we made grammars stateless: + elemDecl = fElemNonDeclPool->getByKey(nameRawBuf, uriId, currentScope); + } + // this is initialized correctly only if there is + // no element decl. The other uses in this scope will only + // be encountered if there continues to be no element decl--which + // implies that this will have been initialized correctly. + unsigned int orgGrammarUri = uriId; + if (!elemDecl && ( orgGrammarUri = fURIStringPool->getId(original_uriStr)) != uriId) { + // not found, switch to the specified grammar + const XMLCh* uriStr = getURIText(uriId); + bool errorCondition = !switchGrammar(uriStr) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + ,uriStr + ); + } + + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , currentScope + ); + } + + if (!elemDecl && currentScope != Grammar::TOP_LEVEL_SCOPE) { + // if not found, then it may be a reference, try TOP_LEVEL_SCOPE + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , Grammar::TOP_LEVEL_SCOPE + ); + if(!elemDecl) + { + // look in the list of undeclared elements, as would have been done + // before we made grammars stateless: + elemDecl = fElemNonDeclPool->getByKey(nameRawBuf, uriId, (int)Grammar::TOP_LEVEL_SCOPE); + } + if(!elemDecl) { + // still not found in specified uri + // try emptyNamespace see if element should be un-qualified. + // Use a temp variable until we decide this is the case + XMLElementDecl* tempElemDecl = fGrammar->getElemDecl + ( + fEmptyNamespaceId + , nameRawBuf + , qnameRawBuf + , currentScope + ); + if (tempElemDecl && tempElemDecl->getCreateReason() != XMLElementDecl::JustFaultIn && fValidate) { + fValidator->emitError + ( + XMLValid::ElementNotUnQualified + , qnameRawBuf + ); + elemDecl = tempElemDecl; + } + } + } + + if (!elemDecl) { + // still not found, fault this in and issue error later + // switch back to original grammar first (if necessary) + if(orgGrammarUri != uriId) + { + switchGrammar(original_uriStr); + } + elemDecl = new (fMemoryManager) SchemaElementDecl + ( + fPrefixBuf.getRawBuffer() + , nameRawBuf + , uriId + , SchemaElementDecl::Any + , Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + elemDecl->setId(fElemNonDeclPool->put((void*)elemDecl->getBaseName(), uriId, currentScope, (SchemaElementDecl*)elemDecl)); + wasAdded = true; + } + } + else if (!elemDecl) + { + //the element has no prefix, + //thus it is either a non-qualified element defined in current targetNS + //or an element that is defined in the globalNS + + //try unqualifed first + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , currentScope + ); + if(!elemDecl) + { + // look in the list of undeclared elements, as would have been done + // before we made grammars stateless: + elemDecl = fElemNonDeclPool->getByKey(nameRawBuf, uriId, currentScope); + } + // this is initialized correctly only if there is + // no element decl. The other uses in this scope will only + // be encountered if there continues to be no element decl--which + // implies that this will have been initialized correctly. + unsigned int orgGrammarUri = fEmptyNamespaceId; + if (!elemDecl && (orgGrammarUri = fURIStringPool->getId(original_uriStr)) != fEmptyNamespaceId) { + //not found, switch grammar and try globalNS + bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + , XMLUni::fgZeroLenString + ); + } + + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , currentScope + ); + } + + if (!elemDecl && currentScope != Grammar::TOP_LEVEL_SCOPE) { + // if not found, then it may be a reference, try TOP_LEVEL_SCOPE + elemDecl = fGrammar->getElemDecl + ( + uriId + , nameRawBuf + , qnameRawBuf + , Grammar::TOP_LEVEL_SCOPE + ); + if(!elemDecl) + { + // look in the list of undeclared elements, as would have been done + // before we made grammars stateless: + elemDecl = fElemNonDeclPool->getByKey(nameRawBuf, uriId, (int)Grammar::TOP_LEVEL_SCOPE); + } + if (!elemDecl && orgGrammarUri != fEmptyNamespaceId) { + // still Not found in specified uri + // go to original Grammar again to see if element needs to be fully qualified. + bool errorCondition = !switchGrammar(original_uriStr) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + ,original_uriStr + ); + } + + // Use a temp variable until we decide this is the case + XMLElementDecl* tempElemDecl = fGrammar->getElemDecl + ( + orgGrammarUri + , nameRawBuf + , qnameRawBuf + , currentScope + ); + if (tempElemDecl && tempElemDecl->getCreateReason() != XMLElementDecl::JustFaultIn && fValidate) { + fValidator->emitError + ( + XMLValid::ElementNotQualified + , qnameRawBuf + ); + elemDecl=tempElemDecl; + } + } + } + + if (!elemDecl) { + // still not found, fault this in and issue error later + // switch back to original grammar first (if necessary) + if(orgGrammarUri != fEmptyNamespaceId) + { + switchGrammar(original_uriStr); + } + elemDecl = new (fMemoryManager) SchemaElementDecl + ( + fPrefixBuf.getRawBuffer() + , nameRawBuf + , uriId + , SchemaElementDecl::Any + , Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + elemDecl->setId(fElemNonDeclPool->put((void*)elemDecl->getBaseName(), uriId, currentScope, (SchemaElementDecl*)elemDecl)); + wasAdded = true; + } + } + + // this info needed for DOMTypeInfo + fPSVIElemContext.fErrorOccurred = false; + + // We do something different here according to whether we found the + // element or not. + bool bXsiTypeSet= (fValidator)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false; + if (wasAdded) + { + if (laxThisOne && !bXsiTypeSet) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + + // If validating then emit an error + if (fValidate) + { + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the grammar pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + if(!bXsiTypeSet) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + } + } + else + { + // If its not marked declared and validating, then emit an error + if (!elemDecl->isDeclared()) { + if(elemDecl->getCreateReason() == XMLElementDecl::NoReason) { + if(!bXsiTypeSet) + fPSVIElemContext.fErrorOccurred = true; + } + if (laxThisOne) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + + if (fValidate && !bXsiTypeSet) + { + fValidator->emitError + ( + XMLValid::ElementNotDefined + , elemDecl->getFullName() + ); + } + } + } + + + // Now we can update the element stack to set the current element + // decl. We expanded the stack above, but couldn't store the element + // decl because we didn't know it yet. + fElemStack.setElement(elemDecl, fReaderMgr.getCurrentReaderNum()); + fElemStack.setCurrentURI(uriId); + + if (isRoot) + { + fRootGrammar = fGrammar; + fRootElemName = XMLString::replicate(qnameRawBuf, fMemoryManager); + } + + if (fPSVIHandler) + { + fPSVIElemContext.fElemDepth++; + + if (elemDecl->isDeclared()) + { + fPSVIElemContext.fNoneValidationDepth = fPSVIElemContext.fElemDepth; + } + else + { + fPSVIElemContext.fFullValidationDepth = fPSVIElemContext.fElemDepth; + + /****** + * While we report an error for historical reasons, this should + * actually result in lax assessment - NG. + if (isRoot && fValidate) + fPSVIElemContext.fErrorOccurred = true; + ******/ + } + } + + // Validate the element + if (fValidate) + { + fValidator->validateElement(elemDecl); + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + fPSVIElemContext.fErrorOccurred = true; + } + + // squirrel away the element's QName, so that we can do an efficient + // end-tag match + fElemStack.setCurrentSchemaElemName(fQNameBuf.getRawBuffer()); + + ComplexTypeInfo* typeinfo = (fValidate) + ? ((SchemaValidator*)fValidator)->getCurrentTypeInfo() + : ((SchemaElementDecl*) elemDecl)->getComplexTypeInfo(); + + if (typeinfo) { + currentScope = typeinfo->getScopeDefined(); + + // switch grammar if the typeinfo has a different grammar (happens when there is xsi:type) + XMLCh* typeName = typeinfo->getTypeName(); + const int comma = XMLString::indexOf(typeName, chComma); + if (comma > 0) { + XMLBuffer prefixBuf(comma+1, fMemoryManager); + prefixBuf.append(typeName, comma); + const XMLCh* uriStr = prefixBuf.getRawBuffer(); + + bool errorCondition = !switchGrammar(uriStr) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + , prefixBuf.getRawBuffer() + ); + } + } + else if (comma == 0) { + bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString) && fValidate; + if (errorCondition && !laxThisOne) + { + fValidator->emitError + ( + XMLValid::GrammarNotFound + , XMLUni::fgZeroLenString + ); + } + } + } + fElemStack.setCurrentScope(currentScope); + + // Set element next state + if (elemDepth >= fElemStateSize) { + resizeElemState(); + } + + fElemState[elemDepth] = 0; + fElemLoopState[elemDepth] = 0; + fElemStack.setCurrentGrammar(fGrammar); + + // If this is the first element and we are validating, check the root + // element. + if (!isRoot && parentValidation) + { + // If the element stack is not empty, then add this element as a + // child of the previous top element. If its empty, this is the root + // elem and is not the child of anything. + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // PSVI handling: must reset this, even if no attributes... + if(getPSVIHandler()) + fPSVIAttrList->reset(); + + // Now lets get the fAttrList filled in. This involves faulting in any + // defaulted and fixed attributes and normalizing the values of any that + // we got explicitly. + // + // We update the attCount value with the total number of attributes, but + // it goes in with the number of values we got during the raw scan of + // explictly provided attrs above. + attCount = buildAttList(*fRawAttrList, attCount, elemDecl, *fAttrList); + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // activate identity constraints + if (toCheckIdentityConstraint()) + { + fICHandler->activateIdentityConstraint + ( + (SchemaElementDecl*) elemDecl + , (int) elemDepth + , uriId + , fPrefixBuf.getRawBuffer() + , *fAttrList + , attCount + , fValidationContext + ); + + } + + // Since the element may have default values, call start tag now regardless if it is empty or not + // If we have a document handler, then tell it about this start tag + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , uriId + , fPrefixBuf.getRawBuffer() + , *fAttrList + , attCount + , false + , isRoot + ); + } // may be where we output something... + + // if we have a PSVIHandler, now's the time to call + // its handleAttributesPSVI method: + if(fPSVIHandler) + { + QName *eName = elemDecl->getElementName(); + fPSVIHandler->handleAttributesPSVI + ( + eName->getLocalPart() + , fURIStringPool->getValueForId(eName->getURI()) + , fPSVIAttrList + ); + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // reset current type info + DatatypeValidator* psviMemberType = 0; + if (fGrammarType == Grammar::SchemaGrammarType) + { + if (fValidate && elemDecl->isDeclared()) + { + fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + if(!fPSVIElemContext.fCurrentTypeInfo) + fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + else + fPSVIElemContext.fCurrentDV = 0; + if(fPSVIHandler) + { + fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue(); + + if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString)) + fPSVIElemContext.fNormalizedValue = 0; + } + } + else + { + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; + } + } + + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + // REVISIT: in the case of xsi:type, this may + // return the wrong string... + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , elemDecl->getFullName() + , elemDecl->getFormattedContentModel() + ); + } + + if (((SchemaValidator*) fValidator)->getErrorOccurred()) + fPSVIElemContext.fErrorOccurred = true; + // note that if we're empty, won't be a current DV + else + { + if (fPSVIHandler) + { + fPSVIElemContext.fIsSpecified = ((SchemaValidator*) fValidator)->getIsElemSpecified(); + if(fPSVIElemContext.fIsSpecified) + fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl *)elemDecl)->getDefaultValue(); + } + if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union) + psviMemberType = fValidationContext->getValidatingMemberType(); + } + + // call matchers and de-activate context + if (toCheckIdentityConstraint()) + { + fICHandler->deactivateContext + ( + (SchemaElementDecl *) elemDecl + , fContent.getRawBuffer() + , fValidationContext + , fPSVIElemContext.fCurrentDV + ); + } + + } + else if (fGrammarType == Grammar::SchemaGrammarType) { + ((SchemaValidator*)fValidator)->resetNillable(); + } + + if (fPSVIHandler) + { + endElementPSVI + ( + (SchemaElementDecl*)elemDecl, psviMemberType + ); + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + fDocHandler->endElement + ( + *elemDecl + , uriId + , isRoot + , fPrefixBuf.getRawBuffer() + ); + } + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + else + { + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + fValidator->setGrammar(fGrammar); + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } + } + else // not empty + { + + // send a partial element psvi + if (fPSVIHandler) + { + + ComplexTypeInfo* curTypeInfo = 0; + DatatypeValidator* curDV = 0; + XSTypeDefinition* typeDef = 0; + + if (fValidate && elemDecl->isDeclared()) + { + curTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo(); + + if (curTypeInfo) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(curTypeInfo); + } + else + { + curDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + + if (curDV) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(curDV); + } + } + } + + fPSVIElement->reset + ( + PSVIElement::VALIDITY_NOTKNOWN + , PSVIElement::VALIDATION_NONE + , fRootElemName + , ((SchemaValidator*) fValidator)->getIsElemSpecified() + , (elemDecl->isDeclared()) ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0 + , typeDef + , 0 //memberType + , fModel + , ((SchemaElementDecl*)elemDecl)->getDefaultValue() + , 0 + , 0 + , 0 + ); + + + fPSVIHandler->handlePartialElementPSVI + ( + elemDecl->getBaseName() + , fURIStringPool->getValueForId(elemDecl->getURI()) + , fPSVIElement + ); + + } + + fErrorStack->push(fPSVIElemContext.fErrorOccurred); + } + + return true; +} + + +// --------------------------------------------------------------------------- +// SGXMLScanner: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* SGXMLScanner::loadGrammar(const InputSource& src + , const short grammarType + , const bool toCache) +{ + Grammar* loadedGrammar = 0; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + fGrammarResolver->cacheGrammarFromParse(false); + // if the new grammar has to be cached, better use the already cached + // grammars, or the an exception will be thrown when caching an already + // cached grammar + fGrammarResolver->useCachedGrammarInParse(toCache); + fRootGrammar = 0; + + if (fValScheme == Val_Auto) { + fValidate = true; + } + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fSeeXsi = false; + + if (grammarType == Grammar::SchemaGrammarType) { + loadedGrammar = loadXMLSchemaGrammar(src, toCache); + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + return loadedGrammar; +} + +void SGXMLScanner::resetCachedGrammar () +{ + fCachedSchemaInfoList->removeAll (); +} + +// --------------------------------------------------------------------------- +// SGXMLScanner: Private helper methods +// --------------------------------------------------------------------------- +// This method handles the common initialization, to avoid having to do +// it redundantly in multiple constructors. +void SGXMLScanner::commonInit() +{ + // Create the element state array + fElemState = (unsigned int*) fMemoryManager->allocate + ( + fElemStateSize * sizeof(unsigned int) + ); //new unsigned int[fElemStateSize]; + fElemLoopState = (unsigned int*) fMemoryManager->allocate + ( + fElemStateSize * sizeof(unsigned int) + ); //new unsigned int[fElemStateSize]; + + // And we need one for the raw attribute scan. This just stores key/ + // value string pairs (prior to any processing.) + fRawAttrList = new (fMemoryManager) RefVectorOf(32, true, fMemoryManager); + fRawAttrColonList = (int*) fMemoryManager->allocate + ( + fRawAttrColonListSize * sizeof(int) + ); + + // Create the Validator and init them + fSchemaValidator = new (fMemoryManager) SchemaValidator(0, fMemoryManager); + initValidator(fSchemaValidator); + + // Create IdentityConstraint info + fICHandler = new (fMemoryManager) IdentityConstraintHandler(this, fMemoryManager); + + // Add the default entity entries for the character refs that must always + // be present. + fEntityTable = new (fMemoryManager) ValueHashTableOf(11, fMemoryManager); + fEntityTable->put((void*) XMLUni::fgAmp, chAmpersand); + fEntityTable->put((void*) XMLUni::fgLT, chOpenAngle); + fEntityTable->put((void*) XMLUni::fgGT, chCloseAngle); + fEntityTable->put((void*) XMLUni::fgQuot, chDoubleQuote); + fEntityTable->put((void*) XMLUni::fgApos, chSingleQuote); + fElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + fAttDefRegistry = new (fMemoryManager) RefHashTableOf + ( + 131, false, fMemoryManager + ); + fUndeclaredAttrRegistry = new (fMemoryManager) Hash2KeysSetOf(7, fMemoryManager); + fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager); + + fSchemaInfoList = new (fMemoryManager) RefHash2KeysTableOf(29, fMemoryManager); + fCachedSchemaInfoList = new (fMemoryManager) RefHash2KeysTableOf(29, fMemoryManager); + + if (fValidator) + { + if (!fValidator->handlesSchema()) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoSchemaValidator, fMemoryManager); + } + else + { + fValidator = fSchemaValidator; + } +} + +void SGXMLScanner::cleanUp() +{ + fMemoryManager->deallocate(fElemState); //delete [] fElemState; + fMemoryManager->deallocate(fElemLoopState); //delete [] fElemLoopState; + delete fSchemaGrammar; + delete fEntityTable; + delete fRawAttrList; + fMemoryManager->deallocate(fRawAttrColonList); + delete fSchemaValidator; + delete fICHandler; + delete fElemNonDeclPool; + delete fAttDefRegistry; + delete fUndeclaredAttrRegistry; + delete fPSVIAttrList; + if (fPSVIElement) + delete fPSVIElement; + + if (fErrorStack) + delete fErrorStack; + + delete fSchemaInfoList; + delete fCachedSchemaInfoList; +} + +void SGXMLScanner::resizeElemState() { + + unsigned int newSize = fElemStateSize * 2; + unsigned int* newElemState = (unsigned int*) fMemoryManager->allocate + ( + newSize * sizeof(unsigned int) + ); //new unsigned int[newSize]; + unsigned int* newElemLoopState = (unsigned int*) fMemoryManager->allocate + ( + newSize * sizeof(unsigned int) + ); //new unsigned int[newSize]; + + // Copy the existing values + unsigned int index = 0; + for (; index < fElemStateSize; index++) + { + newElemState[index] = fElemState[index]; + newElemLoopState[index] = fElemLoopState[index]; + } + + for (; index < newSize; index++) + newElemLoopState[index] = newElemState[index] = 0; + + // Delete the old array and udpate our members + fMemoryManager->deallocate(fElemState); //delete [] fElemState; + fMemoryManager->deallocate(fElemLoopState); //delete [] fElemLoopState; + fElemState = newElemState; + fElemLoopState = newElemLoopState; + fElemStateSize = newSize; +} + +void SGXMLScanner::resizeRawAttrColonList() { + + unsigned int newSize = fRawAttrColonListSize * 2; + int* newRawAttrColonList = (int*) fMemoryManager->allocate + ( + newSize * sizeof(int) + ); //new int[newSize]; + + // Copy the existing values + unsigned int index = 0; + for (; index < fRawAttrColonListSize; index++) + newRawAttrColonList[index] = fRawAttrColonList[index]; + + // Delete the old array and udpate our members + fMemoryManager->deallocate(fRawAttrColonList); //delete [] fRawAttrColonList; + fRawAttrColonList = newRawAttrColonList; + fRawAttrColonListSize = newSize; +} + +// This method is called from scanStartTag() to build up the list of +// XMLAttr objects that will be passed out in the start tag callout. We +// get the key/value pairs from the raw scan of explicitly provided attrs, +// which have not been normalized. And we get the element declaration from +// which we will get any defaulted or fixed attribute defs and add those +// in as well. +XMLSize_t +SGXMLScanner::buildAttList(const RefVectorOf& providedAttrs + , const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill) +{ + // Ask the element to clear the 'provided' flag on all of the att defs + // that it owns, and to return us a boolean indicating whether it has + // any defs. + DatatypeValidator *currDV = 0; + ComplexTypeInfo *currType = 0; + + if (fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (!currType) { + currDV = ((SchemaValidator*)fValidator)->getCurrentDatatypeValidator(); + } + } + + const bool hasDefs = (currType && fValidate) + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); + + fElemCount++; + + // If there are no expliclitily provided attributes and there are no + // defined attributes for the element, the we don't have anything to do. + // So just return zero in this case. + if (!hasDefs && !attCount) + return 0; + + // Keep up with how many attrs we end up with total + XMLSize_t retCount = 0; + + // And get the current size of the output vector. This lets us use + // existing elements until we fill it, then start adding new ones. + const XMLSize_t curAttListSize = toFill.size(); + + // We need a buffer into which raw scanned attribute values will be + // normalized. + XMLBufBid bbNormal(&fBufMgr); + XMLBuffer& normBuf = bbNormal.getBuffer(); + + XMLBufBid bbPrefix(&fBufMgr); + XMLBuffer& prefixBuf = bbPrefix.getBuffer(); + + // Loop through our explicitly provided attributes, which are in the raw + // scanned form, and build up XMLAttr objects. + XMLSize_t index; + const XMLCh* prefPtr, *suffPtr; + for (index = 0; index < attCount; index++) + { + PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID; + PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL; + const KVStringPair* curPair = providedAttrs.elementAt(index); + + // We have to split the name into its prefix and name parts. Then + // we map the prefix to its URI. + const XMLCh* const namePtr = curPair->getKey(); + + const int colonInd = fRawAttrColonList[index]; + unsigned int uriId; + if (colonInd != -1) + { + prefixBuf.set(namePtr, colonInd); + prefPtr = prefixBuf.getRawBuffer(); + suffPtr = namePtr + colonInd + 1; + // Map the prefix to a URI id + uriId = resolvePrefix(prefPtr, ElemStack::Mode_Attribute); + } + else + { + // No colon, so we just have a name with no prefix + prefPtr = XMLUni::fgZeroLenString; + suffPtr = namePtr; + // an empty prefix is always the empty namespace, when dealing with attributes + uriId = fEmptyNamespaceId; + } + + // If the uri comes back as the xmlns or xml URI or its just a name + // and that name is 'xmlns', then we handle it specially. So set a + // boolean flag that lets us quickly below know which we are dealing + // with. + const bool isNSAttr = (uriId == fEmptyNamespaceId)? + XMLString::equals(suffPtr, XMLUni::fgXMLNSString) : + (uriId == fXMLNSNamespaceId || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI)); + + // If its not a special case namespace attr of some sort, then we + // do normal checking and processing. + XMLAttDef::AttTypes attType = XMLAttDef::CData; + DatatypeValidator *attrValidator = 0; + PSVIAttribute *psviAttr = 0; + bool otherXSI = false; + + if (isNSAttr) + { + if(!fUndeclaredAttrRegistry->putIfNotPresent(suffPtr, uriId)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + else + { + bool ValueValidate = false; + bool tokenizeBuffer = false; + + if (uriId == fXMLNSNamespaceId) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + } + else if (XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI)) + { + if (XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_BOOLEAN); + + ValueValidate = true; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_SCHEMALOCATION)) + { + // use anyURI as the validator + // tokenize the data and use the anyURI data for each piece + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + //We should validate each value in the schema location however + //this lead to a performance degradation of around 4%. Since + //the first value of each pair needs to match what is in the + //schema document and the second value needs to be valid in + //order to open the document we won't validate it. Need to + //do performance analysis of the anyuri datatype. + //ValueValidate = true; + ValueValidate = false; + tokenizeBuffer = true; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCATION)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI); + //We should validate this value however + //this lead to a performance degradation of around 4%. Since + //the value needs to be valid in + //order to open the document we won't validate it. Need to + //do performance analysis of the anyuri datatype. + //ValueValidate = true; + ValueValidate = false; + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE)) + { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_QNAME); + + ValueValidate = true; + } + else { + otherXSI = true; + } + } + + if (!otherXSI) { + normalizeAttRawValue + ( + namePtr + , curPair->getValue() + , normBuf + ); + + if (fValidate && attrValidator && ValueValidate) + { + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(attrValidator, normBuf.getRawBuffer(), normBuf, true); + + ValidationContext* const theContext = + getValidationContext(); + + if (theContext) + { + try + { + if (tokenizeBuffer) { + XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager); + while (tokenizer.hasMoreTokens()) { + attrValidator->validate( + tokenizer.nextToken(), + theContext, + fMemoryManager); + } + } + else { + attrValidator->validate( + normBuf.getRawBuffer(), + theContext, + fMemoryManager); + } + } + catch (const XMLException& idve) + { + fValidator->emitError (XMLValid::DatatypeError, idve.getCode(), idve.getMessage()); + } + } + } + + if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType) + { + psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); + XSSimpleTypeDefinition *validatingType = (attrValidator) + ? (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator) + : 0; + // no attribute declarations for these... + psviAttr->reset( + fRootElemName + , PSVIItem::VALIDITY_NOTKNOWN + , PSVIItem::VALIDATION_NONE + , validatingType + , 0 + , 0 + , false + , 0 + , attrValidator + ); + } + } + } + } + + if (!isNSAttr || otherXSI) + { + // Some checking for attribute wild card first (for schema) + bool laxThisOne = false; + bool skipThisOne = false; + + XMLAttDef* attDefForWildCard = 0; + XMLAttDef* attDef = 0; + + if (fGrammarType == Grammar::SchemaGrammarType) { + + //retrieve the att def + SchemaAttDef* attWildCard = 0; + if (currType) { + attDef = currType->getAttDef(suffPtr, uriId); + attWildCard = currType->getAttWildCard(); + } + else if (!currDV) { // check explicitly-set wildcard + attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard(); + } + + // if not found or faulted in - check for a matching wildcard attribute + // if no matching wildcard attribute, check (un)qualifed cases and flag + // appropriate errors + if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) { + + if (attWildCard) { + //if schema, see if we should lax or skip the validation of this attribute + if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) { + + if(!skipThisOne) + { + SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId)); + if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) { + RefHashTableOf* attRegistry = sGrammar->getAttributeDeclRegistry(); + if (attRegistry) { + attDefForWildCard = attRegistry->get(suffPtr); + } + } + } + } + } + else if (currType) { + // not found, see if the attDef should be qualified or not + if (uriId == fEmptyNamespaceId) { + attDef = currType->getAttDef(suffPtr, fURIStringPool->getId(fGrammar->getTargetNamespace())); + if (fValidate + && attDef + && attDef->getCreateReason() != XMLAttDef::JustFaultIn) { + // the attribute should be qualified + fValidator->emitError + ( + XMLValid::AttributeNotQualified + , attDef->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + } + else { + attDef = currType->getAttDef(suffPtr, fEmptyNamespaceId); + if (fValidate + && attDef + && attDef->getCreateReason() != XMLAttDef::JustFaultIn) { + // the attribute should be qualified + fValidator->emitError + ( + XMLValid::AttributeNotUnQualified + , attDef->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + } + } + } + } + + // now need to prepare for duplicate detection + if(attDef) + { + unsigned int *curCountPtr = fAttDefRegistry->get(attDef); + if(!curCountPtr) + { + curCountPtr = getNewUIntPtr(); + *curCountPtr = fElemCount; + fAttDefRegistry->put(attDef, curCountPtr); + } + else if(*curCountPtr < fElemCount) + *curCountPtr = fElemCount; + else + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , attDef->getFullName() + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + } + else + { + if(!fUndeclaredAttrRegistry->putIfNotPresent(suffPtr, uriId)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , namePtr + , elemDecl->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + } + + // if we've found either an attDef or an attDefForWildCard, + // then we're doing full validation and it may still be valid. + if(!attDef && !attDefForWildCard) + { + if(!laxThisOne && !skipThisOne) + { + fPSVIElemContext.fErrorOccurred = true; + } + if(getPSVIHandler()) + { + if(!laxThisOne && !skipThisOne) + { + attrValid = PSVIItem::VALIDITY_INVALID; + } + else if(laxThisOne) + { + attrValid = PSVIItem::VALIDITY_NOTKNOWN; + attrAssessed = PSVIItem::VALIDATION_PARTIAL; + } + else + { + attrValid = PSVIItem::VALIDITY_NOTKNOWN; + attrAssessed = PSVIItem::VALIDATION_NONE; + } + } + } + + bool errorCondition = fValidate && !attDefForWildCard && !attDef; + if (errorCondition && !skipThisOne && !laxThisOne) + { + // + // Its not valid for this element, so issue an error if we are + // validating. + // + XMLBufBid bbMsg(&fBufMgr); + XMLBuffer& bufMsg = bbMsg.getBuffer(); + if (uriId != fEmptyNamespaceId) { + XMLBufBid bbURI(&fBufMgr); + XMLBuffer& bufURI = bbURI.getBuffer(); + + getURIText(uriId, bufURI); + + bufMsg.append(chOpenCurly); + bufMsg.append(bufURI.getRawBuffer()); + bufMsg.append(chCloseCurly); + } + bufMsg.append(suffPtr); + fValidator->emitError + ( + XMLValid::AttNotDefinedForElement + , bufMsg.getRawBuffer() + , elemDecl->getFullName() + ); + } + + // Now normalize the raw value since we have the attribute type. We + // don't care about the return status here. If it failed, an error + // was issued, which is all we care about. + if (attDefForWildCard) { + normalizeAttValue( + attDefForWildCard, namePtr, curPair->getValue(), normBuf + ); + + // If we found an attdef for this one, then lets validate it. + const XMLCh* xsNormalized = normBuf.getRawBuffer(); + DatatypeValidator* tempDV = ((SchemaAttDef*) attDefForWildCard)->getDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf, true); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + if (fNormalizeData && fValidate) { + normBuf.set(xsNormalized); + } + } + + if (fValidate ) { + fValidator->validateAttrValue( + attDefForWildCard, xsNormalized, false, elemDecl + ); + attrValidator = ((SchemaValidator *)fValidator)->getMostRecentAttrValidator(); + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + fPSVIElemContext.fErrorOccurred = true; + if(getPSVIHandler()) + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + else { // no decl; default DOMTypeInfo to anySimpleType + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + + // Save the type for later use + attType = attDefForWildCard->getType(); + } + else { + normalizeAttValue( + attDef, namePtr, curPair->getValue(), normBuf + ); + + // If we found an attdef for this one, then lets validate it. + if (attDef) + { + const XMLCh* xsNormalized = normBuf.getRawBuffer(); + if (fGrammarType == Grammar::SchemaGrammarType) + { + DatatypeValidator* tempDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf, true); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + if (fNormalizeData && fValidate && !skipThisOne) { + normBuf.set(xsNormalized); + } + } + } + + if (fValidate && !skipThisOne) + { + fValidator->validateAttrValue( + attDef, xsNormalized, false, elemDecl + ); + attrValidator = ((SchemaValidator *)fValidator)->getMostRecentAttrValidator(); + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + fPSVIElemContext.fErrorOccurred = true; + if(getPSVIHandler()) + attrValid = PSVIItem::VALIDITY_INVALID; + } + } + else { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + } + else { + attrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + + // Save the type for later use + if (attDef) + { + attType = attDef->getType(); + } + } + + // now fill in the PSVIAttributes entry for this attribute: + if(getPSVIHandler()) + { + psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); + SchemaAttDef *actualAttDef = 0; + if(attDef) + actualAttDef = (SchemaAttDef *)attDef; + else if (attDefForWildCard) + actualAttDef = (SchemaAttDef *)attDefForWildCard; + if(actualAttDef) + { + XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); + DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); + XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); + if(attrValid != PSVIItem::VALIDITY_VALID) + { + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , validatingType + , 0 + , actualAttDef->getValue() + , false + , attrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *memberType = 0; + if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , validatingType + , memberType + , actualAttDef->getValue() + , false + , attrDecl + , (memberType)?attrValidator:attrDataType + ); + } + } + else + { + psviAttr->reset + ( + fRootElemName + , attrValid + , attrAssessed + , 0 + , 0 + , 0 + , false + , 0 + , 0 + ); + } + } + } + + // Add this attribute to the attribute list that we use to pass them + // to the handler. We reuse its existing elements but expand it as + // required. + XMLAttr* curAttr; + if (retCount >= curAttListSize) + { + curAttr = new (fMemoryManager) XMLAttr + ( + uriId + , suffPtr + , prefPtr + , normBuf.getRawBuffer() + , attType + , true + , fMemoryManager + ); + toFill.addElement(curAttr); + } + else + { + curAttr = toFill.elementAt(retCount); + curAttr->set + ( + uriId + , suffPtr + , prefPtr + , normBuf.getRawBuffer() + , attType + ); + curAttr->setSpecified(true); + } + if(psviAttr) + psviAttr->setValue(curAttr->getValue()); + + // Bump the count of attrs in the list + retCount++; + } + + // Now, if there are any attributes declared by this element, let's + // go through them and make sure that any required ones are provided, + // and fault in any fixed ones and defaulted ones that are not provided + // literally. + if (hasDefs) + { + // Check after all specified attrs are scanned + // (1) report error for REQUIRED attrs that are missing (V_TAGc) + // (2) add default attrs if missing (FIXED and NOT_FIXED) + + XMLAttDefList& attDefList = getAttDefList(currType, elemDecl); + + for(XMLSize_t i=0; igetDefaultType(); + + unsigned int *attCountPtr = fAttDefRegistry->get(curDef); + if (!attCountPtr || *attCountPtr < fElemCount) + { // did not occur + // note that since there is no attribute information + // item present, there is no PSVI infoset to augment here *except* + // that the element is invalid + + //the attribute is not provided + if (fValidate) + { + // If we are validating and its required, then an error + if ((defType == XMLAttDef::Required) || + (defType == XMLAttDef::Required_And_Fixed) ) + + { + fValidator->emitError + ( + XMLValid::RequiredAttrNotProvided + , curDef->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + } + else if ((defType == XMLAttDef::Default) || + (defType == XMLAttDef::Fixed) ) + { + if (fStandalone && curDef->isExternal()) + { + // XML 1.0 Section 2.9 + // Document is standalone, so attributes must not be defaulted. + fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef->getFullName(), elemDecl->getFullName()); + } + } + } + + // Fault in the value if needed, and bump the att count. + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + // Let the validator pass judgement on the attribute value + if (fValidate) + { + fValidator->validateAttrValue + ( + curDef + , curDef->getValue() + , false + , elemDecl + ); + } + + XMLAttr* curAtt; + if (retCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr(fMemoryManager); + fValidator->faultInAttr(*curAtt, *curDef); + fAttrList->addElement(curAtt); + } + else + { + curAtt = fAttrList->elementAt(retCount); + fValidator->faultInAttr(*curAtt, *curDef); + } + + // Indicate it was not explicitly specified and bump count + curAtt->setSpecified(false); + retCount++; + if(getPSVIHandler()) + { + QName *attName = ((SchemaAttDef *)curDef)->getAttName(); + PSVIAttribute *defAttrToFill = fPSVIAttrList->getPSVIAttributeToFill + ( + attName->getLocalPart(), fURIStringPool->getValueForId( attName->getURI()) + ); + XSAttributeDeclaration *defAttrDecl = (XSAttributeDeclaration *)fModel->getXSObject((void *)curDef); + DatatypeValidator * attrDataType = ((SchemaAttDef *)curDef)->getDatatypeValidator(); + XSSimpleTypeDefinition *defAttrType = + (XSSimpleTypeDefinition*)fModel->getXSObject(attrDataType); + // would have occurred during validation of default value + if(((SchemaValidator *)fValidator)->getErrorOccurred()) + { + defAttrToFill->reset( + fRootElemName + , PSVIItem::VALIDITY_INVALID + , PSVIItem::VALIDATION_FULL + , defAttrType + , 0 + , curDef->getValue() + , true + , defAttrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *defAttrMemberType = 0; + if(defAttrType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + { + defAttrMemberType = (XSSimpleTypeDefinition *)fModel->getXSObject + ( + ((SchemaValidator*)fValidator)->getMostRecentAttrValidator() + ); + } + defAttrToFill->reset + ( + fRootElemName + , PSVIItem::VALIDITY_VALID + , PSVIItem::VALIDATION_FULL + , defAttrType + , defAttrMemberType + , curDef->getValue() + , true + , defAttrDecl + , (defAttrMemberType)?((SchemaValidator *)fValidator)->getMostRecentAttrValidator():attrDataType + ); + } + defAttrToFill->setValue(curDef->getValue()); + } + } + } + else if (attCountPtr) + { + //attribute is provided + // (schema) report error for PROHIBITED attrs that are present (V_TAGc) + if (defType == XMLAttDef::Prohibited && fValidate) + { + fValidator->emitError + ( + XMLValid::ProhibitedAttributePresent + , curDef->getFullName() + ); + fPSVIElemContext.fErrorOccurred = true; + if (getPSVIHandler()) + { + QName *attQName = ((SchemaAttDef *)curDef)->getAttName(); + // bad luck... + PSVIAttribute *prohibitedAttr = fPSVIAttrList->getAttributePSVIByName + ( + attQName->getLocalPart(), + fURIStringPool->getValueForId(attQName->getURI()) + ); + prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + + return retCount; +} + + +// This method will take a raw attribute value and normalize it according to +// the rules of the attribute type. It will put the resulting value into the +// passed buffer. +// +// This code assumes that escaped characters in the original value (via char +// refs) are prefixed by a 0xFFFF character. This is because some characters +// are legal if escaped only. And some escape chars are not subject to +// normalization rules. +bool SGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef + , const XMLCh* const attName + , const XMLCh* const value + , XMLBuffer& toFill) +{ + // A simple state value for a whitespace processing state machine + enum States + { + InWhitespace + , InContent + }; + + // Get the type and name + const XMLAttDef::AttTypes type = (attDef) + ?attDef->getType() + :XMLAttDef::CData; + + // Assume its going to go fine, and empty the target buffer in preperation + bool retVal = true; + toFill.reset(); + + // Get attribute def - to check to see if it's declared externally or not + bool isAttExternal = (attDef) + ?attDef->isExternal() + :false; + + // Loop through the chars of the source value and normalize it according + // to the type. + States curState = InContent; + bool firstNonWS = false; + XMLCh nextCh; + const XMLCh* srcPtr = value; + + if (type == XMLAttDef::CData || type > XMLAttDef::Notation) { + while (*srcPtr) { + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + nextCh = *srcPtr; + + // Do we have an escaped character ? + if (nextCh == 0xFFFF) + { + nextCh = *++srcPtr; + } + else if ( (nextCh <= 0x0D) && (nextCh == 0x09 || nextCh == 0x0A || nextCh == 0x0D) ) { + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attName); + } + nextCh = chSpace; + } + else if (nextCh == chOpenAngle) { + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + emitError(XMLErrs::BracketInAttrValue, attName); + retVal = false; + } + + // Add this char to the target buffer + toFill.append(nextCh); + + // And move up to the next character in the source + srcPtr++; + } + } + else { + while (*srcPtr) + { + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + nextCh = *srcPtr; + + // Do we have an escaped character ? + if (nextCh == 0xFFFF) + { + nextCh = *++srcPtr; + } + else if (nextCh == chOpenAngle) { + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + emitError(XMLErrs::BracketInAttrValue, attName); + retVal = false; + } + + if (curState == InWhitespace) + { + if (!fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + if (firstNonWS) + toFill.append(chSpace); + curState = InContent; + firstNonWS = true; + } + else + { + srcPtr++; + continue; + } + } + else if (curState == InContent) + { + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + curState = InWhitespace; + srcPtr++; + + // Check Validity Constraint for Standalone document declaration + // XML 1.0, Section 2.9 + if (fStandalone && fValidate && isAttExternal) + { + if (!firstNonWS || (nextCh != chSpace) || (!*srcPtr) || fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr)) + { + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attName); + } + } + continue; + } + firstNonWS = true; + } + + // Add this char to the target buffer + toFill.append(nextCh); + + // And move up to the next character in the source + srcPtr++; + } + } + + return retVal; +} + +// This method will just normalize the input value as CDATA without +// any standalone checking. +bool SGXMLScanner::normalizeAttRawValue( const XMLCh* const attrName + , const XMLCh* const value + , XMLBuffer& toFill) +{ + // Assume its going to go fine, and empty the target buffer in preperation + bool retVal = true; + toFill.reset(); + + // Loop through the chars of the source value and normalize it according + // to the type. + bool escaped; + XMLCh nextCh; + const XMLCh* srcPtr = value; + while (*srcPtr) + { + // Get the next character from the source. We have to watch for + // escaped characters (which are indicated by a 0xFFFF value followed + // by the char that was escaped.) + nextCh = *srcPtr; + escaped = (nextCh == 0xFFFF); + if (escaped) + nextCh = *++srcPtr; + + // If its not escaped, then make sure its not a < character, which is + // not allowed in attribute values. + if (!escaped && (*srcPtr == chOpenAngle)) + { + emitError(XMLErrs::BracketInAttrValue, attrName); + retVal = false; + } + + if (!escaped) + { + // NOTE: Yes this is a little redundant in that a 0x20 is + // replaced with an 0x20. But its faster to do this (I think) + // than checking for 9, A, and D separately. + if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + nextCh = chSpace; + } + + // Add this char to the target buffer + toFill.append(nextCh); + + // And move up to the next character in the source + srcPtr++; + } + return retVal; +} + +// This method will reset the scanner data structures, and related plugged +// in stuff, for a new scan session. We get the input source for the primary +// XML entity, create the reader for it, and push it on the stack so that +// upon successful return from here we are ready to go. +void SGXMLScanner::scanReset(const InputSource& src) +{ + + // This call implicitly tells us that we are going to reuse the scanner + // if it was previously used. So tell the validator to reset itself. + // + // But, if the fUseCacheGrammar flag is set, then don't reset it. + // + // NOTE: The ReaderMgr is flushed on the way out, because that is + // required to insure that files are closed. + fGrammarResolver->cacheGrammarFromParse(fToCacheGrammar); + fGrammarResolver->useCachedGrammarInParse(fUseCachedGrammar); + + // Clear transient schema info list. + // + fSchemaInfoList->removeAll (); + + // fModel may need updating, as fGrammarResolver could have cleaned it + if(fModel && getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); + + // Create dummy schema grammar + if (!fSchemaGrammar) { + fSchemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + } + + fGrammar = fSchemaGrammar; + fGrammarType = Grammar::DTDGrammarType; + fRootGrammar = 0; + + fValidator->setGrammar(fGrammar); + if (fValidatorFromUser) { + + ((SchemaValidator*) fValidator)->setErrorReporter(fErrorReporter); + ((SchemaValidator*) fValidator)->setGrammarResolver(fGrammarResolver); + ((SchemaValidator*) fValidator)->setExitOnFirstFatal(fExitOnFirstFatal); + } + + // Reset validation + fValidate = (fValScheme == Val_Always) ? true : false; + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + + // Reset the Root Element Name + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + fRootElemName = 0; + + // Reset IdentityConstraints + if (fICHandler) + fICHandler->reset(); + + // Reset the element stack, and give it the latest ids for the special + // URIs it has to know about. + fElemStack.reset + ( + fEmptyNamespaceId + , fUnknownNamespaceId + , fXMLNamespaceId + , fXMLNSNamespaceId + ); + + if (!fSchemaNamespaceId) + fSchemaNamespaceId = fURIStringPool->addOrFind(SchemaSymbols::fgURI_XSI); + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fSeeXsi = false; + fDoNamespaces = true; + fDoSchema = true; + + // Reset PSVI context + // Note that we always need this around for DOMTypeInfo + if (!fPSVIElement) + fPSVIElement = new (fMemoryManager) PSVIElement(fMemoryManager); + + if (!fErrorStack) + { + fErrorStack = new (fMemoryManager) ValueStackOf(8, fMemoryManager); + } + else + { + fErrorStack->removeAllElements(); + } + + resetPSVIElemContext(); + + // Reset the validators + fSchemaValidator->reset(); + fSchemaValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal); + fSchemaValidator->setGrammarResolver(fGrammarResolver); + if (fValidatorFromUser) + fValidator->reset(); + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , true + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // Push this read onto the reader manager + fReaderMgr.pushReader(newReader, 0); + + // and reset security-related things if necessary: + if(fSecurityManager != 0) + { + fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } + fElemCount = 0; + if(fUIntPoolRowTotal >= 32) + { // 8 KB tied up with validating attributes... + fAttDefRegistry->removeAll(); + recreateUIntPool(); + } + else + { + // note that this will implicitly reset the values of the hashtables, + // though their buckets will still be tied up + resetUIntPool(); + } + fUndeclaredAttrRegistry->removeAll(); +} + + +// This method is called between markup in content. It scans for character +// data that is sent to the document handler. It watches for any markup +// characters that would indicate that the character data has ended. It also +// handles expansion of general and character entities. +// +// sendData() is a local static helper for this method which handles some +// code that must be done in three different places here. +void SGXMLScanner::sendCharData(XMLBuffer& toSend) +{ + // If no data in the buffer, then nothing to do + if (toSend.isEmpty()) + return; + + // We do different things according to whether we are validating or + // not. If not, its always just characters; else, it depends on the + // current element's content model. + if (fValidate) + { + // Get the raw data we need for the callback + const XMLCh* rawBuf = toSend.getRawBuffer(); + const XMLSize_t len = toSend.getLen(); + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; + // And see if the current element is a 'Children' style content model + ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + else if(modelType == SchemaElementDecl::Empty) + charOpts = XMLElementDecl::NoCharData; + } + + // should not be necessary once PSVI method on element decls + // are removed + if (charOpts == XMLElementDecl::NoCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len)) + { + // Its all spaces. So, if they can take spaces, then send it + // as ignorable whitespace. If they can handle any char data + // send it as characters. + if (charOpts == XMLElementDecl::SpacesOk) { + if (fDocHandler) + fDocHandler->ignorableWhitespace(rawBuf, len, false); + } + else if (charOpts == XMLElementDecl::AllCharData) + { + XMLSize_t xsLen; + const XMLCh* xsNormalized; + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + } + else { + xsNormalized = rawBuf; + xsLen = len; + } + + // tell the schema validation about the character data for checkContent later + ((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized); + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + + if (fDocHandler) { + if (fNormalizeData) { + fDocHandler->docCharacters(xsNormalized, xsLen, false); + } + else { + fDocHandler->docCharacters(rawBuf, len, false); + } + } + } + } + else + { + // If they can take any char data, then send it. Otherwise, they + // can only handle whitespace and can't handle this stuff so + // issue an error. + if (charOpts == XMLElementDecl::AllCharData) + { + XMLSize_t xsLen; + const XMLCh *xsNormalized; + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + } + else { + xsNormalized = rawBuf; + xsLen = len; + } + + // tell the schema validation about the character data for checkContent later + ((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized); + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + + if (fDocHandler) { + if (fNormalizeData) { + fDocHandler->docCharacters(xsNormalized, xsLen, false); + } + else { + fDocHandler->docCharacters(rawBuf, len, false); + } + } + } + else + { + fValidator->emitError(XMLValid::NoCharDataInCM); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + else + { + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) + fContent.append(toSend.getRawBuffer(), toSend.getLen()); + + // Always assume its just char data if not validating + if (fDocHandler) + fDocHandler->docCharacters(toSend.getRawBuffer(), toSend.getLen(), false); + } + + // Reset buffer + toSend.reset(); +} + + + +// This method is called with a key/value string pair that represents an +// xmlns="yyy" or xmlns:xxx="yyy" attribute. This method will update the +// current top of the element stack based on this data. We know that when +// we get here, that it is one of these forms, so we don't bother confirming +// it. +// +// But we have to ensure +// 1. xxx is not xmlns +// 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa +// 3. yyy is not XMLUni::fgXMLNSURIName +// 4. if xxx is not null, then yyy cannot be an empty string. +void SGXMLScanner::updateNSMap(const XMLCh* const attrName + , const XMLCh* const attrValue) +{ + updateNSMap(attrName, attrValue, XMLString::indexOf(attrName, chColon)); +} + +void SGXMLScanner::updateNSMap(const XMLCh* const attrName + , const XMLCh* const attrValue + , const int colonOfs) +{ + // We need a buffer to normalize the attribute value into + XMLBufBid bbNormal(&fBufMgr); + XMLBuffer& normalBuf = bbNormal.getBuffer(); + + // Normalize the value into the passed buffer. In this case, we don't + // care about the return value. An error was issued for the error, which + // is all we care about here. + normalizeAttRawValue(attrName, attrValue, normalBuf); + XMLCh* namespaceURI = normalBuf.getRawBuffer(); + + // We either have the default prefix (""), or we point it into the attr + // name parameter. Note that the xmlns is not the prefix we care about + // here. To us, the 'prefix' is really the local part of the attrName + // parameter. + // + // Check 1. xxx is not xmlns + // 2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa + // 3. yyy is not XMLUni::fgXMLNSURIName + // 4. if xxx is not null, then yyy cannot be an empty string. + const XMLCh* prefPtr = XMLUni::fgZeroLenString; + if (colonOfs != -1) { + prefPtr = &attrName[colonOfs + 1]; + + if (XMLString::equals(prefPtr, XMLUni::fgXMLNSString)) + emitError(XMLErrs::NoUseOfxmlnsAsPrefix); + else if (XMLString::equals(prefPtr, XMLUni::fgXMLString)) { + if (!XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) + emitError(XMLErrs::PrefixXMLNotMatchXMLURI); + } + + if (!namespaceURI) + emitError(XMLErrs::NoEmptyStrNamespace, attrName); + else if(!*namespaceURI && fXMLVersion == XMLReader::XMLV1_0) + emitError(XMLErrs::NoEmptyStrNamespace, attrName); + } + + if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName)) + emitError(XMLErrs::NoUseOfxmlnsURI); + else if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) { + if (!XMLString::equals(prefPtr, XMLUni::fgXMLString)) + emitError(XMLErrs::XMLURINotMatchXMLPrefix); + } + + // Ok, we have to get the unique id for the attribute value, which is the + // URI that this value should be mapped to. The validator has the + // namespace string pool, so we ask him to find or add this new one. Then + // we ask the element stack to add this prefix to URI Id mapping. + fElemStack.addPrefix + ( + prefPtr + , fURIStringPool->addOrFind(namespaceURI) + ); +} + +void SGXMLScanner::scanRawAttrListforNameSpaces(XMLSize_t attCount) +{ + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + // When we find one, send it off to be used to update the element stack's + // namespace mappings. + for (XMLSize_t index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + + // If either the key begins with "xmlns:" or its just plain + // "xmlns", then use it to update the map. + if (!XMLString::compareNString(rawPtr, XMLUni::fgXMLNSColonString, 6) + || XMLString::equals(rawPtr, XMLUni::fgXMLNSString)) + { + const XMLCh* valuePtr = curPair->getValue(); + + updateNSMap(rawPtr, valuePtr, fRawAttrColonList[index]); + + // if the schema URI is seen in the the valuePtr, set the boolean seeXsi + if (XMLString::equals(valuePtr, SchemaSymbols::fgURI_XSI)) { + fSeeXsi = true; + } + } + } + + // walk through the list again to deal with "xsi:...." + if (fSeeXsi) + { + // Schema Xsi Type yyyy (e.g. xsi:type="yyyyy") + XMLBufBid bbXsi(&fBufMgr); + XMLBuffer& fXsiType = bbXsi.getBuffer(); + + for (XMLSize_t index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + const XMLCh* prefPtr; + + int colonInd = fRawAttrColonList[index]; + + if (colonInd != -1) { + fURIBuf.set(rawPtr, colonInd); + prefPtr = fURIBuf.getRawBuffer(); + } + else { + prefPtr = XMLUni::fgZeroLenString; + } + + // if schema URI has been seen, scan for the schema location and uri + // and resolve the schema grammar; or scan for schema type + if (resolvePrefix(prefPtr, ElemStack::Mode_Attribute) == fSchemaNamespaceId) { + + const XMLCh* valuePtr = curPair->getValue(); + const XMLCh* suffPtr = &rawPtr[colonInd + 1]; + + if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_SCHEMALOCATION)) + parseSchemaLocation(valuePtr); + else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCATION)) + resolveSchemaGrammar(valuePtr, XMLUni::fgZeroLenString); + + if( fValidator && fValidator->handlesSchema() ) + { + if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE)) + { + // normalize the attribute according to schema whitespace facet + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_QNAME); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiType, true); + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL)) + { + // normalize the attribute according to schema whitespace facet + XMLBuffer& fXsiNil = fBufMgr.bidOnBuffer(); + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_BOOLEAN); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiNil, true); + if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_TRUE)) + ((SchemaValidator*)fValidator)->setNillable(true); + else if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_FALSE)) + ((SchemaValidator*)fValidator)->setNillable(false); + else + emitError(XMLErrs::InvalidAttValue, fXsiNil.getRawBuffer(), valuePtr); + fBufMgr.releaseBuffer(fXsiNil); + } + } + } + } + + if (fValidator && fValidator->handlesSchema()) { + if (!fXsiType.isEmpty()) { + int colonPos = -1; + unsigned int uriId = resolveQName ( + fXsiType.getRawBuffer() + , fPrefixBuf + , ElemStack::Mode_Element + , colonPos + ); + ((SchemaValidator*)fValidator)->setXsiType(fPrefixBuf.getRawBuffer(), fXsiType.getRawBuffer() + colonPos + 1, uriId); + } + } + } +} + +void SGXMLScanner::parseSchemaLocation(const XMLCh* const schemaLocationStr, bool ignoreLoadSchema) +{ + BaseRefVectorOf* schemaLocation = XMLString::tokenizeString(schemaLocationStr, fMemoryManager); + Janitor > janLoc(schemaLocation); + + XMLSize_t size = schemaLocation->size(); + if (size % 2 != 0 ) { + emitError(XMLErrs::BadSchemaLocation); + } else { + // We need a buffer to normalize the attribute value into + XMLBuffer normalBuf(1023, fMemoryManager); + for(XMLSize_t i=0; ielementAt(i), normalBuf); + resolveSchemaGrammar(schemaLocation->elementAt(i+1), normalBuf.getRawBuffer(), ignoreLoadSchema); + } + } +} + +void SGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri, bool ignoreLoadSchema) { + + Grammar* grammar = 0; + + { + XMLSchemaDescriptionImpl theSchemaDescription(uri, fMemoryManager); + theSchemaDescription.setLocationHints(loc); + grammar = fGrammarResolver->getGrammar(&theSchemaDescription); + } + + // If multi-import is enabled, make sure the existing grammar came + // from the import directive. Otherwise we may end up reloading + // the same schema that came from the external grammar pool. Ideally, + // we would move fSchemaInfoList to XMLGrammarPool so that it survives + // the destruction of the scanner in which case we could rely on the + // same logic we use to weed out duplicate schemas below. + // + if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType || + (getHandleMultipleImports() && + ((XMLSchemaDescription*)grammar->getGrammarDescription())-> + getContextType () == XMLSchemaDescription::CONTEXT_IMPORT)) + { + if (fLoadSchema || ignoreLoadSchema) + { + XSDDOMParser parser(0, fMemoryManager, 0); + + parser.setValidationScheme(XercesDOMParser::Val_Never); + parser.setDoNamespaces(true); + parser.setUserEntityHandler(fEntityHandler); + parser.setUserErrorReporter(fErrorReporter); + + //Normalize sysId + XMLBufBid nnSys(&fBufMgr); + XMLBuffer& normalizedSysId = nnSys.getBuffer(); + XMLString::removeChar(loc, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBufBid bbSys(&fBufMgr); + XMLBuffer& expSysId = bbSys.getBuffer(); + + // Allow the entity handler to expand the system id if they choose + // to do so. + InputSource* srcToFill = 0; + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::SchemaGrammar, + expSysId.getRawBuffer(), uri, XMLUni::fgZeroLenString, lastInfo.systemId, + &fReaderMgr); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + else + { + expSysId.set(normalizedURI); + } + + // If they didn't create a source via the entity handler, then we + // have to create one on our own. + if (!srcToFill) + { + if (fDisableDefaultEntityResolution) + return; + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBufBid ddSys(&fBufMgr); + XMLBuffer& resolvedSysId = ddSys.getBuffer(); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + // Put a janitor on the input source + Janitor janSrc(srcToFill); + + // Check if this exact schema has already been seen. + // + const XMLCh* sysId = srcToFill->getSystemId(); + unsigned int uriId = (uri && *uri) ? fURIStringPool->addOrFind(uri) : fEmptyNamespaceId; + SchemaInfo* importSchemaInfo = 0; + + if (fUseCachedGrammar) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, uriId); + + if (!importSchemaInfo && !fToCacheGrammar) + importSchemaInfo = fSchemaInfoList->get(sysId, uriId); + + if (importSchemaInfo) + { + // We haven't added any new grammars so it is safe to just + // return. + // + return; + } + + // Should just issue warning if the schema is not found + bool flag = srcToFill->getIssueFatalErrorIfNotFound(); + srcToFill->setIssueFatalErrorIfNotFound(false); + + parser.parse(*srcToFill); + + // Reset the InputSource + srcToFill->setIssueFatalErrorIfNotFound(flag); + + if (parser.getSawFatal() && fExitOnFirstFatal) + emitError(XMLErrs::SchemaScanFatalError); + + DOMDocument* document = parser.getDocument(); //Our Grammar + + if (document != 0) { + + DOMElement* root = document->getDocumentElement();// This is what we pass to TraverserSchema + if (root != 0) + { + const XMLCh* newUri = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + bool newGrammar = false; + if (!XMLString::equals(newUri, uri)) { + if (fValidate || fValScheme == Val_Auto) { + fValidator->emitError(XMLValid::WrongTargetNamespace, loc, uri); + } + + grammar = fGrammarResolver->getGrammar(newUri); + newGrammar = true; + } + + if (!grammar || + grammar->getGrammarType() == Grammar::DTDGrammarType || + (getHandleMultipleImports() && + ((XMLSchemaDescription*) grammar->getGrammarDescription())-> + getContextType () == XMLSchemaDescription::CONTEXT_IMPORT)) + { + // If we switched namespace URI, recheck the schema info. + // + if (newGrammar) + { + unsigned int newUriId = (newUri && *newUri) ? fURIStringPool->addOrFind(newUri) : fEmptyNamespaceId; + + if (fUseCachedGrammar) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, newUriId); + + if (!importSchemaInfo && !fToCacheGrammar) + importSchemaInfo = fSchemaInfoList->get(sysId, newUriId); + + if (importSchemaInfo) + return; + } + + // Since we have seen a grammar, set our validation flag + // at this point if the validation scheme is auto + if (fValScheme == Val_Auto && !fValidate) { + fValidate = true; + fElemStack.setValidationFlag(fValidate); + } + + bool grammarFound = grammar && + grammar->getGrammarType() == Grammar::SchemaGrammarType; + + SchemaGrammar* schemaGrammar; + + if (grammarFound) { + schemaGrammar = (SchemaGrammar*) grammar; + } + else { + schemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + } + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) schemaGrammar->getGrammarDescription(); + + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE); + gramDesc->setLocationHints(sysId); + + TraverseSchema traverseSchema + ( + root + , fURIStringPool + , schemaGrammar + , fGrammarResolver + , fUseCachedGrammar ? fCachedSchemaInfoList : fSchemaInfoList + , fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList + , this + , sysId + , fEntityHandler + , fErrorReporter + , fMemoryManager + , grammarFound + ); + + // Reset the now invalid schema roots in the collected + // schema info entries. + // + { + RefHash2KeysTableOfEnumerator i ( + fToCacheGrammar ? fCachedSchemaInfoList : fSchemaInfoList); + + while (i.hasMoreElements ()) + i.nextElement().resetRoot (); + } + + if (fGrammarType == Grammar::DTDGrammarType) { + fGrammar = schemaGrammar; + fGrammarType = Grammar::SchemaGrammarType; + fValidator->setGrammar(fGrammar); + } + + if (fValidate) { + // validate the Schema scan so far + fValidator->preContentValidation(false); + } + } + } + } + } + } + else + { + // Since we have seen a grammar, set our validation flag + // at this point if the validation scheme is auto + if (fValScheme == Val_Auto && !fValidate) { + fValidate = true; + fElemStack.setValidationFlag(fValidate); + } + + // we have seen a schema, so set up the fValidator as fSchemaValidator + if (fGrammarType == Grammar::DTDGrammarType) { + fGrammar = grammar; + fGrammarType = Grammar::SchemaGrammarType; + fValidator->setGrammar(fGrammar); + } + } + // update fModel; rely on the grammar resolver to do this + // efficiently + if(getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); +} + +InputSource* SGXMLScanner::resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId) +{ + //Normalize sysId + XMLBufBid nnSys(&fBufMgr); + XMLBuffer& normalizedSysId = nnSys.getBuffer(); + XMLString::removeChar(sysId, 0xFFFF, normalizedSysId); + const XMLCh* normalizedURI = normalizedSysId.getRawBuffer(); + + // Create a buffer for expanding the system id + XMLBufBid bbSys(&fBufMgr); + XMLBuffer& expSysId = bbSys.getBuffer(); + + // Allow the entity handler to expand the system id if they choose + // to do so. + InputSource* srcToFill = 0; + if (fEntityHandler) + { + if (!fEntityHandler->expandSystemId(normalizedURI, expSysId)) + expSysId.set(normalizedURI); + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + expSysId.getRawBuffer(), 0, pubId, lastInfo.systemId, + &fReaderMgr); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + else + { + expSysId.set(normalizedURI); + } + + // If they didn't create a source via the entity handler, then we + // have to create one on our own. + if (!srcToFill) + { + if (fDisableDefaultEntityResolution) + return 0; + + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(lastInfo.systemId, expSysId.getRawBuffer(), urlTmp)) || + (urlTmp.isRelative())) + { + if (!fStandardUriConformant) + { + XMLBufBid ddSys(&fBufMgr); + XMLBuffer& resolvedSysId = ddSys.getBuffer(); + XMLUri::normalizeURI(expSysId.getRawBuffer(), resolvedSysId); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( + lastInfo.systemId + , resolvedSysId.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fStandardUriConformant && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + return srcToFill; +} + + +// --------------------------------------------------------------------------- +// SGXMLScanner: Private grammar preparsing methods +// --------------------------------------------------------------------------- +Grammar* SGXMLScanner::loadXMLSchemaGrammar(const InputSource& src, + const bool toCache) +{ + // Reset the validators + fSchemaValidator->reset(); + fSchemaValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal); + fSchemaValidator->setGrammarResolver(fGrammarResolver); + + if (fValidatorFromUser) + fValidator->reset(); + + XSDDOMParser parser(0, fMemoryManager, 0); + + parser.setValidationScheme(XercesDOMParser::Val_Never); + parser.setDoNamespaces(true); + parser.setUserEntityHandler(fEntityHandler); + parser.setUserErrorReporter(fErrorReporter); + + // Should just issue warning if the schema is not found + bool flag = src.getIssueFatalErrorIfNotFound(); + ((InputSource&) src).setIssueFatalErrorIfNotFound(false); + + parser.parse(src); + + // Reset the InputSource + ((InputSource&) src).setIssueFatalErrorIfNotFound(flag); + + if (parser.getSawFatal() && fExitOnFirstFatal) + emitError(XMLErrs::SchemaScanFatalError); + + DOMDocument* document = parser.getDocument(); //Our Grammar + + if (document != 0) { + + DOMElement* root = document->getDocumentElement();// This is what we pass to TraverserSchema + if (root != 0) + { + const XMLCh* nsUri = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + Grammar* grammar = fGrammarResolver->getGrammar(nsUri); + + // Check if this exact schema has already been seen. + // + const XMLCh* sysId = src.getSystemId(); + SchemaInfo* importSchemaInfo = 0; + + if (grammar) + { + if (nsUri && *nsUri) + importSchemaInfo = fCachedSchemaInfoList->get(sysId, fURIStringPool->addOrFind(nsUri)); + else + importSchemaInfo = fCachedSchemaInfoList->get(sysId, fEmptyNamespaceId); + } + + if (!importSchemaInfo) + { + bool grammarFound = grammar && + grammar->getGrammarType() == Grammar::SchemaGrammarType && + getHandleMultipleImports(); + + SchemaGrammar* schemaGrammar; + + if (grammarFound) + schemaGrammar = (SchemaGrammar*) grammar; + else + schemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) schemaGrammar->getGrammarDescription(); + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE); + gramDesc->setLocationHints(sysId); + + TraverseSchema traverseSchema + ( + root + , fURIStringPool + , schemaGrammar + , fGrammarResolver + , fCachedSchemaInfoList + , toCache ? fCachedSchemaInfoList : fSchemaInfoList + , this + , sysId + , fEntityHandler + , fErrorReporter + , fMemoryManager + , grammarFound + ); + + grammar = schemaGrammar; + + // Reset the now invalid schema roots in the collected + // schema info entries. + // + { + RefHash2KeysTableOfEnumerator i ( + toCache ? fCachedSchemaInfoList : fSchemaInfoList); + + while (i.hasMoreElements ()) + i.nextElement().resetRoot (); + } + } + + if (fValidate) { + // validate the Schema scan so far + fValidator->setGrammar(grammar); + fValidator->preContentValidation(false); + } + + if (toCache) { + fGrammarResolver->cacheGrammars(); + } + + if(getPSVIHandler()) + fModel = fGrammarResolver->getXSModel(); + + return grammar; + } + } + + return 0; +} + + + +// --------------------------------------------------------------------------- +// SGXMLScanner: Private parsing methods +// --------------------------------------------------------------------------- + +// This method is called to do a raw scan of an attribute value. It does not +// do normalization (since we don't know their types yet.) It just scans the +// value and does entity expansion. +// +// End of entity's must be dealt with here. During DTD scan, they can come +// from external entities. During content, they can come from any entity. +// We just eat the end of entity and continue with our scan until we come +// to the closing quote. If an unterminated value causes us to go through +// subsequent entities, that will cause errors back in the calling code, +// but there's little we can do about it here. +bool SGXMLScanner::basicAttrValueScan(const XMLCh* const attrName, XMLBuffer& toFill) +{ + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + while (true) + { + try + { + while(true) + { + XMLCh nextCh = fReaderMgr.getNextChar(); + + if (nextCh != quoteCh) + { + if (nextCh != chAmpersand) + { + if ((nextCh < 0xD800) || (nextCh > 0xDFFF)) + { + // Its got to at least be a valid XML character + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + if (nextCh == 0) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacterInAttrValue, attrName, tmpBuf); + } + } else // its a surrogate + { + // Deal with surrogate pairs + + // we expect a a leading surrogate. + if (nextCh <= 0xDBFF) + { + toFill.append(nextCh); + + // process the trailing surrogate + nextCh = fReaderMgr.getNextChar(); + + // it should be a trailing surrogate. + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + } else + { + // Its a trailing surrogate, but we are not expecting it + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + } + } else // its a chAmpersand + { + // Check for an entity ref . We ignore the empty flag in + // this one. + + bool escaped; + XMLCh firstCh; + XMLCh secondCh + ; + // If it was not returned directly, then jump back up + if (scanEntityRef(true, firstCh, secondCh, escaped) == EntityExp_Returned) + { + // If it was escaped, then put in a 0xFFFF value. This will + // be used later during validation and normalization of the + // value to know that the following character was via an + // escape char. + if (escaped) + toFill.append(0xFFFF); + + toFill.append(firstCh); + if (secondCh) + toFill.append(secondCh); + } + continue; + } + } else // its a quoteCh + { + // Check for our ending quote. It has to be in the same entity + // as where we started. Quotes in nested entities are ignored. + + if (curReader == fReaderMgr.getCurrentReaderNum()) + { + return true; + } + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr.getCurrentReaderNum()) + { + emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // add it to the buffer + toFill.append(nextCh); + + } + } + catch(const EndOfEntityException&) + { + // Just eat it and continue. + } + } + return true; +} + + +// This method scans a CDATA section. It collects the character into one +// of the temp buffers and calls the document handler, if any, with the +// characters. It assumes that the getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + else if(modelType == SchemaElementDecl::Empty) + charOpts = XMLElementDecl::NoCharData; + } + + // should not be necessary when PSVI on element decl removed + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + while (true) + { + const XMLCh nextCh = fReaderMgr.getNextChar(); + + // Watch for unexpected end of file + if (!nextCh) + { + emitError(XMLErrs::UnterminatedCDATASection); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + if (fValidate && fStandalone && (fReaderMgr.getCurrentReader()->isWhitespace(nextCh))) + { + // This document is standalone; this ignorable CDATA whitespace is forbidden. + // XML 1.0, Section 2.9 + // And see if the current element is a 'Children' style content model + if (topElem->fThisElement->isExternal()) { + + if (charOpts == XMLElementDecl::SpacesOk) // Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + fValidator->emitError(XMLValid::NoWSForStandalone); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + + // If this is a close square bracket it could be our closing + // sequence. + if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose)) + { + // make sure we were not expecting a trailing surrogate. + if (gotLeadingSurrogate) { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + + XMLSize_t xsLen = bbCData.getLen(); + const XMLCh* xsNormalized = bbCData.getRawBuffer(); + if (fValidate) { + + DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf); + xsNormalized = fWSNormalizeBuf.getRawBuffer(); + xsLen = fWSNormalizeBuf.getLen(); + } + + // tell the schema validation about the character data for checkContent later + ((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized); + + if (charOpts != XMLElementDecl::AllCharData) + { + // They definitely cannot handle any type of char data + fValidator->emitError(XMLValid::NoCharDataInCM); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + + // call all active identity constraints + if (toCheckIdentityConstraint() && fICHandler->getMatcherCount()) { + fContent.append(xsNormalized, xsLen); + } + + // If we have a doc handler, call it + if (fDocHandler) + { + if (fNormalizeData) { + fDocHandler->docCharacters(xsNormalized, xsLen, true); + } + else { + fDocHandler->docCharacters( + bbCData.getRawBuffer(), bbCData.getLen(), true + ); + } + } + + // And we are done + break; + } + + // Make sure its a valid character. But if we've emitted an error + // already, don't bother with the overhead since we've already told + // them about it. + if (!emittedError) + { + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + emittedError = true; + } + } + gotLeadingSurrogate = false; + } + } + + // Add it to the buffer + bbCData.append(nextCh); + } +} + + +void SGXMLScanner::scanCharData(XMLBuffer& toUse) +{ + // We have to watch for the stupid ]]> sequence, which is illegal in + // character data. So this is a little state machine that handles that. + enum States + { + State_Waiting + , State_GotOne + , State_GotTwo + }; + + // Reset the buffer before we start + toUse.reset(); + + // Turn on the 'throw at end' flag of the reader manager + ThrowEOEJanitor jan(&fReaderMgr, true); + + // In order to be more efficient we have to use kind of a deeply nested + // set of blocks here. The outer block puts on a try and catches end of + // entity exceptions. The inner loop is the per-character loop. If we + // put the try inside the inner loop, it would work but would require + // the exception handling code setup/teardown code to be invoked for + // each character. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = State_Waiting; + bool escaped = false; + bool gotLeadingSurrogate = false; + bool notDone = true; + while (notDone) + { + try + { + while (true) + { + // Eat through as many plain content characters as possible without + // needing special handling. Moving most content characters here, + // in this one call, rather than running the overall loop once + // per content character, is a speed optimization. + if (curState == State_Waiting && !gotLeadingSurrogate) + { + fReaderMgr.movePlainContentChars(toUse); + } + + // Try to get another char from the source + // The code from here on down covers all contengencies, + if (!fReaderMgr.getNextCharIfNot(chOpenAngle, nextCh)) + { + // If we were waiting for a trailing surrogate, its an error + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + notDone = false; + break; + } + + // Watch for a reference. Note that the escapement mechanism + // is ignored in this content. + escaped = false; + if (nextCh == chAmpersand) + { + sendCharData(toUse); + + // Turn off the throwing at the end of entity during this + ThrowEOEJanitor jan(&fReaderMgr, false); + + if (scanEntityRef(false, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Make sure the returned char is a valid XML char + if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // Keep the state machine up to date + if (!escaped) + { + if (nextCh == chCloseSquare) + { + if (curState == State_Waiting) + curState = State_GotOne; + else if (curState == State_GotOne) + curState = State_GotTwo; + } + else if (nextCh == chCloseAngle) + { + if (curState == State_GotTwo) + emitError(XMLErrs::BadSequenceInCharData); + curState = State_Waiting; + } + else + { + curState = State_Waiting; + } + } + else + { + curState = State_Waiting; + } + + // Add this char to the buffer + toUse.append(nextCh); + + if (secondCh) + { + toUse.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException& toCatch) + { + // Some entity ended, so we have to send any accumulated + // chars and send an end of entity event. + sendCharData(toUse); + gotLeadingSurrogate = false; + + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + // Check the validity constraints as per XML 1.0 Section 2.9 + if (fValidate && fStandalone) + { + // See if the text contains whitespace + // Get the raw data we need for the callback + const XMLCh* rawBuf = toUse.getRawBuffer(); + const XMLSize_t len = toUse.getLen(); + const bool isSpaces = fReaderMgr.getCurrentReader()->containsWhiteSpace(rawBuf, len); + + if (isSpaces) + { + // And see if the current element is a 'Children' style content model + const ElemStack::StackElem* topElem = fElemStack.topElement(); + + if (topElem->fThisElement->isExternal()) { + + // Get the character data opts for the current element + XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData; + // And see if the current element is a 'Children' style content model + ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if(currType) + { + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType(); + if(modelType == SchemaElementDecl::Children || + modelType == SchemaElementDecl::ElementOnlyEmpty) + charOpts = XMLElementDecl::SpacesOk; + } + + if (charOpts == XMLElementDecl::SpacesOk) // => Element Content + { + // Error - standalone should have a value of "no" as whitespace detected in an + // element type with element content whose element declaration was external + // + fValidator->emitError(XMLValid::NoWSForStandalone); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } + } + } + } + // Send any char data that we accumulated into the buffer + sendCharData(toUse); +} + + +// This method will scan a general/character entity ref. It will either +// expand a char ref and return it directly, or push a reader for a general +// entity. +// +// The return value indicates whether the char parameters hold the value +// or whether the value was pushed as a reader, or that it failed. +// +// The escaped flag tells the caller whether the returned parameter resulted +// from a character reference, which escapes the character in some cases. It +// only makes any difference if the return value indicates the value was +// returned directly. +SGXMLScanner::EntityExpRes +SGXMLScanner::scanEntityRef( const bool + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped) +{ + // Assume no escape + secondCh = 0; + escaped = false; + + // We have to insure that its all in one entity + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // If the next char is a pound, then its a character reference and we + // need to expand it always. + if (fReaderMgr.skippedChar(chPound)) + { + // Its a character reference, so scan it and get back the numeric + // value it represents. + if (!scanCharRef(firstCh, secondCh)) + return EntityExp_Failed; + + escaped = true; + + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + return EntityExp_Returned; + } + + // Expand it since its a normal entity ref + XMLBufBid bbName(&fBufMgr); + int colonPosition; + if (!fReaderMgr.getQName(bbName.getBuffer(), &colonPosition)) + { + if (bbName.isEmpty()) + emitError(XMLErrs::ExpectedEntityRefName); + else + emitError(XMLErrs::InvalidEntityRefName, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // Next char must be a semi-colon. But if its not, just emit + // an error and try to continue. + if (!fReaderMgr.skippedChar(chSemiColon)) + emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // Make sure we ended up on the same entity reader as the & char + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // Look up the name in the general entity pool + // If it does not exist, then obviously an error + if (!fEntityTable->containsKey(bbName.getRawBuffer())) + { + // XML 1.0 Section 4.1 + // Well-formedness Constraint for entity not found: + // In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, + // or a document with "standalone='yes'", for an entity reference that does not occur within the external subset + // or a parameter entity + if (fStandalone || fHasNoDTD) + emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + + return EntityExp_Failed; + } + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + // there seems nothing better to be done than to reset the entity expansion limit + fEntityExpansionCount = 0; + } + + firstCh = fEntityTable->get(bbName.getRawBuffer()); + escaped = true; + return EntityExp_Returned; +} + + +bool SGXMLScanner::switchGrammar(const XMLCh* const newGrammarNameSpace) +{ + Grammar* tempGrammar = fGrammarResolver->getGrammar(newGrammarNameSpace); + + if (!tempGrammar) { + tempGrammar = fSchemaGrammar; + } + + if (!tempGrammar) + return false; + else { + fGrammar = tempGrammar; + fGrammarType = fGrammar->getGrammarType(); + if (fGrammarType == Grammar::DTDGrammarType) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Gen_NoDTDValidator, fMemoryManager); + } + + fValidator->setGrammar(fGrammar); + return true; + } +} + +// check if we should skip or lax the validation of the element +// if skip - no validation +// if lax - validate only if the element if found +bool SGXMLScanner::laxElementValidation(QName* element, ContentLeafNameTypeVector* cv, + const XMLContentModel* const cm, + const XMLSize_t parentElemDepth) +{ + bool skipThisOne = false; + bool laxThisOne = false; + unsigned int elementURI = element->getURI(); + unsigned int currState = fElemState[parentElemDepth]; + unsigned int currLoop = fElemLoopState[parentElemDepth]; + + if (currState == XMLContentModel::gInvalidTrans) { + return laxThisOne; + } + + SubstitutionGroupComparator comparator(fGrammarResolver, fURIStringPool); + + if (cv) { + XMLSize_t i = 0; + XMLSize_t leafCount = cv->getLeafCount(); + unsigned int nextState = 0; + + for (; i < leafCount; i++) { + + QName* fElemMap = cv->getLeafNameAt(i); + unsigned int uri = fElemMap->getURI(); + ContentSpecNode::NodeTypes type = cv->getLeafTypeAt(i); + + if (type == ContentSpecNode::Leaf) { + if (((uri == elementURI) + && XMLString::equals(fElemMap->getLocalPart(), element->getLocalPart())) + || comparator.isEquivalentTo(element, fElemMap)) { + + nextState = cm->getNextState(currState, i); + + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } else if ((type & 0x0f) == ContentSpecNode::Any) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + else if ((type & 0x0f) == ContentSpecNode::Any_Other) { + if (uri != elementURI && elementURI != fEmptyNamespaceId) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f) == ContentSpecNode::Any_NS) { + if (uri == elementURI) { + nextState = cm->getNextState(currState, i); + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + + } // for + + if (i == leafCount) { // no match + fElemState[parentElemDepth] = XMLContentModel::gInvalidTrans; + fElemLoopState[parentElemDepth] = 0; + return laxThisOne; + } + + ContentSpecNode::NodeTypes type = cv->getLeafTypeAt(i); + if ((type & 0x0f) == ContentSpecNode::Any || + (type & 0x0f) == ContentSpecNode::Any_Other || + (type & 0x0f) == ContentSpecNode::Any_NS) + { + if (type == ContentSpecNode::Any_Skip || + type == ContentSpecNode::Any_NS_Skip || + type == ContentSpecNode::Any_Other_Skip) { + skipThisOne = true; + } + else if (type == ContentSpecNode::Any_Lax || + type == ContentSpecNode::Any_NS_Lax || + type == ContentSpecNode::Any_Other_Lax) { + laxThisOne = true; + } + } + fElemState[parentElemDepth] = nextState; + fElemLoopState[parentElemDepth] = currLoop; + } // if + + if (skipThisOne) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + + return laxThisOne; +} + + +// check if there is an AnyAttribute, and if so, see if we should lax or skip +// if skip - no validation +// if lax - validate only if the attribute if found +bool SGXMLScanner::anyAttributeValidation(SchemaAttDef* attWildCard, unsigned int uriId, bool& skipThisOne, bool& laxThisOne) +{ + XMLAttDef::AttTypes wildCardType = attWildCard->getType(); + bool anyEncountered = false; + skipThisOne = false; + laxThisOne = false; + if (wildCardType == XMLAttDef::Any_Any) + anyEncountered = true; + else if (wildCardType == XMLAttDef::Any_Other) { + if (attWildCard->getAttName()->getURI() != uriId + && uriId != fEmptyNamespaceId) + anyEncountered = true; + } + else if (wildCardType == XMLAttDef::Any_List) { + ValueVectorOf* nameURIList = attWildCard->getNamespaceList(); + XMLSize_t listSize = (nameURIList) ? nameURIList->size() : 0; + + if (listSize) { + for (XMLSize_t i=0; i < listSize; i++) { + if (nameURIList->elementAt(i) == uriId) + anyEncountered = true; + } + } + } + + if (anyEncountered) { + XMLAttDef::DefAttTypes defType = attWildCard->getDefaultType(); + if (defType == XMLAttDef::ProcessContents_Skip) { + // attribute should just be bypassed, + skipThisOne = true; + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE); + } + } + else if (defType == XMLAttDef::ProcessContents_Lax) { + laxThisOne = true; + } + } + + return anyEncountered; +} + +inline XMLAttDefList& getAttDefList(ComplexTypeInfo* currType, XMLElementDecl* elemDecl) +{ + if (currType) + return currType->getAttDefList(); + else + return elemDecl->getAttDefList(); +} + +void SGXMLScanner::endElementPSVI(SchemaElementDecl* const elemDecl, + DatatypeValidator* const memberDV) +{ + PSVIElement::ASSESSMENT_TYPE validationAttempted; + PSVIElement::VALIDITY_STATE validity = PSVIElement::VALIDITY_NOTKNOWN; + + if (fPSVIElemContext.fElemDepth > fPSVIElemContext.fFullValidationDepth) + validationAttempted = PSVIElement::VALIDATION_FULL; + else if (fPSVIElemContext.fElemDepth > fPSVIElemContext.fNoneValidationDepth) + validationAttempted = PSVIElement::VALIDATION_NONE; + else + { + validationAttempted = PSVIElement::VALIDATION_PARTIAL; + fPSVIElemContext.fFullValidationDepth = + fPSVIElemContext.fNoneValidationDepth = fPSVIElemContext.fElemDepth - 1; + } + + if (fValidate && elemDecl->isDeclared()) + { + validity = (fPSVIElemContext.fErrorOccurred) + ? PSVIElement::VALIDITY_INVALID : PSVIElement::VALIDITY_VALID; + } + + XSTypeDefinition* typeDef = 0; + bool isMixed = false; + if (fPSVIElemContext.fCurrentTypeInfo) + { + typeDef = (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentTypeInfo); + SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes)fPSVIElemContext.fCurrentTypeInfo->getContentType(); + isMixed = (modelType == SchemaElementDecl::Mixed_Simple + || modelType == SchemaElementDecl::Mixed_Complex); + } + else if (fPSVIElemContext.fCurrentDV) + typeDef = (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentDV); + + XMLCh* canonicalValue = 0; + if (fPSVIElemContext.fNormalizedValue && !isMixed && + validity == PSVIElement::VALIDITY_VALID) + { + if (memberDV) + canonicalValue = (XMLCh*) memberDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager); + else if (fPSVIElemContext.fCurrentDV) + canonicalValue = (XMLCh*) fPSVIElemContext.fCurrentDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager); + } + + fPSVIElement->reset + ( + validity + , validationAttempted + , fRootElemName + , fPSVIElemContext.fIsSpecified + , (elemDecl->isDeclared()) + ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0 + , typeDef + , (memberDV) ? (XSSimpleTypeDefinition*) fModel->getXSObject(memberDV) : 0 + , fModel + , elemDecl->getDefaultValue() + , fPSVIElemContext.fNormalizedValue + , canonicalValue + ); + + fPSVIHandler->handleElementPSVI + ( + elemDecl->getBaseName() + , fURIStringPool->getValueForId(elemDecl->getURI()) + , fPSVIElement + ); + + // decrease element depth + fPSVIElemContext.fElemDepth--; + +} + +void SGXMLScanner::resetPSVIElemContext() +{ + fPSVIElemContext.fIsSpecified = false; + fPSVIElemContext.fErrorOccurred = false; + fPSVIElemContext.fElemDepth = -1; + fPSVIElemContext.fFullValidationDepth = -1; + fPSVIElemContext.fNoneValidationDepth = -1; + fPSVIElemContext.fCurrentDV = 0; + fPSVIElemContext.fCurrentTypeInfo = 0; + fPSVIElemContext.fNormalizedValue = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/SGXMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/SGXMLScanner.hpp new file mode 100644 index 000000000..4f334c6cc --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/SGXMLScanner.hpp @@ -0,0 +1,307 @@ +/* + * 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: SGXMLScanner.hpp 882548 2009-11-20 13:44:14Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SGXMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_SGXMLSCANNER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +class SchemaGrammar; +class SchemaValidator; +class IdentityConstraintHandler; +class IdentityConstraint; +class ContentLeafNameTypeVector; +class SchemaAttDef; +class XMLContentModel; +class XSModel; +class PSVIAttributeList; +class PSVIElement; + +// This is a scanner class, which process XML Schema grammar. +class XMLPARSER_EXPORT SGXMLScanner : public XMLScanner +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + SGXMLScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + SGXMLScanner + ( + XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~SGXMLScanner(); + + // ----------------------------------------------------------------------- + // XMLScanner public virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const; + virtual NameIdPool* getEntityDeclPool(); + virtual const NameIdPool* getEntityDeclPool() const; + virtual void scanDocument + ( + const InputSource& src + ); + virtual bool scanNext(XMLPScanToken& toFill); + virtual Grammar* loadGrammar + ( + const InputSource& src + , const short grammarType + , const bool toCache = false + ); + + virtual void resetCachedGrammar (); + virtual Grammar::GrammarType getCurrentGrammarType() const; + +protected: + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanReset(const InputSource& src); + + // ----------------------------------------------------------------------- + // SGXMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual bool scanStartTag(bool& gotData); + virtual void scanEndTag(bool& gotData); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + XMLSize_t buildAttList + ( + const RefVectorOf& providedAttrs + , const XMLSize_t attCount + , XMLElementDecl* elemDecl + , RefVectorOf& toFill + ); + bool laxElementValidation(QName* element, ContentLeafNameTypeVector* cv, + const XMLContentModel* const cm, + const XMLSize_t parentElemDepth); + XMLSize_t rawAttrScan + ( + const XMLCh* const elemName + , RefVectorOf& toFill + , bool& isEmpty + ); + void updateNSMap + ( + const XMLCh* const attrName + , const XMLCh* const attrValue + ); + void resizeElemState(); + + void updateNSMap + ( + const XMLCh* const attrName + , const XMLCh* const attrValue + , const int colonPosition + ); + void resizeRawAttrColonList(); + // ----------------------------------------------------------------------- + // Data members + // + // fRawAttrList + // During the initial scan of the attributes we can only do a raw + // scan for key/value pairs. So this vector is used to store them + // until they can be processed (and put into fAttrList.) + // + // fSchemaValidator + // The Schema validator instance. + // + // fSeeXsi + // This flag indicates a schema has been seen. + // + // fElemState + // fElemLoopState + // fElemStateSize + // Stores an element next state from DFA content model - used for + // wildcard validation + // + // fElemNonDeclPool + // registry for elements without decls in the grammar + // fElemCount + // count of the number of start tags seen so far (starts at 1). + // Used for duplicate attribute detection/processing of required/defaulted attributes + // fAttDefRegistry + // mapping from XMLAttDef instances to the count of the last + // start tag where they were utilized. + // fUndeclaredAttrRegistry + // set of namespaceId/localName pairs to detect duplicates + // fPSVIAttrList + // PSVI attribute list implementation that needs to be + // filled when a PSVIHandler is registered + // fSchemaInfoList + // Transient schema info list that is passed to TraverseSchema instances. + // fCachedSchemaInfoList + // Cached Schema info list that is passed to TraverseSchema instances. + // + // ----------------------------------------------------------------------- + bool fSeeXsi; + Grammar::GrammarType fGrammarType; + unsigned int fElemStateSize; + unsigned int* fElemState; + unsigned int* fElemLoopState; + XMLBuffer fContent; + ValueHashTableOf* fEntityTable; + RefVectorOf* fRawAttrList; + unsigned int fRawAttrColonListSize; + int* fRawAttrColonList; + SchemaGrammar* fSchemaGrammar; + SchemaValidator* fSchemaValidator; + IdentityConstraintHandler* fICHandler; + RefHash3KeysIdPool* fElemNonDeclPool; + unsigned int fElemCount; + RefHashTableOf*fAttDefRegistry; + Hash2KeysSetOf* fUndeclaredAttrRegistry; + PSVIAttributeList * fPSVIAttrList; + XSModel* fModel; + PSVIElement* fPSVIElement; + ValueStackOf* fErrorStack; + PSVIElemContext fPSVIElemContext; + RefHash2KeysTableOf* fSchemaInfoList; + RefHash2KeysTableOf* fCachedSchemaInfoList; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SGXMLScanner(); + SGXMLScanner(const SGXMLScanner&); + SGXMLScanner& operator=(const SGXMLScanner&); + + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanCDSection(); + virtual void scanCharData(XMLBuffer& toToUse); + virtual EntityExpRes scanEntityRef + ( + const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped + ); + virtual void scanDocTypeDecl(); + virtual void sendCharData(XMLBuffer& toSend); + virtual InputSource* resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void commonInit(); + void cleanUp(); + + bool normalizeAttValue + ( + const XMLAttDef* const attDef + , const XMLCh* const attrName + , const XMLCh* const value + , XMLBuffer& toFill + ); + bool normalizeAttRawValue + ( + const XMLCh* const attrName + , const XMLCh* const value + , XMLBuffer& toFill + ); + void scanRawAttrListforNameSpaces(XMLSize_t attCount); + void parseSchemaLocation(const XMLCh* const schemaLocationStr, bool ignoreLoadSchema = false); + void resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri, bool ignoreLoadSchema = false); + bool switchGrammar(const XMLCh* const newGrammarNameSpace); + bool anyAttributeValidation(SchemaAttDef* attWildCard, + unsigned int uriId, + bool& skipThisOne, + bool& laxThisOne); + + // ----------------------------------------------------------------------- + // Private scanning methods + // ----------------------------------------------------------------------- + bool basicAttrValueScan + ( + const XMLCh* const attrName + , XMLBuffer& toFill + ); + bool scanAttValue + ( + const XMLAttDef* const attDef + , XMLBuffer& toFill + ); + bool scanContent(); + + // ----------------------------------------------------------------------- + // IdentityConstraints Activation methods + // ----------------------------------------------------------------------- + inline bool toCheckIdentityConstraint() const; + + // ----------------------------------------------------------------------- + // Grammar preparsing methods + // ----------------------------------------------------------------------- + Grammar* loadXMLSchemaGrammar(const InputSource& src, const bool toCache = false); + + // ----------------------------------------------------------------------- + // PSVI handling methods + // ----------------------------------------------------------------------- + void endElementPSVI(SchemaElementDecl* const elemDecl, + DatatypeValidator* const memberDV); + void resetPSVIElemContext(); +}; + +inline const XMLCh* SGXMLScanner::getName() const +{ + return XMLUni::fgSGXMLScanner; +} + +inline bool SGXMLScanner::toCheckIdentityConstraint() const +{ + return fValidate && fIdentityConstraintChecking && fICHandler; +} + +inline Grammar::GrammarType SGXMLScanner::getCurrentGrammarType() const +{ + return fGrammarType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.cpp b/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.cpp new file mode 100644 index 000000000..4de4c3cca --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.cpp @@ -0,0 +1,217 @@ +/* + * 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: ValidationContextImpl.cpp 903149 2010-01-26 09:58:40Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructor and Destructor +// --------------------------------------------------------------------------- + +ValidationContextImpl::~ValidationContextImpl() +{ + if (fIdRefList) + delete fIdRefList; +} + +ValidationContextImpl::ValidationContextImpl(MemoryManager* const manager) +:ValidationContext(manager) +,fIdRefList(0) +,fEntityDeclPool(0) +,fToCheckIdRefList(true) +,fValidatingMemberType(0) +,fElemStack(0) +,fScanner(0) +,fNamespaceScope(0) +{ + fIdRefList = new (fMemoryManager) RefHashTableOf(109, fMemoryManager); +} + +/** + * IdRefList + * + */ +RefHashTableOf* ValidationContextImpl::getIdRefList() const +{ + return fIdRefList; +} + +void ValidationContextImpl::setIdRefList(RefHashTableOf* const newIdRefList) +{ + if (fIdRefList) + delete fIdRefList; + + fIdRefList = newIdRefList; +} + +void ValidationContextImpl::clearIdRefList() +{ + if (fIdRefList) + fIdRefList->removeAll(); + +} + +void ValidationContextImpl::addId(const XMLCh * const content) +{ + if (!fIdRefList || !fToCheckIdRefList) + return; + + XMLRefInfo* idEntry = fIdRefList->get(content); + + if (idEntry) + { + if (idEntry->getDeclared()) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_ID_Not_Unique + , content + , fMemoryManager); + } + } + else + { + idEntry = new (fMemoryManager) XMLRefInfo(content, false, false, fMemoryManager); + fIdRefList->put((void*)idEntry->getRefName(), idEntry); + } + + // + // Mark it declared + // + idEntry->setDeclared(true); + +} + +void ValidationContextImpl::addIdRef(const XMLCh * const content) +{ + if (!fIdRefList || !fToCheckIdRefList) + return; + + XMLRefInfo* idEntry = fIdRefList->get(content); + + if (!idEntry) + { + idEntry = new (fMemoryManager) XMLRefInfo(content, false, false, fMemoryManager); + fIdRefList->put((void*)idEntry->getRefName(), idEntry); + } + + // + // Mark it used + // + idEntry->setUsed(true); + +} + +void ValidationContextImpl::toCheckIdRefList(bool toCheck) +{ + fToCheckIdRefList = toCheck; +} + +/** + * EntityDeclPool + * + */ +const NameIdPool* ValidationContextImpl::getEntityDeclPool() const +{ + return fEntityDeclPool; +} + +const NameIdPool* ValidationContextImpl::setEntityDeclPool(const NameIdPool* const newEntityDeclPool) +{ + // we don't own it so we return the existing one for the owner to delete + const NameIdPool* tempPool = fEntityDeclPool; + fEntityDeclPool = newEntityDeclPool; + return tempPool; + +} + +void ValidationContextImpl::checkEntity(const XMLCh * const content) const +{ + + if (fEntityDeclPool) + { + const DTDEntityDecl* decl = fEntityDeclPool->getByKey(content); + + if (!decl || !decl->isUnparsed()) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_ENTITY_Invalid + , content + , fMemoryManager); + } + + } + else + { + ThrowXMLwithMemMgr1 + ( + InvalidDatatypeValueException + , XMLExcepts::VALUE_ENTITY_Invalid + , content + , fMemoryManager + ); + } + +} + +/* QName + */ +bool ValidationContextImpl::isPrefixUnknown(XMLCh* prefix) { + bool unknown = false; + if (XMLString::equals(prefix, XMLUni::fgXMLNSString)) { + return true; + } + else if (!XMLString::equals(prefix, XMLUni::fgXMLString)) { + if(fElemStack && !fElemStack->isEmpty()) + fElemStack->mapPrefixToURI(prefix, unknown); + else if(fNamespaceScope) + unknown = (fNamespaceScope->getNamespaceForPrefix(prefix)==fNamespaceScope->getEmptyNamespaceId()); + } + return unknown; +} + +const XMLCh* ValidationContextImpl::getURIForPrefix(XMLCh* prefix) { + bool unknown = false; + unsigned int uriId = 0; + if(fElemStack) + uriId = fElemStack->mapPrefixToURI(prefix, unknown); + else if(fNamespaceScope) + { + uriId = fNamespaceScope->getNamespaceForPrefix(prefix); + unknown = uriId == fNamespaceScope->getEmptyNamespaceId(); + } + if (!unknown) + return fScanner->getURIText(uriId); + + return XMLUni::fgZeroLenString; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.hpp b/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.hpp new file mode 100644 index 000000000..5bb82c057 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/ValidationContextImpl.hpp @@ -0,0 +1,173 @@ +/* + * 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: ValidationContextImpl.hpp 729944 2008-12-29 17:03:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_VALIDATION_CONTEXTIMPL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN +class ElemStack; +class NamespaceScope; + +class XMLPARSER_EXPORT ValidationContextImpl : public ValidationContext +{ +public : + // ----------------------------------------------------------------------- + /** @name Virtual destructor for derived classes */ + // ----------------------------------------------------------------------- + //@{ + + /** + * virtual destructor + * + */ + virtual ~ValidationContextImpl(); + + ValidationContextImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + + //@} + + // ----------------------------------------------------------------------- + /** @name The ValidationContextImpl Interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * IDRefList + * + */ + virtual RefHashTableOf* getIdRefList() const; + + virtual void setIdRefList(RefHashTableOf* const); + + virtual void clearIdRefList(); + + virtual void addId(const XMLCh * const ); + + virtual void addIdRef(const XMLCh * const ); + + virtual void toCheckIdRefList(bool); + + /** + * EntityDeclPool + * + */ + virtual const NameIdPool* getEntityDeclPool() const; + + virtual const NameIdPool* setEntityDeclPool(const NameIdPool* const); + + virtual void checkEntity(const XMLCh * const ) const; + + + /** + * Union datatype handling + * + */ + + virtual DatatypeValidator * getValidatingMemberType() const; + virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) ; + + /** + * QName datatype handling + * Create default implementations for source code compatibility + */ + virtual bool isPrefixUnknown(XMLCh* prefix); + virtual void setElemStack(ElemStack* elemStack); + virtual const XMLCh* getURIForPrefix(XMLCh* prefix); + virtual void setScanner(XMLScanner* scanner); + virtual void setNamespaceScope(NamespaceScope* nsStack); + + + //@} + +private: + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + ValidationContextImpl(const ValidationContextImpl& ); + ValidationContextImpl& operator=(const ValidationContextImpl& ); + //@} + + // ----------------------------------------------------------------------- + // Data members + // + // fIDRefList: owned/adopted + // This is a list of XMLRefInfo objects. This member lets us do all + // needed ID-IDREF balancing checks. + // + // fEntityDeclPool: referenced only + // This is a pool of EntityDecl objects, which contains all of the + // general entities that are declared in the DTD subsets, plus the + // default entities (such as > < ...) defined by the XML Standard. + // + // fToAddToList + // fValidatingMemberType + // The member type in a union that actually + // validated some text. Note that the validationContext does not + // own this object, and the value of getValidatingMemberType + // will not be accurate unless the type of the most recently-validated + // element/attribute is in fact a union datatype. + // fElemStack + // Need access to elemstack to look up URI's that are inscope (while validating an XML). + // fNamespaceScope + // Need access to namespace scope to look up URI's that are inscope (while loading a schema). + // ----------------------------------------------------------------------- + + RefHashTableOf* fIdRefList; + const NameIdPool* fEntityDeclPool; + bool fToCheckIdRefList; + DatatypeValidator * fValidatingMemberType; + ElemStack* fElemStack; + XMLScanner* fScanner; + NamespaceScope* fNamespaceScope; + +}; + + + +inline DatatypeValidator * ValidationContextImpl::getValidatingMemberType() const +{ + return fValidatingMemberType; +} + +inline void ValidationContextImpl::setValidatingMemberType(DatatypeValidator * validatingMemberType) +{ + fValidatingMemberType = validatingMemberType; +} + +inline void ValidationContextImpl::setElemStack(ElemStack* elemStack) { + fElemStack = elemStack; +} + +inline void ValidationContextImpl::setScanner(XMLScanner* scanner) { + fScanner = scanner; +} + +inline void ValidationContextImpl::setNamespaceScope(NamespaceScope* nsStack) { + fNamespaceScope = nsStack; +} + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.cpp b/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.cpp new file mode 100644 index 000000000..7f2ce70e7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.cpp @@ -0,0 +1,159 @@ +/* + * 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: VecAttrListImpl.cpp 672273 2008-06-27 13:57:00Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +VecAttrListImpl::VecAttrListImpl() : + + fAdopt(false) + , fCount(0) + , fVector(0) +{ +} + +VecAttrListImpl::~VecAttrListImpl() +{ + // + // Note that some compilers can't deal with the fact that the pointer + // is to a const object, so we have to cast off the const'ness here! + // + if (fAdopt) + delete (RefVectorOf*)fVector; +} + + +// --------------------------------------------------------------------------- +// Implementation of the attribute list interface +// --------------------------------------------------------------------------- +XMLSize_t VecAttrListImpl::getLength() const +{ + return fCount; +} + +const XMLCh* VecAttrListImpl::getName(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return fVector->elementAt(index)->getQName(); +} + +const XMLCh* VecAttrListImpl::getType(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return XMLAttDef::getAttTypeString(fVector->elementAt(index)->getType(), fVector->getMemoryManager()); +} + +const XMLCh* VecAttrListImpl::getValue(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return fVector->elementAt(index)->getValue(); +} + +const XMLCh* VecAttrListImpl::getType(const XMLCh* const name) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + for (XMLSize_t index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + if (XMLString::equals(curElem->getQName(), name)) + return XMLAttDef::getAttTypeString(curElem->getType(), fVector->getMemoryManager()); + } + return 0; +} + +const XMLCh* VecAttrListImpl::getValue(const XMLCh* const name) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + for (XMLSize_t index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + if (XMLString::equals(curElem->getQName(), name)) + return curElem->getValue(); + } + return 0; +} + +const XMLCh* VecAttrListImpl::getValue(const char* const name) const +{ + // Temporarily transcode the name for lookup + XMLCh* wideName = XMLString::transcode(name, XMLPlatformUtils::fgMemoryManager); + ArrayJanitor janName(wideName, XMLPlatformUtils::fgMemoryManager); + + // + // Search the vector for the attribute with the given name and return + // its type. + // + for (XMLSize_t index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + if (XMLString::equals(curElem->getQName(), wideName)) + return curElem->getValue(); + } + return 0; +} + + + +// --------------------------------------------------------------------------- +// Setter methods +// --------------------------------------------------------------------------- +void VecAttrListImpl::setVector(const RefVectorOf* const srcVec + , const XMLSize_t count + , const bool adopt) +{ + // + // Delete the previous vector (if any) if we are adopting. Note that some + // compilers can't deal with the fact that the pointer is to a const + // object, so we have to cast off the const'ness here! + // + if (fAdopt) + delete (RefVectorOf*)fVector; + + fAdopt = adopt; + fCount = count; + fVector = srcVec; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.hpp b/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.hpp new file mode 100644 index 000000000..22ae2d508 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/VecAttrListImpl.hpp @@ -0,0 +1,96 @@ +/* + * 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: VecAttrListImpl.hpp 672273 2008-06-27 13:57:00Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VECATTRLISTIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_VECATTRLISTIMPL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT VecAttrListImpl : public XMemory, public AttributeList +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + VecAttrListImpl(); + ~VecAttrListImpl(); + + + // ----------------------------------------------------------------------- + // Implementation of the attribute list interface + // ----------------------------------------------------------------------- + virtual XMLSize_t getLength() const; + virtual const XMLCh* getName(const XMLSize_t index) const; + virtual const XMLCh* getType(const XMLSize_t index) const; + virtual const XMLCh* getValue(const XMLSize_t index) const; + virtual const XMLCh* getType(const XMLCh* const name) const; + virtual const XMLCh* getValue(const XMLCh* const name) const; + virtual const XMLCh* getValue(const char* const name) const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setVector + ( + const RefVectorOf* const srcVec + , const XMLSize_t count + , const bool adopt = false + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + VecAttrListImpl(const VecAttrListImpl&); + VecAttrListImpl& operator=(const VecAttrListImpl&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fAdopt + // Indicates whether the passed vector is to be adopted or not. If + // so, we destroy it when we are destroyed (and when a new vector is + // set!) + // + // fCount + // The count of elements in the vector that should be considered + // valid. This is an optimization to allow vector elements to be + // reused over and over but a different count of them be valid for + // each use. + // + // fVector + // The vector that provides the backing for the list. + // ----------------------------------------------------------------------- + bool fAdopt; + XMLSize_t fCount; + const RefVectorOf* fVector; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.cpp b/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.cpp new file mode 100644 index 000000000..f475cad3c --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.cpp @@ -0,0 +1,249 @@ +/* + * 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: VecAttributesImpl.cpp 672311 2008-06-27 16:05:01Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +VecAttributesImpl::VecAttributesImpl() : + + fAdopt(false) + , fCount(0) + , fVector(0) + , fScanner(0) +{ +} + +VecAttributesImpl::~VecAttributesImpl() +{ + // + // Note that some compilers can't deal with the fact that the pointer + // is to a const object, so we have to cast off the const'ness here! + // + if (fAdopt) + delete (RefVectorOf*)fVector; +} + + +// --------------------------------------------------------------------------- +// Implementation of the attribute list interface +// --------------------------------------------------------------------------- +XMLSize_t VecAttributesImpl::getLength() const +{ + return fCount; +} + +const XMLCh* VecAttributesImpl::getURI(const XMLSize_t index) const +{ + // since this func really needs to be const, like the rest, not sure how we + // make it const and re-use the fURIBuffer member variable. we're currently + // creating a buffer each time you need a URI. there has to be a better + // way to do this... + + //XMLBuffer tempBuf; + if (index >= fCount) { + + + return 0; + } + //fValidator->getURIText(fVector->elementAt(index)->getURIId(), tempBuf) ; + //return tempBuf.getRawBuffer() ; + return fScanner->getURIText(fVector->elementAt(index)->getURIId()); +} + +const XMLCh* VecAttributesImpl::getLocalName(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return fVector->elementAt(index)->getName(); +} + +const XMLCh* VecAttributesImpl::getQName(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return fVector->elementAt(index)->getQName(); +} + +const XMLCh* VecAttributesImpl::getType(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return XMLAttDef::getAttTypeString(fVector->elementAt(index)->getType(), fVector->getMemoryManager()); +} + +const XMLCh* VecAttributesImpl::getValue(const XMLSize_t index) const +{ + if (index >= fCount) { + return 0; + } + return fVector->elementAt(index)->getValue(); +} + +bool VecAttributesImpl::getIndex(const XMLCh* const uri, + const XMLCh* const localPart, + XMLSize_t& index) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + XMLBuffer uriBuffer(1023, fVector->getMemoryManager()) ; + for (index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + fScanner->getURIText(curElem->getURIId(), uriBuffer) ; + + if ( (XMLString::equals(curElem->getName(), localPart)) && + (XMLString::equals(uriBuffer.getRawBuffer(), uri)) ) + return true; + } + return false; +} + +int VecAttributesImpl::getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + XMLBuffer uriBuffer(1023, fVector->getMemoryManager()) ; + for (XMLSize_t index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + fScanner->getURIText(curElem->getURIId(), uriBuffer) ; + + if ( (XMLString::equals(curElem->getName(), localPart)) && + (XMLString::equals(uriBuffer.getRawBuffer(), uri)) ) + return (int)index ; + } + return -1; +} + +bool VecAttributesImpl::getIndex(const XMLCh* const qName, + XMLSize_t& index) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + for (index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + if (XMLString::equals(curElem->getQName(), qName)) + return true; + } + return false; +} + +int VecAttributesImpl::getIndex(const XMLCh* const qName ) const +{ + // + // Search the vector for the attribute with the given name and return + // its type. + // + for (XMLSize_t index = 0; index < fCount; index++) + { + const XMLAttr* curElem = fVector->elementAt(index); + + if (XMLString::equals(curElem->getQName(), qName)) + return (int)index ; + } + return -1; +} + +const XMLCh* VecAttributesImpl::getType(const XMLCh* const uri, const XMLCh* const localPart ) const +{ + XMLSize_t i; + + if (getIndex(uri, localPart, i)) + return getType(i); + else + return 0; +} + +const XMLCh* VecAttributesImpl::getType(const XMLCh* const qName) const +{ + XMLSize_t i; + + if (getIndex(qName, i)) + return getType(i); + else + return 0; +} + +const XMLCh* VecAttributesImpl::getValue(const XMLCh* const uri, const XMLCh* const localPart ) const +{ + XMLSize_t i; + + if (getIndex(uri, localPart, i)) + return getValue(i); + else + return 0; +} + +const XMLCh* VecAttributesImpl::getValue(const XMLCh* const qName) const +{ + XMLSize_t i; + + if (getIndex(qName, i)) + return getValue(i); + else + return 0; +} + +// --------------------------------------------------------------------------- +// Setter methods +// --------------------------------------------------------------------------- +void VecAttributesImpl::setVector(const RefVectorOf* const srcVec + , const XMLSize_t count + , const XMLScanner * const scanner + , const bool adopt) +{ + // + // Delete the previous vector (if any) if we are adopting. Note that some + // compilers can't deal with the fact that the pointer is to a const + // object, so we have to cast off the const'ness here! + // + if (fAdopt) + delete (RefVectorOf*)fVector; + + fAdopt = adopt; + fCount = count; + fVector = srcVec; + fScanner = scanner ; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.hpp b/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.hpp new file mode 100644 index 000000000..a7b1c1fb7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/VecAttributesImpl.hpp @@ -0,0 +1,117 @@ +/* + * 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: VecAttributesImpl.hpp 672311 2008-06-27 16:05:01Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VECATTRIBUTESIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_VECATTRIBUTESIMPL_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT VecAttributesImpl : public Attributes +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + VecAttributesImpl(); + ~VecAttributesImpl(); + + + // ----------------------------------------------------------------------- + // Implementation of the attributes interface + // ----------------------------------------------------------------------- + virtual XMLSize_t getLength() const ; + + virtual const XMLCh* getURI(const XMLSize_t index) const; + virtual const XMLCh* getLocalName(const XMLSize_t index) const ; + virtual const XMLCh* getQName(const XMLSize_t index) const ; + virtual const XMLCh* getType(const XMLSize_t index) const ; + virtual const XMLCh* getValue(const XMLSize_t index) const ; + + virtual bool getIndex(const XMLCh* const uri, const XMLCh* const localPart, XMLSize_t& index) const; + virtual int getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const ; + virtual bool getIndex(const XMLCh* const qName, XMLSize_t& index) const; + virtual int getIndex(const XMLCh* const qName ) const ; + + virtual const XMLCh* getType(const XMLCh* const uri, const XMLCh* const localPart ) const ; + virtual const XMLCh* getType(const XMLCh* const qName) const ; + + virtual const XMLCh* getValue(const XMLCh* const qName) const; + virtual const XMLCh* getValue(const XMLCh* const uri, const XMLCh* const localPart ) const ; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setVector + ( + const RefVectorOf* const srcVec + , const XMLSize_t count + , const XMLScanner * const scanner + , const bool adopt = false + ); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + VecAttributesImpl(const VecAttributesImpl&); + VecAttributesImpl& operator=(const VecAttributesImpl&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fAdopt + // Indicates whether the passed vector is to be adopted or not. If + // so, we destroy it when we are destroyed (and when a new vector is + // set!) + // + // fCount + // The count of elements in the vector that should be considered + // valid. This is an optimization to allow vector elements to be + // reused over and over but a different count of them be valid for + // each use. + // + // fVector + // The vector that provides the backing for the list. + // + // fScanner + // This is a pointer to the in use Scanner, so that we can resolve + // namespace URIs from UriIds + // + // fURIBuffer + // A temporary buffer which is re-used when getting namespace URI's + // ----------------------------------------------------------------------- + bool fAdopt; + XMLSize_t fCount; + const RefVectorOf* fVector; + const XMLScanner * fScanner ; +}; + +XERCES_CPP_NAMESPACE_END + +#endif // ! VECATTRIBUTESIMPL_HPP diff --git a/project/jni/xerces/src/xercesc/internal/WFXMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/WFXMLScanner.cpp new file mode 100644 index 000000000..587f6aab0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/WFXMLScanner.cpp @@ -0,0 +1,2055 @@ +/* + * 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: WFXMLScanner.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// WFXMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ReaderMgrResetType; + + +WFXMLScanner::WFXMLScanner( XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(valToAdopt, grammarResolver, manager) + , fElementIndex(0) + , fElements(0) + , fEntityTable(0) + , fAttrNameHashList(0) + , fAttrNSList(0) + , fElementLookup(0) +{ + CleanupType cleanup(this, &WFXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +WFXMLScanner::WFXMLScanner( XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errHandler + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) : + + XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt, grammarResolver, manager) + , fElementIndex(0) + , fElements(0) + , fEntityTable(0) + , fAttrNameHashList(0) + , fAttrNSList(0) + , fElementLookup(0) +{ + CleanupType cleanup(this, &WFXMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +WFXMLScanner::~WFXMLScanner() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- +NameIdPool* WFXMLScanner::getEntityDeclPool() +{ + return 0; +} + +const NameIdPool* WFXMLScanner::getEntityDeclPool() const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// WFXMLScanner: Main entry point to scan a document +// --------------------------------------------------------------------------- +void WFXMLScanner::scanDocument(const InputSource& src) +{ + // Bump up the sequence id for this parser instance. This will invalidate + // any previous progressive scan tokens. + fSequenceId++; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + // Reset the scanner and its plugged in stuff for a new run. This + // resets all the data structures, creates the initial reader and + // pushes it on the stack, and sets up the base document path. + scanReset(src); + + // If we have a document handler, then call the start document + if (fDocHandler) + fDocHandler->startDocument(); + + // Scan the prolog part, which is everything before the root element + // including the DTD subsets. + scanProlog(); + + // If we got to the end of input, then its not a valid XML file. + // Else, go on to scan the content. + if (fReaderMgr.atEOF()) + { + emitError(XMLErrs::EmptyMainEntity); + } + else + { + // Scan content, and tell it its not an external entity + if (scanContent()) + { + // That went ok, so scan for any miscellaneous stuff + if (!fReaderMgr.atEOF()) + scanMiscellaneous(); + } + } + + // If we have a document handler, then call the end document + if (fDocHandler) + fDocHandler->endDocument(); + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so fall through + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so fall through + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } +} + + +bool WFXMLScanner::scanNext(XMLPScanToken& token) +{ + // Make sure this token is still legal + if (!isLegalToken(token)) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_BadPScanToken, fMemoryManager); + + // Find the next token and remember the reader id + XMLSize_t orgReader; + XMLTokens curToken; + bool retVal = true; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + try + { + while (true) + { + // We have to handle any end of entity exceptions that happen here. + // We could be at the end of X nested entities, each of which will + // generate an end of entity exception as we try to move forward. + try + { + curToken = senseNextToken(orgReader); + break; + } + catch(const EndOfEntityException& toCatch) + { + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + if (curToken == Token_CharData) + { + scanCharData(fCDataBuf); + } + else if (curToken == Token_EOF) + { + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + retVal = false; + } + else + { + // Its some sort of markup + bool gotData = true; + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // If we hit the end, then do the miscellaneous part + if (!gotData) + { + // That went ok, so scan for any miscellaneous stuff + scanMiscellaneous(); + + if (fDocHandler) + fDocHandler->endDocument(); + } + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception, so return failure + retVal = false; + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, so return failure + retVal = false; + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + // Return failure + retVal = false; + } + catch(const OutOfMemoryException&) + { + throw; + } + + // If we are not at the end, release the object that will + // reset the ReaderMgr. + if (retVal) + resetReaderMgr.release(); + + return retVal; +} + + + +// --------------------------------------------------------------------------- +// WFXMLScanner: Private helper methods. +// --------------------------------------------------------------------------- + +// This method handles the common initialization, to avoid having to do +// it redundantly in multiple constructors. +void WFXMLScanner::commonInit() +{ + fEntityTable = new (fMemoryManager) ValueHashTableOf(11, fMemoryManager); + fAttrNameHashList = new (fMemoryManager)ValueVectorOf(16, fMemoryManager); + fAttrNSList = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + fElements = new (fMemoryManager) RefVectorOf(32, true, fMemoryManager); + fElementLookup = new (fMemoryManager) RefHashTableOf(109, false, fMemoryManager); + + // Add the default entity entries for the character refs that must always + // be present. + fEntityTable->put((void*) XMLUni::fgAmp, chAmpersand); + fEntityTable->put((void*) XMLUni::fgLT, chOpenAngle); + fEntityTable->put((void*) XMLUni::fgGT, chCloseAngle); + fEntityTable->put((void*) XMLUni::fgQuot, chDoubleQuote); + fEntityTable->put((void*) XMLUni::fgApos, chSingleQuote); +} + +void WFXMLScanner::cleanUp() +{ + delete fEntityTable; + delete fAttrNameHashList; + delete fAttrNSList; + delete fElementLookup; + delete fElements; +} + +// This method will reset the scanner data structures, and related plugged +// in stuff, for a new scan session. We get the input source for the primary +// XML entity, create the reader for it, and push it on the stack so that +// upon successful return from here we are ready to go. +void WFXMLScanner::scanReset(const InputSource& src) +{ + // For all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Reset the element stack, and give it the latest ids for the special + // URIs it has to know about. + fElemStack.reset + ( + fEmptyNamespaceId + , fUnknownNamespaceId + , fXMLNamespaceId + , fXMLNSNamespaceId + ); + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fElementIndex = 0; + + // Reset elements lookup table + fElementLookup->removeAll(); + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , true + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // Push this read onto the reader manager + fReaderMgr.pushReader(newReader, 0); + + // and reset security-related things if necessary: + if(fSecurityManager != 0) + { + fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } +} + +// This method is called between markup in content. It scans for character +// data that is sent to the document handler. It watches for any markup +// characters that would indicate that the character data has ended. It also +// handles expansion of general and character entities. +// +// sendData() is a local static helper for this method which handles some +// code that must be done in three different places here. +void WFXMLScanner::sendCharData(XMLBuffer& toSend) +{ + // If no data in the buffer, then nothing to do + if (toSend.isEmpty()) + return; + + // Always assume its just char data if not validating + if (fDocHandler) + fDocHandler->docCharacters(toSend.getRawBuffer(), toSend.getLen(), false); + + // Reset buffer + toSend.reset(); +} + +// --------------------------------------------------------------------------- +// WFXMLScanner: Private scanning methods +// --------------------------------------------------------------------------- + +// This method will kick off the scanning of the primary content of the +// document, i.e. the elements. +bool WFXMLScanner::scanContent() +{ + // Go into a loop until we hit the end of the root element, or we fall + // out because there is no root element. + // + // We have to do kind of a deeply nested double loop here in order to + // avoid doing the setup/teardown of the exception handler on each + // round. Doing it this way we only do it when an exception actually + // occurs. + bool gotData = true; + bool inMarkup = false; + while (gotData) + { + try + { + while (gotData) + { + // Sense what the next top level token is. According to what + // this tells us, we will call something to handle that kind + // of thing. + XMLSize_t orgReader; + const XMLTokens curToken = senseNextToken(orgReader); + + // Handle character data and end of file specially. Char data + // is not markup so we don't want to handle it in the loop + // below. + if (curToken == Token_CharData) + { + // Scan the character data and call appropriate events. Let + // him use our local character data buffer for efficiency. + scanCharData(fCDataBuf); + continue; + } + else if (curToken == Token_EOF) + { + // The element stack better be empty at this point or we + // ended prematurely before all elements were closed. + if (!fElemStack.isEmpty()) + { + const ElemStack::StackElem* topElem = fElemStack.popTop(); + emitError + ( + XMLErrs::EndedWithTagsOnStack + , topElem->fThisElement->getFullName() + ); + } + + // Its the end of file, so clear the got data flag + gotData = false; + continue; + } + + // We are in some sort of markup now + inMarkup = true; + + // According to the token we got, call the appropriate + // scanning method. + switch(curToken) + { + case Token_CData : + // Make sure we are within content + if (fElemStack.isEmpty()) + emitError(XMLErrs::CDATAOutsideOfContent); + scanCDSection(); + break; + + case Token_Comment : + scanComment(); + break; + + case Token_EndTag : + scanEndTag(gotData); + break; + + case Token_PI : + scanPI(); + break; + + case Token_StartTag : + if (fDoNamespaces) + scanStartTagNS(gotData); + else + scanStartTag(gotData); + break; + + default : + fReaderMgr.skipToChar(chOpenAngle); + break; + } + + if (orgReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // And we are back out of markup again + inMarkup = false; + } + } + catch(const EndOfEntityException& toCatch) + { + // If we were in some markup when this happened, then its a + // partial markup error. + if (inMarkup) + emitError(XMLErrs::PartialMarkupInEntity); + + // Send an end of entity reference event + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + + inMarkup = false; + } + } + + // It went ok, so return success + return true; +} + + +void WFXMLScanner::scanEndTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the end of the root element. + gotData = true; + + // Check if the element stack is empty. If so, then this is an unbalanced + // element (i.e. more ends than starts, perhaps because of bad text + // causing one to be skipped.) + if (fElemStack.isEmpty()) + { + emitError(XMLErrs::MoreEndThanStartTags); + fReaderMgr.skipPastChar(chCloseAngle); + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd, fMemoryManager); + } + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + unsigned int uriId = (fDoNamespaces) + ? fElemStack.getCurrentURI() : fEmptyNamespaceId; + const ElemStack::StackElem* topElem = fElemStack.popTop(); + + // See if it was the root element, to avoid multiple calls below + const bool isRoot = fElemStack.isEmpty(); + + // Make sure that its the end of the element that we expect + if (!fReaderMgr.skippedStringLong(topElem->fThisElement->getFullName())) + { + emitError + ( + XMLErrs::ExpectedEndOfTagX + , topElem->fThisElement->getFullName() + ); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // Make sure we are back on the same reader as where we started + if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialTagMarkupError); + + // Skip optional whitespace + fReaderMgr.skipPastSpaces(); + + // Make sure we find the closing bracket + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError + ( + XMLErrs::UnterminatedEndTag + , topElem->fThisElement->getFullName() + ); + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + fDocHandler->endElement + ( + *topElem->fThisElement + , uriId + , isRoot + , topElem->fThisElement->getElementName()->getPrefix() + ); + } + + // If this was the root, then done with content + gotData = !isRoot; +} + +void WFXMLScanner::scanDocTypeDecl() +{ + // Just skips over it + // REVISIT: Should we issue a warning + static const XMLCh doctypeIE[] = + { + chOpenSquare, chCloseAngle, chNull + }; + XMLCh nextCh = fReaderMgr.skipUntilIn(doctypeIE); + + if (nextCh == chOpenSquare) + fReaderMgr.skipPastChar(chCloseSquare); + + fReaderMgr.skipPastChar(chCloseAngle); +} + +bool WFXMLScanner::scanStartTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Get the QName. In this case, we are not doing namespaces, so we just + // use it as is and don't have to break it into parts. + if (!fReaderMgr.getName(fQNameBuf)) + { + emitError(XMLErrs::ExpectedElementName); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // Assume it won't be an empty tag + bool isEmpty = false; + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Lets try to look up the element + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + XMLElementDecl* elemDecl = fElementLookup->get(qnameRawBuf); + + if (!elemDecl) { + + if (fElementIndex < fElements->size()) { + elemDecl = fElements->elementAt(fElementIndex); + } + else { + elemDecl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + fGrammarPoolMemoryManager + ); + fElements->addElement(elemDecl); + } + + elemDecl->setElementName(XMLUni::fgZeroLenString, qnameRawBuf, fEmptyNamespaceId); + fElementLookup->put((void*)elemDecl->getFullName(), elemDecl); + fElementIndex++; + } + + // Expand the element stack and add the new element + fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum()); + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // We loop until we either see a /> or >, handling attribute/value + // pairs until we get there. + XMLSize_t attCount = 0; + XMLSize_t curAttListSize = fAttrList->size(); + while (true) + { + // And get the next non-space character + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + bool bFoundSpace; + fReaderMgr.skipPastSpaces(bFoundSpace); + if (!bFoundSpace) + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + // Ok, peek another char + nextCh = fReaderMgr.peekNextChar(); + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + if (!fReaderMgr.getName(fAttNameBuf)) + { + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.skipPastChar(chCloseAngle); + return false; + } + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // See if this attribute is declared more than one for this element. + const XMLCh* attNameRawBuf = fAttNameBuf.getRawBuffer(); + XMLSize_t attNameHash = XMLString::hash(attNameRawBuf, 109); + + if (attCount) { + + for (XMLSize_t k=0; k < attCount; k++) { + + if (fAttrNameHashList->elementAt(k) == attNameHash) { + if ( + XMLString::equals + ( + fAttrList->elementAt(k)->getName() + , attNameRawBuf + ) + ) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , attNameRawBuf + , qnameRawBuf + ); + break; + } + } + } + } + + // Skip any whitespace before the value and then scan the att + // value. This will come back normalized with entity refs and + // char refs expanded. + fReaderMgr.skipPastSpaces(); + if (!scanAttValue(attNameRawBuf, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // Add this attribute to the attribute list that we use to + // pass them to the handler. We reuse its existing elements + // but expand it as required. + XMLAttr* curAtt; + if (attCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr + ( + 0 + , attNameRawBuf + , XMLUni::fgZeroLenString + , fAttValueBuf.getRawBuffer() + , XMLAttDef::CData + , true + , fMemoryManager + ); + fAttrList->addElement(curAtt); + fAttrNameHashList->addElement(attNameHash); + } + else + { + curAtt = fAttrList->elementAt(attCount); + curAtt->set + ( + 0 + , attNameRawBuf + , XMLUni::fgZeroLenString + , fAttValueBuf.getRawBuffer() + ); + curAtt->setSpecified(true); + fAttrNameHashList->setElementAt(attNameHash, attCount); + } + attCount++; + + // And jump back to the top of the loop + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, elemDecl->getFullName()); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + } + + // If we have a document handler, then tell it about this start tag. We + // don't have any URI id to send along, so send fEmptyNamespaceId. We also do not send + // any prefix since its just one big name if we are not doing namespaces. + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , fEmptyNamespaceId + , 0 + , *fAttrList + , attCount + , isEmpty + , isRoot + ); + } + + return true; +} + + +// This method is called to scan a start tag when we are processing +// namespaces. There are two different versions of this method, one for +// namespace aware processing an done for non-namespace aware processing. +// +// This method is called after we've scanned the < of a start tag. So we +// have to get the element name, then scan the attributes, after which +// we are either going to see >, />, or attributes followed by one of those +// sequences. +bool WFXMLScanner::scanStartTagNS(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // The current position is after the open bracket, so we need to read in + // in the element name. + int colonPosition; + if (!fReaderMgr.getQName(fQNameBuf, &colonPosition)) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Assume it won't be an empty tag + bool isEmpty = false; + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // Lets try to look up the element + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + XMLElementDecl* elemDecl = fElementLookup->get(qnameRawBuf); + + if (!elemDecl) { + if (!XMLString::compareNString(qnameRawBuf, XMLUni::fgXMLNSColonString, 6)) + emitError(XMLErrs::NoXMLNSAsElementPrefix, qnameRawBuf); + + if (fElementIndex < fElements->size()) { + elemDecl = fElements->elementAt(fElementIndex); + } + else { + elemDecl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + fGrammarPoolMemoryManager + ); + fElements->addElement(elemDecl); + } + + elemDecl->setElementName(qnameRawBuf, fEmptyNamespaceId); + fElementLookup->put((void*)elemDecl->getFullName(), elemDecl); + fElementIndex++; + } + + // Expand the element stack and add the new element + fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum()); + + // reset NS attribute list + fAttrNSList->removeAllElements(); + + // We loop until we either see a /> or >, handling attribute/value + // pairs until we get there. + XMLSize_t attCount = 0; + XMLSize_t curAttListSize = fAttrList->size(); + while (true) + { + // And get the next non-space character + XMLCh nextCh = fReaderMgr.peekNextChar(); + + // If the next character is not a slash or closed angle bracket, + // then it must be whitespace, since whitespace is required + // between the end of the last attribute and the name of the next + // one. + if (attCount) + { + if ((nextCh != chForwardSlash) && (nextCh != chCloseAngle)) + { + bool bFoundSpace; + fReaderMgr.skipPastSpaces(bFoundSpace); + if (!bFoundSpace) + { + // Emit the error but keep on going + emitError(XMLErrs::ExpectedWhitespace); + } + // Ok, peek another char + nextCh = fReaderMgr.peekNextChar(); + } + } + + // Ok, here we first check for any of the special case characters. + // If its not one, then we do the normal case processing, which + // assumes that we've hit an attribute value, Otherwise, we do all + // the special case checks. + if (!fReaderMgr.getCurrentReader()->isSpecialStartTagChar(nextCh)) + { + // Assume its going to be an attribute, so get a name from + // the input. + int colonPosition; + if (!fReaderMgr.getQName(fAttNameBuf, &colonPosition)) + { + if (fAttNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedAttrName); + else + emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer()); + fReaderMgr.skipPastChar(chCloseAngle); + return false; + } + + // And next must be an equal sign + if (!scanEq()) + { + static const XMLCh tmpList[] = + { + chSingleQuote, chDoubleQuote, chCloseAngle + , chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedEqSign); + + // Try to sync back up by skipping forward until we either + // hit something meaningful. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) || (chFound == chForwardSlash)) + { + // Jump back to top for normal processing of these + continue; + } + else if ((chFound == chSingleQuote) + || (chFound == chDoubleQuote) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through assuming that the value is to follow + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // See if this attribute is declared more than one for this element. + const XMLCh* attNameRawBuf = fAttNameBuf.getRawBuffer(); + XMLSize_t attNameHash = XMLString::hash(attNameRawBuf, 109); + if (attCount) { + + for (XMLSize_t k=0; k < attCount; k++) { + + if (fAttrNameHashList->elementAt(k) == attNameHash) { + if (XMLString::equals( + fAttrList->elementAt(k)->getQName() + , attNameRawBuf)) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , attNameRawBuf + , qnameRawBuf + ); + break; + } + } + } + } + + // Skip any whitespace before the value and then scan the att + // value. This will come back normalized with entity refs and + // char refs expanded. + fReaderMgr.skipPastSpaces(); + if (!scanAttValue(attNameRawBuf, fAttValueBuf)) + { + static const XMLCh tmpList[] = + { + chCloseAngle, chOpenAngle, chForwardSlash, chNull + }; + + emitError(XMLErrs::ExpectedAttrValue); + + // It failed, so lets try to get synced back up. We skip + // forward until we find some whitespace or one of the + // chars in our list. + const XMLCh chFound = fReaderMgr.skipUntilInOrWS(tmpList); + + if ((chFound == chCloseAngle) + || (chFound == chForwardSlash) + || fReaderMgr.getCurrentReader()->isWhitespace(chFound)) + { + // Just fall through and process this attribute, though + // the value will be "". + } + else if (chFound == chOpenAngle) + { + // Assume a malformed tag and that new one is starting + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + return false; + } + else + { + // Something went really wrong + return false; + } + } + + // Add this attribute to the attribute list that we use to + // pass them to the handler. We reuse its existing elements + // but expand it as required. + const XMLCh* attValueRawBuf = fAttValueBuf.getRawBuffer(); + XMLAttr* curAtt = 0; + if (attCount >= curAttListSize) + { + curAtt = new (fMemoryManager) XMLAttr + ( + fEmptyNamespaceId + , attNameRawBuf + , attValueRawBuf + , XMLAttDef::CData + , true + , fMemoryManager + ); + fAttrList->addElement(curAtt); + fAttrNameHashList->addElement(attNameHash); + } + else + { + curAtt = fAttrList->elementAt(attCount); + curAtt->set + ( + fEmptyNamespaceId + , attNameRawBuf + , attValueRawBuf + ); + curAtt->setSpecified(true); + fAttrNameHashList->setElementAt(attNameHash, attCount); + } + + // Map prefix to namespace + const XMLCh* attPrefix = curAtt->getPrefix(); + const XMLCh* attLocalName = curAtt->getName(); + const XMLCh* namespaceURI = fAttValueBuf.getRawBuffer(); + + if (attPrefix && *attPrefix) { + if (XMLString::equals(attPrefix, XMLUni::fgXMLString)) { + curAtt->setURIId(fXMLNamespaceId); + } + else if (XMLString::equals(attPrefix, XMLUni::fgXMLNSString)) { + + if (XMLString::equals(attLocalName, XMLUni::fgXMLNSString)) + emitError(XMLErrs::NoUseOfxmlnsAsPrefix); + else if (XMLString::equals(attLocalName, XMLUni::fgXMLString)) { + if (!XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) + emitError(XMLErrs::PrefixXMLNotMatchXMLURI); + } + + if (!namespaceURI) + emitError(XMLErrs::NoEmptyStrNamespace, attNameRawBuf); + else if(!*namespaceURI && fXMLVersion == XMLReader::XMLV1_0) + emitError(XMLErrs::NoEmptyStrNamespace, attNameRawBuf); + + fElemStack.addPrefix + ( + attLocalName + , fURIStringPool->addOrFind(namespaceURI) + ); + curAtt->setURIId(fXMLNSNamespaceId); + } + else { + fAttrNSList->addElement(curAtt); + } + } + else { + if (XMLString::equals(XMLUni::fgXMLNSString, attLocalName)) { + + if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName)) + emitError(XMLErrs::NoUseOfxmlnsURI); + else if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName)) + emitError(XMLErrs::XMLURINotMatchXMLPrefix); + + fElemStack.addPrefix + ( + XMLUni::fgZeroLenString + , fURIStringPool->addOrFind(namespaceURI) + ); + } + } + + // increment attribute count + attCount++; + + // And jump back to the top of the loop + continue; + } + + // It was some special case character so do all of the checks and + // deal with it. + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chForwardSlash) + { + fReaderMgr.getNextChar(); + isEmpty = true; + if (!fReaderMgr.skippedChar(chCloseAngle)) + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + break; + } + else if (nextCh == chCloseAngle) + { + fReaderMgr.getNextChar(); + break; + } + else if (nextCh == chOpenAngle) + { + // Check for this one specially, since its going to be common + // and it is kind of auto-recovering since we've already hit the + // next open bracket, which is what we would have seeked to (and + // skipped this whole tag.) + emitError(XMLErrs::UnterminatedStartTag, qnameRawBuf); + break; + } + else if ((nextCh == chSingleQuote) || (nextCh == chDoubleQuote)) + { + // Check for this one specially, which is probably a missing + // attribute name, e.g. ="value". Just issue expected name + // error and eat the quoted string, then jump back to the + // top again. + emitError(XMLErrs::ExpectedAttrName); + fReaderMgr.getNextChar(); + fReaderMgr.skipQuotedString(nextCh); + fReaderMgr.skipPastSpaces(); + continue; + } + } + + // Handle provided attributes that we did not map their prefixes + for (unsigned int i=0; i < fAttrNSList->size(); i++) { + + XMLAttr* providedAttr = fAttrNSList->elementAt(i); + + providedAttr->setURIId + ( + resolvePrefix + ( + providedAttr->getPrefix(), + ElemStack::Mode_Attribute + ) + ); + } + + if(attCount) { + + // + // Decide if to use hash table to do duplicate checking + // + bool toUseHashTable = false; + setAttrDupChkRegistry(attCount, toUseHashTable); + + // check for duplicate namespace attributes: + // by checking for qualified names with the same local part and with prefixes + // which have been bound to namespace names that are identical. + XMLAttr* loopAttr; + XMLAttr* curAtt; + for (unsigned int attrIndex=0; attrIndex < attCount-1; attrIndex++) { + loopAttr = fAttrList->elementAt(attrIndex); + + if (!toUseHashTable) + { + for (unsigned int curAttrIndex = attrIndex+1; curAttrIndex < attCount; curAttrIndex++) { + curAtt = fAttrList->elementAt(curAttrIndex); + if (curAtt->getURIId() == loopAttr->getURIId() && + XMLString::equals(curAtt->getName(), loopAttr->getName())) { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , curAtt->getName() + , elemDecl->getFullName() + ); + } + } + } + else + { + if (fAttrDupChkRegistry->containsKey((void*)loopAttr->getName(), loopAttr->getURIId())) + { + emitError + ( + XMLErrs::AttrAlreadyUsedInSTag + , loopAttr->getName() + , elemDecl->getFullName() + ); + } + + fAttrDupChkRegistry->put((void*)loopAttr->getName(), loopAttr->getURIId(), loopAttr); + } + } + } + + // Resolve the qualified name to a URI. + unsigned int uriId = resolvePrefix + ( + elemDecl->getElementName()->getPrefix() + , ElemStack::Mode_Element + ); + + // Now we can update the element stack + fElemStack.setCurrentURI(uriId); + + // Tell the document handler about this start tag + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl + , uriId + , elemDecl->getElementName()->getPrefix() + , *fAttrList + , attCount + , isEmpty + , isRoot + ); + } + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If the elem stack is empty, then it was an empty root + if (isRoot) + gotData = false; + } + + return true; +} + +// --------------------------------------------------------------------------- +// XMLScanner: Private parsing methods +// --------------------------------------------------------------------------- +bool WFXMLScanner::scanAttValue(const XMLCh* const attrName + , XMLBuffer& toFill) +{ + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + XMLCh nextCh; + XMLCh secondCh = 0; + bool gotLeadingSurrogate = false; + bool escaped; + while (true) + { + try + { + while(true) + { + nextCh = fReaderMgr.getNextChar(); + + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Check for our ending quote in the same entity + if (nextCh == quoteCh) + { + if (curReader == fReaderMgr.getCurrentReaderNum()) + return true; + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr.getCurrentReaderNum()) + { + emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // Check for an entity ref now, before we let it affect our + // whitespace normalization logic below. We ignore the empty flag + // in this one. + escaped = false; + if (nextCh == chAmpersand) + { + if (scanEntityRef(true, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacterInAttrValue, attrName, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // If its not escaped, then make sure its not a < character, which + // is not allowed in attribute values. + if (!escaped) { + if (nextCh == chOpenAngle) + emitError(XMLErrs::BracketInAttrValue, attrName); + else if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + nextCh = chSpace; + } + + // Else add it to the buffer + toFill.append(nextCh); + + if (secondCh) + { + toFill.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException&) + { + // Just eat it and continue. + gotLeadingSurrogate = false; + escaped = false; + } + } + return true; +} + + +// This method scans a CDATA section. It collects the character into one +// of the temp buffers and calls the document handler, if any, with the +// characters. It assumes that the docCharacters + ( + bbCData.getRawBuffer() + , bbCData.getLen() + , true + ); + } + + // And we are done + break; + } + + // Make sure its a valid character. But if we've emitted an error + // already, don't bother with the overhead since we've already told + // them about it. + if (!emittedError) + { + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + emittedError = true; + } + } + gotLeadingSurrogate = false; + } + } + + // Add it to the buffer + bbCData.append(nextCh); + } +} + + +void WFXMLScanner::scanCharData(XMLBuffer& toUse) +{ + // We have to watch for the stupid ]]> sequence, which is illegal in + // character data. So this is a little state machine that handles that. + enum States + { + State_Waiting + , State_GotOne + , State_GotTwo + }; + + // Reset the buffer before we start + toUse.reset(); + + // Turn on the 'throw at end' flag of the reader manager + ThrowEOEJanitor jan(&fReaderMgr, true); + + // In order to be more efficient we have to use kind of a deeply nested + // set of blocks here. The outer block puts on a try and catches end of + // entity exceptions. The inner loop is the per-character loop. If we + // put the try inside the inner loop, it would work but would require + // the exception handling code setup/teardown code to be invoked for + // each character. + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = State_Waiting; + bool escaped = false; + bool gotLeadingSurrogate = false; + bool notDone = true; + while (notDone) + { + try + { + while (true) + { + // Eat through as many plain content characters as possible without + // needing special handling. Moving most content characters here, + // in this one call, rather than running the overall loop once + // per content character, is a speed optimization. + if (curState == State_Waiting && !gotLeadingSurrogate) + { + fReaderMgr.movePlainContentChars(toUse); + } + + // Try to get another char from the source + // The code from here on down covers all contengencies, + if (!fReaderMgr.getNextCharIfNot(chOpenAngle, nextCh)) + { + // If we were waiting for a trailing surrogate, its an error + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + + notDone = false; + break; + } + + // Watch for a reference. Note that the escapement mechanism + // is ignored in this content. + escaped = false; + if (nextCh == chAmpersand) + { + sendCharData(toUse); + + // Turn off the throwing at the end of entity during this + ThrowEOEJanitor jan(&fReaderMgr, false); + + if (scanEntityRef(false, nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Deal with surrogate pairs + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) { + emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + + // Keep the state machine up to date + if (!escaped) + { + if (nextCh == chCloseSquare) + { + if (curState == State_Waiting) + curState = State_GotOne; + else if (curState == State_GotOne) + curState = State_GotTwo; + } + else if (nextCh == chCloseAngle) + { + if (curState == State_GotTwo) + emitError(XMLErrs::BadSequenceInCharData); + curState = State_Waiting; + } + else + { + curState = State_Waiting; + } + } + else + { + curState = State_Waiting; + } + + // Add this char to the buffer + toUse.append(nextCh); + + if (secondCh) + { + toUse.append(secondCh); + secondCh=0; + } + } + } + catch(const EndOfEntityException& toCatch) + { + // Some entity ended, so we have to send any accumulated + // chars and send an end of entity event. + sendCharData(toUse); + gotLeadingSurrogate = false; + + if (fDocHandler) + fDocHandler->endEntityReference(toCatch.getEntity()); + } + } + + // Send any char data that we accumulated into the buffer + sendCharData(toUse); +} + +InputSource* WFXMLScanner::resolveSystemId(const XMLCh* const /*sysId*/ + ,const XMLCh* const /*pubId*/) +{ + return 0; +} + +// This method will scan a general/character entity ref. It will either +// expand a char ref and return it directly, or push a reader for a general +// entity. +// +// The return value indicates whether the char parameters hold the value +// or whether the value was pushed as a reader, or that it failed. +// +// The escaped flag tells the caller whether the returned parameter resulted +// from a character reference, which escapes the character in some cases. It +// only makes any difference if the return value indicates the value was +// returned directly. +XMLScanner::EntityExpRes +WFXMLScanner::scanEntityRef(const bool + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped) +{ + // Assume no escape + secondCh = 0; + escaped = false; + + // We have to insure that its all in one entity + const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum(); + + // If the next char is a pound, then its a character reference and we + // need to expand it always. + if (fReaderMgr.skippedChar(chPound)) + { + // Its a character reference, so scan it and get back the numeric + // value it represents. + if (!scanCharRef(firstCh, secondCh)) + return EntityExp_Failed; + + escaped = true; + + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + return EntityExp_Returned; + } + + // Expand it since its a normal entity ref + XMLBufBid bbName(&fBufMgr); + if (!fReaderMgr.getName(bbName.getBuffer())) + { + emitError(XMLErrs::ExpectedEntityRefName); + return EntityExp_Failed; + } + + // Next char must be a semi-colon. But if its not, just emit + // an error and try to continue. + if (!fReaderMgr.skippedChar(chSemiColon)) + emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // Make sure we ended up on the same entity reader as the & char + if (curReader != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialMarkupInEntity); + + // Look up the name in the general entity pool + // If it does not exist, then obviously an error + if (!fEntityTable->containsKey(bbName.getRawBuffer())) + { + // XML 1.0 Section 4.1 + // Well-formedness Constraint for entity not found: + // In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, + // or a document with "standalone='yes'", for an entity reference that does not occur within the external subset + // or a parameter entity + if (fStandalone || fHasNoDTD) + emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + + return EntityExp_Failed; + } + + // here's where we need to check if there's a SecurityManager, + // how many entity references we've had + if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) { + XMLCh expLimStr[32]; + XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager); + emitError + ( + XMLErrs::EntityExpansionLimitExceeded + , expLimStr + ); + // there seems nothing better to be done than to reset the entity expansion counter + fEntityExpansionCount = 0; + } + + firstCh = fEntityTable->get(bbName.getRawBuffer()); + escaped = true; + return EntityExp_Returned; +} + +// --------------------------------------------------------------------------- +// WFXMLScanner: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* WFXMLScanner::loadGrammar(const InputSource& + , const short + , const bool) +{ + // REVISIT: emit a warning or throw an exception + return 0; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/WFXMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/WFXMLScanner.hpp new file mode 100644 index 000000000..960858de4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/WFXMLScanner.hpp @@ -0,0 +1,153 @@ +/* + * 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: WFXMLScanner.hpp 810580 2009-09-02 15:52:22Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_WFXMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_WFXMLSCANNER_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// This is a a non-validating scanner. No DOCTYPE or XML Schema processing +// will take place. +class XMLPARSER_EXPORT WFXMLScanner : public XMLScanner +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + WFXMLScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + WFXMLScanner + ( + XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~WFXMLScanner(); + + // ----------------------------------------------------------------------- + // XMLScanner public virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const; + virtual NameIdPool* getEntityDeclPool(); + virtual const NameIdPool* getEntityDeclPool() const; + virtual void scanDocument + ( + const InputSource& src + ); + virtual bool scanNext(XMLPScanToken& toFill); + virtual Grammar* loadGrammar + ( + const InputSource& src + , const short grammarType + , const bool toCache = false + ); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + WFXMLScanner(); + WFXMLScanner(const WFXMLScanner&); + WFXMLScanner& operator=(const WFXMLScanner&); + + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanCDSection(); + virtual void scanCharData(XMLBuffer& toToUse); + virtual EntityExpRes scanEntityRef + ( + const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped + ); + virtual void scanDocTypeDecl(); + virtual void scanReset(const InputSource& src); + virtual void sendCharData(XMLBuffer& toSend); + virtual InputSource* resolveSystemId(const XMLCh* const sysId + ,const XMLCh* const pubId); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void commonInit(); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Private scanning methods + // ----------------------------------------------------------------------- + bool scanAttValue + ( + const XMLCh* const attrName + , XMLBuffer& toFill + ); + bool scanContent(); + void scanEndTag(bool& gotData); + bool scanStartTag(bool& gotData); + bool scanStartTagNS(bool& gotData); + + // ----------------------------------------------------------------------- + // Data members + // + // fEntityTable + // This the table that contains the default entity entries. + // + // fAttrNameHashList + // This contains the hash value for attribute names. It's used when + // checking for duplicate attributes. + // + // fAttrNSList + // This contains XMLAttr objects that we need to map their prefixes + // to URIs when namespace is enabled. + // + // ----------------------------------------------------------------------- + unsigned int fElementIndex; + RefVectorOf* fElements; + ValueHashTableOf* fEntityTable; + ValueVectorOf* fAttrNameHashList; + ValueVectorOf* fAttrNSList; + RefHashTableOf* fElementLookup; +}; + +inline const XMLCh* WFXMLScanner::getName() const +{ + return XMLUni::fgWFXMLScanner; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XMLInternalErrorHandler.hpp b/project/jni/xerces/src/xercesc/internal/XMLInternalErrorHandler.hpp new file mode 100644 index 000000000..7d3239d05 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLInternalErrorHandler.hpp @@ -0,0 +1,139 @@ +/* + * 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: XMLInternalErrorHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLINTERNALERRORHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLINTERNALERRORHANDLER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLInternalErrorHandler : public ErrorHandler +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLInternalErrorHandler(ErrorHandler* userHandler = 0) : + fSawWarning(false), + fSawError(false), + fSawFatal(false), + fUserErrorHandler(userHandler) + { + } + + ~XMLInternalErrorHandler() + { + } + + // ----------------------------------------------------------------------- + // Implementation of the error handler interface + // ----------------------------------------------------------------------- + void warning(const SAXParseException& toCatch); + void error(const SAXParseException& toCatch); + void fatalError(const SAXParseException& toCatch); + void resetErrors(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getSawWarning() const; + bool getSawError() const; + bool getSawFatal() const; + + // ----------------------------------------------------------------------- + // Private data members + // + // fSawWarning + // This is set if we get any warning, and is queryable via a getter + // method. + // + // fSawError + // This is set if we get any errors, and is queryable via a getter + // method. + // + // fSawFatal + // This is set if we get any fatal, and is queryable via a getter + // method. + // + // fUserErrorHandler + // This is the error handler from user + // ----------------------------------------------------------------------- + bool fSawWarning; + bool fSawError; + bool fSawFatal; + ErrorHandler* fUserErrorHandler; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLInternalErrorHandler(const XMLInternalErrorHandler&); + XMLInternalErrorHandler& operator=(const XMLInternalErrorHandler&); +}; + +inline bool XMLInternalErrorHandler::getSawWarning() const +{ + return fSawWarning; +} + +inline bool XMLInternalErrorHandler::getSawError() const +{ + return fSawError; +} + +inline bool XMLInternalErrorHandler::getSawFatal() const +{ + return fSawFatal; +} + +inline void XMLInternalErrorHandler::warning(const SAXParseException& toCatch) +{ + fSawWarning = true; + if (fUserErrorHandler) + fUserErrorHandler->warning(toCatch); +} + +inline void XMLInternalErrorHandler::error(const SAXParseException& toCatch) +{ + fSawError = true; + if (fUserErrorHandler) + fUserErrorHandler->error(toCatch); +} + +inline void XMLInternalErrorHandler::fatalError(const SAXParseException& toCatch) +{ + fSawFatal = true; + if (fUserErrorHandler) + fUserErrorHandler->fatalError(toCatch); +} + +inline void XMLInternalErrorHandler::resetErrors() +{ + fSawWarning = false; + fSawError = false; + fSawFatal = false; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XMLReader.cpp b/project/jni/xerces/src/xercesc/internal/XMLReader.cpp new file mode 100644 index 000000000..16fc11e98 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLReader.cpp @@ -0,0 +1,1895 @@ +/* + * 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: XMLReader.cpp 901280 2010-01-20 17:06:14Z johns $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLReader: Query Methods +// --------------------------------------------------------------------------- +// Checks whether all of the chars in the passed buffer are whitespace or +// not. Breaks out on the first non-whitespace. +// +bool XMLReader::isAllSpaces(const XMLCh* const toCheck + , const XMLSize_t count) const +{ + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + while (curCh < endPtr) + { + if (!(fgCharCharsTable[*curCh++] & gWhitespaceCharMask)) + return false; + } + return true; +} + + +// +// Checks whether at least one of the chars in the passed buffer are whitespace or +// not. +// +bool XMLReader::containsWhiteSpace(const XMLCh* const toCheck + , const XMLSize_t count) const +{ + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + while (curCh < endPtr) + { + if (fgCharCharsTable[*curCh++] & gWhitespaceCharMask) + return true; + } + return false; +} + +// +// This one is not called terribly often, so call the XMLChar utility +// +bool XMLReader::isPublicIdChar(const XMLCh toCheck) const +{ + if (fXMLVersion == XMLV1_1) + return XMLChar1_1::isPublicIdChar(toCheck); + else + return XMLChar1_0::isPublicIdChar(toCheck); +} + +// --------------------------------------------------------------------------- +// XMLReader: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLReader::XMLReader(const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd + , const bool calculateSrcOfs + , XMLSize_t lowWaterMark + , const XMLVersion version + , MemoryManager* const manager) : + fCharIndex(0) + , fCharsAvail(0) + , fCurCol(1) + , fCurLine(1) + , fEncodingStr(0) + , fForcedEncoding(false) + , fNoMore(false) + , fPublicId(XMLString::replicate(pubId, manager)) + , fRawBufIndex(0) + , fRawBytesAvail(0) + , fLowWaterMark (lowWaterMark) + , fReaderNum(0xFFFFFFFF) + , fRefFrom(from) + , fSentTrailingSpace(false) + , fSource(source) + , fSrcOfsBase(0) + , fSrcOfsSupported(false) + , fCalculateSrcOfs(calculateSrcOfs) + , fSystemId(XMLString::replicate(sysId, manager)) + , fStream(streamToAdopt) + , fSwapped(false) + , fThrowAtEnd(throwAtEnd) + , fTranscoder(0) + , fType(type) + , fMemoryManager(manager) +{ + setXMLVersion(version); + + // Do an initial load of raw bytes + refreshRawBuffer(); + + // Ask the transcoding service if it supports src offset info + fSrcOfsSupported = XMLPlatformUtils::fgTransService->supportsSrcOfs(); + + // + // Use the recognizer class to get a basic sense of what family of + // encodings this file is in. We'll start off with a reader of that + // type, and update it later if needed when we read the XMLDecl line. + // + fEncoding = XMLRecognizer::basicEncodingProbe(fRawByteBuf, fRawBytesAvail); + + #if defined(XERCES_DEBUG) + if ((fEncoding < XMLRecognizer::Encodings_Min) + || (fEncoding > XMLRecognizer::Encodings_Max)) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Reader_BadAutoEncoding, fMemoryManager); + } + #endif + + fEncodingStr = XMLString::replicate(XMLRecognizer::nameForEncoding(fEncoding, fMemoryManager), fMemoryManager); + + // Check whether the fSwapped flag should be set or not + checkForSwapped(); + + // + // This will check to see if the first line is an XMLDecl and, if + // so, decode that first line manually one character at a time. This + // leaves enough characters in the buffer that the high level code + // can get through the Decl and call us back with the real encoding. + // + doInitDecode(); + + // + // NOTE: We won't create a transcoder until we either get a call to + // setEncoding() or we get a call to refreshCharBuffer() and no + // transcoder has been set yet. + // +} + + +XMLReader::XMLReader(const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , const XMLCh* const encodingStr + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd + , const bool calculateSrcOfs + , XMLSize_t lowWaterMark + , const XMLVersion version + , MemoryManager* const manager) : + fCharIndex(0) + , fCharsAvail(0) + , fCurCol(1) + , fCurLine(1) + , fEncoding(XMLRecognizer::UTF_8) + , fEncodingStr(0) + , fForcedEncoding(true) + , fNoMore(false) + , fPublicId(XMLString::replicate(pubId, manager)) + , fRawBufIndex(0) + , fRawBytesAvail(0) + , fLowWaterMark (lowWaterMark) + , fReaderNum(0xFFFFFFFF) + , fRefFrom(from) + , fSentTrailingSpace(false) + , fSource(source) + , fSrcOfsBase(0) + , fSrcOfsSupported(false) + , fCalculateSrcOfs(calculateSrcOfs) + , fSystemId(XMLString::replicate(sysId, manager)) + , fStream(streamToAdopt) + , fSwapped(false) + , fThrowAtEnd(throwAtEnd) + , fTranscoder(0) + , fType(type) + , fMemoryManager(manager) +{ + setXMLVersion(version); + + // Do an initial load of raw bytes + refreshRawBuffer(); + + // Copy the encoding string to our member + fEncodingStr = XMLString::replicate(encodingStr, fMemoryManager); + XMLString::upperCaseASCII(fEncodingStr); + + // Ask the transcoding service if it supports src offset info + fSrcOfsSupported = XMLPlatformUtils::fgTransService->supportsSrcOfs(); + + // + // Map the passed encoding name to one of our enums. If it does not + // match one of the intrinsic encodings, it will come back 'other', + // which tells us to create a transcoder based reader. + // + fEncoding = XMLRecognizer::encodingForName(fEncodingStr); + + // test the presence of the BOM and remove it from the source + switch(fEncoding) + { + case XMLRecognizer::UCS_4B : + case XMLRecognizer::UCS_4L : + { + if (fRawBytesAvail > 4 && + (((fRawByteBuf[0] == 0x00) && (fRawByteBuf[1] == 0x00) && (fRawByteBuf[2] == 0xFE) && (fRawByteBuf[3] == 0xFF)) || + ((fRawByteBuf[0] == 0xFF) && (fRawByteBuf[1] == 0xFE) && (fRawByteBuf[2] == 0x00) && (fRawByteBuf[3] == 0x00))) ) + { + fRawBufIndex += 4; + } + break; + } + case XMLRecognizer::UTF_8 : + { + // Look at the raw buffer as short chars + const char* asChars = (const char*)fRawByteBuf; + + if (fRawBytesAvail > XMLRecognizer::fgUTF8BOMLen && + XMLString::compareNString( asChars + , XMLRecognizer::fgUTF8BOM + , XMLRecognizer::fgUTF8BOMLen) == 0) + { + fRawBufIndex += XMLRecognizer::fgUTF8BOMLen; + } + break; + } + case XMLRecognizer::UTF_16B : + case XMLRecognizer::UTF_16L : + { + if (fRawBytesAvail < 2) + break; + + const UTF16Ch* asUTF16 = (const UTF16Ch*)&fRawByteBuf[fRawBufIndex]; + if ((*asUTF16 == chUnicodeMarker) || (*asUTF16 == chSwappedUnicodeMarker)) + { + fRawBufIndex += sizeof(UTF16Ch); + } + break; + } + case XMLRecognizer::EBCDIC: + case XMLRecognizer::US_ASCII: + case XMLRecognizer::XERCES_XMLCH: + case XMLRecognizer::OtherEncoding: + case XMLRecognizer::Encodings_Count: + { + // silence warning about enumeration not being used + break; + } + } + + // Check whether the fSwapped flag should be set or not + checkForSwapped(); + + // + // Create a transcoder for the encoding. Since the encoding has been + // forced, this will be the one we will use, period. + // + XMLTransService::Codes failReason; + if (fEncoding == XMLRecognizer::OtherEncoding) + { + // + // fEncodingStr not pre-recognized, use it + // directly for transcoder + // + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fEncodingStr + , failReason + , kCharBufSize + , fMemoryManager + ); + } + else + { + // + // Use the recognized fEncoding to create the transcoder + // + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fEncoding + , failReason + , kCharBufSize + , fMemoryManager + ); + + } + + if (!fTranscoder) + { + // We are about to throw which means the d-tor won't be called. + // Clean up some memory. + // + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + ArrayJanitor jan (fEncodingStr, fMemoryManager); + + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , fEncodingStr + , fMemoryManager + ); + } + + // + // Note that, unlike above, we do not do an initial decode of the + // first line. We take the caller's word that the encoding is correct + // and just assume that the first bulk decode (kicked off by the first + // get of a character) will work. + // + // So we do here the slipping in of the leading space if required. + // + if ((fType == Type_PE) && (fRefFrom == RefFrom_NonLiteral)) + { + // This represents no data from the source + fCharSizeBuf[fCharsAvail] = 0; + fCharOfsBuf[fCharsAvail] = 0; + fCharBuf[fCharsAvail++] = chSpace; + } +} + + +XMLReader::XMLReader(const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , XMLRecognizer::Encodings encodingEnum + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd + , const bool calculateSrcOfs + , XMLSize_t lowWaterMark + , const XMLVersion version + , MemoryManager* const manager) : + fCharIndex(0) + , fCharsAvail(0) + , fCurCol(1) + , fCurLine(1) + , fEncoding(XMLRecognizer::UTF_8) + , fEncodingStr(0) + , fForcedEncoding(true) + , fNoMore(false) + , fPublicId(XMLString::replicate(pubId, manager)) + , fRawBufIndex(0) + , fRawBytesAvail(0) + , fLowWaterMark (lowWaterMark) + , fReaderNum(0xFFFFFFFF) + , fRefFrom(from) + , fSentTrailingSpace(false) + , fSource(source) + , fSrcOfsBase(0) + , fSrcOfsSupported(false) + , fCalculateSrcOfs(calculateSrcOfs) + , fSystemId(XMLString::replicate(sysId, manager)) + , fStream(streamToAdopt) + , fSwapped(false) + , fThrowAtEnd(throwAtEnd) + , fTranscoder(0) + , fType(type) + , fMemoryManager(manager) +{ + setXMLVersion(version); + + // Do an initial load of raw bytes + refreshRawBuffer(); + + // Ask the transcoding service if it supports src offset info + fSrcOfsSupported = XMLPlatformUtils::fgTransService->supportsSrcOfs(); + + // + // Use the passed encoding code + // + fEncoding = encodingEnum; + fEncodingStr = XMLString::replicate(XMLRecognizer::nameForEncoding(fEncoding, fMemoryManager), fMemoryManager); + + // Check whether the fSwapped flag should be set or not + checkForSwapped(); + + // + // Create a transcoder for the encoding. Since the encoding has been + // forced, this will be the one we will use, period. + // + XMLTransService::Codes failReason; + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fEncoding + , failReason + , kCharBufSize + , fMemoryManager + ); + + if (!fTranscoder) + { + // We are about to throw which means the d-tor won't be called. + // Clean up some memory. + // + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + ArrayJanitor jan (fEncodingStr, fMemoryManager); + + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , fEncodingStr + , fMemoryManager + ); + } + + // + // Note that, unlike above, we do not do an initial decode of the + // first line. We take the caller's word that the encoding is correct + // and just assume that the first bulk decode (kicked off by the first + // get of a character) will work. + // + // So we do here the slipping in of the leading space if required. + // + if ((fType == Type_PE) && (fRefFrom == RefFrom_NonLiteral)) + { + // This represents no data from the source + fCharSizeBuf[fCharsAvail] = 0; + fCharOfsBuf[fCharsAvail] = 0; + fCharBuf[fCharsAvail++] = chSpace; + } +} + + +XMLReader::~XMLReader() +{ + fMemoryManager->deallocate(fEncodingStr); + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); + delete fStream; + delete fTranscoder; +} + + +// --------------------------------------------------------------------------- +// XMLReader: Character buffer management methods +// --------------------------------------------------------------------------- +XMLFilePos XMLReader::getSrcOffset() const +{ + if (!fSrcOfsSupported || !fCalculateSrcOfs) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Reader_SrcOfsNotSupported, fMemoryManager); + + // + // Take the current source offset and add in the sizes that we've + // eaten from the source so far. + // + if( fCharIndex == 0 ) { + return fSrcOfsBase; + } + + if( fCharIndex < fCharsAvail ) { + + return (fSrcOfsBase + fCharOfsBuf[fCharIndex]); + } + + return (fSrcOfsBase + fCharOfsBuf[fCharIndex-1] + fCharSizeBuf[fCharIndex-1]); +} + + +bool XMLReader::refreshCharBuffer() +{ + // If the no more flag is set, then don't bother doing anything. + if (fNoMore) + return false; + + XMLSize_t startInd; + + // See if we have any existing chars. + const XMLSize_t spareChars = fCharsAvail - fCharIndex; + + // If we are full, then don't do anything. + if (spareChars == kCharBufSize) + return true; + + // + // If no transcoder has been created yet, then we never saw the + // any encoding="" string and the encoding was not forced, so lets + // create one now. We know that it won't change now. + // + // However, note that if we autosensed EBCDIC, then we have to + // consider it an error if we never got an encoding since we don't + // know what variant of EBCDIC it is. + // + if (!fTranscoder) + { + if (fEncoding == XMLRecognizer::EBCDIC) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Reader_EncodingStrRequired, fMemoryManager); + + // Ask the transcoding service to make use a transcoder + XMLTransService::Codes failReason; + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fEncodingStr + , failReason + , kCharBufSize + , fMemoryManager + ); + + if (!fTranscoder) + { + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Trans_CantCreateCvtrFor + , fEncodingStr + , fMemoryManager + ); + } + } + + // + // Add the number of source bytes eaten so far to the base src + // offset member. + // + if (fCalculateSrcOfs) { + for (startInd = 0; startInd < fCharIndex; startInd++) + fSrcOfsBase += fCharSizeBuf[startInd]; + } + + // + // If there are spare chars, then move then down to the bottom. We + // have to move the char sizes down also. + // + startInd = 0; + if (spareChars) + { + for (XMLSize_t index = fCharIndex; index < fCharsAvail; index++) + { + fCharBuf[startInd] = fCharBuf[index]; + fCharSizeBuf[startInd] = fCharSizeBuf[index]; + startInd++; + } + } + + // + // And then get more chars, starting after any spare chars that were + // left over from the last time. + // + fCharsAvail = xcodeMoreChars + ( + &fCharBuf[startInd] + , &fCharSizeBuf[startInd] + , kCharBufSize - spareChars + ); + + // Add back in the spare chars + fCharsAvail += spareChars; + + // Reset the buffer index to zero, so we start from the 0th char again + fCharIndex = 0; + + // + // If no chars available, then we have to check for one last thing. If + // this is reader for a PE and its not being expanded inside a literal, + // then unget a trailing space. We use a boolean to avoid triggering + // this more than once. + // + if (!fCharsAvail + && (fType == Type_PE) + && (fRefFrom == RefFrom_NonLiteral) + && !fSentTrailingSpace) + { + fCharBuf[0] = chSpace; + fCharsAvail = 1; + fSentTrailingSpace = true; + } + + // + // If we get here with no more chars, then set the fNoMore flag which + // lets us optimize and know without checking that no more chars are + // available. + // + if (!fCharsAvail) + fNoMore = true; + + // Calculate fCharOfsBuf using the elements from fCharBufSize + if (fCalculateSrcOfs) + { + unsigned int last = 0; + fCharOfsBuf[0] = 0; + for (XMLSize_t index = 1; index < fCharsAvail; ++index) { + fCharOfsBuf[index] = last+fCharSizeBuf[index-1]; + last = fCharOfsBuf[index]; + // code was: + // fCharOfsBuf[index] = fCharOfsBuf[index-1]+fCharSizeBuf[index-1]; + // but on Solaris 64 bit with sun studio 11 this didn't work as + // every value of fCharOfsBuf[] was 1. + } + } + + return (fCharsAvail != 0); +} + + + +// --------------------------------------------------------------------------- +// XMLReader: Scanning methods +// --------------------------------------------------------------------------- +bool XMLReader::getName(XMLBuffer& toFill, const bool token) +{ + // Ok, first lets see if we have chars in the buffer. If not, then lets + // reload. + if (fCharIndex == fCharsAvail) + { + if (!refreshCharBuffer()) + return false; + } + + XMLSize_t charIndex_start = fCharIndex; + + // Lets check the first char for being a first name char. If not, then + // what's the point in living mannnn? Just give up now. We only do this + // if its a name and not a name token that they want. + if (!token) + { + if (fXMLVersion == XMLV1_1 && ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F))) { + // make sure one more char is in the buffer, the transcoder + // should put only a complete surrogate pair into the buffer + assert(fCharIndex+1 < fCharsAvail); + if ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] > 0xDFFF)) + return false; + + // Looks ok, so lets eat it + fCharIndex += 2; + } + else { + if (!isFirstNameChar(fCharBuf[fCharIndex])) + return false; + + // Looks ok, so lets eat it + fCharIndex ++; + } + + } + + // And now we loop until we run out of data in this reader or we hit + // a non-name char. + while (true) + { + if (fXMLVersion == XMLV1_1) + { + while (fCharIndex < fCharsAvail) + { + // Check the current char and take it if its a name char. Else + // break out. + if ( (fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) ) + { + // make sure one more char is in the buffer, the transcoder + // should put only a complete surrogate pair into the buffer + assert(fCharIndex+1 < fCharsAvail); + if ( (fCharBuf[fCharIndex+1] < 0xDC00) || + (fCharBuf[fCharIndex+1] > 0xDFFF) ) + break; + fCharIndex += 2; + + } + else + { + if (!isNameChar(fCharBuf[fCharIndex])) + break; + fCharIndex++; + } + } + } + else // XMLV1_0 + { + while (fCharIndex < fCharsAvail) + { + if (!isNameChar(fCharBuf[fCharIndex])) + break; + fCharIndex++; + } + } + + // we have to copy the accepted character(s), and update column + if (fCharIndex != charIndex_start) + { + fCurCol += (XMLFileLoc)(fCharIndex - charIndex_start); + toFill.append(&fCharBuf[charIndex_start], fCharIndex - charIndex_start); + } + + // something is wrong if there is still something in the buffer + // or if we don't get no more, then break out. + if ((fCharIndex < fCharsAvail) || + !refreshCharBuffer()) + break; + + charIndex_start = fCharIndex; + } + + return !toFill.isEmpty(); +} + +bool XMLReader::getNCName(XMLBuffer& toFill) +{ + if (fCharIndex == fCharsAvail && !refreshCharBuffer()) + return false; + + XMLSize_t charIndex_start = fCharIndex, count; + // Lets check the first char for being a first name char. If not, then + // what's the point in living mannnn? Just give up now. We only do this + // if its a name and not a name token that they want. + if (fXMLVersion == XMLV1_1 + && ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F))) { + // make sure one more char is in the buffer, the transcoder + // should put only a complete surrogate pair into the buffer + assert(fCharIndex+1 < fCharsAvail); + if ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] > 0xDFFF)) + return false; + + // Looks ok, so lets eat it + fCharIndex += 2; + } + else { + if (!isFirstNCNameChar(fCharBuf[fCharIndex])) { + return false; + } + + // Looks ok, so lets eat it + fCharIndex++; + } + + do + { + if (fCharIndex == fCharsAvail) + { + // we have to copy the accepted character(s), and update the column number, + // before getting new data and losing the value of fCharIndex + if((count = fCharIndex - charIndex_start)!=0) + { + fCurCol += (XMLFileLoc)count; + toFill.append(&fCharBuf[charIndex_start], count); + } + if(!refreshCharBuffer()) + return true; + charIndex_start = fCharIndex; + } + + // Check the current char and take it if it's a name char + if (fXMLVersion == XMLV1_1) + { + while(fCharIndex < fCharsAvail) + { + if(isNCNameChar(fCharBuf[fCharIndex])) fCharIndex++; + else if((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) && ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] > 0xDFFF))) fCharIndex+=2; + else break; + } + } + else + while(fCharIndex < fCharsAvail && isNCNameChar(fCharBuf[fCharIndex])) fCharIndex++; + // if we didn't consume the entire buffer, we are done + } while(fCharIndex == fCharsAvail); + + // we have to copy the accepted character(s), and update column + if((count = fCharIndex - charIndex_start)!=0) + { + fCurCol += (XMLFileLoc)count; + toFill.append(&fCharBuf[charIndex_start], count); + } + return true; +} + +bool XMLReader::getQName(XMLBuffer& toFill, int* colonPosition) +{ + // We are only looking for two iterations (i.e. 'NCNAME':'NCNAME'). + // We will stop when we finished scanning for a QName (i.e. either a second + // colon or an invalid char). + if(!getNCName(toFill)) + { + *colonPosition = -1; + return false; + } + if (fCharIndex == fCharsAvail && !refreshCharBuffer()) + { + *colonPosition = -1; + return true; + } + if (fCharBuf[fCharIndex] != chColon) + { + *colonPosition = -1; + return true; + } + + *colonPosition = (int)toFill.getLen(); + toFill.append(chColon); + fCharIndex++; + fCurCol++; + return getNCName(toFill); +} + +bool XMLReader::getSpaces(XMLBuffer& toFill) +{ + // + // We just loop until we either hit a non-space or the end of this + // entity. We return true if we returned because of a non-space and + // false if because of end of entity. + // + // NOTE: We have to maintain line/col info here and we have to do + // whitespace normalization if we are not already internalized. + // + while (true) + { + // Loop through the current chars in the buffer + while (fCharIndex < fCharsAvail) + { + // Get the current char out of the buffer + XMLCh curCh = fCharBuf[fCharIndex]; + + // + // See if its a white space char. If so, then process it. Else + // we've hit a non-space and need to return. + // + if (isWhitespace(curCh)) + { + // Eat this char + fCharIndex++; + + // + // 'curCh' is a whitespace(x20|x9|xD|xA), so we only can have + // end-of-line combinations with a leading chCR(xD) or chLF(xA) + // + // 100000 x20 + // 001001 x9 + // 001010 chLF + // 001101 chCR + // ----------- + // 000110 == (chCR|chLF) & ~(0x9|0x20) + // + // if the result of thelogical-& operation is + // true : 'curCh' must be xA or xD + // false : 'curCh' must be x20 or x9 + // + if ( ( curCh & (chCR|chLF) & ~(0x9|0x20) ) == 0 ) + { + fCurCol++; + } else + { + handleEOL(curCh, false); + } + + // Ok we can add this guy to our buffer + toFill.append(curCh); + } + else + { + // Return true to indicate we broke out due to a whitespace + return true; + } + } + + // + // We've eaten up the current buffer, so lets try to reload it. If + // we don't get anything new, then break out. If we do, then we go + // back to the top to keep getting spaces. + // + if (!refreshCharBuffer()) + break; + } + return false; +} + + +bool XMLReader::getUpToCharOrWS(XMLBuffer& toFill, const XMLCh toCheck) +{ + while (true) + { + // Loop through the current chars in the buffer + while (fCharIndex < fCharsAvail) + { + // Get the current char out of the buffer + XMLCh curCh = fCharBuf[fCharIndex]; + + // + // See if its not a white space or our target char, then process + // it. Else, we need to return. + // + if (!isWhitespace(curCh) && (curCh != toCheck)) + { + // Eat this char + fCharIndex++; + + // + // 'curCh' is not a whitespace(x20|x9|xD|xA), so we only can + // have end-of-line combinations with a leading chNEL(x85) or + // chLineSeparator(x2028) + // + // 0010000000101000 chLineSeparator + // 0000000010000101 chNEL + // --------------------- + // 1101111101010010 == ~(chNEL|chLineSeparator) + // + // if the result of the logical-& operation is + // true : 'curCh' can not be chNEL or chLineSeparator + // false : 'curCh' can be chNEL or chLineSeparator + // + if ( curCh & (XMLCh) ~(chNEL|chLineSeparator) ) + { + fCurCol++; + } else + { + handleEOL(curCh, false); + } + + // Add it to our buffer + toFill.append(curCh); + } + else + { + return true; + } + } + + // + // We've eaten up the current buffer, so lets try to reload it. If + // we don't get anything new, then break out. If we do, then we go + // back to the top to keep getting spaces. + // + if (!refreshCharBuffer()) + break; + } + + // We never hit any non-space and ate up the whole reader + return false; + +} + +bool XMLReader::skipIfQuote(XMLCh& chGotten) +{ + if (fCharIndex == fCharsAvail && !refreshCharBuffer()) + return false; + + chGotten = fCharBuf[fCharIndex]; + if ((chGotten == chDoubleQuote) || (chGotten == chSingleQuote)) + { + fCharIndex++; + fCurCol++; + return true; + } + return false; +} + + +bool XMLReader::skipSpaces(bool& skippedSomething, bool inDecl) +{ + // DO NOT set the skippedSomething to 'false', but change it to be 'true' only + + // We enter a loop where we skip over spaces until we hit the end of + // this reader or a non-space value. The return indicates whether we + // hit the non-space (true) or the end (false). + do + { + // Loop through the current chars in the buffer + while (fCharIndex < fCharsAvail) + { + // See if its a white space char. If so, then process it. Else + // we've hit a non-space and need to return. + if (isWhitespace(fCharBuf[fCharIndex])) + { + // Get the current char out of the buffer and eat it + XMLCh curCh = fCharBuf[fCharIndex++]; + skippedSomething = true; + // + // 'curCh' is a whitespace(x20|x9|xD|xA), so we only can have + // end-of-line combinations with a leading chCR(xD) or chLF(xA) + // + // 100000 x20 + // 001001 x9 + // 001010 chLF + // 001101 chCR + // ----------- + // 000110 == (chCR|chLF) & ~(0x9|0x20) + // + // if the result of the logical-& operation is + // true : 'curCh' must be xA or xD + // false : 'curCh' must be x20 or x9 + // + if ( ( curCh & (chCR|chLF) & ~(0x9|0x20) ) == 0 ) + { + fCurCol++; + } else + { + handleEOL(curCh, inDecl); + } + } + else + return true; + } + + // We've eaten up the current buffer, so lets try to reload it. If + // we don't get anything new, then break out. If we do, then we go + // back to the top to keep getting spaces. + } while(refreshCharBuffer()); + + // We never hit any non-space and ate up the whole reader + return false; +} + +bool XMLReader::skippedChar(const XMLCh toSkip) +{ + // + // If the buffer is empty, then try to reload it. If we still get + // nothing, then return false. + // + if (fCharIndex == fCharsAvail) + { + if (!refreshCharBuffer()) + return false; + } + + // + // See if the current char is the one we want. If so, then we need + // to eat it and return true. + // + if (fCharBuf[fCharIndex] == toSkip) + { + fCharIndex++; + fCurCol++; + return true; + } + return false; +} + + +bool XMLReader::skippedSpace() +{ + // + // If the buffer is empty, then try to reload it. If we still get + // nothing, then return false. + // + if (fCharIndex == fCharsAvail) + { + if (!refreshCharBuffer()) + return false; + } + + // + // See if the current char is a whitespace. If so, then we need to eat + // it and return true. + // + const XMLCh curCh = fCharBuf[fCharIndex]; + if (isWhitespace(curCh)) + { + // Eat the character + fCharIndex++; + + // + // 'curCh' is a whitespace(x20|x9|xD|xA), so we only can have + // end-of-line combinations with a leading chCR(xD) or chLF(xA) + // + // 100000 x20 + // 001001 x9 + // 001010 chLF + // 001101 chCR + // ----------- + // 000110 == (chCR|chLF) & ~(0x9|0x20) + // + // if the result of the logical-& operation is + // true : 'curCh' must be xA or xD + // false : 'curCh' must be x20 or x9 + // + if ( ( curCh & (chCR|chLF) & ~(0x9|0x20) ) == 0 ) + { + fCurCol++; + } else + { + handleEOL((XMLCh&)curCh, false); + } + + return true; + } + return false; +} + +bool XMLReader::skippedString(const XMLCh* const toSkip) +{ + // This function works on strings that are smaller than kCharBufSize. + // This function guarantees that in case the comparison is unsuccessful + // the fCharIndex will point to the original data. + // + + // Get the length of the string to skip. + // + const XMLSize_t srcLen = XMLString::stringLen(toSkip); + XMLSize_t charsLeft = charsLeftInBuffer(); + + // See if the current reader has enough chars to test against this + // string. If not, then ask it to reload its buffer. If that does not + // get us enough, then it cannot match. + // + // NOTE: This works because strings never have to cross a reader! And + // a string to skip will never have a new line in it, so we will never + // miss adjusting the current line. + // + while (charsLeft < srcLen) + { + if (!refreshCharBuffer()) + return false; + + XMLSize_t tmp = charsLeftInBuffer(); + if (tmp == charsLeft) // if the refreshCharBuf() did not add anything new + return false; // give up and return. + + charsLeft = tmp; + } + + // Ok, now we now that the current reader has enough chars in its + // buffer and that its index is back at zero. So we can do a quick and + // dirty comparison straight to its buffer with no requirement to unget + // if it fails. + // + if (memcmp(&fCharBuf[fCharIndex], toSkip, srcLen * sizeof(XMLCh))) + return false; + + // Add the source length to the current column to get it back right. + // + fCurCol += (XMLFileLoc)srcLen; + + // And get the character buffer index back right by just adding the + // source len to it. + // + fCharIndex += srcLen; + + return true; +} + +bool XMLReader::skippedStringLong(const XMLCh* toSkip) +{ + // This function works on strings that are potentially longer than + // kCharBufSize (e.g., end tag). This function does not guarantee + // that in case the comparison is unsuccessful the fCharIndex will + // point to the original data. + // + + XMLSize_t srcLen = XMLString::stringLen(toSkip); + XMLSize_t charsLeft = charsLeftInBuffer(); + + while (srcLen != 0) + { + // Fill up the buffer with as much data as possible. + // + while (charsLeft < srcLen && charsLeft != kCharBufSize) + { + if (!refreshCharBuffer()) + return false; + + XMLSize_t tmp = charsLeftInBuffer(); + if (tmp == charsLeft) // if the refreshCharBuf() did not add anything + return false; // new give up and return. + + charsLeft = tmp; + } + + XMLSize_t n = charsLeft < srcLen ? charsLeft : srcLen; + + if (memcmp(&fCharBuf[fCharIndex], toSkip, n * sizeof(XMLCh))) + return false; + + toSkip += n; + srcLen -= n; + + fCharIndex += n; + fCurCol += (XMLFileLoc)n; + charsLeft -= n; + } + + return true; +} + +// +// This is just to peek if the next coming buffer +// matches the string toPeek. +// Similar to skippedString, but just the fCharIndex and fCurCol are not updated +// +bool XMLReader::peekString(const XMLCh* const toPeek) +{ + // Get the length of the string to skip + const XMLSize_t srcLen = XMLString::stringLen(toPeek); + + // + // See if the current reader has enough chars to test against this + // string. If not, then ask it to reload its buffer. If that does not + // get us enough, then it cannot match. + // + // NOTE: This works because strings never have to cross a reader! And + // a string to skip will never have a new line in it, so we will never + // miss adjusting the current line. + // + XMLSize_t charsLeft = charsLeftInBuffer(); + while (charsLeft < srcLen) + { + refreshCharBuffer(); + XMLSize_t t = charsLeftInBuffer(); + if (t == charsLeft) // if the refreshCharBuf() did not add anything new + return false; // give up and return. + charsLeft = t; + } + + + + + // + // Ok, now we now that the current reader has enough chars in its + // buffer and that its index is back at zero. So we can do a quick and + // dirty comparison straight to its buffer with no requirement to unget + // if it fails. + // + if (memcmp(&fCharBuf[fCharIndex], toPeek, srcLen*sizeof(XMLCh))) + return false; + + return true; +} + + +// --------------------------------------------------------------------------- +// XMLReader: Setter methods (most are inlined) +// --------------------------------------------------------------------------- +bool XMLReader::setEncoding(const XMLCh* const newEncoding) +{ + // + // If the encoding was forced, then we ignore the new value and just + // return with success. If it was forced, then we are to use that + // encoding without question. Note that, if we are forced, we created + // a transcoder up front so there is no need to do one here in that + // case. + // + if (fForcedEncoding) + return true; + + // + // upperCase the newEncoding first for better performance + // + XMLCh* inputEncoding = XMLString::replicate(newEncoding, fMemoryManager); + XMLString::upperCaseASCII(inputEncoding); + + XMLRecognizer::Encodings newBaseEncoding; + // + // Check for non-endian specific UTF-16 or UCS-4. If so, and if we + // are already in one of the endian versions of those encodings, + // then just keep it and go on. Otherwise, its not valid. + // + if (XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString2) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString3) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString4) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString5) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString6) + || XMLString::equals(inputEncoding, XMLUni::fgUTF16EncodingString7)) + { + fMemoryManager->deallocate(inputEncoding); + + if ((fEncoding != XMLRecognizer::UTF_16L) + && (fEncoding != XMLRecognizer::UTF_16B)) + { + return false; + } + + // Override with the original endian specific encoding + newBaseEncoding = fEncoding; + + if (fEncoding == XMLRecognizer::UTF_16L) { + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = 0; + fEncodingStr = XMLString::replicate(XMLUni::fgUTF16LEncodingString, fMemoryManager); + } + else { + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = 0; + fEncodingStr = XMLString::replicate(XMLUni::fgUTF16BEncodingString, fMemoryManager); + } + } + else if (XMLString::equals(inputEncoding, XMLUni::fgUCS4EncodingString) + || XMLString::equals(inputEncoding, XMLUni::fgUCS4EncodingString2) + || XMLString::equals(inputEncoding, XMLUni::fgUCS4EncodingString3) + || XMLString::equals(inputEncoding, XMLUni::fgUCS4EncodingString4) + || XMLString::equals(inputEncoding, XMLUni::fgUCS4EncodingString5)) + { + fMemoryManager->deallocate(inputEncoding); + + if ((fEncoding != XMLRecognizer::UCS_4L) + && (fEncoding != XMLRecognizer::UCS_4B)) + { + return false; + } + + // Override with the original endian specific encoding + newBaseEncoding = fEncoding; + + if (fEncoding == XMLRecognizer::UCS_4L) { + + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = 0; + fEncodingStr = XMLString::replicate(XMLUni::fgUCS4LEncodingString, fMemoryManager); + } + else { + + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = 0; + fEncodingStr = XMLString::replicate(XMLUni::fgUCS4BEncodingString, fMemoryManager); + } + } + else + { + // + // Try to map the string to one of our standard encodings. If its not + // one of them, then it has to be one of the non-intrinsic encodings, + // in which case we have to delete our intrinsic encoder and create a + // new one. + // + newBaseEncoding = XMLRecognizer::encodingForName(inputEncoding); + + // + // If it does not come back as one of the auto-sensed encodings, then we + // have to possibly replace it and at least check a few things. + // + if (newBaseEncoding == XMLRecognizer::OtherEncoding) + { + // + // We already know it's none of those non-endian special cases, + // so just replicate the new name and use it directly to create the transcoder + // + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = inputEncoding; + + XMLTransService::Codes failReason; + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + fEncodingStr + , failReason + , kCharBufSize + , fMemoryManager + ); + } + else + { + // Store the new encoding string since it is just an intrinsic + fMemoryManager->deallocate(fEncodingStr); + fEncodingStr = inputEncoding; + } + } + + if (!fTranscoder) { + // + // Now we can create a transcoder using the recognized fEncoding. We + // might get back a transcoder for an intrinsically supported encoding, + // or we might get one from the underlying transcoding service. + // + XMLTransService::Codes failReason; + fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor + ( + newBaseEncoding + , failReason + , kCharBufSize + , fMemoryManager + ); + + if (!fTranscoder) + ThrowXMLwithMemMgr1(TranscodingException, XMLExcepts::Trans_CantCreateCvtrFor, fEncodingStr, fMemoryManager); + } + + // Update the base encoding member with the new base encoding found + fEncoding = newBaseEncoding; + + // Looks ok to us + return true; +} + + +// --------------------------------------------------------------------------- +// XMLReader: Private helper methods +// --------------------------------------------------------------------------- + +// +// This is called when the encoding flag is set and just sets the fSwapped +// flag appropriately. +// +void XMLReader::checkForSwapped() +{ + // Assume not swapped + fSwapped = false; + + if (XMLPlatformUtils::fgXMLChBigEndian) + { + if ((fEncoding == XMLRecognizer::UTF_16L) + || (fEncoding == XMLRecognizer::UCS_4L)) + { + fSwapped = true; + } + } + else + { + if ((fEncoding == XMLRecognizer::UTF_16B) + || (fEncoding == XMLRecognizer::UCS_4B)) + { + fSwapped = true; + } + } +} + + +// +// This is called from the constructor when the encoding is not forced. +// We assume that the encoding has been auto-sensed at this point and that +// fSwapped is set correctly. +// +// In the case of UCS-4 and EBCDIC, we don't have to check for a decl. +// The fact that we got here, means that there is one, because that's the +// only way we can autosense those. +// +void XMLReader::doInitDecode() +{ + switch(fEncoding) + { + case XMLRecognizer::UCS_4B : + case XMLRecognizer::UCS_4L : + { + // Remove bom if any + if (((fRawByteBuf[0] == 0x00) && (fRawByteBuf[1] == 0x00) && (fRawByteBuf[2] == 0xFE) && (fRawByteBuf[3] == 0xFF)) || + ((fRawByteBuf[0] == 0xFF) && (fRawByteBuf[1] == 0xFE) && (fRawByteBuf[2] == 0x00) && (fRawByteBuf[3] == 0x00)) ) + { + for (XMLSize_t i = 0; i < fRawBytesAvail; i++) + fRawByteBuf[i] = fRawByteBuf[i+4]; + + fRawBytesAvail -=4; + } + + // Look at the raw buffer as UCS4 chars + const UCS4Ch* asUCS = (const UCS4Ch*)fRawByteBuf; + + while (fRawBufIndex < fRawBytesAvail) + { + // Get out the current 4 byte value and inc our raw buf index + UCS4Ch curVal = *asUCS++; + fRawBufIndex += sizeof(UCS4Ch); + + // Swap if that is required for this machine + if (fSwapped) + curVal = BitOps::swapBytes(curVal); + + // Make sure its at least semi legal. If not, undo and throw + if (curVal > 0xFFFF) + { + fCharsAvail = 0; + fRawBufIndex = 0; + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fEncodingStr); + ArrayJanitor janValue(fSystemId, fMemoryManager); + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Reader_CouldNotDecodeFirstLine + , fSystemId + , fMemoryManager + ); + } + + // Convert the value to an XML char and store it + fCharSizeBuf[fCharsAvail] = 4; + fCharBuf[fCharsAvail++] = XMLCh(curVal); + + // Break out on the > character + if (curVal == chCloseAngle) + break; + } + break; + } + + case XMLRecognizer::UTF_8 : + { + // If there's a utf-8 BOM (0xEF 0xBB 0xBF), skip past it. + // Don't move to char buf - no one wants to see it. + // Note: this causes any encoding= declaration to override + // the BOM's attempt to say that the encoding is utf-8. + + // Look at the raw buffer as short chars + const char* asChars = (const char*)fRawByteBuf; + + if (fRawBytesAvail > XMLRecognizer::fgUTF8BOMLen && + XMLString::compareNString( asChars + , XMLRecognizer::fgUTF8BOM + , XMLRecognizer::fgUTF8BOMLen) == 0) + { + fRawBufIndex += XMLRecognizer::fgUTF8BOMLen; + asChars += XMLRecognizer::fgUTF8BOMLen; + } + + // + // First check that there are enough bytes to even see the + // decl indentifier. If not, get out now with no action since + // there is no decl. + // + if (fRawBytesAvail < XMLRecognizer::fgASCIIPreLen) + break; + + // Check for the opening sequence. If not, then no decl + if (XMLString::compareNString( asChars + , XMLRecognizer::fgASCIIPre + , XMLRecognizer::fgASCIIPreLen)) + { + break; + } + + while (fRawBufIndex < fRawBytesAvail) + { + const char curCh = *asChars++; + fRawBufIndex++; + + // Looks ok, so store it + fCharSizeBuf[fCharsAvail] = 1; + fCharBuf[fCharsAvail++] = XMLCh(curCh); + + // Break out on a > character + if (curCh == chCloseAngle) + break; + + // + // A char greater than 0x7F is not allowed in this case. If + // so, undo and throw. + // + if (curCh & 0x80) + { + fCharsAvail = 0; + fRawBufIndex = 0; + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fEncodingStr); + ArrayJanitor janValue(fSystemId, fMemoryManager); + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Reader_CouldNotDecodeFirstLine + , fSystemId + , fMemoryManager + ); + } + } + break; + } + + case XMLRecognizer::UTF_16B : + case XMLRecognizer::UTF_16L : + { + // + // If there is a decl here, we just truncate back the characters + // as we go. No surrogate creation would be allowed here in legal + // XML, so we consider it a transoding error if we find one. + // + if (fRawBytesAvail < 2) + break; + + XMLSize_t postBOMIndex = 0; + const UTF16Ch* asUTF16 = (const UTF16Ch*)&fRawByteBuf[fRawBufIndex]; + if ((*asUTF16 == chUnicodeMarker) || (*asUTF16 == chSwappedUnicodeMarker)) + { + fRawBufIndex += sizeof(UTF16Ch); + asUTF16++; + postBOMIndex = fRawBufIndex; + } + + // First check that there are enough raw bytes for there to even + // be a decl indentifier. If not, then nothing to do. + // + if (fRawBytesAvail - fRawBufIndex < XMLRecognizer::fgUTF16PreLen) + { + fRawBufIndex = postBOMIndex; + break; + } + + // + // See we get a match on the prefix. If not, then reset and + // break out. + // + if (fEncoding == XMLRecognizer::UTF_16B) + { + if (memcmp(asUTF16, XMLRecognizer::fgUTF16BPre, XMLRecognizer::fgUTF16PreLen)) + { + fRawBufIndex = postBOMIndex; + break; + } + } + else + { + if (memcmp(asUTF16, XMLRecognizer::fgUTF16LPre, XMLRecognizer::fgUTF16PreLen)) + { + fRawBufIndex = postBOMIndex; + break; + } + } + + while (fRawBufIndex < fRawBytesAvail) + { + // Get out the current 2 byte value + UTF16Ch curVal = *asUTF16++; + fRawBufIndex += sizeof(UTF16Ch); + + // Swap if that is required for this machine + if (fSwapped) + curVal = BitOps::swapBytes(curVal); + + // + // Store it and bump the target index, implicitly converting + // if UTF16Ch and XMLCh are not the same size. + // + fCharSizeBuf[fCharsAvail] = 2; + fCharBuf[fCharsAvail++] = curVal; + + // Break out on a > char + if (curVal == chCloseAngle) + break; + } + break; + } + + case XMLRecognizer::EBCDIC : + { + // + // We use special support in the intrinsic EBCDIC-US transcoder + // to go through one char at a time. + // + const XMLByte* srcPtr = fRawByteBuf; + while (1) + { + // Transcode one char from the source + const XMLCh chCur = XMLEBCDICTranscoder::xlatThisOne(*srcPtr++); + fRawBufIndex++; + + // + // And put it into the character buffer. This stuff has to + // look like it was normally transcoded. + // + fCharSizeBuf[fCharsAvail] = 1; + fCharBuf[fCharsAvail++] = chCur; + + // If its a > char, then break out + if (chCur == chCloseAngle) + break; + + // Watch for using up all input and get out + if (fRawBufIndex == fRawBytesAvail) + break; + } + break; + } + + default : + // It should never be anything else here + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fEncodingStr); + fMemoryManager->deallocate(fSystemId); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Reader_BadAutoEncoding, fMemoryManager); + break; + } + + // + // Ok, by the time we get here, if its a legal XML file we have eaten + // the XML/TextDecl. So, if we are a PE and are being referenced from + // outside a literal, then we need to throw in an arbitrary space that + // is required by XML. + // + if ((fType == Type_PE) && (fRefFrom == RefFrom_NonLiteral)) + fCharBuf[fCharsAvail++] = chSpace; + + // Calculate fCharOfsBuf buffer using the elements from fCharBufSize + if (fCalculateSrcOfs) + { + fCharOfsBuf[0] = 0; + for (XMLSize_t index = 1; index < fCharsAvail; ++index) { + fCharOfsBuf[index] = fCharOfsBuf[index-1]+fCharSizeBuf[index-1]; + } + } +} + + +// +// This method is called internally when we run out of bytes in the raw +// buffer. We just read as many bytes as we can into the raw buffer again +// and store the number of bytes we got. +// +void XMLReader::refreshRawBuffer() +{ + // + // If there are any bytes left, move them down to the start. There + // should only ever be (max bytes per char - 1) at the most. + // + const XMLSize_t bytesLeft = fRawBytesAvail - fRawBufIndex; + + // Move the existing ones down + for (XMLSize_t index = 0; index < bytesLeft; index++) + fRawByteBuf[index] = fRawByteBuf[fRawBufIndex + index]; + + // + // And then read into the buffer past the existing bytes. Add back in + // that many to the bytes read, and subtract that many from the bytes + // requested. + // + fRawBytesAvail = fStream->readBytes + ( + &fRawByteBuf[bytesLeft], kRawBufSize - bytesLeft + ) + bytesLeft; + + // + // We need to reset the buffer index back to the start in all cases, + // since any trailing data was copied down to the start. + // + fRawBufIndex = 0; +} + + +// +// This method is called internally when we run out of characters in the +// trancoded character buffer. We transcode up to another maxChars chars +// from the +// +XMLSize_t +XMLReader::xcodeMoreChars( XMLCh* const bufToFill + , unsigned char* const charSizes + , const XMLSize_t maxChars) +{ + XMLSize_t charsDone = 0; + XMLSize_t bytesEaten = 0; + bool needMode = false; + + while (!bytesEaten) + { + // If our raw buffer is low, then lets load up another batch of + // raw bytes now. + // + XMLSize_t bytesLeft = fRawBytesAvail - fRawBufIndex; + if (needMode || bytesLeft == 0 || bytesLeft < fLowWaterMark) + { + refreshRawBuffer(); + + // If there are no characters or if we need more but didn't get + // any, return zero now. + // + if (fRawBytesAvail == 0 || + (needMode && (bytesLeft == fRawBytesAvail - fRawBufIndex))) + return 0; + } + + // Ask the transcoder to internalize another batch of chars. It is + // possible that there is data in the raw buffer but the transcoder + // is unable to produce anything because transcoding of multi-byte + // encodings may have left a few bytes representing a partial + // character in the buffer that can't be used until the next chunk + // (and the rest of the character) is read. In this case set the + // needMore flag and try again. + // + + charsDone = fTranscoder->transcodeFrom + ( + &fRawByteBuf[fRawBufIndex] + , fRawBytesAvail - fRawBufIndex + , bufToFill + , maxChars + , bytesEaten + , charSizes + ); + + if (bytesEaten == 0) + needMode = true; + else + fRawBufIndex += bytesEaten; + } + + return charsDone; +} + +/*** + * + * XML1.1 + * + * 2.11 End-of-Line Handling + * + * XML parsed entities are often stored in computer files which, for editing + * convenience, are organized into lines. These lines are typically separated + * by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA). + * + * To simplify the tasks of applications, the XML processor MUST behave as if + * it normalized all line breaks in external parsed entities (including the document + * entity) on input, before parsing, by translating all of the following to a single + * #xA character: + * + * 1. the two-character sequence #xD #xA + * 2. the two-character sequence #xD #x85 + * 3. the single character #x85 + * 4. the single character #x2028 + * 5. any #xD character that is not immediately followed by #xA or #x85. + * + * + ***/ +void XMLReader::handleEOL(XMLCh& curCh, bool inDecl) +{ + // 1. the two-character sequence #xD #xA + // 2. the two-character sequence #xD #x85 + // 5. any #xD character that is not immediately followed by #xA or #x85. + switch(curCh) + { + case chCR: + fCurCol = 1; + fCurLine++; + + // + // If not already internalized, then convert it to an + // LF and eat any following LF. + // + if (fSource == Source_External) + { + if ((fCharIndex < fCharsAvail) || refreshCharBuffer()) + { + if ( fCharBuf[fCharIndex] == chLF || + ((fCharBuf[fCharIndex] == chNEL) && fNEL) ) + { + fCharIndex++; + } + } + curCh = chLF; + } + break; + + case chLF: + fCurCol = 1; + fCurLine++; + break; + + // 3. the single character #x85 + // 4. the single character #x2028 + case chNEL: + case chLineSeparator: + if (inDecl && fXMLVersion == XMLV1_1) + { + + /*** + * XML1.1 + * + * 2.11 End-of-Line Handling + * ... + * The characters #x85 and #x2028 cannot be reliably recognized and translated + * until an entity's encoding declaration (if present) has been read. + * Therefore, it is a fatal error to use them within the XML declaration or + * text declaration. + * + ***/ + ThrowXMLwithMemMgr1 + ( + TranscodingException + , XMLExcepts::Reader_NelLsepinDecl + , fSystemId + , fMemoryManager + ); + } + + if (fNEL && fSource == Source_External) + { + fCurCol = 1; + fCurLine++; + curCh = chLF; + } + break; + default: + fCurCol++; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XMLReader.hpp b/project/jni/xerces/src/xercesc/internal/XMLReader.hpp new file mode 100644 index 000000000..c49124e33 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLReader.hpp @@ -0,0 +1,790 @@ +/* + * 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: XMLReader.hpp 833045 2009-11-05 13:21:27Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLREADER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLREADER_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; +class BinInputStream; +class ReaderMgr; +class XMLScanner; +class XMLTranscoder; + + +// --------------------------------------------------------------------------- +// Instances of this class are used to manage the content of entities. The +// scanner maintains a stack of these, one for each entity (this means entity +// in the sense of any parsed file or internal entity) currently being +// scanned. This class, given a binary input stream will handle reading in +// the data and decoding it from its external decoding into the internal +// Unicode format. Once internallized, this class provides the access +// methods to read in the data in various ways, maintains line and column +// information, and provides high performance character attribute checking +// methods. +// +// This is NOT to be derived from. +// +// --------------------------------------------------------------------------- +class XMLPARSER_EXPORT XMLReader : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public types + // ----------------------------------------------------------------------- + enum Types + { + Type_PE + , Type_General + }; + + enum Sources + { + Source_Internal + , Source_External + }; + + enum RefFrom + { + RefFrom_Literal + , RefFrom_NonLiteral + }; + + enum XMLVersion + { + XMLV1_0 + , XMLV1_1 + , XMLV_Unknown + }; + + + // ----------------------------------------------------------------------- + // Public, query methods + // ----------------------------------------------------------------------- + bool isAllSpaces + ( + const XMLCh* const toCheck + , const XMLSize_t count + ) const; + + bool containsWhiteSpace + ( + const XMLCh* const toCheck + , const XMLSize_t count + ) const; + + + bool isXMLLetter(const XMLCh toCheck) const; + bool isFirstNameChar(const XMLCh toCheck) const; + bool isNameChar(const XMLCh toCheck) const; + bool isPlainContentChar(const XMLCh toCheck) const; + bool isSpecialStartTagChar(const XMLCh toCheck) const; + bool isXMLChar(const XMLCh toCheck) const; + bool isWhitespace(const XMLCh toCheck) const; + bool isControlChar(const XMLCh toCheck) const; + bool isPublicIdChar(const XMLCh toCheck) const; + bool isFirstNCNameChar(const XMLCh toCheck) const; + bool isNCNameChar(const XMLCh toCheck) const; + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLReader + ( + const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd = false + , const bool calculateSrcOfs = true + , XMLSize_t lowWaterMark = 100 + , const XMLVersion xmlVersion = XMLV1_0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLReader + ( + const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , const XMLCh* const encodingStr + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd = false + , const bool calculateSrcOfs = true + , XMLSize_t lowWaterMark = 100 + , const XMLVersion xmlVersion = XMLV1_0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLReader + ( + const XMLCh* const pubId + , const XMLCh* const sysId + , BinInputStream* const streamToAdopt + , XMLRecognizer::Encodings encodingEnum + , const RefFrom from + , const Types type + , const Sources source + , const bool throwAtEnd = false + , const bool calculateSrcOfs = true + , XMLSize_t lowWaterMark = 100 + , const XMLVersion xmlVersion = XMLV1_0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~XMLReader(); + + + // ----------------------------------------------------------------------- + // Character buffer management methods + // ----------------------------------------------------------------------- + XMLSize_t charsLeftInBuffer() const; + bool refreshCharBuffer(); + + + // ----------------------------------------------------------------------- + // Scanning methods + // ----------------------------------------------------------------------- + bool getName(XMLBuffer& toFill, const bool token); + bool getQName(XMLBuffer& toFill, int* colonPosition); + bool getNCName(XMLBuffer& toFill); + bool getNextChar(XMLCh& chGotten); + bool getNextCharIfNot(const XMLCh chNotToGet, XMLCh& chGotten); + void movePlainContentChars(XMLBuffer &dest); + bool getSpaces(XMLBuffer& toFill); + bool getUpToCharOrWS(XMLBuffer& toFill, const XMLCh toCheck); + bool peekNextChar(XMLCh& chGotten); + bool skipIfQuote(XMLCh& chGotten); + bool skipSpaces(bool& skippedSomething, bool inDecl = false); + bool skippedChar(const XMLCh toSkip); + bool skippedSpace(); + bool skippedString(const XMLCh* const toSkip); + bool skippedStringLong(const XMLCh* toSkip); + bool peekString(const XMLCh* const toPeek); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLFileLoc getColumnNumber() const; + const XMLCh* getEncodingStr() const; + XMLFileLoc getLineNumber() const; + bool getNoMoreFlag() const; + const XMLCh* getPublicId() const; + XMLSize_t getReaderNum() const; + RefFrom getRefFrom() const; + Sources getSource() const; + XMLFilePos getSrcOffset() const; + const XMLCh* getSystemId() const; + bool getThrowAtEnd() const; + Types getType() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + bool setEncoding + ( + const XMLCh* const newEncoding + ); + void setReaderNum(const XMLSize_t newNum); + void setThrowAtEnd(const bool newValue); + void setXMLVersion(const XMLVersion version); + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLReader(const XMLReader&); + XMLReader& operator=(const XMLReader&); + + // --------------------------------------------------------------------------- + // Class Constants + // + // kCharBufSize + // The size of the character spool buffer that we use. Its not terribly + // large because its just getting filled with data from a raw byte + // buffer as we go along. We don't want to decode all the text at + // once before we find out that there is an error. + // + // NOTE: This is a size in characters, not bytes. + // + // kRawBufSize + // The size of the raw buffer from which raw bytes are spooled out + // as we transcode chunks of data. As it is emptied, it is filled back + // in again from the source stream. + // --------------------------------------------------------------------------- + enum Constants + { + kCharBufSize = 16 * 1024 + , kRawBufSize = 48 * 1024 + }; + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void checkForSwapped(); + + void doInitCharSizeChecks(); + + void doInitDecode(); + + XMLByte getNextRawByte + ( + const bool eoiOk + ); + + void refreshRawBuffer(); + + void setTranscoder + ( + const XMLCh* const newEncoding + ); + + XMLSize_t xcodeMoreChars + ( + XMLCh* const bufToFill + , unsigned char* const charSizes + , const XMLSize_t maxChars + ); + + void handleEOL + ( + XMLCh& curCh + , bool inDecl = false + ); + + // ----------------------------------------------------------------------- + // Data members + // + // fCharIndex + // The index into the character buffer. When this hits fCharsAvail + // then its time to refill. + // + // fCharBuf + // A buffer that the reader manager fills up with transcoded + // characters a small amount at a time. + // + // fCharsAvail + // The characters currently available in the character buffer. + // + // fCharSizeBuf + // This buffer is an array that contains the number of source chars + // eaten to create each char in the fCharBuf buffer. So the entry + // fCharSizeBuf[x] is the number of source chars that were eaten + // to make the internalized char fCharBuf[x]. This only contains + // useful data if fSrcOfsSupported is true. + // + // fCharOfsBuf + // This buffer is an array that contains the offset in the + // fRawByteBuf buffer of each char in the fCharBuf buffer. It + // only contains useful data if fSrcOfsSupported is true. + // + // fCurCol + // fCurLine + // The current line and column that we are in within this reader's + // text. + // + // fEncoding + // This is the rough encoding setting. This enum is set during + // construction and just tells us the rough family of encoding that + // we are doing. + // + // fEncodingStr + // This is the name of the encoding we are using. It will be + // provisionally set during construction, from the auto-sensed + // encoding. But it might be overridden when the XMLDecl is finally + // seen by the scanner. It can also be forced to a particular + // encoding, in which case fForcedEncoding is set. + // + // fForcedEncoding + // If the encoding if forced then this is set and all other + // information will be ignored. This encoding will be taken as + // gospel. This is done by calling an alternate constructor. + // + // fNoMore + // This is set when the source text is exhausted. It lets us know + // quickly that no more text is available. + // + // fRawBufIndex + // The current index into the raw byte buffer. When its equal to + // fRawBytesAvail then we need to read another buffer. + // + // fRawByteBuf + // This is the raw byte buffer that is used to spool out bytes + // from into the fCharBuf buffer, as we transcode in blocks. + // + // fRawBytesAvail + // The number of bytes currently available in the raw buffer. This + // helps deal with the last buffer's worth, which will usually not + // be a full one. + // + // fLowWaterMark + // The low water mark for the raw byte buffer. + // + // + // fReaderNum + // Each reader from a particular reader manager (which means from a + // particular document) is given a unique number. The reader manager + // sets these numbers. They are used to catch things like partial + // markup errors. + // + // fRefFrom + // This flag is provided in the ctor, and tells us if we represent + // some entity being expanded inside a literal. Sometimes things + // happen differently inside and outside literals. + // + // fPublicId + // fSystemId + // These are the system and public ids of the source that this + // reader is reading. + // + // fSentTrailingSpace + // If we are a PE entity being read and we not referenced from a + // literal, then a leading and trailing space must be faked into the + // data. This lets us know we've done the trailing space already (so + // we don't just keep doing it again and again.) + // + // fSource + // Indicates whether the content this reader is spooling as already + // been internalized. This will prevent multiple processing of + // whitespace when an already internalized entity is being spooled + // out. + // + // fSpareChar + // Some encodings can create two chars in an atomic way, e.g. + // surrogate pairs. We might not be able to store both, so we store + // it here until the next buffer transcoding operation. + // + // fSrcOfsBase + // This is the base offset within the source of this entity. Values + // in the curent fCharSizeBuf array are relative to this value. + // + // fSrcOfsSupported + // This flag is set to indicate whether source byte offset info + // is supported. For intrinsic encodings, its always set since we + // can always support it. For transcoder based encodings, we ask + // the transcoder if it supports it or not. + // + // fStream + // This is the input stream that provides the data for the reader. + // Its always treated as a raw byte stream. The derived class will + // ask for buffers of text from it and will handle making some + // sense of it. + // + // fSwapped + // If the encoding is one of the ones we do intrinsically, and its + // in a different byte order from our native order, then this is + // set to remind us to byte swap it during transcoding. + // + // fThrowAtEnd + // Indicates whether the reader manager should throw an end of entity + // exception at the end of this reader instance. This is usually + // set for top level external entity references. It overrides the + // reader manager's global flag that controls throwing at the end + // of entities. Defaults to false. + // + // fTranscoder + // If the encoding is not one that we handle intrinsically, then + // we use an an external transcoder to do it. This class is an + // abstraction that allows us to use pluggable external transcoding + // services (via XMLTransService in util.) + // + // fType + // Indicates whether this reader represents a PE or not. If this + // flag is true and the fInLiteral flag is false, then we will put + // out an extra space at the end. + // + // fgCharCharsTable; + // Pointer to XMLChar table, depends on XML version + // + // fNEL + // Boolean indicates if NEL and LSEP should be recognized as NEL + // + // fXMLVersion + // Enum to indicate if this Reader is conforming to XML 1.0 or XML 1.1 + // ----------------------------------------------------------------------- + XMLSize_t fCharIndex; + XMLCh fCharBuf[kCharBufSize]; + XMLSize_t fCharsAvail; + unsigned char fCharSizeBuf[kCharBufSize]; + unsigned int fCharOfsBuf[kCharBufSize]; + XMLFileLoc fCurCol; + XMLFileLoc fCurLine; + XMLRecognizer::Encodings fEncoding; + XMLCh* fEncodingStr; + bool fForcedEncoding; + bool fNoMore; + XMLCh* fPublicId; + XMLSize_t fRawBufIndex; + XMLByte fRawByteBuf[kRawBufSize]; + XMLSize_t fRawBytesAvail; + XMLSize_t fLowWaterMark; + XMLSize_t fReaderNum; + RefFrom fRefFrom; + bool fSentTrailingSpace; + Sources fSource; + XMLFilePos fSrcOfsBase; + bool fSrcOfsSupported; + bool fCalculateSrcOfs; + XMLCh* fSystemId; + BinInputStream* fStream; + bool fSwapped; + bool fThrowAtEnd; + XMLTranscoder* fTranscoder; + Types fType; + XMLByte* fgCharCharsTable; + bool fNEL; + XMLVersion fXMLVersion; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// XMLReader: Public, query methods +// --------------------------------------------------------------------------- +inline bool XMLReader::isNameChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gNameCharMask) != 0); +} + +inline bool XMLReader::isNCNameChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gNCNameCharMask) != 0); +} + +inline bool XMLReader::isPlainContentChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gPlainContentCharMask) != 0); +} + + +inline bool XMLReader::isFirstNameChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gFirstNameCharMask) != 0); +} + +inline bool XMLReader::isFirstNCNameChar(const XMLCh toCheck) const +{ + return (((fgCharCharsTable[toCheck] & gFirstNameCharMask) != 0) + && (toCheck != chColon)); +} + +inline bool XMLReader::isSpecialStartTagChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gSpecialStartTagCharMask) != 0); +} + +inline bool XMLReader::isXMLChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gXMLCharMask) != 0); +} + +inline bool XMLReader::isXMLLetter(const XMLCh toCheck) const +{ + return (((fgCharCharsTable[toCheck] & gFirstNameCharMask) != 0) + && (toCheck != chColon) && (toCheck != chUnderscore)); +} + +inline bool XMLReader::isWhitespace(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gWhitespaceCharMask) != 0); +} + +inline bool XMLReader::isControlChar(const XMLCh toCheck) const +{ + return ((fgCharCharsTable[toCheck] & gControlCharMask) != 0); +} + +// --------------------------------------------------------------------------- +// XMLReader: Buffer management methods +// --------------------------------------------------------------------------- +inline XMLSize_t XMLReader::charsLeftInBuffer() const +{ + return fCharsAvail - fCharIndex; +} + + +// --------------------------------------------------------------------------- +// XMLReader: Getter methods +// --------------------------------------------------------------------------- +inline XMLFileLoc XMLReader::getColumnNumber() const +{ + return fCurCol; +} + +inline const XMLCh* XMLReader::getEncodingStr() const +{ + return fEncodingStr; +} + +inline XMLFileLoc XMLReader::getLineNumber() const +{ + return fCurLine; +} + +inline bool XMLReader::getNoMoreFlag() const +{ + return fNoMore; +} + +inline const XMLCh* XMLReader::getPublicId() const +{ + return fPublicId; +} + +inline XMLSize_t XMLReader::getReaderNum() const +{ + return fReaderNum; +} + +inline XMLReader::RefFrom XMLReader::getRefFrom() const +{ + return fRefFrom; +} + +inline XMLReader::Sources XMLReader::getSource() const +{ + return fSource; +} + +inline const XMLCh* XMLReader::getSystemId() const +{ + return fSystemId; +} + +inline bool XMLReader::getThrowAtEnd() const +{ + return fThrowAtEnd; +} + +inline XMLReader::Types XMLReader::getType() const +{ + return fType; +} + +// --------------------------------------------------------------------------- +// XMLReader: Setter methods +// --------------------------------------------------------------------------- +inline void XMLReader::setReaderNum(const XMLSize_t newNum) +{ + fReaderNum = newNum; +} + +inline void XMLReader::setThrowAtEnd(const bool newValue) +{ + fThrowAtEnd = newValue; +} + +inline void XMLReader::setXMLVersion(const XMLVersion version) +{ + fXMLVersion = version; + if (version == XMLV1_1) { + fNEL = true; + fgCharCharsTable = XMLChar1_1::fgCharCharsTable1_1; + } + else { + fNEL = XMLChar1_0::enableNEL; + fgCharCharsTable = XMLChar1_0::fgCharCharsTable1_0; + } + +} + + + +// --------------------------------------------------------------------------- +// +// XMLReader: movePlainContentChars() +// +// Move as many plain (no special handling of any sort required) content +// characters as possible from this reader to the supplied destination buffer. +// +// This is THE hottest performance spot in the parser. +// +// --------------------------------------------------------------------------- +inline void XMLReader::movePlainContentChars(XMLBuffer &dest) +{ + const XMLSize_t chunkSize = fCharsAvail - fCharIndex; + const XMLCh* cursor = &fCharBuf[fCharIndex]; + XMLSize_t count=0; + for(;count= fCharsAvail) + { + // If fNoMore is set, then we have nothing else to give + if (fNoMore) + return false; + + // Try to refresh + if (!refreshCharBuffer()) + return false; + } + + // Check the next char + if (fCharBuf[fCharIndex] == chNotToGet) + return false; + + // Its not the one we want to skip so bump the index + chGotten = fCharBuf[fCharIndex++]; + + // Handle end of line normalization and line/col member maintenance. + // + // we can have end-of-line combinations with a leading + // chCR(xD), chLF(xA), chNEL(x85), or chLineSeparator(x2028) + // + // 0000000000001101 chCR + // 0000000000001010 chLF + // 0000000010000101 chNEL + // 0010000000101000 chLineSeparator + // ----------------------- + // 1101111101010000 == ~(chCR|chLF|chNEL|chLineSeparator) + // + // if the result of the logical-& operation is + // true : 'curCh' can not be chCR, chLF, chNEL or chLineSeparator + // false : 'curCh' can be chCR, chLF, chNEL or chLineSeparator + // + if ( chGotten & (XMLCh) ~(chCR|chLF|chNEL|chLineSeparator) ) + { + fCurCol++; + } else + { + handleEOL(chGotten, false); + } + + return true; +} + +// --------------------------------------------------------------------------- +// XMLReader: getNextChar() method inlined for speed +// --------------------------------------------------------------------------- +inline bool XMLReader::getNextChar(XMLCh& chGotten) +{ + // + // See if there is at least a char in the buffer. Else, do the buffer + // reload logic. + // + if (fCharIndex >= fCharsAvail) + { + // If fNoMore is set, then we have nothing else to give + if (fNoMore) + return false; + + // Try to refresh + if (!refreshCharBuffer()) + return false; + } + + chGotten = fCharBuf[fCharIndex++]; + + // Handle end of line normalization and line/col member maintenance. + // + // we can have end-of-line combinations with a leading + // chCR(xD), chLF(xA), chNEL(x85), or chLineSeparator(x2028) + // + // 0000000000001101 chCR + // 0000000000001010 chLF + // 0000000010000101 chNEL + // 0010000000101000 chLineSeparator + // ----------------------- + // 1101111101010000 == ~(chCR|chLF|chNEL|chLineSeparator) + // + // if the result of the logical-& operation is + // true : 'curCh' can not be chCR, chLF, chNEL or chLineSeparator + // false : 'curCh' can be chCR, chLF, chNEL or chLineSeparator + // + if ( chGotten & (XMLCh) ~(chCR|chLF|chNEL|chLineSeparator) ) + { + fCurCol++; + } else + { + handleEOL(chGotten, false); + } + + return true; +} + + +// --------------------------------------------------------------------------- +// XMLReader: peekNextChar() method inlined for speed +// --------------------------------------------------------------------------- +inline bool XMLReader::peekNextChar(XMLCh& chGotten) +{ + // + // If there is something still in the buffer, get it. Else do the reload + // scenario. + // + if (fCharIndex >= fCharsAvail) + { + // Try to refresh the buffer + if (!refreshCharBuffer()) + { + chGotten = chNull; + return false; + } + } + + chGotten = fCharBuf[fCharIndex]; + + // + // Even though we are only peeking, we have to act the same as the + // normal char get method in regards to newline normalization, though + // its not as complicated as the actual character getting method's. + // + if ((chGotten == chCR || (fNEL && (chGotten == chNEL || chGotten == chLineSeparator))) + && (fSource == Source_External)) + chGotten = chLF; + + return true; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/XMLScanner.cpp new file mode 100644 index 000000000..a02cea815 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLScanner.cpp @@ -0,0 +1,2398 @@ +/* + * 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: XMLScanner.cpp 882548 2009-11-20 13:44:14Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static data +// --------------------------------------------------------------------------- +static XMLUInt32 gScannerId = 0; +static XMLMutex* sScannerMutex = 0; +static XMLMsgLoader* gMsgLoader = 0; + +void XMLInitializer::initializeXMLScanner() +{ + gMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLErrDomain); + + if (!gMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); + + sScannerMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager); +} + +void XMLInitializer::terminateXMLScanner() +{ + delete gMsgLoader; + gMsgLoader = 0; + + delete sScannerMutex; + sScannerMutex = 0; +} + +// +// +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ReaderMgrResetType; + + +// --------------------------------------------------------------------------- +// XMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLScanner::XMLScanner(XMLValidator* const valToAdopt, + GrammarResolver* const grammarResolver, + MemoryManager* const manager) + : fBufferSize(1024 * 1024) + , fLowWaterMark (100) + , fStandardUriConformant(false) + , fCalculateSrcOfs(false) + , fDoNamespaces(false) + , fExitOnFirstFatal(true) + , fValidationConstraintFatal(false) + , fInException(false) + , fStandalone(false) + , fHasNoDTD(true) + , fValidate(false) + , fValidatorFromUser(false) + , fDoSchema(false) + , fSchemaFullChecking(false) + , fIdentityConstraintChecking(true) + , fToCacheGrammar(false) + , fUseCachedGrammar(false) + , fLoadExternalDTD(true) + , fLoadSchema(true) + , fNormalizeData(true) + , fGenerateSyntheticAnnotations(false) + , fValidateAnnotations(false) + , fIgnoreCachedDTD(false) + , fIgnoreAnnotations(false) + , fDisableDefaultEntityResolution(false) + , fSkipDTDValidation(false) + , fHandleMultipleImports(false) + , fErrorCount(0) + , fEntityExpansionLimit(0) + , fEntityExpansionCount(0) + , fEmptyNamespaceId(0) + , fUnknownNamespaceId(0) + , fXMLNamespaceId(0) + , fXMLNSNamespaceId(0) + , fSchemaNamespaceId(0) + , fUIntPool(0) + , fUIntPoolRow(0) + , fUIntPoolCol(0) + , fUIntPoolRowTotal(2) + , fScannerId(0) + , fSequenceId(0) + , fAttrList(0) + , fAttrDupChkRegistry(0) + , fDocHandler(0) + , fDocTypeHandler(0) + , fEntityHandler(0) + , fErrorReporter(0) + , fErrorHandler(0) + , fPSVIHandler(0) + , fValidationContext(0) + , fEntityDeclPoolRetrieved(false) + , fReaderMgr(manager) + , fValidator(valToAdopt) + , fValScheme(Val_Never) + , fGrammarResolver(grammarResolver) + , fGrammarPoolMemoryManager(grammarResolver->getGrammarPoolMemoryManager()) + , fGrammar(0) + , fRootGrammar(0) + , fURIStringPool(0) + , fRootElemName(0) + , fExternalSchemaLocation(0) + , fExternalNoNamespaceSchemaLocation(0) + , fSecurityManager(0) + , fXMLVersion(XMLReader::XMLV1_0) + , fMemoryManager(manager) + , fBufMgr(manager) + , fAttNameBuf(1023, manager) + , fAttValueBuf(1023, manager) + , fCDataBuf(1023, manager) + , fQNameBuf(1023, manager) + , fPrefixBuf(1023, manager) + , fURIBuf(1023, manager) + , fWSNormalizeBuf(1023, manager) + , fElemStack(manager) +{ + CleanupType cleanup(this, &XMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLScanner::XMLScanner( XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errHandler + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) + + : fBufferSize(1024 * 1024) + , fLowWaterMark (100) + , fStandardUriConformant(false) + , fCalculateSrcOfs(false) + , fDoNamespaces(false) + , fExitOnFirstFatal(true) + , fValidationConstraintFatal(false) + , fInException(false) + , fStandalone(false) + , fHasNoDTD(true) + , fValidate(false) + , fValidatorFromUser(false) + , fDoSchema(false) + , fSchemaFullChecking(false) + , fIdentityConstraintChecking(true) + , fToCacheGrammar(false) + , fUseCachedGrammar(false) + , fLoadExternalDTD(true) + , fLoadSchema(true) + , fNormalizeData(true) + , fGenerateSyntheticAnnotations(false) + , fValidateAnnotations(false) + , fIgnoreCachedDTD(false) + , fIgnoreAnnotations(false) + , fDisableDefaultEntityResolution(false) + , fSkipDTDValidation(false) + , fHandleMultipleImports(false) + , fErrorCount(0) + , fEntityExpansionLimit(0) + , fEntityExpansionCount(0) + , fEmptyNamespaceId(0) + , fUnknownNamespaceId(0) + , fXMLNamespaceId(0) + , fXMLNSNamespaceId(0) + , fSchemaNamespaceId(0) + , fUIntPool(0) + , fUIntPoolRow(0) + , fUIntPoolCol(0) + , fUIntPoolRowTotal(2) + , fScannerId(0) + , fSequenceId(0) + , fAttrList(0) + , fAttrDupChkRegistry(0) + , fDocHandler(docHandler) + , fDocTypeHandler(docTypeHandler) + , fEntityHandler(entityHandler) + , fErrorReporter(errHandler) + , fErrorHandler(0) + , fPSVIHandler(0) + , fValidationContext(0) + , fEntityDeclPoolRetrieved(false) + , fReaderMgr(manager) + , fValidator(valToAdopt) + , fValScheme(Val_Never) + , fGrammarResolver(grammarResolver) + , fGrammarPoolMemoryManager(grammarResolver->getGrammarPoolMemoryManager()) + , fGrammar(0) + , fRootGrammar(0) + , fURIStringPool(0) + , fRootElemName(0) + , fExternalSchemaLocation(0) + , fExternalNoNamespaceSchemaLocation(0) + , fSecurityManager(0) + , fXMLVersion(XMLReader::XMLV1_0) + , fMemoryManager(manager) + , fBufMgr(manager) + , fAttNameBuf(1023, manager) + , fAttValueBuf(1023, manager) + , fCDataBuf(1023, manager) + , fQNameBuf(1023, manager) + , fPrefixBuf(1023, manager) + , fURIBuf(1023, manager) + , fWSNormalizeBuf(1023, manager) + , fElemStack(manager) +{ + CleanupType cleanup(this, &XMLScanner::cleanUp); + + try + { + commonInit(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLScanner::~XMLScanner() +{ + cleanUp(); +} + +void XMLScanner::resetCachedGrammar () +{ +} + +void XMLScanner::setValidator(XMLValidator* const valToAdopt) +{ + if (fValidatorFromUser) + delete fValidator; + fValidator = valToAdopt; + fValidatorFromUser = true; + initValidator(fValidator); +} + + + +// --------------------------------------------------------------------------- +// XMLScanner: Main entry point to scan a document +// --------------------------------------------------------------------------- +void XMLScanner::scanDocument( const XMLCh* const systemId) +{ + // First we try to parse it as a URL. If that fails, we assume its + // a file and try it that way. + InputSource* srcToUse = 0; + try + { + // Create a temporary URL. Since this is the primary document, + // it has to be fully qualified. If not, then assume we are just + // mistaking a file for a URL. + XMLURL tmpURL(fMemoryManager); + + if (XMLURL::parse(systemId, tmpURL)) { + + if (tmpURL.isRelative()) { + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return; + } + } + else + { + if (fStandardUriConformant && tmpURL.hasInvalidChar()) { + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return; + } + srcToUse = new (fMemoryManager) URLInputSource(tmpURL, fMemoryManager); + } + } + else { + + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + // lazy bypass ... since all MalformedURLException are fatal, no need to check the type + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return; + } + } + } + catch(const XMLException& excToCatch) + { + // For any other XMLException, + // emit the error and catch any user exception thrown from here. + fInException = true; + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + return; + } + + Janitor janSrc(srcToUse); + scanDocument(*srcToUse); +} + +void XMLScanner::scanDocument( const char* const systemId) +{ + // We just delegate this to the XMLCh version after transcoding + XMLCh* tmpBuf = XMLString::transcode(systemId, fMemoryManager); + ArrayJanitor janBuf(tmpBuf, fMemoryManager); + scanDocument(tmpBuf); +} + + +// This method begins a progressive parse. It scans through the prolog and +// returns a token to be used on subsequent scanNext() calls. If the return +// value is true, then the token is legal and ready for further use. If it +// returns false, then the scan of the prolog failed and the token is not +// going to work on subsequent scanNext() calls. +bool XMLScanner::scanFirst( const XMLCh* const systemId + , XMLPScanToken& toFill) +{ + // First we try to parse it as a URL. If that fails, we assume its + // a file and try it that way. + InputSource* srcToUse = 0; + try + { + // Create a temporary URL. Since this is the primary document, + // it has to be fully qualified. If not, then assume we are just + // mistaking a file for a URL. + XMLURL tmpURL(fMemoryManager); + if (XMLURL::parse(systemId, tmpURL)) { + if (tmpURL.isRelative()) { + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return false; + } + } + else + { + if (fStandardUriConformant && tmpURL.hasInvalidChar()) { + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return false; + } + srcToUse = new (fMemoryManager) URLInputSource(tmpURL, fMemoryManager); + } + } + else { + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + // lazy bypass ... since all MalformedURLException are fatal, no need to check the type + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return false; + } + } + } + catch(const XMLException& excToCatch) + { + // For any other XMLException, + // emit the error and catch any user exception thrown from here. + fInException = true; + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + return false; + } + + Janitor janSrc(srcToUse); + return scanFirst(*srcToUse, toFill); +} + +bool XMLScanner::scanFirst( const char* const systemId + , XMLPScanToken& toFill) +{ + // We just delegate this to the XMLCh version after transcoding + XMLCh* tmpBuf = XMLString::transcode(systemId, fMemoryManager); + ArrayJanitor janBuf(tmpBuf, fMemoryManager); + return scanFirst(tmpBuf, toFill); +} + +bool XMLScanner::scanFirst( const InputSource& src + , XMLPScanToken& toFill) +{ + // Bump up the sequence id for this new scan cycle. This will invalidate + // any previous tokens we've returned. + fSequenceId++; + + ReaderMgrResetType resetReaderMgr(&fReaderMgr, &ReaderMgr::reset); + + // Reset the scanner and its plugged in stuff for a new run. This + // resets all the data structures, creates the initial reader and + // pushes it on the stack, and sets up the base document path + scanReset(src); + + // If we have a document handler, then call the start document + if (fDocHandler) + fDocHandler->startDocument(); + + try + { + // Scan the prolog part, which is everything before the root element + // including the DTD subsets. This is all that is done on the scan + // first. + scanProlog(); + + // If we got to the end of input, then its not a valid XML file. + // Else, go on to scan the content. + if (fReaderMgr.atEOF()) + { + emitError(XMLErrs::EmptyMainEntity); + } + } + // NOTE: + // + // In all of the error processing below, the emitError() call MUST come + // before the flush of the reader mgr, or it will fail because it tries + // to find out the position in the XML source of the error. + catch(const XMLErrs::Codes) + { + // This is a 'first failure' exception so return failure + return false; + } + catch(const XMLValid::Codes) + { + // This is a 'first fatal error' type exit, return failure + return false; + } + catch(const XMLException& excToCatch) + { + // Emit the error and catch any user exception thrown from here. Make + // sure in all cases we flush the reader manager. + fInException = true; + try + { + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + return false; + } + catch(const OutOfMemoryException&) + { + // This is a special case for out-of-memory + // conditions, because resetting the ReaderMgr + // can be problematic. + resetReaderMgr.release(); + + throw; + } + + // Fill in the caller's token to make it legal and return success + toFill.set(fScannerId, fSequenceId); + + // Release the object that will reset the ReaderMgr, since there's + // more to scan. + resetReaderMgr.release(); + + return true; +} + + +void XMLScanner::scanReset(XMLPScanToken& token) +{ + // Make sure this token is still legal + if (!isLegalToken(token)) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_BadPScanToken, fMemoryManager); + + // Reset the reader manager + fReaderMgr.reset(); + + // And invalidate any tokens by bumping our sequence number + fSequenceId++; + + // Reset our error count + fErrorCount = 0; +} + +void XMLScanner::setParseSettings(XMLScanner* const refScanner) +{ + setDocHandler(refScanner->getDocHandler()); + setDocTypeHandler(refScanner->getDocTypeHandler()); + setErrorHandler(refScanner->getErrorHandler()); + setErrorReporter(refScanner->getErrorReporter()); + setEntityHandler(refScanner->getEntityHandler()); + setDoNamespaces(refScanner->getDoNamespaces()); + setDoSchema(refScanner->getDoSchema()); + setCalculateSrcOfs(refScanner->getCalculateSrcOfs()); + setStandardUriConformant(refScanner->getStandardUriConformant()); + setExitOnFirstFatal(refScanner->getExitOnFirstFatal()); + setValidationConstraintFatal(refScanner->getValidationConstraintFatal()); + setIdentityConstraintChecking(refScanner->getIdentityConstraintChecking()); + setValidationSchemaFullChecking(refScanner->getValidationSchemaFullChecking()); + cacheGrammarFromParse(refScanner->isCachingGrammarFromParse()); + useCachedGrammarInParse(refScanner->isUsingCachedGrammarInParse()); + setLoadExternalDTD(refScanner->getLoadExternalDTD()); + setLoadSchema(refScanner->getLoadSchema()); + setNormalizeData(refScanner->getNormalizeData()); + setExternalSchemaLocation(refScanner->getExternalSchemaLocation()); + setExternalNoNamespaceSchemaLocation(refScanner->getExternalNoNamespaceSchemaLocation()); + setValidationScheme(refScanner->getValidationScheme()); + setSecurityManager(refScanner->getSecurityManager()); + setPSVIHandler(refScanner->getPSVIHandler()); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Private helper methods. +// --------------------------------------------------------------------------- + +// This method handles the common initialization, to avoid having to do +// it redundantly in multiple constructors. +void XMLScanner::commonInit() +{ + // We have to do a little init that involves statics, so we have to + // use the mutex to protect it. + { + XMLMutexLock lockInit(sScannerMutex); + + // And assign ourselves the next available scanner id + fScannerId = ++gScannerId; + } + + // Create the attribute list, which is used to store attribute values + // during start tag processing. Give it a reasonable initial size that + // will serve for most folks, though it will grow as required. + fAttrList = new (fMemoryManager) RefVectorOf(32, true, fMemoryManager); + + // Create the id ref list. This is used to enforce XML 1.0 ID ref + // semantics, i.e. all id refs must refer to elements that exist + fValidationContext = new (fMemoryManager) ValidationContextImpl(fMemoryManager); + fValidationContext->setElemStack(&fElemStack); + fValidationContext->setScanner(this); + + // Create the GrammarResolver + //fGrammarResolver = new GrammarResolver(); + + // create initial, 64-element, fUIntPool + fUIntPool = (unsigned int **)fMemoryManager->allocate(sizeof(unsigned int *) *fUIntPoolRowTotal); + memset(fUIntPool, 0, sizeof(unsigned int *) * fUIntPoolRowTotal); + fUIntPool[0] = (unsigned int *)fMemoryManager->allocate(sizeof(unsigned int) << 6); + memset(fUIntPool[0], 0, sizeof(unsigned int) << 6); + + // Register self as handler for XMLBufferFull events on the CDATA buffer + fCDataBuf.setFullHandler(this, fBufferSize); + + if (fValidator) { + fValidatorFromUser = true; + initValidator(fValidator); + } +} + +void XMLScanner::cleanUp() +{ + delete fAttrList; + delete fAttrDupChkRegistry; + delete fValidationContext; + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation; + fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation; + // delete fUIntPool + if (fUIntPool) + { + for (unsigned int i=0; i<=fUIntPoolRow; i++) + { + fMemoryManager->deallocate(fUIntPool[i]); + } + fMemoryManager->deallocate(fUIntPool); + } +} + +void XMLScanner::initValidator(XMLValidator* theValidator) { + + // Tell the validator about the stuff it needs to know in order to + // do its work. + theValidator->setScannerInfo(this, &fReaderMgr, &fBufMgr); + theValidator->setErrorReporter(fErrorReporter); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Error emitting methods +// --------------------------------------------------------------------------- + +// These methods are called whenever the scanner wants to emit an error. +// It handles getting the message loaded, doing token replacement, etc... +// and then calling the error handler, if its installed. +bool XMLScanner::emitErrorWillThrowException(const XMLErrs::Codes toEmit) +{ + if (XMLErrs::isFatal(toEmit) && fExitOnFirstFatal && !fInException) + return true; + return false; +} + +void XMLScanner::emitError(const XMLErrs::Codes toEmit) +{ + // Bump the error count if it is not a warning + if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + incrementErrorCount(); + + if (fErrorReporter) + { + // Load the message into a local for display + const XMLSize_t msgSize = 1023; + XMLCh errText[msgSize + 1]; + + if (!gMsgLoader->loadMsg(toEmit, errText, msgSize)) + { + // Probably should load a default msg here + } + + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgXMLErrDomain + , XMLErrs::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (emitErrorWillThrowException(toEmit)) + throw toEmit; +} + +void XMLScanner::emitError( const XMLErrs::Codes toEmit + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4) +{ + // Bump the error count if it is not a warning + if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + incrementErrorCount(); + + if (fErrorReporter) + { + // Load the message into alocal and replace any tokens found in + // the text. + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + if (!gMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fMemoryManager)) + { + // Should probably load a default message here + } + + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgXMLErrDomain + , XMLErrs::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (emitErrorWillThrowException(toEmit)) + throw toEmit; +} + +void XMLScanner::emitError( const XMLErrs::Codes toEmit + , const char* const text1 + , const char* const text2 + , const char* const text3 + , const char* const text4) +{ + // Bump the error count if it is not a warning + if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + incrementErrorCount(); + + if (fErrorReporter) + { + // Load the message into alocal and replace any tokens found in + // the text. + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + if (!gMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fMemoryManager)) + { + // Should probably load a default message here + } + + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + toEmit + , XMLUni::fgXMLErrDomain + , XMLErrs::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (emitErrorWillThrowException(toEmit)) + throw toEmit; +} + +void XMLScanner::emitError( const XMLErrs::Codes toEmit + , const XMLExcepts::Codes originalExceptCode + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4) +{ + // Bump the error count if it is not a warning + if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) + incrementErrorCount(); + + if (fErrorReporter) + { + // Load the message into alocal and replace any tokens found in + // the text. + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + + if (!gMsgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fMemoryManager)) + { + // Should probably load a default message here + } + + // Create a LastExtEntityInfo structure and get the reader manager + // to fill it in for us. This will give us the information about + // the last reader on the stack that was an external entity of some + // sort (i.e. it will ignore internal entities. + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + fErrorReporter->error + ( + originalExceptCode + , XMLUni::fgExceptDomain //fgXMLErrDomain + , XMLErrs::errorType(toEmit) + , errText + , lastInfo.systemId + , lastInfo.publicId + , lastInfo.lineNumber + , lastInfo.colNumber + ); + } + + // Bail out if its fatal an we are to give up on the first fatal error + if (emitErrorWillThrowException(toEmit)) + throw toEmit; +} + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- + +// This method allows the caller to query the current location of the scanner. +// It will return the sys/public ids of the current entity, and the line/col +// position within it. +// +// NOTE: This API returns the location with the last external file. So if its +// currently scanning an entity, the position returned will be the end of +// the entity reference in the file that had the reference. +// +/*bool +XMLScanner::getLastExtLocation( XMLCh* const sysIdToFill + , const unsigned int maxSysIdChars + , XMLCh* const pubIdToFill + , const unsigned int maxPubIdChars + , XMLSSize_t& lineToFill + , XMLSSize_t& colToFill) const +{ + // Create a local info object and get it filled in by the reader manager + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + + // Fill in the line and column number + lineToFill = lastInfo.lineNumber; + colToFill = lastInfo.colNumber; + + // And copy over as much of the ids as will fit + sysIdToFill[0] = 0; + if (lastInfo.systemId) + { + if (XMLString::stringLen(lastInfo.systemId) > maxSysIdChars) + return false; + XMLString::copyString(sysIdToFill, lastInfo.systemId); + } + + pubIdToFill[0] = 0; + if (lastInfo.publicId) + { + if (XMLString::stringLen(lastInfo.publicId) > maxPubIdChars) + return false; + XMLString::copyString(pubIdToFill, lastInfo.publicId); + } + return true; +}*/ + + +// --------------------------------------------------------------------------- +// XMLScanner: Private scanning methods +// --------------------------------------------------------------------------- + +// This method is called after the end of the root element, to handle +// any miscellaneous stuff hanging around. +void XMLScanner::scanMiscellaneous() +{ + // Get a buffer for this work + XMLBufBid bbCData(&fBufMgr); + + while (true) + { + try + { + const XMLCh nextCh = fReaderMgr.peekNextChar(); + + // Watch for end of file and break out + if (!nextCh) + break; + + if (nextCh == chOpenAngle) + { + if (checkXMLDecl(true)) + { + // Can't have an XML decl here + emitError(XMLErrs::NotValidAfterContent); + fReaderMgr.skipPastChar(chCloseAngle); + } + else if (fReaderMgr.skippedString(XMLUni::fgPIString)) + { + scanPI(); + } + else if (fReaderMgr.skippedString(XMLUni::fgCommentString)) + { + scanComment(); + } + else + { + // This can't be possible, so just give up + emitError(XMLErrs::ExpectedCommentOrPI); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + else if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + // If we have a doc handler, then gather up the spaces and + // call back. Otherwise, just skip over whitespace. + if (fDocHandler) + { + fReaderMgr.getSpaces(bbCData.getBuffer()); + fDocHandler->ignorableWhitespace + ( + bbCData.getRawBuffer() + , bbCData.getLen() + , false + ); + } + else + { + fReaderMgr.skipPastSpaces(); + } + } + else + { + emitError(XMLErrs::ExpectedCommentOrPI); + fReaderMgr.skipPastChar(chCloseAngle); + } + } + catch(const EndOfEntityException&) + { + // Some entity leaked out of the content part of the document. Issue + // a warning and keep going. + emitError(XMLErrs::EntityPropogated); + } + } +} + + +// Scans a PI and calls the appropriate callbacks. At entry we have just +// scanned the ' to be a termination of the target + if (fReaderMgr.skippedChar(chCloseAngle)) + break; + } + + // Check for correct surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) { + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + + gotLeadingSurrogate = false; + } + + bbTarget.append(nextCh); + } + } + else + { + // No target, but make sure its terminated ok + if (!fReaderMgr.skippedChar(chQuestion)) + { + emitError(XMLErrs::UnterminatedPI); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError(XMLErrs::UnterminatedPI); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + } + + // Point the target pointer at the raw data + targetPtr = bbTarget.getRawBuffer(); + + // If we have a handler, then call it + if (fDocHandler) + { + fDocHandler->docPI + ( + namePtr + , targetPtr + ); + } + + //mark PI is seen within the current element + if (! fElemStack.isEmpty()) + fElemStack.setCommentOrPISeen(); + +} + +// Scans all the input from the start of the file to the root element. +// There does not have to be anything in the prolog necessarily, but usually +// there is at least an XMLDecl. +// +// On exit from here we are either at the end of the file or about to read +// the opening < of the root element. +void XMLScanner::scanProlog() +{ + bool sawDocTypeDecl = false; + // Get a buffer for whitespace processing + XMLBufBid bbCData(&fBufMgr); + + // Loop through the prolog. If there is no content, this could go all + // the way to the end of the file. + try + { + while (true) + { + const XMLCh nextCh = fReaderMgr.peekNextChar(); + + if (nextCh == chOpenAngle) + { + // Ok, it could be the xml decl, a comment, the doc type line, + // or the start of the root element. + if (checkXMLDecl(true)) + { + // There shall be at lease --ONE-- space in between + // the tag 'getLineNumber() != 1) + || (curReader->getColumnNumber() != 7)) + { + emitError(XMLErrs::XMLDeclMustBeFirst); + } + + scanXMLDecl(Decl_XML); + } + else if (fReaderMgr.skippedString(XMLUni::fgPIString)) + { + scanPI(); + } + else if (fReaderMgr.skippedString(XMLUni::fgCommentString)) + { + scanComment(); + } + else if (fReaderMgr.skippedString(XMLUni::fgDocTypeString)) + { + if (sawDocTypeDecl) { + emitError(XMLErrs::DuplicateDocTypeDecl); + } + scanDocTypeDecl(); + sawDocTypeDecl = true; + + // if reusing grammar, this has been validated already in first scan + // skip for performance + if (fValidate && fGrammar && !fGrammar->getValidated()) { + // validate the DTD scan so far + fValidator->preContentValidation(fUseCachedGrammar, true); + } + } + else + { + // Assume its the start of the root element + return; + } + } + else if (fReaderMgr.getCurrentReader()->isWhitespace(nextCh)) + { + // If we have a document handler then gather up the + // whitespace and call back. Otherwise just skip over spaces. + if (fDocHandler) + { + fReaderMgr.getSpaces(bbCData.getBuffer()); + fDocHandler->ignorableWhitespace + ( + bbCData.getRawBuffer() + , bbCData.getLen() + , false + ); + } + else + { + fReaderMgr.skipPastSpaces(); + } + } + else + { + emitError(XMLErrs::InvalidDocumentStructure); + + // Watch for end of file and break out + if (!nextCh) + break; + else + fReaderMgr.skipPastChar(chCloseAngle); + } + + } + } + catch(const EndOfEntityException&) + { + // We should never get an end of entity here. They should only + // occur within the doc type scanning method, and not leak out to + // here. + emitError + ( + XMLErrs::UnexpectedEOE + , "in prolog" + ); + } +} + + +// Scans the line. This stuff is all sequential so we don't +// do any state machine loop here. We just bull straight through it. It ends +// past the closing bracket. If there is a document handler, then its called +// on the XMLDecl callback. +// +// On entry, the ' +// [77] TextDecl::= '' +void XMLScanner::scanXMLDecl(const DeclTypes type) +{ + // Get us some buffers to use + XMLBufBid bbVersion(&fBufMgr); + XMLBufBid bbEncoding(&fBufMgr); + XMLBufBid bbStand(&fBufMgr); + XMLBufBid bbDummy(&fBufMgr); + XMLBufBid bbName(&fBufMgr); + + // We use this little enum and array to keep up with what we found + // and what order we found them in. This lets us get them free form + // without too much overhead, but still know that they were in the + // wrong order. + enum Strings + { + VersionString + , EncodingString + , StandaloneString + , UnknownString + + , StringCount + }; + int flags[StringCount] = { -1, -1, -1, -1 }; + + // Also set up a list of buffers in the right order so that we know + // where to put stuff. + XMLBuffer* buffers[StringCount] ; + buffers[0] = &bbVersion.getBuffer(); + buffers[1] = &bbEncoding.getBuffer(); + buffers[2] = &bbStand.getBuffer(); + buffers[3] = &bbDummy.getBuffer(); + + int curCount = 0; + Strings curString; + XMLBuffer& nameBuf = bbName.getBuffer(); + while (true) + { + // Skip any spaces + bool skippedSomething; + fReaderMgr.skipPastSpaces(skippedSomething, true); + + // If we are looking at a question mark, then break out + if (fReaderMgr.lookingAtChar(chQuestion)) + break; + + // If this is not the first string, then we require the spaces + if (!skippedSomething && curCount) + emitError(XMLErrs::ExpectedWhitespace); + + // Get characters up to the next whitespace or equal's sign. + if (!scanUpToWSOr(nameBuf, chEqual)) + emitError(XMLErrs::ExpectedDeclString); + + // See if it matches any of our expected strings + if (XMLString::equals(nameBuf.getRawBuffer(), XMLUni::fgVersionString)) + curString = VersionString; + else if (XMLString::equals(nameBuf.getRawBuffer(), XMLUni::fgEncodingString)) + curString = EncodingString; + else if (XMLString::equals(nameBuf.getRawBuffer(), XMLUni::fgStandaloneString)) + curString = StandaloneString; + else + curString = UnknownString; + + // If its an unknown string, then give that error. Else check to + // see if this one has been done already and give that error. + if (curString == UnknownString) + emitError(XMLErrs::ExpectedDeclString, nameBuf.getRawBuffer()); + else if (flags[curString] != -1) + emitError(XMLErrs::DeclStringRep, nameBuf.getRawBuffer()); + else if (flags[curString] == -1) + flags[curString] = ++curCount; + + // Scan for an equal's sign. If we don't find it, issue an error + // but keep trying to go on. + if (!scanEq(true)) + emitError(XMLErrs::ExpectedEqSign); + + // Get a quote string into the buffer for the string that we are + // currently working on. + if (!getQuotedString(*buffers[curString])) + { + emitError(XMLErrs::ExpectedQuotedString); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // And validate the value according which one it was + const XMLCh* rawValue = buffers[curString]->getRawBuffer(); + if (curString == VersionString) + { + if (XMLString::equals(rawValue, XMLUni::fgVersion1_1)) { + if (type == Decl_XML) { + fXMLVersion = XMLReader::XMLV1_1; + fReaderMgr.setXMLVersion(XMLReader::XMLV1_1); + } + else { + if (fXMLVersion != XMLReader::XMLV1_1) + emitError(XMLErrs::UnsupportedXMLVersion, rawValue); + } + } + else if (XMLString::equals(rawValue, XMLUni::fgVersion1_0)) { + if (type == Decl_XML) { + fXMLVersion = XMLReader::XMLV1_0; + fReaderMgr.setXMLVersion(XMLReader::XMLV1_0); + } + } + else + emitError(XMLErrs::UnsupportedXMLVersion, rawValue); + } + else if (curString == EncodingString) + { + if (!XMLString::isValidEncName(rawValue)) + emitError(XMLErrs::BadXMLEncoding, rawValue); + } + else if (curString == StandaloneString) + { + if (XMLString::equals(rawValue, XMLUni::fgYesString)) + fStandalone = true; + else if (XMLString::equals(rawValue, XMLUni::fgNoString)) + fStandalone = false; + else + { + emitError(XMLErrs::BadStandalone); + //if (!XMLString::compareIString(rawValue, XMLUni::fgYesString)) + //else if (!XMLString::compareIString(rawValue, XMLUni::fgNoString)) + if (buffers[curString]->getLen() == 3 && + (((rawValue[0] == chLatin_y) || (rawValue[0] == chLatin_Y)) && + ((rawValue[1] == chLatin_e) || (rawValue[1] == chLatin_E)) && + ((rawValue[2] == chLatin_s) || (rawValue[2] == chLatin_S)))) + fStandalone = true; + else if (buffers[curString]->getLen() == 2 && + (((rawValue[0] == chLatin_n) || (rawValue[0] == chLatin_N)) && + ((rawValue[1] == chLatin_o) || (rawValue[1] == chLatin_O)))) + fStandalone = false; + } + } + } + + // Make sure that the strings present are in order. We don't care about + // which ones are present at this point, just that any there are in the + // right order. + int curTop = 0; + for (int index = VersionString; index < StandaloneString; index++) + { + if (flags[index] != -1) + { + if (flags[index] != curTop + 1) + { + emitError(XMLErrs::DeclStringsInWrongOrder); + break; + } + curTop = flags[index]; + } + } + + // If its an XML decl, the version must be present. + // If its a Text decl, then encoding must be present AND standalone must not be present. + if ((type == Decl_XML) && (flags[VersionString] == -1)) + emitError(XMLErrs::XMLVersionRequired); + else if (type == Decl_Text) { + if (flags[StandaloneString] != -1) + emitError(XMLErrs::StandaloneNotLegal); + if (flags[EncodingString] == -1) + emitError(XMLErrs::EncodingRequired); + } + + if (!fReaderMgr.skippedChar(chQuestion)) + { + emitError(XMLErrs::UnterminatedXMLDecl); + fReaderMgr.skipPastChar(chCloseAngle); + } + else if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError(XMLErrs::UnterminatedXMLDecl); + fReaderMgr.skipPastChar(chCloseAngle); + } + + // Do this before we possibly update the reader with the + // actual encoding string. Otherwise, we will pass the wrong thing + // for the last parameter! + const XMLCh* actualEnc = fReaderMgr.getCurrentEncodingStr(); + + // Ok, we've now seen the real encoding string, if there was one, so + // lets call back on the current reader and tell it what the real + // encoding string was. If it fails, that's because it represents some + // sort of contradiction with the autosensed format, and it keeps the + // original encoding. + // + // NOTE: This can fail for a number of reasons, such as a bogus encoding + // name or because its in flagrant contradiction of the auto-sensed + // format. + if (flags[EncodingString] != -1) + { + if (!fReaderMgr.getCurrentReader()->setEncoding(bbEncoding.getRawBuffer())) + emitError(XMLErrs::ContradictoryEncoding, bbEncoding.getRawBuffer()); + else + actualEnc = bbEncoding.getRawBuffer(); + } + + // If we have a document handler then call the XML Decl callback. + if (type == Decl_XML) + { + if (fDocHandler) + fDocHandler->XMLDecl + ( + bbVersion.getRawBuffer() + , bbEncoding.getRawBuffer() + , bbStand.getRawBuffer() + , actualEnc + ); + } + else if (type == Decl_Text) + { + if (fDocTypeHandler) + fDocTypeHandler->TextDecl + ( + bbVersion.getRawBuffer() + , bbEncoding.getRawBuffer() + ); + } +} + +const XMLCh* XMLScanner::getURIText(const unsigned int uriId) const +{ + if (fURIStringPool->exists(uriId)) { + // Look up the URI in the string pool and return its id + const XMLCh* value = fURIStringPool->getValueForId(uriId); + if (!value) + return XMLUni::fgZeroLenString; + + return value; + } + else + return XMLUni::fgZeroLenString; +} + +bool XMLScanner::getURIText( const unsigned int uriId + , XMLBuffer& uriBufToFill) const +{ + if (fURIStringPool->exists(uriId)) { + // Look up the URI in the string pool and return its id + const XMLCh* value = fURIStringPool->getValueForId(uriId); + if (!value) + return false; + + uriBufToFill.set(value); + return true; + } + else + return false; +} + +bool XMLScanner::checkXMLDecl(bool startWithAngle) { + + // [23] XMLDecl ::= '' + // [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') + // + // [3] S ::= (#x20 | #x9 | #xD | #xA)+ + if (startWithAngle) { + if (fReaderMgr.peekString(XMLUni::fgXMLDeclString)) { + if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpace) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTab) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLF) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCR)) + { + return true; + } + } + else if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpaceU) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTabU) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLFU) + || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCRU)) + { + // Just in case, check for upper case. If found, issue + // an error, but keep going. + emitError(XMLErrs::XMLDeclMustBeLowerCase); + return true; + } + } + else { + if (fReaderMgr.peekString(XMLUni::fgXMLString)) { + if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpace) + || fReaderMgr.skippedString(XMLUni::fgXMLStringHTab) + || fReaderMgr.skippedString(XMLUni::fgXMLStringLF) + || fReaderMgr.skippedString(XMLUni::fgXMLStringCR)) + { + return true; + } + } + else if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpaceU) + || fReaderMgr.skippedString(XMLUni::fgXMLStringHTabU) + || fReaderMgr.skippedString(XMLUni::fgXMLStringLFU) + || fReaderMgr.skippedString(XMLUni::fgXMLStringCRU)) + { + // Just in case, check for upper case. If found, issue + // an error, but keep going. + emitError(XMLErrs::XMLDeclMustBeLowerCase); + return true; + } + } + + return false; +} + + +// --------------------------------------------------------------------------- +// XMLScanner: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* XMLScanner::loadGrammar(const XMLCh* const systemId + , const short grammarType + , const bool toCache) +{ + InputSource* srcToUse = 0; + + if (fEntityHandler){ + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr.getLastExtEntityInfo(lastInfo); + XMLResourceIdentifier resourceIdentifier(XMLResourceIdentifier::ExternalEntity, + systemId, 0, XMLUni::fgZeroLenString, lastInfo.systemId, + &fReaderMgr); + srcToUse = fEntityHandler->resolveEntity(&resourceIdentifier); + } + + // First we try to parse it as a URL. If that fails, we assume its + // a file and try it that way. + if (!srcToUse) { + if (fDisableDefaultEntityResolution) + return 0; + + try + { + // Create a temporary URL. Since this is the primary document, + // it has to be fully qualified. If not, then assume we are just + // mistaking a file for a URL. + XMLURL tmpURL(fMemoryManager); + + if (XMLURL::parse(systemId, tmpURL)) { + + if (tmpURL.isRelative()) + { + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return 0; + } + } + else + { + if (fStandardUriConformant && tmpURL.hasInvalidChar()) { + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL, fMemoryManager); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return 0; + } + srcToUse = new (fMemoryManager) URLInputSource(tmpURL, fMemoryManager); + } + } + else + { + if (!fStandardUriConformant) + srcToUse = new (fMemoryManager) LocalFileInputSource(systemId, fMemoryManager); + else { + // since this is the top of the try/catch, cannot call ThrowXMLwithMemMgr + // emit the error directly + // lazy bypass ... since all MalformedURLException are fatal, no need to check the type + MalformedURLException e(__FILE__, __LINE__, XMLExcepts::URL_MalformedURL); + fInException = true; + emitError + ( + XMLErrs::XMLException_Fatal + , e.getCode() + , e.getMessage() + ); + return 0; + } + } + } + catch(const XMLException& excToCatch) + { + // For any other XMLException, + // emit the error and catch any user exception thrown from here. + fInException = true; + if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning) + emitError + ( + XMLErrs::XMLException_Warning + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal) + emitError + ( + XMLErrs::XMLException_Fatal + , excToCatch.getCode() + , excToCatch.getMessage() + ); + else + emitError + ( + XMLErrs::XMLException_Error + , excToCatch.getCode() + , excToCatch.getMessage() + ); + return 0; + } + } + + Janitor janSrc(srcToUse); + return loadGrammar(*srcToUse, grammarType, toCache); +} + +Grammar* XMLScanner::loadGrammar(const char* const systemId + , const short grammarType + , const bool toCache) +{ + // We just delegate this to the XMLCh version after transcoding + XMLCh* tmpBuf = XMLString::transcode(systemId, fMemoryManager); + ArrayJanitor janBuf(tmpBuf, fMemoryManager); + return loadGrammar(tmpBuf, grammarType, toCache); +} + + +// --------------------------------------------------------------------------- +// XMLScanner: Setter methods +// --------------------------------------------------------------------------- +void XMLScanner::setURIStringPool(XMLStringPool* const stringPool) +{ + fURIStringPool = stringPool; + fEmptyNamespaceId = fURIStringPool->addOrFind(XMLUni::fgZeroLenString); + fUnknownNamespaceId = fURIStringPool->addOrFind(XMLUni::fgUnknownURIName); + fXMLNamespaceId = fURIStringPool->addOrFind(XMLUni::fgXMLURIName); + fXMLNSNamespaceId = fURIStringPool->addOrFind(XMLUni::fgXMLNSURIName); +} + +// --------------------------------------------------------------------------- +// XMLScanner: Private helper methods +// --------------------------------------------------------------------------- + +/*** + * In reusing grammars (cacheing grammar from parse, or use cached grammar), internal + * dtd is allowed conditionally. + * + * In the case of cacheing grammar from parse, it is NOT allowed. + * + * In the case of use cached grammar, + * if external dtd is present and it is parsed before, then it is not allowed, + * otherwise it is allowed. + * + ***/ +void XMLScanner::checkInternalDTD(bool hasExtSubset + ,const XMLCh* const sysId + ,const XMLCh* const pubId) +{ + if (fToCacheGrammar) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Val_CantHaveIntSS, fMemoryManager); + + if (fUseCachedGrammar && hasExtSubset && !fIgnoreCachedDTD) + { + InputSource* sysIdSrc = resolveSystemId(sysId, pubId); + if (sysIdSrc) { + Janitor janSysIdSrc(sysIdSrc); + Grammar* grammar = fGrammarResolver->getGrammar(sysIdSrc->getSystemId()); + + if (grammar && grammar->getGrammarType() == Grammar::DTDGrammarType) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Val_CantHaveIntSS, fMemoryManager); + } + } + } + +} + +// This method is called after the content scan to insure that all the +// ID/IDREF attributes match up (i.e. that all IDREFs refer to IDs.) This is +// an XML 1.0 rule, so we can do here in the core. + +void XMLScanner::checkIDRefs() +{ + // Iterate the id ref list. If we find any entries here which are used + // but not declared, then that's an error. + RefHashTableOfEnumerator refEnum(fValidationContext->getIdRefList(), false, fMemoryManager); + while (refEnum.hasMoreElements()) + { + // Get a ref to the current element + const XMLRefInfo& curRef = refEnum.nextElement(); + + // If its used but not declared, then its an error + if (!curRef.getDeclared() && curRef.getUsed() && fValidate) + fValidator->emitError(XMLValid::IDNotDeclared, curRef.getRefName()); + } +} + + +// This just does a simple check that the passed progressive scan token is +// legal for this scanner. +bool XMLScanner::isLegalToken(const XMLPScanToken& toCheck) +{ + return ((fScannerId == toCheck.fScannerId) + && (fSequenceId == toCheck.fSequenceId)); +} + + +// This method will handle figuring out what the next top level token is +// in the input stream. It will return an enumerated value that indicates +// what it believes the next XML level token must be. It will eat as many +// chars are required to figure out what is next. +XMLScanner::XMLTokens XMLScanner::senseNextToken(XMLSize_t& orgReader) +{ + // Get the next character and use it to guesstimate what the next token + // is going to be. We turn on end of entity exceptions when we do this + // in order to catch the scenario where the current entity ended at + // the > of some markup. + XMLCh nextCh=0; + + XMLReader* curReader=fReaderMgr.getCurrentReader(); + // avoid setting up the ThrowEOEJanitor if we know that we have data in the current reader + if(curReader && curReader->charsLeftInBuffer()>0) + nextCh = fReaderMgr.peekNextChar(); + else + { + ThrowEOEJanitor janMgr(&fReaderMgr, true); + nextCh = fReaderMgr.peekNextChar(); + } + + // If it's not a '<' we must be in content (unless it's a EOF) + // + // This includes entity references '&' of some sort. These must + // be character data because that's the only place a reference can + // occur in content. + if (nextCh != chOpenAngle) + return nextCh?Token_CharData:Token_EOF; + + // Ok it had to have been a '<' character. So get it out of the reader + // and store the reader number where we saw it, passing it back to the + // caller. + fReaderMgr.getNextChar(); + orgReader = fReaderMgr.getCurrentReaderNum(); + + // Ok, so lets go through the things that it could be at this point which + // are all some form of markup. + switch(fReaderMgr.peekNextChar()) + { + case chForwardSlash: + { + fReaderMgr.getNextChar(); + return Token_EndTag; + } + case chBang: + { + static const XMLCh gCDATAStr[] = + { + chBang, chOpenSquare, chLatin_C, chLatin_D, chLatin_A + , chLatin_T, chLatin_A, chNull + }; + + static const XMLCh gCommentString[] = + { + chBang, chDash, chDash, chNull + }; + + if (fReaderMgr.skippedString(gCDATAStr)) + return Token_CData; + + if (fReaderMgr.skippedString(gCommentString)) + return Token_Comment; + + emitError(XMLErrs::ExpectedCommentOrCDATA); + return Token_Unknown; + } + case chQuestion: + { + // It must be a PI + fReaderMgr.getNextChar(); + return Token_PI; + } + } + // Assume its an element name, so return with a start tag token. If it + // turns out not to be, then it will fail when it cannot get a valid tag. + return Token_StartTag; +} + +// --------------------------------------------------------------------------- +// XMLScanner: Private parsing methods +// --------------------------------------------------------------------------- + +// This guy just scans out a single or double quoted string of characters. +// It does not pass any judgement on the contents and assumes that it is +// illegal to have another quote of the same kind inside the string's +// contents. +// +// NOTE: This is for simple stuff like the strings in the XMLDecl which +// cannot have any entities inside them. So this guy does not handle any +// end of entity stuff. +bool XMLScanner::getQuotedString(XMLBuffer& toFill) +{ + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr.skipIfQuote(quoteCh)) + return false; + + XMLCh nextCh; + // Get another char and see if it matches the starting quote char + while ((nextCh=fReaderMgr.getNextChar())!=quoteCh) + { + // We should never get either an end of file null char here. If we + // do, just fail. It will be handled more gracefully in the higher + // level code that called us. + if (!nextCh) + return false; + + // Else add it to the buffer + toFill.append(nextCh); + } + return true; +} + + +// This method scans a character reference and returns the character that +// was refered to. It assumes that we've already scanned the &# characters +// that prefix the numeric code. +bool XMLScanner::scanCharRef(XMLCh& toFill, XMLCh& second) +{ + bool gotOne = false; + unsigned int value = 0; + + // Set the radix. Its supposed to be a lower case x if hex. But, in + // order to recover well, we check for an upper and put out an error + // for that. + unsigned int radix = 10; + if (fReaderMgr.skippedChar(chLatin_x)) + { + radix = 16; + } + else if (fReaderMgr.skippedChar(chLatin_X)) + { + emitError(XMLErrs::HexRadixMustBeLowerCase); + radix = 16; + } + + while (true) + { + const XMLCh nextCh = fReaderMgr.peekNextChar(); + + // Watch for EOF + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Break out on the terminating semicolon + if (nextCh == chSemiColon) + { + fReaderMgr.getNextChar(); + break; + } + + // Convert this char to a binary value, or bail out if its not + // one. + unsigned int nextVal; + if ((nextCh >= chDigit_0) && (nextCh <= chDigit_9)) + nextVal = (unsigned int)(nextCh - chDigit_0); + else if ((nextCh >= chLatin_A) && (nextCh <= chLatin_F)) + nextVal= (unsigned int)(10 + (nextCh - chLatin_A)); + else if ((nextCh >= chLatin_a) && (nextCh <= chLatin_f)) + nextVal = (unsigned int)(10 + (nextCh - chLatin_a)); + else + { + // Return a zero + toFill = 0; + + // If we got at least a sigit, then do an unterminated ref error. + // Else, do an expected a numerical ref thing. + if (gotOne) + emitError(XMLErrs::UnterminatedCharRef); + else + emitError(XMLErrs::ExpectedNumericalCharRef); + + // Return failure + return false; + } + + // Make sure its valid for the radix. If not, then just eat the + // digit and go on after issueing an error. Else, update the + // running value with this new digit. + if (nextVal >= radix) + { + XMLCh tmpStr[2]; + tmpStr[0] = nextCh; + tmpStr[1] = chNull; + emitError(XMLErrs::BadDigitForRadix, tmpStr); + } + else + { + value = (value * radix) + nextVal; + // Guard against overflow. + if (value > 0x10FFFF) { + // Character reference was not in the valid range + emitError(XMLErrs::InvalidCharacterRef); + return false; + } + } + + // Indicate that we got at least one good digit + gotOne = true; + + // And eat the last char + fReaderMgr.getNextChar(); + } + + // Return the char (or chars) + // And check if the character expanded is valid or not + if (value >= 0x10000 && value <= 0x10FFFF) + { + value -= 0x10000; + toFill = XMLCh((value >> 10) + 0xD800); + second = XMLCh((value & 0x3FF) + 0xDC00); + } + else if (value <= 0xFFFD) + { + toFill = XMLCh(value); + second = 0; + if (!fReaderMgr.getCurrentReader()->isXMLChar(toFill) && !fReaderMgr.getCurrentReader()->isControlChar(toFill)) { + // Character reference was not in the valid range + emitError(XMLErrs::InvalidCharacterRef); + return false; + } + } + else { + // Character reference was not in the valid range + emitError(XMLErrs::InvalidCharacterRef); + return false; + } + + return true; +} + + +// We get here after the '' It will calls the appropriate handler with the comment +// text, if one is provided. A comment can be in either the document or +// the DTD, so the fInDocument flag is used to know which handler to send +// it to. +void XMLScanner::scanComment() +{ + + enum States + { + InText + , OneDash + , TwoDashes + }; + + // Get a buffer for this + XMLBufBid bbComment(&fBufMgr); + + // Get the comment text into a temp buffer. Be sure to use temp buffer + // two here, since its to be used for stuff that is potentially longer + // than just a name. + States curState = InText; + bool gotLeadingSurrogate = false; + while (true) + { + // Get the next character + const XMLCh nextCh = fReaderMgr.getNextChar(); + + // Watch for an end of file + if (!nextCh) + { + emitError(XMLErrs::UnterminatedComment); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + // Check for correct surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + if (gotLeadingSurrogate) + emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr.getCurrentReader()->isXMLChar(nextCh)) { + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + + gotLeadingSurrogate = false; + } + + if (curState == InText) + { + // If its a dash, go to OneDash state. Otherwise take as text + if (nextCh == chDash) + curState = OneDash; + else + bbComment.append(nextCh); + } + else if (curState == OneDash) + { + // If its another dash, then we change to the two dashes states. + // Otherwise, we have to put in the deficit dash and the new + // character and go back to InText. + if (nextCh == chDash) + { + curState = TwoDashes; + } + else + { + bbComment.append(chDash); + bbComment.append(nextCh); + curState = InText; + } + } + else if (curState == TwoDashes) + { + // The next character must be the closing bracket + if (nextCh != chCloseAngle) + { + emitError(XMLErrs::IllegalSequenceInComment); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + break; + } + } + + // If we have an available handler, call back with the comment. + if (fDocHandler) + { + fDocHandler->docComment + ( + bbComment.getRawBuffer() + ); + } + + //mark comment is seen within the current element + if (! fElemStack.isEmpty()) + fElemStack.setCommentOrPISeen(); + +} + + +// Most equal signs can have white space around them, so this little guy +// just makes the calling code cleaner by eating whitespace. +bool XMLScanner::scanEq(bool inDecl) +{ + if(inDecl) + { + bool skippedSomething; + fReaderMgr.skipPastSpaces(skippedSomething, inDecl); + if (fReaderMgr.skippedChar(chEqual)) + { + fReaderMgr.skipPastSpaces(skippedSomething, inDecl); + return true; + } + } + else + { + fReaderMgr.skipPastSpaces(); + if (fReaderMgr.skippedChar(chEqual)) + { + fReaderMgr.skipPastSpaces(); + return true; + } + } + return false; +} + + +XMLSize_t +XMLScanner::scanUpToWSOr(XMLBuffer& toFill, const XMLCh chEndChar) +{ + fReaderMgr.getUpToCharOrWS(toFill, chEndChar); + return toFill.getLen(); +} + +unsigned int *XMLScanner::getNewUIntPtr() +{ + // this method hands back a new pointer initialized to 0 + unsigned int *retVal; + if(fUIntPoolCol < 64) + { + retVal = fUIntPool[fUIntPoolRow]+fUIntPoolCol; + fUIntPoolCol++; + return retVal; + } + // time to grow the pool... + if(fUIntPoolRow+1 == fUIntPoolRowTotal) + { + // and time to add some space for new rows: + fUIntPoolRowTotal <<= 1; + unsigned int **newArray = (unsigned int **)fMemoryManager->allocate(sizeof(unsigned int *) * fUIntPoolRowTotal ); + memcpy(newArray, fUIntPool, (fUIntPoolRow+1) * sizeof(unsigned int *)); + fMemoryManager->deallocate(fUIntPool); + fUIntPool = newArray; + // need to 0 out new elements we won't need: + for (unsigned int i=fUIntPoolRow+2; iallocate(sizeof(unsigned int) << 6); + memset(fUIntPool[fUIntPoolRow], 0, sizeof(unsigned int) << 6); + // point to next element + fUIntPoolCol = 1; + return fUIntPool[fUIntPoolRow]; +} + +void XMLScanner::resetUIntPool() +{ + // to reuse the unsigned int pool--and the hashtables that use it-- + // simply reinitialize everything to 0's + for(unsigned int i = 0; i<= fUIntPoolRow; i++) + memset(fUIntPool[i], 0, sizeof(unsigned int) << 6); +} + +void XMLScanner::recreateUIntPool() +{ + // this allows a bloated unsigned int pool to be dispensed with + + // first, delete old fUIntPool + for (unsigned int i=0; i<=fUIntPoolRow; i++) + { + fMemoryManager->deallocate(fUIntPool[i]); + } + fMemoryManager->deallocate(fUIntPool); + + fUIntPoolRow = fUIntPoolCol = 0; + fUIntPoolRowTotal = 2; + fUIntPool = (unsigned int **)fMemoryManager->allocate(sizeof(unsigned int *) * fUIntPoolRowTotal); + fUIntPool[0] = (unsigned int *)fMemoryManager->allocate(sizeof(unsigned int) << 6); + memset(fUIntPool[fUIntPoolRow], 0, sizeof(unsigned int) << 6); + fUIntPool[1] = 0; +} + +unsigned int XMLScanner::resolvePrefix( const XMLCh* const prefix + , const ElemStack::MapModes mode) +{ + // + // If the prefix is empty, and we are in attribute mode, then we assign + // it to the empty namespace because the default namespace does not + // apply to attributes. + // + if (!*prefix) + { + if(mode == ElemStack::Mode_Attribute) + return fEmptyNamespaceId; + } + // Watch for the special namespace prefixes. We always map these to + // special URIs. 'xml' gets mapped to the official URI that its defined + // to map to by the NS spec. xmlns gets mapped to a special place holder + // URI that we define (so that it maps to something checkable.) + else + { + if (XMLString::equals(prefix, XMLUni::fgXMLNSString)) + return fXMLNSNamespaceId; + else if (XMLString::equals(prefix, XMLUni::fgXMLString)) + return fXMLNamespaceId; + } + + // Ask the element stack to search up itself for a mapping for the + // passed prefix. + bool unknown; + unsigned int uriId = fElemStack.mapPrefixToURI(prefix, unknown); + + // If it was unknown, then the URI was faked in but we have to issue an error + if (unknown) + emitError(XMLErrs::UnknownPrefix, prefix); + + // check to see if uriId is empty; in XML 1.1 an emptynamespace is okay unless + // we are trying to use it. + if (*prefix && + mode == ElemStack::Mode_Element && + fXMLVersion != XMLReader::XMLV1_0 && + uriId == fElemStack.getEmptyNamespaceId()) + emitError(XMLErrs::UnknownPrefix, prefix); + + return uriId; +} + +unsigned int +XMLScanner::resolveQName( const XMLCh* const qName + , XMLBuffer& prefixBuf + , const ElemStack::MapModes mode + , int& prefixColonPos) +{ + prefixColonPos = XMLString::indexOf(qName, chColon); + return resolveQNameWithColon(qName, prefixBuf, mode, prefixColonPos); +} + +unsigned int +XMLScanner::resolveQNameWithColon( const XMLCh* const qName + , XMLBuffer& prefixBuf + , const ElemStack::MapModes mode + , const int prefixColonPos) +{ + // Lets split out the qName into a URI and name buffer first. The URI + // can be empty. + if (prefixColonPos == -1) + { + // Its all name with no prefix, so put the whole thing into the name + // buffer. Then map the empty string to a URI, since the empty string + // represents the default namespace. This will either return some + // explicit URI which the default namespace is mapped to, or the + // the default global namespace. + prefixBuf.reset(); + return resolvePrefix(XMLUni::fgZeroLenString, mode); + } + else + { + // Copy the chars up to but not including the colon into the prefix + // buffer. + prefixBuf.set(qName, prefixColonPos); + return resolvePrefix(prefixBuf.getRawBuffer(), mode); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/XMLScanner.hpp new file mode 100644 index 000000000..fc702334b --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLScanner.hpp @@ -0,0 +1,1432 @@ +/* + * 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: XMLScanner.hpp 882548 2009-11-20 13:44:14Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSCANNER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; +class XMLDocumentHandler; +class XMLEntityHandler; +class ErrorHandler; +class DocTypeHandler; +class XMLPScanToken; +class XMLStringPool; +class Grammar; +class XMLValidator; +class MemoryManager; +class PSVIHandler; + + +struct PSVIElemContext +{ + bool fIsSpecified; + bool fErrorOccurred; + int fElemDepth; + int fFullValidationDepth; + int fNoneValidationDepth; + DatatypeValidator* fCurrentDV; + ComplexTypeInfo* fCurrentTypeInfo; + const XMLCh* fNormalizedValue; +}; + +// This is the mondo scanner class, which does the vast majority of the +// work of parsing. It handles reading in input and spitting out events +// to installed handlers. +class XMLPARSER_EXPORT XMLScanner : public XMemory, public XMLBufferFullHandler +{ +public : + // ----------------------------------------------------------------------- + // Public class types + // + // NOTE: These should really be private, but some of the compilers we + // have to deal with are too stupid to understand this. + // + // DeclTypes + // Used by scanXMLDecl() to know what type of decl it should scan. + // Text decls have slightly different rules from XMLDecls. + // + // EntityExpRes + // These are the values returned from the entity expansion method, + // to indicate how it went. + // + // XMLTokens + // These represent the possible types of input we can get while + // scanning content. + // + // ValScheme + // This indicates what the scanner should do in terms of validation. + // 'Auto' means if there is any int/ext subset, then validate. Else, + // don't. + // ----------------------------------------------------------------------- + enum DeclTypes + { + Decl_Text + , Decl_XML + }; + + enum EntityExpRes + { + EntityExp_Pushed + , EntityExp_Returned + , EntityExp_Failed + }; + + enum XMLTokens + { + Token_CData + , Token_CharData + , Token_Comment + , Token_EndTag + , Token_EOF + , Token_PI + , Token_StartTag + , Token_Unknown + }; + + enum ValSchemes + { + Val_Never + , Val_Always + , Val_Auto + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLScanner + ( + XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~XMLScanner(); + + + // ----------------------------------------------------------------------- + // Error emitter methods + // ----------------------------------------------------------------------- + bool emitErrorWillThrowException(const XMLErrs::Codes toEmit); + void emitError(const XMLErrs::Codes toEmit); + void emitError + ( + const XMLErrs::Codes toEmit + , const XMLCh* const text1 + , const XMLCh* const text2 = 0 + , const XMLCh* const text3 = 0 + , const XMLCh* const text4 = 0 + ); + void emitError + ( + const XMLErrs::Codes toEmit + , const char* const text1 + , const char* const text2 = 0 + , const char* const text3 = 0 + , const char* const text4 = 0 + ); + void emitError + ( + const XMLErrs::Codes toEmit + , const XMLExcepts::Codes originalErrorCode + , const XMLCh* const text1 = 0 + , const XMLCh* const text2 = 0 + , const XMLCh* const text3 = 0 + , const XMLCh* const text4 = 0 + + ); + + // ----------------------------------------------------------------------- + // Implementation of XMLBufferFullHandler interface + // ----------------------------------------------------------------------- + + virtual bool bufferFull(XMLBuffer& toSend) + { + sendCharData(toSend); + return true; + } + + virtual Grammar::GrammarType getCurrentGrammarType() const; + + // ----------------------------------------------------------------------- + // Public pure virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const = 0; + virtual NameIdPool* getEntityDeclPool() = 0; + virtual const NameIdPool* getEntityDeclPool() const = 0; + virtual void scanDocument + ( + const InputSource& src + ) = 0; + virtual bool scanNext(XMLPScanToken& toFill) = 0; + virtual Grammar* loadGrammar + ( + const InputSource& src + , const short grammarType + , const bool toCache = false + ) = 0; + + virtual void resetCachedGrammar (); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const XMLDocumentHandler* getDocHandler() const; + XMLDocumentHandler* getDocHandler(); + const DocTypeHandler* getDocTypeHandler() const; + DocTypeHandler* getDocTypeHandler(); + bool getDoNamespaces() const; + ValSchemes getValidationScheme() const; + bool getDoSchema() const; + bool getValidationSchemaFullChecking() const; + bool getIdentityConstraintChecking() const; + const XMLEntityHandler* getEntityHandler() const; + XMLEntityHandler* getEntityHandler(); + const XMLErrorReporter* getErrorReporter() const; + XMLErrorReporter* getErrorReporter(); + const ErrorHandler* getErrorHandler() const; + ErrorHandler* getErrorHandler(); + const PSVIHandler* getPSVIHandler() const; + PSVIHandler* getPSVIHandler(); + bool getExitOnFirstFatal() const; + bool getValidationConstraintFatal() const; + RefHashTableOf* getIDRefList(); + const RefHashTableOf* getIDRefList() const; + + ValidationContext* getValidationContext(); + + bool getInException() const; + /*bool getLastExtLocation + ( + XMLCh* const sysIdToFill + , const unsigned int maxSysIdChars + , XMLCh* const pubIdToFill + , const unsigned int maxPubIdChars + , XMLSSize_t& lineToFill + , XMLSSize_t& colToFill + ) const;*/ + const Locator* getLocator() const; + const ReaderMgr* getReaderMgr() const; + XMLFilePos getSrcOffset() const; + bool getStandalone() const; + const XMLValidator* getValidator() const; + XMLValidator* getValidator(); + int getErrorCount(); + const XMLStringPool* getURIStringPool() const; + XMLStringPool* getURIStringPool(); + bool getHasNoDTD() const; + XMLCh* getExternalSchemaLocation() const; + XMLCh* getExternalNoNamespaceSchemaLocation() const; + SecurityManager* getSecurityManager() const; + bool getLoadExternalDTD() const; + bool getLoadSchema() const; + bool getNormalizeData() const; + bool isCachingGrammarFromParse() const; + bool isUsingCachedGrammarInParse() const; + bool getCalculateSrcOfs() const; + Grammar* getRootGrammar() const; + XMLReader::XMLVersion getXMLVersion() const; + MemoryManager* getMemoryManager() const; + ValueVectorOf* getNamespaceContext() const; + unsigned int getPrefixId(const XMLCh* const prefix) const; + const XMLCh* getPrefixForId(unsigned int prefId) const; + + // Return is a reference so that we can return it as void* from + // getProperty. + // + const XMLSize_t& getLowWaterMark() const; + + bool getGenerateSyntheticAnnotations() const; + bool getValidateAnnotations() const; + bool getIgnoreCachedDTD() const; + bool getIgnoreAnnotations() const; + bool getDisableDefaultEntityResolution() const; + bool getSkipDTDValidation() const; + bool getHandleMultipleImports() const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * When an attribute name has no prefix, unlike elements, it is not mapped + * to the global namespace. So, in order to have something to map it to + * for practical purposes, a id for an empty URL is created and used for + * such names. + * + * @return The URL pool id of the URL for an empty URL "". + */ + unsigned int getEmptyNamespaceId() const; + + /** + * When a prefix is found that has not been mapped, an error is issued. + * However, if the parser has been instructed not to stop on the first + * fatal error, it needs to be able to continue. To do so, it will map + * that prefix tot his magic unknown namespace id. + * + * @return The URL pool id of the URL for the unknown prefix + * namespace. + */ + unsigned int getUnknownNamespaceId() const; + + /** + * The prefix 'xml' is a magic prefix, defined by the XML spec and + * requiring no prior definition. This method returns the id for the + * intrinsically defined URL for this prefix. + * + * @return The URL pool id of the URL for the 'xml' prefix. + */ + unsigned int getXMLNamespaceId() const; + + /** + * The prefix 'xmlns' is a magic prefix, defined by the namespace spec + * and requiring no prior definition. This method returns the id for the + * intrinsically defined URL for this prefix. + * + * @return The URL pool id of the URL for the 'xmlns' prefix. + */ + unsigned int getXMLNSNamespaceId() const; + + /** + * This method find the passed URI id in its URI pool and + * copy the text of that URI into the passed buffer. + */ + bool getURIText + ( + const unsigned int uriId + , XMLBuffer& uriBufToFill + ) const; + + const XMLCh* getURIText(const unsigned int uriId) const; + + /* tell if the validator comes from user */ + bool isValidatorFromUser(); + + /* tell if standard URI are forced */ + bool getStandardUriConformant() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void addGlobalPrefix(const XMLCh* const prefix, const unsigned int uriId); + void setDocHandler(XMLDocumentHandler* const docHandler); + void setDocTypeHandler(DocTypeHandler* const docTypeHandler); + void setDoNamespaces(const bool doNamespaces); + void setEntityHandler(XMLEntityHandler* const docTypeHandler); + void setErrorReporter(XMLErrorReporter* const errHandler); + void setErrorHandler(ErrorHandler* const handler); + void setPSVIHandler(PSVIHandler* const handler); + void setURIStringPool(XMLStringPool* const stringPool); + void setExitOnFirstFatal(const bool newValue); + void setValidationConstraintFatal(const bool newValue); + void setValidationScheme(const ValSchemes newScheme); + void setValidator(XMLValidator* const valToAdopt); + void setDoSchema(const bool doSchema); + void setValidationSchemaFullChecking(const bool schemaFullChecking); + void setIdentityConstraintChecking(const bool identityConstraintChecking); + void setHasNoDTD(const bool hasNoDTD); + void cacheGrammarFromParse(const bool newValue); + void useCachedGrammarInParse(const bool newValue); + void setRootElemName(XMLCh* rootElemName); + void setExternalSchemaLocation(const XMLCh* const schemaLocation); + void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation); + void setExternalSchemaLocation(const char* const schemaLocation); + void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation); + void setSecurityManager(SecurityManager* const securityManager); + void setLoadExternalDTD(const bool loadDTD); + void setLoadSchema(const bool loadSchema); + void setNormalizeData(const bool normalizeData); + void setCalculateSrcOfs(const bool newValue); + void setParseSettings(XMLScanner* const refScanner); + void setStandardUriConformant(const bool newValue); + void setInputBufferSize(const XMLSize_t bufferSize); + void setLowWaterMark(XMLSize_t newValue); + + void setGenerateSyntheticAnnotations(const bool newValue); + void setValidateAnnotations(const bool newValue); + void setIgnoredCachedDTD(const bool newValue); + void setIgnoreAnnotations(const bool newValue); + void setDisableDefaultEntityResolution(const bool newValue); + void setSkipDTDValidation(const bool newValue); + void setHandleMultipleImports(const bool newValue); + + // ----------------------------------------------------------------------- + // Mutator methods + // ----------------------------------------------------------------------- + void incrementErrorCount(void); // For use by XMLValidator + + // ----------------------------------------------------------------------- + // Document scanning methods + // + // scanDocument() does the entire source document. scanFirst(), + // scanNext(), and scanReset() support a progressive parse. + // ----------------------------------------------------------------------- + void scanDocument + ( + const XMLCh* const systemId + ); + void scanDocument + ( + const char* const systemId + ); + + bool scanFirst + ( + const InputSource& src + , XMLPScanToken& toFill + ); + bool scanFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ); + bool scanFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ); + + void scanReset(XMLPScanToken& toFill); + + bool checkXMLDecl(bool startWithAngle); + + // ----------------------------------------------------------------------- + // Grammar preparsing methods + // ----------------------------------------------------------------------- + Grammar* loadGrammar + ( + const XMLCh* const systemId + , const short grammarType + , const bool toCache = false + ); + Grammar* loadGrammar + ( + const char* const systemId + , const short grammarType + , const bool toCache = false + ); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + unsigned int resolveQName + ( + const XMLCh* const qName + , XMLBuffer& prefixBufToFill + , const ElemStack::MapModes mode + , int& prefixColonPos + ); + +protected: + // ----------------------------------------------------------------------- + // Protected pure virtual methods + // ----------------------------------------------------------------------- + virtual void scanCDSection() = 0; + virtual void scanCharData(XMLBuffer& toToUse) = 0; + virtual EntityExpRes scanEntityRef + ( + const bool inAttVal + , XMLCh& firstCh + , XMLCh& secondCh + , bool& escaped + ) = 0; + virtual void scanDocTypeDecl() = 0; + virtual void scanReset(const InputSource& src) = 0; + virtual void sendCharData(XMLBuffer& toSend) = 0; + + //return owned by the caller + virtual InputSource* resolveSystemId(const XMLCh* const /*sysId*/ + ,const XMLCh* const /*pubId*/) {return 0;}; + + // ----------------------------------------------------------------------- + // Protected scanning methods + // ----------------------------------------------------------------------- + bool scanCharRef(XMLCh& toFill, XMLCh& second); + void scanComment(); + bool scanEq(bool inDecl = false); + void scanMiscellaneous(); + void scanPI(); + void scanProlog(); + void scanXMLDecl(const DeclTypes type); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void checkInternalDTD(bool hasExtSubset, const XMLCh* const sysId, const XMLCh* const pubId); + void checkIDRefs(); + bool isLegalToken(const XMLPScanToken& toCheck); + XMLTokens senseNextToken(XMLSize_t& orgReader); + void initValidator(XMLValidator* theValidator); + inline void resetValidationContext(); + unsigned int *getNewUIntPtr(); + void resetUIntPool(); + void recreateUIntPool(); + unsigned int resolvePrefix + ( + const XMLCh* const prefix + , const ElemStack::MapModes mode + ); + unsigned int resolveQNameWithColon + ( + const XMLCh* const qName + , XMLBuffer& prefixBufToFill + , const ElemStack::MapModes mode + , const int prefixColonPos + ); + + inline + void setAttrDupChkRegistry + ( + const XMLSize_t &attrNumber + , bool &toUseHashTable + ); + + // ----------------------------------------------------------------------- + // Data members + // + // fBufferSize + // Maximum input buffer size + // + // fLowWaterMark + // The low water mark for the raw byte buffer. + // + // fAttrList + // Every time we get a new element start tag, we have to pass to + // the document handler the attributes found. To make it more + // efficient we keep this ref vector of XMLAttr objects around. We + // just reuse it over and over, allowing it to grow to meet the + // peak need. + // + // fBufMgr + // This is a manager for temporary buffers used during scanning. + // For efficiency we must use a set of static buffers, but we have + // to insure that they are not incorrectly reused. So this manager + // provides the smarts to hand out buffers as required. + // + // fDocHandler + // The client code's document handler. If zero, then no document + // handler callouts are done. We don't adopt it. + // + // fDocTypeHandler + // The client code's document type handler (used by DTD Validator). + // + // fDoNamespaces + // This flag indicates whether the client code wants us to do + // namespaces or not. If the installed validator indicates that it + // has to do namespaces, then this is ignored. + // + // fEntityHandler + // The client code's entity handler. If zero, then no entity handler + // callouts are done. We don't adopt it. + // + // fErrorReporter + // The client code's error reporter. If zero, then no error reporter + // callouts are done. We don't adopt it. + // + // fErrorHandler + // The client code's error handler. Need to store this info for + // Schema parse error handling. + // + // fPSVIHandler + // The client code's PSVI handler. + // + // fExitOnFirstFatal + // This indicates whether we bail out on the first fatal XML error + // or not. It defaults to true, which is the strict XML way, but it + // can be changed. + // + // fValidationConstraintFatal + // This indicates whether we treat validation constraint errors as + // fatal errors or not. It defaults to false, but it can be changed. + // + // fIDRefList + // This is a list of XMLRefInfo objects. This member lets us do all + // needed ID-IDREF balancing checks. + // + // fInException + // To avoid a circular freakout when we catch an exception and emit + // it, which would normally throw again if the 'fail on first error' + // flag is one. + // + // fReaderMgr + // This is the reader manager, from which we get characters. It + // manages the reader stack for us, and provides a lot of convenience + // methods to do specialized checking for chars, sequences of chars, + // skipping chars, etc... + // + // fScannerId + // fSequenceId + // These are used for progressive parsing, to make sure that the + // client code does the right thing at the right time. + // + // fStandalone + // Indicates whether the document is standalone or not. Defaults to + // no, but can be overridden in the XMLDecl. + // + // fHasNoDTD + // Indicates the document has no DTD or has only an internal DTD subset + // which contains no parameter entity references. + // + // fValidate + // Indicates whether any validation should be done. This is defined + // by the existence of a Grammar together with fValScheme. + // + // fValidator + // The installed validator. We look at them via the abstract + // validator interface, and don't know what it actual is. + // Either point to user's installed validator, or fDTDValidator + // or fSchemaValidator. + // + // fValidatorFromUser + // This flag indicates whether the validator was installed from + // user. If false, then the validator was created by the Scanner. + // + // fValScheme + // This is the currently set validation scheme. It defaults to + // 'never', but can be set by the client. + // + // fErrorCount + // The number of errors we've encountered. + // + // fDoSchema + // This flag indicates whether the client code wants Schema to + // be processed or not. + // + // fSchemaFullChecking + // This flag indicates whether the client code wants full Schema + // constraint checking. + // + // fIdentityConstraintChecking + // This flag indicates whether the client code wants Identity + // Constraint checking, defaulted to true to maintain backward + // compatibility (to minimize supprise) + // + // fAttName + // fAttValue + // fCDataBuf + // fNameBuf + // fQNameBuf + // fPrefixBuf + // For the most part, buffers are obtained from the fBufMgr object + // on the fly. However, for the start tag scan, we have a set of + // fixed buffers for performance reasons. These are used a lot and + // there are a number of them, so asking the buffer manager each + // time for new buffers is a bit too much overhead. + // + // fEmptyNamespaceId + // This is the id of the empty namespace URI. This is a special one + // because of the xmlns="" type of deal. We have to quickly sense + // that its the empty namespace. + // + // fUnknownNamespaceId + // This is the id of the namespace URI which is assigned to the + // global namespace. Its for debug purposes only, since there is no + // real global namespace URI. Its set by the derived class. + // + // fXMLNamespaceId + // fXMLNSNamespaceId + // These are the ids of the namespace URIs which are assigned to the + // 'xml' and 'xmlns' special prefixes. The former is officially + // defined but the latter is not, so we just provide one for debug + // purposes. + // + // fSchemaNamespaceId + // This is the id of the schema namespace URI. + // + // fGrammarResolver + // Grammar Pool that stores all the grammars. Key is namespace for + // schema and system id for external DTD. When caching a grammar, if + // a grammar is already in the pool, it will be replaced with the + // new parsed one. + // + // fGrammar + // Current Grammar used by the Scanner and Validator + // + // fRootGrammar + // The grammar where the root element is declared. + // + // fGrammarType + // Current Grammar Type. Store this value instead of calling getGrammarType + // all the time for faster performance. + // + // fURIStringPool + // This is a pool for URIs with unique ids assigned. We use a standard + // string pool class. This pool is going to be shared by all Grammar. + // Use only if namespace is turned on. + // + // fRootElemName + // No matter we are using DTD or Schema Grammar, if a DOCTYPE exists, + // we need to verify the root element name. So store the rootElement + // that is used in the DOCTYPE in the Scanner instead of in the DTDGrammar + // where it used to + // + // fExternalSchemaLocation + // The list of Namespace/SchemaLocation that was specified externally + // using setExternalSchemaLocation. + // + // fExternalNoNamespaceSchemaLocation + // The no target namespace XML Schema Location that was specified + // externally using setExternalNoNamespaceSchemaLocation. + // + // fSecurityManager + // The SecurityManager instance; as and when set by the application. + // + // fEntityExpansionLimit + // The number of entity expansions to be permitted while processing this document + // Only meaningful when fSecurityManager != 0 + // + // fEntityExpansionCount + // The number of general entities expanded so far in this document. + // Only meaningful when fSecurityManager != null + // + // fLoadExternalDTD + // This flag indicates whether the external DTD be loaded or not + // + // fLoadSchema + // This flag indicates whether the parser should attempt to load + // schemas if they cannot be found in the grammar pool. + // + // fNormalizeData + // This flag indicates whether the parser should perform datatype + // normalization that is defined in the schema. + // + // fCalculateSrcOfs + // This flag indicates the parser should calculate the source offset. + // Turning this on may impact performance. + // + // fStandardUriConformant + // This flag controls whether we force conformant URI + // + // fXMLVersion + // Enum to indicate if the main doc is XML 1.1 or XML 1.0 conformant + // fUIntPool + // pool of unsigned integers to help with duplicate attribute + // detection and filling in default/fixed attributes + // fUIntPoolRow + // current row in fUIntPool + // fUIntPoolCol + // current column in row + // fUIntPoolRowTotal + // total number of rows in table + // + // fMemoryManager + // Pluggable memory manager for dynamic allocation/deallocation. + // + // ----------------------------------------------------------------------- + XMLSize_t fBufferSize; + XMLSize_t fLowWaterMark; + bool fStandardUriConformant; + bool fCalculateSrcOfs; + bool fDoNamespaces; + bool fExitOnFirstFatal; + bool fValidationConstraintFatal; + bool fInException; + bool fStandalone; + bool fHasNoDTD; + bool fValidate; + bool fValidatorFromUser; + bool fDoSchema; + bool fSchemaFullChecking; + bool fIdentityConstraintChecking; + bool fToCacheGrammar; + bool fUseCachedGrammar; + bool fLoadExternalDTD; + bool fLoadSchema; + bool fNormalizeData; + bool fGenerateSyntheticAnnotations; + bool fValidateAnnotations; + bool fIgnoreCachedDTD; + bool fIgnoreAnnotations; + bool fDisableDefaultEntityResolution; + bool fSkipDTDValidation; + bool fHandleMultipleImports; + int fErrorCount; + XMLSize_t fEntityExpansionLimit; + XMLSize_t fEntityExpansionCount; + unsigned int fEmptyNamespaceId; + unsigned int fUnknownNamespaceId; + unsigned int fXMLNamespaceId; + unsigned int fXMLNSNamespaceId; + unsigned int fSchemaNamespaceId; + unsigned int ** fUIntPool; + unsigned int fUIntPoolRow; + unsigned int fUIntPoolCol; + unsigned int fUIntPoolRowTotal; + XMLUInt32 fScannerId; + XMLUInt32 fSequenceId; + RefVectorOf* fAttrList; + RefHash2KeysTableOf* fAttrDupChkRegistry; + XMLDocumentHandler* fDocHandler; + DocTypeHandler* fDocTypeHandler; + XMLEntityHandler* fEntityHandler; + XMLErrorReporter* fErrorReporter; + ErrorHandler* fErrorHandler; + PSVIHandler* fPSVIHandler; + ValidationContext *fValidationContext; + bool fEntityDeclPoolRetrieved; + ReaderMgr fReaderMgr; + XMLValidator* fValidator; + ValSchemes fValScheme; + GrammarResolver* const fGrammarResolver; + MemoryManager* const fGrammarPoolMemoryManager; + Grammar* fGrammar; + Grammar* fRootGrammar; + XMLStringPool* fURIStringPool; + XMLCh* fRootElemName; + XMLCh* fExternalSchemaLocation; + XMLCh* fExternalNoNamespaceSchemaLocation; + SecurityManager* fSecurityManager; + XMLReader::XMLVersion fXMLVersion; + MemoryManager* fMemoryManager; + XMLBufferMgr fBufMgr; + XMLBuffer fAttNameBuf; + XMLBuffer fAttValueBuf; + XMLBuffer fCDataBuf; + XMLBuffer fQNameBuf; + XMLBuffer fPrefixBuf; + XMLBuffer fURIBuf; + XMLBuffer fWSNormalizeBuf; + ElemStack fElemStack; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLScanner(); + XMLScanner(const XMLScanner&); + XMLScanner& operator=(const XMLScanner&); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void commonInit(); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Private scanning methods + // ----------------------------------------------------------------------- + bool getQuotedString(XMLBuffer& toFill); + XMLSize_t scanUpToWSOr + ( + XMLBuffer& toFill + , const XMLCh chEndChar + ); +}; + +// --------------------------------------------------------------------------- +// XMLScanner: Getter methods +// --------------------------------------------------------------------------- +inline const XMLDocumentHandler* XMLScanner::getDocHandler() const +{ + return fDocHandler; +} + +inline XMLDocumentHandler* XMLScanner::getDocHandler() +{ + return fDocHandler; +} + +inline const DocTypeHandler* XMLScanner::getDocTypeHandler() const +{ + return fDocTypeHandler; +} + +inline DocTypeHandler* XMLScanner::getDocTypeHandler() +{ + return fDocTypeHandler; +} + +inline bool XMLScanner::getDoNamespaces() const +{ + return fDoNamespaces; +} + +inline const XMLEntityHandler* XMLScanner::getEntityHandler() const +{ + return fEntityHandler; +} + +inline XMLEntityHandler* XMLScanner::getEntityHandler() +{ + return fEntityHandler; +} + +inline const XMLErrorReporter* XMLScanner::getErrorReporter() const +{ + return fErrorReporter; +} + +inline XMLErrorReporter* XMLScanner::getErrorReporter() +{ + return fErrorReporter; +} + +inline const ErrorHandler* XMLScanner::getErrorHandler() const +{ + return fErrorHandler; +} + +inline ErrorHandler* XMLScanner::getErrorHandler() +{ + return fErrorHandler; +} + +inline const PSVIHandler* XMLScanner::getPSVIHandler() const +{ + return fPSVIHandler; +} + +inline PSVIHandler* XMLScanner::getPSVIHandler() +{ + return fPSVIHandler; +} + +inline bool XMLScanner::getExitOnFirstFatal() const +{ + return fExitOnFirstFatal; +} + +inline bool XMLScanner::getValidationConstraintFatal() const +{ + return fValidationConstraintFatal; +} + +inline bool XMLScanner::getInException() const +{ + return fInException; +} + +inline RefHashTableOf* XMLScanner::getIDRefList() +{ + return fValidationContext->getIdRefList(); +} + +inline const RefHashTableOf* XMLScanner::getIDRefList() const +{ + return fValidationContext->getIdRefList(); +} + +inline ValidationContext* XMLScanner::getValidationContext() +{ + if (!fEntityDeclPoolRetrieved) + { + fValidationContext->setEntityDeclPool(getEntityDeclPool()); + fEntityDeclPoolRetrieved = true; + } + + return fValidationContext; +} + +inline const Locator* XMLScanner::getLocator() const +{ + return &fReaderMgr; +} + +inline const ReaderMgr* XMLScanner::getReaderMgr() const +{ + return &fReaderMgr; +} + +inline XMLFilePos XMLScanner::getSrcOffset() const +{ + return fReaderMgr.getSrcOffset(); +} + +inline bool XMLScanner::getStandalone() const +{ + return fStandalone; +} + +inline XMLScanner::ValSchemes XMLScanner::getValidationScheme() const +{ + return fValScheme; +} + +inline const XMLValidator* XMLScanner::getValidator() const +{ + return fValidator; +} + +inline XMLValidator* XMLScanner::getValidator() +{ + return fValidator; +} + +inline bool XMLScanner::getDoSchema() const +{ + return fDoSchema; +} + +inline bool XMLScanner::getValidationSchemaFullChecking() const +{ + return fSchemaFullChecking; +} + +inline bool XMLScanner::getIdentityConstraintChecking() const +{ + return fIdentityConstraintChecking; +} + +inline int XMLScanner::getErrorCount() +{ + return fErrorCount; +} + +inline bool XMLScanner::isValidatorFromUser() +{ + return fValidatorFromUser; +} + +inline unsigned int XMLScanner::getEmptyNamespaceId() const +{ + return fEmptyNamespaceId; +} + +inline unsigned int XMLScanner::getUnknownNamespaceId() const +{ + return fUnknownNamespaceId; +} + +inline unsigned int XMLScanner::getXMLNamespaceId() const +{ + return fXMLNamespaceId; +} + +inline unsigned int XMLScanner::getXMLNSNamespaceId() const +{ + return fXMLNSNamespaceId; +} + +inline const XMLStringPool* XMLScanner::getURIStringPool() const +{ + return fURIStringPool; +} + +inline XMLStringPool* XMLScanner::getURIStringPool() +{ + return fURIStringPool; +} + +inline bool XMLScanner::getHasNoDTD() const +{ + return fHasNoDTD; +} + +inline XMLCh* XMLScanner::getExternalSchemaLocation() const +{ + return fExternalSchemaLocation; +} + +inline XMLCh* XMLScanner::getExternalNoNamespaceSchemaLocation() const +{ + return fExternalNoNamespaceSchemaLocation; +} + +inline SecurityManager* XMLScanner::getSecurityManager() const +{ + return fSecurityManager; +} + +inline bool XMLScanner::getLoadExternalDTD() const +{ + return fLoadExternalDTD; +} + +inline bool XMLScanner::getLoadSchema() const +{ + return fLoadSchema; +} + +inline bool XMLScanner::getNormalizeData() const +{ + return fNormalizeData; +} + +inline bool XMLScanner::isCachingGrammarFromParse() const +{ + return fToCacheGrammar; +} + +inline bool XMLScanner::isUsingCachedGrammarInParse() const +{ + return fUseCachedGrammar; +} + +inline bool XMLScanner::getCalculateSrcOfs() const +{ + return fCalculateSrcOfs; +} + +inline Grammar* XMLScanner::getRootGrammar() const +{ + return fRootGrammar; +} + +inline bool XMLScanner::getStandardUriConformant() const +{ + return fStandardUriConformant; +} + +inline XMLReader::XMLVersion XMLScanner::getXMLVersion() const +{ + return fXMLVersion; +} + +inline MemoryManager* XMLScanner::getMemoryManager() const +{ + return fMemoryManager; +} + +inline ValueVectorOf* XMLScanner::getNamespaceContext() const +{ + return fElemStack.getNamespaceMap(); +} + +inline unsigned int XMLScanner::getPrefixId(const XMLCh* const prefix) const +{ + return fElemStack.getPrefixId(prefix); +} + +inline const XMLCh* XMLScanner::getPrefixForId(unsigned int prefId) const +{ + return fElemStack.getPrefixForId(prefId); +} + +inline bool XMLScanner::getGenerateSyntheticAnnotations() const +{ + return fGenerateSyntheticAnnotations; +} + +inline bool XMLScanner::getValidateAnnotations() const +{ + return fValidateAnnotations; +} + +inline const XMLSize_t& XMLScanner::getLowWaterMark() const +{ + return fLowWaterMark; +} + +inline bool XMLScanner::getIgnoreCachedDTD() const +{ + return fIgnoreCachedDTD; +} + +inline bool XMLScanner::getIgnoreAnnotations() const +{ + return fIgnoreAnnotations; +} + +inline bool XMLScanner::getDisableDefaultEntityResolution() const +{ + return fDisableDefaultEntityResolution; +} + +inline bool XMLScanner::getSkipDTDValidation() const +{ + return fSkipDTDValidation; +} + +inline bool XMLScanner::getHandleMultipleImports() const +{ + return fHandleMultipleImports; +} + +// --------------------------------------------------------------------------- +// XMLScanner: Setter methods +// --------------------------------------------------------------------------- +inline void XMLScanner::addGlobalPrefix(const XMLCh* const prefix, const unsigned int uriId) +{ + fElemStack.addGlobalPrefix(prefix, uriId); +} + +inline void XMLScanner::setDocHandler(XMLDocumentHandler* const docHandler) +{ + fDocHandler = docHandler; +} + +inline void XMLScanner::setDocTypeHandler(DocTypeHandler* const docTypeHandler) +{ + fDocTypeHandler = docTypeHandler; +} + +inline void XMLScanner::setErrorHandler(ErrorHandler* const handler) +{ + fErrorHandler = handler; +} + +inline void XMLScanner::setPSVIHandler(PSVIHandler* const handler) +{ + fPSVIHandler = handler; +} + +inline void XMLScanner::setEntityHandler(XMLEntityHandler* const entityHandler) +{ + fEntityHandler = entityHandler; + fReaderMgr.setEntityHandler(entityHandler); +} + +inline void XMLScanner::setErrorReporter(XMLErrorReporter* const errHandler) +{ + fErrorReporter = errHandler; +} + +inline void XMLScanner::setExitOnFirstFatal(const bool newValue) +{ + fExitOnFirstFatal = newValue; +} + + +inline void XMLScanner::setValidationConstraintFatal(const bool newValue) +{ + fValidationConstraintFatal = newValue; +} + +inline void XMLScanner::setValidationScheme(const ValSchemes newScheme) +{ + fValScheme = newScheme; + + // validation flag for Val_Auto is set to false by default, + // and will be turned to true if a grammar is seen + if (fValScheme == Val_Always) + fValidate = true; + else + fValidate = false; +} + +inline void XMLScanner::setDoSchema(const bool doSchema) +{ + fDoSchema = doSchema; +} + +inline void XMLScanner::setDoNamespaces(const bool doNamespaces) +{ + fDoNamespaces = doNamespaces; +} + +inline void XMLScanner::setValidationSchemaFullChecking(const bool schemaFullChecking) +{ + fSchemaFullChecking = schemaFullChecking; +} + +inline void XMLScanner::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fIdentityConstraintChecking = identityConstraintChecking; +} + +inline void XMLScanner::setHasNoDTD(const bool hasNoDTD) +{ + fHasNoDTD = hasNoDTD; +} + +inline void XMLScanner::setRootElemName(XMLCh* rootElemName) +{ + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + fRootElemName = XMLString::replicate(rootElemName, fMemoryManager); +} + +inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation) +{ + fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation; + fExternalSchemaLocation = XMLString::replicate(schemaLocation, fMemoryManager); +} + +inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation) +{ + fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation; + fExternalNoNamespaceSchemaLocation = XMLString::replicate(noNamespaceSchemaLocation, fMemoryManager); +} + +inline void XMLScanner::setExternalSchemaLocation(const char* const schemaLocation) +{ + fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation; + fExternalSchemaLocation = XMLString::transcode(schemaLocation, fMemoryManager); +} + +inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation) +{ + fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation; + fExternalNoNamespaceSchemaLocation = XMLString::transcode(noNamespaceSchemaLocation, fMemoryManager); +} + +inline void XMLScanner::setSecurityManager(SecurityManager* const securityManager) +{ + fSecurityManager = securityManager; + if(securityManager != 0) + { + fEntityExpansionLimit = securityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } +} + +inline void XMLScanner::setLoadExternalDTD(const bool loadDTD) +{ + fLoadExternalDTD = loadDTD; +} + +inline void XMLScanner::setLoadSchema(const bool loadSchema) +{ + fLoadSchema = loadSchema; +} + +inline void XMLScanner::setNormalizeData(const bool normalizeData) +{ + fNormalizeData = normalizeData; +} + +inline void XMLScanner::cacheGrammarFromParse(const bool newValue) +{ + fToCacheGrammar = newValue; +} + +inline void XMLScanner::useCachedGrammarInParse(const bool newValue) +{ + fUseCachedGrammar = newValue; +} + +inline void XMLScanner::setCalculateSrcOfs(const bool newValue) +{ + fCalculateSrcOfs = newValue; +} + +inline void XMLScanner::setStandardUriConformant(const bool newValue) +{ + fStandardUriConformant = newValue; + fReaderMgr.setStandardUriConformant(newValue); +} + +inline void XMLScanner::setGenerateSyntheticAnnotations(const bool newValue) +{ + fGenerateSyntheticAnnotations = newValue; +} + +inline void XMLScanner::setValidateAnnotations(const bool newValue) +{ + fValidateAnnotations = newValue; +} + +inline void XMLScanner::setInputBufferSize(const XMLSize_t bufferSize) +{ + fBufferSize = bufferSize; + fCDataBuf.setFullHandler(this, fBufferSize); +} + +inline void XMLScanner::setLowWaterMark(XMLSize_t newValue) +{ + fLowWaterMark = newValue; +} + +inline void XMLScanner::setIgnoredCachedDTD(const bool newValue) +{ + fIgnoreCachedDTD = newValue; +} + +inline void XMLScanner::setIgnoreAnnotations(const bool newValue) +{ + fIgnoreAnnotations = newValue; +} + +inline void XMLScanner::setDisableDefaultEntityResolution(const bool newValue) +{ + fDisableDefaultEntityResolution = newValue; +} + +inline void XMLScanner::setSkipDTDValidation(const bool newValue) +{ + fSkipDTDValidation = newValue; +} + +inline void XMLScanner::setHandleMultipleImports(const bool newValue) +{ + fHandleMultipleImports = newValue; +} + +// --------------------------------------------------------------------------- +// XMLScanner: Mutator methods +// --------------------------------------------------------------------------- +inline void XMLScanner::incrementErrorCount() +{ + ++fErrorCount; +} + +inline void XMLScanner::resetValidationContext() +{ + fValidationContext->clearIdRefList(); + fValidationContext->setEntityDeclPool(0); + fEntityDeclPoolRetrieved = false; +} + +inline void XMLScanner::setAttrDupChkRegistry(const XMLSize_t &attrNumber + , bool &toUseHashTable) +{ + // once the attribute exceed 100, we use hash table to check duplication + if (attrNumber > 100) + { + toUseHashTable = true; + + if (!fAttrDupChkRegistry) + { + fAttrDupChkRegistry = new (fMemoryManager) RefHash2KeysTableOf + ( + 2*attrNumber+1, false, fMemoryManager + ); + } + else + { + fAttrDupChkRegistry->removeAll(); + } + } + +} + +inline Grammar::GrammarType XMLScanner::getCurrentGrammarType() const +{ + return Grammar::UnKnown; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.cpp b/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.cpp new file mode 100644 index 000000000..356faf7b2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.cpp @@ -0,0 +1,88 @@ +/* + * 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: XMLScannerResolver.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLScannerResolver: Public static methods +// --------------------------------------------------------------------------- +XMLScanner* +XMLScannerResolver::getDefaultScanner( XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) +{ + return new (manager) IGXMLScanner(valToAdopt, grammarResolver, manager); +} + +XMLScanner* +XMLScannerResolver::resolveScanner( const XMLCh* const scannerName + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) +{ + if (XMLString::equals(scannerName, XMLUni::fgWFXMLScanner)) + return new (manager) WFXMLScanner(valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgIGXMLScanner)) + return new (manager) IGXMLScanner(valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgSGXMLScanner)) + return new (manager) SGXMLScanner(valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgDGXMLScanner)) + return new (manager) DGXMLScanner(valToAdopt, grammarResolver, manager); + + // REVISIT: throw an exception or return a default one? + return 0; +} + +XMLScanner* +XMLScannerResolver::resolveScanner( const XMLCh* const scannerName + , XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager) +{ + if (XMLString::equals(scannerName, XMLUni::fgWFXMLScanner)) + return new (manager) WFXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgIGXMLScanner)) + return new (manager) IGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgSGXMLScanner)) + return new (manager) SGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager); + else if (XMLString::equals(scannerName, XMLUni::fgDGXMLScanner)) + return new (manager) DGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager); + + // REVISIT: throw an exception or return a default one? + return 0; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.hpp b/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.hpp new file mode 100644 index 000000000..8b6f89771 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XMLScannerResolver.hpp @@ -0,0 +1,79 @@ +/* + * 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: XMLScannerResolver.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSCANNERRESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSCANNERRESOLVER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLValidator; +class XMLDocumentHandler; +class XMLErrorReporter; +class DocTypeHandler; +class XMLEntityHandler; + +class XMLPARSER_EXPORT XMLScannerResolver +{ +public: + // ----------------------------------------------------------------------- + // Public class methods + // ----------------------------------------------------------------------- + static XMLScanner* resolveScanner + ( + const XMLCh* const scannerName + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + static XMLScanner* resolveScanner + ( + const XMLCh* const scannerName + , XMLDocumentHandler* const docHandler + , DocTypeHandler* const docTypeHandler + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errReporter + , XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + static XMLScanner* getDefaultScanner + ( + XMLValidator* const valToAdopt + , GrammarResolver* const grammarResolver + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + +private : + + // ----------------------------------------------------------------------- + // Unimplemented constructor and destructor + // ----------------------------------------------------------------------- + XMLScannerResolver(); + ~XMLScannerResolver(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XProtoType.cpp b/project/jni/xerces/src/xercesc/internal/XProtoType.cpp new file mode 100644 index 000000000..2dc809265 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XProtoType.cpp @@ -0,0 +1,108 @@ +/* + * 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: XProtoType.cpp 834826 2009-11-11 10:03:53Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * + * write the length of the class name + * write the class name + * + ***/ +void XProtoType::store(XSerializeEngine& serEng) const +{ + XMLSize_t strLen = XMLString::stringLen((char*)fClassName); + serEng << (unsigned long)strLen; + serEng.write(fClassName, strLen * sizeof(XMLByte)); +} + +/*** + * + * To verify that the content in the binary stream + * is the same as this class + * + ***/ +void XProtoType::load(XSerializeEngine& serEng + , XMLByte* const inName + , MemoryManager* const manager) +{ + if (!inName) + { + ThrowXMLwithMemMgr(XSerializationException + , XMLExcepts::XSer_ProtoType_Null_ClassName, manager); + } + + // read and check class name length + XMLSize_t inNameLen = XMLString::stringLen((char*)inName); + XMLSize_t classNameLen = 0; + serEng >> (unsigned long&)classNameLen; + + if (classNameLen != inNameLen) + { + XMLCh value1[17]; + XMLCh value2[17]; + XMLString::sizeToText(inNameLen, value1, 16, 10, manager); + XMLString::sizeToText(classNameLen, value2, 16, 10, manager); + + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_ProtoType_NameLen_Dif + , value1 + , value2 + , manager); + } + + // read and check class name + XMLByte className[256]; + serEng.read(className, classNameLen*sizeof(XMLByte)); + className[classNameLen] = '\0'; + + if ( !XMLString::equals((char*)className, (char*)inName)) + { + //we don't have class name exceed this length in xerces + XMLCh name1[256]; + XMLCh name2[256]; + XMLCh *tmp = XMLString::transcode((char*)inName, manager); + XMLString::copyNString(name1, tmp, 255); + manager->deallocate(tmp); + tmp = XMLString::transcode((char*)className, manager); + XMLString::copyNString(name2, tmp, 255); + manager->deallocate(tmp); + + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_ProtoType_Name_Dif + , name1 + , name2 + , manager); + } + + return; + +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/internal/XProtoType.hpp b/project/jni/xerces/src/xercesc/internal/XProtoType.hpp new file mode 100644 index 000000000..9b5559d89 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XProtoType.hpp @@ -0,0 +1,93 @@ +/* + * 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: XProtoType.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XPROTOTYPE_HPP) +#define XERCESC_INCLUDE_GUARD_XPROTOTYPE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XSerializeEngine; +class XSerializable; + +class XMLUTIL_EXPORT XProtoType +{ +public: + + void store(XSerializeEngine& serEng) const; + + static void load(XSerializeEngine& serEng + , XMLByte* const name + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // ------------------------------------------------------------------------------- + // data + // + // fClassName: + // name of the XSerializable derivatives + // + // fCreateObject: + // pointer to the factory method (createObject()) + // of the XSerializable derivatives + // + // ------------------------------------------------------------------------------- + + XMLByte* fClassName; + + XSerializable* (*fCreateObject)(MemoryManager*); + +}; + +#define DECL_XPROTOTYPE(class_name) \ +static XProtoType class##class_name; \ +static XSerializable* createObject(MemoryManager* manager); + +/*** + * For non-abstract class + ***/ +#define IMPL_XPROTOTYPE_TOCREATE(class_name) \ +IMPL_XPROTOTYPE_INSTANCE(class_name) \ +XSerializable* class_name::createObject(MemoryManager* manager) \ +{return new (manager) class_name(manager);} + +/*** +* For abstract class + ***/ +#define IMPL_XPROTOTYPE_NOCREATE(class_name) \ +IMPL_XPROTOTYPE_INSTANCE(class_name) \ +XSerializable* class_name::createObject(MemoryManager*) \ +{return 0;} + + +/*** + * Helper Macro + ***/ +#define XPROTOTYPE_CLASS(class_name) ((XProtoType*)(&class_name::class##class_name)) + +#define IMPL_XPROTOTYPE_INSTANCE(class_name) \ +XProtoType class_name::class##class_name = \ +{(XMLByte*) #class_name, class_name::createObject }; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.cpp b/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.cpp new file mode 100644 index 000000000..3cbe5a09c --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.cpp @@ -0,0 +1,725 @@ +/* + * 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: XSAXMLScanner.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSAXMLScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +XSAXMLScanner::XSAXMLScanner( GrammarResolver* const grammarResolver + , XMLStringPool* const uriStringPool + , SchemaGrammar* const xsaGrammar + , MemoryManager* const manager) : + + SGXMLScanner(0, grammarResolver, manager) +{ + fSchemaGrammar = xsaGrammar; + setURIStringPool(uriStringPool); +} + +XSAXMLScanner::~XSAXMLScanner() +{ +} + +// --------------------------------------------------------------------------- +// XSAXMLScanner: SGXMLScanner virtual methods +// --------------------------------------------------------------------------- +// This method will kick off the scanning of the primary content of the +void XSAXMLScanner::scanEndTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the end of the root element. + gotData = true; + + // Check if the element stack is empty. If so, then this is an unbalanced + // element (i.e. more ends than starts, perhaps because of bad text + // causing one to be skipped.) + if (fElemStack.isEmpty()) + { + emitError(XMLErrs::MoreEndThanStartTags); + fReaderMgr.skipPastChar(chCloseAngle); + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Scan_UnbalancedStartEnd, fMemoryManager); + } + + // Pop the stack of the element we are supposed to be ending. Remember + // that we don't own this. The stack just keeps them and reuses them. + unsigned int uriId = fElemStack.getCurrentURI(); + + // Make sure that its the end of the element that we expect + const XMLCh *elemName = fElemStack.getCurrentSchemaElemName(); + const ElemStack::StackElem* topElem = fElemStack.popTop(); + if (!fReaderMgr.skippedStringLong(elemName)) + { + emitError + ( + XMLErrs::ExpectedEndOfTagX, elemName + ); + fReaderMgr.skipPastChar(chCloseAngle); + return; + } + + // See if it was the root element, to avoid multiple calls below + const bool isRoot = fElemStack.isEmpty(); + + // Make sure we are back on the same reader as where we started + if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum()) + emitError(XMLErrs::PartialTagMarkupError); + + // Skip optional whitespace + fReaderMgr.skipPastSpaces(); + + // Make sure we find the closing bracket + if (!fReaderMgr.skippedChar(chCloseAngle)) + { + emitError + ( + XMLErrs::UnterminatedEndTag, topElem->fThisElement->getFullName() + ); + } + + // If validation is enabled, then lets pass him the list of children and + // this element and let him validate it. + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent + ( + topElem->fThisElement + , topElem->fChildren + , topElem->fChildCount + , &failure + ); + + if (!res) + { + // One of the elements is not valid for the content. NOTE that + // if no children were provided but the content model requires + // them, it comes back with a zero value. But we cannot use that + // to index the child array in this case, and have to put out a + // special message. + if (!topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::EmptyNotValidForContent + , topElem->fThisElement->getFormattedContentModel() + ); + } + else if (failure >= topElem->fChildCount) + { + fValidator->emitError + ( + XMLValid::NotEnoughElemsForCM + , topElem->fThisElement->getFormattedContentModel() + ); + } + else + { + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , topElem->fChildren[failure]->getRawName() + , topElem->fThisElement->getFormattedContentModel() + ); + } + } + } + + // now we can reset the datatype buffer, since the + // application has had a chance to copy the characters somewhere else + ((SchemaValidator *)fValidator)->clearDatatypeBuffer(); + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + if (topElem->fPrefixColonPos != -1) + fPrefixBuf.set(elemName, topElem->fPrefixColonPos); + else + fPrefixBuf.reset(); + fDocHandler->endElement + ( + *topElem->fThisElement + , uriId + , isRoot + , fPrefixBuf.getRawBuffer() + ); + } + + // If this was the root, then done with content + gotData = !isRoot; + + if (gotData) { + + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + fValidator->setGrammar(fGrammar); + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } +} + +bool XSAXMLScanner::scanStartTag(bool& gotData) +{ + // Assume we will still have data until proven otherwise. It will only + // ever be false if this is the root and its empty. + gotData = true; + + // Reset element content + fContent.reset(); + + // The current position is after the open bracket, so we need to read in + // in the element name. + int prefixColonPos; + if (!fReaderMgr.getQName(fQNameBuf, &prefixColonPos)) + { + if (fQNameBuf.isEmpty()) + emitError(XMLErrs::ExpectedElementName); + else + emitError(XMLErrs::InvalidElementName, fQNameBuf.getRawBuffer()); + fReaderMgr.skipToChar(chOpenAngle); + return false; + } + + // See if its the root element + const bool isRoot = fElemStack.isEmpty(); + + // Skip any whitespace after the name + fReaderMgr.skipPastSpaces(); + + // First we have to do the rawest attribute scan. We don't do any + // normalization of them at all, since we don't know yet what type they + // might be (since we need the element decl in order to do that.) + const XMLCh* qnameRawBuf = fQNameBuf.getRawBuffer(); + bool isEmpty; + XMLSize_t attCount = rawAttrScan(qnameRawBuf, *fRawAttrList, isEmpty); + + // save the contentleafname and currentscope before addlevel, for later use + ContentLeafNameTypeVector* cv = 0; + XMLContentModel* cm = 0; + unsigned int currentScope = Grammar::TOP_LEVEL_SCOPE; + bool laxThisOne = false; + if (!isRoot) + { + // schema validator will have correct type if validating + SchemaElementDecl* tempElement = (SchemaElementDecl*) + fElemStack.topElement()->fThisElement; + SchemaElementDecl::ModelTypes modelType = tempElement->getModelType(); + ComplexTypeInfo *currType = 0; + + if (fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (currType) + modelType = (SchemaElementDecl::ModelTypes)currType->getContentType(); + else // something must have gone wrong + modelType = SchemaElementDecl::Any; + } + else { + currType = tempElement->getComplexTypeInfo(); + } + + if ((modelType == SchemaElementDecl::Mixed_Simple) + || (modelType == SchemaElementDecl::Mixed_Complex) + || (modelType == SchemaElementDecl::Children)) + { + cm = currType->getContentModel(); + cv = cm->getContentLeafNameTypeVector(); + currentScope = fElemStack.getCurrentScope(); + } + else if (modelType == SchemaElementDecl::Any) { + laxThisOne = true; + } + } + + // Now, since we might have to update the namespace map for this element, + // but we don't have the element decl yet, we just tell the element stack + // to expand up to get ready. + XMLSize_t elemDepth = fElemStack.addLevel(); + fElemStack.setValidationFlag(fValidate); + fElemStack.setPrefixColonPos(prefixColonPos); + + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + if (attCount) + scanRawAttrListforNameSpaces(attCount); + + // Resolve the qualified name to a URI and name so that we can look up + // the element decl for this element. We have now update the prefix to + // namespace map so we should get the correct element now. + unsigned int uriId = resolveQNameWithColon + ( + qnameRawBuf, fPrefixBuf, ElemStack::Mode_Element, prefixColonPos + ); + + //if schema, check if we should lax or skip the validation of this element + bool parentValidation = fValidate; + if (cv) { + QName element(fPrefixBuf.getRawBuffer(), &qnameRawBuf[prefixColonPos + 1], uriId, fMemoryManager); + // elementDepth will be > 0, as cv is only constructed if element is not + // root. + laxThisOne = laxElementValidation(&element, cv, cm, elemDepth - 1); + } + + // Look up the element now in the grammar. This will get us back a + // generic element decl object. We tell him to fault one in if he does + // not find it. + bool wasAdded = false; + const XMLCh* nameRawBuf = &qnameRawBuf[prefixColonPos + 1]; + XMLElementDecl* elemDecl = fGrammar->getElemDecl + ( + uriId, nameRawBuf, qnameRawBuf, currentScope + ); + + if (!elemDecl) + { + // URI is different, so we try to switch grammar + if (uriId != fURIStringPool->getId(fGrammar->getTargetNamespace())) { + switchGrammar(getURIText(uriId), laxThisOne); + } + + // look for a global element declaration + elemDecl = fGrammar->getElemDecl( + uriId, nameRawBuf, qnameRawBuf, Grammar::TOP_LEVEL_SCOPE + ); + + if (!elemDecl) + { + // if still not found, look in list of undeclared elements + elemDecl = fElemNonDeclPool->getByKey( + nameRawBuf, uriId, (int)Grammar::TOP_LEVEL_SCOPE); + + if (!elemDecl) + { + elemDecl = new (fMemoryManager) SchemaElementDecl + ( + fPrefixBuf.getRawBuffer(), nameRawBuf, uriId + , SchemaElementDecl::Any, Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + + elemDecl->setId (fElemNonDeclPool->put( + (void*)elemDecl->getBaseName(), + uriId, + (int)Grammar::TOP_LEVEL_SCOPE, + (SchemaElementDecl*)elemDecl)); + + wasAdded = true; + } + } + } + + // We do something different here according to whether we found the + // element or not. + bool bXsiTypeSet= (fValidator)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false; + if (wasAdded || !elemDecl->isDeclared()) + { + if (laxThisOne && !bXsiTypeSet) { + fValidate = false; + fElemStack.setValidationFlag(fValidate); + } + + // If validating then emit an error + if (fValidate) + { + // This is to tell the reuse Validator that this element was + // faulted-in, was not an element in the grammar pool originally + elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); + + if(!bXsiTypeSet) + fValidator->emitError + ( + XMLValid::ElementNotDefined, elemDecl->getFullName() + ); + } + } + + // Now we can update the element stack to set the current element + // decl. We expanded the stack above, but couldn't store the element + // decl because we didn't know it yet. + fElemStack.setElement(elemDecl, fReaderMgr.getCurrentReaderNum()); + fElemStack.setCurrentURI(uriId); + + if (isRoot) { + fRootElemName = XMLString::replicate(qnameRawBuf, fMemoryManager); + } + + // Validate the element + if (fValidate) { + fValidator->validateElement(elemDecl); + } + + // squirrel away the element's QName, so that we can do an efficient + // end-tag match + fElemStack.setCurrentSchemaElemName(fQNameBuf.getRawBuffer()); + + ComplexTypeInfo* typeinfo = (fValidate) + ? ((SchemaValidator*)fValidator)->getCurrentTypeInfo() + : ((SchemaElementDecl*) elemDecl)->getComplexTypeInfo(); + + if (typeinfo) + { + currentScope = typeinfo->getScopeDefined(); + + // switch grammar if the typeinfo has a different grammar + XMLCh* typeName = typeinfo->getTypeName(); + int comma = XMLString::indexOf(typeName, chComma); + if (comma > 0) + { + XMLBufBid bbPrefix(&fBufMgr); + XMLBuffer& prefixBuf = bbPrefix.getBuffer(); + + prefixBuf.append(typeName, comma); + switchGrammar(prefixBuf.getRawBuffer(), laxThisOne); + } + } + fElemStack.setCurrentScope(currentScope); + + // Set element next state + if (elemDepth >= fElemStateSize) { + resizeElemState(); + } + + fElemState[elemDepth] = 0; + fElemLoopState[elemDepth] = 0; + fElemStack.setCurrentGrammar(fGrammar); + + // If this is the first element and we are validating, check the root + // element. + if (!isRoot && parentValidation) { + fElemStack.addChild(elemDecl->getElementName(), true); + } + + // Now lets get the fAttrList filled in. This involves faulting in any + // defaulted and fixed attributes and normalizing the values of any that + // we got explicitly. + // + // We update the attCount value with the total number of attributes, but + // it goes in with the number of values we got during the raw scan of + // explictly provided attrs above. + attCount = buildAttList(*fRawAttrList, attCount, elemDecl, *fAttrList); + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + + // Since the element may have default values, call start tag now regardless if it is empty or not + // If we have a document handler, then tell it about this start tag + if (fDocHandler) + { + fDocHandler->startElement + ( + *elemDecl, uriId, fPrefixBuf.getRawBuffer(), *fAttrList + , attCount, false, isRoot + ); + } // may be where we output something... + + // If empty, validate content right now if we are validating and then + // pop the element stack top. Else, we have to update the current stack + // top's namespace mapping elements. + if (isEmpty) + { + // Pop the element stack back off since it'll never be used now + fElemStack.popTop(); + + // If validating, then insure that its legal to have no content + if (fValidate) + { + XMLSize_t failure; + bool res = fValidator->checkContent(elemDecl, 0, 0, &failure); + if (!res) + { + // REVISIT: in the case of xsi:type, this may + // return the wrong string... + fValidator->emitError + ( + XMLValid::ElementNotValidForContent + , elemDecl->getFullName() + , elemDecl->getFormattedContentModel() + ); + } + } + + // If we have a doc handler, tell it about the end tag + if (fDocHandler) + { + fDocHandler->endElement + ( + *elemDecl, uriId, isRoot, fPrefixBuf.getRawBuffer() + ); + } + + // If the elem stack is empty, then it was an empty root + if (isRoot) { + gotData = false; + } + else + { + // Restore the grammar + fGrammar = fElemStack.getCurrentGrammar(); + fGrammarType = fGrammar->getGrammarType(); + fValidator->setGrammar(fGrammar); + + // Restore the validation flag + fValidate = fElemStack.getValidationFlag(); + } + } + + return true; +} + +// --------------------------------------------------------------------------- +// XSAXMLScanner: XMLScanner virtual methods +// --------------------------------------------------------------------------- +// This method will reset the scanner data structures, and related plugged +// in stuff, for a new scan session. We get the input source for the primary +// XML entity, create the reader for it, and push it on the stack so that +// upon successful return from here we are ready to go. +void XSAXMLScanner::scanReset(const InputSource& src) +{ + fGrammar = fSchemaGrammar; + fGrammarType = Grammar::SchemaGrammarType; + fRootGrammar = fSchemaGrammar; + + fValidator->setGrammar(fGrammar); + + // Reset validation + fValidate = true; + + // And for all installed handlers, send reset events. This gives them + // a chance to flush any cached data. + if (fDocHandler) + fDocHandler->resetDocument(); + if (fEntityHandler) + fEntityHandler->resetEntities(); + if (fErrorReporter) + fErrorReporter->resetErrors(); + + // Clear out the id reference list + resetValidationContext(); + + // Reset the Root Element Name + if (fRootElemName) { + fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName; + } + + fRootElemName = 0; + + // Reset the element stack, and give it the latest ids for the special + // URIs it has to know about. + fElemStack.reset + ( + fEmptyNamespaceId, fUnknownNamespaceId, fXMLNamespaceId, fXMLNSNamespaceId + ); + + if (!fSchemaNamespaceId) + fSchemaNamespaceId = fURIStringPool->addOrFind(SchemaSymbols::fgURI_XSI); + + // Reset some status flags + fInException = false; + fStandalone = false; + fErrorCount = 0; + fHasNoDTD = true; + fSeeXsi = false; + fDoNamespaces = true; + fDoSchema = true; + + // Reset the validators + fSchemaValidator->reset(); + fSchemaValidator->setErrorReporter(fErrorReporter); + fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal); + fSchemaValidator->setGrammarResolver(fGrammarResolver); + + // Handle the creation of the XML reader object for this input source. + // This will provide us with transcoding and basic lexing services. + XMLReader* newReader = fReaderMgr.createReader + ( + src + , true + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , fCalculateSrcOfs + , fLowWaterMark + ); + + if (!newReader) { + if (src.getIssueFatalErrorIfNotFound()) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource, src.getSystemId(), fMemoryManager); + else + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Scan_CouldNotOpenSource_Warning, src.getSystemId(), fMemoryManager); + } + + // Push this read onto the reader manager + fReaderMgr.pushReader(newReader, 0); + + // and reset security-related things if necessary: + if(fSecurityManager != 0) + { + fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit(); + fEntityExpansionCount = 0; + } + fElemCount = 0; + if (fUIntPoolRowTotal >= 32) + { // 8 KB tied up with validating attributes... + fAttDefRegistry->removeAll(); + recreateUIntPool(); + } + else + { + // note that this will implicitly reset the values of the hashtables, + // though their buckets will still be tied up + resetUIntPool(); + } + fUndeclaredAttrRegistry->removeAll(); +} + + +void XSAXMLScanner::scanRawAttrListforNameSpaces(XMLSize_t attCount) +{ + // Make an initial pass through the list and find any xmlns attributes or + // schema attributes. + // When we find one, send it off to be used to update the element stack's + // namespace mappings. + XMLSize_t index = 0; + for (index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + + // If either the key begins with "xmlns:" or its just plain + // "xmlns", then use it to update the map. + if (!XMLString::compareNString(rawPtr, XMLUni::fgXMLNSColonString, 6) + || XMLString::equals(rawPtr, XMLUni::fgXMLNSString)) + { + const XMLCh* valuePtr = curPair->getValue(); + + updateNSMap(rawPtr, valuePtr, fRawAttrColonList[index]); + + // if the schema URI is seen in the the valuePtr, set the boolean seeXsi + if (XMLString::equals(valuePtr, SchemaSymbols::fgURI_XSI)) { + fSeeXsi = true; + } + } + } + + // walk through the list again to deal with "xsi:...." + if (fSeeXsi) + { + // Schema Xsi Type yyyy (e.g. xsi:type="yyyyy") + XMLBufBid bbXsi(&fBufMgr); + XMLBuffer& fXsiType = bbXsi.getBuffer(); + + QName attName(fMemoryManager); + + for (index = 0; index < attCount; index++) + { + // each attribute has the prefix:suffix="value" + const KVStringPair* curPair = fRawAttrList->elementAt(index); + const XMLCh* rawPtr = curPair->getKey(); + + attName.setName(rawPtr, fEmptyNamespaceId); + const XMLCh* prefPtr = attName.getPrefix(); + + // if schema URI has been seen, scan for the schema location and uri + // and resolve the schema grammar; or scan for schema type + if (resolvePrefix(prefPtr, ElemStack::Mode_Attribute) == fSchemaNamespaceId) { + + const XMLCh* valuePtr = curPair->getValue(); + const XMLCh* suffPtr = attName.getLocalPart(); + + if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_TYPE)) + { + // normalize the attribute according to schema whitespace facet + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_QNAME); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiType, true); + } + else if (XMLString::equals(suffPtr, SchemaSymbols::fgATT_NILL)) + { + // normalize the attribute according to schema whitespace facet + XMLBuffer& fXsiNil = fBufMgr.bidOnBuffer(); + DatatypeValidator* tempDV = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_BOOLEAN); + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, valuePtr, fXsiNil, true); + if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_TRUE)) + ((SchemaValidator*)fValidator)->setNillable(true); + else if(XMLString::equals(fXsiNil.getRawBuffer(), SchemaSymbols::fgATTVAL_FALSE)) + ((SchemaValidator*)fValidator)->setNillable(false); + else + emitError(XMLErrs::InvalidAttValue, fXsiNil.getRawBuffer(), valuePtr); + fBufMgr.releaseBuffer(fXsiNil); + } + } + } + + if (!fXsiType.isEmpty()) + { + int colonPos = -1; + unsigned int uriId = resolveQName + ( + fXsiType.getRawBuffer(), fPrefixBuf, ElemStack::Mode_Element, colonPos + ); + ((SchemaValidator*)fValidator)->setXsiType(fPrefixBuf.getRawBuffer(), fXsiType.getRawBuffer() + colonPos + 1, uriId); + } + } +} + +void XSAXMLScanner::switchGrammar( const XMLCh* const uriStr + , bool laxValidate) +{ + Grammar* tempGrammar = 0; + + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + tempGrammar = fSchemaGrammar; + } + else { + tempGrammar = fGrammarResolver->getGrammar(uriStr); + } + + if (tempGrammar && tempGrammar->getGrammarType() == Grammar::SchemaGrammarType) + { + fGrammar = tempGrammar; + fGrammarType = Grammar::SchemaGrammarType; + fValidator->setGrammar(fGrammar); + } + else if(!laxValidate) { + fValidator->emitError(XMLValid::GrammarNotFound, uriStr); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.hpp b/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.hpp new file mode 100644 index 000000000..bde27f1aa --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSAXMLScanner.hpp @@ -0,0 +1,98 @@ +/* + * 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: XSAXMLScanner.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSAXMLSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_XSAXMLSCANNER_HPP + +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This is a scanner class, which processes/validates contents of XML Schema +// Annotations. It's intended for internal use only. +// +class XMLPARSER_EXPORT XSAXMLScanner : public SGXMLScanner +{ +public : + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + virtual ~XSAXMLScanner(); + + // ----------------------------------------------------------------------- + // XMLScanner public virtual methods + // ----------------------------------------------------------------------- + virtual const XMLCh* getName() const; + +protected: + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + /** + * The grammar representing the XML Schema annotation (xsaGrammar) is + * passed in by the caller. The scanner will own it and is responsible + * for deleting it. + */ + XSAXMLScanner + ( + GrammarResolver* const grammarResolver + , XMLStringPool* const uriStringPool + , SchemaGrammar* const xsaGrammar + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + friend class TraverseSchema; + + // ----------------------------------------------------------------------- + // XMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual void scanReset(const InputSource& src); + + // ----------------------------------------------------------------------- + // SGXMLScanner virtual methods + // ----------------------------------------------------------------------- + virtual bool scanStartTag(bool& gotData); + virtual void scanEndTag(bool& gotData); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSAXMLScanner(); + XSAXMLScanner(const XSAXMLScanner&); + XSAXMLScanner& operator=(const XSAXMLScanner&); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void scanRawAttrListforNameSpaces(XMLSize_t attCount); + void switchGrammar(const XMLCh* const newGrammarNameSpace, bool laxValidate); +}; + +inline const XMLCh* XSAXMLScanner::getName() const +{ + return XMLUni::fgXSAXMLScanner; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XSObjectFactory.cpp b/project/jni/xerces/src/xercesc/internal/XSObjectFactory.cpp new file mode 100644 index 000000000..dff7e7a69 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSObjectFactory.cpp @@ -0,0 +1,1056 @@ +/* + * 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 $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static XMLCh regexSeparator[] = {chPipe, chNull}; + + +// --------------------------------------------------------------------------- +// XSObjectFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +XSObjectFactory::XSObjectFactory(MemoryManager* const manager) + : fMemoryManager(manager) + , fXercesToXSMap(0) + , fDeleteVector(0) +{ + fDeleteVector = new (manager) RefVectorOf(20, true, manager); + fXercesToXSMap = new (manager) RefHashTableOf ( + 109, false, manager); +} + +XSObjectFactory::~XSObjectFactory() +{ + delete fXercesToXSMap; + delete fDeleteVector; +} + +// --------------------------------------------------------------------------- +// XSObjectFactory: factory methods +// --------------------------------------------------------------------------- +XSParticle* +XSObjectFactory::createModelGroupParticle(const ContentSpecNode* const rootNode, + XSModel* const xsModel) +{ + if (rootNode == 0) + return 0; + + ContentSpecNode::NodeTypes nodeType = rootNode->getType(); + if (nodeType == ContentSpecNode::All + || nodeType == ContentSpecNode::ModelGroupChoice + || nodeType == ContentSpecNode::ModelGroupSequence) + { + XSParticleList* particleList = new (fMemoryManager) RefVectorOf (4, true, fMemoryManager); + XSAnnotation* annot = getAnnotationFromModel(xsModel, rootNode); + XSModelGroup* modelGroup = 0; + + if (nodeType == ContentSpecNode::All) + { + modelGroup = new (fMemoryManager) XSModelGroup(XSModelGroup::COMPOSITOR_ALL, particleList, annot, xsModel, fMemoryManager); + buildAllParticles(rootNode, particleList, xsModel); + } + else + { + if (nodeType == ContentSpecNode::ModelGroupChoice) + modelGroup = new (fMemoryManager) XSModelGroup(XSModelGroup::COMPOSITOR_CHOICE, particleList, annot, xsModel, fMemoryManager); + else + modelGroup = new (fMemoryManager) XSModelGroup(XSModelGroup::COMPOSITOR_SEQUENCE, particleList, annot, xsModel, fMemoryManager); + + buildChoiceSequenceParticles(rootNode->getFirst(), particleList, xsModel); + buildChoiceSequenceParticles(rootNode->getSecond(), particleList, xsModel); + } + + int m = rootNode->getMaxOccurs(); + XSParticle* groupParticle = new (fMemoryManager) XSParticle + ( + XSParticle::TERM_MODELGROUP + , xsModel + , modelGroup + , (XMLSize_t)rootNode->getMinOccurs() + , (XMLSize_t)m + , m == -1 + , fMemoryManager + ); + + return groupParticle; + } + else + return 0; +} + +void XSObjectFactory::buildAllParticles(const ContentSpecNode* const rootNode, + XSParticleList* const particleList, + XSModel* const xsModel) +{ + // Get the type of spec node our current node is + const ContentSpecNode::NodeTypes nodeType = rootNode->getType(); + + if (nodeType == ContentSpecNode::All) + { + const ContentSpecNode* rightNode = rootNode->getSecond(); + + buildAllParticles(rootNode->getFirst(), particleList, xsModel); + if (rightNode) + buildAllParticles(rightNode, particleList, xsModel); + } + else if (nodeType == ContentSpecNode::Leaf) + { + XSParticle* elemParticle = createElementParticle(rootNode, xsModel); + if (elemParticle) + particleList->addElement(elemParticle); + } +} + +void XSObjectFactory::buildChoiceSequenceParticles(const ContentSpecNode* const rootNode, + XSParticleList* const particleList, + XSModel* const xsModel) +{ + if (rootNode) + { + const ContentSpecNode::NodeTypes nodeType = rootNode->getType(); + + if (nodeType == ContentSpecNode::Sequence) + { + buildChoiceSequenceParticles(rootNode->getFirst(), particleList, xsModel); + buildChoiceSequenceParticles(rootNode->getSecond(), particleList, xsModel); + } + else if (nodeType == ContentSpecNode::Choice) + { + buildChoiceSequenceParticles(rootNode->getFirst(), particleList, xsModel); + buildChoiceSequenceParticles(rootNode->getSecond(), particleList, xsModel); + } + else if ((nodeType & 0x0f) == ContentSpecNode::Any + || (nodeType & 0x0f) == ContentSpecNode::Any_Other + || (nodeType & 0x0f) == ContentSpecNode::Any_NS + || nodeType == ContentSpecNode::Any_NS_Choice) + { + XSParticle* wildcardParticle = createWildcardParticle(rootNode, xsModel); + if (wildcardParticle) + particleList->addElement(wildcardParticle); + } + else if (nodeType == ContentSpecNode::Leaf) + { + XSParticle* elemParticle = createElementParticle(rootNode, xsModel); + if (elemParticle) + particleList->addElement(elemParticle); + } + // must be a model group + else + { + XSParticle* xsParticle = createModelGroupParticle(rootNode, xsModel); + if (xsParticle) + particleList->addElement(xsParticle); + } + } +} + +XSParticle* +XSObjectFactory::createElementParticle(const ContentSpecNode* const rootNode, + XSModel* const xsModel) +{ + if (rootNode->getElementDecl()) + { + XSElementDeclaration* xsElemDecl = addOrFind( + (SchemaElementDecl*) rootNode->getElementDecl(), xsModel); + + if (xsElemDecl) + { + int m = rootNode->getMaxOccurs(); + XSParticle* particle = new (fMemoryManager) XSParticle + ( + XSParticle::TERM_ELEMENT + , xsModel + , xsElemDecl + , (XMLSize_t)rootNode->getMinOccurs() + , (XMLSize_t)m + , m == -1 + , fMemoryManager + ); + + return particle; + } + } + + return 0; +} + +XSParticle* +XSObjectFactory::createWildcardParticle(const ContentSpecNode* const rootNode, + XSModel* const xsModel) +{ + XSWildcard* xsWildcard = createXSWildcard(rootNode, xsModel); + if (xsWildcard) + { + int m = rootNode->getMaxOccurs(); + XSParticle* particle = new (fMemoryManager) XSParticle + ( + XSParticle::TERM_WILDCARD + , xsModel + , xsWildcard + , (XMLSize_t)rootNode->getMinOccurs() + , (XMLSize_t)m + , m == -1 + , fMemoryManager + ); + + return particle; + } + + return 0; +} + +XSAttributeDeclaration* +XSObjectFactory::addOrFind(SchemaAttDef* const attDef, + XSModel* const xsModel, + XSComplexTypeDefinition* const enclosingTypeDef) +{ + XSAttributeDeclaration* xsObj = (XSAttributeDeclaration*) xsModel->getXSObject(attDef); + if (xsObj) + { + if (xsObj->getScope() == XSConstants::SCOPE_LOCAL + && xsObj->getEnclosingCTDefinition() == 0 + && enclosingTypeDef) + xsObj->setEnclosingCTDefinition(enclosingTypeDef); + } + else + { + XSSimpleTypeDefinition* xsType = 0; + if (attDef->getDatatypeValidator()) + xsType = addOrFind(attDef->getDatatypeValidator(), xsModel); + + XSConstants::SCOPE scope = XSConstants::SCOPE_ABSENT; + XSComplexTypeDefinition* enclosingCTDefinition = 0; + + if (attDef->getPSVIScope() == PSVIDefs::SCP_GLOBAL) + scope = XSConstants::SCOPE_GLOBAL; + else if (attDef->getPSVIScope() == PSVIDefs::SCP_LOCAL) + { + scope = XSConstants::SCOPE_LOCAL; + enclosingCTDefinition = enclosingTypeDef; + } + + xsObj = new (fMemoryManager) XSAttributeDeclaration + ( + attDef + , xsType + , getAnnotationFromModel(xsModel, attDef) + , xsModel + , scope + , enclosingCTDefinition + , fMemoryManager + ); + putObjectInMap(attDef, xsObj); + } + + return xsObj; +} + +XSSimpleTypeDefinition* +XSObjectFactory::addOrFind(DatatypeValidator* const validator, + XSModel* const xsModel, + bool isAnySimpleType) +{ + XSSimpleTypeDefinition* xsObj = (XSSimpleTypeDefinition*) xsModel->getXSObject(validator); + if (!xsObj) + { + XSTypeDefinition* baseType = 0; + XSSimpleTypeDefinitionList* memberTypes = 0; + XSSimpleTypeDefinition* primitiveOrItemType = 0; + XSSimpleTypeDefinition::VARIETY typeVariety = XSSimpleTypeDefinition::VARIETY_ATOMIC; + bool primitiveTypeSelf = false; + + //REVISIT: the getFixed method is protected so added friend XSObjectFactory + // to DatatypeValidator class... + DatatypeValidator::ValidatorType dvType = validator->getType(); + DatatypeValidator* baseDV = validator->getBaseValidator(); + + if (dvType == DatatypeValidator::Union) + { + typeVariety = XSSimpleTypeDefinition::VARIETY_UNION; + RefVectorOf* membersDV = ((UnionDatatypeValidator*)validator)->getMemberTypeValidators(); + XMLSize_t size = membersDV->size(); + if (size) + { + memberTypes = new (fMemoryManager) RefVectorOf(size, false, fMemoryManager); + for (XMLSize_t i=0; iaddElement(addOrFind(membersDV->elementAt(i), xsModel)); + } + + if (baseDV) + { + baseType = addOrFind(baseDV, xsModel); + } + else + { + baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition + ( + SchemaSymbols::fgDT_ANYSIMPLETYPE + , SchemaSymbols::fgURI_SCHEMAFORSCHEMA + ); + } + } + else if (dvType == DatatypeValidator::List) + { + typeVariety = XSSimpleTypeDefinition::VARIETY_LIST; + if (baseDV->getType() == DatatypeValidator::List) + { + baseType = addOrFind(baseDV, xsModel); + primitiveOrItemType = ((XSSimpleTypeDefinition*) baseType)->getItemType(); + } + else + { + baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition + ( + SchemaSymbols::fgDT_ANYSIMPLETYPE + , SchemaSymbols::fgURI_SCHEMAFORSCHEMA + ); + primitiveOrItemType = addOrFind(baseDV, xsModel); + } + } + else if (!isAnySimpleType) + { + if (baseDV) + { + baseType = addOrFind(baseDV, xsModel); + primitiveOrItemType = ((XSSimpleTypeDefinition*) baseType)->getPrimitiveType(); + } + else // built-in + { + baseType = (XSSimpleTypeDefinition*) xsModel->getTypeDefinition + ( + SchemaSymbols::fgDT_ANYSIMPLETYPE + , SchemaSymbols::fgURI_SCHEMAFORSCHEMA + ); + primitiveTypeSelf = true; + } + } + else + { + baseType = xsModel->getTypeDefinition(SchemaSymbols::fgATTVAL_ANYTYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + } + + xsObj = new (fMemoryManager) XSSimpleTypeDefinition + ( + validator + , typeVariety + , baseType + , primitiveOrItemType + , memberTypes + , getAnnotationFromModel(xsModel, validator) + , xsModel + , fMemoryManager + ); + putObjectInMap(validator, xsObj); + + if (primitiveTypeSelf) + xsObj->setPrimitiveType(xsObj); + + // process facets + processFacets(validator, xsModel, xsObj); + } + + return xsObj; +} + +XSElementDeclaration* +XSObjectFactory::addOrFind(SchemaElementDecl* const elemDecl, + XSModel* const xsModel, + XSComplexTypeDefinition* const enclosingTypeDef) +{ + XSElementDeclaration* xsObj = (XSElementDeclaration*) xsModel->getXSObject(elemDecl); + if (xsObj) + { + if (!xsObj->getEnclosingCTDefinition() && enclosingTypeDef) + xsObj->setEnclosingCTDefinition(enclosingTypeDef); + } + else + { + XSElementDeclaration* xsSubElem = 0; + XSTypeDefinition* xsType = 0; + XSNamedMap* icMap = 0; + + if (elemDecl->getSubstitutionGroupElem()) + xsSubElem = addOrFind(elemDecl->getSubstitutionGroupElem(), xsModel); + + // defer checking for complexTypeInfo until later as it could + // eventually need this elemement + // but don't check simple type unless no complexTypeInfo present + if (!elemDecl->getComplexTypeInfo() && elemDecl->getDatatypeValidator()) + xsType = addOrFind(elemDecl->getDatatypeValidator(), xsModel); + + XMLSize_t count = elemDecl->getIdentityConstraintCount(); + if (count) + { + //REVISIT: size of hash table.... + icMap = new (fMemoryManager) XSNamedMap + ( + count + , 29 + , xsModel->getURIStringPool() + , false + , fMemoryManager + ); + + for (XMLSize_t i = 0; i < count; i++) + { + XSIDCDefinition* icDef = addOrFind + ( + elemDecl->getIdentityConstraintAt(i) + , xsModel + ); + if (icDef) + { + icMap->addElement + ( + icDef + , icDef->getName() + , icDef->getNamespace() + ); + } + } + } + + XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT; + if (elemDecl->getPSVIScope() == PSVIDefs::SCP_LOCAL) + elemScope = XSConstants::SCOPE_LOCAL; + else if (elemDecl->getPSVIScope() == PSVIDefs::SCP_GLOBAL) + elemScope = XSConstants::SCOPE_GLOBAL; + + xsObj = new (fMemoryManager) XSElementDeclaration + ( + elemDecl + , xsType + , xsSubElem + , getAnnotationFromModel(xsModel, elemDecl) + , icMap + , xsModel + , elemScope + , enclosingTypeDef + , fMemoryManager + ); + putObjectInMap(elemDecl, xsObj); + + if (elemDecl->getComplexTypeInfo()) + { + xsType = addOrFind(elemDecl->getComplexTypeInfo(), xsModel); + xsObj->setTypeDefinition(xsType); + } + else if (!xsType) + { + xsType = xsModel->getTypeDefinition + ( + SchemaSymbols::fgATTVAL_ANYTYPE + , SchemaSymbols::fgURI_SCHEMAFORSCHEMA + ); + xsObj->setTypeDefinition(xsType); + } + } + + return xsObj; +} + +XSComplexTypeDefinition* +XSObjectFactory::addOrFind(ComplexTypeInfo* const typeInfo, + XSModel* const xsModel) +{ + XSComplexTypeDefinition* xsObj = (XSComplexTypeDefinition*) xsModel->getXSObject(typeInfo); + if (!xsObj) + { + XSWildcard* xsWildcard = 0; + XSSimpleTypeDefinition* xsSimpleType = 0; + XSAttributeUseList* xsAttList = 0; + XSTypeDefinition* xsBaseType = 0; + XSParticle* xsParticle = 0; + + if (typeInfo->getAttWildCard()) + xsWildcard = createXSWildcard(typeInfo->getAttWildCard(), xsModel); + + if ((typeInfo->getContentType() == SchemaElementDecl::Simple) && + (typeInfo->getDatatypeValidator())) + xsSimpleType = addOrFind(typeInfo->getDatatypeValidator(), xsModel); + + XMLSize_t attCount=0; + if (typeInfo->hasAttDefs()) + { + SchemaAttDefList& attDefList = (SchemaAttDefList&) typeInfo->getAttDefList(); + attCount = attDefList.getAttDefCount(); + xsAttList = new (fMemoryManager) RefVectorOf(attCount, false, fMemoryManager); + // create list now put fill it in after we put complextype into map + // otherwise we may encounter an infinite loop: complextype needs to + // addorfind attdef, which does an addorfind on the enclosingCTdefintion. + } + + // compute fBase + bool isAnyType = false; + if (typeInfo->getBaseComplexTypeInfo() == typeInfo) // case of anyType + isAnyType = true; + else if (typeInfo->getBaseComplexTypeInfo()) + xsBaseType = addOrFind(typeInfo->getBaseComplexTypeInfo(), xsModel); + else if (typeInfo->getBaseDatatypeValidator()) + xsBaseType = addOrFind(typeInfo->getBaseDatatypeValidator(), xsModel); + else // base is anyType + xsBaseType = xsModel->getTypeDefinition(SchemaSymbols::fgATTVAL_ANYTYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + + // compute particle + ContentSpecNode* contentSpec = typeInfo->getContentSpec(); + if (contentSpec) + xsParticle = createModelGroupParticle(contentSpec, xsModel); + + xsObj = new (fMemoryManager) XSComplexTypeDefinition + ( + typeInfo + , xsWildcard + , xsSimpleType + , xsAttList + , xsBaseType + , xsParticle + , getAnnotationFromModel(xsModel, typeInfo) + , xsModel + , fMemoryManager + ); + putObjectInMap(typeInfo, xsObj); + + if (isAnyType) + xsObj->setBaseType(xsObj); + + if (typeInfo->hasAttDefs()) + { + // now create the xsattributedeclarations... + SchemaAttDefList& attDefList = (SchemaAttDefList&) typeInfo->getAttDefList(); + for(unsigned int i=0; iput(&attDef, xsAttDecl); + } + else + xsAttDecl = addOrFind(&attDef, xsModel, xsObj); + + if (attDef.getDefaultType() != XMLAttDef::Prohibited) { + + XSAttributeUse* attUse = createXSAttributeUse(xsAttDecl, xsModel); + xsAttList->addElement(attUse); + processAttUse(&attDef, attUse); + } + } + } + + // process local elements + XMLSize_t elemCount = typeInfo->elementCount(); + for (XMLSize_t j=0; jelementAt(j); + + if (elemDecl->getEnclosingScope() == typeInfo->getScopeDefined() + && elemDecl->getPSVIScope() == PSVIDefs::SCP_LOCAL) + addOrFind(elemDecl, xsModel, xsObj); + } + } + + return xsObj; +} + +XSIDCDefinition* XSObjectFactory::addOrFind(IdentityConstraint* const ic, + XSModel* const xsModel) +{ + XSIDCDefinition* xsObj = (XSIDCDefinition*) xsModel->getXSObject(ic); + if (!xsObj) + { + XSIDCDefinition* keyIC = 0; + StringList* stringList = 0; + XMLSize_t fieldCount = ic->getFieldCount(); + + if (fieldCount) + { + stringList = new (fMemoryManager) RefArrayVectorOf( + fieldCount, true, fMemoryManager); + + for(XMLSize_t i=0; igetFieldAt(i)->getXPath()->getExpression() + , fMemoryManager + ); + stringList->addElement(expr); + } + } + + if (ic->getType() == IdentityConstraint::ICType_KEYREF) + keyIC = addOrFind(((IC_KeyRef*) ic)->getKey(), xsModel); + + xsObj= new (fMemoryManager) XSIDCDefinition + ( + ic + , keyIC + , getAnnotationFromModel(xsModel, ic) + , stringList + , xsModel + , fMemoryManager + ); + putObjectInMap(ic, xsObj); + } + + return xsObj; +} + +XSNotationDeclaration* XSObjectFactory::addOrFind(XMLNotationDecl* const notDecl, + XSModel* const xsModel) +{ + XSNotationDeclaration* xsObj = (XSNotationDeclaration*) xsModel->getXSObject(notDecl); + if (!xsObj) + { + xsObj = new (fMemoryManager) XSNotationDeclaration + ( + notDecl + , getAnnotationFromModel(xsModel, notDecl) + , xsModel + , fMemoryManager + ); + putObjectInMap(notDecl, xsObj); + } + + return xsObj; +} + +XSAttributeUse* +XSObjectFactory::createXSAttributeUse(XSAttributeDeclaration* const xsAttDecl, + XSModel* const xsModel) +{ + XSAttributeUse* attrUse = new (fMemoryManager) XSAttributeUse(xsAttDecl, xsModel, fMemoryManager); + fDeleteVector->addElement(attrUse); + + return attrUse; +} + +XSWildcard* +XSObjectFactory::createXSWildcard(SchemaAttDef* const attDef, + XSModel* const xsModel) +{ + XSAnnotation* annot = (attDef->getBaseAttDecl()) + ? getAnnotationFromModel(xsModel, attDef->getBaseAttDecl()) + : getAnnotationFromModel(xsModel, attDef); + + XSWildcard* xsWildcard = new (fMemoryManager) XSWildcard + ( + attDef + , annot + , xsModel + , fMemoryManager + ); + fDeleteVector->addElement(xsWildcard); + + return xsWildcard; +} + +XSWildcard* +XSObjectFactory::createXSWildcard(const ContentSpecNode* const rootNode, + XSModel* const xsModel) +{ + XSWildcard* xsWildcard = new (fMemoryManager) XSWildcard + ( + rootNode + , getAnnotationFromModel(xsModel, rootNode) + , xsModel + , fMemoryManager + ); + fDeleteVector->addElement(xsWildcard); + + return xsWildcard; +} + +XSModelGroupDefinition* +XSObjectFactory::createXSModelGroupDefinition(XercesGroupInfo* const groupInfo, + XSModel* const xsModel) +{ + XSParticle* particle = createModelGroupParticle( + groupInfo->getContentSpec(), xsModel); + + XSModelGroupDefinition* xsObj = new (fMemoryManager) XSModelGroupDefinition + ( + groupInfo + , particle + , getAnnotationFromModel(xsModel, groupInfo) + , xsModel + , fMemoryManager + ); + fDeleteVector->addElement(xsObj); + + // process local elements + XMLSize_t elemCount = groupInfo->elementCount(); + for (XMLSize_t j=0; jelementAt(j); + + if (elemDecl->getEnclosingScope() == groupInfo->getScope()) + addOrFind(elemDecl, xsModel); + } + + return xsObj; +} + + +XSAttributeGroupDefinition* +XSObjectFactory::createXSAttGroupDefinition(XercesAttGroupInfo* const attGroupInfo, + XSModel* const xsModel) +{ + XSAttributeUseList* xsAttList = 0; + XSWildcard* xsWildcard = 0; + XMLSize_t attCount = attGroupInfo->attributeCount(); + + if (attCount) + { + xsAttList = new (fMemoryManager) RefVectorOf(attCount, false, fMemoryManager); + for (XMLSize_t i=0; i < attCount; i++) + { + SchemaAttDef* attDef = attGroupInfo->attributeAt(i); + XSAttributeDeclaration* xsAttDecl = 0; + + if (attDef->getBaseAttDecl()) + xsAttDecl = addOrFind(attDef->getBaseAttDecl(), xsModel); + else + xsAttDecl = addOrFind(attDef, xsModel); + + if (xsAttDecl && (attDef->getDefaultType() != XMLAttDef::Prohibited)) // just for sanity + { + XSAttributeUse* attUse = createXSAttributeUse(xsAttDecl, xsModel); + xsAttList->addElement(attUse); + processAttUse(attDef, attUse); + } + } + } + + if (attGroupInfo->getCompleteWildCard()) + xsWildcard = createXSWildcard(attGroupInfo->getCompleteWildCard(), xsModel); + + XSAttributeGroupDefinition* xsObj = new (fMemoryManager) XSAttributeGroupDefinition + ( + attGroupInfo + , xsAttList + , xsWildcard + , getAnnotationFromModel(xsModel, attGroupInfo) + , xsModel + , fMemoryManager + ); + fDeleteVector->addElement(xsObj); + + return xsObj; +} + +XSAnnotation* XSObjectFactory::getAnnotationFromModel(XSModel* const xsModel, + const void* const key) +{ + XSNamespaceItemList* namespaceItemList = xsModel->getNamespaceItems(); + + XSAnnotation* annot = 0; + for (unsigned int i=0; isize(); i++) + { + XSNamespaceItem* nsItem = namespaceItemList->elementAt(i); + if (nsItem->fGrammar) + { + annot = nsItem->fGrammar->getAnnotation(key); + if (annot) + return annot; + } + } + + if (xsModel->fParent) + return getAnnotationFromModel(xsModel->fParent, key); + return 0; +} + + +void XSObjectFactory::putObjectInMap(void* key, XSObject* const object) +{ + fXercesToXSMap->put(key, object); + fDeleteVector->addElement(object); +} + +void XSObjectFactory::processFacets(DatatypeValidator* const dv, + XSModel* const xsModel, + XSSimpleTypeDefinition* const xsST) +{ + // NOTE: XSMultiValueFacetList is not owned by XSModel! + // NOTE: XSFacetList is not owned by XSModel! + bool isFixed = false; + int dvFacetsDefined = dv->getFacetsDefined(); + int dvFixedFacets = dv->getFixed(); + int definedFacets = 0; + int fixedFacets = 0; + XSMultiValueFacetList* xsMultiFacetList = 0; + StringList* patternList = 0; + XSFacetList* xsFacetList = new (fMemoryManager) RefVectorOf(4, false, fMemoryManager); + + if (isMultiValueFacetDefined(dv)) + xsMultiFacetList = new (fMemoryManager) RefVectorOf(2, false, fMemoryManager); + + if (dvFacetsDefined & DatatypeValidator::FACET_ENUMERATION) + { + RefArrayVectorOf* enumList = (RefArrayVectorOf*) dv->getEnumString(); + + if (dvFixedFacets & DatatypeValidator::FACET_ENUMERATION) + { + isFixed = true; + fixedFacets |= XSSimpleTypeDefinition::FACET_ENUMERATION; + } + + XSMultiValueFacet* mvFacet = new (fMemoryManager) XSMultiValueFacet( + XSSimpleTypeDefinition::FACET_ENUMERATION , enumList, isFixed + , getAnnotationFromModel(xsModel, enumList), xsModel, fMemoryManager + ); + + fDeleteVector->addElement(mvFacet); + xsMultiFacetList->addElement(mvFacet); + definedFacets |= XSSimpleTypeDefinition::FACET_ENUMERATION; + } + + if (dv->getFacets()) + { + RefHashTableOfEnumerator e(dv->getFacets(), false, fMemoryManager); + while (e.hasMoreElements()) + { + KVStringPair& pair = e.nextElement(); + XMLCh* key = pair.getKey(); + XSSimpleTypeDefinition::FACET facetType; + XSAnnotation* annot = getAnnotationFromModel(xsModel, &pair); + + if (XMLString::equals(key, SchemaSymbols::fgELT_MAXINCLUSIVE)) + { + facetType = XSSimpleTypeDefinition::FACET_MAXINCLUSIVE; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MAXINCLUSIVE) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXEXCLUSIVE)) + { + facetType = XSSimpleTypeDefinition::FACET_MAXEXCLUSIVE; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MAXEXCLUSIVE) !=0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MININCLUSIVE)) + { + facetType = XSSimpleTypeDefinition::FACET_MININCLUSIVE; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MININCLUSIVE) !=0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MINEXCLUSIVE)) + { + facetType = XSSimpleTypeDefinition::FACET_MINEXCLUSIVE; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MINEXCLUSIVE) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_LENGTH)) + { + facetType = XSSimpleTypeDefinition::FACET_LENGTH; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_LENGTH) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MINLENGTH)) + { + facetType = XSSimpleTypeDefinition::FACET_MINLENGTH; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MINLENGTH) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXLENGTH)) + { + facetType = XSSimpleTypeDefinition::FACET_MAXLENGTH; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_MAXLENGTH) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_TOTALDIGITS)) + { + facetType = XSSimpleTypeDefinition::FACET_TOTALDIGITS; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_TOTALDIGITS) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_FRACTIONDIGITS)) + { + facetType = XSSimpleTypeDefinition::FACET_FRACTIONDIGITS; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_FRACTIONDIGITS) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_WHITESPACE)) + { + facetType = XSSimpleTypeDefinition::FACET_WHITESPACE; + isFixed = ((dvFixedFacets & DatatypeValidator::FACET_WHITESPACE) != 0); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN)) + { + XMLStringTokenizer tokenizer(dv->getPattern(), regexSeparator, fMemoryManager); + patternList = new (fMemoryManager) RefArrayVectorOf( + tokenizer.countTokens(), true, fMemoryManager + ); + + while (tokenizer.hasMoreTokens()) + patternList->addElement(XMLString::replicate(tokenizer.nextToken(), fMemoryManager)); + + if (dvFixedFacets & DatatypeValidator::FACET_PATTERN) + { + isFixed = true; + fixedFacets |= XSSimpleTypeDefinition::FACET_PATTERN; + } + + XSMultiValueFacet* mvFacet = new (fMemoryManager) XSMultiValueFacet( + XSSimpleTypeDefinition::FACET_PATTERN, patternList + , isFixed, annot, xsModel, fMemoryManager + ); + fDeleteVector->addElement(mvFacet); + xsMultiFacetList->addElement(mvFacet); + definedFacets |= XSSimpleTypeDefinition::FACET_PATTERN; + continue; + } + else + { + // REVISIT: hmm... what about XSSimpleTypeDefinition::FACET_NONE + // don't think I need to create an empty Facet? + continue; + } + + XSFacet* xsFacet = new (fMemoryManager) XSFacet( + facetType, pair.getValue(), isFixed, annot, xsModel, fMemoryManager); + + fDeleteVector->addElement(xsFacet); + xsFacetList->addElement(xsFacet); + definedFacets |= facetType; + if (isFixed) + fixedFacets |= facetType; + } + } + + // add whistespace facet if missing + if ((definedFacets & XSSimpleTypeDefinition::FACET_WHITESPACE) == 0) + { + XSFacet* xsFacet = new (fMemoryManager) XSFacet( + XSSimpleTypeDefinition::FACET_WHITESPACE + , dv->getWSstring(dv->getWSFacet()) + , false, 0, xsModel, fMemoryManager); + + fDeleteVector->addElement(xsFacet); + xsFacetList->addElement(xsFacet); + definedFacets |= XSSimpleTypeDefinition::FACET_WHITESPACE; + } + + // inherit facets from base + + if (xsST->getBaseType() && xsST->getBaseType()->getTypeCategory() == XSTypeDefinition::SIMPLE_TYPE) + { + XSSimpleTypeDefinition* baseST = (XSSimpleTypeDefinition*) xsST->getBaseType(); + XSFacetList* baseFacets = baseST->getFacets(); + + for (unsigned int i=0; isize(); i++) + { + XSFacet* bFacet = baseFacets->elementAt(i); + if ((definedFacets & bFacet->getFacetKind()) == 0) + { + definedFacets |= bFacet->getFacetKind(); + xsFacetList->addElement(bFacet); + if (bFacet->isFixed()) + fixedFacets |= bFacet->getFacetKind(); + } + } + + if (baseST->getMultiValueFacets()) + { + XSMultiValueFacetList* baseMVFacets = baseST->getMultiValueFacets(); + for (unsigned int j=0; jsize(); j++) + { + XSMultiValueFacet* bFacet = baseMVFacets->elementAt(j); + if ((definedFacets & bFacet->getFacetKind()) == 0) + { + definedFacets |= bFacet->getFacetKind(); + xsMultiFacetList->addElement(bFacet); + if (bFacet->isFixed()) + fixedFacets |= bFacet->getFacetKind(); + } + } + } + } + + xsST->setFacetInfo(definedFacets, fixedFacets, xsFacetList, xsMultiFacetList, patternList); +} + +void XSObjectFactory::processAttUse(SchemaAttDef* const attDef, + XSAttributeUse* const xsAttUse) +{ + bool isRequired = false; + XSConstants::VALUE_CONSTRAINT constraintType = XSConstants::VALUE_CONSTRAINT_NONE; + + if (attDef->getDefaultType() == XMLAttDef::Default) + { + constraintType = XSConstants::VALUE_CONSTRAINT_DEFAULT; + } + else if ((attDef->getDefaultType() == XMLAttDef::Fixed) || + (attDef->getDefaultType() == XMLAttDef::Required_And_Fixed)) + { + constraintType = XSConstants::VALUE_CONSTRAINT_FIXED; + } + + if (attDef->getDefaultType() == XMLAttDef::Required || + attDef->getDefaultType() == XMLAttDef::Required_And_Fixed) + isRequired = true; + + xsAttUse->set(isRequired, constraintType, attDef->getValue()); +} + +bool XSObjectFactory::isMultiValueFacetDefined(DatatypeValidator* const dv) +{ + DatatypeValidator* tmpDV = dv; + + while (tmpDV) + { + if ((tmpDV->getFacetsDefined() & DatatypeValidator::FACET_PATTERN) + || (tmpDV->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION)) + return true; + + tmpDV = tmpDV->getBaseValidator(); + } + + return false; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XSObjectFactory.hpp b/project/jni/xerces/src/xercesc/internal/XSObjectFactory.hpp new file mode 100644 index 000000000..3621e0bc5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSObjectFactory.hpp @@ -0,0 +1,237 @@ +/* + * 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: XSObjectFactory.hpp 678409 2008-07-21 13:08:10Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSOBJECTFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_XSOBJECTFACTORY_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XSObject; +class XSAttributeUse; +class XSAttributeDeclaration; +class XSModel; +class XSElementDeclaration; +class XSSimpleTypeDefinition; +class XSComplexTypeDefinition; +class XSModelGroupDefinition; +class XSAttributeGroupDefinition; +class XSWildcard; +class XSParticle; +class XSAnnotation; +class XSNamespaceItem; +class XSNotationDeclaration; +class SchemaAttDef; +class SchemaElementDecl; +class DatatypeValidator; +class ContentSpecNode; +class ComplexTypeInfo; +class XercesGroupInfo; +class XercesAttGroupInfo; +class XSIDCDefinition; +class IdentityConstraint; +class XMLNotationDecl; + +/** + * Factory class to create various XSObject(s) + * Used by XSModel + */ +class XMLPARSER_EXPORT XSObjectFactory : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XSObjectFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~XSObjectFactory(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and destructor + // ----------------------------------------------------------------------- + XSObjectFactory(const XSObjectFactory&); + XSObjectFactory& operator=(const XSObjectFactory&); + + // ----------------------------------------------------------------------- + // factory methods + // ----------------------------------------------------------------------- + XSParticle* createModelGroupParticle + ( + const ContentSpecNode* const node + , XSModel* const xsModel + ); + + XSAttributeDeclaration* addOrFind + ( + SchemaAttDef* const attDef + , XSModel* const xsModel + , XSComplexTypeDefinition* const enclosingTypeDef = 0 + ); + + XSSimpleTypeDefinition* addOrFind + ( + DatatypeValidator* const validator + , XSModel* const xsModel + , bool isAnySimpleType = false + ); + + XSElementDeclaration* addOrFind + ( + SchemaElementDecl* const elemDecl + , XSModel* const xsModel + , XSComplexTypeDefinition* const enclosingTypeDef = 0 + ); + + XSComplexTypeDefinition* addOrFind + ( + ComplexTypeInfo* const typeInfo + , XSModel* const xsModel + ); + + XSIDCDefinition* addOrFind + ( + IdentityConstraint* const ic + , XSModel* const xsModel + ); + + XSNotationDeclaration* addOrFind + ( + XMLNotationDecl* const notDecl + , XSModel* const xsModel + ); + + XSAttributeUse* createXSAttributeUse + ( + XSAttributeDeclaration* const xsAttDecl + , XSModel* const xsModel + ); + XSWildcard* createXSWildcard + ( + SchemaAttDef* const attDef + , XSModel* const xsModel + ); + + XSWildcard* createXSWildcard + ( + const ContentSpecNode* const rootNode + , XSModel* const xsModel + ); + + XSModelGroupDefinition* createXSModelGroupDefinition + ( + XercesGroupInfo* const groupInfo + , XSModel* const xsModel + ); + + XSAttributeGroupDefinition* createXSAttGroupDefinition + ( + XercesAttGroupInfo* const attGroupInfo + , XSModel* const xsModel + ); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + // creates a particle corresponding to an element + XSParticle* createElementParticle + ( + const ContentSpecNode* const rootNode + , XSModel* const xsModel + ); + + // creates a particle corresponding to a wildcard + XSParticle* createWildcardParticle + ( + const ContentSpecNode* const rootNode + , XSModel* const xsModel + ); + + XSAnnotation* getAnnotationFromModel + ( + XSModel* const xsModel + , const void* const key + ); + + void buildAllParticles + ( + const ContentSpecNode* const rootNode + , XSParticleList* const particleList + , XSModel* const xsModel + ); + + void buildChoiceSequenceParticles + ( + const ContentSpecNode* const rootNode + , XSParticleList* const particleList + , XSModel* const xsModel + ); + + void putObjectInMap + ( + void* key + , XSObject* const object + ); + + XSObject* getObjectFromMap + ( + void* key + ); + + void processFacets + ( + DatatypeValidator* const dv + , XSModel* const xsModel + , XSSimpleTypeDefinition* const xsST + ); + + void processAttUse + ( + SchemaAttDef* const attDef + , XSAttributeUse* const xsAttUse + ); + + bool isMultiValueFacetDefined(DatatypeValidator* const dv); + + // make XSModel our friend + friend class XSModel; + + // ----------------------------------------------------------------------- + // Private Data Members + // + // fMemoryManager + // The memory manager used to create various XSObject(s). + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + RefHashTableOf* fXercesToXSMap; + RefVectorOf* fDeleteVector; +}; + +inline XSObject* XSObjectFactory::getObjectFromMap(void* key) +{ + return fXercesToXSMap->get(key); +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XSerializable.hpp b/project/jni/xerces/src/xercesc/internal/XSerializable.hpp new file mode 100644 index 000000000..5e3a33c02 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSerializable.hpp @@ -0,0 +1,117 @@ +/* + * 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: XSerializable.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSERIALIZABLE_HPP) +#define XERCESC_INCLUDE_GUARD_XSERIALIZABLE_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XSerializable +{ +public : + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + virtual ~XSerializable() {} ; + + // ----------------------------------------------------------------------- + // Serialization Interface + // ----------------------------------------------------------------------- + virtual bool isSerializable() const = 0; + + virtual void serialize(XSerializeEngine& ) = 0; + + virtual XProtoType* getProtoType() const = 0; + +protected: + XSerializable() {} + XSerializable(const XSerializable& ) {} + +private: + // ----------------------------------------------------------------------- + // Unimplemented assignment operator + // ----------------------------------------------------------------------- + XSerializable& operator=(const XSerializable&); + +}; + +inline void XSerializable::serialize(XSerializeEngine& ) +{ +} + +/*** + * Macro to be included in XSerializable derivatives' + * declaration's public section + ***/ +#define DECL_XSERIALIZABLE(class_name) \ +public: \ +\ +DECL_XPROTOTYPE(class_name) \ +\ +virtual bool isSerializable() const ; \ +virtual XProtoType* getProtoType() const; \ +virtual void serialize(XSerializeEngine&); \ +\ +inline friend XSerializeEngine& operator>>(XSerializeEngine& serEng \ + , class_name*& objPtr) \ +{objPtr = (class_name*) serEng.read(XPROTOTYPE_CLASS(class_name)); \ + return serEng; \ +}; + +/*** + * Macro to be included in the implementation file + * of XSerializable derivatives' which is instantiable + ***/ +#define IMPL_XSERIALIZABLE_TOCREATE(class_name) \ +IMPL_XPROTOTYPE_TOCREATE(class_name) \ +IMPL_XSERIAL(class_name) + +/*** + * Macro to be included in the implementation file + * of XSerializable derivatives' which is UN-instantiable + ***/ +#define IMPL_XSERIALIZABLE_NOCREATE(class_name) \ +IMPL_XPROTOTYPE_NOCREATE(class_name) \ +IMPL_XSERIAL(class_name) + +/*** + * Helper Macro + ***/ +#define IMPL_XSERIAL(class_name) \ +bool class_name::isSerializable() const \ +{return true; } \ +XProtoType* class_name::getProtoType() const \ +{return XPROTOTYPE_CLASS(class_name); } + +#define IS_EQUIVALENT(lptr, rptr) \ + if (lptr == rptr) \ + return true; \ + if (( lptr && !rptr) || (!lptr && rptr)) \ + return false; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/internal/XSerializationException.hpp b/project/jni/xerces/src/xercesc/internal/XSerializationException.hpp new file mode 100644 index 000000000..fccf15e63 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSerializationException.hpp @@ -0,0 +1,34 @@ +/* + * 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: XSerializationException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSERIALIZATION_EXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XSERIALIZATION_EXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(XSerializationException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XSerializeEngine.cpp b/project/jni/xerces/src/xercesc/internal/XSerializeEngine.cpp new file mode 100644 index 000000000..c66cfe10e --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSerializeEngine.cpp @@ -0,0 +1,1158 @@ +/* + * 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: XSerializeEngine.cpp 834826 2009-11-11 10:03:53Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const bool XSerializeEngine::toWriteBufferLen = true; +const bool XSerializeEngine::toReadBufferLen = true; + +static const unsigned long noDataFollowed = (unsigned long)-1; + +static const XSerializeEngine::XSerializedObjectId_t fgNullObjectTag = 0; // indicating null ptrs +static const XSerializeEngine::XSerializedObjectId_t fgNewClassTag = 0xFFFFFFFF; // indicating new class +static const XSerializeEngine::XSerializedObjectId_t fgTemplateObjTag = 0xFFFFFFFE; // indicating template object +static const XSerializeEngine::XSerializedObjectId_t fgClassMask = 0x80000000; // indicates class tag +static const XSerializeEngine::XSerializedObjectId_t fgMaxObjectCount = 0x3FFFFFFD; + +#define TEST_THROW_ARG1(condition, data, err_msg) \ +if (condition) \ +{ \ + XMLCh value1[64]; \ + XMLString::sizeToText(data, value1, 65, 10, getMemoryManager()); \ + ThrowXMLwithMemMgr1(XSerializationException \ + , err_msg \ + , value1 \ + , getMemoryManager()); \ +} + +#define TEST_THROW_ARG2(condition, data1, data2, err_msg) \ +if (condition) \ +{ \ + XMLCh value1[64]; \ + XMLCh value2[64]; \ + XMLString::sizeToText(data1, value1, 65, 10, getMemoryManager()); \ + XMLString::sizeToText(data2, value2, 65, 10, getMemoryManager()); \ + ThrowXMLwithMemMgr2(XSerializationException \ + , err_msg \ + , value1 \ + , value2 \ + , getMemoryManager()); \ +} + +// --------------------------------------------------------------------------- +// Constructor and Destructor +// --------------------------------------------------------------------------- +XSerializeEngine::~XSerializeEngine() +{ + if (isStoring()) + { + flush(); + delete fStorePool; + } + else + { + delete fLoadPool; + } + + getMemoryManager()->deallocate(fBufStart); + +} + +XSerializeEngine::XSerializeEngine(BinInputStream* inStream + , XMLGrammarPool* const gramPool + , XMLSize_t bufSize) +:fStoreLoad(mode_Load) +,fStorerLevel(0) +,fGrammarPool(gramPool) +,fInputStream(inStream) +,fOutputStream(0) +,fBufCount(0) +,fBufSize(bufSize) +,fBufStart( (XMLByte*) gramPool->getMemoryManager()->allocate(bufSize)) +,fBufEnd(0) +,fBufCur(fBufStart) +,fBufLoadMax(fBufStart) +,fStorePool(0) +,fLoadPool( new (gramPool->getMemoryManager()) ValueVectorOf(29, gramPool->getMemoryManager(), false)) +,fObjectCount(0) +{ + /*** + * initialize buffer from the inStream + ***/ + fillBuffer(); + +} + +XSerializeEngine::XSerializeEngine(BinOutputStream* outStream + , XMLGrammarPool* const gramPool + , XMLSize_t bufSize) +:fStoreLoad(mode_Store) +,fStorerLevel(0) +,fGrammarPool(gramPool) +,fInputStream(0) +,fOutputStream(outStream) +,fBufCount(0) +,fBufSize(bufSize) +,fBufStart((XMLByte*) gramPool->getMemoryManager()->allocate(bufSize)) +,fBufEnd(fBufStart+bufSize) +,fBufCur(fBufStart) +,fBufLoadMax(0) +,fStorePool( new (gramPool->getMemoryManager()) RefHashTableOf(29, true, gramPool->getMemoryManager()) ) +,fLoadPool(0) +,fObjectCount(0) +{ + resetBuffer(); + + //initialize store pool + fStorePool->put(0, new (gramPool->getMemoryManager()) XSerializedObjectId(fgNullObjectTag)); + +} + +void XSerializeEngine::flush() +{ + if (isStoring()) + flushBuffer(); + +} + +// --------------------------------------------------------------------------- +// Storing +// --------------------------------------------------------------------------- +void XSerializeEngine::write(XSerializable* const objectToWrite) +{ + ensureStoring(); + //don't ensurePointer here !!! + + XSerializedObjectId_t objIndex = 0; + + if (!objectToWrite) // null pointer + { + *this << fgNullObjectTag; + } + else if (0 != (objIndex = lookupStorePool((void*) objectToWrite))) + { + // writing an object reference tag + *this << objIndex; + } + else + { + // write protoType first + XProtoType* protoType = objectToWrite->getProtoType(); + write(protoType); + + // put the object into StorePool + addStorePool((void*)objectToWrite); + + // ask the object to serialize itself + objectToWrite->serialize(*this); + } + +} + +void XSerializeEngine::write(XProtoType* const protoType) +{ + ensureStoring(); + ensurePointer(protoType); + + XSerializedObjectId_t objIndex = lookupStorePool((void*)protoType); + + if (objIndex) + { + //protoType seen in the store pool + *this << (fgClassMask | objIndex); + } + else + { + // store protoType + *this << fgNewClassTag; + protoType->store(*this); + addStorePool((void*)protoType); + } + +} + +/*** + * +***/ +void XSerializeEngine::write(const XMLCh* const toWrite + , XMLSize_t writeLen) +{ + write((XMLByte*)toWrite, (sizeof(XMLCh)/sizeof(XMLByte)) * writeLen); +} + + +void XSerializeEngine::write(const XMLByte* const toWrite + , XMLSize_t writeLen) +{ + ensureStoring(); + ensurePointer((void*)toWrite); + ensureStoreBuffer(); + + if (writeLen == 0) + return; + + /*** + * If the available space is sufficient, write it up + ***/ + XMLSize_t bufAvail = fBufEnd - fBufCur; + + if (writeLen <= bufAvail) + { + memcpy(fBufCur, toWrite, writeLen); + fBufCur += writeLen; + return; + } + + const XMLByte* tempWrite = (const XMLByte*) toWrite; + XMLSize_t writeRemain = writeLen; + + // fill up the avaiable space and flush + memcpy(fBufCur, tempWrite, bufAvail); + tempWrite += bufAvail; + writeRemain -= bufAvail; + flushBuffer(); + + // write chunks of fBufSize + while (writeRemain >= fBufSize) + { + memcpy(fBufCur, tempWrite, fBufSize); + tempWrite += fBufSize; + writeRemain -= fBufSize; + flushBuffer(); + } + + // write the remaining if any + if (writeRemain) + { + memcpy(fBufCur, tempWrite, writeRemain); + fBufCur += writeRemain; + } + +} + +/*** + * + * Storage scheme (normal): + * + * < + * 1st integer: bufferLen (optional) + * 2nd integer: dataLen + * bytes following: + * > + * + * Storage scheme (special): + * < + * only integer: noDataFollowed + * > + */ + +void XSerializeEngine::writeString(const XMLCh* const toWrite + , const XMLSize_t bufferLen + , bool toWriteBufLen) +{ + if (toWrite) + { + if (toWriteBufLen) + *this<<(unsigned long)bufferLen; + + XMLSize_t strLen = XMLString::stringLen(toWrite); + *this<<(unsigned long)strLen; + + write(toWrite, strLen); + } + else + { + *this<fCreateObject(getMemoryManager()); + Assert((objRet != 0), XMLExcepts::XSer_CreateObject_Fail); + + // put it into load pool + addLoadPool(objRet); + + // de-serialize it + objRet->serialize(*this); + + } + + return objRet; +} + +bool XSerializeEngine::read(XProtoType* const protoType + , XSerializedObjectId_t* objectTagRet) +{ + ensureLoading(); + ensurePointer(protoType); + + XSerializedObjectId_t obTag; + + *this >> obTag; + + // object reference tag found + if (!(obTag & fgClassMask)) + { + *objectTagRet = obTag; + return false; + } + + if (obTag == fgNewClassTag) + { + // what follows fgNewClassTag is the prototype object info + // for the object anticipated, go and verify the info + XProtoType::load(*this, protoType->fClassName, getMemoryManager()); + + addLoadPool((void*)protoType); + } + else + { + // what follows class tag is an XSerializable object + XSerializedObjectId_t classIndex = (obTag & ~fgClassMask); + XSerializedObjectId_t loadPoolSize = (XSerializedObjectId_t)fLoadPool->size(); + + if ((classIndex == 0 ) || (classIndex > loadPoolSize)) + { + XMLCh value1[64]; + XMLCh value2[64]; + XMLString::binToText(classIndex, value1, 65, 10, getMemoryManager()); + XMLString::binToText(loadPoolSize, value2, 65, 10, getMemoryManager()); + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_Inv_ClassIndex + , value1 + , value2 + , getMemoryManager()); + } + + ensurePointer(lookupLoadPool(classIndex)); + } + + return true; +} + +void XSerializeEngine::read(XMLCh* const toRead + , XMLSize_t readLen) +{ + read((XMLByte*)toRead, (sizeof(XMLCh)/sizeof(XMLByte))*readLen); +} + +void XSerializeEngine::read(XMLByte* const toRead + , XMLSize_t readLen) +{ + ensureLoading(); + ensurePointer(toRead); + ensureLoadBuffer(); + + if (readLen == 0) + return; + + /*** + * If unread is sufficient, read it up + ***/ + XMLSize_t dataAvail = fBufLoadMax - fBufCur; + + if (readLen <= dataAvail) + { + memcpy(toRead, fBufCur, readLen); + fBufCur += readLen; + return; + } + + /*** + * + * fillBuffer will discard anything left in the buffer + * before it asks the inputStream to fill in the buffer, + * so we need to readup everything in the buffer before + * calling fillBuffer + * + ***/ + XMLByte* tempRead = (XMLByte*) toRead; + XMLSize_t readRemain = readLen; + + // read the unread + memcpy(tempRead, fBufCur, dataAvail); + tempRead += dataAvail; + readRemain -= dataAvail; + + // read chunks of fBufSize + while (readRemain >= fBufSize) + { + fillBuffer(); + memcpy(tempRead, fBufCur, fBufSize); + tempRead += fBufSize; + readRemain -= fBufSize; + } + + // read the remaining if any + if (readRemain) + { + fillBuffer(); + memcpy(tempRead, fBufCur, readRemain); + fBufCur += readRemain; + } + +} + +/*** + * + * Storage scheme (normal): + * + * < + * 1st integer: bufferLen (optional) + * 2nd integer: dataLen + * bytes following: + * > + * + * Storage scheme (special): + * < + * only integer: noDataFollowed + * > + */ +void XSerializeEngine::readString(XMLCh*& toRead + , XMLSize_t& bufferLen + , XMLSize_t& dataLen + , bool toReadBufLen) +{ + /*** + * Check if any data written + ***/ + unsigned long tmp; + *this>>tmp; + bufferLen=tmp; + + if (bufferLen == noDataFollowed) + { + toRead = 0; + bufferLen = 0; + dataLen = 0; + return; + } + + if (toReadBufLen) + { + *this>>tmp; + dataLen=tmp; + } + else + { + dataLen = bufferLen++; + } + + toRead = (XMLCh*) getMemoryManager()->allocate(bufferLen * sizeof(XMLCh)); + read(toRead, dataLen); + toRead[dataLen] = 0; +} + +void XSerializeEngine::readString(XMLByte*& toRead + , XMLSize_t& bufferLen + , XMLSize_t& dataLen + , bool toReadBufLen) +{ + /*** + * Check if any data written + ***/ + unsigned long tmp; + *this>>tmp; + bufferLen=tmp; + if (bufferLen == noDataFollowed) + { + toRead = 0; + bufferLen = 0; + dataLen = 0; + return; + } + + if (toReadBufLen) + { + *this>>tmp; + dataLen=tmp; + } + else + { + dataLen = bufferLen++; + } + + toRead = (XMLByte*) getMemoryManager()->allocate(bufferLen * sizeof(XMLByte)); + read(toRead, dataLen); + toRead[dataLen] = 0; + +} + +// --------------------------------------------------------------------------- +// Insertion & Extraction +// --------------------------------------------------------------------------- + +XSerializeEngine& XSerializeEngine::operator<<(XMLCh xch) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(XMLCh))); + + alignBufCur(sizeof(XMLCh)); + *(XMLCh*)fBufCur = xch; + fBufCur += sizeof(XMLCh); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(XMLCh& xch) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(XMLCh))); + + alignBufCur(sizeof(XMLCh)); + xch = *(XMLCh*)fBufCur; + fBufCur += sizeof(XMLCh); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(XMLByte by) +{ + checkAndFlushBuffer(sizeof(XMLByte)); + + *(XMLByte*)fBufCur = by; + fBufCur += sizeof(XMLByte); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(XMLByte& by) +{ + checkAndFillBuffer(sizeof(XMLByte)); + + by = *(XMLByte*)fBufCur; + fBufCur += sizeof(XMLByte); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(bool b) +{ + checkAndFlushBuffer(sizeof(bool)); + + *(bool*)fBufCur = b; + fBufCur += sizeof(bool); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(bool& b) +{ + checkAndFillBuffer(sizeof(bool)); + + b = *(bool*)fBufCur; + fBufCur += sizeof(bool); + return *this; +} + +void XSerializeEngine::writeSize (XMLSize_t t) +{ + checkAndFlushBuffer(sizeof(t)); + + memcpy(fBufCur, &t, sizeof(t)); + fBufCur += sizeof(t); +} + +void XSerializeEngine::writeInt64 (XMLInt64 t) +{ + checkAndFlushBuffer(sizeof(t)); + + memcpy(fBufCur, &t, sizeof(t)); + fBufCur += sizeof(t); +} + +void XSerializeEngine::writeUInt64 (XMLUInt64 t) +{ + checkAndFlushBuffer(sizeof(t)); + + memcpy(fBufCur, &t, sizeof(t)); + fBufCur += sizeof(t); +} + +void XSerializeEngine::readSize (XMLSize_t& t) +{ + checkAndFillBuffer(sizeof(t)); + + memcpy(&t, fBufCur, sizeof(t)); + fBufCur += sizeof(t); +} + +void XSerializeEngine::readInt64 (XMLInt64& t) +{ + checkAndFillBuffer(sizeof(t)); + + memcpy(&t, fBufCur, sizeof(t)); + fBufCur += sizeof(t); +} + +void XSerializeEngine::readUInt64 (XMLUInt64& t) +{ + checkAndFillBuffer(sizeof(t)); + + memcpy(&t, fBufCur, sizeof(t)); + fBufCur += sizeof(t); +} + +XSerializeEngine& XSerializeEngine::operator<<(char ch) +{ + return XSerializeEngine::operator<<((XMLByte)ch); +} + +XSerializeEngine& XSerializeEngine::operator>>(char& ch) +{ + return XSerializeEngine::operator>>((XMLByte&)ch); +} + +XSerializeEngine& XSerializeEngine::operator<<(short sh) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(short))); + + alignBufCur(sizeof(short)); + *(short*)fBufCur = sh; + fBufCur += sizeof(short); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(short& sh) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(short))); + + alignBufCur(sizeof(short)); + sh = *(short*)fBufCur; + fBufCur += sizeof(short); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(int i) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(int))); + + alignBufCur(sizeof(int)); + *(int*)fBufCur = i; + fBufCur += sizeof(int); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(int& i) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(int))); + + alignBufCur(sizeof(int)); + i = *(int*)fBufCur; + fBufCur += sizeof(int); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(unsigned int ui) +{ + + checkAndFlushBuffer(calBytesNeeded(sizeof(unsigned int))); + + alignBufCur(sizeof(unsigned int)); + *(unsigned int*)fBufCur = ui; + fBufCur += sizeof(unsigned int); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(unsigned int& ui) +{ + + checkAndFillBuffer(calBytesNeeded(sizeof(unsigned int))); + + alignBufCur(sizeof(unsigned int)); + ui = *(unsigned int*)fBufCur; + fBufCur += sizeof(unsigned int); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(long l) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(long))); + + alignBufCur(sizeof(long)); + *(long*)fBufCur = l; + fBufCur += sizeof(long); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(long& l) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(long))); + + alignBufCur(sizeof(long)); + l = *(long*)fBufCur; + fBufCur += sizeof(long); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(unsigned long ul) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(unsigned long))); + + alignBufCur(sizeof(unsigned long)); + *(unsigned long*)fBufCur = ul; + fBufCur += sizeof(unsigned long); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(unsigned long& ul) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(unsigned long))); + + alignBufCur(sizeof(unsigned long)); + ul = *(unsigned long*)fBufCur; + fBufCur += sizeof(unsigned long); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(float f) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(float))); + + alignBufCur(sizeof(float)); + *(float*)fBufCur = *(float*)&f; + fBufCur += sizeof(float); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(float& f) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(float))); + + alignBufCur(sizeof(float)); + *(float*)&f = *(float*)fBufCur; + fBufCur += sizeof(float); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator<<(double d) +{ + checkAndFlushBuffer(calBytesNeeded(sizeof(double))); + + alignBufCur(sizeof(double)); + *(double*)fBufCur = *(double*)&d; + fBufCur += sizeof(double); + return *this; +} + +XSerializeEngine& XSerializeEngine::operator>>(double& d) +{ + checkAndFillBuffer(calBytesNeeded(sizeof(double))); + + alignBufCur(sizeof(double)); + *(double*)&d = *(double*)fBufCur; + fBufCur += sizeof(double); + return *this; +} + +// --------------------------------------------------------------------------- +// StorePool/LoadPool Opertions +// --------------------------------------------------------------------------- +XSerializeEngine::XSerializedObjectId_t +XSerializeEngine::lookupStorePool(void* const objToLookup) const +{ + //0 indicating object is not in the StorePool + XSerializedObjectId* data = fStorePool->get(objToLookup); + return (XSerializeEngine::XSerializedObjectId_t) (data ? data->getValue() : 0); + +} + +void XSerializeEngine::addStorePool(void* const objToAdd) +{ + pumpCount(); + fStorePool->put(objToAdd, new (fGrammarPool->getMemoryManager()) XSerializedObjectId(fObjectCount)); +} + +XSerializable* XSerializeEngine::lookupLoadPool(XSerializedObjectId_t objectTag) const +{ + + /*** + * an object tag read from the binary refering to + * an object beyond the upper most boundary of the load pool + ***/ + + if (objectTag > fLoadPool->size()) + { + XMLCh value1[64]; + XMLCh value2[64]; + XMLString::binToText(objectTag, value1, 65, 10, getMemoryManager()); + XMLString::sizeToText(fLoadPool->size(), value2, 65, 10, getMemoryManager()); + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_LoadPool_UppBnd_Exceed + , value1 + , value2 + , getMemoryManager()); + } + + if (objectTag == 0) + return 0; + + /*** + * A non-null object tag starts from 1 while fLoadPool starts from 0 + ***/ + return (XSerializable*) fLoadPool->elementAt(objectTag - 1); +} + +void XSerializeEngine::addLoadPool(void* const objToAdd) +{ + + TEST_THROW_ARG2( (fLoadPool->size() != fObjectCount) + , fObjectCount + , fLoadPool->size() + , XMLExcepts::XSer_LoadPool_NoTally_ObjCnt + ) + + pumpCount(); + fLoadPool->addElement(objToAdd); + +} + +void XSerializeEngine::pumpCount() +{ + if (fObjectCount >= fgMaxObjectCount) + { + XMLCh value1[64]; + XMLCh value2[64]; + XMLString::sizeToText(fObjectCount, value1, 65, 10, getMemoryManager()); + XMLString::binToText(fgMaxObjectCount, value2, 65, 10, getMemoryManager()); + ThrowXMLwithMemMgr2(XSerializationException + , XMLExcepts::XSer_ObjCount_UppBnd_Exceed + , value1 + , value2 + , getMemoryManager()); + } + + fObjectCount++; + +} + +// --------------------------------------------------------------------------- +// Buffer Opertions +// --------------------------------------------------------------------------- +/*** + * + * Though client may need only miniBytesNeeded, we always request + * a full size reading from our inputStream. + * + * Whatever possibly left in the buffer is abandoned, such as in + * the case of CheckAndFillBuffer() + * + ***/ +void XSerializeEngine::fillBuffer() +{ + ensureLoading(); + ensureLoadBuffer(); + + resetBuffer(); + + XMLSize_t bytesRead = fInputStream->readBytes(fBufStart, fBufSize); + + /*** + * InputStream MUST fill in the exact amount of bytes as requested + * to do: combine the checking and create a new exception code later + ***/ + TEST_THROW_ARG2( (bytesRead < fBufSize) + , bytesRead + , fBufSize + , XMLExcepts::XSer_InStream_Read_LT_Req + ) + + TEST_THROW_ARG2( (bytesRead > fBufSize) + , bytesRead + , fBufSize + , XMLExcepts::XSer_InStream_Read_OverFlow + ) + + fBufLoadMax = fBufStart + fBufSize; + fBufCur = fBufStart; + + ensureLoadBuffer(); + + fBufCount++; +} + +/*** + * + * Flush out whatever left in the buffer, from + * fBufStart to fBufEnd. + * + ***/ +void XSerializeEngine::flushBuffer() +{ + ensureStoring(); + ensureStoreBuffer(); + + fOutputStream->writeBytes(fBufStart, fBufSize); + fBufCur = fBufStart; + + resetBuffer(); + ensureStoreBuffer(); + + fBufCount++; +} + +inline void XSerializeEngine::checkAndFlushBuffer(XMLSize_t bytesNeedToWrite) +{ + TEST_THROW_ARG1( (bytesNeedToWrite <= 0) + , bytesNeedToWrite + , XMLExcepts::XSer_Inv_checkFlushBuffer_Size + ) + + // fBufStart ... fBufCur ...fBufEnd + if ((fBufCur + bytesNeedToWrite) > fBufEnd) + flushBuffer(); +} + +inline void XSerializeEngine::checkAndFillBuffer(XMLSize_t bytesNeedToRead) +{ + + TEST_THROW_ARG1( (bytesNeedToRead <= 0) + , bytesNeedToRead + , XMLExcepts::XSer_Inv_checkFillBuffer_Size + ) + + // fBufStart ... fBufCur ...fBufLoadMax + if ((fBufCur + bytesNeedToRead) > fBufLoadMax) + { + fillBuffer(); + } + +} + +inline void XSerializeEngine::ensureStoreBuffer() const +{ + XMLSize_t a = (XMLSize_t) (fBufCur - fBufStart); + XMLSize_t b = (XMLSize_t) (fBufEnd - fBufCur); + + TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufEnd)) + , a + , b + , XMLExcepts::XSer_StoreBuffer_Violation + ) + +} + +inline void XSerializeEngine::ensureLoadBuffer() const +{ + XMLSize_t a = (XMLSize_t) (fBufCur - fBufStart); + XMLSize_t b = (XMLSize_t) (fBufLoadMax - fBufCur); + + TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufLoadMax)) + , a + , b + , XMLExcepts::XSer_LoadBuffer_Violation + ) + +} + +inline void XSerializeEngine::ensurePointer(void* const ptr) const +{ + + TEST_THROW_ARG1( (ptr == 0) + , 0 + , XMLExcepts::XSer_Inv_Null_Pointer + ) + +} + +inline void XSerializeEngine::resetBuffer() +{ + memset(fBufStart, 0, fBufSize * sizeof(XMLByte)); +} + +// --------------------------------------------------------------------------- +// Template object +// --------------------------------------------------------------------------- +/*** + * + * Search the store pool to see if the address has been seen before or not. + * + * If yes, write the corresponding object Tag to the internal buffer + * and return true. + * + * Otherwise, add the address to the store pool and return false + * to notifiy the client application code to store the template object. + * + ***/ +bool XSerializeEngine::needToStoreObject(void* const templateObjectToWrite) +{ + ensureStoring(); //don't ensurePointer here !!! + + XSerializedObjectId_t objIndex = 0; + + if (!templateObjectToWrite) + { + *this << fgNullObjectTag; // null pointer + return false; + } + else if (0 != (objIndex = lookupStorePool(templateObjectToWrite))) + { + *this << objIndex; // write an object reference tag + return false; + } + else + { + *this << fgTemplateObjTag; // write fgTemplateObjTag to denote that actual + // template object follows + addStorePool(templateObjectToWrite); // put the address into StorePool + return true; + } + +} + +bool XSerializeEngine::needToLoadObject(void** templateObjectToRead) +{ + ensureLoading(); + + XSerializedObjectId_t obTag; + + *this >> obTag; + + if (obTag == fgTemplateObjTag) + { + /*** + * what follows fgTemplateObjTag is the actual template object + * We need the client application to create a template object + * and register it through registerObject(), and deserialize + * template object + ***/ + return true; + } + else + { + /*** + * We hava a reference to an existing template object, get it. + */ + *templateObjectToRead = lookupLoadPool(obTag); + return false; + } + +} + +void XSerializeEngine::registerObject(void* const templateObjectToRegister) +{ + ensureLoading(); + addLoadPool(templateObjectToRegister); +} + +XMLGrammarPool* XSerializeEngine::getGrammarPool() const +{ + return fGrammarPool; +} + +XMLStringPool* XSerializeEngine::getStringPool() const +{ + return fGrammarPool->getURIStringPool(); +} + +MemoryManager* XSerializeEngine::getMemoryManager() const +{ + //todo: changed to return fGrammarPool->getMemoryManager() + return fGrammarPool ? fGrammarPool->getMemoryManager() : XMLPlatformUtils::fgMemoryManager; +} + +// +// Based on the current position (fBufCur), calculated the needed size +// to read/write +// +inline XMLSize_t XSerializeEngine::alignAdjust(XMLSize_t size) const +{ + XMLSize_t remainder = (XMLSize_t) fBufCur % size; + return (remainder == 0) ? 0 : (size - remainder); +} + +// Adjust the fBufCur +inline void XSerializeEngine::alignBufCur(XMLSize_t size) +{ + fBufCur+=alignAdjust(size); + assert(((XMLSize_t) fBufCur % size)==0); +} + +inline XMLSize_t XSerializeEngine::calBytesNeeded(XMLSize_t size) const +{ + return (alignAdjust(size) + size); +} + +void XSerializeEngine::trace(char* /*funcName*/) const +{ + return; + +/* + if (isStoring()) + printf("\n funcName=<%s>, storing, count=<%lu>, postion=<%lu>\n", funcName, fBufCount, getBufCurAccumulated()); + else + printf("\n funcName=<%s>, loading, count=<%lu>, postion=<%lu>\n", funcName, fBufCount, getBufCurAccumulated()); +*/ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XSerializeEngine.hpp b/project/jni/xerces/src/xercesc/internal/XSerializeEngine.hpp new file mode 100644 index 000000000..88a4ecc4b --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XSerializeEngine.hpp @@ -0,0 +1,841 @@ +/* + * 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: XSerializeEngine.hpp 679296 2008-07-24 08:13:42Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSERIALIZE_ENGINE_HPP) +#define XERCESC_INCLUDE_GUARD_XSERIALIZE_ENGINE_HPP + +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XSerializable; +class XProtoType; +class MemoryManager; +class XSerializedObjectId; +class BinOutputStream; +class BinInputStream; +class XMLGrammarPool; +class XMLGrammarPoolImpl; +class XMLStringPool; + +class XMLUTIL_EXPORT XSerializeEngine +{ +public: + + enum { mode_Store + , mode_Load + }; + + + static const bool toReadBufferLen; + + typedef unsigned int XSerializedObjectId_t; + + /*** + * + * Destructor + * + ***/ + ~XSerializeEngine(); + + /*** + * + * Constructor for de-serialization(loading) + * + * Application needs to make sure that the instance of + * BinInputStream, persists beyond the life of this + * SerializeEngine. + * + * Param + * inStream input stream + * gramPool Grammar Pool + * bufSize the size of the internal buffer + * + ***/ + XSerializeEngine(BinInputStream* inStream + , XMLGrammarPool* const gramPool + , XMLSize_t bufSize = 8192 ); + + + /*** + * + * Constructor for serialization(storing) + * + * Application needs to make sure that the instance of + * BinOutputStream, persists beyond the life of this + * SerializeEngine. + * + * Param + * outStream output stream + * gramPool Grammar Pool + * bufSize the size of the internal buffer + * + ***/ + XSerializeEngine(BinOutputStream* outStream + , XMLGrammarPool* const gramPool + , XMLSize_t bufSize = 8192 ); + + /*** + * + * When serialization, flush out the internal buffer + * + * Return: + * + ***/ + void flush(); + + /*** + * + * Checking if the serialize engine is doing serialization(storing) + * + * Return: true, if it is + * false, otherwise + * + ***/ + inline bool isStoring() const; + + /*** + * + * Checking if the serialize engine is doing de-serialization(loading) + * + * Return: true, if it is + * false, otherwise + * + ***/ + inline bool isLoading() const; + + /*** + * + * Get the GrammarPool + * + * Return: XMLGrammarPool + * + ***/ + XMLGrammarPool* getGrammarPool() const; + + /*** + * + * Get the StringPool + * + * Return: XMLStringPool + * + ***/ + XMLStringPool* getStringPool() const; + + /*** + * + * Get the embeded Memory Manager + * + * Return: MemoryManager + * + ***/ + MemoryManager* getMemoryManager() const; + + /*** + * + * Get the storer level (the level of the serialize engine + * which created the binary stream that this serialize engine + * is loading). + * + * The level returned is meaningful only when + * the engine isLoading. + * + * Return: level + * + ***/ + inline unsigned int getStorerLevel() const; + + /*** + * + * Write object to the internal buffer. + * + * Param + * objectToWrite: the object to be serialized + * + * Return: + * + ***/ + void write(XSerializable* const objectToWrite); + + /*** + * + * Write prototype info to the internal buffer. + * + * Param + * protoType: instance of prototype + * + * Return: + * + ***/ + void write(XProtoType* const protoType); + + /*** + * + * Write a stream of XMLByte to the internal buffer. + * + * Param + * toWrite: the stream of XMLByte to write + * writeLen: the length of the stream + * + * Return: + * + ***/ + void write(const XMLByte* const toWrite + , XMLSize_t writeLen); + + /*** + * + * Write a stream of XMLCh to the internal buffer. + * + * Param + * toWrite: the stream of XMLCh to write + * writeLen: the length of the stream + * + * Return: + * + ***/ + void write(const XMLCh* const toWrite + , XMLSize_t writeLen); + + /*** + * + * Write a stream of XMLCh to the internal buffer. + * + * Write the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toWrite: the stream of XMLCh to write + * bufferLen: the maximum size of the buffer + * toWriteBufLen: specify if the bufferLen need to be written or not + * + * Return: + * + ***/ + void writeString(const XMLCh* const toWrite + , const XMLSize_t bufferLen = 0 + , bool toWriteBufLen = false); + + /*** + * + * Write a stream of XMLByte to the internal buffer. + * + * Write the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toWrite: the stream of XMLByte to write + * bufferLen: the maximum size of the buffer + * toWriteBufLen: specify if the bufferLen need to be written or not + * + * Return: + * + ***/ + void writeString(const XMLByte* const toWrite + , const XMLSize_t bufferLen = 0 + , bool toWriteBufLen = false); + + static const bool toWriteBufferLen; + + /*** + * + * Read/Create object from the internal buffer. + * + * Param + * protoType: an instance of prototype of the object anticipated + * + * Return: to object read/created + * + ***/ + XSerializable* read(XProtoType* const protoType); + + /*** + * + * Read prototype object from the internal buffer. + * Verify if the same prototype object found in buffer. + * + * Param + * protoType: an instance of prototype of the object anticipated + * objTag: the object Tag to an existing object + * + * Return: true : if matching found + * false : otherwise + * + ***/ + bool read(XProtoType* const protoType + , XSerializedObjectId_t* objTag); + + /*** + * + * Read XMLByte stream from the internal buffer. + * + * Param + * toRead: the buffer to hold the XMLByte stream + * readLen: the length of the XMLByte to read in + * + * Return: + * + ***/ + void read(XMLByte* const toRead + , XMLSize_t readLen); + + /*** + * + * Read XMLCh stream from the internal buffer. + * + * Param + * toRead: the buffer to hold the XMLCh stream + * readLen: the length of the XMLCh to read in + * + * Return: + * + ***/ + void read(XMLCh* const toRead + , XMLSize_t readLen); + + /*** + * + * Read a stream of XMLCh from the internal buffer. + * + * Read the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toRead: the pointer to the buffer to hold the XMLCh stream + * bufferLen: the size of the buffer created + * dataLen: the length of the stream + * toReadBufLen: specify if the bufferLen need to be read or not + * + * Return: + * + ***/ + void readString(XMLCh*& toRead + , XMLSize_t& bufferLen + , XMLSize_t& dataLen + , bool toReadBufLen = false); + + /*** + * + * Read a stream of XMLCh from the internal buffer. + * + * Read the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toRead: the pointer to the buffer to hold the XMLCh stream + * bufferLen: the size of the buffer created + * + * Return: + * + ***/ + inline void readString(XMLCh*& toRead + , XMLSize_t& bufferLen); + + /*** + * + * Read a stream of XMLCh from the internal buffer. + * + * Param + * toRead: the pointer to the buffer to hold the XMLCh stream + * + * Return: + * + ***/ + inline void readString(XMLCh*& toRead); + + /*** + * + * Read a stream of XMLByte from the internal buffer. + * + * Read the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toRead: the pointer to the buffer to hold the XMLByte stream + * bufferLen: the size of the buffer created + * dataLen: the length of the stream + * toReadBufLen: specify if the bufferLen need to be read or not + * + * Return: + * + ***/ + void readString(XMLByte*& toRead + , XMLSize_t& bufferLen + , XMLSize_t& dataLen + , bool toReadBufLen = false); + + + /*** + * + * Read a stream of XMLByte from the internal buffer. + * + * Read the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toRead: the pointer to the buffer to hold the XMLByte stream + * bufferLen: the size of the buffer created + * + * Return: + * + ***/ + inline void readString(XMLByte*& toRead + , XMLSize_t& bufferLen); + + /*** + * + * Read a stream of XMLByte from the internal buffer. + * + * Read the bufferLen first if requested, then the length + * of the stream followed by the stream. + * + * Param + * toRead: the pointer to the buffer to hold the XMLByte stream + * bufferLen: the size of the buffer created + * dataLen: the length of the stream + * toReadBufLen: specify if the bufferLen need to be read or not + * + * Return: + * + ***/ + inline void readString(XMLByte*& toRead); + + /*** + * + * Check if the template object has been stored or not + * + * Param + * objectPtr: the template object pointer + * + * Return: true : the object has NOT been stored yet + * false : otherwise + * + ***/ + bool needToStoreObject(void* const templateObjectToWrite); + + /*** + * + * Check if the template object has been loaded or not + * + * Param + * objectPtr: the address of the template object pointer + * + * Return: true : the object has NOT been loaded yet + * false : otherwise + * + ***/ + bool needToLoadObject(void** templateObjectToRead); + + /*** + * + * In the case of needToLoadObject() return true, the client + * application needs to instantiate an expected template object, and + * register the address to the engine. + * + * Param + * objectPtr: the template object pointer newly instantiated + * + * Return: + * + ***/ + void registerObject(void* const templateObjectToRegister); + + /*** + * + * Insertion operator for serializable classes + * + ***/ + + friend XSerializeEngine& operator<<(XSerializeEngine& + , XSerializable* const ); + + /*** + * + * Insertion operators for + * . basic Xerces data types + * . built-in types + * + ***/ + XSerializeEngine& operator<<(XMLByte); + XSerializeEngine& operator<<(XMLCh); + + XSerializeEngine& operator<<(char); + XSerializeEngine& operator<<(short); + XSerializeEngine& operator<<(int); + XSerializeEngine& operator<<(unsigned int); + XSerializeEngine& operator<<(long); + XSerializeEngine& operator<<(unsigned long); + XSerializeEngine& operator<<(float); + XSerializeEngine& operator<<(double); + XSerializeEngine& operator<<(bool); + + // These cannot be done as operators since on some platforms they + // may collide with int/long types. + // + void writeSize (XMLSize_t); + void writeInt64 (XMLInt64); + void writeUInt64 (XMLUInt64); + + + /*** + * + * Extraction operators for + * . basic Xerces data types + * . built-in types + * + ***/ + XSerializeEngine& operator>>(XMLByte&); + XSerializeEngine& operator>>(XMLCh&); + + XSerializeEngine& operator>>(char&); + XSerializeEngine& operator>>(short&); + XSerializeEngine& operator>>(int&); + XSerializeEngine& operator>>(unsigned int&); + XSerializeEngine& operator>>(long&); + XSerializeEngine& operator>>(unsigned long&); + XSerializeEngine& operator>>(float&); + XSerializeEngine& operator>>(double&); + XSerializeEngine& operator>>(bool&); + + void readSize (XMLSize_t&); + void readInt64 (XMLInt64&); + void readUInt64 (XMLUInt64&); + + /*** + * + * Getters + * + ***/ + inline + XMLSize_t getBufSize() const; + + inline + XMLSize_t getBufCur() const; + + inline + XMLSize_t getBufCurAccumulated() const; + + inline + unsigned long getBufCount() const; + + void trace(char*) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSerializeEngine(); + XSerializeEngine(const XSerializeEngine&); + XSerializeEngine& operator=(const XSerializeEngine&); + + /*** + * + * Store Pool Opertions + * + ***/ + XSerializedObjectId_t lookupStorePool(void* const objectPtr) const; + void addStorePool(void* const objectPtr); + + /*** + * + * Load Pool Opertions + * + ***/ + XSerializable* lookupLoadPool(XSerializedObjectId_t objectTag) const; + void addLoadPool(void* const objectPtr); + + /*** + * + * Intenal Buffer Operations + * + ***/ + inline void checkAndFillBuffer(XMLSize_t bytesNeedToRead); + + inline void checkAndFlushBuffer(XMLSize_t bytesNeedToWrite); + + void fillBuffer(); + + void flushBuffer(); + + void pumpCount(); + + inline void resetBuffer(); + + /*** + * + * Helper + * + ***/ + inline void ensureStoring() const; + + inline void ensureLoading() const; + + inline void ensureStoreBuffer() const; + + inline void ensureLoadBuffer() const; + + inline void ensurePointer(void* const) const; + + inline void Assert(bool toEval + , const XMLExcepts::Codes toThrow) const; + + + inline XMLSize_t calBytesNeeded(XMLSize_t) const; + + inline XMLSize_t alignAdjust(XMLSize_t) const; + + inline void alignBufCur(XMLSize_t); + + // Make XTemplateSerializer friend of XSerializeEngine so that + // we can call lookupStorePool and lookupLoadPool in the case of + // annotations. + friend class XTemplateSerializer; + + // ------------------------------------------------------------------------------- + // data + // + // fStoreLoad: + // Indicator: storing(serialization) or loading(de-serialization) + // + // fStorerLevel: + // The level of the serialize engine which created the binary + // stream that this serialize engine is loading + // + // It is set by GrammarPool when loading + // + // fGrammarPool: + // Thw owning GrammarPool which instantiate this SerializeEngine + // instance + // + // fInputStream: + // Binary stream to read from (de-serialization), provided + // by client application, not owned. + // + // fOutputStream: + // Binary stream to write to (serialization), provided + // by client application, not owned. + // + // fBufSize: + // The size of the internal buffer + // + // fBufStart/fBufEnd: + // + // The internal buffer. + // fBufEnd: + // one beyond the last valid cell + // fBufEnd === (fBufStart + fBufSize) + // + // fBufCur: + // The cursor of the buffer + // + // fBufLoadMax: + // Indicating the end of the valid content in the buffer + // + // fStorePool: + // Object collection for storing + // + // fLoadPool: + // Object collection for loading + // + // fMapCount: + // ------------------------------------------------------------------------------- + const short fStoreLoad; + unsigned int fStorerLevel; + + XMLGrammarPool* const fGrammarPool; + BinInputStream* const fInputStream; + BinOutputStream* const fOutputStream; + + unsigned long fBufCount; + + //buffer + const XMLSize_t fBufSize; + XMLByte* const fBufStart; + XMLByte* const fBufEnd; + XMLByte* fBufCur; + XMLByte* fBufLoadMax; + + + + /*** + * Map for storing object + * + * key: XSerializable* + * XProtoType* + * + * value: XMLInteger*, owned + * + ***/ + RefHashTableOf* fStorePool; + + /*** + * Vector for loading object, objects are NOT owned + * + * data: XSerializable* + * XProtoType* + * + ***/ + ValueVectorOf* fLoadPool; + + /*** + * object counter + ***/ + XSerializedObjectId_t fObjectCount; + + //to allow grammar pool to set storer level when loading + friend class XMLGrammarPoolImpl; +}; + +inline bool XSerializeEngine::isStoring() const +{ + return (fStoreLoad == mode_Store); +} + +inline bool XSerializeEngine::isLoading() const +{ + return (fStoreLoad == mode_Load); +} + +inline XSerializeEngine& operator<<(XSerializeEngine& serEng + , XSerializable* const serObj) +{ + serEng.write(serObj); + return serEng; +} + +inline void XSerializeEngine::ensureStoring() const +{ + Assert(isStoring(), XMLExcepts::XSer_Storing_Violation); +} + +inline void XSerializeEngine::ensureLoading() const +{ + Assert(isLoading(), XMLExcepts::XSer_Loading_Violation); +} + + + +inline void XSerializeEngine::Assert(bool toEval + , const XMLExcepts::Codes toThrow) const +{ + if (!toEval) + { + ThrowXMLwithMemMgr(XSerializationException, toThrow, getMemoryManager()); + } + +} + +inline void XSerializeEngine::readString(XMLCh*& toRead + , XMLSize_t& bufferLen) +{ + XMLSize_t dummyDataLen; + readString(toRead, bufferLen, dummyDataLen); +} + +inline void XSerializeEngine::readString(XMLCh*& toRead) +{ + XMLSize_t dummyBufferLen; + XMLSize_t dummyDataLen; + readString(toRead, dummyBufferLen, dummyDataLen); +} + +inline void XSerializeEngine::readString(XMLByte*& toRead + , XMLSize_t& bufferLen) +{ + XMLSize_t dummyDataLen; + readString(toRead, bufferLen, dummyDataLen); +} + +inline void XSerializeEngine::readString(XMLByte*& toRead) +{ + XMLSize_t dummyBufferLen; + XMLSize_t dummyDataLen; + readString(toRead, dummyBufferLen, dummyDataLen); +} + +inline +XMLSize_t XSerializeEngine::getBufSize() const +{ + return fBufSize; +} + +inline +XMLSize_t XSerializeEngine::getBufCur() const +{ + return (fBufCur-fBufStart); +} + +inline +XMLSize_t XSerializeEngine::getBufCurAccumulated() const +{ + return (fBufCount - (isStoring() ? 0: 1)) * fBufSize + (fBufCur-fBufStart); +} + +inline +unsigned long XSerializeEngine::getBufCount() const +{ + return fBufCount; +} + +inline +unsigned int XSerializeEngine::getStorerLevel() const +{ + return fStorerLevel; +} + +/*** + * Ought to be nested class + ***/ +class XSerializedObjectId : public XMemory +{ +public: + + ~XSerializedObjectId(){}; + +private: + + inline XSerializedObjectId(XSerializeEngine::XSerializedObjectId_t val): + fData(val) { }; + + inline XSerializeEngine::XSerializedObjectId_t getValue() const {return fData; }; + + friend class XSerializeEngine; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSerializedObjectId(); + XSerializedObjectId(const XSerializedObjectId&); + XSerializedObjectId& operator=(const XSerializedObjectId&); + + XSerializeEngine::XSerializedObjectId_t fData; + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.cpp b/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.cpp new file mode 100644 index 000000000..b07454cd8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.cpp @@ -0,0 +1,2322 @@ +/* + * 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. + */ + + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * internal class meant to be comsumed by XTemplateSerializer only + * the size can not grow + ***/ +#ifdef XERCES_DEBUG_SORT_GRAMMAR + +class KeySet : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Contructors and Destructor + // ----------------------------------------------------------------------- + KeySet + ( + const XMLCh* const strKey + , const int intKey1 + , const int intKey2 + , MemoryManager* const manager + ); + + ~KeySet(); + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + inline void getKeys(const XMLCh*&, int&, int&) const; + void print() const; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + KeySet(const KeySet&); + KeySet& operator=(const KeySet&); + + // ----------------------------------------------------------------------- + // Data members + // reference only + // ----------------------------------------------------------------------- + const XMLCh* const fStrKey; + const int fIntKey1; + const int fIntKey2; + MemoryManager* fMemoryManager; + +}; + +KeySet::KeySet(const XMLCh* const strKey + , const int intKey1 + , const int intKey2 + , MemoryManager* const manager) +:fStrKey(strKey) +,fIntKey1(intKey1) +,fIntKey2(intKey2) +,fMemoryManager(manager) +{ +} + +KeySet::~KeySet() +{ +} + +inline +void KeySet::getKeys(const XMLCh*& strKey, int& intKey1, int& intKey2) const +{ + strKey = fStrKey; + intKey1 = fIntKey1; + intKey2 = fIntKey2; +} + +void KeySet::print() const +{ + char* tmpStr = XMLString::transcode(fStrKey, fMemoryManager); + printf("tmpStr=<%s>, intKey1=<%d>, intKey2=<%d>\n", tmpStr, fIntKey1, fIntKey2); + XMLString::release(&tmpStr, fMemoryManager); +} + +static int compareKeySet(const void* keyl, const void* keyr) +{ + const KeySet* pairl=*(const KeySet**)keyl; + const KeySet* pairr=*(const KeySet**)keyr; + + const XMLCh* strKeyl = 0; + int intKeyl_1 = 0; + int intKeyl_2 = 0; + pairl->getKeys(strKeyl, intKeyl_1, intKeyl_2); + + const XMLCh* strKeyr = 0; + int intKeyr_1 = 0; + int intKeyr_2 = 0; + pairr->getKeys(strKeyr, intKeyr_1, intKeyr_2); + + int compareValue = XMLString::compareString(strKeyl, strKeyr); + + if (compareValue !=0) + return compareValue; + + compareValue = intKeyl_1 - intKeyr_1; + if (compareValue !=0) + return compareValue; + + return (intKeyl_2 - intKeyr_2); + +} + +class SortArray : public XMemory +{ +private : + // ----------------------------------------------------------------------- + // Contructors and Destructor + // ----------------------------------------------------------------------- + SortArray + ( + const XMLSize_t size + , MemoryManager* const manager + ); + + ~SortArray(); + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + inline const KeySet* elementAt(const XMLSize_t index) const; + void addElement(const KeySet* const keySet); + void sort(); + void dump() const; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SortArray(const SortArray&); + SortArray& operator=(const SortArray&); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + XMLSize_t fCur; //point to the current available slot + XMLSize_t fSize; + const KeySet** fElemList; //owning objects + MemoryManager* fMemoryManager; + + friend class XTemplateSerializer; + +}; + +SortArray::SortArray(const XMLSize_t size + , MemoryManager* const manager ) +:fCur(0) +,fSize(size) +,fMemoryManager(manager) +{ + fElemList = (const KeySet**) fMemoryManager->allocate(size * sizeof (KeySet*)); +} + +SortArray::~SortArray() +{ + for (XMLSize_t i=0; i< fSize; i++) + delete fElemList[i]; + + fMemoryManager->deallocate(fElemList); +} + +inline +const KeySet* SortArray::elementAt(const XMLSize_t index) const +{ + assert(index < fCur); + return fElemList[index]; +} + +void SortArray::addElement(const KeySet* const keySet) +{ + assert(fCur < fSize); + fElemList[fCur++]=keySet; +} + +void SortArray::sort() +{ + assert(fCur == fSize); + //dump(); + qsort(fElemList, fSize, sizeof (KeySet*), compareKeySet); + //dump(); +} + +void SortArray::dump() const +{ + printf("\n fSize=<%d>, fCur=<%d>\n", fSize, fCur); + for (XMLSize_t i = 0; i < fCur; i++) + fElemList[i]->print(); +} + +#define GET_NEXT_KEYSET() \ + const KeySet* keySet = sortArray.elementAt(i); \ + const XMLCh* strKey = 0; \ + int intKey1 = 0; \ + int intKey2 = 0; \ + keySet->getKeys(strKey, intKey1, intKey2); + +#define SORT_KEYSET_ONEKEY(MM) \ + SortArray sortArray(itemNumber, MM); \ + while (e.hasMoreElements()) \ + { \ + KeySet* keySet = new (MM) KeySet((XMLCh*) e.nextElementKey(), 0, 0, MM); \ + sortArray.addElement(keySet); \ + } \ + sortArray.sort(); + +#define SORT_KEYSET_TWOKEYS(MM) \ + SortArray sortArray(itemNumber, MM); \ + while (e.hasMoreElements()) \ + { \ + XMLCh* strKey; \ + int intKey; \ + e.nextElementKey((void*&)strKey, intKey); \ + KeySet* keySet = new (MM) KeySet(strKey, intKey, 0, MM); \ + sortArray.addElement(keySet); \ + } \ + sortArray.sort(); + +#endif + +/********************************************************** + * + * ValueVectorOf + * + * SchemaElementDecl* + * unsigned int + * + ***********************************************************/ +void XTemplateSerializer::storeObject(ValueVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorSize = objToStore->size(); + serEng.writeSize (vectorSize); + + for ( XMLSize_t i = 0; i < vectorSize; i++) + { + SchemaElementDecl*& data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toCallDestructor + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + ValueVectorOf( + initSize + , serEng.getMemoryManager() + , toCallDestructor + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorSize = 0; + serEng.readSize (vectorSize); + + for (XMLSize_t i = 0; i < vectorSize; i++) + { + SchemaElementDecl* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } +} + +void XTemplateSerializer::storeObject(ValueVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorSize = objToStore->size(); + serEng.writeSize (vectorSize); + + for (XMLSize_t i = 0; i < vectorSize; i++) + { + unsigned int& data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toCallDestructor + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + ValueVectorOf( + initSize + , serEng.getMemoryManager() + , toCallDestructor + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorSize = 0; + serEng.readSize (vectorSize); + + for (XMLSize_t i = 0; i < vectorSize; i++) + { + unsigned int data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +/********************************************************** + * + * RefArrayVectorOf + * + * XMLCh + * + ***********************************************************/ + +void XTemplateSerializer::storeObject(RefArrayVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorSize = objToStore->size(); + serEng.writeSize (vectorSize); + + for (XMLSize_t i = 0; i < vectorSize; i++) + { + serEng.writeString(objToStore->elementAt(i)); + } + } + +} + +void XTemplateSerializer::loadObject(RefArrayVectorOf** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefArrayVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorSize = 0; + serEng.readSize (vectorSize); + + for (XMLSize_t i = 0; i < vectorSize; i++) + { + XMLCh* data; + serEng.readString(data); + (*objToLoad)->addElement(data); + } + } + +} + +/********************************************************** + * + * RefVectorOf + * + * SchemaAttDef + * SchemaElementDecl + * ContentSpecNode + * IC_Field + * DatatypeValidator + * IdentityConstraint + * XMLNumber + * XercesLocationPath + * XercesStep + * + ***********************************************************/ + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + SchemaAttDef* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + SchemaAttDef* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + SchemaElementDecl* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + SchemaElementDecl* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + ContentSpecNode* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + ContentSpecNode* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + IC_Field* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + IC_Field* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + DatatypeValidator* data = objToStore->elementAt(i); + DatatypeValidator::storeDV(serEng, data); + } + } + +} + +void XTemplateSerializer::loadObject(RefVectorOf** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + DatatypeValidator* data; + data = DatatypeValidator::loadDV(serEng); + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + IdentityConstraint* data = objToStore->elementAt(i); + IdentityConstraint::storeIC(serEng, data); + } + } + +} + +void XTemplateSerializer::loadObject(RefVectorOf** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + IdentityConstraint* data; + data = IdentityConstraint::loadIC(serEng); + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + XMLNumber* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XMLNumber::NumberType numType + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + XMLNumber* data; + data = XMLNumber::loadNumber(numType , serEng); + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for ( XMLSize_t i = 0; i < vectorLength; i++) + { + XercesLocationPath* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + XercesLocationPath* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +void XTemplateSerializer::storeObject(RefVectorOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + XMLSize_t vectorLength = objToStore->size(); + serEng.writeSize (vectorLength); + + for (XMLSize_t i = 0; i < vectorLength; i++) + { + XercesStep* data = objToStore->elementAt(i); + serEng<** objToLoad + , int initSize + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + RefVectorOf( + initSize + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t vectorLength = 0; + serEng.readSize (vectorLength); + for (XMLSize_t i = 0 ; i < vectorLength; i++) + { + XercesStep* data; + serEng>>data; + (*objToLoad)->addElement(data); + } + } + +} + +/********************************************************** + * + * RefHashTableOf + * + * KVStringPair + * XMLAttDef + * DTDAttDef + * ComplexTypeInfo + * XercesGroupInfo + * XercesAttGroupInfo + * XMLRefInfo + * DatatypeValidator + * Grammar + * XSAnnotation + * + ***********************************************************/ +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + KVStringPair* data = objToStore->get(strKey); + serEng<get(e.nextElementKey()); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + KVStringPair* data; + serEng>>data; + + (*objToLoad)->put((void*)data->getKey(), data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + XMLAttDef* data = objToStore->get(strKey); + serEng<get(e.nextElementKey()); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + //This is used solely by SchemaGrammar and by all means it must be + //SchemaAttDef, ideally we may change it to RefHashTableOf + //later on. + //Affected files IGXMLScanner, SGXMLScanner, SchemaGrammar, TraverseSchema + //XMLAttDef* data; + SchemaAttDef* data; + serEng>>data; + + (*objToLoad)->put((void*)data->getAttName()->getLocalPart(), data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + DTDAttDef* data = objToStore->get(strKey); + serEng<get(e.nextElementKey()); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + DTDAttDef* data; + serEng>>data; + + (*objToLoad)->put((void*)data->getFullName(), data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + ComplexTypeInfo* data = objToStore->get(strKey); + serEng<get(e.nextElementKey()); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + ComplexTypeInfo* data; + serEng>>data; + + (*objToLoad)->put((void*)data->getTypeName(), data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + unsigned int id = serEng.getStringPool()->getId(strKey); + serEng<get(strKey); + serEng<getId(key); + + // key = StringPool->getValueForId(XercesGroupInfo::getNameSpaceId()) + // + chComma + // + StringPool->getValueForId(XercesGroupInfo::getNameId()) + // + // and the key is guranteed in the StringPool + // + // + // if (id == 0) + // { + // throw exception + // } + // + + serEng<get(key); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + unsigned int id; + serEng>>id; + + XMLCh* key = (XMLCh*) serEng.getStringPool()->getValueForId(id); + + XercesGroupInfo* data; + serEng>>data; + + (*objToLoad)->put((void*)key, data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + XercesAttGroupInfo* data = objToStore->get(strKey); + serEng<get(e.nextElementKey()); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + XercesAttGroupInfo* data; + serEng>>data; + + XMLCh* key = (XMLCh*) serEng.getStringPool()->getValueForId(data->getNameId()); + (*objToLoad)->put((void*)key, data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + serEng.writeString(strKey); + + XMLRefInfo* data = objToStore->get(strKey); + serEng<get(key); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + XMLCh* key; + serEng.readString(key); + + XMLRefInfo* data; + serEng>>data; + + (*objToLoad)->put((void*)key, data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + + if (serEng.needToStoreObject(objToStore)) + { + + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + DatatypeValidator* data = objToStore->get(strKey); + DatatypeValidator::storeDV(serEng, data); + } +#else + while (e.hasMoreElements()) + { + /*** + * to do: verify valid id + * + * XMLCh* key = (XMLCh*) e.nextElementKey(); + * unsigned int id = serEng.getStringPool()->getId(key); + * if (id == 0) + * throw exception + ***/ + DatatypeValidator* data = objToStore->get(e.nextElementKey()); + DatatypeValidator::storeDV(serEng, data); + } +#endif + } +} + +void XTemplateSerializer::loadObject(RefHashTableOf** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + DatatypeValidator* data; + data = DatatypeValidator::loadDV(serEng); + + /*** + * restore the key + ***/ + XMLCh* typeUri = (XMLCh*) data->getTypeUri(); + XMLCh* typeLocal = (XMLCh*) data->getTypeLocalName(); + XMLSize_t uriLen = XMLString::stringLen(typeUri); + XMLSize_t localLen = XMLString::stringLen(typeLocal); + XMLCh* typeKey = (XMLCh*) serEng.getMemoryManager()->allocate + ( + (uriLen + localLen + 2) * sizeof(XMLCh) + ); + // "typeuri,typeLocal" + XMLString::moveChars(typeKey, typeUri, uriLen+1); + typeKey[uriLen] = chComma; + XMLString::moveChars(&typeKey[uriLen+1], typeLocal, localLen+1); + typeKey[uriLen + localLen + 1] = chNull; + ArrayJanitor janName(typeKey, serEng.getMemoryManager()); + + /* + * get the string from string pool + * + * to do: + ***/ + unsigned int id = serEng.getStringPool()->getId(typeKey); + XMLCh* refKey = (XMLCh*) serEng.getStringPool()->getValueForId(id); + + (*objToLoad)->put((void*)refKey, data); + } + } +} + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + XMLSize_t itemNumber = 0; + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_ONEKEY(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + Grammar* data = objToStore->get(strKey); + Grammar::storeGrammar(serEng, data); + } +#else + while (e.hasMoreElements()) + { + Grammar* data = objToStore->get(e.nextElementKey()); + Grammar::storeGrammar(serEng, data); + } +#endif + + } +} + +void XTemplateSerializer::loadObject(RefHashTableOf** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + Grammar* data; + data = Grammar::loadGrammar(serEng); + + XMLCh* key = (XMLCh*) data->getGrammarDescription()->getGrammarKey(); + (*objToLoad)->put(key, data); + } + } +} + + +void XTemplateSerializer::storeObject(RefHashTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHashTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //get the total item number + unsigned int itemNumber = 0; + while (e.hasMoreElements()) + { + void* key = e.nextElementKey(); + XSerializeEngine::XSerializedObjectId_t keyId = serEng.lookupStorePool(key); + + if (keyId) + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + + //to sort the key + //though keyId is not supposed to be involved in compare + //we merely use the KeySet to encap both the string key and keyid + SortArray sortArray(itemNumber, objToStore->getMemoryManager()); + while (e.hasMoreElements()) + { + void* key = e.nextElementKey(); + XSerializeEngine::XSerializedObjectId_t keyId = serEng.lookupStorePool(key); + + if (keyId) + { + KeySet* keySet = + new (objToStore->getMemoryManager()) KeySet((XMLCh*)key, keyId, 0, objToStore->getMemoryManager()); + sortArray.addElement(keySet); + } + + } + + sortArray.sort(); + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + XSerializeEngine::XSerializedObjectId_t keyId = (XSerializeEngine::XSerializedObjectId_t)intKey1; + XSAnnotation* data = objToStore->get(strKey); + + serEng< ids(16, serEng.getMemoryManager()); + ValueVectorOf keys(16, serEng.getMemoryManager()); + + while (e.hasMoreElements()) + { + void* key = e.nextElementKey(); + XSerializeEngine::XSerializedObjectId_t keyId = serEng.lookupStorePool(key); + + if (keyId) + { + ids.addElement(keyId); + keys.addElement(key); + } + } + + XMLSize_t itemNumber = ids.size(); + serEng.writeSize (itemNumber); + + for (XMLSize_t i=0; iget(keys.elementAt(i)); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHashTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + XMLSize_t itemIndex; + XSerializeEngine::XSerializedObjectId_t keyId; + void* key; + XSAnnotation* data; + if (!serEng.fGrammarPool->getIgnoreSerializedAnnotations()) { + for (itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + serEng>>keyId; + key = serEng.lookupLoadPool(keyId); + serEng>>data; + (*objToLoad)->put(key, data); + } + } + else { + for (itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + serEng>>keyId; + key = serEng.lookupLoadPool(keyId); + serEng>>data; + delete data; + } + } + } +} + +/********************************************************** + * + * RefHash2KeysTableOf + * + * SchemaAttDef + * ElemVector + * + ***********************************************************/ +void XTemplateSerializer::storeObject(RefHash2KeysTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + XMLSize_t itemNumber = 0; + + RefHash2KeysTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + //to sort the key + SORT_KEYSET_TWOKEYS(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + SchemaAttDef* data = objToStore->get(strKey, intKey1); + serEng<get(key1, key2); + serEng<** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHash2KeysTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + SchemaAttDef* data; + serEng>>data; + + XMLCh* key1 = data->getAttName()->getLocalPart(); + int key2 = data->getAttName()->getURI(); + //key2==data->getId() + (*objToLoad)->put((void*)key1, key2, data); + + } + + } + +} + +void XTemplateSerializer::storeObject(RefHash2KeysTableOf* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + XMLSize_t itemNumber = 0; + + RefHash2KeysTableOfEnumerator e(objToStore, false, objToStore->getMemoryManager()); + + while (e.hasMoreElements()) + { + e.nextElement(); + itemNumber++; + } + + serEng.writeSize (itemNumber); + e.Reset(); + +#ifdef XERCES_DEBUG_SORT_GRAMMAR + + //to sort the key + SORT_KEYSET_TWOKEYS(serEng.getMemoryManager()) + + //to store the data + for (XMLSize_t i=0; i < itemNumber; i++) + { + GET_NEXT_KEYSET() + + serEng.writeString(strKey); + serEng<get(strKey, intKey1); + storeObject(data, serEng); + } +#else + + while (e.hasMoreElements()) + { + void* key1; + int key2; + + e.nextElementKey(key1, key2); + serEng.writeString((const XMLCh*)key1); + serEng<get(key1, key2); + storeObject(data, serEng); + + } +#endif + } + +} + +void XTemplateSerializer::loadObject(RefHash2KeysTableOf** objToLoad + , int + , bool toAdopt + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHash2KeysTableOf( + hashModulus + , toAdopt + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + XMLCh* key1; + serEng.readString(key1); + + int key2; + serEng>>key2; + + ElemVector* data = 0; + + //don't call destructor + loadObject(&data, 8, false, serEng); + + /*** + * + * There must be one element in the vector whose + * susbititutionGroupElem matches the (key1,key2) + * + ***/ + + // bool FOUND=false; + + XMLSize_t vectorSize = data->size(); + for ( XMLSize_t i = 0; i < vectorSize; i++) + { + SchemaElementDecl*& elem = data->elementAt(i); + SchemaElementDecl* subElem = elem->getSubstitutionGroupElem(); + XMLCh* elemName = subElem->getBaseName(); + int uri = subElem->getURI(); + if (XMLString::equals(elemName, key1) && + (uri == key2) ) + { + //release the temp + serEng.getMemoryManager()->deallocate(key1); + key1 = elemName; + //FOUND=true; + break; + } + } + + /*** + * if (!FOUND) + * { + * throw exception + * } + ***/ + + (*objToLoad)->put((void*)key1, key2, data); + + } + + } +} + +/********************************************************** + * + * RefHash3KeysIdPool + * + * SchemaElementDecl + * + * maintain the same order through id + ***********************************************************/ +void XTemplateSerializer::storeObject(RefHash3KeysIdPool* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + serEng.writeSize (objToStore->getHashModulus()); + + RefHash3KeysIdPoolEnumerator e(objToStore, false, objToStore->getMemoryManager()); + + serEng.writeSize (e.size()); + + void* strkey; + int key1; + int key2; + /* Update to store key2 separately as for the putGroupElemDecl the key is not the + enclosing scope but another value. */ + while (e.hasMoreKeys()) + { + e.nextElementKey(strkey, key1, key2); + serEng<getByKey(strkey, key1, key2); + serEng<** objToLoad + , int + , bool toAdopt + , int initSize2 + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + XMLSize_t hashModulus; + serEng.readSize (hashModulus); + + if (!*objToLoad) + { + *objToLoad = new (serEng.getMemoryManager()) + RefHash3KeysIdPool( + hashModulus + , toAdopt + , initSize2 + , serEng.getMemoryManager()); + } + + serEng.registerObject(*objToLoad); + + XMLSize_t itemNumber = 0; + serEng.readSize (itemNumber); + + int scopeKey; + SchemaElementDecl* elemDecl; + for (XMLSize_t itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + serEng>>scopeKey; + serEng>>elemDecl; + + (*objToLoad)->put(elemDecl->getBaseName() + , elemDecl->getURI() + , scopeKey + , elemDecl); + } + + } + +} + +/********************************************************** + * + * NameIdPool + * no NameIdPool::nextElementKey() + * + * DTDElementDecl + * DTDEntityDecl + * XMLNotationDecl + * + * maintain the same order through id + ***********************************************************/ +void XTemplateSerializer::storeObject(NameIdPool* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + NameIdPoolEnumerator e(objToStore, objToStore->getMemoryManager()); + + serEng<<(unsigned int)e.size(); + + while (e.hasMoreElements()) + { + DTDElementDecl& data = e.nextElement(); + data.serialize(serEng); + } + } + +} + +void XTemplateSerializer::loadObject(NameIdPool** objToLoad + , int initSize + , int initSize2 + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + NameIdPool( + initSize + , initSize2 + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + unsigned int itemNumber = 0; + serEng >> itemNumber; + + for (unsigned int itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + DTDElementDecl* data = new (serEng.getMemoryManager()) + DTDElementDecl(serEng.getMemoryManager()); + data->serialize(serEng); + (*objToLoad)->put(data); + } + } +} + +void XTemplateSerializer::storeObject(NameIdPool* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + NameIdPoolEnumerator e(objToStore, objToStore->getMemoryManager()); + + serEng<<(unsigned int)e.size(); + + while (e.hasMoreElements()) + { + DTDEntityDecl& data = e.nextElement(); + data.serialize(serEng); + } + } +} + +void XTemplateSerializer::loadObject(NameIdPool** objToLoad + , int initSize + , int initSize2 + , XSerializeEngine& serEng) +{ + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + NameIdPool( + initSize + , initSize2 + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + unsigned int itemNumber = 0; + serEng >> itemNumber; + + for (unsigned int itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + DTDEntityDecl* data = new (serEng.getMemoryManager()) + DTDEntityDecl(serEng.getMemoryManager()); + data->serialize(serEng); + (*objToLoad)->put(data); + } + } +} + +void XTemplateSerializer::storeObject(NameIdPool* const objToStore + , XSerializeEngine& serEng) +{ + if (serEng.needToStoreObject(objToStore)) + { + NameIdPoolEnumerator e(objToStore, objToStore->getMemoryManager()); + + serEng<<(unsigned int)e.size(); + + while (e.hasMoreElements()) + { + XMLNotationDecl& data = e.nextElement(); + data.serialize(serEng); + } + } +} + +void XTemplateSerializer::loadObject(NameIdPool** objToLoad + , int initSize + , int initSize2 + , XSerializeEngine& serEng) +{ + + if (serEng.needToLoadObject((void**)objToLoad)) + { + if (!*objToLoad) + { + if (initSize < 0) + initSize = 16; + + *objToLoad = new (serEng.getMemoryManager()) + NameIdPool( + initSize + , initSize2 + , serEng.getMemoryManager() + ); + } + + serEng.registerObject(*objToLoad); + + unsigned int itemNumber = 0; + serEng >> itemNumber; + + for (unsigned int itemIndex = 0; itemIndex < itemNumber; itemIndex++) + { + XMLNotationDecl* data = new (serEng.getMemoryManager()) + XMLNotationDecl(serEng.getMemoryManager()); + data->serialize(serEng); + (*objToLoad)->put(data); + } + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.hpp b/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.hpp new file mode 100644 index 000000000..a980629a3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/internal/XTemplateSerializer.hpp @@ -0,0 +1,365 @@ +/* + * 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: XTemplateSerializer.hpp 678409 2008-07-21 13:08:10Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XTEMPLATE_SERIALIZER_HPP) +#define XERCESC_INCLUDE_GUARD_XTEMPLATE_SERIALIZER_HPP + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XTemplateSerializer +{ +public: + + /********************************************************** + * + * ValueVectorOf + * + * SchemaElementDecl* + * unsigned int + * + ***********************************************************/ + static void storeObject(ValueVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(ValueVectorOf** tempObjToRead + , int initSize + , bool toCallDestructor + , XSerializeEngine& serEng); + + static void storeObject(ValueVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(ValueVectorOf** tempObjToRead + , int initSize + , bool toCallDestructor + , XSerializeEngine& serEng); + + /********************************************************** + * + * RefArrayVectorOf + * + * XMLCh + * + ***********************************************************/ + static void storeObject(RefArrayVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefArrayVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + /********************************************************** + * + * RefVectorOf + * + * SchemaAttDef + * SchemaElementDecl + * ContentSpecNode + * IC_Field + * DatatypeValidator + * IdentityConstraint + * XMLNumber + * XercesLocationPath + * XercesStep + * + ***********************************************************/ + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XMLNumber::NumberType numType + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefVectorOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefVectorOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + /********************************************************** + * + * RefHashTableOf + * + * KVStringPair + * XMLAttDef + * DTDAttDef + * ComplexTypeInfo + * XercesGroupInfo + * XercesAttGroupInfo + * XMLRefInfo + * DatatypeValidator + * Grammar + * XSAnnotation + * + ***********************************************************/ + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHashTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHashTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + /********************************************************** + * + * RefHash2KeysTableOf + * + * SchemaAttDef + * ElemVector + * + ***********************************************************/ + static void storeObject(RefHash2KeysTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHash2KeysTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + static void storeObject(RefHash2KeysTableOf* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHash2KeysTableOf** tempObjToRead + , int initSize + , bool toAdopt + , XSerializeEngine& serEng); + + /********************************************************** + * + * RefHash3KeysIdPool + * + * SchemaElementDecl + * + ***********************************************************/ + static void storeObject(RefHash3KeysIdPool* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(RefHash3KeysIdPool** tempObjToRead + , int initSize + , bool toAdopt + , int initSize2 + , XSerializeEngine& serEng); + + /********************************************************** + * + * NameIdPool + * + * DTDElementDecl + * DTDEntityDecl + * XMLNotationDecl + * + ***********************************************************/ + static void storeObject(NameIdPool* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(NameIdPool** tempObjToRead + , int initSize + , int initSize2 + , XSerializeEngine& serEng); + + static void storeObject(NameIdPool* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(NameIdPool** tempObjToRead + , int initSize + , int initSize2 + , XSerializeEngine& serEng); + + static void storeObject(NameIdPool* const tempObjToWrite + , XSerializeEngine& serEng); + + static void loadObject(NameIdPool** tempObjToRead + , int initSize + , int initSize2 + , XSerializeEngine& serEng); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ~XTemplateSerializer(); + XTemplateSerializer(); + XTemplateSerializer(const XTemplateSerializer&); + XTemplateSerializer& operator=(const XTemplateSerializer&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.cpp b/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.cpp new file mode 100644 index 000000000..ee803e418 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.cpp @@ -0,0 +1,1784 @@ +/* + * 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. + */ + +/** +* This file contains code to build the DOM tree. It registers a document +* handler with the scanner. In these handler methods, appropriate DOM nodes +* are created and added to the DOM tree. +* +* $Id: AbstractDOMParser.cpp 935358 2010-04-18 15:40:35Z borisk $ +* +*/ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Constructors and Destructor +// --------------------------------------------------------------------------- + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ResetInProgressType; + + +AbstractDOMParser::AbstractDOMParser( XMLValidator* const valToAdopt + , MemoryManager* const manager + , XMLGrammarPool* const gramPool) : + + fCreateEntityReferenceNodes(true) +, fIncludeIgnorableWhitespace(true) +, fWithinElement(false) +, fParseInProgress(false) +, fCreateCommentNodes(true) +, fDocumentAdoptedByUser(false) +, fCreateSchemaInfo(false) +, fDoXInclude(false) +, fScanner(0) +, fImplementationFeatures(0) +, fCurrentParent(0) +, fCurrentNode(0) +, fCurrentEntity(0) +, fDocument(0) +, fDocumentType(0) +, fDocumentVector(0) +, fGrammarResolver(0) +, fURIStringPool(0) +, fValidator(valToAdopt) +, fMemoryManager(manager) +, fGrammarPool(gramPool) +, fBufMgr(manager) +, fInternalSubset(fBufMgr.bidOnBuffer()) +, fPSVIHandler(0) +{ + CleanupType cleanup(this, &AbstractDOMParser::cleanUp); + + try + { + initialize(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +AbstractDOMParser::~AbstractDOMParser() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Initialize/CleanUp methods +// --------------------------------------------------------------------------- +void AbstractDOMParser::initialize() +{ + // Create grammar resolver and string pool to pass to the scanner + fGrammarResolver = new (fMemoryManager) GrammarResolver(fGrammarPool, fMemoryManager); + fURIStringPool = fGrammarResolver->getStringPool(); + + // Create a scanner and tell it what validator to use. Then set us + // as the document event handler so we can fill the DOM document. + fScanner = XMLScannerResolver::getDefaultScanner(fValidator, fGrammarResolver, fMemoryManager); + fScanner->setDocHandler(this); + fScanner->setDocTypeHandler(this); + fScanner->setURIStringPool(fURIStringPool); + + this->reset(); +} + +void AbstractDOMParser::cleanUp() +{ + if (fDocumentVector) + delete fDocumentVector; + + if (!fDocumentAdoptedByUser && fDocument) + fDocument->release(); + + delete fScanner; + delete fGrammarResolver; + // grammar pool *always* owns this + //delete fURIStringPool; + fMemoryManager->deallocate(fImplementationFeatures); + + if (fValidator) + delete fValidator; +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Utilities +// --------------------------------------------------------------------------- +void AbstractDOMParser::reset() +{ + // if fDocument exists already, store the old pointer in the vector for deletion later + if (fDocument && !fDocumentAdoptedByUser) { + if (!fDocumentVector) { + // allocate the vector if not exists yet + fDocumentVector = new (fMemoryManager) RefVectorOf(10, true, fMemoryManager) ; + } + fDocumentVector->addElement(fDocument); + } + + fDocument = 0; + resetDocType(); + fCurrentParent = 0; + fCurrentNode = 0; + fCurrentEntity = 0; + fWithinElement = false; + fDocumentAdoptedByUser = false; + fInternalSubset.reset(); +} + + +void AbstractDOMParser::resetInProgress() +{ + fParseInProgress = false; +} + + +void AbstractDOMParser::resetPool() +{ + // We cannot enter here while a regular parse is in progress. + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + if (fDocumentVector) + fDocumentVector->removeAllElements(); + + if (!fDocumentAdoptedByUser && fDocument) + fDocument->release(); + + fDocument = 0; +} + +bool AbstractDOMParser::isDocumentAdopted() const +{ + return fDocumentAdoptedByUser; +} + +DOMDocument* AbstractDOMParser::adoptDocument() +{ + fDocumentAdoptedByUser = true; + return fDocument; +} + + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Getter methods +// --------------------------------------------------------------------------- +DOMDocument* AbstractDOMParser::getDocument() +{ + return fDocument; +} + +const XMLValidator& AbstractDOMParser::getValidator() const +{ + return *fScanner->getValidator(); +} + +bool AbstractDOMParser::getDoNamespaces() const +{ + return fScanner->getDoNamespaces(); +} + +bool AbstractDOMParser::getGenerateSyntheticAnnotations() const +{ + return fScanner->getGenerateSyntheticAnnotations(); +} + +bool AbstractDOMParser::getValidateAnnotations() const +{ + return fScanner->getValidateAnnotations(); +} + +bool AbstractDOMParser::getExitOnFirstFatalError() const +{ + return fScanner->getExitOnFirstFatal(); +} + +bool AbstractDOMParser::getValidationConstraintFatal() const +{ + return fScanner->getValidationConstraintFatal(); +} + +AbstractDOMParser::ValSchemes AbstractDOMParser::getValidationScheme() const +{ + const XMLScanner::ValSchemes scheme = fScanner->getValidationScheme(); + + if (scheme == XMLScanner::Val_Always) + return Val_Always; + else if (scheme == XMLScanner::Val_Never) + return Val_Never; + + return Val_Auto; +} + +bool AbstractDOMParser::getDoSchema() const +{ + return fScanner->getDoSchema(); +} + +bool AbstractDOMParser::getValidationSchemaFullChecking() const +{ + return fScanner->getValidationSchemaFullChecking(); +} + +bool AbstractDOMParser::getIdentityConstraintChecking() const +{ + return fScanner->getIdentityConstraintChecking(); +} + +XMLSize_t AbstractDOMParser::getErrorCount() const +{ + return fScanner->getErrorCount(); +} + +XMLCh* AbstractDOMParser::getExternalSchemaLocation() const +{ + return fScanner->getExternalSchemaLocation(); +} + +XMLCh* AbstractDOMParser::getExternalNoNamespaceSchemaLocation() const +{ + return fScanner->getExternalNoNamespaceSchemaLocation(); +} + +SecurityManager* AbstractDOMParser::getSecurityManager() const +{ + return fScanner->getSecurityManager(); +} + +// Return it as a reference so that we cn return as void* from getParameter. +// +const XMLSize_t& AbstractDOMParser::getLowWaterMark() const +{ + return fScanner->getLowWaterMark(); +} + +bool AbstractDOMParser::getLoadExternalDTD() const +{ + return fScanner->getLoadExternalDTD(); +} + +bool AbstractDOMParser::getLoadSchema() const +{ + return fScanner->getLoadSchema(); +} + +bool AbstractDOMParser::getCalculateSrcOfs() const +{ + return fScanner->getCalculateSrcOfs(); +} + +bool AbstractDOMParser::getStandardUriConformant() const +{ + return fScanner->getStandardUriConformant(); +} + +bool AbstractDOMParser::getIgnoreAnnotations() const +{ + return fScanner->getIgnoreAnnotations(); +} + +bool AbstractDOMParser::getDisableDefaultEntityResolution() const +{ + return fScanner->getDisableDefaultEntityResolution(); +} + +bool AbstractDOMParser::getSkipDTDValidation() const +{ + return fScanner->getSkipDTDValidation(); +} + +bool AbstractDOMParser::getHandleMultipleImports() const +{ + return fScanner->getHandleMultipleImports(); +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Setter methods +// --------------------------------------------------------------------------- +void AbstractDOMParser::setPSVIHandler(PSVIHandler* const handler) +{ + fPSVIHandler = handler; + if (fPSVIHandler) { + fScanner->setPSVIHandler(this); + } + else if(!fCreateSchemaInfo) { + fScanner->setPSVIHandler(0); + } +} + + +void AbstractDOMParser::setDoNamespaces(const bool newState) +{ + fScanner->setDoNamespaces(newState); +} + +void AbstractDOMParser::setGenerateSyntheticAnnotations(const bool newState) +{ + fScanner->setGenerateSyntheticAnnotations(newState); +} + +void AbstractDOMParser::setValidateAnnotations(const bool newState) +{ + fScanner->setValidateAnnotations(newState); +} + +void AbstractDOMParser::setExitOnFirstFatalError(const bool newState) +{ + fScanner->setExitOnFirstFatal(newState); +} + +void AbstractDOMParser::setValidationConstraintFatal(const bool newState) +{ + fScanner->setValidationConstraintFatal(newState); +} + +void AbstractDOMParser::setValidationScheme(const ValSchemes newScheme) +{ + if (newScheme == Val_Never) + fScanner->setValidationScheme(XMLScanner::Val_Never); + else if (newScheme == Val_Always) + fScanner->setValidationScheme(XMLScanner::Val_Always); + else + fScanner->setValidationScheme(XMLScanner::Val_Auto); +} + +void AbstractDOMParser::setDoSchema(const bool newState) +{ + fScanner->setDoSchema(newState); +} + +void AbstractDOMParser::setValidationSchemaFullChecking(const bool schemaFullChecking) +{ + fScanner->setValidationSchemaFullChecking(schemaFullChecking); +} + +void AbstractDOMParser::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fScanner->setIdentityConstraintChecking(identityConstraintChecking); +} + +void AbstractDOMParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) +{ + fScanner->setExternalSchemaLocation(schemaLocation); +} +void AbstractDOMParser::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation) +{ + fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); +} + +void AbstractDOMParser::setExternalSchemaLocation(const char* const schemaLocation) +{ + fScanner->setExternalSchemaLocation(schemaLocation); +} +void AbstractDOMParser::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation) +{ + fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); +} + +void AbstractDOMParser::setSecurityManager(SecurityManager* const securityManager) +{ + // since this could impact various components, don't permit it to change + // during a parse + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + fScanner->setSecurityManager(securityManager); +} + +void AbstractDOMParser::setLowWaterMark(XMLSize_t lwm) +{ + fScanner->setLowWaterMark(lwm); +} + +void AbstractDOMParser::setLoadExternalDTD(const bool newState) +{ + fScanner->setLoadExternalDTD(newState); +} + +void AbstractDOMParser::setLoadSchema(const bool newState) +{ + fScanner->setLoadSchema(newState); +} + +void AbstractDOMParser::setCalculateSrcOfs(const bool newState) +{ + fScanner->setCalculateSrcOfs(newState); +} + +void AbstractDOMParser::setStandardUriConformant(const bool newState) +{ + fScanner->setStandardUriConformant(newState); +} + +void AbstractDOMParser::useScanner(const XMLCh* const scannerName) +{ + XMLScanner* tempScanner = XMLScannerResolver::resolveScanner + ( + scannerName + , fValidator + , fGrammarResolver + , fMemoryManager + ); + + if (tempScanner) { + + tempScanner->setParseSettings(fScanner); + tempScanner->setURIStringPool(fURIStringPool); + delete fScanner; + fScanner = tempScanner; + } +} + +void AbstractDOMParser::setCreateSchemaInfo(const bool create) +{ + fCreateSchemaInfo = create; + if(fCreateSchemaInfo) + fScanner->setPSVIHandler(this); + else if(!fPSVIHandler) + fScanner->setPSVIHandler(0); +} + +void AbstractDOMParser::setIgnoreAnnotations(const bool newValue) +{ + fScanner->setIgnoreAnnotations(newValue); +} + +void AbstractDOMParser::setDisableDefaultEntityResolution(const bool newValue) +{ + fScanner->setDisableDefaultEntityResolution(newValue); +} + +void AbstractDOMParser::setSkipDTDValidation(const bool newValue) +{ + fScanner->setSkipDTDValidation(newValue); +} + +void AbstractDOMParser::setHandleMultipleImports(const bool newValue) +{ + fScanner->setHandleMultipleImports(newValue); +} + +void AbstractDOMParser::setDocument(DOMDocument* toSet) +{ + fDocument = (DOMDocumentImpl *)toSet; +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Parsing methods +// --------------------------------------------------------------------------- +void AbstractDOMParser::parse(const InputSource& source) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &AbstractDOMParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(source); + + if (fDoXInclude && getErrorCount()==0){ + DOMDocument *doc = getDocument(); + // after XInclude, the document must be normalized + if(doc) + doc->normalizeDocument(); + } + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void AbstractDOMParser::parse(const XMLCh* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &AbstractDOMParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + + if (fDoXInclude && getErrorCount()==0){ + DOMDocument *doc = getDocument(); + // after XInclude, the document must be normalized + if(doc) + doc->normalizeDocument(); + } + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void AbstractDOMParser::parse(const char* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &AbstractDOMParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + + if (fDoXInclude && getErrorCount()==0){ + DOMDocument *doc = getDocument(); + // after XInclude, the document must be normalized + if(doc) + doc->normalizeDocument(); + } + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + + + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Progressive parse methods +// --------------------------------------------------------------------------- +bool AbstractDOMParser::parseFirst( const XMLCh* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool AbstractDOMParser::parseFirst( const char* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool AbstractDOMParser::parseFirst( const InputSource& source + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(source, toFill); +} + +bool AbstractDOMParser::parseNext(XMLPScanToken& token) +{ + return fScanner->scanNext(token); +} + +void AbstractDOMParser::parseReset(XMLPScanToken& token) +{ + // Reset the scanner, and then reset the parser + fScanner->scanReset(token); + reset(); +} + + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Implementation of PSVIHandler interface +// --------------------------------------------------------------------------- +void AbstractDOMParser::handleElementPSVI(const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo) +{ + // associate the info now; if the user wants, she can override what we did + if(fCreateSchemaInfo) + { + DOMTypeInfoImpl* typeInfo=new (getDocument()) DOMTypeInfoImpl(); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Validity, elementInfo->getValidity()); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted, elementInfo->getValidationAttempted()); + if(elementInfo->getTypeDefinition()) + { + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, elementInfo->getTypeDefinition()->getTypeCategory()); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, elementInfo->getTypeDefinition()->getAnonymous()); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, + fDocument->getPooledString(elementInfo->getTypeDefinition()->getNamespace())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, + fDocument->getPooledString(elementInfo->getTypeDefinition()->getName())); + } + else if(elementInfo->getValidity()==PSVIItem::VALIDITY_VALID) + { + // if we are valid but we don't have a type validator, we are xs:anyType + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, XSTypeDefinition::COMPLEX_TYPE); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, false); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, SchemaSymbols::fgATTVAL_ANYTYPE); + } + if(elementInfo->getMemberTypeDefinition()) + { + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous, elementInfo->getMemberTypeDefinition()->getAnonymous()); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace, + fDocument->getPooledString(elementInfo->getMemberTypeDefinition()->getNamespace())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name, + fDocument->getPooledString(elementInfo->getMemberTypeDefinition()->getName())); + } + if(elementInfo->getElementDeclaration()) + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Nil, elementInfo->getElementDeclaration()->getNillable()); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default, fDocument->getPooledString(elementInfo->getSchemaDefault())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value, fDocument->getPooledString(elementInfo->getSchemaNormalizedValue())); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified, true); + ((DOMElementNSImpl*)fCurrentParent)->setSchemaTypeInfo(typeInfo); + } + if(fPSVIHandler) + fPSVIHandler->handleElementPSVI(localName, uri, elementInfo); +} + +void AbstractDOMParser::handlePartialElementPSVI(const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo) +{ + if(fPSVIHandler) + fPSVIHandler->handlePartialElementPSVI(localName, uri, elementInfo); +} + +void AbstractDOMParser::handleAttributesPSVI( const XMLCh* const localName + , const XMLCh* const uri + , PSVIAttributeList * psviAttributes) +{ + if(fCreateSchemaInfo) + { + for (XMLSize_t index=0; index < psviAttributes->getLength(); index++) { + XERCES_CPP_NAMESPACE_QUALIFIER PSVIAttribute *attrInfo=psviAttributes->getAttributePSVIAtIndex(index); + XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* pAttrNode=fCurrentNode->getAttributes()->getNamedItemNS(psviAttributes->getAttributeNamespaceAtIndex(index), + psviAttributes->getAttributeNameAtIndex(index)); + if(pAttrNode!=NULL) + { + DOMTypeInfoImpl* typeInfo=new (getDocument()) DOMTypeInfoImpl(); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Validity, attrInfo->getValidity()); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Validation_Attempted, attrInfo->getValidationAttempted()); + if(attrInfo->getTypeDefinition()) + { + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, XSTypeDefinition::SIMPLE_TYPE); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, attrInfo->getTypeDefinition()->getAnonymous()); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, + fDocument->getPooledString(attrInfo->getTypeDefinition()->getNamespace())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, + fDocument->getPooledString(attrInfo->getTypeDefinition()->getName())); + } + else if(attrInfo->getValidity()==PSVIItem::VALIDITY_VALID) + { + // if we are valid but we don't have a type validator, we are xs:anySimpleType + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Type, XSTypeDefinition::SIMPLE_TYPE); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Anonymous, false); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name, SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + if(attrInfo->getMemberTypeDefinition()) + { + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Anonymous, attrInfo->getMemberTypeDefinition()->getAnonymous()); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace, + fDocument->getPooledString(attrInfo->getMemberTypeDefinition()->getNamespace())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name, + fDocument->getPooledString(attrInfo->getMemberTypeDefinition()->getName())); + } + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Default, fDocument->getPooledString(attrInfo->getSchemaDefault())); + typeInfo->setStringProperty(DOMPSVITypeInfo::PSVI_Schema_Normalized_Value, fDocument->getPooledString(attrInfo->getSchemaNormalizedValue())); + typeInfo->setNumericProperty(DOMPSVITypeInfo::PSVI_Schema_Specified, true); + ((DOMAttrImpl*)pAttrNode)->setSchemaTypeInfo(typeInfo); + } + } + } + // associate the info now; if the user wants, she can override what we did + if(fPSVIHandler) + fPSVIHandler->handleAttributesPSVI(localName, uri, psviAttributes); +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Implementation of XMLDocumentHandler interface +// --------------------------------------------------------------------------- +void AbstractDOMParser::docCharacters( const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Ignore chars outside of content + if (!fWithinElement) + return; + + if (cdataSection == true) + { + DOMCDATASection *node = createCDATASection (chars, length); + castToParentImpl (fCurrentParent)->appendChildFast (node); + fCurrentNode = node; + } + else + { + if (fCurrentNode->getNodeType() == DOMNode::TEXT_NODE) + { + DOMTextImpl *node = (DOMTextImpl*)fCurrentNode; + node->appendData(chars, length); + } + else + { + DOMText *node = createText (chars, length); + castToParentImpl (fCurrentParent)->appendChildFast (node); + fCurrentNode = node; + } + } +} + + +void AbstractDOMParser::docComment(const XMLCh* const comment) +{ + if (fCreateCommentNodes) { + DOMComment *dcom = fDocument->createComment(comment); + castToParentImpl (fCurrentParent)->appendChildFast (dcom); + fCurrentNode = dcom; + } +} + + +void AbstractDOMParser::docPI( const XMLCh* const target + , const XMLCh* const data) +{ + DOMProcessingInstruction *pi = fDocument->createProcessingInstruction + ( + target + , data + ); + castToParentImpl (fCurrentParent)->appendChildFast (pi); + fCurrentNode = pi; +} + + +void AbstractDOMParser::endEntityReference(const XMLEntityDecl&) +{ + if (!fCreateEntityReferenceNodes) + return; + + DOMEntityReferenceImpl *erImpl = 0; + + if (fCurrentParent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) + erImpl = (DOMEntityReferenceImpl *) fCurrentParent; + + fCurrentNode = fCurrentParent; + fCurrentParent = fCurrentNode->getParentNode (); + + // When the document is invalid but we continue parsing, we may + // end up seeing more 'end' events than the 'start' ones. + // + if (fCurrentParent == 0 && fDocument != 0) + { + fCurrentNode = fDocument->getDocumentElement (); + fCurrentParent = fCurrentNode; + } + + if (erImpl) + erImpl->setReadOnly(true, true); +} + + +void AbstractDOMParser::endElement( const XMLElementDecl& + , const unsigned int + , const bool + , const XMLCh* const) +{ + fCurrentNode = fCurrentParent; + fCurrentParent = fCurrentNode->getParentNode (); + + // When the document is invalid but we continue parsing, we may + // end up seeing more 'end' events than the 'start' ones. + // + if (fCurrentParent == 0 && fDocument != 0) + { + fCurrentNode = fDocument->getDocumentElement (); + fCurrentParent = fCurrentNode; + } + + // If we've hit the end of content, clear the flag. + // + if (fCurrentParent == fDocument) + fWithinElement = false; + + if(fDoXInclude && + (XIncludeUtils::isXIIncludeDOMNode(fCurrentNode) || + ((XIncludeUtils::isXIFallbackDOMNode(fCurrentNode) && + !XMLString::equals(fCurrentParent->getNamespaceURI(), XIncludeUtils::fgXIIIncludeNamespaceURI))))) + { + XIncludeUtils xiu((XMLErrorReporter *) this); + // process the XInclude node, then update the fCurrentNode with the new content + if(xiu.parseDOMNodeDoingXInclude(fCurrentNode, fDocument, getScanner()->getEntityHandler())) + fCurrentNode = fCurrentParent->getLastChild(); + } +} + + +void AbstractDOMParser::ignorableWhitespace( const XMLCh* const chars + , const XMLSize_t length + , const bool) +{ + // Ignore chars before the root element + if (!fWithinElement || !fIncludeIgnorableWhitespace) + return; + + // revisit. Not safe to slam in a null like this. + XMLCh savedChar = chars[length]; + XMLCh *ncChars = (XMLCh *)chars; // cast off const + ncChars[length] = chNull; + + if (fCurrentNode->getNodeType() == DOMNode::TEXT_NODE) + { + DOMText *node = (DOMText *)fCurrentNode; + node->appendData(chars); + } + else + { + DOMTextImpl *node = (DOMTextImpl *)fDocument->createTextNode(chars); + node->setIgnorableWhitespace(true); + castToParentImpl (fCurrentParent)->appendChildFast (node); + + fCurrentNode = node; + } + ncChars[length] = savedChar; +} + + +void AbstractDOMParser::resetDocument() +{ + // + // The reset methods are called before a new parse event occurs. + // Reset this parsers state to clear out anything that may be left + // from a previous use, in particular the DOM document itself. + // + this->reset(); +} + + +void AbstractDOMParser::startDocument() +{ + if(fImplementationFeatures == 0) + fDocument = (DOMDocumentImpl *)DOMImplementation::getImplementation()->createDocument(fMemoryManager); + else + fDocument = (DOMDocumentImpl *)DOMImplementationRegistry::getDOMImplementation(fImplementationFeatures)->createDocument(fMemoryManager); + + // Just set the document as the current parent and current node + fCurrentParent = fDocument; + fCurrentNode = fDocument; + // set DOM error checking off + fDocument->setErrorChecking(false); + fDocument->setDocumentURI(fScanner->getLocator()->getSystemId()); + fDocument->setInputEncoding(fScanner->getReaderMgr()->getCurrentEncodingStr()); +} + + +void AbstractDOMParser::endDocument() +{ + // set DOM error checking back on + fDocument->setErrorChecking(true); + + // DOM L2 does not support editing DocumentType nodes + if (fDocumentType && fScanner -> getDoNamespaces()) + fDocumentType->setReadOnly(true, true); +} + + +void AbstractDOMParser::startElement(const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot) +{ + DOMElement *elem; + DOMElementImpl *elemImpl; + const XMLCh* namespaceURI = 0; + bool doNamespaces = fScanner->getDoNamespaces(); + + // Create the element name. Here we are going to bypass the + // DOMDocument::createElement() interface and instantiate the + // required types directly in order to avoid name checking + // overhead. + // + if (doNamespaces) + { + //DOM Level 2, doNamespaces on + // + const XMLCh* localName = elemDecl.getBaseName(); + + if (urlId != fScanner->getEmptyNamespaceId()) { //TagName has a prefix + + namespaceURI = fScanner->getURIText(urlId); //get namespaceURI + + if (elemPrefix && *elemPrefix) + { + XMLBufBid elemQName(&fBufMgr); + + elemQName.set(elemPrefix); + elemQName.append(chColon); + elemQName.append(localName); + + elem = createElementNS ( + namespaceURI, elemPrefix, localName, elemQName.getRawBuffer()); + } + else + elem = createElementNS (namespaceURI, 0, localName, localName); + } + else + elem = createElementNS (namespaceURI, 0, localName, localName); + } + else + { //DOM Level 1 + elem = createElement (elemDecl.getFullName()); + } + + elemImpl = (DOMElementImpl *) elem; + + if (attrCount) + { + unsigned int xmlnsNSId = fScanner->getXMLNSNamespaceId(); + unsigned int emptyNSId = fScanner->getEmptyNamespaceId(); + + DOMAttrMapImpl* map = elemImpl->fAttributes; + map->reserve (attrCount); + + for (XMLSize_t index = 0; index < attrCount; ++index) + { + const XMLAttr* oneAttrib = attrList.elementAt(index); + DOMAttrImpl *attr = 0; + + if (doNamespaces) + { + //DOM Level 2, doNamespaces on + // + unsigned int attrURIId = oneAttrib->getURIId(); + const XMLCh* localName = oneAttrib->getName(); + const XMLCh* prefix = oneAttrib->getPrefix(); + namespaceURI = 0; + + if ((prefix==0 || *prefix==0) && XMLString::equals(localName, XMLUni::fgXMLNSString)) + { + // xmlns=... + attrURIId = xmlnsNSId; + } + if (attrURIId != emptyNSId) + { + //TagName has a prefix + namespaceURI = fScanner->getURIText(attrURIId); + } + + attr = (DOMAttrImpl*) createAttrNS (namespaceURI, + prefix, + localName, + oneAttrib->getQName()); + + map->setNamedItemNSFast(attr); + } + else + { + attr = (DOMAttrImpl*) createAttr (oneAttrib->getName()); + map->setNamedItemFast(attr); + } + + attr->setValueFast(oneAttrib->getValue()); + + // Attributes of type ID. If this is one, add it to the hashtable of IDs + // that is constructed for use by GetElementByID(). + // + if (oneAttrib->getType()==XMLAttDef::ID) + { + if (fDocument->fNodeIDMap == 0) + fDocument->fNodeIDMap = new (fDocument) DOMNodeIDMap(500, fDocument); + fDocument->fNodeIDMap->add(attr); + attr->fNode.isIdAttr(true); + } + + attr->setSpecified(oneAttrib->getSpecified()); + + // store DTD validation information + if(fCreateSchemaInfo) + { + switch(oneAttrib->getType()) + { + case XMLAttDef::CData: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedCDATAAttribute); break; + case XMLAttDef::ID: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDAttribute); break; + case XMLAttDef::IDRef: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDREFAttribute); break; + case XMLAttDef::IDRefs: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDREFSAttribute); break; + case XMLAttDef::Entity: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENTITYAttribute); break; + case XMLAttDef::Entities: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENTITIESAttribute); break; + case XMLAttDef::NmToken: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNMTOKENAttribute); break; + case XMLAttDef::NmTokens: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNMTOKENSAttribute); break; + case XMLAttDef::Notation: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNOTATIONAttribute); break; + case XMLAttDef::Enumeration: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENUMERATIONAttribute); break; + default: attr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdNotValidatedAttribute); break; + } + } + } + } + + //Set up the default attributes if any. + // + if (elemDecl.hasAttDefs()) + { + XMLAttDefList* defAttrs = &elemDecl.getAttDefList(); + XMLAttDef* attr = 0; + DOMAttrImpl * insertAttr = 0; + + for(XMLSize_t i=0; igetAttDefCount(); i++) + { + attr = &defAttrs->getAttDef(i); + + const XMLAttDef::DefAttTypes defType = attr->getDefaultType(); + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + + if (doNamespaces) + { + // DOM Level 2 wants all namespace declaration attributes + // to be bound to "http://www.w3.org/2000/xmlns/" + // So as long as the XML parser doesn't do it, it needs to + // be done here. + const XMLCh* qualifiedName = attr->getFullName(); + XMLBufBid bbPrefixQName(&fBufMgr); + XMLBuffer& prefixBuf = bbPrefixQName.getBuffer(); + int colonPos = -1; + unsigned int uriId = fScanner->resolveQName(qualifiedName, prefixBuf, ElemStack::Mode_Attribute, colonPos); + + const XMLCh* namespaceURI = 0; + if (XMLString::equals(qualifiedName, XMLUni::fgXMLNSString)) //for xmlns=... + uriId = fScanner->getXMLNSNamespaceId(); + if (uriId != fScanner->getEmptyNamespaceId()) { //TagName has a prefix + namespaceURI = fScanner->getURIText(uriId); + } + + insertAttr = (DOMAttrImpl *) fDocument->createAttributeNS(namespaceURI, // NameSpaceURI + qualifiedName); // qualified name + + DOMAttr* remAttr = elemImpl->setDefaultAttributeNodeNS(insertAttr); + if (remAttr) + remAttr->release(); + } + else + { + // Namespaces is turned off... + insertAttr = (DOMAttrImpl *) fDocument->createAttribute(attr->getFullName()); + + DOMNode* remAttr = elemImpl->setDefaultAttributeNode(insertAttr); + if (remAttr) + remAttr->release(); + } + //need to do this before the get as otherwise we overwrite any value in the attr + if (attr->getValue() != 0) + { + insertAttr->setValueFast(attr->getValue()); + insertAttr->setSpecified(false); + } + + // store DTD validation information + if(fCreateSchemaInfo) + { + switch(attr->getType()) + { + case XMLAttDef::CData: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedCDATAAttribute); break; + case XMLAttDef::ID: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDAttribute); break; + case XMLAttDef::IDRef: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDREFAttribute); break; + case XMLAttDef::IDRefs: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedIDREFSAttribute); break; + case XMLAttDef::Entity: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENTITYAttribute); break; + case XMLAttDef::Entities: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENTITIESAttribute); break; + case XMLAttDef::NmToken: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNMTOKENAttribute); break; + case XMLAttDef::NmTokens: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNMTOKENSAttribute); break; + case XMLAttDef::Notation: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedNOTATIONAttribute); break; + case XMLAttDef::Enumeration: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdValidatedENUMERATIONAttribute); break; + default: insertAttr->setSchemaTypeInfo(&DOMTypeInfoImpl::g_DtdNotValidatedAttribute); break; + } + } + } + + insertAttr = 0; + attr->reset(); + } + } + + if (fCurrentParent != fDocument) + castToParentImpl (fCurrentParent)->appendChildFast (elem); + else + fCurrentParent->appendChild (elem); + + fCurrentParent = elem; + fCurrentNode = elem; + fWithinElement = true; + + // If an empty element, do end right now (no endElement() will be called) + if (isEmpty) + endElement(elemDecl, urlId, isRoot, elemPrefix); +} + + +void AbstractDOMParser::startEntityReference(const XMLEntityDecl& entDecl) +{ + const XMLCh * entName = entDecl.getName(); + DOMNamedNodeMap *entities = fDocumentType->getEntities(); + DOMEntityImpl* entity = (DOMEntityImpl*)entities->getNamedItem(entName); + if (entity) + entity->setInputEncoding(fScanner->getReaderMgr()->getCurrentEncodingStr()); + fCurrentEntity = entity; + + + // Following line has been moved up so that erImpl is only declared + // and used if create entity ref flag is true + if (fCreateEntityReferenceNodes == true) { + DOMEntityReference *er = fDocument->createEntityReferenceByParser(entName); + + //set the readOnly flag to false before appending node, will be reset + // in endEntityReference + DOMEntityReferenceImpl *erImpl = (DOMEntityReferenceImpl *) er; + erImpl->setReadOnly(false, true); + + castToParentImpl (fCurrentParent)->appendChildFast (er); + + fCurrentParent = er; + fCurrentNode = er; + + // this entityRef needs to be stored in Entity map too. + // We'd decide later whether the entity nodes should be created by a + // separated method in parser or not. For now just stick it in if + // the ref nodes are created + if (entity) + entity->setEntityRef(er); + } +} + + +void AbstractDOMParser::XMLDecl(const XMLCh* const version + , const XMLCh* const encoding + , const XMLCh* const standalone + , const XMLCh* const actualEncStr) +{ + fDocument->setXmlStandalone(XMLString::equals(XMLUni::fgYesString, standalone)); + fDocument->setXmlVersion(version); + fDocument->setXmlEncoding(encoding); + fDocument->setInputEncoding(actualEncStr); +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Helper methods +// --------------------------------------------------------------------------- + +//doctypehandler interfaces +void AbstractDOMParser::attDef +( + const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool +) +{ + if (fDocumentType->isIntSubsetReading()) + { + if (elemDecl.hasAttDefs()) + { + fInternalSubset.append(attDef.getFullName()); + + // Get the type and display it + const XMLAttDef::AttTypes type = attDef.getType(); + switch(type) + { + case XMLAttDef::CData : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgCDATAString); + break; + case XMLAttDef::ID : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgIDString); + break; + case XMLAttDef::IDRef : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgIDRefString); + break; + case XMLAttDef::IDRefs : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgIDRefsString); + break; + case XMLAttDef::Entity : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgEntityString); + break; + case XMLAttDef::Entities : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgEntitiesString); + break; + case XMLAttDef::NmToken : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgNmTokenString); + break; + case XMLAttDef::NmTokens : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgNmTokensString); + break; + + case XMLAttDef::Notation : + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgNotationString); + break; + + case XMLAttDef::Enumeration : + { + fInternalSubset.append(chSpace); + const XMLCh* enumString = attDef.getEnumeration(); + XMLSize_t length = XMLString::stringLen(enumString); + if (length > 0) { + + fInternalSubset.append(chOpenParen ); + for(XMLSize_t i=0; iisIntSubsetReading()) + { + if (comment != 0) + { + fInternalSubset.append(XMLUni::fgCommentString); + fInternalSubset.append(chSpace); + fInternalSubset.append(comment); + fInternalSubset.append(chSpace); + fInternalSubset.append(chDash); + fInternalSubset.append(chDash); + fInternalSubset.append(chCloseAngle); + } + } +} + +void AbstractDOMParser::doctypeDecl +( + const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool + , const bool +) +{ + fDocumentType = (DOMDocumentTypeImpl *) fDocument->createDocumentType(elemDecl.getFullName(), publicId, systemId); + fDocument->setDocumentType(fDocumentType); + +} + +void AbstractDOMParser::doctypePI +( + const XMLCh* const target + , const XMLCh* const data +) +{ + if (fDocumentType->isIntSubsetReading()) + { + //add these chars to internalSubset variable + fInternalSubset.append(chOpenAngle); + fInternalSubset.append(chQuestion); + fInternalSubset.append(target); + fInternalSubset.append(chSpace); + fInternalSubset.append(data); + fInternalSubset.append(chQuestion); + fInternalSubset.append(chCloseAngle); + } +} + + +void AbstractDOMParser::doctypeWhitespace +( + const XMLCh* const chars + , const XMLSize_t length +) +{ + if (fDocumentType->isIntSubsetReading()) + fInternalSubset.append(chars, length); +} + +void AbstractDOMParser::elementDecl +( + const DTDElementDecl& decl + , const bool +) +{ + if (fDocumentType->isIntSubsetReading()) + { + fInternalSubset.append(chOpenAngle); + fInternalSubset.append(chBang); + fInternalSubset.append(XMLUni::fgElemString); + fInternalSubset.append(chSpace); + fInternalSubset.append(decl.getFullName()); + + //get the ContentSpec information + const XMLCh* contentModel = decl.getFormattedContentModel(); + if (contentModel != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(contentModel); + } + + fInternalSubset.append(chCloseAngle); + } +} + +void AbstractDOMParser::endAttList +( + const DTDElementDecl& elemDecl +) +{ + if (fDocumentType->isIntSubsetReading()) + { + //print the closing angle + fInternalSubset.append(chCloseAngle); + } + + // this section sets up default attributes. + // default attribute nodes are stored in a NamedNodeMap DocumentTypeImpl::elements + // default attribute data attached to the document is used to conform to the + // DOM spec regarding creating element nodes & removing attributes with default values + // see DocumentTypeImpl + if (elemDecl.hasAttDefs()) + { + XMLAttDefList* defAttrs = &elemDecl.getAttDefList(); + XMLAttDef* attr = 0; + + DOMAttrImpl * insertAttr = 0; + DOMElement *elem = fDocument->createElement(elemDecl.getFullName()); + DOMElementImpl *elemImpl = (DOMElementImpl *) elem; + bool doNamespaces = fScanner->getDoNamespaces(); + + for(XMLSize_t i=0; igetAttDefCount(); i++) + { + attr = &defAttrs->getAttDef(i); + if (attr->getValue() != 0) + { + if (doNamespaces) + { + // DOM Level 2 wants all namespace declaration attributes + // to be bound to "http://www.w3.org/2000/xmlns/" + // So as long as the XML parser doesn't do it, it needs to + // done here. + const XMLCh* qualifiedName = attr->getFullName(); + int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName); + + XMLBufBid bbQName(&fBufMgr); + XMLBuffer& buf = bbQName.getBuffer(); + static const XMLCh XMLNS[] = { + chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chNull}; + + if (index > 0) { + // there is prefix + // map to XML URI for all cases except when prefix == "xmlns" + XMLCh* prefix; + XMLCh temp[1000]; + + if (index > 999) + prefix = (XMLCh*) fMemoryManager->allocate + ( + (index + 1) * sizeof(XMLCh) + );//new XMLCh[index+1]; + else + prefix = temp; + + XMLString::subString(prefix ,qualifiedName, 0, index, fMemoryManager); + + if (XMLString::equals(prefix,XMLNS)) + buf.append(XMLUni::fgXMLNSURIName); + else + buf.append(XMLUni::fgXMLURIName); + + if (index > 999) + fMemoryManager->deallocate(prefix);//delete [] prefix; + } + else { + // No prefix + if (XMLString::equals(qualifiedName,XMLNS)) + buf.append(XMLUni::fgXMLNSURIName); + } + + insertAttr = (DOMAttrImpl *) fDocument->createAttributeNS( + buf.getRawBuffer(), // NameSpaceURI + qualifiedName); // qualified name + + DOMNode* remAttr = elemImpl->setAttributeNodeNS(insertAttr); + if (remAttr) + remAttr->release(); + } + else + { + // Namespaces is turned off... + insertAttr = (DOMAttrImpl *) fDocument->createAttribute(attr->getFullName()); + DOMNode* remAttr = elemImpl->setAttributeNode(insertAttr); + if (remAttr) + remAttr->release(); + } + + insertAttr->setValueFast(attr->getValue()); + insertAttr->setSpecified(false); + } + } + DOMNode* rem = fDocumentType->getElements()->setNamedItem(elemImpl); + if (rem) + rem->release(); + } +} + +void AbstractDOMParser::endIntSubset() +{ + fDocumentType->setInternalSubset(fInternalSubset.getRawBuffer()); + // the buffer shouldn't be released as it is reused in the next parse + // fBufMgr.releaseBuffer(fInternalSubset); + fDocumentType->fIntSubsetReading = false; +} + +void AbstractDOMParser::endExtSubset() +{ +} + +void AbstractDOMParser::entityDecl +( + const DTDEntityDecl& entityDecl + , const bool + , const bool +) +{ + DOMEntityImpl* entity = (DOMEntityImpl *) fDocument->createEntity(entityDecl.getName()); + + entity->setPublicId(entityDecl.getPublicId()); + entity->setSystemId(entityDecl.getSystemId()); + entity->setNotationName(entityDecl.getNotationName()); + entity->setBaseURI(entityDecl.getBaseURI()); + + DOMEntityImpl *previousDef = (DOMEntityImpl *) + fDocumentType->getEntities()->setNamedItem( entity ); + + if (previousDef) + previousDef->release(); + + if (fDocumentType->isIntSubsetReading()) + { + //add thes chars to internalSubset variable + fInternalSubset.append(chOpenAngle); + fInternalSubset.append(chBang); + fInternalSubset.append(XMLUni::fgEntityString); + fInternalSubset.append(chSpace); + + fInternalSubset.append(entityDecl.getName()); + + const XMLCh* id = entity->getPublicId(); + if (id != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgPubIDString); + fInternalSubset.append(chSpace); + fInternalSubset.append(chDoubleQuote); + fInternalSubset.append(id); + fInternalSubset.append(chDoubleQuote); + } + id = entity->getSystemId(); + if (id != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgSysIDString); + fInternalSubset.append(chSpace); + fInternalSubset.append(chDoubleQuote); + fInternalSubset.append(id); + fInternalSubset.append(chDoubleQuote); + + } + id = entity->getNotationName(); + if (id != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgNDATAString); + fInternalSubset.append(chSpace); + fInternalSubset.append(id); + } + id = entityDecl.getValue(); + if (id !=0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(chDoubleQuote); + fInternalSubset.append(id); + fInternalSubset.append(chDoubleQuote); + } + + fInternalSubset.append(chCloseAngle); + } + +} + +void AbstractDOMParser::resetDocType() +{ + fDocumentType = 0; +} + +void AbstractDOMParser::notationDecl +( + const XMLNotationDecl& notDecl + , const bool +) +{ + DOMNotationImpl* notation = (DOMNotationImpl *)fDocument->createNotation(notDecl.getName()); + notation->setPublicId(notDecl.getPublicId()); + notation->setSystemId(notDecl.getSystemId()); + notation->setBaseURI(notDecl.getBaseURI()); + + DOMNode* rem = fDocumentType->getNotations()->setNamedItem( notation ); + if (rem) + rem->release(); + + if (fDocumentType->isIntSubsetReading()) + { + //add thes chars to internalSubset variable + fInternalSubset.append(chOpenAngle); + fInternalSubset.append(chBang); + fInternalSubset.append(XMLUni::fgNotationString); + fInternalSubset.append(chSpace); + + fInternalSubset.append(notDecl.getName()); + + const XMLCh* id = notation->getPublicId(); + if (id != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgPubIDString); + fInternalSubset.append(chSpace); + fInternalSubset.append(chDoubleQuote); + fInternalSubset.append(id); + fInternalSubset.append(chDoubleQuote); + } + id = notation->getSystemId(); + if (id != 0) { + fInternalSubset.append(chSpace); + fInternalSubset.append(XMLUni::fgSysIDString); + fInternalSubset.append(chSpace); + fInternalSubset.append(chDoubleQuote); + fInternalSubset.append(id); + fInternalSubset.append(chDoubleQuote); + + } + fInternalSubset.append(chCloseAngle); + } +} + +void AbstractDOMParser::startAttList +( + const DTDElementDecl& elemDecl +) +{ + if (fDocumentType->isIntSubsetReading()) + { + fInternalSubset.append(chOpenAngle); + fInternalSubset.append(chBang); + fInternalSubset.append(XMLUni::fgAttListString); + fInternalSubset.append(chSpace); + fInternalSubset.append(elemDecl.getFullName()); + } +} + +void AbstractDOMParser::startIntSubset() +{ + fDocumentType->fIntSubsetReading = true; +} + +void AbstractDOMParser::startExtSubset() +{ +} + +void AbstractDOMParser::TextDecl +( + const XMLCh* const versionStr + , const XMLCh* const encodingStr +) +{ + if (fCurrentEntity) { + fCurrentEntity->setXmlVersion(versionStr); + fCurrentEntity->setXmlEncoding(encodingStr); + } +} + +DOMCDATASection* AbstractDOMParser:: +createCDATASection (const XMLCh* s, XMLSize_t n) +{ + return new (fDocument, DOMMemoryManager::CDATA_SECTION_OBJECT) + DOMCDATASectionImpl(fDocument, s, n); +} + + +DOMText* AbstractDOMParser:: +createText (const XMLCh* s, XMLSize_t n) +{ + return new (fDocument, DOMMemoryManager::TEXT_OBJECT) + DOMTextImpl(fDocument, s, n); +} + + +DOMElement* AbstractDOMParser:: +createElement (const XMLCh* name) +{ + return new (fDocument, DOMMemoryManager::ELEMENT_OBJECT) + DOMElementImpl(fDocument, name); +} + +DOMElement* AbstractDOMParser:: +createElementNS (const XMLCh* namespaceURI, + const XMLCh* elemPrefix, + const XMLCh* localName, + const XMLCh* qName) +{ + return new (fDocument, DOMMemoryManager::ELEMENT_NS_OBJECT) + DOMElementNSImpl (fDocument, + namespaceURI, + elemPrefix, + localName, + qName); +} + +DOMAttr* AbstractDOMParser:: +createAttr (const XMLCh* name) +{ + return new (fDocument, DOMMemoryManager::ATTR_OBJECT) + DOMAttrImpl(fDocument, name); +} + +DOMAttr* AbstractDOMParser:: +createAttrNS (const XMLCh* namespaceURI, + const XMLCh* elemPrefix, + const XMLCh* localName, + const XMLCh* qName) +{ + return new (fDocument, DOMMemoryManager::ATTR_NS_OBJECT) + DOMAttrNSImpl (fDocument, + namespaceURI, + elemPrefix, + localName, + qName); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.hpp b/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.hpp new file mode 100644 index 000000000..8e6687108 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/AbstractDOMParser.hpp @@ -0,0 +1,1900 @@ +/* + * 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: AbstractDOMParser.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACTDOMPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_ABSTRACTDOMPARSER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPScanToken; +class XMLScanner; +class XMLValidator; +class DOMDocumentImpl; +class DOMDocumentTypeImpl; +class DOMEntityImpl; +class DOMElement; +class GrammarResolver; +class XMLGrammarPool; +class PSVIHandler; + +/** + * This class implements the Document Object Model (DOM) interface. + * It is used as a base for DOM parsers (i.e. XercesDOMParser, DOMLSParser). + */ +class PARSERS_EXPORT AbstractDOMParser : + + public XMemory + , public XMLDocumentHandler + , public XMLErrorReporter + , public XMLEntityHandler + , public DocTypeHandler + , public PSVIHandler +{ +public : + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** @name Public constants */ + //@{ + + /** ValScheme enum used in setValidationScheme + * Val_Never: Do not report validation errors. + * Val_Always: The parser will always report validation errors. + * Val_Auto: The parser will report validation errors only if a grammar is specified. + * + * @see #setValidationScheme + */ + enum ValSchemes + { + Val_Never + , Val_Always + , Val_Auto + }; + + //@} + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + + /** + * Destructor + */ + virtual ~AbstractDOMParser(); + + //@} + + // ----------------------------------------------------------------------- + // Utility methods + // ----------------------------------------------------------------------- + + /** @name Utility methods */ + //@{ + /** Reset the parser + * + * This method resets the state of the DOM driver and makes + * it ready for a fresh parse run. + */ + void reset(); + + /** Adopt the DOM document + * + * This method returns the DOMDocument object representing the + * root of the document tree. + * + * The caller will adopt the DOMDocument and thus is responsible to + * call DOMDocument::release() to release the associated memory. + * The parser will not delete it. The ownership is transferred + * from the parser to the caller. + * + * @return The adopted DOMDocument object which represents the entire + * XML document. + */ + DOMDocument* adoptDocument(); + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** Get the DOM document + * + * This method returns the DOMDocument object representing the + * root of the document tree. This object provides the primary + * access to the document's data. + * + * The returned DOMDocument object is owned by the parser. + * + * @return The DOMDocument object which represents the entire + * XML document. + */ + DOMDocument* getDocument(); + + /** Get a const reference to the validator + * + * This method returns a reference to the parser's installed + * validator. + * + * @return A const reference to the installed validator object. + */ + const XMLValidator& getValidator() const; + + /** + * This method returns an enumerated value that indicates the current + * validation scheme set on this parser. + * + * @return The ValSchemes value current set on this parser. + * @see #setValidationScheme + */ + ValSchemes getValidationScheme() const; + + /** Get the 'do schema' flag + * + * This method returns the state of the parser's schema processing + * flag. + * + * @return true, if the parser is currently configured to + * understand schema, false otherwise. + * + * @see #setDoSchema + */ + bool getDoSchema() const; + + /** Get the 'full schema constraint checking' flag + * + * This method returns the state of the parser's full schema constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have full schema constraint checking, false otherwise. + * + * @see #setValidationSchemaFullChecking + */ + bool getValidationSchemaFullChecking() const; + + /** Get the identity constraint checking' flag + * + * This method returns the state of the parser's identity constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have identity constraint checking, false otherwise. + * + * @see setIdentityConstraintChecking + */ + bool getIdentityConstraintChecking() const; + + /** Get error count from the last parse operation. + * + * This method returns the error count from the last parse + * operation. Note that this count is actually stored in the + * scanner, so this method simply returns what the + * scanner reports. + * + * @return number of errors encountered during the latest + * parse operation. + * + */ + XMLSize_t getErrorCount() const; + + /** Get the 'do namespaces' flag + * + * This method returns the state of the parser's namespace processing + * flag. + * + * @return true, if the parser is currently configured to + * understand namespaces, false otherwise. + * + * @see #setDoNamespaces + */ + bool getDoNamespaces() const; + + /** Get the 'exit on first error' flag + * + * This method returns the state of the parser's + * exit-on-First-Fatal-Error flag. If this flag is true, then the + * parse will exit the first time it sees any non-wellformed XML or + * any validity error. The default state is true. + * + * @return true, if the parser is currently configured to + * exit on the first fatal error, false otherwise. + * + * @see #setExitOnFirstFatalError + */ + bool getExitOnFirstFatalError() const; + + /** + * This method returns the state of the parser's + * validation-constraint-fatal flag. + * + * @return true, if the parser is currently configured to + * set validation constraint errors as fatal, false + * otherwise. + * + * @see #setValidationConstraintFatal + */ + bool getValidationConstraintFatal() const; + + /** Get the 'include entity references' flag + * + * This method returns the flag that specifies whether the parser is + * creating entity reference nodes in the DOM tree being produced. + * + * @return The state of the create entity reference node + * flag. + * @see #setCreateEntityReferenceNodes + */ + bool getCreateEntityReferenceNodes()const; + + /** Get the 'include ignorable whitespace' flag. + * + * This method returns the state of the parser's include ignorable + * whitespace flag. + * + * @return 'true' if the include ignorable whitespace flag is set on + * the parser, 'false' otherwise. + * + * @see #setIncludeIgnorableWhitespace + */ + bool getIncludeIgnorableWhitespace() const; + + /** Get the set of Namespace/SchemaLocation that is specified externally. + * + * This method returns the list of Namespace/SchemaLocation that was + * specified using setExternalSchemaLocation. + * + * The parser owns the returned string, and the memory allocated for + * the returned string will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else. + * + * @return a pointer to the list of Namespace/SchemaLocation that was + * specified externally. The pointer spans the same life-time as + * the parser. A null pointer is returned if nothing + * was specified externally. + * + * @see #setExternalSchemaLocation(const XMLCh* const) + */ + XMLCh* getExternalSchemaLocation() const; + + /** Get the noNamespace SchemaLocation that is specified externally. + * + * This method returns the no target namespace XML Schema Location + * that was specified using setExternalNoNamespaceSchemaLocation. + * + * The parser owns the returned string, and the memory allocated for + * the returned string will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else. + * + * @return a pointer to the no target namespace Schema Location that was + * specified externally. The pointer spans the same life-time as + * the parser. A null pointer is returned if nothing + * was specified externally. + * + * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) + */ + XMLCh* getExternalNoNamespaceSchemaLocation() const; + + /** Get the SecurityManager instance attached to this parser. + * + * This method returns the security manager + * that was specified using setSecurityManager. + * + * The SecurityManager instance must have been specified by the application; + * this should not be deleted until after the parser has been deleted (or + * a new SecurityManager instance has been supplied to the parser). + * + * @return a pointer to the SecurityManager instance + * specified externally. A null pointer is returned if nothing + * was specified externally. + * + * @see #setSecurityManager + */ + SecurityManager* getSecurityManager() const; + + /** Get the raw buffer low water mark for this parser. + * + * If the number of available bytes in the raw buffer is less than + * the low water mark the parser will attempt to read more data before + * continuing parsing. By default the value for this parameter is 100 + * bytes. You may want to set this parameter to 0 if you would like + * the parser to parse the available data immediately without + * potentially blocking while waiting for more date. + * + * @return current low water mark + * + * @see #setSecurityManager + */ + const XMLSize_t& getLowWaterMark() const; + + /** Get the 'Loading External DTD' flag + * + * This method returns the state of the parser's loading external DTD + * flag. + * + * @return false, if the parser is currently configured to + * ignore external DTD completely, true otherwise. + * + * @see #setLoadExternalDTD + * @see #getValidationScheme + */ + bool getLoadExternalDTD() const; + + /** Get the 'Loading Schema' flag + * + * This method returns the state of the parser's loading schema + * flag. + * + * @return true, if the parser is currently configured to + * automatically load schemas that are not in the + * grammar pool, false otherwise. + * + * @see #setLoadSchema + */ + bool getLoadSchema() const; + + /** Get the 'create comment node' flag + * + * This method returns the flag that specifies whether the parser is + * creating comment nodes in the DOM tree being produced. + * + * @return The state of the create comment node flag. + * @see #setCreateCommentNodes + */ + bool getCreateCommentNodes()const; + + /** + * Get the 'calculate src offset flag' + * + * This method returns the state of the parser's src offset calculation + * when parsing an XML document. + * + * @return true, if the parser is currently configured to + * calculate src offsets, false otherwise. + * + * @see #setCalculateSrcOfs + */ + bool getCalculateSrcOfs() const; + + /** + * Get the 'force standard uri flag' + * + * This method returns the state if the parser forces standard uri + * + * @return true, if the parser is currently configured to + * force standard uri, i.e. malformed uri will be rejected. + * + * @see #setStandardUriConformant + */ + bool getStandardUriConformant() const; + + /** + * This method returns the installed PSVI handler. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed PSVI handler object. + */ + PSVIHandler* getPSVIHandler(); + + /** + * This method returns the installed PSVI handler. Suitable + * for 'rvalue' usages. + * + * @return A const pointer to the installed PSVI handler object. + */ + const PSVIHandler* getPSVIHandler() const; + + /** Get the 'associate schema info' flag + * + * This method returns the flag that specifies whether + * the parser is storing schema informations in the element + * and attribute nodes in the DOM tree being produced. + * + * @return The state of the associate schema info flag. + * @see #setCreateSchemaInfo + */ + bool getCreateSchemaInfo() const; + + /** Get the 'do XInclude' flag + * + * This method returns the flag that specifies whether + * the parser will process XInclude nodes + * in the DOM tree being produced. + * + * @return The state of the 'do XInclude' flag. + * @see #setDoXInclude + */ + bool getDoXInclude() const; + + /** Get the 'generate synthetic annotations' flag + * + * @return true, if the parser is currently configured to + * generate synthetic annotations, false otherwise. + * A synthetic XSAnnotation is created when a schema + * component has non-schema attributes but has no + * child annotations so that the non-schema attributes + * can be recovered under PSVI. + * + * @see #setGenerateSyntheticAnnotations + */ + bool getGenerateSyntheticAnnotations() const; + + /** Get the 'validate annotations' flag + * + * @return true, if the parser is currently configured to + * validate annotations, false otherwise. + * + * @see #setValidateAnnotations + */ + bool getValidateAnnotations() const; + + /** Get the 'ignore annotations' flag + * + * @return true, if the parser is currently configured to + * ignore annotations, false otherwise. + * + * @see #setIgnoreAnnotations + */ + bool getIgnoreAnnotations() const; + + /** Get the 'disable default entity resolution' flag + * + * @return true, if the parser is currently configured to + * not perform default entity resolution, false otherwise. + * + * @see #setDisableDefaultEntityResolution + */ + bool getDisableDefaultEntityResolution() const; + + /** Get the 'skip DTD validation' flag + * + * @return true, if the parser is currently configured to + * skip DTD validation, false otherwise. + * + * @see #setSkipDTDValidation + */ + bool getSkipDTDValidation() const; + + /** Get the 'handle multiple schema imports' flag + * + * @return true, if the parser is currently configured to + * import multiple schemas with the same namespace, false otherwise. + * + * @see #setHandleMultipleImports + */ + bool getHandleMultipleImports() const; + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + /** set the 'generate synthetic annotations' flag + * + * @param newValue The value for specifying whether Synthetic Annotations + * should be generated or not. + * A synthetic XSAnnotation is created when a schema + * component has non-schema attributes but has no + * child annotations so that the non-schema attributes + * can be recovered under PSVI. + * + * @see #getGenerateSyntheticAnnotations + */ + void setGenerateSyntheticAnnotations(const bool newValue); + + /** set the 'validlate annotations' flag + * + * @param newValue The value for specifying whether Annotations + * should be validated or not. + * + * @see #getValidateAnnotations + */ + void setValidateAnnotations(const bool newValue); + + /** Set the 'do namespaces' flag + * + * This method allows users to enable or disable the parser's + * namespace processing. When set to true, parser starts enforcing + * all the constraints and rules specified by the NameSpace + * specification. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether NameSpace rules should + * be enforced or not. + * + * @see #getDoNamespaces + */ + void setDoNamespaces(const bool newState); + + /** Set the 'exit on first error' flag + * + * This method allows users to set the parser's behaviour when it + * encounters the first fatal error. If set to true, the parser + * will exit at the first fatal error. If false, then it will + * report the error and continue processing. + * + * The default value is 'true' and the parser exits on the + * first fatal error. + * + * @param newState The value specifying whether the parser should + * continue or exit when it encounters the first + * fatal error. + * + * @see #getExitOnFirstFatalError + */ + void setExitOnFirstFatalError(const bool newState); + + /** + * This method allows users to set the parser's behaviour when it + * encounters a validation constraint error. If set to true, and the + * the parser will treat validation error as fatal and will exit depends on the + * state of "getExitOnFirstFatalError". If false, then it will + * report the error and continue processing. + * + * Note: setting this true does not mean the validation error will be printed with + * the word "Fatal Error". It is still printed as "Error", but the parser + * will exit if "setExitOnFirstFatalError" is set to true. + * + *

The default value is 'false'.

+ * + * @param newState If true, the parser will exit if "setExitOnFirstFatalError" + * is set to true. + * + * @see #getValidationConstraintFatal + * @see #setExitOnFirstFatalError + */ + void setValidationConstraintFatal(const bool newState); + + /** Set the 'include entity references' flag + * + * This method allows the user to specify whether the parser should + * create entity reference nodes in the DOM tree being produced. + * When the 'create' flag is + * true, the parser will create EntityReference nodes in the DOM tree. + * The EntityReference nodes and their child nodes will be read-only. + * When the 'create' flag is false, no EntityReference nodes will be created. + *

The replacement text + * of the entity is included in either case, either as a + * child of the Entity Reference node or in place at the location + * of the reference. + *

The default value is 'true'. + * + * @param create The new state of the create entity reference nodes + * flag. + * @see #getCreateEntityReferenceNodes + */ + void setCreateEntityReferenceNodes(const bool create); + + /** Set the 'include ignorable whitespace' flag + * + * This method allows the user to specify whether a validating parser + * should include ignorable whitespaces as text nodes. It has no effect + * on non-validating parsers which always include non-markup text. + *

When set to true (also the default), ignorable whitespaces will be + * added to the DOM tree as text nodes. The method + * DOMText::isIgnorableWhitespace() will return true for those text + * nodes only. + *

When set to false, all ignorable whitespace will be discarded and + * no text node is added to the DOM tree. Note: applications intended + * to process the "xml:space" attribute should not set this flag to false. + * And this flag also overrides any schema datateye whitespace facets, + * that is, all ignorable whitespace will be discarded even though + * 'preserve' is set in schema datatype whitespace facets. + * + * @param include The new state of the include ignorable whitespace + * flag. + * + * @see #getIncludeIgnorableWhitespace + */ + void setIncludeIgnorableWhitespace(const bool include); + + /** + * This method allows users to set the validation scheme to be used + * by this parser. The value is one of the ValSchemes enumerated values + * defined by this class: + * + *
Val_Never - turn off validation + *
Val_Always - turn on validation + *
Val_Auto - turn on validation if any internal/external + * DTD subset have been seen + * + *

The parser's default state is: Val_Never.

+ * + * @param newScheme The new validation scheme to use. + * + * @see #getValidationScheme + */ + void setValidationScheme(const ValSchemes newScheme); + + /** Set the 'do schema' flag + * + * This method allows users to enable or disable the parser's + * schema processing. When set to false, parser will not process + * any schema found. + * + * The parser's default state is: false. + * + * Note: If set to true, namespace processing must also be turned on. + * + * @param newState The value specifying whether schema support should + * be enforced or not. + * + * @see #getDoSchema + */ + void setDoSchema(const bool newState); + + /** + * This method allows the user to turn full Schema constraint checking on/off. + * Only takes effect if Schema validation is enabled. + * If turned off, partial constraint checking is done. + * + * Full schema constraint checking includes those checking that may + * be time-consuming or memory intensive. Currently, particle unique + * attribution constraint checking and particle derivation restriction checking + * are controlled by this option. + * + * The parser's default state is: false. + * + * @param schemaFullChecking True to turn on full schema constraint checking. + * + * @see #getValidationSchemaFullChecking + */ + void setValidationSchemaFullChecking(const bool schemaFullChecking); + + /** + * This method allows users to enable or disable the parser's identity + * constraint checks. + * + *

By default, the parser does identity constraint checks. + * The default value is true.

+ * + * @param newState The value specifying whether the parser should + * do identity constraint checks or not in the + * input XML document. + * + * @see #getIdentityConstraintChecking + */ + void setIdentityConstraintChecking(const bool newState); + + /** + * This method allows the user to specify a list of schemas to use. + * If the targetNamespace of a schema specified using this method matches + * the targetNamespace of a schema occurring in the instance document in + * the schemaLocation attribute, or if the targetNamespace matches the + * namespace attribute of the "import" element, the schema specified by the + * user using this method will be used (i.e., the schemaLocation attribute + * in the instance document or on the "import" element will be effectively ignored). + * + * If this method is called more than once, only the last one takes effect. + * + * The syntax is the same as for schemaLocation attributes in instance + * documents: e.g, "http://www.example.com file_name.xsd". The user can + * specify more than one XML Schema in the list. + * + * @param schemaLocation the list of schemas to use + * + * @see #getExternalSchemaLocation + */ + + void setExternalSchemaLocation(const XMLCh* const schemaLocation); + + /** + * This method is same as setExternalSchemaLocation(const XMLCh* const). + * It takes native char string as parameter + * + * @param schemaLocation the list of schemas to use + * + * @see #setExternalSchemaLocation(const XMLCh* const) + */ + void setExternalSchemaLocation(const char* const schemaLocation); + + /** + * This method allows the user to specify the no target namespace XML + * Schema Location externally. If specified, the instance document's + * noNamespaceSchemaLocation attribute will be effectively ignored. + * + * If this method is called more than once, only the last one takes effect. + * + * The syntax is the same as for the noNamespaceSchemaLocation attribute + * that may occur in an instance document: e.g."file_name.xsd". + * + * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace + * + * @see #getExternalNoNamespaceSchemaLocation + */ + void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation); + + /** + * This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const). + * It takes native char string as parameter + * + * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace + * + * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) + */ + void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation); + + /** + * This allows an application to set a SecurityManager on + * the parser; this object stores information that various + * components use to limit their consumption of system + * resources while processing documents. + * + * If this method is called more than once, only the last one takes effect. + * It may not be reset during a parse. + * + * + * @param securityManager the SecurityManager instance to + * be used by this parser + * + * @see #getSecurityManager + */ + void setSecurityManager(SecurityManager* const securityManager); + + /** Set the raw buffer low water mark for this parser. + * + * If the number of available bytes in the raw buffer is less than + * the low water mark the parser will attempt to read more data before + * continuing parsing. By default the value for this parameter is 100 + * bytes. You may want to set this parameter to 0 if you would like + * the parser to parse the available data immediately without + * potentially blocking while waiting for more date. + * + * @param lwm new low water mark + * + * @see #getSecurityManager + */ + void setLowWaterMark(XMLSize_t lwm); + + /** Set the 'Loading External DTD' flag + * + * This method allows users to enable or disable the loading of external DTD. + * When set to false, the parser will ignore any external DTD completely + * if the validationScheme is set to Val_Never. + * + * The parser's default state is: true. + * + * This flag is ignored if the validationScheme is set to Val_Always or Val_Auto. + * + * @param newState The value specifying whether external DTD should + * be loaded or not. + * + * @see #getLoadExternalDTD + * @see #setValidationScheme + */ + void setLoadExternalDTD(const bool newState); + + /** Set the 'Loading Schema' flag + * + * This method allows users to enable or disable the loading of schemas. + * When set to false, the parser not attempt to load schemas beyond + * querying the grammar pool for them. + * + * The parser's default state is: true. + * + * @param newState The value specifying whether schemas should + * be loaded if they're not found in the grammar + * pool. + * + * @see #getLoadSchema + * @see #setDoSchema + */ + void setLoadSchema(const bool newState); + + /** Set the 'create comment nodes' flag + * + * This method allows the user to specify whether the parser should + * create comment nodes in the DOM tree being produced. + *

The default value is 'true'. + * + * @param create The new state of the create comment nodes + * flag. + * @see #getCreateCommentNodes + */ + void setCreateCommentNodes(const bool create); + + /** Enable/disable src offset calculation + * + * This method allows users to enable/disable src offset calculation. + * Disabling the calculation will improve performance. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should enable or + * disable src offset calculation + * + * @see #getCalculateSrcOfs + */ + void setCalculateSrcOfs(const bool newState); + + /** Force standard uri + * + * This method allows users to tell the parser to force standard uri conformance. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether the parser should reject malformed URI. + * + * @see #getStandardUriConformant + */ + void setStandardUriConformant(const bool newState); + + /** Set the scanner to use when scanning the XML document + * + * This method allows users to set the scanner to use + * when scanning a given XML document. + * + * @param scannerName The name of the desired scanner + */ + void useScanner(const XMLCh* const scannerName); + + /** Set the implementation to use when creating the document + * + * This method allows users to set the implementation to use + * to create the document when parseing. + * + * @param implementationFeatures The names of the desired features the implementation should have. + */ + void useImplementation(const XMLCh* const implementationFeatures); + + /** + * This method installs the user specified PSVI handler on + * the parser. + * + * @param handler A pointer to the PSVI handler to be called + * when the parser comes across 'PSVI' events + * as per the schema specification. + */ + virtual void setPSVIHandler(PSVIHandler* const handler); + + /** Set the 'associate schema info' flag + * + * This method allows users to specify whether + * the parser should store schema informations in the element + * and attribute nodes in the DOM tree being produced. + * + * @param newState The state to set + * @see #getCreateSchemaInfo + */ + void setCreateSchemaInfo(const bool newState); + + /** Set the 'do XInclude' flag + * + * This method allows users to specify whether + * the parser should process XInclude nodes + * in the DOM tree being produced. + * + * @param newState The state to set + * @see #getDoXInclude + */ + void setDoXInclude(const bool newState); + + /** Set the 'ignore annotation' flag + * + * This method gives users the option to not generate XSAnnotations + * when "traversing" a schema. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreAnnotations(const bool newValue); + + /** Set the 'disable default entity resolution' flag + * + * This method gives users the option to not perform default entity + * resolution. If the user's resolveEntity method returns NULL the + * parser will try to resolve the entity on its own. When this option + * is set to true, the parser will not attempt to resolve the entity + * when the resolveEntity method returns NULL. + * + * The parser's default state is false + * + * @param newValue The state to set + * + * @see #EntityResolver + */ + void setDisableDefaultEntityResolution(const bool newValue); + + /** Set the 'skip DTD validation' flag + * + * This method gives users the option to skip DTD validation only when + * schema validation is on (i.e. when performing validation, we will + * ignore the DTD, except for entities, when schema validation is enabled). + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setSkipDTDValidation(const bool newValue); + + /** Set the 'handle multiple schema imports' flag + * + * This method gives users the ability to import multiple schemas that + * have the same namespace. + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setHandleMultipleImports(const bool newValue); + //@} + + + // ----------------------------------------------------------------------- + // Parsing methods + // ----------------------------------------------------------------------- + + /** @name Parsing methods */ + //@{ + + /** Parse via an input source object + * + * This method invokes the parsing process on the XML file specified + * by the InputSource parameter. This API is borrowed from the + * SAX Parser interface. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * @see InputSource#InputSource + */ + void parse(const InputSource& source); + + /** Parse via a file path or URL + * + * This method invokes the parsing process on the XML file specified by + * the Unicode string parameter 'systemId'. This method is borrowed + * from the SAX Parser interface. + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML file to be parsed. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * @see #parse(InputSource,...) + */ + void parse(const XMLCh* const systemId); + + /** Parse via a file path or URL (in the local code page) + * + * This method invokes the parsing process on the XML file specified by + * the native char* string parameter 'systemId'. + * + * @param systemId A const char pointer to a native string which + * contains the path to the XML file to be parsed. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * @see #parse(InputSource,...) + */ + void parse(const char* const systemId); + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a Unicode string representing the path + * to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ); + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a regular native string representing + * the path to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ); + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + */ + bool parseFirst + ( + const InputSource& source + , XMLPScanToken& toFill + ); + + /** Continue a progressive parse operation + * + * This method is used to continue with progressive parsing of + * XML files started by a call to 'parseFirst' method. + * + * It parses the XML file and stops as soon as it comes across + * a XML token (as defined in the XML specification). + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the next XML token. + * It indicates the user can go ahead with parsing the rest + * of the file. It returns 'false' to indicate that the parser + * could not find next token as per the XML specification + * production rule. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseNext(XMLPScanToken& token); + + /** Reset the parser after a progressive parse + * + * If a progressive parse loop exits before the end of the document + * is reached, the parser has no way of knowing this. So it will leave + * open any files or sockets or memory buffers that were in use at + * the time that the parse loop exited. + * + * The next parse operation will cause these open files and such to + * be closed, but the next parse operation might occur at some unknown + * future point. To avoid this problem, you should reset the parser if + * you exit the loop early. + * + * If you exited because of an error, then this cleanup will be done + * for you. Its only when you exit the file prematurely of your own + * accord, because you've found what you wanted in the file most + * likely. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + void parseReset(XMLPScanToken& token); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the PSVIHandler interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the PSVIHandler interface. */ + //@{ + + /** Receive notification of the PSVI properties of an element. + * The scanner will issue this call after the XMLDocumentHandler + * endElement call. Since the scanner will issue the psviAttributes + * call immediately after reading the start tag of an element, all element + * content will be effectively bracketed by these two calls. + * @param localName The name of the element whose end tag was just + * parsed. + * @param uri The namespace to which the element is bound + * @param elementInfo Object containing the element's PSVI properties + */ + virtual void handleElementPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo + ); + + virtual void handlePartialElementPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIElement * elementInfo + ); + /** + * Enables PSVI information about attributes to be passed back to the + * application. This callback will be made on *all* + * elements; on elements with no attributes, the final parameter will + * be null. + * @param localName The name of the element upon which start tag + * these attributes were encountered. + * @param uri The namespace to which the element is bound + * @param psviAttributes Object containing the attributes' PSVI properties + * with information to identify them. + */ + virtual void handleAttributesPSVI + ( + const XMLCh* const localName + , const XMLCh* const uri + , PSVIAttributeList * psviAttributes + ); + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLDocumentHandler interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLDocumentHandler interface. */ + //@{ + + /** Handle document character events + * + * This method is used to report all the characters scanned by the + * parser. This DOM implementation stores this data in the appropriate + * DOM node, creating one if necessary. + * + * @param chars A const pointer to a Unicode string representing the + * character data. + * @param length The length of the Unicode string returned in 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + */ + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** Handle a document comment event + * + * This method is used to report any comments scanned by the parser. + * A new comment node is created which stores this data. + * + * @param comment A const pointer to a null terminated Unicode + * string representing the comment text. + */ + virtual void docComment + ( + const XMLCh* const comment + ); + + /** Handle a document PI event + * + * This method is used to report any PI scanned by the parser. A new + * PI node is created and appended as a child of the current node in + * the tree. + * + * @param target A const pointer to a Unicode string representing the + * target of the PI declaration. + * @param data A const pointer to a Unicode string representing the + * data of the PI declaration. See the PI production rule + * in the XML specification for details. + */ + virtual void docPI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** Handle the end of document event + * + * This method is used to indicate the end of the current document. + */ + virtual void endDocument(); + + /** Handle and end of element event + * + * This method is used to indicate the end tag of an element. The + * DOM parser pops the current element off the top of the element + * stack, and make it the new current element. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param isRoot A flag indicating whether this element was the + * root element. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + */ + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix + ); + + /** Handle and end of entity reference event + * + * This method is used to indicate that an end of an entity reference + * was just scanned. + * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void endEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** Handle an ignorable whitespace vent + * + * This method is used to report all the whitespace characters, which + * are determined to be 'ignorable'. This distinction between characters + * is only made, if validation is enabled. + * + * Any whitespace before content is ignored. If the current node is + * already of type DOMNode::TEXT_NODE, then these whitespaces are + * appended, otherwise a new Text node is created which stores this + * data. Essentially all contiguous ignorable characters are collected + * in one node. + * + * @param chars A const pointer to a Unicode string representing the + * ignorable whitespace character data. + * @param length The length of the Unicode string 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** Handle a document reset event + * + * This method allows the user installed Document Handler to 'reset' + * itself, freeing all the memory resources. The scanner calls this + * method before starting a new parse event. + */ + virtual void resetDocument(); + + /** Handle a start document event + * + * This method is used to report the start of the parsing process. + */ + virtual void startDocument(); + + /** Handle a start element event + * + * This method is used to report the start of an element. It is + * called at the end of the element, by which time all attributes + * specified are also parsed. A new DOM Element node is created + * along with as many attribute nodes as required. This new element + * is added appended as a child of the current node in the tree, and + * then replaces it as the current node (if the isEmpty flag is false.) + * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @param attrList A const reference to the object containing the + * list of attributes just scanned for this element. + * @param attrCount A count of number of attributes in the list + * specified by the parameter 'attrList'. + * @param isEmpty A flag indicating whether this is an empty element + * or not. If empty, then no endElement() call will + * be made. + * @param isRoot A flag indicating whether this element was the + * root element. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ); + + /** Handle a start entity reference event + * + * This method is used to indicate the start of an entity reference. + * If the expand entity reference flag is true, then a new + * DOM Entity reference node is created. + * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void startEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** Handle an XMLDecl event + * + * This method is used to report the XML decl scanned by the parser. + * Refer to the XML specification to see the meaning of parameters. + * + * This method is a no-op for this DOM + * implementation. + * + * @param versionStr A const pointer to a Unicode string representing + * version string value. + * @param encodingStr A const pointer to a Unicode string representing + * the encoding string value. + * @param standaloneStr A const pointer to a Unicode string + * representing the standalone string value. + * @param actualEncStr A const pointer to a Unicode string + * representing the actual encoding string + * value. + */ + virtual void XMLDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncStr + ); + + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the deprecated DocTypeHandler interface. + // ----------------------------------------------------------------------- + /** @name Deprecated DocTypeHandler Interfaces */ + //@{ + virtual void attDef + ( + const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool ignoring + ); + + virtual void doctypeComment + ( + const XMLCh* const comment + ); + + virtual void doctypeDecl + ( + const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool hasIntSubset + , const bool hasExtSubset = false + ); + + virtual void doctypePI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + virtual void doctypeWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + virtual void elementDecl + ( + const DTDElementDecl& decl + , const bool isIgnored + ); + + virtual void endAttList + ( + const DTDElementDecl& elemDecl + ); + + virtual void endIntSubset(); + + virtual void endExtSubset(); + + virtual void entityDecl + ( + const DTDEntityDecl& entityDecl + , const bool isPEDecl + , const bool isIgnored + ); + + virtual void resetDocType(); + + virtual void notationDecl + ( + const XMLNotationDecl& notDecl + , const bool isIgnored + ); + + virtual void startAttList + ( + const DTDElementDecl& elemDecl + ); + + virtual void startIntSubset(); + + virtual void startExtSubset(); + + virtual void TextDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + ); + + //@} + +protected: + // DOM node creation hooks. Override them if you are using your own + // DOM node types. + // + virtual DOMCDATASection* createCDATASection (const XMLCh*, XMLSize_t); + virtual DOMText* createText (const XMLCh*, XMLSize_t); + + virtual DOMElement* createElement (const XMLCh* name); + virtual DOMElement* createElementNS (const XMLCh* namespaceURI, + const XMLCh* elemPrefix, + const XMLCh* localName, + const XMLCh* qName); + + virtual DOMAttr* createAttr (const XMLCh* name); + virtual DOMAttr* createAttrNS (const XMLCh* namespaceURI, + const XMLCh* elemPrefix, + const XMLCh* localName, + const XMLCh* qName); + + + + +protected : + // ----------------------------------------------------------------------- + // Protected Constructor Methods + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + /** Construct a AbstractDOMParser, with an optional validator + * + * Constructor with an instance of validator class to use for + * validation. If you don't provide a validator, a default one will + * be created for you in the scanner. + * + * @param valToAdopt Pointer to the validator instance to use. The + * parser is responsible for freeing the memory. + * + * @param gramPool Pointer to the grammar pool instance from + * external application (through derivatives). + * The parser does NOT own it. + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + AbstractDOMParser + ( + XMLValidator* const valToAdopt = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + //@} + + // ----------------------------------------------------------------------- + // Protected getter methods + // ----------------------------------------------------------------------- + /** @name Protected getter methods */ + //@{ + /** Get the current DOM node + * + * This provides derived classes with access to the current node, i.e. + * the node to which new nodes are being added. + */ + DOMNode* getCurrentNode(); + + /** Get the XML scanner + * + * This provides derived classes with access to the XML scanner. + */ + XMLScanner* getScanner() const; + + /** Get the Grammar resolver + * + * This provides derived classes with access to the grammar resolver. + */ + GrammarResolver* getGrammarResolver() const; + + /** Get the parse in progress flag + * + * This provides derived classes with access to the parse in progress + * flag. + */ + bool getParseInProgress() const; + + MemoryManager* getMemoryManager() const; + + //@} + + + // ----------------------------------------------------------------------- + // Protected setter methods + // ----------------------------------------------------------------------- + + /** @name Protected setter methods */ + //@{ + + /** Set the current DOM node + * + * This method sets the current node maintained inside the parser to + * the one specified. + * + * @param toSet The DOM node which will be the current node. + */ + void setCurrentNode(DOMNode* toSet); + + /** Set the document node + * + * This method sets the DOM Document node to the one specified. + * + * @param toSet The new DOM Document node for this XML document. + */ + void setDocument(DOMDocument* toSet); + + /** Set the parse in progress flag + * + * This method sets the parse in progress flag to true or false. + * + * @param toSet The value of the flag to be set. + */ + void setParseInProgress(const bool toSet); + //@} + + // ----------------------------------------------------------------------- + // Protected Helper methods + // ----------------------------------------------------------------------- + /** @name Protected helper methods */ + //@{ + void resetPool(); + + /** + * Returns true if the user has adopted the document + */ + bool isDocumentAdopted() const; + + //@} + + +private : + // ----------------------------------------------------------------------- + // Initialize/Cleanup methods + // ----------------------------------------------------------------------- + void initialize(); + void cleanUp(); + void resetInProgress(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AbstractDOMParser(const AbstractDOMParser&); + AbstractDOMParser& operator=(const AbstractDOMParser&); + +protected: + // ----------------------------------------------------------------------- + // Protected data members + // + // fCurrentNode + // fCurrentParent + // Used to track the current node during nested element events. Since + // the tree must be built from a set of disjoint callbacks, we need + // these to keep up with where we currently are. + // + // fCurrentEntity + // Used to track the current entity decl. If a text decl is seen later on, + // it is used to update the encoding and version information. + // + // fDocument + // The root document object, filled with the document contents. + // + // fCreateEntityReferenceNodes + // Indicates whether entity reference nodes should be created. + // + // fIncludeIgnorableWhitespace + // Indicates whether ignorable whitespace should be added to + // the DOM tree for validating parsers. + // + // fScanner + // The scanner used for this parser. This is created during the + // constructor. + // + // fImplementationFeatures + // The implementation features that we use to get an implementation + // for use in creating the DOMDocument used during parse. If this is + // null then the default DOMImplementation is used + // + // fParseInProgress + // Used to prevent multiple entrance to the parser while its doing + // a parse. + // + // fWithinElement + // A flag to indicate that the parser is within at least one level + // of element processing. + // + // fDocumentType + // Used to store and update the documentType variable information + // in fDocument + // + // fDocumentVector + // Store all the previous fDocument(s) (thus not the current fDocument) + // created in this parser. It is destroyed when the parser is destructed. + // + // fCreateCommentNodes + // Indicates whether comment nodes should be created. + // + // fDocumentAdoptedByUser + // The DOMDocument ownership has been transferred to application + // If set to true, the parser does not own the document anymore + // and thus will not release its memory. + // + // fInternalSubset + // Buffer for storing the internal subset information. + // Once complete (after DOCTYPE is finished scanning), send + // it to DocumentType Node + // + // fGrammarPool + // The grammar pool passed from external application (through derivatives). + // which could be 0, not owned. + // + // fCreateSchemaInfo + // Indicates whether element and attributes will have schema info associated + // + // fDoXinclude + // A bool used to request that XInlcude processing occur on the + // Document the parser parses. + // ----------------------------------------------------------------------- + bool fCreateEntityReferenceNodes; + bool fIncludeIgnorableWhitespace; + bool fWithinElement; + bool fParseInProgress; + bool fCreateCommentNodes; + bool fDocumentAdoptedByUser; + bool fCreateSchemaInfo; + bool fDoXInclude; + XMLScanner* fScanner; + XMLCh* fImplementationFeatures; + DOMNode* fCurrentParent; + DOMNode* fCurrentNode; + DOMEntityImpl* fCurrentEntity; + DOMDocumentImpl* fDocument; + DOMDocumentTypeImpl* fDocumentType; + RefVectorOf* fDocumentVector; + GrammarResolver* fGrammarResolver; + XMLStringPool* fURIStringPool; + XMLValidator* fValidator; + MemoryManager* fMemoryManager; + XMLGrammarPool* fGrammarPool; + XMLBufferMgr fBufMgr; + XMLBuffer& fInternalSubset; + PSVIHandler* fPSVIHandler; +}; + + + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Getter methods +// --------------------------------------------------------------------------- +inline bool AbstractDOMParser::getCreateEntityReferenceNodes() const +{ + return fCreateEntityReferenceNodes; +} + +inline bool AbstractDOMParser::getIncludeIgnorableWhitespace() const +{ + return fIncludeIgnorableWhitespace; +} + +inline bool AbstractDOMParser::getParseInProgress() const +{ + return fParseInProgress; +} + +inline XMLScanner* AbstractDOMParser::getScanner() const +{ + return fScanner; +} + +inline GrammarResolver* AbstractDOMParser::getGrammarResolver() const +{ + return fGrammarResolver; +} + +inline bool AbstractDOMParser::getCreateCommentNodes() const +{ + return fCreateCommentNodes; +} + +inline PSVIHandler* AbstractDOMParser::getPSVIHandler() +{ + return fPSVIHandler; +} + +inline const PSVIHandler* AbstractDOMParser::getPSVIHandler() const +{ + return fPSVIHandler; +} + +inline bool AbstractDOMParser::getCreateSchemaInfo() const +{ + return fCreateSchemaInfo; +} + +inline bool AbstractDOMParser::getDoXInclude() const +{ + return fDoXInclude; +} +// --------------------------------------------------------------------------- +// AbstractDOMParser: Setter methods +// --------------------------------------------------------------------------- +inline void AbstractDOMParser::setCreateEntityReferenceNodes(const bool create) +{ + fCreateEntityReferenceNodes = create; +} + +inline void AbstractDOMParser::setIncludeIgnorableWhitespace(const bool include) +{ + fIncludeIgnorableWhitespace = include; +} + +inline void AbstractDOMParser::setCreateCommentNodes(const bool create) +{ + fCreateCommentNodes = create; +} + +inline void AbstractDOMParser::useImplementation(const XMLCh* const implementationFeatures) +{ + fMemoryManager->deallocate(fImplementationFeatures); + fImplementationFeatures = XMLString::replicate(implementationFeatures, fMemoryManager); +} + +inline void AbstractDOMParser::setDoXInclude(const bool newState) +{ + fDoXInclude = newState; +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Protected getter methods +// --------------------------------------------------------------------------- +inline DOMNode* AbstractDOMParser::getCurrentNode() +{ + return fCurrentNode; +} + +inline MemoryManager* AbstractDOMParser::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// AbstractDOMParser: Protected setter methods +// --------------------------------------------------------------------------- +inline void AbstractDOMParser::setCurrentNode(DOMNode* toSet) +{ + fCurrentNode = toSet; +} + +inline void AbstractDOMParser::setParseInProgress(const bool toSet) +{ + fParseInProgress = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.cpp b/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.cpp new file mode 100644 index 000000000..860878094 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.cpp @@ -0,0 +1,1379 @@ +/* + * 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. + */ + +/** +* This file contains code to build the DOM tree. It registers a document +* handler with the scanner. In these handler methods, appropriate DOM nodes +* are created and added to the DOM tree. +* +* $Id: DOMLSParserImpl.cpp 882548 2009-11-20 13:44:14Z borisk $ +* +*/ + + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// A filter used to abort processing +// --------------------------------------------------------------------------- +class __AbortFilter : public DOMLSParserFilter +{ +public: + __AbortFilter() {} + virtual FilterAction acceptNode(DOMNode*) { return FILTER_INTERRUPT; } + virtual FilterAction startElement(DOMElement* ) { return FILTER_INTERRUPT; } + virtual DOMNodeFilter::ShowType getWhatToShow() const { return DOMNodeFilter::SHOW_ALL; } +}; + +static __AbortFilter g_AbortFilter; + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Constructors and Destructor +// --------------------------------------------------------------------------- +DOMLSParserImpl::DOMLSParserImpl( XMLValidator* const valToAdopt + , MemoryManager* const manager + , XMLGrammarPool* const gramPool) : + +AbstractDOMParser(valToAdopt, manager, gramPool) +, fEntityResolver(0) +, fXMLEntityResolver(0) +, fErrorHandler(0) +, fFilter(0) +, fCharsetOverridesXMLEncoding(true) +, fUserAdoptsDocument(false) +, fSupportedParameters(0) +, fFilterAction(0) +, fFilterDelayedTextNodes(0) +, fWrapNodesInDocumentFragment(0) +, fWrapNodesContext(0) +{ + // dom spec has different default from scanner's default, so set explicitly + getScanner()->setNormalizeData(false); + + fSupportedParameters=new (fMemoryManager) DOMStringListImpl(48, manager); + fSupportedParameters->add(XMLUni::fgDOMResourceResolver); + fSupportedParameters->add(XMLUni::fgDOMErrorHandler); + fSupportedParameters->add(XMLUni::fgXercesEntityResolver); + fSupportedParameters->add(XMLUni::fgXercesSchemaExternalSchemaLocation); + fSupportedParameters->add(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation); + fSupportedParameters->add(XMLUni::fgXercesSecurityManager); + fSupportedParameters->add(XMLUni::fgXercesScannerName); + fSupportedParameters->add(XMLUni::fgXercesParserUseDocumentFromImplementation); + fSupportedParameters->add(XMLUni::fgDOMCharsetOverridesXMLEncoding); + fSupportedParameters->add(XMLUni::fgDOMDisallowDoctype); + fSupportedParameters->add(XMLUni::fgDOMIgnoreUnknownCharacterDenormalization); + fSupportedParameters->add(XMLUni::fgDOMNamespaces); + fSupportedParameters->add(XMLUni::fgDOMSupportedMediatypesOnly); + fSupportedParameters->add(XMLUni::fgDOMValidate); + fSupportedParameters->add(XMLUni::fgDOMValidateIfSchema); + fSupportedParameters->add(XMLUni::fgDOMWellFormed); + fSupportedParameters->add(XMLUni::fgDOMCanonicalForm); + fSupportedParameters->add(XMLUni::fgDOMCDATASections); + fSupportedParameters->add(XMLUni::fgDOMCheckCharacterNormalization); + fSupportedParameters->add(XMLUni::fgDOMComments); + fSupportedParameters->add(XMLUni::fgDOMDatatypeNormalization); + fSupportedParameters->add(XMLUni::fgDOMElementContentWhitespace); + fSupportedParameters->add(XMLUni::fgDOMEntities); + fSupportedParameters->add(XMLUni::fgDOMNamespaceDeclarations); + fSupportedParameters->add(XMLUni::fgDOMNormalizeCharacters); + fSupportedParameters->add(XMLUni::fgDOMSchemaLocation); + fSupportedParameters->add(XMLUni::fgDOMSchemaType); + fSupportedParameters->add(XMLUni::fgDOMSplitCDATASections); + fSupportedParameters->add(XMLUni::fgDOMInfoset); + fSupportedParameters->add(XMLUni::fgXercesSchema); + fSupportedParameters->add(XMLUni::fgXercesSchemaFullChecking); + fSupportedParameters->add(XMLUni::fgXercesUserAdoptsDOMDocument); + fSupportedParameters->add(XMLUni::fgXercesLoadExternalDTD); + fSupportedParameters->add(XMLUni::fgXercesLoadSchema); + fSupportedParameters->add(XMLUni::fgXercesContinueAfterFatalError); + fSupportedParameters->add(XMLUni::fgXercesValidationErrorAsFatal); + fSupportedParameters->add(XMLUni::fgXercesCacheGrammarFromParse); + fSupportedParameters->add(XMLUni::fgXercesUseCachedGrammarInParse); + fSupportedParameters->add(XMLUni::fgXercesCalculateSrcOfs); + fSupportedParameters->add(XMLUni::fgXercesStandardUriConformant); + fSupportedParameters->add(XMLUni::fgXercesDOMHasPSVIInfo); + fSupportedParameters->add(XMLUni::fgXercesGenerateSyntheticAnnotations); + fSupportedParameters->add(XMLUni::fgXercesValidateAnnotations); + fSupportedParameters->add(XMLUni::fgXercesIdentityConstraintChecking); + fSupportedParameters->add(XMLUni::fgXercesIgnoreCachedDTD); + fSupportedParameters->add(XMLUni::fgXercesIgnoreAnnotations); + fSupportedParameters->add(XMLUni::fgXercesDisableDefaultEntityResolution); + fSupportedParameters->add(XMLUni::fgXercesSkipDTDValidation); + fSupportedParameters->add(XMLUni::fgXercesDoXInclude); + fSupportedParameters->add(XMLUni::fgXercesHandleMultipleImports); + + // LSParser by default does namespace processing + setDoNamespaces(true); +} + + +DOMLSParserImpl::~DOMLSParserImpl() +{ + delete fSupportedParameters; + delete fFilterAction; + delete fFilterDelayedTextNodes; +} + + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Setter methods +// --------------------------------------------------------------------------- +bool DOMLSParserImpl::getBusy() const +{ + return getParseInProgress(); +} + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Setter methods +// --------------------------------------------------------------------------- +void DOMLSParserImpl::setFilter(DOMLSParserFilter* const filter) +{ + fFilter = filter; +} + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: DOMConfiguration methods +// --------------------------------------------------------------------------- +void DOMLSParserImpl::setParameter(const XMLCh* name, const void* value) +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgDOMResourceResolver) == 0) + { + fEntityResolver = (DOMLSResourceResolver*)value; + if (fEntityResolver) { + getScanner()->setEntityHandler(this); + fXMLEntityResolver = 0; + } + else { + getScanner()->setEntityHandler(0); + } + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler) == 0) + { + fErrorHandler = (DOMErrorHandler*)value; + if (fErrorHandler) { + getScanner()->setErrorReporter(this); + } + else { + getScanner()->setErrorReporter(0); + } + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesEntityResolver) == 0) + { + fXMLEntityResolver = (XMLEntityResolver*)value; + if (fXMLEntityResolver) { + getScanner()->setEntityHandler(this); + fEntityResolver = 0; + } + else { + getScanner()->setEntityHandler(0); + } + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0) + { + setExternalSchemaLocation((XMLCh*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation) == 0) + { + setExternalNoNamespaceSchemaLocation((XMLCh*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSecurityManager) == 0) + { + setSecurityManager((SecurityManager*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesScannerName) == 0) + { + AbstractDOMParser::useScanner((const XMLCh*) value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesParserUseDocumentFromImplementation) == 0) + { + useImplementation((const XMLCh*) value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLowWaterMark) == 0) + { + setLowWaterMark(*(const XMLSize_t*)value); + } + else + throw DOMException(DOMException::NOT_FOUND_ERR, 0, getMemoryManager()); +} + +void DOMLSParserImpl::setParameter(const XMLCh* name, bool state) +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCharsetOverridesXMLEncoding) == 0) + { + // in fact, setting this has no effect to the parser + fCharsetOverridesXMLEncoding = state; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDisallowDoctype) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMIgnoreUnknownCharacterDenormalization) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces) == 0) + { + setDoNamespaces(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSupportedMediatypesOnly) == 0) + { + if (state) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate) == 0) + { + if (state) { + if (getValidationScheme() == AbstractDOMParser::Val_Never) + setValidationScheme(AbstractDOMParser::Val_Always); + } + else { + setValidationScheme(AbstractDOMParser::Val_Never); + } + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema) == 0) + { + if (state) { + setValidationScheme(AbstractDOMParser::Val_Auto); + } + else { + setValidationScheme(AbstractDOMParser::Val_Never); + } + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMWellFormed) == 0) + { + if(state==false) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm) == 0 ) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections) == 0 ) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCheckCharacterNormalization) == 0 ) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMComments) == 0) + { + setCreateCommentNodes(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization) == 0) + { + getScanner()->setNormalizeData(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace) == 0) + { + setIncludeIgnorableWhitespace(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities) == 0) + { + setCreateEntityReferenceNodes(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations) == 0) + { + if (state==false) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections) == 0) + { + // TODO + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset) == 0) + { + if (!state) + throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager()); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchema) == 0) + { + setDoSchema(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0) + { + setValidationSchemaFullChecking(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesUserAdoptsDOMDocument) == 0) + { + if(state) + fUserAdoptsDocument = true; + else + fUserAdoptsDocument = false; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0) + { + setLoadExternalDTD(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0) + { + setLoadSchema(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0) + { + setExitOnFirstFatalError(!state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0) + { + setValidationConstraintFatal(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0) + { + getScanner()->cacheGrammarFromParse(state); + + if (state) + getScanner()->useCachedGrammarInParse(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesUseCachedGrammarInParse) == 0) + { + if (state || !getScanner()->isCachingGrammarFromParse()) + getScanner()->useCachedGrammarInParse(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCalculateSrcOfs) == 0) + { + getScanner()->setCalculateSrcOfs(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesStandardUriConformant) == 0) + { + getScanner()->setStandardUriConformant(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDOMHasPSVIInfo) == 0) + { + setCreateSchemaInfo(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0) + { + getScanner()->setGenerateSyntheticAnnotations(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0) + { + getScanner()->setValidateAnnotations(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + { + getScanner()->setIdentityConstraintChecking(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) + { + getScanner()->setIgnoredCachedDTD(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + getScanner()->setIgnoreAnnotations(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + getScanner()->setDisableDefaultEntityResolution(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + getScanner()->setSkipDTDValidation(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDoXInclude) == 0) + { + setDoXInclude(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesHandleMultipleImports) == 0) + { + getScanner()->setHandleMultipleImports(state); + } + else + throw DOMException(DOMException::NOT_FOUND_ERR, 0, getMemoryManager()); +} + +const void* DOMLSParserImpl::getParameter(const XMLCh* name) const +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCharsetOverridesXMLEncoding) == 0) + { + return (void*)fCharsetOverridesXMLEncoding; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDisallowDoctype) == 0) + { + // TODO + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMIgnoreUnknownCharacterDenormalization) == 0) + { + // TODO + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces) == 0) + { + return (void*)getDoNamespaces(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMResourceResolver) == 0) + { + return fEntityResolver; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSupportedMediatypesOnly) == 0) + { + return (void*)false; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate) == 0) + { + return (void*)(getValidationScheme() != AbstractDOMParser::Val_Never); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema) == 0) + { + return (void*)(getValidationScheme() == AbstractDOMParser::Val_Auto); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMWellFormed) == 0) + { + return (void*)true; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm) == 0 ) + { + // TODO + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections) == 0 ) + { + // TODO + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCheckCharacterNormalization) == 0 ) + { + // TODO + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMComments) == 0) + { + return (void*)getCreateCommentNodes(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization) == 0) + { + return (void*)getScanner()->getNormalizeData(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace) == 0) + { + return (void*)getIncludeIgnorableWhitespace(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities) == 0) + { + return (void*)getCreateEntityReferenceNodes(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler) == 0) + { + return fErrorHandler; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations) == 0) + { + return (void*)true; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters) == 0) + { + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation) == 0) + { + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType) == 0) + { + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections) == 0) + { + return 0; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset) == 0) + { + return (void*)true; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchema) == 0) + { + return (void*)getDoSchema(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0) + { + return (void*)getValidationSchemaFullChecking(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + { + return (void*)getIdentityConstraintChecking(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0) + { + return (void*)getLoadExternalDTD(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0) + { + return (void*)getLoadSchema(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0) + { + return (void*)!getExitOnFirstFatalError(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0) + { + return (void*)getValidationConstraintFatal(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0) + { + return (void*)getScanner()->isCachingGrammarFromParse(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesUseCachedGrammarInParse) == 0) + { + return (void*)getScanner()->isUsingCachedGrammarInParse(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCalculateSrcOfs) == 0) + { + return (void*)getScanner()->getCalculateSrcOfs(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesStandardUriConformant) == 0) + { + return (void*)getScanner()->getStandardUriConformant(); + } + else if(XMLString::compareIStringASCII(name, XMLUni::fgXercesUserAdoptsDOMDocument) == 0) + { + return (void*)fUserAdoptsDocument; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDOMHasPSVIInfo) == 0) + { + return (void*)getCreateSchemaInfo(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0) + { + return (void*)getScanner()->getGenerateSyntheticAnnotations(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0) + { + return (void*)getScanner()->getValidateAnnotations(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) + { + return (void*)getScanner()->getIgnoreCachedDTD(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + return (void*)getScanner()->getIgnoreAnnotations(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + return (void*)getScanner()->getDisableDefaultEntityResolution(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + return (void*)getScanner()->getSkipDTDValidation(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesHandleMultipleImports) == 0) + { + return (void*)getScanner()->getHandleMultipleImports(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesEntityResolver) == 0) + { + return fXMLEntityResolver; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0) + { + return getExternalSchemaLocation(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation) == 0) + { + return getExternalNoNamespaceSchemaLocation(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSecurityManager) == 0) + { + return getSecurityManager(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDoXInclude) == 0) + { + return (void *)getDoXInclude(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLowWaterMark) == 0) + { + return (void*)&getLowWaterMark(); + } + else + throw DOMException(DOMException::NOT_FOUND_ERR, 0, getMemoryManager()); +} + +bool DOMLSParserImpl::canSetParameter(const XMLCh* name, const void* /*value*/) const +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgDOMResourceResolver) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesEntityResolver) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSecurityManager) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesScannerName) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesParserUseDocumentFromImplementation) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesLowWaterMark) == 0) + return true; + else if(XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType) == 0) + return false; + + return false; +} + +bool DOMLSParserImpl::canSetParameter(const XMLCh* name, bool value) const +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCharsetOverridesXMLEncoding) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMComments) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSchema) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesUseCachedGrammarInParse) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesCalculateSrcOfs) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesStandardUriConformant) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesUserAdoptsDOMDocument) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesDOMHasPSVIInfo) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesDoXInclude) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgXercesHandleMultipleImports) == 0) + return true; + else if(XMLString::compareIStringASCII(name, XMLUni::fgDOMDisallowDoctype) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMIgnoreUnknownCharacterDenormalization) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMCheckCharacterNormalization) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections) == 0) + return false; + else if(XMLString::compareIStringASCII(name, XMLUni::fgDOMSupportedMediatypesOnly) == 0) + return value?false:true; + else if(XMLString::compareIStringASCII(name, XMLUni::fgDOMWellFormed) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations) == 0 || + XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset) == 0) + return value?true:false; + + return false; +} + +const DOMStringList* DOMLSParserImpl::getParameterNames() const +{ + return fSupportedParameters; +} + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Feature methods +// --------------------------------------------------------------------------- +void DOMLSParserImpl::release() +{ + DOMLSParserImpl* builder = (DOMLSParserImpl*) this; + delete builder; +} + +void DOMLSParserImpl::resetDocumentPool() +{ + resetPool(); +} + + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Parsing methods +// --------------------------------------------------------------------------- +DOMDocument* DOMLSParserImpl::parse(const DOMLSInput* source) +{ + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + // remove the abort filter, if present + if(fFilter==&g_AbortFilter) + fFilter=0; + if(fFilterAction) + fFilterAction->removeAll(); + if(fFilterDelayedTextNodes) + fFilterDelayedTextNodes->removeAll(); + + Wrapper4DOMLSInput isWrapper((DOMLSInput*)source, fEntityResolver, false, getMemoryManager()); + + AbstractDOMParser::parse(isWrapper); + + // Disabled until 4.0.0. See XERCESC-1894 for details. + //if(getErrorCount()!=0) + // throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingFailed, fMemoryManager); + + if (fUserAdoptsDocument) + return adoptDocument(); + else + return getDocument(); +} + +DOMDocument* DOMLSParserImpl::parseURI(const XMLCh* const systemId) +{ + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + // remove the abort filter, if present + if(fFilter==&g_AbortFilter) + fFilter=0; + if(fFilterAction) + fFilterAction->removeAll(); + if(fFilterDelayedTextNodes) + fFilterDelayedTextNodes->removeAll(); + + AbstractDOMParser::parse(systemId); + + // Disabled until 4.0.0. See XERCESC-1894 for details. + //if(getErrorCount()!=0) + // throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingFailed, fMemoryManager); + + if (fUserAdoptsDocument) + return adoptDocument(); + else + return getDocument(); +} + +DOMDocument* DOMLSParserImpl::parseURI(const char* const systemId) +{ + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + // remove the abort filter, if present + if(fFilter==&g_AbortFilter) + fFilter=0; + if(fFilterAction) + fFilterAction->removeAll(); + if(fFilterDelayedTextNodes) + fFilterDelayedTextNodes->removeAll(); + + AbstractDOMParser::parse(systemId); + + // Disabled until 4.0.0. See XERCESC-1894 for details. + //if(getErrorCount()!=0) + // throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingFailed, fMemoryManager); + + if (fUserAdoptsDocument) + return adoptDocument(); + else + return getDocument(); +} + +void DOMLSParserImpl::startDocument() +{ + if(fWrapNodesInDocumentFragment) + { + fDocument = (DOMDocumentImpl*)fWrapNodesInDocumentFragment->getOwnerDocument(); + fCurrentParent = fCurrentNode = fWrapNodesInDocumentFragment; + // set DOM error checking off + fDocument->setErrorChecking(false); + + // if we have namespaces in scope, push them down to the reader + ValueHashTableOf inScopeNS(7, fMemoryManager); + DOMNode* cursor = fWrapNodesContext; + while(cursor) + { + if(cursor->getNodeType()==DOMNode::ELEMENT_NODE) + { + DOMNamedNodeMap* attrs = cursor->getAttributes(); + for(XMLSize_t i=0; igetLength(); i++) + { + DOMNode* attr = attrs->item(i); + if(XMLString::equals(attr->getNamespaceURI(), XMLUni::fgXMLNSURIName) && !inScopeNS.containsKey(attr->getLocalName())) + inScopeNS.put((void*)attr->getLocalName(), fScanner->getURIStringPool()->addOrFind(attr->getNodeValue())); + else if(XMLString::equals(attr->getNodeName(), XMLUni::fgXMLNSString) && !inScopeNS.containsKey(XMLUni::fgZeroLenString)) + inScopeNS.put((void*)XMLUni::fgZeroLenString, fScanner->getURIStringPool()->addOrFind(attr->getNodeValue())); + } + } + cursor = cursor->getParentNode(); + } + ValueHashTableOfEnumerator iter(&inScopeNS, false, fMemoryManager); + while(iter.hasMoreElements()) + { + XMLCh* prefix = (XMLCh*)iter.nextElementKey(); + fScanner->addGlobalPrefix(prefix, inScopeNS.get(prefix)); + } + + // in this case the document URI and the input encoding must be propagated to the context document + if(fWrapNodesAction==ACTION_REPLACE_CHILDREN && fWrapNodesContext->getNodeType()==DOMNode::DOCUMENT_NODE) + { + fDocument->setDocumentURI(fScanner->getLocator()->getSystemId()); + fDocument->setInputEncoding(fScanner->getReaderMgr()->getCurrentEncodingStr()); + } + } + else + AbstractDOMParser::startDocument(); +} + +void DOMLSParserImpl::XMLDecl( const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncStr + ) +{ + if(fWrapNodesInDocumentFragment && !(fWrapNodesAction==ACTION_REPLACE_CHILDREN && fWrapNodesContext->getNodeType()==DOMNode::DOCUMENT_NODE)) + { + // don't change the properties for the context document, unless the context node is a + // DOMDocument node and the action is ACTION_REPLACE_CHILDREN + } + else + AbstractDOMParser::XMLDecl(versionStr, encodingStr, standaloneStr, actualEncStr); +} + +DOMNode* DOMLSParserImpl::parseWithContext(const DOMLSInput* source, + DOMNode* contextNode, + const ActionType action) +{ + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + // remove the abort filter, if present + if(fFilter==&g_AbortFilter) + fFilter=0; + if(fFilterAction) + fFilterAction->removeAll(); + if(fFilterDelayedTextNodes) + fFilterDelayedTextNodes->removeAll(); + + DOMDocumentFragment* holder = contextNode->getOwnerDocument()->createDocumentFragment(); + // When parsing the input stream, the context node (or its parent, depending on where + // the result will be inserted) is used for resolving unbound namespace prefixes + if(action==ACTION_INSERT_BEFORE || action==ACTION_INSERT_AFTER || action==ACTION_REPLACE) + fWrapNodesContext = contextNode->getParentNode(); + else + fWrapNodesContext = contextNode; + fWrapNodesInDocumentFragment = holder; + fWrapNodesAction = action; + // When calling parseWithContext, the values of the following configuration parameters + // will be ignored and their default values will always be used instead: "validate", + // "validate-if-schema", and "element-content-whitespace". + ValSchemes oldValidate = getValidationScheme(); + setValidationScheme(Val_Never); + bool oldElementContentWhitespace = getIncludeIgnorableWhitespace(); + setIncludeIgnorableWhitespace(true); + + Wrapper4DOMLSInput isWrapper((DOMLSInput*)source, fEntityResolver, false, getMemoryManager()); + AbstractDOMParser::parse(isWrapper); + + setValidationScheme(oldValidate); + setIncludeIgnorableWhitespace(oldElementContentWhitespace); + fWrapNodesContext = NULL; + fWrapNodesInDocumentFragment = NULL; + fDocument = NULL; + + if(getErrorCount()!=0) + { + holder->release(); + throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingFailed, fMemoryManager); + } + + DOMNode* result = holder->getFirstChild(); + DOMNode* node, *parent = contextNode->getParentNode(); + switch(action) + { + case ACTION_REPLACE_CHILDREN: + // remove existing children + while((node = contextNode->getFirstChild())!=NULL) + contextNode->removeChild(node)->release(); + // then fall back to behave like an append + case ACTION_APPEND_AS_CHILDREN: + while((node = holder->getFirstChild())!=NULL) + contextNode->appendChild(holder->removeChild(node)); + break; + case ACTION_INSERT_BEFORE: + while((node = holder->getFirstChild())!=NULL) + parent->insertBefore(holder->removeChild(node), contextNode); + break; + case ACTION_INSERT_AFTER: + while((node = holder->getLastChild())!=NULL) + parent->insertBefore(holder->removeChild(node), contextNode->getNextSibling()); + break; + case ACTION_REPLACE: + while((node = holder->getFirstChild())!=NULL) + parent->insertBefore(holder->removeChild(node), contextNode); + parent->removeChild(contextNode)->release(); + break; + } + holder->release(); + + // TODO whenever we add support for DOM Mutation Events: + // As the new data is inserted into the document, at least one mutation event is fired + // per new immediate child or sibling of the context node. + return result; +} + +void DOMLSParserImpl::abort() +{ + fFilter=&g_AbortFilter; +} + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Implementation of the XMLErrorReporter interface +// --------------------------------------------------------------------------- +void DOMLSParserImpl::error( const unsigned int code + , const XMLCh* const + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const + , const XMLFileLoc lineNum + , const XMLFileLoc colNum) +{ + if (fErrorHandler) { + + DOMError::ErrorSeverity severity = DOMError::DOM_SEVERITY_ERROR; + + if (errType == XMLErrorReporter::ErrType_Warning) + severity = DOMError::DOM_SEVERITY_WARNING; + else if (errType == XMLErrorReporter::ErrType_Fatal) + severity = DOMError::DOM_SEVERITY_FATAL_ERROR; + + DOMLocatorImpl location(lineNum, colNum, getCurrentNode(), systemId); + if(getScanner()->getCalculateSrcOfs()) + location.setByteOffset(getScanner()->getSrcOffset()); + DOMErrorImpl domError(severity, errorText, &location); + + // if user return false, we should stop the process, so throw an error + bool toContinueProcess = true; + try + { + toContinueProcess = fErrorHandler->handleError(domError); + } + catch(...) + { + } + if (!toContinueProcess && !getScanner()->getInException()) + throw (XMLErrs::Codes) code; + } +} + +void DOMLSParserImpl::resetErrors() +{ +} + + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Implementation of XMLEntityHandler interface +// --------------------------------------------------------------------------- +InputSource* +DOMLSParserImpl::resolveEntity( XMLResourceIdentifier* resourceIdentifier ) +{ + // + // Just map it to the SAX entity resolver. If there is not one installed, + // return a null pointer to cause the default resolution. + // + if (fEntityResolver) { + DOMLSInput* is = fEntityResolver->resolveResource(resourceIdentifier->getResourceIdentifierType()==XMLResourceIdentifier::ExternalEntity?XMLUni::fgDOMDTDType:XMLUni::fgDOMXMLSchemaType, + resourceIdentifier->getNameSpace(), + resourceIdentifier->getPublicId(), + resourceIdentifier->getSystemId(), + resourceIdentifier->getBaseURI()); + if (is) + return new (getMemoryManager()) Wrapper4DOMLSInput(is, fEntityResolver, true, getMemoryManager()); + } + if (fXMLEntityResolver) { + return(fXMLEntityResolver->resolveEntity(resourceIdentifier)); + } + + return 0; +} + +typedef JanitorMemFunCall ResetParseType; + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Grammar preparsing methods +// --------------------------------------------------------------------------- +Grammar* DOMLSParserImpl::loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &DOMLSParserImpl::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + grammar = getScanner()->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +Grammar* DOMLSParserImpl::loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &DOMLSParserImpl::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + grammar = getScanner()->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +Grammar* DOMLSParserImpl::loadGrammar(const DOMLSInput* source, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + throw DOMException(DOMException::INVALID_STATE_ERR, XMLDOMMsg::LSParser_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &DOMLSParserImpl::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + Wrapper4DOMLSInput isWrapper((DOMLSInput*)source, fEntityResolver, false, getMemoryManager()); + grammar = getScanner()->loadGrammar(isWrapper, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +void DOMLSParserImpl::resetCachedGrammarPool() +{ + getGrammarResolver()->resetCachedGrammar(); + getScanner()->resetCachedGrammar(); +} + +void DOMLSParserImpl::resetParse() +{ + if (getScanner()->getDocTypeHandler() == 0) + { + getScanner()->setDocTypeHandler(this); + } + + setParseInProgress(false); +} + +Grammar* DOMLSParserImpl::getGrammar(const XMLCh* const nameSpaceKey) const +{ + return getGrammarResolver()->getGrammar(nameSpaceKey); +} + +Grammar* DOMLSParserImpl::getRootGrammar() const +{ + return getScanner()->getRootGrammar(); +} + +const XMLCh* DOMLSParserImpl::getURIText(unsigned int uriId) const +{ + return getScanner()->getURIText(uriId); +} + +XMLFilePos DOMLSParserImpl::getSrcOffset() const +{ + return getScanner()->getSrcOffset(); +} + +void DOMLSParserImpl::applyFilter(DOMNode* node) +{ + DOMLSParserFilter::FilterAction action; + // if the parent was already rejected, reject this too + if(fFilterAction && fFilterAction->containsKey(fCurrentParent) && fFilterAction->get(fCurrentParent)==DOMLSParserFilter::FILTER_REJECT) + action = DOMLSParserFilter::FILTER_REJECT; + else + action = fFilter->acceptNode(node); + + switch(action) + { + case DOMLSParserFilter::FILTER_ACCEPT: break; + case DOMLSParserFilter::FILTER_REJECT: + case DOMLSParserFilter::FILTER_SKIP: if(node==fCurrentNode) + fCurrentNode = (node->getPreviousSibling()?node->getPreviousSibling():fCurrentParent); + fCurrentParent->removeChild(node); + node->release(); + break; + case DOMLSParserFilter::FILTER_INTERRUPT: throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingAborted, fMemoryManager); + } +} + +void DOMLSParserImpl::docCharacters(const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + AbstractDOMParser::docCharacters(chars, length, cdataSection); + if(fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fCurrentNode->getPreviousSibling() && fFilterDelayedTextNodes->containsKey(fCurrentNode->getPreviousSibling())) + { + DOMNode* textNode = fCurrentNode->getPreviousSibling(); + fFilterDelayedTextNodes->removeKey(textNode); + applyFilter(textNode); + } + DOMNodeFilter::ShowType whatToShow=fFilter->getWhatToShow(); + if(cdataSection && (whatToShow & DOMNodeFilter::SHOW_CDATA_SECTION)) + { + applyFilter(fCurrentNode); + } + else if(!cdataSection && (whatToShow & DOMNodeFilter::SHOW_TEXT)) + { + if(fFilterDelayedTextNodes==0) + fFilterDelayedTextNodes=new (fMemoryManager) ValueHashTableOf(7, fMemoryManager); + fFilterDelayedTextNodes->put(fCurrentNode, true); + } + } +} + +void DOMLSParserImpl::docComment(const XMLCh* const comment) +{ + if(fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fFilterDelayedTextNodes->containsKey(fCurrentNode)) + { + fFilterDelayedTextNodes->removeKey(fCurrentNode); + applyFilter(fCurrentNode); + } + } + + AbstractDOMParser::docComment(comment); + if(fFilter) + { + DOMNodeFilter::ShowType whatToShow=fFilter->getWhatToShow(); + if(whatToShow & DOMNodeFilter::SHOW_COMMENT) + applyFilter(fCurrentNode); + } +} + +void DOMLSParserImpl::docPI(const XMLCh* const target + , const XMLCh* const data) +{ + if(fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fFilterDelayedTextNodes->containsKey(fCurrentNode)) + { + fFilterDelayedTextNodes->removeKey(fCurrentNode); + applyFilter(fCurrentNode); + } + } + + AbstractDOMParser::docPI(target, data); + if(fFilter) + { + DOMNodeFilter::ShowType whatToShow=fFilter->getWhatToShow(); + if(whatToShow & DOMNodeFilter::SHOW_PROCESSING_INSTRUCTION) + applyFilter(fCurrentNode); + } +} + +void DOMLSParserImpl::startEntityReference(const XMLEntityDecl& entDecl) +{ + if(fCreateEntityReferenceNodes && fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fFilterDelayedTextNodes->containsKey(fCurrentNode)) + { + fFilterDelayedTextNodes->removeKey(fCurrentNode); + applyFilter(fCurrentNode); + } + } + + DOMNode* origParent = fCurrentParent; + AbstractDOMParser::startEntityReference(entDecl); + if (fCreateEntityReferenceNodes && fFilter) + { + if(fFilterAction && fFilterAction->containsKey(origParent) && fFilterAction->get(origParent)==DOMLSParserFilter::FILTER_REJECT) + fFilterAction->put(fCurrentNode, DOMLSParserFilter::FILTER_REJECT); + } +} + +void DOMLSParserImpl::endElement(const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix) +{ + if(fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fFilterDelayedTextNodes->containsKey(fCurrentNode)) + { + fFilterDelayedTextNodes->removeKey(fCurrentNode); + applyFilter(fCurrentNode); + } + } + + AbstractDOMParser::endElement(elemDecl, urlId, isRoot, elemPrefix); + if(fFilter) + { + DOMNodeFilter::ShowType whatToShow=fFilter->getWhatToShow(); + if(whatToShow & DOMNodeFilter::SHOW_ELEMENT) + { + DOMNode* thisNode = fCurrentNode; + DOMLSParserFilter::FilterAction action; + if(fFilterAction && fFilterAction->containsKey(thisNode)) + { + action = fFilterAction->get(thisNode); + fFilterAction->removeKey(thisNode); + } + else + action = fFilter->acceptNode(thisNode); + switch(action) + { + case DOMLSParserFilter::FILTER_ACCEPT: break; + case DOMLSParserFilter::FILTER_REJECT: fCurrentNode = (thisNode->getPreviousSibling()?thisNode->getPreviousSibling():fCurrentParent); + fCurrentParent->removeChild(thisNode); + thisNode->release(); + break; + case DOMLSParserFilter::FILTER_SKIP: { + DOMNode* child=thisNode->getFirstChild(); + while(child) + { + DOMNode* next=child->getNextSibling(); + fCurrentParent->appendChild(child); + child=next; + } + fCurrentNode = (thisNode->getPreviousSibling()?thisNode->getPreviousSibling():fCurrentParent); + fCurrentParent->removeChild(thisNode); + thisNode->release(); + } + break; + case DOMLSParserFilter::FILTER_INTERRUPT: throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingAborted, fMemoryManager); + } + } + } +} + +void DOMLSParserImpl::startElement(const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot) +{ + if(fFilter) + { + // send the notification for the previous text node + if(fFilterDelayedTextNodes && fFilterDelayedTextNodes->containsKey(fCurrentNode)) + { + fFilterDelayedTextNodes->removeKey(fCurrentNode); + applyFilter(fCurrentNode); + } + } + + DOMNode* origParent = fCurrentParent; + AbstractDOMParser::startElement(elemDecl, urlId, elemPrefix, attrList, attrCount, false, isRoot); + if(fFilter) + { + // if the parent was already rejected, reject this too + if(fFilterAction && fFilterAction->containsKey(origParent) && fFilterAction->get(origParent)==DOMLSParserFilter::FILTER_REJECT) + fFilterAction->put(fCurrentNode, DOMLSParserFilter::FILTER_REJECT); + else + { + DOMLSParserFilter::FilterAction action = fFilter->startElement((DOMElement*)fCurrentNode); + + switch(action) + { + case DOMLSParserFilter::FILTER_ACCEPT: break; + case DOMLSParserFilter::FILTER_REJECT: + case DOMLSParserFilter::FILTER_SKIP: if(fFilterAction==0) + fFilterAction=new (fMemoryManager) ValueHashTableOf(7, fMemoryManager); + fFilterAction->put(fCurrentNode, action); + break; + case DOMLSParserFilter::FILTER_INTERRUPT: throw DOMLSException(DOMLSException::PARSE_ERR, XMLDOMMsg::LSParser_ParsingAborted, fMemoryManager); + } + } + } + if(isEmpty) + endElement(elemDecl, urlId, isRoot, elemPrefix); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.hpp b/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.hpp new file mode 100644 index 000000000..005acba0c --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/DOMLSParserImpl.hpp @@ -0,0 +1,715 @@ +/* + * 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: DOMLSParserImpl.hpp 830538 2009-10-28 13:41:11Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOMBUILDERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_DOMBUILDERIMPL_HPP + + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLEntityResolver; +class XMLResourceIdentifier; +class DOMStringListImpl; +class DOMLSResourceResolver; + + /** + * Introduced in DOM Level 3 + * + * DOMLSParserImpl provides an implementation of a DOMLSParser interface. + * A DOMLSParser instance is obtained from the DOMImplementationLS interface + * by invoking its createDOMLSParser method. + */ +class PARSERS_EXPORT DOMLSParserImpl : public AbstractDOMParser, + public DOMLSParser, + public DOMConfiguration +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Detructor + // ----------------------------------------------------------------------- + + /** @name Constructors and Destructor */ + //@{ + /** Construct a DOMLSParserImpl, with an optional validator + * + * Constructor with an instance of validator class to use for + * validation. If you don't provide a validator, a default one will + * be created for you in the scanner. + * + * @param valToAdopt Pointer to the validator instance to use. The + * parser is responsible for freeing the memory. + * @param manager The memory manager to be used for memory allocations + * @param gramPool Pointer to the grammar pool instance from + * external application. + * The parser does NOT own it. + * + */ + DOMLSParserImpl + ( + XMLValidator* const valToAdopt = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + /** + * Destructor + */ + virtual ~DOMLSParserImpl(); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of DOMLSParser interface + // ----------------------------------------------------------------------- + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** + * @see DOMLSParser#getDomConfig + */ + virtual DOMConfiguration* getDomConfig(); + + /** + * @see DOMLSParser#getFilter + */ + virtual const DOMLSParserFilter* getFilter() const; + + /** + * @see DOMLSParser#getAsync + */ + virtual bool getAsync() const; + + /** + * @see DOMLSParser#getBusy + */ + virtual bool getBusy() const; + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + /** + * @see DOMLSParser#setFilter + */ + virtual void setFilter(DOMLSParserFilter* const filter); + + //@} + + // ----------------------------------------------------------------------- + // Parsing methods + // ----------------------------------------------------------------------- + /** @name Parsing methods */ + //@{ + + // ----------------------------------------------------------------------- + // Parsing methods + // ----------------------------------------------------------------------- + /** + * @see DOMLSParser#parse + */ + virtual DOMDocument* parse(const DOMLSInput* source); + + /** + * @see DOMLSParser#parseURI + */ + virtual DOMDocument* parseURI(const XMLCh* const uri); + + /** + * @see DOMLSParser#parseURI + */ + virtual DOMDocument* parseURI(const char* const uri); + + /** + * @see DOMLSParser#parseWithContext + */ + virtual DOMNode* parseWithContext + ( + const DOMLSInput* source + , DOMNode* contextNode + , const ActionType action + ); + + /** + * @see DOMLSParser#abort + */ + virtual void abort(); + + + // ----------------------------------------------------------------------- + // Non-standard Extension + // ----------------------------------------------------------------------- + /** @name Non-standard Extension */ + //@{ + + /** + * Called to indicate that this DOMLSParser is no longer in use + * and that the implementation may relinquish any resources associated with it. + * + */ + virtual void release(); + + /** Reset the documents vector pool and release all the associated memory + * back to the system. + * + * When parsing a document using a DOM parser, all memory allocated + * for a DOM tree is associated to the DOM document. + * + * If you do multiple parse using the same DOM parser instance, then + * multiple DOM documents will be generated and saved in a vector pool. + * All these documents (and thus all the allocated memory) + * won't be deleted until the parser instance is destroyed. + * + * If you don't need these DOM documents anymore and don't want to + * destroy the DOM parser instance at this moment, then you can call this method + * to reset the document vector pool and release all the allocated memory + * back to the system. + * + * It is an error to call this method if you are in the middle of a + * parse (e.g. in the mid of a progressive parse). + * + * @exception IOException An exception from the parser if this function + * is called when a parse is in progress. + * + */ + virtual void resetDocumentPool(); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the DOMLSInput parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param source A const reference to the DOMLSInput object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see DOMLSInput#DOMLSInput + */ + virtual Grammar* loadGrammar(const DOMLSInput* source, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no chaching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) const; + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + virtual Grammar* getRootGrammar() const; + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + virtual const XMLCh* getURIText(unsigned int uriId) const; + + /** + * Clear the cached grammar pool + */ + virtual void resetCachedGrammarPool(); + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + virtual XMLFilePos getSrcOffset() const; + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the DOMConfiguration interface. + // ----------------------------------------------------------------------- + /** @name Implementation of the DOMConfiguration interface. */ + //@{ + /** + * Set the value of a parameter. + * + * @param name The name of the parameter to set. + * @param value The new value or null if the user wishes to unset the + * parameter. While the type of the value parameter is defined as + * DOMUserData, the object type must match the type defined + * by the definition of the parameter. For example, if the parameter is + * "error-handler", the value must be of type DOMErrorHandler + * + * @exception DOMException (NOT_SUPPORTED_ERR) Raised when the + * parameter name is recognized but the requested value cannot be set. + * @exception DOMException (NOT_FOUND_ERR) Raised when the + * parameter name is not recognized. + * + * @since DOM level 3 + **/ + virtual void setParameter(const XMLCh* name, const void* value); + virtual void setParameter(const XMLCh* name, bool value); + + /** + * Return the value of a parameter if known. + * + * @param name The name of the parameter. + * @return The current object associated with the specified parameter or + * null if no object has been associated or if the parameter is not + * supported. + * + * @exception DOMException (NOT_FOUND_ERR) Raised when the i + * boolean parameter + * name is not recognized. + * + * @since DOM level 3 + **/ + virtual const void* getParameter(const XMLCh* name) const; + + /** + * Check if setting a parameter to a specific value is supported. + * + * @param name The name of the parameter to check. + * @param value An object. if null, the returned value is true. + * @return true if the parameter could be successfully set to the specified + * value, or false if the parameter is not recognized or the requested value + * is not supported. This does not change the current value of the parameter + * itself. + * + * @since DOM level 3 + **/ + virtual bool canSetParameter(const XMLCh* name, const void* value) const; + virtual bool canSetParameter(const XMLCh* name, bool value) const; + + /** + * The list of the parameters supported by this DOMConfiguration object and + * for which at least one value can be set by the application. + * Note that this list can also contain parameter names defined outside this specification. + * + * @return The list of parameters that can be used with setParameter/getParameter + * @since DOM level 3 + **/ + virtual const DOMStringList* getParameterNames() const; + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLErrorReporter interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLErrorReporter interface. */ + //@{ + + /** Handle errors reported from the parser + * + * This method is used to report back errors found while parsing the + * XML file. This method is also borrowed from the SAX specification. + * It calls the corresponding user installed Error Handler method: + * 'fatal', 'error', 'warning' depending on the severity of the error. + * This classification is defined by the XML specification. + * + * @param errCode An integer code for the error. + * @param msgDomain A const pointer to an Unicode string representing + * the message domain to use. + * @param errType An enumeration classifying the severity of the error. + * @param errorText A const pointer to an Unicode string representing + * the text of the error message. + * @param systemId A const pointer to an Unicode string representing + * the system id of the XML file where this error + * was discovered. + * @param publicId A const pointer to an Unicode string representing + * the public id of the XML file where this error + * was discovered. + * @param lineNum The line number where the error occurred. + * @param colNum The column number where the error occurred. + * @see DOMErrorHandler + */ + virtual void error + ( + const unsigned int errCode + , const XMLCh* const msgDomain + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ); + + /** Reset any error data before a new parse + * + * This method allows the user installed Error Handler callback to + * 'reset' itself. + * + * This method is a no-op for this DOM + * implementation. + */ + virtual void resetErrors(); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLEntityHandler interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLEntityHandler interface. */ + //@{ + + /** Handle an end of input source event + * + * This method is used to indicate the end of parsing of an external + * entity file. + * + * This method is a no-op for this DOM + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the XML file being parsed. + * @see InputSource + */ + virtual void endInputSource(const InputSource& inputSource); + + /** Expand a system id + * + * This method allows an installed XMLEntityHandler to further + * process any system id's of enternal entities encountered in + * the XML file being parsed, such as redirection etc. + * + * This method always returns 'false' + * for this DOM implementation. + * + * @param systemId A const pointer to an Unicode string representing + * the system id scanned by the parser. + * @param toFill A pointer to a buffer in which the application + * processed system id is stored. + * @return 'true', if any processing is done, 'false' otherwise. + */ + virtual bool expandSystemId + ( + const XMLCh* const systemId + , XMLBuffer& toFill + ); + + /** Reset any entity handler information + * + * This method allows the installed XMLEntityHandler to reset + * itself. + * + * This method is a no-op for this DOM + * implementation. + */ + virtual void resetEntities(); + + /** Resolve a public/system id + * + * This method allows a user installed entity handler to further + * process any pointers to external entities. The applications can + * implement 'redirection' via this callback. + * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return The value returned by the user installed resolveEntity + * method or NULL otherwise to indicate no processing was done. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @see XMLEntityHandler + * @see XMLEntityResolver + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ); + + /** Handle a 'start input source' event + * + * This method is used to indicate the start of parsing an external + * entity file. + * + * This method is a no-op for this DOM parse + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the external entity + * being parsed. + */ + virtual void startInputSource(const InputSource& inputSource); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLDocumentHandler interface. + // ----------------------------------------------------------------------- + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + virtual void docComment + ( + const XMLCh* const comment + ); + virtual void docPI + ( + const XMLCh* const target + , const XMLCh* const data + ); + virtual void startEntityReference + ( + const XMLEntityDecl& entDecl + ); + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix + ); + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ); + + // overriden callbacks to implement parseWithContext behavior + virtual void startDocument(); + virtual void XMLDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncStr + ); + + +private : + // ----------------------------------------------------------------------- + // Initialize/Cleanup methods + // ----------------------------------------------------------------------- + void resetParse(); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void applyFilter(DOMNode* node); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEntityResolver + // The installed DOM entity resolver, if any. Null if none. + // + // fXMLEntityResolver + // The installed Xerces entity resolver, if any. Null if none. + // + // fErrorHandler + // The installed DOM error handler, if any. Null if none. + // + // fFilter + // The installed application filter, if any. Null if none. + // + // fCharsetOverridesXMLEncoding + // Indicates if the "charset-overrides-xml-encoding" is set or not + // + // fUserAdoptsDocument + // The DOMDocument ownership has been transferred to application + // If set to true, the parser does not own the document anymore + // and thus will not release its memory. + // + // fSupportedParameters + // A list of the parameters that can be set, including the ones + // specific of Xerces + // + // fFilterAction + // A map of elements rejected by the DOMLSParserFilter::startElement + // callback, used to avoid invoking DOMLSParserFilter::acceptNode + // on its children + // + // fFilterDelayedTextNodes + // As text nodes are filled incrementally, store them in a map + // so that we ask DOMLSParserFilter::acceptNode only once, when it + // is completely created + // + // fWrapNodesInDocumentFragment + // fWrapNodesContext + // fWrapNodesAction + // Variables used to keep the state for parseWithContext API + // + //----------------------------------------------------------------------- + DOMLSResourceResolver* fEntityResolver; + XMLEntityResolver* fXMLEntityResolver; + DOMErrorHandler* fErrorHandler; + DOMLSParserFilter* fFilter; + bool fCharsetOverridesXMLEncoding; + bool fUserAdoptsDocument; + DOMStringListImpl* fSupportedParameters; + ValueHashTableOf* fFilterAction; + ValueHashTableOf* fFilterDelayedTextNodes; + DOMDocumentFragment* fWrapNodesInDocumentFragment; + DOMNode* fWrapNodesContext; + ActionType fWrapNodesAction; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DOMLSParserImpl(const DOMLSParserImpl &); + DOMLSParserImpl & operator = (const DOMLSParserImpl &); +}; + + + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Handlers for the XMLEntityHandler interface +// --------------------------------------------------------------------------- +inline void DOMLSParserImpl::endInputSource(const InputSource&) +{ + // The DOM entity resolver doesn't handle this +} + +inline bool DOMLSParserImpl::expandSystemId(const XMLCh* const, XMLBuffer&) +{ + // The DOM entity resolver doesn't handle this + return false; +} + +inline void DOMLSParserImpl::resetEntities() +{ + // Nothing to do on this one +} + +inline void DOMLSParserImpl::startInputSource(const InputSource&) +{ + // The DOM entity resolver doesn't handle this +} + + +// --------------------------------------------------------------------------- +// DOMLSParserImpl: Getter methods +// --------------------------------------------------------------------------- +inline DOMConfiguration* DOMLSParserImpl::getDomConfig() +{ + return this; +} + +inline bool DOMLSParserImpl::getAsync() const +{ + // We are a synchronous parser + return false; +} + +inline const DOMLSParserFilter* DOMLSParserImpl::getFilter() const +{ + return fFilter; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.cpp b/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.cpp new file mode 100644 index 000000000..54e2fcc6d --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.cpp @@ -0,0 +1,416 @@ +/* + * 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: SAX2XMLFilterImpl.cpp 673975 2008-07-04 09:23:56Z borisk $ + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +SAX2XMLFilterImpl::SAX2XMLFilterImpl(SAX2XMLReader* parent) : + fParentReader(0) + , fDocHandler(0) + , fDTDHandler(0) + , fEntityResolver(0) + , fErrorHandler(0) +{ + setParent(parent); +} + +SAX2XMLFilterImpl::~SAX2XMLFilterImpl() +{ +} + +// --------------------------------------------------------------------------- +// SAX2XMLFilterImpl: XMLFilter impl +// --------------------------------------------------------------------------- +void SAX2XMLFilterImpl::setParent(SAX2XMLReader* parent) +{ + if(fParentReader) + { + fParentReader->setEntityResolver(0); + fParentReader->setDTDHandler(0); + fParentReader->setContentHandler(0); + fParentReader->setErrorHandler(0); + } + fParentReader=parent; + if(fParentReader) + { + fParentReader->setEntityResolver(this); + fParentReader->setDTDHandler(this); + fParentReader->setContentHandler(this); + fParentReader->setErrorHandler(this); + } +} + +bool SAX2XMLFilterImpl::getExitOnFirstFatalError() const +{ + if(fParentReader) + fParentReader->getExitOnFirstFatalError(); + return false; +} + +bool SAX2XMLFilterImpl::getValidationConstraintFatal() const +{ + if(fParentReader) + fParentReader->getValidationConstraintFatal(); + return false; +} + +Grammar* SAX2XMLFilterImpl::getRootGrammar() +{ + if(fParentReader) + fParentReader->getRootGrammar(); + return NULL; +} + +const XMLCh* SAX2XMLFilterImpl::getURIText(unsigned int uriId) const +{ + if(fParentReader) + fParentReader->getURIText(uriId); + return NULL; +} + +XMLFilePos SAX2XMLFilterImpl::getSrcOffset() const +{ + if(fParentReader) + fParentReader->getSrcOffset(); + return 0; +} + +// --------------------------------------------------------------------------- +// SAX2XMLFilterImpl Validator functions +// --------------------------------------------------------------------------- +void SAX2XMLFilterImpl::setValidator(XMLValidator* valueToAdopt) +{ + if(fParentReader) + fParentReader->setValidator(valueToAdopt); +} + +XMLValidator* SAX2XMLFilterImpl::getValidator() const +{ + if(fParentReader) + return fParentReader->getValidator(); + return 0; +} + +// --------------------------------------------------------------------------- +// SAX2XMLReader Interface +// --------------------------------------------------------------------------- +XMLSize_t SAX2XMLFilterImpl::getErrorCount() const +{ + if(fParentReader) + return fParentReader->getErrorCount(); + return 0; +} + +void SAX2XMLFilterImpl::setExitOnFirstFatalError(const bool newState) +{ + if(fParentReader) + fParentReader->setExitOnFirstFatalError(newState); +} + +void SAX2XMLFilterImpl::setValidationConstraintFatal(const bool newState) +{ + if(fParentReader) + fParentReader->setValidationConstraintFatal(newState); +} + +void SAX2XMLFilterImpl::parse (const InputSource& source) +{ + if(fParentReader) + fParentReader->parse(source); +} + +void SAX2XMLFilterImpl::parse (const XMLCh* const systemId) +{ + if(fParentReader) + fParentReader->parse(systemId); +} + +void SAX2XMLFilterImpl::parse (const char* const systemId) +{ + if(fParentReader) + fParentReader->parse(systemId); +} + +// --------------------------------------------------------------------------- +// SAX2XMLFilterImpl: Progressive parse methods +// --------------------------------------------------------------------------- +bool SAX2XMLFilterImpl::parseFirst( const XMLCh* const systemId + , XMLPScanToken& toFill) +{ + if(fParentReader) + return fParentReader->parseFirst(systemId, toFill); + return false; +} + +bool SAX2XMLFilterImpl::parseFirst( const char* const systemId + , XMLPScanToken& toFill) +{ + if(fParentReader) + fParentReader->parseFirst(systemId, toFill); + return false; +} + +bool SAX2XMLFilterImpl::parseFirst( const InputSource& source + , XMLPScanToken& toFill) +{ + if(fParentReader) + fParentReader->parseFirst(source, toFill); + return false; +} + +bool SAX2XMLFilterImpl::parseNext(XMLPScanToken& token) +{ + if(fParentReader) + fParentReader->parseNext(token); + return false; +} + +void SAX2XMLFilterImpl::parseReset(XMLPScanToken& token) +{ + if(fParentReader) + fParentReader->parseReset(token); +} + +// --------------------------------------------------------------------------- +// SAX2XMLFilterImpl: Features and Properties +// --------------------------------------------------------------------------- + +void SAX2XMLFilterImpl::setFeature(const XMLCh* const name, const bool value) +{ + if(fParentReader) + fParentReader->setFeature(name,value); +} + +bool SAX2XMLFilterImpl::getFeature(const XMLCh* const name) const +{ + if(fParentReader) + return fParentReader->getFeature(name); + return false; +} + +void SAX2XMLFilterImpl::setProperty(const XMLCh* const name, void* value) +{ + if(fParentReader) + fParentReader->setProperty(name,value); +} + +void* SAX2XMLFilterImpl::getProperty(const XMLCh* const name) const +{ + if(fParentReader) + return fParentReader->getProperty(name); + return NULL; +} + +// --------------------------------------------------------------------------- +// SAX2XMLFilterImpl: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* SAX2XMLFilterImpl::loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + if(fParentReader) + return fParentReader->loadGrammar(systemId, grammarType, toCache); + return NULL; +} + +Grammar* SAX2XMLFilterImpl::loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + if(fParentReader) + return fParentReader->loadGrammar(systemId, grammarType, toCache); + return NULL; +} + +Grammar* SAX2XMLFilterImpl::loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + if(fParentReader) + return fParentReader->loadGrammar(source, grammarType, toCache); + return NULL; +} + +void SAX2XMLFilterImpl::resetCachedGrammarPool() +{ + if(fParentReader) + fParentReader->resetCachedGrammarPool(); +} + +void SAX2XMLFilterImpl::setInputBufferSize(const XMLSize_t bufferSize) +{ + if(fParentReader) + fParentReader->setInputBufferSize(bufferSize); +} + +Grammar* SAX2XMLFilterImpl::getGrammar(const XMLCh* const nameSpaceKey) +{ + if(fParentReader) + return fParentReader->getGrammar(nameSpaceKey); + return NULL; +} + +// ----------------------------------------------------------------------- +// Implementation of the EntityResolver interface +// ----------------------------------------------------------------------- +InputSource* SAX2XMLFilterImpl::resolveEntity(const XMLCh* const publicId + , const XMLCh* const systemId) +{ + if(fEntityResolver) + return fEntityResolver->resolveEntity(publicId, systemId); + return 0; +} + +// ----------------------------------------------------------------------- +// Implementation of the DTDHandler interface +// ----------------------------------------------------------------------- +void SAX2XMLFilterImpl::notationDecl( const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId) +{ + if(fDTDHandler) + fDTDHandler->notationDecl(name, publicId, systemId); +} + +void SAX2XMLFilterImpl::unparsedEntityDecl(const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const notationName) +{ + if(fDTDHandler) + fDTDHandler->unparsedEntityDecl(name, publicId, systemId, notationName); +} + +void SAX2XMLFilterImpl::resetDocType() +{ + if(fDTDHandler) + fDTDHandler->resetDocType(); +} + +// ----------------------------------------------------------------------- +// Implementation of the ContentHandler interface +// ----------------------------------------------------------------------- + +void SAX2XMLFilterImpl::characters(const XMLCh* const chars + , const XMLSize_t length) +{ + if(fDocHandler) + fDocHandler->characters(chars, length); +} + +void SAX2XMLFilterImpl::endDocument() +{ + if(fDocHandler) + fDocHandler->endDocument(); +} + +void SAX2XMLFilterImpl::endElement(const XMLCh* const uri + , const XMLCh* const localname + , const XMLCh* const qname) +{ + if(fDocHandler) + fDocHandler->endElement(uri, localname, qname); +} + +void SAX2XMLFilterImpl::ignorableWhitespace(const XMLCh* const chars + , const XMLSize_t length) +{ + if(fDocHandler) + fDocHandler->ignorableWhitespace(chars, length); +} + +void SAX2XMLFilterImpl::processingInstruction(const XMLCh* const target + , const XMLCh* const data) +{ + if(fDocHandler) + fDocHandler->processingInstruction(target, data); +} + +void SAX2XMLFilterImpl::setDocumentLocator(const Locator* const locator) +{ + if(fDocHandler) + fDocHandler->setDocumentLocator(locator); +} + +void SAX2XMLFilterImpl::startDocument() +{ + if(fDocHandler) + fDocHandler->startDocument(); +} + +void SAX2XMLFilterImpl::startElement(const XMLCh* const uri + , const XMLCh* const localname + , const XMLCh* const qname + , const Attributes& attrs) +{ + if(fDocHandler) + fDocHandler->startElement(uri, localname, qname, attrs); +} + +void SAX2XMLFilterImpl::startPrefixMapping(const XMLCh* const prefix + , const XMLCh* const uri) +{ + if(fDocHandler) + fDocHandler->startPrefixMapping(prefix, uri); +} + +void SAX2XMLFilterImpl::endPrefixMapping(const XMLCh* const prefix) +{ + if(fDocHandler) + fDocHandler->endPrefixMapping(prefix); +} + +void SAX2XMLFilterImpl::skippedEntity(const XMLCh* const name) +{ + if(fDocHandler) + fDocHandler->skippedEntity(name); +} + +// ----------------------------------------------------------------------- +// Implementation of the ErrorHandler interface +// ----------------------------------------------------------------------- + +void SAX2XMLFilterImpl::warning(const SAXParseException& exc) +{ + if(fErrorHandler) + fErrorHandler->warning(exc); +} + +void SAX2XMLFilterImpl::error(const SAXParseException& exc) +{ + if(fErrorHandler) + fErrorHandler->error(exc); +} + +void SAX2XMLFilterImpl::fatalError(const SAXParseException& exc) +{ + if(fErrorHandler) + fErrorHandler->fatalError(exc); +} + +void SAX2XMLFilterImpl::resetErrors() +{ + if(fErrorHandler) + fErrorHandler->resetErrors(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.hpp b/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.hpp new file mode 100644 index 000000000..33ca34d46 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAX2XMLFilterImpl.hpp @@ -0,0 +1,1445 @@ +/* + * 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: SAX2XMLFilterImpl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLFILTERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_SAX2XMLFILTERIMPL_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * This class implements the SAX2 'XMLFilterImpl' interface and should be + * used by applications as the base class for their SAX2 filters. + * This implementation simply forwards every call to the parent object. + * + */ + +class PARSERS_EXPORT SAX2XMLFilterImpl : + public SAX2XMLFilter + , public EntityResolver + , public DTDHandler + , public ContentHandler + , public ErrorHandler +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** The default constructor */ + SAX2XMLFilterImpl(SAX2XMLReader* parent); + + /** The destructor */ + ~SAX2XMLFilterImpl() ; + //@} + + //----------------------------------------------------------------------- + // Implementation of SAX2XMLReader Interface + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // The XMLReader interface + //----------------------------------------------------------------------- + /** @name Implementation of SAX 2.0 XMLReader interface's. */ + //@{ + + /** + * This method returns the installed content handler. + * + * @return A pointer to the installed content handler object. + */ + virtual ContentHandler* getContentHandler() const ; + + /** + * This method returns the installed DTD handler. + * + * @return A pointer to the installed DTD handler object. + */ + virtual DTDHandler* getDTDHandler() const ; + + /** + * This method returns the installed entity resolver. + * + * @return A pointer to the installed entity resolver object. + */ + virtual EntityResolver* getEntityResolver() const ; + + /** + * This method returns the installed error handler. + * + * @return A pointer to the installed error handler object. + */ + virtual ErrorHandler* getErrorHandler() const ; + + /** + * Query the current state of any feature in a SAX2 XMLReader. + * + * @param name The unique identifier (URI) of the feature being set. + * @return The current state of the feature. + * @exception SAXNotRecognizedException If the requested feature is not known. + */ + virtual bool getFeature(const XMLCh* const name) const ; + + /** + * Query the current value of a property in a SAX2 XMLReader. + * + * The parser owns the returned pointer. The memory allocated for + * the returned pointer will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else; otherwise you may get unexpected result. Since the returned + * pointer is a generic void pointer, see the SAX2 Programming Guide to learn + * exactly what type of property value each property returns for replication. + * + * @param name The unique identifier (URI) of the property being set. + * @return The current value of the property. The pointer spans the same + * life-time as the parser. A null pointer is returned if nothing + * was specified externally. + * @exception SAXNotRecognizedException If the requested property is not known. + */ + virtual void* getProperty(const XMLCh* const name) const ; + + /** + * Allow an application to register a document event handler. + * + * If the application does not register a document handler, all + * document events reported by the SAX parser will be silently + * ignored (this is the default behaviour implemented by + * HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The document handler. + * @see DocumentHandler#DocumentHandler + * @see HandlerBase#HandlerBase + */ + virtual void setContentHandler(ContentHandler* const handler) ; + + /** + * Allow an application to register a DTD event handler. + * + * If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored (this + * is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the middle + * of a parse, and the SAX parser must begin using the new handler + * immediately. + * + * @param handler The DTD handler. + * @see DTDHandler#DTDHandler + * @see HandlerBase#HandlerBase + */ + virtual void setDTDHandler(DTDHandler* const handler) ; + + /** + * Allow an application to register a custom entity resolver. + * + * If the application does not register an entity resolver, the + * SAX parser will resolve system identifiers and open connections + * to entities itself (this is the default behaviour implemented in + * DefaultHandler). + * + * Applications may register a new or different entity resolver + * in the middle of a parse, and the SAX parser must begin using + * the new resolver immediately. + * + * @param resolver The object for resolving entities. + * @see EntityResolver#EntityResolver + * @see DefaultHandler#DefaultHandler + */ + virtual void setEntityResolver(EntityResolver* const resolver) ; + + /** + * Allow an application to register an error event handler. + * + * If the application does not register an error event handler, + * all error events reported by the SAX parser will be silently + * ignored, except for fatalError, which will throw a SAXException + * (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see ErrorHandler#ErrorHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setErrorHandler(ErrorHandler* const handler) ; + + /** + * Set the state of any feature in a SAX2 XMLReader. + * Supported features in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://xml.org/sax/features/validation (default: true) + *
http://xml.org/sax/features/namespaces (default: true) + *
http://xml.org/sax/features/namespace-prefixes (default: false) + *
http://apache.org/xml/features/validation/dynamic (default: false) + *
http://apache.org/xml/features/validation/reuse-grammar (default: false) + *
http://apache.org/xml/features/validation/schema (default: true) + *
http://apache.org/xml/features/validation/schema-full-checking (default: false) + *
http://apache.org/xml/features/validating/load-schema (default: true) + *
http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true) + *
http://apache.org/xml/features/continue-after-fatal-error (default: false) + *
http://apache.org/xml/features/validation-error-as-fatal (default: false) + * + * @param name The unique identifier (URI) of the feature. + * @param value The requested state of the feature (true or false). + * @exception SAXNotRecognizedException If the requested feature is not known. + * @exception SAXNotSupportedException Feature modification is not supported during parse + * + */ + virtual void setFeature(const XMLCh* const name, const bool value) ; + + /** + * Set the value of any property in a SAX2 XMLReader. + * Supported properties in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://apache.org/xml/properties/schema/external-schemaLocation + *
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation. + * + * It takes a void pointer as the property value. Application is required to initialize this void + * pointer to a correct type. See the SAX2 Programming Guide + * to learn exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. + * If the same property is set more than once, the last one takes effect. + * + * @param name The unique identifier (URI) of the property being set. + * @param value The requested value for the property. See + * the SAX2 Programming Guide to learn + * exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead + * to unexpected result. + * @exception SAXNotRecognizedException If the requested property is not known. + * @exception SAXNotSupportedException Property modification is not supported during parse + */ + virtual void setProperty(const XMLCh* const name, void* value) ; + + /** + * Parse an XML document. + * + * The application can use this method to instruct the SAX parser + * to begin parsing an XML document from any valid input + * source (a character stream, a byte stream, or a URI). + * + * Applications may not invoke this method while a parse is in + * progress (they should create a new Parser instead for each + * additional XML document). Once a parse is complete, an + * application may reuse the same Parser object, possibly with a + * different input source. + * + * @param source The input source for the top-level of the + * XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see InputSource#InputSource + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setDocumentHandler + * @see #setErrorHandler + */ + virtual void parse + ( + const InputSource& source + ) ; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(InputSource) + */ + virtual void parse + ( + const XMLCh* const systemId + ) ; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(InputSource) + */ + virtual void parse + ( + const char* const systemId + ) ; + + //@} + + // ----------------------------------------------------------------------- + // SAX 2.0-ext + // ----------------------------------------------------------------------- + /** @name SAX 2.0-ext */ + //@{ + /** + * This method returns the installed declaration handler. + * + * @return A pointer to the installed declaration handler object. + */ + virtual DeclHandler* getDeclarationHandler() const ; + + /** + * This method returns the installed lexical handler. + * + * @return A pointer to the installed lexical handler object. + */ + virtual LexicalHandler* getLexicalHandler() const ; + + /** + * Allow an application to register a declaration event handler. + * + * If the application does not register a declaration handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by DefaultHandler). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The DTD declaration handler. + * @see DeclHandler#DeclHandler + * @see SAXException#SAXException + * @see DefaultHandler#DefaultHandler + */ + virtual void setDeclarationHandler(DeclHandler* const handler) ; + + /** + * Allow an application to register a lexical event handler. + * + * If the application does not register a lexical handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see LexicalHandler#LexicalHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setLexicalHandler(LexicalHandler* const handler) ; + + //@} + + // ----------------------------------------------------------------------- + // Getter Methods + // ----------------------------------------------------------------------- + /** @name Getter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to get the current validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @return A pointer to the validator. An application should not deleted + * the object returned. + * + */ + virtual XMLValidator* getValidator() const ; + + /** Get error count from the last parse operation. + * + * This method returns the error count from the last parse + * operation. Note that this count is actually stored in the + * scanner, so this method simply returns what the + * scanner reports. + * + * @return number of errors encountered during the latest + * parse operation. + */ + virtual XMLSize_t getErrorCount() const ; + + /** + * This method returns the state of the parser's + * exit-on-First-Fatal-Error flag. + * + *

Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which indicates the opposite state.

+ * + * @return true, if the parser is currently configured to + * exit on the first fatal error, false otherwise. + * + * @see #setExitOnFirstFatalError + * @see #getFeature + */ + virtual bool getExitOnFirstFatalError() const ; + + /** + * This method returns the state of the parser's + * validation-constraint-fatal flag. + * + *

Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing. + * + * @return true, if the parser is currently configured to + * set validation constraint errors as fatal, false + * otherwise. + * + * @see #setValidationContraintFatal + * @see #getFeature + */ + virtual bool getValidationConstraintFatal() const ; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey); + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + virtual Grammar* getRootGrammar(); + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + virtual const XMLCh* getURIText(unsigned int uriId) const; + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + virtual XMLFilePos getSrcOffset() const; + + //@} + + // ----------------------------------------------------------------------- + // Setter Methods + // ----------------------------------------------------------------------- + /** @name Setter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to set a validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @param valueToAdopt A pointer to the validator that the reader should use. + * + */ + virtual void setValidator(XMLValidator* valueToAdopt) ; + + /** + * This method allows users to set the parser's behaviour when it + * encounters the first fatal error. If set to true, the parser + * will exit at the first fatal error. If false, then it will + * report the error and continue processing. + * + *

The default value is 'true' and the parser exits on the + * first fatal error.

+ * + *

Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which has the opposite behaviour.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState The value specifying whether the parser should + * continue or exit when it encounters the first + * fatal error. + * + * @see #getExitOnFirstFatalError + * @see #setFeature + */ + virtual void setExitOnFirstFatalError(const bool newState) ; + + /** + * This method allows users to set the parser's behaviour when it + * encounters a validation constraint error. If set to true, and the + * the parser will treat validation error as fatal and will exit depends on the + * state of "getExitOnFirstFatalError". If false, then it will + * report the error and continue processing. + * + * Note: setting this true does not mean the validation error will be printed with + * the word "Fatal Error". It is still printed as "Error", but the parser + * will exit if "setExitOnFirstFatalError" is set to true. + * + *

The default value is 'false'.

+ * + *

Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState If true, the parser will exit if "setExitOnFirstFatalError" + * is set to true. + * + * @see #getValidationConstraintFatal + * @see #setExitOnFirstFatalError + * @see #setFeature + */ + virtual void setValidationConstraintFatal(const bool newState) ; + //@} + + + // ----------------------------------------------------------------------- + // Progressive scan methods + // ----------------------------------------------------------------------- + + /** @name Progressive scan methods */ + //@{ + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a Unicode string representing the path + * to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could parse the + * prolog (which means the token will not be valid.) + * + * @see #parseNext + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ) ; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a regular native string representing + * the path to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ) ; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + */ + virtual bool parseFirst + ( + const InputSource& source + , XMLPScanToken& toFill + ) ; + + /** Continue a progressive parse operation + * + * This method is used to continue with progressive parsing of + * XML files started by a call to 'parseFirst' method. + * + * It parses the XML file and stops as soon as it comes across + * a XML token (as defined in the XML specification). Relevant + * callback handlers are invoked as required by the SAX + * specification. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the next XML token. + * It indicates the user can go ahead with parsing the rest + * of the file. It returns 'false' to indicate that the parser + * could not find next token as per the XML specification + * production rule. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseNext(XMLPScanToken& token) ; + + /** Reset the parser after a progressive parse + * + * If a progressive parse loop exits before the end of the document + * is reached, the parser has no way of knowing this. So it will leave + * open any files or sockets or memory buffers that were in use at + * the time that the parse loop exited. + * + * The next parse operation will cause these open files and such to + * be closed, but the next parse operation might occur at some unknown + * future point. To avoid this problem, you should reset the parser if + * you exit the loop early. + * + * If you exited because of an error, then this cleanup will be done + * for you. Its only when you exit the file prematurely of your own + * accord, because you've found what you wanted in the file most + * likely. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + */ + virtual void parseReset(XMLPScanToken& token) ; + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the grammar preparsing interface + // ----------------------------------------------------------------------- + + /** @name Implementation of Grammar preparsing interface's. */ + //@{ + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the SAX InputSource parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param source A const reference to the SAX InputSource object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see InputSource#InputSource + */ + virtual Grammar* loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Clear the cached grammar pool + */ + virtual void resetCachedGrammarPool(); + + /** Set maximum input buffer size + * + * This method allows users to limit the size of buffers used in parsing + * XML character data. The effect of setting this size is to limit the + * size of a ContentHandler::characters() call. + * + * The parser's default input buffer size is 1 megabyte. + * + * @param bufferSize The maximum input buffer size + */ + void setInputBufferSize(const XMLSize_t bufferSize); + + //@} + + + // ----------------------------------------------------------------------- + // Advanced document handler list maintenance methods + // ----------------------------------------------------------------------- + + /** @name Advanced document handler list maintenance methods */ + //@{ + /** + * This method installs the specified 'advanced' document callback + * handler, thereby allowing the user to customize the processing, + * if they choose to do so. Any number of advanced callback handlers + * maybe installed. + * + *

The methods in the advanced callback interface represent + * Xerces-C extensions. There is no specification for this interface.

+ * + * @param toInstall A pointer to the users advanced callback handler. + * + * @see #removeAdvDocHandler + */ + virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) ; + + /** + * This method removes the 'advanced' document handler callback from + * the underlying parser scanner. If no handler is installed, advanced + * callbacks are not invoked by the scanner. + * @param toRemove A pointer to the advanced callback handler which + * should be removed. + * + * @see #installAdvDocHandler + */ + virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) ; + //@} + + + // ----------------------------------------------------------------------- + // The XMLFilter interface + // ----------------------------------------------------------------------- + + /** @name Implementation of SAX 2.0 XMLFilter interface's. */ + //@{ + /** + * This method returns the parent XMLReader object. + * + * @return A pointer to the parent XMLReader object. + */ + virtual SAX2XMLReader* getParent() const; + + /** + * Sets the parent XMLReader object; parse requests will be forwarded to this + * object, and callback notifications coming from it will be postprocessed + * + * @param parent The new XMLReader parent. + * @see SAX2XMLReader#SAX2XMLReader + */ + virtual void setParent(SAX2XMLReader* parent); + //@} + + // ----------------------------------------------------------------------- + // Implementation of the EntityResolver interface + // ----------------------------------------------------------------------- + /** @name The EntityResolver interface */ + //@{ + + /** + * Allow the application to resolve external entities. + * + *

The Parser will call this method before opening any external + * entity except the top-level document entity (including the + * external DTD subset, external entities referenced within the + * DTD, and external entities referenced within the document + * element): the application may request that the parser resolve + * the entity itself, that it use an alternative URI, or that it + * use an entirely different input source.

+ * + *

Application writers can use this method to redirect external + * system identifiers to secure and/or local URIs, to look up + * public identifiers in a catalogue, or to read an entity from a + * database or other input source (including, for example, a dialog + * box).

+ * + *

If the system identifier is a URL, the SAX parser must + * resolve it fully before reporting it to the application.

+ * + * @param publicId The public identifier of the external entity + * being referenced, or null if none was supplied. + * @param systemId The system identifier of the external entity + * being referenced. + * @return An InputSource object describing the new input source, + * or null to request that the parser open a regular + * URI connection to the system identifier. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception, + * possibly the result of creating a new InputStream + * or Reader for the InputSource. + * @see InputSource#InputSource + */ + virtual InputSource* resolveEntity + ( + const XMLCh* const publicId + , const XMLCh* const systemId + ); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the DTDHandler interface + // ----------------------------------------------------------------------- + /** @name The DTD handler interface */ + //@{ + /** + * Receive notification of a notation declaration event. + * + *

It is up to the application to record the notation for later + * reference, if necessary.

+ * + *

If a system identifier is present, and it is a URL, the SAX + * parser must resolve it fully before passing it to the + * application.

+ * + * @param name The notation name. + * @param publicId The notation's public identifier, or null if + * none was given. + * @param systemId The notation's system identifier, or null if + * none was given. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #unparsedEntityDecl + * @see AttributeList#AttributeList + */ + virtual void notationDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ); + + /** + * Receive notification of an unparsed entity declaration event. + * + *

Note that the notation name corresponds to a notation + * reported by the notationDecl() event. It is up to the + * application to record the entity for later reference, if + * necessary.

+ * + *

If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @param name The unparsed entity's name. + * @param publicId The entity's public identifier, or null if none + * was given. + * @param systemId The entity's system identifier (it must always + * have one). + * @param notationName The name of the associated notation. + * @see #notationDecl + * @see AttributeList#AttributeList + */ + virtual void unparsedEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const notationName + ); + + /** + * Reset the DocType object on its reuse + * + *

This method helps in reseting the DTD object implementation + * defaults each time the DTD is begun.

+ * + */ + virtual void resetDocType(); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the ContentHandler interface + // ----------------------------------------------------------------------- + /** @name The virtual document handler interface */ + + //@{ + /** + * Receive notification of character data. + * + *

The Parser will call this method to report each chunk of + * character data. SAX parsers may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * must come from the same external entity, so that the Locator + * provides useful information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + *

Note that some parsers will report whitespace using the + * ignorableWhitespace() method rather than this one (validating + * parsers must do so).

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #ignorableWhitespace + * @see Locator#Locator + */ + virtual void characters + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of the end of a document. + * + *

The SAX parser will invoke this method only once, and it will + * be the last method invoked during the parse. The parser shall + * not invoke this method until it has either abandoned parsing + * (because of an unrecoverable error) or reached the end of + * input.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endDocument (); + + /** + * Receive notification of the end of an element. + * + *

The SAX parser will invoke this method at the end of every + * element in the XML document; there will be a corresponding + * startElement() event for every endElement() event (even when the + * element is empty).

+ * + * @param uri The URI of the associated namespace for this element + * @param localname The local part of the element name + * @param qname The QName of this element + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname + ); + + /** + * Receive notification of ignorable whitespace in element content. + * + *

Validating Parsers must use this method to report each chunk + * of ignorable whitespace (see the W3C XML 1.0 recommendation, + * section 2.10): non-validating parsers may also use this method + * if they are capable of parsing and using content models.

+ * + *

SAX parsers may return all contiguous whitespace in a single + * chunk, or they may split it into several chunks; however, all of + * the characters in any single event must come from the same + * external entity, so that the Locator provides useful + * information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #characters + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of a processing instruction. + * + *

The Parser will invoke this method once for each processing + * instruction found: note that processing instructions may occur + * before or after the main document element.

+ * + *

A SAX parser should never report an XML declaration (XML 1.0, + * section 2.8) or a text declaration (XML 1.0, section 4.3.1) + * using this method.

+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none was supplied. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void processingInstruction + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * Receive an object for locating the origin of SAX document events. + * + * SAX parsers are strongly encouraged (though not absolutely + * required) to supply a locator: if it does so, it must supply + * the locator to the application by invoking this method before + * invoking any of the other methods in the DocumentHandler + * interface. + * + * The locator allows the application to determine the end + * position of any document-related event, even if the parser is + * not reporting an error. Typically, the application will + * use this information for reporting its own errors (such as + * character content that does not match an application's + * business rules). The information returned by the locator + * is probably not sufficient for use with a search engine. + * + * Note that the locator will return correct information only + * during the invocation of the events in this interface. The + * application should not attempt to use it at any other time. + * + * @param locator An object that can return the location of + * any SAX document event. The object is only + * 'on loan' to the client code and they are not + * to attempt to delete or modify it in any way! + * + * @see Locator#Locator + */ + virtual void setDocumentLocator(const Locator* const locator); + + /** + * Receive notification of the beginning of a document. + * + *

The SAX parser will invoke this method only once, before any + * other methods in this interface or in DTDHandler (except for + * setDocumentLocator).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startDocument(); + + /** + * Receive notification of the beginning of an element. + * + *

The Parser will invoke this method at the beginning of every + * element in the XML document; there will be a corresponding + * endElement() event for every startElement() event (even when the + * element is empty). All of the element's content will be + * reported, in order, before the corresponding endElement() + * event.

+ * + *

Note that the attribute list provided will + * contain only attributes with explicit values (specified or + * defaulted): #IMPLIED attributes will be omitted.

+ * + * @param uri The URI of the associated namespace for this element + * @param localname The local part of the element name + * @param qname The QName of this element + * @param attrs The attributes attached to the element, if any. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #endElement + * @see Attributes#Attributes + */ + virtual void startElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname, + const Attributes& attrs + ); + + /** + * Receive notification of the start of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the start of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @param uri The namespace URI used. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startPrefixMapping + ( + const XMLCh* const prefix, + const XMLCh* const uri + ); + + /** + * Receive notification of the end of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the end of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endPrefixMapping + ( + const XMLCh* const prefix + ); + + /** + * Receive notification of a skipped entity + * + *

The parser will invoke this method once for each entity + * skipped. All processors may skip external entities, + * depending on the values of the features:
+ * http://xml.org/sax/features/external-general-entities
+ * http://xml.org/sax/features/external-parameter-entities

+ * + *

Note: Xerces (specifically) never skips any entities, regardless + * of the above features. This function is never called in the + * Xerces implementation of SAX2.

+ * + *

Introduced with SAX2

+ * + * @param name The name of the skipped entity. If it is a parameter entity, + * the name will begin with %, and if it is the external DTD subset, + * it will be the string [dtd]. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void skippedEntity + ( + const XMLCh* const name + ); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the ErrorHandler interface + // ----------------------------------------------------------------------- + /** @name The error handler interface */ + //@{ + /** + * Receive notification of a warning. + * + *

SAX parsers will use this method to report conditions that + * are not errors or fatal errors as defined by the XML 1.0 + * recommendation. The default behaviour is to take no action.

+ * + *

The SAX parser must continue to provide normal parsing events + * after invoking this method: it should still be possible for the + * application to process the document through to the end.

+ * + * @param exc The warning information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void warning(const SAXParseException& exc); + + /** + * Receive notification of a recoverable error. + * + *

This corresponds to the definition of "error" in section 1.2 + * of the W3C XML 1.0 Recommendation. For example, a validating + * parser would use this callback to report the violation of a + * validity constraint. The default behaviour is to take no + * action.

+ * + *

The SAX parser must continue to provide normal parsing events + * after invoking this method: it should still be possible for the + * application to process the document through to the end. If the + * application cannot do so, then the parser should report a fatal + * error even if the XML 1.0 recommendation does not require it to + * do so.

+ * + * @param exc The error information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void error(const SAXParseException& exc); + + /** + * Receive notification of a non-recoverable error. + * + *

This corresponds to the definition of "fatal error" in + * section 1.2 of the W3C XML 1.0 Recommendation. For example, a + * parser would use this callback to report the violation of a + * well-formedness constraint.

+ * + *

The application must assume that the document is unusable + * after the parser has invoked this method, and should continue + * (if at all) only for the sake of collecting addition error + * messages: in fact, SAX parsers are free to stop reporting any + * other events once this method has been invoked.

+ * + * @param exc The error information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void fatalError(const SAXParseException& exc); + + /** + * Reset the Error handler object on its reuse + * + *

This method helps in reseting the Error handler object + * implementation defaults each time the Error handler is begun.

+ * + */ + virtual void resetErrors(); + + //@} + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SAX2XMLFilterImpl(const SAX2XMLFilterImpl&); + SAX2XMLFilterImpl& operator=(const SAX2XMLFilterImpl&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fParentReader + // The object that we are filtering + // + // fDocHandler + // The installed SAX content handler, if any. Null if none. + // + // fDTDHandler + // The installed SAX DTD handler, if any. Null if none. + // + // fEntityResolver + // The installed SAX entity handler, if any. Null if none. + // + // fErrorHandler + // The installed SAX error handler, if any. Null if none. + // + // ----------------------------------------------------------------------- + SAX2XMLReader* fParentReader; + ContentHandler* fDocHandler; + DTDHandler* fDTDHandler; + EntityResolver* fEntityResolver; + ErrorHandler* fErrorHandler; +}; + + +// --------------------------------------------------------------------------- +// SAX2XMLReader: Getter methods +// --------------------------------------------------------------------------- +inline SAX2XMLReader* SAX2XMLFilterImpl::getParent() const +{ + return fParentReader; +} + +inline ContentHandler* SAX2XMLFilterImpl::getContentHandler() const +{ + return fDocHandler; +} + +inline DTDHandler* SAX2XMLFilterImpl::getDTDHandler() const +{ + return fDTDHandler; +} + +inline EntityResolver* SAX2XMLFilterImpl::getEntityResolver() const +{ + return fEntityResolver; +} + +inline ErrorHandler* SAX2XMLFilterImpl::getErrorHandler() const +{ + return fErrorHandler; +} + +inline LexicalHandler* SAX2XMLFilterImpl::getLexicalHandler() const +{ + return 0; +} + +inline DeclHandler* SAX2XMLFilterImpl::getDeclarationHandler() const +{ + return 0; +} + +inline void SAX2XMLFilterImpl::setContentHandler(ContentHandler* const handler) +{ + fDocHandler = handler; +} + +inline void SAX2XMLFilterImpl::setDTDHandler(DTDHandler* const handler) +{ + fDTDHandler = handler; +} + +inline void SAX2XMLFilterImpl::setErrorHandler(ErrorHandler* const handler) +{ + fErrorHandler = handler; +} + +inline void SAX2XMLFilterImpl::setEntityResolver(EntityResolver* const resolver) +{ + fEntityResolver = resolver; +} + +inline void SAX2XMLFilterImpl::setLexicalHandler(LexicalHandler* const /*handler*/) +{ +} + +inline void SAX2XMLFilterImpl::setDeclarationHandler(DeclHandler* const /*handler*/) +{ +} + +inline void SAX2XMLFilterImpl::installAdvDocHandler(XMLDocumentHandler* const /*toInstall*/) +{ +} + +inline bool SAX2XMLFilterImpl::removeAdvDocHandler(XMLDocumentHandler* const /*toRemove*/) +{ + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.cpp b/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.cpp new file mode 100644 index 000000000..32c07c6a9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.cpp @@ -0,0 +1,1625 @@ +/* + * 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: SAX2XMLReaderImpl.cpp 882548 2009-11-20 13:44:14Z borisk $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +SAX2XMLReader * XMLReaderFactory::createXMLReader( MemoryManager* const manager + , XMLGrammarPool* const gramPool) +{ + SAX2XMLReaderImpl* pImpl=new (manager) SAX2XMLReaderImpl(manager, gramPool); + return pImpl; +} + + +const XMLCh gDTDEntityStr[] = +{ + chOpenSquare, chLatin_d, chLatin_t, chLatin_d, chCloseSquare, chNull +}; + + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ResetInProgressType; + + +SAX2XMLReaderImpl::SAX2XMLReaderImpl(MemoryManager* const manager + , XMLGrammarPool* const gramPool): + + fNamespacePrefix(false) + , fAutoValidation(false) + , fValidation(false) + , fParseInProgress(false) + , fHasExternalSubset(false) + , fElemDepth(0) + , fAdvDHCount(0) + , fAdvDHListSize(32) + , fDocHandler(0) + , fTempAttrVec(0) + , fPrefixesStorage(0) + , fPrefixes(0) + , fPrefixCounts(0) + , fTempQName(0) + , fDTDHandler(0) + , fEntityResolver(0) + , fXMLEntityResolver(0) + , fErrorHandler(0) + , fPSVIHandler(0) + , fLexicalHandler(0) + , fDeclHandler(0) + , fAdvDHList(0) + , fScanner(0) + , fGrammarResolver(0) + , fURIStringPool(0) + , fValidator(0) + , fMemoryManager(manager) + , fGrammarPool(gramPool) +{ + CleanupType cleanup(this, &SAX2XMLReaderImpl::cleanUp); + + try + { + initialize(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +SAX2XMLReaderImpl::~SAX2XMLReaderImpl() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Initialize/Cleanup methods +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::initialize() +{ + // Create grammar resolver and string pool that we pass to the scanner + fGrammarResolver = new (fMemoryManager) GrammarResolver(fGrammarPool, fMemoryManager); + fURIStringPool = fGrammarResolver->getStringPool(); + + // Create a scanner and tell it what validator to use. Then set us + // as the document event handler so we can fill the DOM document. + fScanner = XMLScannerResolver::getDefaultScanner(0, fGrammarResolver, fMemoryManager); + fScanner->setURIStringPool(fURIStringPool); + + // Create the initial advanced handler list array and zero it out + fAdvDHList = (XMLDocumentHandler**) fMemoryManager->allocate + ( + fAdvDHListSize * sizeof(XMLDocumentHandler*) + );//new XMLDocumentHandler*[fAdvDHListSize]; + memset(fAdvDHList, 0, sizeof(void*) * fAdvDHListSize); + + // SAX2 default is for namespaces (feature http://xml.org/sax/features/namespaces) to be on + setDoNamespaces(true) ; + + // default: schema is on + setDoSchema(true); + + fPrefixesStorage = new (fMemoryManager) XMLStringPool(109, fMemoryManager) ; + fPrefixes = new (fMemoryManager) ValueStackOf (30, fMemoryManager) ; + fTempAttrVec = new (fMemoryManager) RefVectorOf (10, false, fMemoryManager) ; + fPrefixCounts = new (fMemoryManager) ValueStackOf(10, fMemoryManager) ; + fTempQName = new (fMemoryManager) XMLBuffer(32, fMemoryManager); +} + + +void SAX2XMLReaderImpl::cleanUp() +{ + fMemoryManager->deallocate(fAdvDHList);//delete [] fAdvDHList; + delete fScanner; + delete fPrefixesStorage; + delete fPrefixes; + delete fTempAttrVec; + delete fPrefixCounts; + delete fGrammarResolver; + delete fTempQName; + // grammar pool must do this + //delete fURIStringPool; +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Advanced document handler list maintenance methods +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::installAdvDocHandler(XMLDocumentHandler* const toInstall) +{ + // See if we need to expand and do so now if needed + if (fAdvDHCount == fAdvDHListSize) + { + // Calc a new size and allocate the new temp buffer + const XMLSize_t newSize = (XMLSize_t)(fAdvDHListSize * 1.5); + XMLDocumentHandler** newList = (XMLDocumentHandler**) fMemoryManager->allocate + ( + newSize * sizeof(XMLDocumentHandler*) + );//new XMLDocumentHandler*[newSize]; + + // Copy over the old data to the new list and zero out the rest + memcpy(newList, fAdvDHList, sizeof(void*) * fAdvDHListSize); + memset + ( + &newList[fAdvDHListSize] + , 0 + , sizeof(void*) * (newSize - fAdvDHListSize) + ); + + // And now clean up the old array and store the new stuff + fMemoryManager->deallocate(fAdvDHList);//delete [] fAdvDHList; + fAdvDHList = newList; + fAdvDHListSize = newSize; + } + + // Add this new guy into the empty slot + fAdvDHList[fAdvDHCount++] = toInstall; + + // + // Install ourself as the document handler with the scanner. We might + // already be, but its not worth checking, just do it. + // + fScanner->setDocHandler(this); +} + + +bool SAX2XMLReaderImpl::removeAdvDocHandler(XMLDocumentHandler* const toRemove) +{ + // If our count is zero, can't be any installed + if (!fAdvDHCount) + return false; + + // + // Search the array until we find this handler. If we find a null entry + // first, we can stop there before the list is kept contiguous. + // + XMLSize_t index; + for (index = 0; index < fAdvDHCount; index++) + { + // + // We found it. We have to keep the list contiguous, so we have to + // copy down any used elements after this one. + // + if (fAdvDHList[index] == toRemove) + { + // + // Optimize if only one entry (pretty common). Otherwise, we + // have to copy them down to compact them. + // + if (fAdvDHCount > 1) + { + index++; + while (index < fAdvDHCount) + fAdvDHList[index - 1] = fAdvDHList[index]; + } + + // Bump down the count and zero out the last one + fAdvDHCount--; + fAdvDHList[fAdvDHCount] = 0; + + // + // If this leaves us with no advanced handlers and there is + // no SAX doc handler installed on us, then remove us from the + // scanner as the document handler. + // + if (!fAdvDHCount && !fDocHandler) + fScanner->setDocHandler(0); + + return true; + } + } + + // Never found it + return false; +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl Validator functions +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::setValidator(XMLValidator* valueToAdopt) +{ + fValidator = valueToAdopt; + fScanner->setValidator(valueToAdopt); +} + +XMLValidator* SAX2XMLReaderImpl::getValidator() const +{ + return fScanner->getValidator(); +} + +// --------------------------------------------------------------------------- +// SAX2XMLReader Interface +// --------------------------------------------------------------------------- +XMLSize_t SAX2XMLReaderImpl::getErrorCount() const +{ + return fScanner->getErrorCount(); +} + +void SAX2XMLReaderImpl::setContentHandler(ContentHandler* const handler) +{ + fDocHandler = handler; + if (fDocHandler) + { + // + // Make sure we are set as the document handler with the scanner. + // We may already be (if advanced handlers are installed), but its + // not worthing checking, just do it. + // + fScanner->setDocHandler(this); + } + else + { + // + // If we don't have any advanced handlers either, then deinstall us + // from the scanner because we don't need document events anymore. + // + if (!fAdvDHCount) + fScanner->setDocHandler(0); + } + +} + +void SAX2XMLReaderImpl::setDTDHandler(DTDHandler* const handler) +{ + fDTDHandler = handler; + if (fDTDHandler) + fScanner->setDocTypeHandler(this); + else + fScanner->setDocTypeHandler(0); +} + + +void SAX2XMLReaderImpl::setErrorHandler(ErrorHandler* const handler) +{ + // + // Store the handler. Then either install or deinstall us as the + // error reporter on the scanner. + // + fErrorHandler = handler; + if (fErrorHandler) { + fScanner->setErrorReporter(this); + fScanner->setErrorHandler(fErrorHandler); + } + else { + fScanner->setErrorReporter(0); + fScanner->setErrorHandler(0); + } +} + +void SAX2XMLReaderImpl::setPSVIHandler(PSVIHandler* const handler) +{ + fPSVIHandler = handler; + if (fPSVIHandler) { + fScanner->setPSVIHandler(fPSVIHandler); + } + else { + fScanner->setPSVIHandler(0); + } +} + +void SAX2XMLReaderImpl::setLexicalHandler(LexicalHandler* const handler) +{ + fLexicalHandler = handler; + if (fLexicalHandler) + fScanner->setDocTypeHandler(this); + else + fScanner->setDocTypeHandler(0); +} + +void SAX2XMLReaderImpl::setDeclarationHandler(DeclHandler* const handler) +{ + fDeclHandler = handler; + if (fDeclHandler) + fScanner->setDocTypeHandler(this); + else + fScanner->setDocTypeHandler(0); +} + + +void SAX2XMLReaderImpl::setEntityResolver(EntityResolver* const resolver) +{ + fEntityResolver = resolver; + if (fEntityResolver) { + fScanner->setEntityHandler(this); + fXMLEntityResolver = 0; + } + else { + fScanner->setEntityHandler(0); + } +} + +void SAX2XMLReaderImpl::setXMLEntityResolver(XMLEntityResolver* const resolver) +{ + fXMLEntityResolver = resolver; + if (fXMLEntityResolver) { + fScanner->setEntityHandler(this); + fEntityResolver = 0; + } + else { + fScanner->setEntityHandler(0); + } +} + +void SAX2XMLReaderImpl::setExitOnFirstFatalError(const bool newState) +{ + fScanner->setExitOnFirstFatal(newState); +} + +void SAX2XMLReaderImpl::setValidationConstraintFatal(const bool newState) +{ + fScanner->setValidationConstraintFatal(newState); +} + +void SAX2XMLReaderImpl::parse (const InputSource& source) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(source); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void SAX2XMLReaderImpl::parse (const XMLCh* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void SAX2XMLReaderImpl::parse (const char* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Progressive parse methods +// --------------------------------------------------------------------------- +bool SAX2XMLReaderImpl::parseFirst( const XMLCh* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool SAX2XMLReaderImpl::parseFirst( const char* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool SAX2XMLReaderImpl::parseFirst( const InputSource& source + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(source, toFill); +} + +bool SAX2XMLReaderImpl::parseNext(XMLPScanToken& token) +{ + return fScanner->scanNext(token); +} + +void SAX2XMLReaderImpl::parseReset(XMLPScanToken& token) +{ + // Reset the scanner + fScanner->scanReset(token); +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Overrides of the XMLDocumentHandler interface +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::docCharacters( const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Suppress the chars before the root element. + if (fElemDepth) + { + // Call the installed LexicalHandler. + if (cdataSection && fLexicalHandler) + fLexicalHandler->startCDATA(); + + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->characters(chars, length); + + // Call the installed LexicalHandler. + if (cdataSection && fLexicalHandler) + fLexicalHandler->endCDATA(); + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docCharacters(chars, length, cdataSection); +} + + +void SAX2XMLReaderImpl::docComment(const XMLCh* const commentText) +{ + // Call the installed LexicalHandler. + if (fLexicalHandler) + { + // SAX2 reports comment text like characters -- as an + // array with a length. + fLexicalHandler->comment(commentText, XMLString::stringLen(commentText)); + } + + // + // OK, if there are any installed advanced handlers, + // then let's call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docComment(commentText); +} + + +void SAX2XMLReaderImpl::XMLDecl( const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncodingStr + ) +{ + // SAX has no way to report this event. But, if there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->XMLDecl( versionStr, + encodingStr, + standaloneStr, + actualEncodingStr ); +} + + +void SAX2XMLReaderImpl::docPI( const XMLCh* const target + , const XMLCh* const data) +{ + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->processingInstruction(target, data); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docPI(target, data); +} + + +void SAX2XMLReaderImpl::endDocument() +{ + if (fDocHandler) + fDocHandler->endDocument(); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endDocument(); +} + + +void SAX2XMLReaderImpl::endEntityReference(const XMLEntityDecl& entityDecl) +{ + // Call the installed LexicalHandler. + if (fLexicalHandler) + fLexicalHandler->endEntity(entityDecl.getName()); + + // + // SAX has no way to report this event. But, if there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endEntityReference(entityDecl); +} + + +void SAX2XMLReaderImpl::ignorableWhitespace(const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Do not report the whitespace before the root element. + if (!fElemDepth) + return; + + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->ignorableWhitespace(chars, length); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->ignorableWhitespace(chars, length, cdataSection); +} + + +void SAX2XMLReaderImpl::resetDocument() +{ + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->resetDocument(); + + // Make sure our element depth flag gets set back to zero + fElemDepth = 0; + + // reset prefix counters and prefix map + fPrefixCounts->removeAllElements(); + fPrefixes->removeAllElements(); + fPrefixesStorage->flushAll(); +} + + +void SAX2XMLReaderImpl::startDocument() +{ + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->setDocumentLocator(fScanner->getLocator()); + if(fDocHandler) + fDocHandler->startDocument(); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->startDocument(); +} + + +void SAX2XMLReaderImpl:: +startElement( const XMLElementDecl& elemDecl + , const unsigned int elemURLId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot) +{ + // Bump the element depth counter if not empty + if (!isEmpty) + fElemDepth++; + + if (fDocHandler) + { + const QName* qName=elemDecl.getElementName(); + const XMLCh* baseName=qName->getLocalPart(); + const XMLCh* elemQName = 0; + if(elemPrefix==0 || *elemPrefix==0) + elemQName=baseName; + else if(XMLString::equals(elemPrefix, qName->getPrefix())) + elemQName=qName->getRawName(); + else + { + fTempQName->set(elemPrefix); + fTempQName->append(chColon); + fTempQName->append(baseName); + elemQName=fTempQName->getRawBuffer(); + } + + if (getDoNamespaces()) + { + XMLSize_t numPrefix = 0; + + if (!fNamespacePrefix) + fTempAttrVec->removeAllElements(); + + for (XMLSize_t i = 0; i < attrCount; i++) + { + const XMLCh* nsPrefix = 0; + const XMLCh* nsURI = 0; + + const XMLAttr* tempAttr = attrList.elementAt(i); + const XMLCh* prefix = tempAttr->getPrefix(); + if(prefix && *prefix) + { + if(XMLString::equals(prefix, XMLUni::fgXMLNSString)) + { + nsPrefix = tempAttr->getName(); + nsURI = tempAttr->getValue(); + } + } + else if (XMLString::equals(tempAttr->getName(), XMLUni::fgXMLNSString)) + { + nsPrefix = XMLUni::fgZeroLenString; + nsURI = tempAttr->getValue(); + } + if (!fNamespacePrefix) + { + if (nsURI == 0) + fTempAttrVec->addElement((XMLAttr*)tempAttr); + } + if (nsURI != 0) + { + if(fDocHandler) + fDocHandler->startPrefixMapping(nsPrefix, nsURI); + unsigned int nPrefixId=fPrefixesStorage->addOrFind(nsPrefix); + fPrefixes->push(nPrefixId) ; + numPrefix++; + } + } + fPrefixCounts->push(numPrefix) ; + if (!fNamespacePrefix) + fAttrList.setVector(fTempAttrVec, fTempAttrVec->size(), fScanner); + else + fAttrList.setVector(&attrList, attrCount, fScanner); + + // call startElement() with namespace declarations + if(fDocHandler) + { + fDocHandler->startElement + ( + fScanner->getURIText(elemURLId) + , baseName + , elemQName + , fAttrList + ); + } + } + else // no namespace + { + fAttrList.setVector(&attrList, attrCount, fScanner); + if(fDocHandler) + { + fDocHandler->startElement(XMLUni::fgZeroLenString, + XMLUni::fgZeroLenString, + qName->getRawName(), + fAttrList); + } + } + + + // If its empty, send the end tag event now + if (isEmpty) + { + // call endPrefixMapping appropriately. + if (getDoNamespaces()) + { + if(fDocHandler) + { + fDocHandler->endElement + ( + fScanner->getURIText(elemURLId) + , baseName + , elemQName + ); + } + + XMLSize_t numPrefix = fPrefixCounts->pop(); + for (XMLSize_t i = 0; i < numPrefix; ++i) + { + unsigned int nPrefixId = fPrefixes->pop() ; + if(fDocHandler) + fDocHandler->endPrefixMapping( fPrefixesStorage->getValueForId(nPrefixId) ); + } + } + else + { + if(fDocHandler) + { + fDocHandler->endElement(XMLUni::fgZeroLenString, + XMLUni::fgZeroLenString, + qName->getRawName()); + } + } + } + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + { + fAdvDHList[index]->startElement + ( + elemDecl + , elemURLId + , elemPrefix + , attrList + , attrCount + , isEmpty + , isRoot + ); + } +} + +void SAX2XMLReaderImpl::endElement( const XMLElementDecl& elemDecl + , const unsigned int uriId + , const bool isRoot + , const XMLCh* const elemPrefix) +{ + // Just map to the SAX document handler + if (fDocHandler) + { + const QName* qName=elemDecl.getElementName(); + const XMLCh* baseName=qName->getLocalPart(); + const XMLCh* elemQName = 0; + if(elemPrefix==0 || *elemPrefix==0) + elemQName=baseName; + else if(XMLString::equals(elemPrefix, qName->getPrefix())) + elemQName=qName->getRawName(); + else + { + fTempQName->set(elemPrefix); + fTempQName->append(chColon); + fTempQName->append(baseName); + elemQName=fTempQName->getRawBuffer(); + } + + if (getDoNamespaces()) + { + if(fDocHandler) + { + fDocHandler->endElement + ( + fScanner->getURIText(uriId) + , baseName + , elemQName + ); + } + + // get the prefixes back so that we can call endPrefixMapping() + XMLSize_t numPrefix = fPrefixCounts->pop(); + for (XMLSize_t i = 0; i < numPrefix; i++) + { + unsigned int nPrefixId = fPrefixes->pop() ; + if(fDocHandler) + fDocHandler->endPrefixMapping( fPrefixesStorage->getValueForId(nPrefixId) ); + } + } + else + { + if(fDocHandler) + { + fDocHandler->endElement(XMLUni::fgZeroLenString, + XMLUni::fgZeroLenString, + qName->getRawName()); + } + } + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endElement(elemDecl, uriId, isRoot, elemPrefix); + + // + // Dump the element depth down again. Don't let it underflow in case + // of malformed XML. + // + if (fElemDepth) + fElemDepth--; +} + +void SAX2XMLReaderImpl::startEntityReference(const XMLEntityDecl& entityDecl) +{ + // Call the installed LexicalHandler. + if (fLexicalHandler) + fLexicalHandler->startEntity(entityDecl.getName()); + // + // SAX has no way to report this. But, If there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->startEntityReference(entityDecl); +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Overrides of the DocTypeHandler interface +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::attDef( const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool ignoring) +{ + if (fDeclHandler && !ignoring) { + + XMLAttDef::AttTypes attType = attDef.getType(); + XMLAttDef::DefAttTypes defAttType = attDef.getDefaultType(); + const XMLCh* defAttTypeStr = XMLUni::fgNullString; + bool isEnumeration = (attType == XMLAttDef::Notation || attType == XMLAttDef::Enumeration); + XMLBuffer enumBuf(128, fMemoryManager); + + if (defAttType == XMLAttDef::Fixed || + defAttType == XMLAttDef::Implied || + defAttType == XMLAttDef::Required) { + defAttTypeStr = attDef.getDefAttTypeString(defAttType, fMemoryManager); + } + + if (isEnumeration) { + + const XMLCh* enumString = attDef.getEnumeration(); + XMLSize_t enumLen = XMLString::stringLen(enumString); + + if (attType == XMLAttDef::Notation) { + + enumBuf.set(XMLUni::fgNotationString); + enumBuf.append(chSpace); + } + + enumBuf.append(chOpenParen); + + for (XMLSize_t i=0; iattributeDecl(elemDecl.getFullName(), + attDef.getFullName(), + (isEnumeration) ? enumBuf.getRawBuffer() + : attDef.getAttTypeString(attDef.getType(), fMemoryManager), + defAttTypeStr, + attDef.getValue()); + } +} + + +void SAX2XMLReaderImpl::doctypeComment(const XMLCh* const commentText) +{ + if (fLexicalHandler) + { + // SAX2 reports comment text like characters -- as an + // array with a length. + fLexicalHandler->comment(commentText, XMLString::stringLen(commentText)); + } +} + + +void SAX2XMLReaderImpl::doctypeDecl(const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool hasIntSubset + , const bool hasExtSubset) +{ + // Call the installed LexicalHandler. + if (fLexicalHandler && (hasIntSubset || hasExtSubset)) + fLexicalHandler->startDTD(elemDecl.getFullName(), publicId, systemId); + + fHasExternalSubset = hasExtSubset; + + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::doctypePI( const XMLCh* const + , const XMLCh* const) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::doctypeWhitespace( const XMLCh* const + , const XMLSize_t) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::elementDecl(const DTDElementDecl& elemDecl, + const bool isIgnored) +{ + if (fDeclHandler && !isIgnored) + fDeclHandler->elementDecl(elemDecl.getFullName(), + elemDecl.getFormattedContentModel()); +} + + +void SAX2XMLReaderImpl::endAttList(const DTDElementDecl&) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::endIntSubset() +{ + // Call the installed LexicalHandler. + if (!fHasExternalSubset && fLexicalHandler) + fLexicalHandler->endDTD(); + + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::endExtSubset() +{ + // Call the installed LexicalHandler. + if (fLexicalHandler) + fLexicalHandler->endEntity(gDTDEntityStr); + if (fLexicalHandler) + fLexicalHandler->endDTD(); + + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::entityDecl( const DTDEntityDecl& entityDecl + , const bool isPEDecl + , const bool isIgnored) +{ + // + // If we have a DTD handler, and this entity is not ignored, and + // its an unparsed entity, then send this one, else if we have a Decl + // handler then send this one. + // + if (!isIgnored) { + + if (entityDecl.isUnparsed()) { + + if (fDTDHandler) { + fDTDHandler->unparsedEntityDecl + ( + entityDecl.getName() + , entityDecl.getPublicId() + , entityDecl.getSystemId() + , entityDecl.getNotationName() + ); + } + } + else if (fDeclHandler) { + + const XMLCh* entityName = entityDecl.getName(); + ArrayJanitor tmpNameJan(0); + + if (isPEDecl) { + + XMLSize_t nameLen = XMLString::stringLen(entityName); + XMLCh* tmpName = (XMLCh*) fMemoryManager->allocate + ( + (nameLen + 2) * sizeof(XMLCh) + );//new XMLCh[nameLen + 2]; + + tmpNameJan.reset(tmpName, fMemoryManager); + tmpName[0] = chPercent; + XMLString::copyString(tmpName + 1, entityName); + entityName = tmpName; + } + + if (entityDecl.isExternal()) { + fDeclHandler->externalEntityDecl + ( + entityName + , entityDecl.getPublicId() + , entityDecl.getSystemId() + ); + } + else { + fDeclHandler->internalEntityDecl + ( + entityName + , entityDecl.getValue() + ); + } + } + } +} + + +void SAX2XMLReaderImpl::resetDocType() +{ + fHasExternalSubset = false; + // Just map to the DTD handler + if (fDTDHandler) + fDTDHandler->resetDocType(); +} + + +void SAX2XMLReaderImpl::notationDecl( const XMLNotationDecl& notDecl + , const bool isIgnored) +{ + if (fDTDHandler && !isIgnored) + { + fDTDHandler->notationDecl + ( + notDecl.getName() + , notDecl.getPublicId() + , notDecl.getSystemId() + ); + } +} + + +void SAX2XMLReaderImpl::startAttList(const DTDElementDecl&) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::startIntSubset() +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAX2XMLReaderImpl::startExtSubset() +{ + if (fLexicalHandler) + fLexicalHandler->startEntity(gDTDEntityStr); +} + + +void SAX2XMLReaderImpl::TextDecl( const XMLCh* const + , const XMLCh* const) +{ + // Unused by SAX DTDHandler interface at this time +} + + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Handlers for the XMLEntityHandler interface +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::endInputSource(const InputSource&) +{ +} + +bool SAX2XMLReaderImpl::expandSystemId(const XMLCh* const, XMLBuffer&) +{ + return false; +} + + +void SAX2XMLReaderImpl::resetEntities() +{ + // Nothing to do for this one +} + +InputSource* SAX2XMLReaderImpl::resolveEntity(XMLResourceIdentifier* resourceIdentifier) +{ + // + // Just map it to the SAX entity resolver. If there is not one installed, + // return a null pointer to cause the default resolution. + // + if (fEntityResolver) + return fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(), + resourceIdentifier->getSystemId()); + if (fXMLEntityResolver) + return fXMLEntityResolver->resolveEntity(resourceIdentifier); + + return 0; +} + +void SAX2XMLReaderImpl::startInputSource(const InputSource&) +{ + // Nothing to do for this one +} + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Overrides of the XMLErrorReporter interface +// --------------------------------------------------------------------------- +void SAX2XMLReaderImpl::resetErrors() +{ + if (fErrorHandler) + fErrorHandler->resetErrors(); +} + + +void SAX2XMLReaderImpl::error( const unsigned int + , const XMLCh* const + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum) +{ + SAXParseException toThrow = SAXParseException + ( + errorText + , publicId + , systemId + , lineNum + , colNum + , fMemoryManager + ); + + if (!fErrorHandler) + { + if (errType == XMLErrorReporter::ErrType_Fatal) + throw toThrow; + else + return; + } + + if (errType == XMLErrorReporter::ErrType_Warning) + fErrorHandler->warning(toThrow); + else if (errType == XMLErrorReporter::ErrType_Fatal) + fErrorHandler->fatalError(toThrow); + else + fErrorHandler->error(toThrow); +} + + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Features and Properties +// --------------------------------------------------------------------------- + +void SAX2XMLReaderImpl::setFeature(const XMLCh* const name, const bool value) +{ + + if (fParseInProgress) + throw SAXNotSupportedException("Feature modification is not supported during parse.", fMemoryManager); + + if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreNameSpaces) == 0) + { + setDoNamespaces(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreValidation) == 0) + { + fValidation = value; + if (fValidation) + if (fAutoValidation) + setValidationScheme(Val_Auto); + else + setValidationScheme(Val_Always); + else + setValidationScheme(Val_Never); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreNameSpacePrefixes) == 0) + { + fNamespacePrefix = value; + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDynamic) == 0) + { + fAutoValidation = value; + // for auto validation, the sax2 core validation feature must also be enabled. + if (fValidation) + if (fAutoValidation) + setValidationScheme(Val_Auto); + else + setValidationScheme(Val_Always); + else + setValidationScheme(Val_Never); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchema) == 0) + { + setDoSchema(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0) + { + fScanner->setValidationSchemaFullChecking(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + { + fScanner->setIdentityConstraintChecking(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0) + { + fScanner->setLoadExternalDTD(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0) + { + fScanner->setLoadSchema(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0) + { + fScanner->setExitOnFirstFatal(!value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0) + { + fScanner->setValidationConstraintFatal(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0) + { + fScanner->cacheGrammarFromParse(value); + + if (value) + fScanner->useCachedGrammarInParse(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesUseCachedGrammarInParse) == 0) + { + if (value || !fScanner->isCachingGrammarFromParse()) + fScanner->useCachedGrammarInParse(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCalculateSrcOfs) == 0) + { + fScanner->setCalculateSrcOfs(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesStandardUriConformant) == 0) + { + fScanner->setStandardUriConformant(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0) + { + fScanner->setGenerateSyntheticAnnotations(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0) + { + fScanner->setValidateAnnotations(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) + { + fScanner->setIgnoredCachedDTD(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + fScanner->setIgnoreAnnotations(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + fScanner->setDisableDefaultEntityResolution(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + fScanner->setSkipDTDValidation(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesHandleMultipleImports) == 0) + { + fScanner->setHandleMultipleImports(value); + } + else + throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); +} + +bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreNameSpaces) == 0) + return getDoNamespaces(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreValidation) == 0) + return fValidation; + else if (XMLString::compareIStringASCII(name, XMLUni::fgSAX2CoreNameSpacePrefixes) == 0) + return fNamespacePrefix; + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDynamic) == 0) + return fAutoValidation; + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchema) == 0) + return getDoSchema(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0) + return fScanner->getValidationSchemaFullChecking(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + return fScanner->getIdentityConstraintChecking(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0) + return fScanner->getLoadExternalDTD(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0) + return fScanner->getLoadSchema(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0) + return !fScanner->getExitOnFirstFatal(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0) + return fScanner->getValidationConstraintFatal(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0) + return fScanner->isCachingGrammarFromParse(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesUseCachedGrammarInParse) == 0) + return fScanner->isUsingCachedGrammarInParse(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesCalculateSrcOfs) == 0) + return fScanner->getCalculateSrcOfs(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesStandardUriConformant) == 0) + return fScanner->getStandardUriConformant(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0) + return fScanner->getGenerateSyntheticAnnotations(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0) + return fScanner->getValidateAnnotations(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) + return fScanner->getIgnoreCachedDTD(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + return fScanner->getIgnoreAnnotations(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + return fScanner->getDisableDefaultEntityResolution(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + return fScanner->getSkipDTDValidation(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesHandleMultipleImports) == 0) + return fScanner->getHandleMultipleImports(); + else + throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); + + return false; +} + +void SAX2XMLReaderImpl::setProperty(const XMLCh* const name, void* value) +{ + if (fParseInProgress) + throw SAXNotSupportedException("Property modification is not supported during parse.", fMemoryManager); + + if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0) + { + fScanner->setExternalSchemaLocation((XMLCh*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation) == 0) + { + fScanner->setExternalNoNamespaceSchemaLocation((XMLCh*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSecurityManager) == 0) + { + fScanner->setSecurityManager((SecurityManager*)value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLowWaterMark) == 0) + { + fScanner->setLowWaterMark(*(const XMLSize_t*)value); + } + else if (XMLString::equals(name, XMLUni::fgXercesScannerName)) + { + XMLScanner* tempScanner = XMLScannerResolver::resolveScanner + ( + (const XMLCh*) value + , fValidator + , fGrammarResolver + , fMemoryManager + ); + + if (tempScanner) { + + tempScanner->setParseSettings(fScanner); + tempScanner->setURIStringPool(fURIStringPool); + delete fScanner; + fScanner = tempScanner; + } + } + else + throw SAXNotRecognizedException("Unknown Property", fMemoryManager); +} + + +void* SAX2XMLReaderImpl::getProperty(const XMLCh* const name) const +{ + if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0) + return (void*)fScanner->getExternalSchemaLocation(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation) == 0) + return (void*)fScanner->getExternalNoNamespaceSchemaLocation(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSecurityManager) == 0) + return (void*)fScanner->getSecurityManager(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLowWaterMark) == 0) + return (void*)&fScanner->getLowWaterMark(); + else if (XMLString::equals(name, XMLUni::fgXercesScannerName)) + return (void*)fScanner->getName(); + else + throw SAXNotRecognizedException("Unknown Property", fMemoryManager); + return 0; +} + + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Private getters and setters for conveniences +// --------------------------------------------------------------------------- + +void SAX2XMLReaderImpl::setValidationScheme(const ValSchemes newScheme) +{ + if (newScheme == Val_Never) + fScanner->setValidationScheme(XMLScanner::Val_Never); + else if (newScheme == Val_Always) + fScanner->setValidationScheme(XMLScanner::Val_Always); + else + fScanner->setValidationScheme(XMLScanner::Val_Auto); +} + +void SAX2XMLReaderImpl::setDoNamespaces(const bool newState) +{ + fScanner->setDoNamespaces(newState); +} + +bool SAX2XMLReaderImpl::getDoNamespaces() const +{ + return fScanner->getDoNamespaces(); +} + +void SAX2XMLReaderImpl::setDoSchema(const bool newState) +{ + fScanner->setDoSchema(newState); +} + +bool SAX2XMLReaderImpl::getDoSchema() const +{ + return fScanner->getDoSchema(); +} + + +// --------------------------------------------------------------------------- +// SAX2XMLReaderImpl: Grammar preparsing +// --------------------------------------------------------------------------- +Grammar* SAX2XMLReaderImpl::loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +Grammar* SAX2XMLReaderImpl::loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +Grammar* SAX2XMLReaderImpl::loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAX2XMLReaderImpl::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(source, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +void SAX2XMLReaderImpl::resetInProgress() +{ + fParseInProgress = false; +} + +void SAX2XMLReaderImpl::resetCachedGrammarPool() +{ + fGrammarResolver->resetCachedGrammar(); + fScanner->resetCachedGrammar(); +} + +void SAX2XMLReaderImpl::setInputBufferSize(const XMLSize_t bufferSize) +{ + fScanner->setInputBufferSize(bufferSize); +} + +Grammar* SAX2XMLReaderImpl::getGrammar(const XMLCh* const nameSpaceKey) +{ + return fGrammarResolver->getGrammar(nameSpaceKey); +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.hpp b/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.hpp new file mode 100644 index 000000000..5a6b3e7e8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAX2XMLReaderImpl.hpp @@ -0,0 +1,1749 @@ +/* + * 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: SAX2XMLReaderImpl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADERIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_SAX2XMLREADERIMPL_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class ContentHandler; +class LexicalHandler; +class DeclHandler; +class GrammarResolver; +class XMLGrammarPool; +class XMLResourceIdentifier; +class PSVIHandler; + +/** + * This class implements the SAX2 'XMLReader' interface and should be + * used by applications wishing to parse the XML files using SAX2. + * It allows the client program to install SAX2 handlers for event + * callbacks. + * + *

It can be used to instantiate a validating or non-validating + * parser, by setting a member flag.

+ * + * we basically re-use the existing SAX1 parser code, but provide a + * new implementation of XMLContentHandler that raises the new + * SAX2 style events + * + */ + +class PARSERS_EXPORT SAX2XMLReaderImpl : + public XMemory + , public SAX2XMLReader + , public XMLDocumentHandler + , public XMLErrorReporter + , public XMLEntityHandler + , public DocTypeHandler +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** The default constructor */ + SAX2XMLReaderImpl( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + /** The destructor */ + ~SAX2XMLReaderImpl() ; + //@} + + //----------------------------------------------------------------------- + // Implementation of SAX2XMLReader Interface + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // The XMLReader interface + //----------------------------------------------------------------------- + /** @name Implementation of SAX 2.0 XMLReader interface's. */ + //@{ + + /** + * This method returns the installed content handler. + * + * @return A pointer to the installed content handler object. + */ + virtual ContentHandler* getContentHandler() const ; + + /** + * This method returns the installed DTD handler. + * + * @return A pointer to the installed DTD handler object. + */ + virtual DTDHandler* getDTDHandler() const ; + + /** + * This method returns the installed entity resolver. + * + * @return A pointer to the installed entity resolver object. + */ + virtual EntityResolver* getEntityResolver() const ; + + /** + * This method returns the installed entity resolver. + * + * @return A pointer to the installed entity resolver object. + */ + virtual XMLEntityResolver* getXMLEntityResolver() const ; + + /** + * This method returns the installed error handler. + * + * @return A pointer to the installed error handler object. + */ + virtual ErrorHandler* getErrorHandler() const ; + + /** + * This method returns the installed PSVI handler. + * + * @return A pointer to the installed PSVI handler object. + */ + virtual PSVIHandler* getPSVIHandler() const ; + + /** + * Query the current state of any feature in a SAX2 XMLReader. + * + * @param name The unique identifier (URI) of the feature being set. + * @return The current state of the feature. + * @exception SAXNotRecognizedException If the requested feature is not known. + */ + virtual bool getFeature(const XMLCh* const name) const ; + + /** + * Query the current value of a property in a SAX2 XMLReader. + * + * The parser owns the returned pointer. The memory allocated for + * the returned pointer will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else; otherwise you may get unexpected result. Since the returned + * pointer is a generic void pointer, see the SAX2 Programming Guide to learn + * exactly what type of property value each property returns for replication. + * + * @param name The unique identifier (URI) of the property being set. + * @return The current value of the property. The pointer spans the same + * life-time as the parser. A null pointer is returned if nothing + * was specified externally. + * @exception SAXNotRecognizedException If the requested property is not known. + */ + virtual void* getProperty(const XMLCh* const name) const ; + + /** + * Allow an application to register a document event handler. + * + * If the application does not register a document handler, all + * document events reported by the SAX parser will be silently + * ignored (this is the default behaviour implemented by + * HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The document handler. + * @see DocumentHandler#DocumentHandler + * @see HandlerBase#HandlerBase + */ + virtual void setContentHandler(ContentHandler* const handler) ; + + /** + * Allow an application to register a DTD event handler. + * + * If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored (this + * is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the middle + * of a parse, and the SAX parser must begin using the new handler + * immediately. + * + * @param handler The DTD handler. + * @see DTDHandler#DTDHandler + * @see HandlerBase#HandlerBase + */ + virtual void setDTDHandler(DTDHandler* const handler) ; + + /** + * Allow an application to register a custom entity resolver. + * + * If the application does not register an entity resolver, the + * SAX parser will resolve system identifiers and open connections + * to entities itself (this is the default behaviour implemented in + * DefaultHandler). + * + * Applications may register a new or different entity resolver + * in the middle of a parse, and the SAX parser must begin using + * the new resolver immediately. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one is used. + * + * @param resolver The object for resolving entities. + * @see EntityResolver#EntityResolver + * @see DefaultHandler#DefaultHandler + */ + virtual void setEntityResolver(EntityResolver* const resolver) ; + + /** Set the entity resolver + * + * This method allows applications to install their own entity + * resolver. By installing an entity resolver, the applications + * can trap and potentially redirect references to external + * entities. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one is used. + * + * @param resolver A const pointer to the user supplied entity + * resolver. + * + * @see #getXMLEntityResolver + */ + virtual void setXMLEntityResolver(XMLEntityResolver* const resolver) ; + + /** + * Allow an application to register an error event handler. + * + * If the application does not register an error event handler, + * all error events reported by the SAX parser will be silently + * ignored, except for fatalError, which will throw a SAXException + * (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see ErrorHandler#ErrorHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setErrorHandler(ErrorHandler* const handler) ; + + /** + * This method installs the user specified PSVI handler on + * the parser. + * + * @param handler A pointer to the PSVI handler to be called + * when the parser comes across 'PSVI' events + * as per the schema specification. + */ + virtual void setPSVIHandler(PSVIHandler* const handler); + + /** + * Set the state of any feature in a SAX2 XMLReader. + * Supported features in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://xml.org/sax/features/validation (default: false) + *
http://xml.org/sax/features/namespaces (default: true) + *
http://xml.org/sax/features/namespace-prefixes (default: false) + *
http://apache.org/xml/features/validation/dynamic (default: false) + *
http://apache.org/xml/features/validation/reuse-grammar (default: false) + *
http://apache.org/xml/features/validation/schema (default: true) + *
http://apache.org/xml/features/validation/schema-full-checking (default: false) + *
http://apache.org/xml/features/validating/load-schema (default: true) + *
http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true) + *
http://apache.org/xml/features/continue-after-fatal-error (default: false) + *
http://apache.org/xml/features/validation-error-as-fatal (default: false) + * + * @param name The unique identifier (URI) of the feature. + * @param value The requested state of the feature (true or false). + * @exception SAXNotRecognizedException If the requested feature is not known. + * @exception SAXNotSupportedException Feature modification is not supported during parse + * + */ + virtual void setFeature(const XMLCh* const name, const bool value) ; + + /** + * Set the value of any property in a SAX2 XMLReader. + * Supported properties in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://apache.org/xml/properties/schema/external-schemaLocation + *
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation. + * + * It takes a void pointer as the property value. Application is required to initialize this void + * pointer to a correct type. See the SAX2 Programming Guide + * to learn exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. + * If the same property is set more than once, the last one takes effect. + * + * @param name The unique identifier (URI) of the property being set. + * @param value The requested value for the property. See + * the SAX2 Programming Guide to learn + * exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead + * to unexpected result. + * @exception SAXNotRecognizedException If the requested property is not known. + * @exception SAXNotSupportedException Property modification is not supported during parse + */ + virtual void setProperty(const XMLCh* const name, void* value) ; + + /** + * Parse an XML document. + * + * The application can use this method to instruct the SAX parser + * to begin parsing an XML document from any valid input + * source (a character stream, a byte stream, or a URI). + * + * Applications may not invoke this method while a parse is in + * progress (they should create a new Parser instead for each + * additional XML document). Once a parse is complete, an + * application may reuse the same Parser object, possibly with a + * different input source. + * + * @param source The input source for the top-level of the + * XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see InputSource#InputSource + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setDocumentHandler + * @see #setErrorHandler + */ + virtual void parse + ( + const InputSource& source + ) ; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(InputSource) + */ + virtual void parse + ( + const XMLCh* const systemId + ) ; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(InputSource) + */ + virtual void parse + ( + const char* const systemId + ) ; + + //@} + + // ----------------------------------------------------------------------- + // SAX 2.0-ext + // ----------------------------------------------------------------------- + /** @name SAX 2.0-ext */ + //@{ + /** + * This method returns the installed declaration handler. + * + * @return A pointer to the installed declaration handler object. + */ + virtual DeclHandler* getDeclarationHandler() const ; + + /** + * This method returns the installed lexical handler. + * + * @return A pointer to the installed lexical handler object. + */ + virtual LexicalHandler* getLexicalHandler() const ; + + /** + * Allow an application to register a declaration event handler. + * + * If the application does not register a declaration handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by DefaultHandler). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The DTD declaration handler. + * @see DeclHandler#DeclHandler + * @see SAXException#SAXException + * @see DefaultHandler#DefaultHandler + */ + virtual void setDeclarationHandler(DeclHandler* const handler) ; + + /** + * Allow an application to register a lexical event handler. + * + * If the application does not register a lexical handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see LexicalHandler#LexicalHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setLexicalHandler(LexicalHandler* const handler) ; + + //@} + + // ----------------------------------------------------------------------- + // Getter Methods + // ----------------------------------------------------------------------- + /** @name Getter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to get the current validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @return A pointer to the validator. An application should not deleted + * the object returned. + * + */ + virtual XMLValidator* getValidator() const ; + //@} + + /** Get error count from the last parse operation. + * + * This method returns the error count from the last parse + * operation. Note that this count is actually stored in the + * scanner, so this method simply returns what the + * scanner reports. + * + * @return number of errors encountered during the latest + * parse operation. + */ + virtual XMLSize_t getErrorCount() const ; + + /** + * This method returns the state of the parser's + * exit-on-First-Fatal-Error flag. + * + *

Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which indicates the opposite state.

+ * + * @return true, if the parser is currently configured to + * exit on the first fatal error, false otherwise. + * + * @see #setExitOnFirstFatalError + * @see #getFeature + */ + virtual bool getExitOnFirstFatalError() const ; + + /** + * This method returns the state of the parser's + * validation-constraint-fatal flag. + * + *

Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing. + * + * @return true, if the parser is currently configured to + * set validation constraint errors as fatal, false + * otherwise. + * + * @see #setValidationContraintFatal + * @see #getFeature + */ + virtual bool getValidationConstraintFatal() const ; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey); + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + virtual Grammar* getRootGrammar(); + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + virtual const XMLCh* getURIText(unsigned int uriId) const; + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + virtual XMLFilePos getSrcOffset() const; + + //@} + + // ----------------------------------------------------------------------- + // Setter Methods + // ----------------------------------------------------------------------- + /** @name Setter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to set a validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @param valueToAdopt A pointer to the validator that the reader should use. + * + */ + virtual void setValidator(XMLValidator* valueToAdopt) ; + + /** + * This method allows users to set the parser's behaviour when it + * encounters the first fatal error. If set to true, the parser + * will exit at the first fatal error. If false, then it will + * report the error and continue processing. + * + *

The default value is 'true' and the parser exits on the + * first fatal error.

+ * + *

Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which has the opposite behaviour.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState The value specifying whether the parser should + * continue or exit when it encounters the first + * fatal error. + * + * @see #getExitOnFirstFatalError + * @see #setFeature + */ + virtual void setExitOnFirstFatalError(const bool newState) ; + + /** + * This method allows users to set the parser's behaviour when it + * encounters a validation constraint error. If set to true, and the + * the parser will treat validation error as fatal and will exit depends on the + * state of "getExitOnFirstFatalError". If false, then it will + * report the error and continue processing. + * + * Note: setting this true does not mean the validation error will be printed with + * the word "Fatal Error". It is still printed as "Error", but the parser + * will exit if "setExitOnFirstFatalError" is set to true. + * + *

The default value is 'false'.

+ * + *

Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState If true, the parser will exit if "setExitOnFirstFatalError" + * is set to true. + * + * @see #getValidationConstraintFatal + * @see #setExitOnFirstFatalError + * @see #setFeature + */ + virtual void setValidationConstraintFatal(const bool newState) ; + //@} + + + // ----------------------------------------------------------------------- + // Progressive scan methods + // ----------------------------------------------------------------------- + + /** @name Progressive scan methods */ + //@{ + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a Unicode string representing the path + * to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could parse the + * prolog (which means the token will not be valid.) + * + * @see #parseNext + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ) ; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a regular native string representing + * the path to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ) ; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + */ + virtual bool parseFirst + ( + const InputSource& source + , XMLPScanToken& toFill + ) ; + + /** Continue a progressive parse operation + * + * This method is used to continue with progressive parsing of + * XML files started by a call to 'parseFirst' method. + * + * It parses the XML file and stops as soon as it comes across + * a XML token (as defined in the XML specification). Relevant + * callback handlers are invoked as required by the SAX + * specification. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the next XML token. + * It indicates the user can go ahead with parsing the rest + * of the file. It returns 'false' to indicate that the parser + * could not find next token as per the XML specification + * production rule. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseNext(XMLPScanToken& token) ; + + /** Reset the parser after a progressive parse + * + * If a progressive parse loop exits before the end of the document + * is reached, the parser has no way of knowing this. So it will leave + * open any files or sockets or memory buffers that were in use at + * the time that the parse loop exited. + * + * The next parse operation will cause these open files and such to + * be closed, but the next parse operation might occur at some unknown + * future point. To avoid this problem, you should reset the parser if + * you exit the loop early. + * + * If you exited because of an error, then this cleanup will be done + * for you. Its only when you exit the file prematurely of your own + * accord, because you've found what you wanted in the file most + * likely. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + */ + virtual void parseReset(XMLPScanToken& token) ; + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the grammar preparsing interface + // ----------------------------------------------------------------------- + + /** @name Implementation of Grammar preparsing interface's. */ + //@{ + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the SAX InputSource parameter. + * + * + * @param source A const reference to the SAX InputSource object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see InputSource#InputSource + */ + virtual Grammar* loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. + * + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. + * + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Clear the cached grammar pool + */ + virtual void resetCachedGrammarPool(); + + /** Set maximum input buffer size + * + * This method allows users to limit the size of buffers used in parsing + * XML character data. The effect of setting this size is to limit the + * size of a ContentHandler::characters() call. + * + * The parser's default input buffer size is 1 megabyte. + * + * @param bufferSize The maximum input buffer size + */ + virtual void setInputBufferSize(const XMLSize_t bufferSize); + + //@} + + + // ----------------------------------------------------------------------- + // Advanced document handler list maintenance methods + // ----------------------------------------------------------------------- + + /** @name Advanced document handler list maintenance methods */ + //@{ + /** + * This method installs the specified 'advanced' document callback + * handler, thereby allowing the user to customize the processing, + * if they choose to do so. Any number of advanced callback handlers + * maybe installed. + * + *

The methods in the advanced callback interface represent + * Xerces-C extensions. There is no specification for this interface.

+ * + * @param toInstall A pointer to the users advanced callback handler. + * + * @see #removeAdvDocHandler + */ + virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) ; + + /** + * This method removes the 'advanced' document handler callback from + * the underlying parser scanner. If no handler is installed, advanced + * callbacks are not invoked by the scanner. + * @param toRemove A pointer to the advanced callback handler which + * should be removed. + * + * @see #installAdvDocHandler + */ + virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) ; + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLDocumentHandler interface + // ----------------------------------------------------------------------- + /** @name Implementation of the XMLDocumentHandler Interface. */ + //@{ + /** + * This method is used to report all the characters scanned + * by the parser. The driver will invoke the 'characters' + * method of the user installed SAX Document Handler. + * + *

If any advanced callback handlers are installed, the + * corresponding 'docCharacters' method will also be invoked.

+ * + * @param chars A const pointer to a Unicode string representing the + * character data. + * @param length The length of the Unicode string returned in 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + * @see DocumentHandler#characters + */ + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** + * This method is used to report any comments scanned by the parser. + * This method is a no-op unless, unless an advanced callback handler + * is installed, in which case the corresponding 'docComment' method + * is invoked. + * + * @param comment A const pointer to a null terminated Unicode + * string representing the comment text. + */ + virtual void docComment + ( + const XMLCh* const comment + ); + + /** + * This method is used to report any PI scanned by the parser. + * + *

Any PI's occurring before any 'content' are not reported + * to any SAX handler as per the specification. However, all + * PI's within content are reported via the SAX Document Handler's + * 'processingInstruction' method. + * + *

If any advanced callback handlers are installed, the + * corresponding 'docPI' method will be invoked.

+ * + * @param target A const pointer to a Unicode string representing the + * target of the PI declaration. + * @param data A const pointer to a Unicode string representing the + * data of the PI declaration. See the PI production rule + * in the XML specification for details. + * + * @see DocumentHandler#processingInstruction + */ + virtual void docPI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * This method is used to indicate the end of root element + * was just scanned by the parser. Corresponding 'endDocument' + * method of the user installed SAX Document Handler will also + * be invoked. + * + *

In addition, if any advanced callback handlers are installed, + * the corresponding 'endDocument' method is invoked.

+ * + * @see DocumentHandler#endDocument + */ + virtual void endDocument(); + + /** + * This method is used to indicate the end tag of an element. + * The driver will invoke the corresponding 'endElement' method of + * the SAX Document Handler interface. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endElement' method is also invoked.

+ * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param isRoot A flag indicating whether this element was the + * root element. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @see DocumentHandler#endElement + */ + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix=0 + ); + + /** + * This method is used to indicate that an end of an entity reference + * was just scanned. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endEntityReference' method is invoked.

+ * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void endEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** + * This method is used to report all the whitespace characters, + * which are determined to be 'ignorable'. This distinction + * between characters is only made, if validation is enabled. + * Corresponding 'ignorableWhitespace' method of the user installed + * SAX Document Handler interface is called. + * + *

Any whitespace before content is not reported to the SAX + * Document Handler method, as per the SAX specification. + * However, if any advanced callback handlers are installed, the + * corresponding 'ignorableWhitespace' method is invoked.

+ * + * @param chars A const pointer to a Unicode string representing the + * ignorable whitespace character data. + * @param length The length of the Unicode string 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + * @see DocumentHandler#ignorableWhitespace + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** + * This method allows the user installed Document Handler and + * any advanced callback handlers to 'reset' themselves. + */ + virtual void resetDocument(); + + /** + * This method is used to report the start of the parsing process. + * The corresponding user installed SAX Document Handler's method + * 'startDocument' is invoked. + * + *

If any advanced callback handlers are installed, then the + * corresponding 'startDocument' method is also called.

+ * + * @see DocumentHandler#startDocument + */ + virtual void startDocument(); + + /** + * This method is used to report the start of an element. It is + * called at the end of the element, by which time all attributes + * specified are also parsed. The corresponding user installed + * SAX Document Handler's method 'startElement' is invoked. + * + *

If any advanced callback handlers are installed, then the + * corresponding 'startElement' method is also called.

+ * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @param attrList A const reference to the object containing the + * list of attributes just scanned for this element. + * @param attrCount A count of number of attributes in the list + * specified by the parameter 'attrList'. + * @param isEmpty A flag indicating whether this is an empty element + * or not. + * @param isRoot A flag indicating whether this element was the + * root element. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ); + + /** + * This method is used to indicate the start of an entity reference. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endEntityReference' method is invoked.

+ * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void startEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** + * This method is used to report the XML decl scanned by the parser. + * Refer to the XML specification to see the meaning of parameters. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param versionStr A const pointer to a Unicode string representing + * version string value. + * @param encodingStr A const pointer to a Unicode string representing + * the encoding string value. + * @param standaloneStr A const pointer to a Unicode string + * representing the standalone string value. + * @param actualEncodingStr A const pointer to a Unicode string + * representing the actual encoding string + * value. + */ + virtual void XMLDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncodingStr + ); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLErrorReporter interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLErrorReporter Interface. */ + //@{ + /** + * This method is used to report back errors found while parsing the + * XML file. The driver will call the corresponding user installed + * SAX Error Handler methods: 'fatal', 'error', 'warning' depending + * on the severity of the error. This classification is defined by + * the XML specification. + * + * @param errCode An integer code for the error. + * @param msgDomain A const pointer to an Unicode string representing + * the message domain to use. + * @param errType An enumeration classifying the severity of the error. + * @param errorText A const pointer to an Unicode string representing + * the text of the error message. + * @param systemId A const pointer to an Unicode string representing + * the system id of the XML file where this error + * was discovered. + * @param publicId A const pointer to an Unicode string representing + * the public id of the XML file where this error + * was discovered. + * @param lineNum The line number where the error occurred. + * @param colNum The column number where the error occurred. + * @see ErrorHandler + */ + virtual void error + ( + const unsigned int errCode + , const XMLCh* const msgDomain + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ); + + /** + * This method allows the user installed Error Handler + * callback to 'reset' itself. + * + * This method is a no-op for this SAX driver + * implementation. + * + */ + virtual void resetErrors(); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLEntityHandler interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLEntityHandler Interface. */ + //@{ + /** + * This method is used to indicate the end of parsing of an external + * entity file. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the XML file being parsed. + * @see InputSource + */ + virtual void endInputSource(const InputSource& inputSource); + + /** + * This method allows an installed XMLEntityHandler to further + * process any system id's of external entities encountered in + * the XML file being parsed, such as redirection etc. + * + * This method always returns 'false' + * for this SAX driver implementation. + * + * @param systemId A const pointer to an Unicode string representing + * the system id scanned by the parser. + * @param toFill A pointer to a buffer in which the application + * processed system id is stored. + * @return 'true', if any processing is done, 'false' otherwise. + */ + virtual bool expandSystemId + ( + const XMLCh* const systemId + , XMLBuffer& toFill + ); + + /** + * This method allows the installed XMLEntityHandler to reset + * itself. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void resetEntities(); + + /** Resolve a public/system id + * + * This method allows a user installed entity handler to further + * process any pointers to external entities. The applications can + * implement 'redirection' via this callback. + * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return The value returned by the user installed resolveEntity + * method or NULL otherwise to indicate no processing was done. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @see XMLEntityHandler + * @see XMLEntityResolver + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ); + + /** + * This method is used to indicate the start of parsing an + * external entity file. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the external entity + * being parsed. + */ + virtual void startInputSource(const InputSource& inputSource); + //@} + + // ----------------------------------------------------------------------- + // Implementation of the Deprecated DocTypeHandler Interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the deprecated DocTypeHandler Interface */ + //@{ + /** + * This method is used to report an attribute definition. + * + * This method is a no-op for this SAX + * driver implementation. + * + * @param elemDecl A const reference to the object containing information + * about the element whose attribute definition was just + * parsed. + * @param attDef A const reference to the object containing information + * attribute definition. + * @param ignore The flag indicating whether this attribute definition + * was ignored by the parser or not. + */ + virtual void attDef + ( + const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool ignoring + ); + + /** + * This method is used to report a comment occurring within the DTD. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param comment A const pointer to a Unicode string representing the + * text of the comment just parsed. + */ + virtual void doctypeComment + ( + const XMLCh* const comment + ); + + /** + * This method is used to report the DOCTYPE declaration. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing information + * about the root element definition declaration of the + * XML document being parsed. + * @param publicId A const pointer to a Unicode string representing the + * public id of the DTD file. + * @param systemId A const pointer to a Unicode string representing the + * system id of the DTD file. + * @param hasIntSubset A flag indicating if this XML file contains any + * internal subset. + * @param hasExtSubset A flag indicating if this XML file contains any + * external subset. Default is false. + */ + virtual void doctypeDecl + ( + const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool hasIntSubset + , const bool hasExtSubset = false + ); + + /** + * This method is used to report any PI declarations + * occurring inside the DTD definition block. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param target A const pointer to a Unicode string representing the + * target of the PI declaration. + * @param data A const pointer to a Unicode string representing the + * data of the PI declaration. See the PI production rule + * in the XML specification for details. + */ + virtual void doctypePI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * This method is used to report any whitespaces + * occurring inside the DTD definition block. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param chars A const pointer to a Unicode string representing the + * whitespace characters. + * @param length The length of the whitespace Unicode string. + */ + virtual void doctypeWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * This method is used to report an element declarations + * successfully scanned by the parser. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param decl A const reference to the object containing element + * declaration information. + * @param isIgnored The flag indicating whether this definition was + * ignored by the parser or not. + */ + virtual void elementDecl + ( + const DTDElementDecl& decl + , const bool isIgnored + ); + + /** + * This method is used to report the end of an attribute + * list declaration for an element. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + */ + virtual void endAttList + ( + const DTDElementDecl& elemDecl + ); + + /** + * This method is used to report the end of the internal subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void endIntSubset(); + + /** + * This method is used to report the end of the external subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void endExtSubset(); + + /** + * This method is used to report any entity declarations. + * For unparsed entities, this driver will invoke the + * SAX DTDHandler::unparsedEntityDecl callback. + * + * @param entityDecl A const reference to the object containing + * the entity declaration information. + * @param isPEDecl The flag indicating whether this was a + * parameter entity declaration or not. + * @param isIgnored The flag indicating whether this definition + * was ignored by the parser or not. + * + * @see DTDHandler#unparsedEntityDecl + */ + virtual void entityDecl + ( + const DTDEntityDecl& entityDecl + , const bool isPEDecl + , const bool isIgnored + ); + + /** + * This method allows the user installed DTD handler to + * reset itself. + */ + virtual void resetDocType(); + + /** + * This method is used to report any notation declarations. + * If there is a user installed DTDHandler, then the driver will + * invoke the SAX DTDHandler::notationDecl callback. + * + * @param notDecl A const reference to the object containing the notation + * declaration information. + * @param isIgnored The flag indicating whether this definition was ignored + * by the parser or not. + * + * @see DTDHandler#notationDecl + */ + virtual void notationDecl + ( + const XMLNotationDecl& notDecl + , const bool isIgnored + ); + + /** + * This method is used to indicate the start of an element's attribute + * list declaration. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + */ + virtual void startAttList + ( + const DTDElementDecl& elemDecl + ); + + /** + * This method is used indicate the start of the internal subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void startIntSubset(); + + /** + * This method is used indicate the start of the external subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void startExtSubset(); + + /** + * This method is used to report the TextDecl. Refer to the XML + * specification for the syntax of a TextDecl. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param versionStr A const pointer to a Unicode string representing + * the version number of the 'version' clause. + * @param encodingStr A const pointer to a Unicode string representing + * the encoding name of the 'encoding' clause. + */ + virtual void TextDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + ); + //@} + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SAX2XMLReaderImpl(const SAX2XMLReaderImpl&); + SAX2XMLReaderImpl& operator=(const SAX2XMLReaderImpl&); + + // ----------------------------------------------------------------------- + // Initialize/Cleanup methods + // ----------------------------------------------------------------------- + void initialize(); + void cleanUp(); + void resetInProgress(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fAttrList + // A temporary implementation of the basic SAX2 Attributes + // interface. We use this one over and over on each startElement + // event to allow SAX-like access to the element attributes. + // + // fDocHandler + // The installed SAX content handler, if any. Null if none. + // + // fnamespacePrefix + // Indicates whether the namespace-prefix feature is on or off. + // + // fautoValidation + // Indicates whether automatic validation is on or off + // + // fValidation + // Indicates whether the 'validation' core features is on or off + // + // fReuseGrammar + // Tells the parser whether it should reuse the grammar or not. + // If true, there cannot be any internal subset. + // + // fPrefixesStorage + // the namespace prefixes will be allocated from this pool + // + // fPrefixes + // A Stack of the current namespace prefixes that need calls to + // endPrefixMapping + // + // fPrefixCounts + // A Stack of the number of prefixes that need endPrefixMapping + // calls for that element + // + // fDTDHandler + // The installed SAX DTD handler, if any. Null if none. + // + // fElemDepth + // This is used to track the element nesting depth, so that we can + // know when we are inside content. This is so we can ignore char + // data outside of content. + // + // fEntityResolver + // The installed SAX entity handler, if any. Null if none. + // + // fErrorHandler + // The installed SAX error handler, if any. Null if none. + // + // fLexicalHandler + // The installed SAX lexical handler, if any. Null if none. + // + // fDecllHandler + // The installed SAX declaration handler, if any. Null if none. + // + // fAdvDHCount + // fAdvDHList + // fAdvDHListSize + // This is an array of pointers to XMLDocumentHandlers, which is + // how we see installed advanced document handlers. There will + // usually not be very many at all, so a simple array is used + // instead of a collection, for performance. It will grow if needed, + // but that is unlikely. + // + // The count is how many handlers are currently installed. The size + // is how big the array itself is (for expansion purposes.) When + // count == size, is time to expand. + // + // fParseInProgress + // This flag is set once a parse starts. It is used to prevent + // multiple entrance or reentrance of the parser. + // + // fScanner + // The scanner being used by this parser. It is created internally + // during construction. + // + // fHasExternalSubset + // Indicate if the document has external DTD subset. + // + // fGrammarPool + // The grammar pool passed from external application (through derivatives). + // which could be 0, not owned. + // + // ----------------------------------------------------------------------- + bool fNamespacePrefix; + bool fAutoValidation; + bool fValidation; + bool fParseInProgress; + bool fHasExternalSubset; + XMLSize_t fElemDepth; + XMLSize_t fAdvDHCount; + XMLSize_t fAdvDHListSize; + VecAttributesImpl fAttrList ; + ContentHandler* fDocHandler ; + RefVectorOf* fTempAttrVec ; + XMLStringPool* fPrefixesStorage ; + ValueStackOf* fPrefixes ; + ValueStackOf* fPrefixCounts ; + XMLBuffer* fTempQName; + DTDHandler* fDTDHandler; + EntityResolver* fEntityResolver; + XMLEntityResolver* fXMLEntityResolver; + ErrorHandler* fErrorHandler; + PSVIHandler* fPSVIHandler; + LexicalHandler* fLexicalHandler; + DeclHandler* fDeclHandler; + XMLDocumentHandler** fAdvDHList; + XMLScanner* fScanner; + GrammarResolver* fGrammarResolver; + XMLStringPool* fURIStringPool; + XMLValidator* fValidator; + MemoryManager* fMemoryManager; + XMLGrammarPool* fGrammarPool; + + // ----------------------------------------------------------------------- + // internal function used to set the state of the parser + // ----------------------------------------------------------------------- + void setValidationScheme(const ValSchemes newScheme); + void setDoNamespaces(const bool newState); + bool getDoNamespaces() const; + void setDoSchema(const bool newState); + bool getDoSchema() const; +}; + + +// --------------------------------------------------------------------------- +// SAX2XMLReader: Getter methods +// --------------------------------------------------------------------------- +inline ContentHandler* SAX2XMLReaderImpl::getContentHandler() const +{ + return fDocHandler; +} + +inline DTDHandler* SAX2XMLReaderImpl::getDTDHandler() const +{ + return fDTDHandler ; +} + +inline EntityResolver* SAX2XMLReaderImpl::getEntityResolver() const +{ + return fEntityResolver; +} + +inline XMLEntityResolver* SAX2XMLReaderImpl::getXMLEntityResolver() const +{ + return fXMLEntityResolver; +} + +inline ErrorHandler* SAX2XMLReaderImpl::getErrorHandler() const +{ + return fErrorHandler; +} + +inline PSVIHandler* SAX2XMLReaderImpl::getPSVIHandler() const +{ + return fPSVIHandler; +} + +inline LexicalHandler* SAX2XMLReaderImpl::getLexicalHandler() const +{ + return fLexicalHandler; +} + +inline DeclHandler* SAX2XMLReaderImpl::getDeclarationHandler() const +{ + return fDeclHandler; +} + +inline bool SAX2XMLReaderImpl::getExitOnFirstFatalError() const +{ + return fScanner->getExitOnFirstFatal(); +} + +inline bool SAX2XMLReaderImpl::getValidationConstraintFatal() const +{ + return fScanner->getValidationConstraintFatal(); +} + +inline Grammar* SAX2XMLReaderImpl::getRootGrammar() +{ + return fScanner->getRootGrammar(); +} + +inline const XMLCh* SAX2XMLReaderImpl::getURIText(unsigned int uriId) const +{ + return fScanner->getURIText(uriId); +} + +inline XMLFilePos SAX2XMLReaderImpl::getSrcOffset() const +{ + return fScanner->getSrcOffset(); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/SAXParser.cpp b/project/jni/xerces/src/xercesc/parsers/SAXParser.cpp new file mode 100644 index 000000000..1441fc563 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAXParser.cpp @@ -0,0 +1,1351 @@ +/* + * 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: SAXParser.cpp 882548 2009-11-20 13:44:14Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// SAXParser: Constructors and Destructor +// --------------------------------------------------------------------------- + + +typedef JanitorMemFunCall CleanupType; +typedef JanitorMemFunCall ResetInProgressType; + + +SAXParser::SAXParser( XMLValidator* const valToAdopt + , MemoryManager* const manager + , XMLGrammarPool* const gramPool): + + fParseInProgress(false) + , fElemDepth(0) + , fAdvDHCount(0) + , fAdvDHListSize(32) + , fDocHandler(0) + , fDTDHandler(0) + , fEntityResolver(0) + , fXMLEntityResolver(0) + , fErrorHandler(0) + , fPSVIHandler(0) + , fAdvDHList(0) + , fScanner(0) + , fGrammarResolver(0) + , fURIStringPool(0) + , fValidator(valToAdopt) + , fMemoryManager(manager) + , fGrammarPool(gramPool) + , fElemQNameBuf(1023, manager) +{ + CleanupType cleanup(this, &SAXParser::cleanUp); + + try + { + initialize(); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +SAXParser::~SAXParser() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// SAXParser: Initialize/CleanUp methods +// --------------------------------------------------------------------------- +void SAXParser::initialize() +{ + // Create grammar resolver and string pool to pass to scanner + fGrammarResolver = new (fMemoryManager) GrammarResolver(fGrammarPool, fMemoryManager); + fURIStringPool = fGrammarResolver->getStringPool(); + + // Create our scanner and tell it what validator to use + fScanner = XMLScannerResolver::getDefaultScanner(fValidator, fGrammarResolver, fMemoryManager); + fScanner->setURIStringPool(fURIStringPool); + + // Create the initial advanced handler list array and zero it out + fAdvDHList = (XMLDocumentHandler**) fMemoryManager->allocate + ( + fAdvDHListSize * sizeof(XMLDocumentHandler*) + );//new XMLDocumentHandler*[fAdvDHListSize]; + memset(fAdvDHList, 0, sizeof(void*) * fAdvDHListSize); +} + +void SAXParser::cleanUp() +{ + fMemoryManager->deallocate(fAdvDHList);//delete [] fAdvDHList; + delete fScanner; + delete fGrammarResolver; + // grammar pool must do this + //delete fURIStringPool; + + if (fValidator) + delete fValidator; +} + + +// --------------------------------------------------------------------------- +// SAXParser: Advanced document handler list maintenance methods +// --------------------------------------------------------------------------- +void SAXParser::installAdvDocHandler(XMLDocumentHandler* const toInstall) +{ + // See if we need to expand and do so now if needed + if (fAdvDHCount == fAdvDHListSize) + { + // Calc a new size and allocate the new temp buffer + const XMLSize_t newSize = (XMLSize_t)(fAdvDHListSize * 1.5); + XMLDocumentHandler** newList = (XMLDocumentHandler**) fMemoryManager->allocate + ( + newSize * sizeof(XMLDocumentHandler*) + );//new XMLDocumentHandler*[newSize]; + + // Copy over the old data to the new list and zero out the rest + memcpy(newList, fAdvDHList, sizeof(void*) * fAdvDHListSize); + memset + ( + &newList[fAdvDHListSize] + , 0 + , sizeof(void*) * (newSize - fAdvDHListSize) + ); + + // And now clean up the old array and store the new stuff + fMemoryManager->deallocate(fAdvDHList);//delete [] fAdvDHList; + fAdvDHList = newList; + fAdvDHListSize = newSize; + } + + // Add this new guy into the empty slot + fAdvDHList[fAdvDHCount++] = toInstall; + + // + // Install ourself as the document handler with the scanner. We might + // already be, but its not worth checking, just do it. + // + fScanner->setDocHandler(this); +} + + +bool SAXParser::removeAdvDocHandler(XMLDocumentHandler* const toRemove) +{ + // If our count is zero, can't be any installed + if (!fAdvDHCount) + return false; + + // + // Search the array until we find this handler. If we find a null entry + // first, we can stop there before the list is kept contiguous. + // + XMLSize_t index; + for (index = 0; index < fAdvDHCount; index++) + { + // + // We found it. We have to keep the list contiguous, so we have to + // copy down any used elements after this one. + // + if (fAdvDHList[index] == toRemove) + { + // + // Optimize if only one entry (pretty common). Otherwise, we + // have to copy them down to compact them. + // + if (fAdvDHCount > 1) + { + index++; + while (index < fAdvDHCount) + fAdvDHList[index - 1] = fAdvDHList[index]; + } + + // Bump down the count and zero out the last one + fAdvDHCount--; + fAdvDHList[fAdvDHCount] = 0; + + // + // If this leaves us with no advanced handlers and there is + // no SAX doc handler installed on us, then remove us from the + // scanner as the document handler. + // + if (!fAdvDHCount && !fDocHandler) + fScanner->setDocHandler(0); + + return true; + } + } + + // Never found it + return false; +} + + +// --------------------------------------------------------------------------- +// SAXParser: Getter methods +// --------------------------------------------------------------------------- +const XMLValidator& SAXParser::getValidator() const +{ + return *fScanner->getValidator(); +} + + +bool SAXParser::getDoNamespaces() const +{ + return fScanner->getDoNamespaces(); +} + +bool SAXParser::getGenerateSyntheticAnnotations() const +{ + return fScanner->getGenerateSyntheticAnnotations(); +} + +bool SAXParser::getValidateAnnotations() const +{ + return fScanner->getValidateAnnotations(); +} + +bool SAXParser::getExitOnFirstFatalError() const +{ + return fScanner->getExitOnFirstFatal(); +} + +bool SAXParser::getValidationConstraintFatal() const +{ + return fScanner->getValidationConstraintFatal(); +} + + +SAXParser::ValSchemes SAXParser::getValidationScheme() const +{ + const XMLScanner::ValSchemes scheme = fScanner->getValidationScheme(); + + if (scheme == XMLScanner::Val_Always) + return Val_Always; + else if (scheme == XMLScanner::Val_Never) + return Val_Never; + + return Val_Auto; +} + +bool SAXParser::getDoSchema() const +{ + return fScanner->getDoSchema(); +} + +bool SAXParser::getValidationSchemaFullChecking() const +{ + return fScanner->getValidationSchemaFullChecking(); +} + +bool SAXParser::getIdentityConstraintChecking() const +{ + return fScanner->getIdentityConstraintChecking(); +} + +int SAXParser::getErrorCount() const +{ + return fScanner->getErrorCount(); +} + +XMLCh* SAXParser::getExternalSchemaLocation() const +{ + return fScanner->getExternalSchemaLocation(); +} + +XMLCh* SAXParser::getExternalNoNamespaceSchemaLocation() const +{ + return fScanner->getExternalNoNamespaceSchemaLocation(); +} + +SecurityManager* SAXParser::getSecurityManager() const +{ + return fScanner->getSecurityManager(); +} + +XMLSize_t SAXParser::getLowWaterMark() const +{ + return fScanner->getLowWaterMark(); +} + +bool SAXParser::getLoadExternalDTD() const +{ + return fScanner->getLoadExternalDTD(); +} + +bool SAXParser::getLoadSchema() const +{ + return fScanner->getLoadSchema(); +} + +bool SAXParser::isCachingGrammarFromParse() const +{ + return fScanner->isCachingGrammarFromParse(); +} + +bool SAXParser::isUsingCachedGrammarInParse() const +{ + return fScanner->isUsingCachedGrammarInParse(); +} + +bool SAXParser::getCalculateSrcOfs() const +{ + return fScanner->getCalculateSrcOfs(); +} + +bool SAXParser::getStandardUriConformant() const +{ + return fScanner->getStandardUriConformant(); +} + +Grammar* SAXParser::getGrammar(const XMLCh* const nameSpaceKey) +{ + return fGrammarResolver->getGrammar(nameSpaceKey); +} + +Grammar* SAXParser::getRootGrammar() +{ + return fScanner->getRootGrammar(); +} + +const XMLCh* SAXParser::getURIText(unsigned int uriId) const +{ + return fScanner->getURIText(uriId); +} + +XMLFilePos SAXParser::getSrcOffset() const +{ + return fScanner->getSrcOffset(); +} + +bool SAXParser::getIgnoreCachedDTD() const +{ + return fScanner->getIgnoreCachedDTD(); +} + +bool SAXParser::getIgnoreAnnotations() const +{ + return fScanner->getIgnoreAnnotations(); +} + +bool SAXParser::getDisableDefaultEntityResolution() const +{ + return fScanner->getDisableDefaultEntityResolution(); +} + +bool SAXParser::getSkipDTDValidation() const +{ + return fScanner->getSkipDTDValidation(); +} + +bool SAXParser::getHandleMultipleImports() const +{ + return fScanner->getHandleMultipleImports(); +} + +// --------------------------------------------------------------------------- +// SAXParser: Setter methods +// --------------------------------------------------------------------------- +void SAXParser::setDoNamespaces(const bool newState) +{ + fScanner->setDoNamespaces(newState); +} + +void SAXParser::setGenerateSyntheticAnnotations(const bool newState) +{ + fScanner->setGenerateSyntheticAnnotations(newState); +} + +void SAXParser::setValidateAnnotations(const bool newState) +{ + fScanner->setValidateAnnotations(newState); +} + +void SAXParser::setExitOnFirstFatalError(const bool newState) +{ + fScanner->setExitOnFirstFatal(newState); +} + + +void SAXParser::setValidationConstraintFatal(const bool newState) +{ + fScanner->setValidationConstraintFatal(newState); +} + + +void SAXParser::setValidationScheme(const ValSchemes newScheme) +{ + if (newScheme == Val_Never) + fScanner->setValidationScheme(XMLScanner::Val_Never); + else if (newScheme == Val_Always) + fScanner->setValidationScheme(XMLScanner::Val_Always); + else + fScanner->setValidationScheme(XMLScanner::Val_Auto); +} + +void SAXParser::setDoSchema(const bool newState) +{ + fScanner->setDoSchema(newState); +} + +void SAXParser::setValidationSchemaFullChecking(const bool schemaFullChecking) +{ + fScanner->setValidationSchemaFullChecking(schemaFullChecking); +} + +void SAXParser::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fScanner->setIdentityConstraintChecking(identityConstraintChecking); +} + +void SAXParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) +{ + fScanner->setExternalSchemaLocation(schemaLocation); +} +void SAXParser::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation) +{ + fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); +} + +void SAXParser::setExternalSchemaLocation(const char* const schemaLocation) +{ + fScanner->setExternalSchemaLocation(schemaLocation); +} +void SAXParser::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation) +{ + fScanner->setExternalNoNamespaceSchemaLocation(noNamespaceSchemaLocation); +} + +void SAXParser::setSecurityManager(SecurityManager* const securityManager) +{ + // since this could impact various components, don't permit it to change + // during a parse + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + fScanner->setSecurityManager(securityManager); +} + +void SAXParser::setLowWaterMark(XMLSize_t lwm) +{ + fScanner->setLowWaterMark(lwm); +} + +void SAXParser::setLoadExternalDTD(const bool newState) +{ + fScanner->setLoadExternalDTD(newState); +} + +void SAXParser::setLoadSchema(const bool newState) +{ + fScanner->setLoadSchema(newState); +} + +void SAXParser::cacheGrammarFromParse(const bool newState) +{ + fScanner->cacheGrammarFromParse(newState); + + if (newState) + fScanner->useCachedGrammarInParse(newState); +} + +void SAXParser::useCachedGrammarInParse(const bool newState) +{ + if (newState || !fScanner->isCachingGrammarFromParse()) + fScanner->useCachedGrammarInParse(newState); +} + +void SAXParser::setCalculateSrcOfs(const bool newState) +{ + fScanner->setCalculateSrcOfs(newState); +} + +void SAXParser::setStandardUriConformant(const bool newState) +{ + fScanner->setStandardUriConformant(newState); +} + +void SAXParser::useScanner(const XMLCh* const scannerName) +{ + XMLScanner* tempScanner = XMLScannerResolver::resolveScanner + ( + scannerName + , fValidator + , fGrammarResolver + , fMemoryManager + ); + + if (tempScanner) { + + tempScanner->setParseSettings(fScanner); + tempScanner->setURIStringPool(fURIStringPool); + delete fScanner; + fScanner = tempScanner; + } +} + +void SAXParser::setInputBufferSize(const XMLSize_t bufferSize) +{ + fScanner->setInputBufferSize(bufferSize); +} + +void SAXParser::setIgnoreCachedDTD(const bool newValue) +{ + fScanner->setIgnoredCachedDTD(newValue); +} + +void SAXParser::setIgnoreAnnotations(const bool newValue) +{ + fScanner->setIgnoreAnnotations(newValue); +} + +void SAXParser::setDisableDefaultEntityResolution(const bool newValue) +{ + fScanner->setDisableDefaultEntityResolution(newValue); +} + +void SAXParser::setSkipDTDValidation(const bool newValue) +{ + fScanner->setSkipDTDValidation(newValue); +} + +void SAXParser::setHandleMultipleImports(const bool newValue) +{ + fScanner->setHandleMultipleImports(newValue); +} + +// --------------------------------------------------------------------------- +// SAXParser: Overrides of the SAX Parser interface +// --------------------------------------------------------------------------- +void SAXParser::parse(const InputSource& source) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(source); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void SAXParser::parse(const XMLCh* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void SAXParser::parse(const char* const systemId) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + try + { + fParseInProgress = true; + fScanner->scanDocument(systemId); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } +} + +void SAXParser::setDocumentHandler(DocumentHandler* const handler) +{ + fDocHandler = handler; + if (fDocHandler) + { + // + // Make sure we are set as the document handler with the scanner. + // We may already be (if advanced handlers are installed), but its + // not worthing checking, just do it. + // + fScanner->setDocHandler(this); + } + else + { + // + // If we don't have any advanced handlers either, then deinstall us + // from the scanner because we don't need document events anymore. + // + if (!fAdvDHCount) + fScanner->setDocHandler(0); + } +} + + +void SAXParser::setDTDHandler(DTDHandler* const handler) +{ + fDTDHandler = handler; + if (fDTDHandler) + fScanner->setDocTypeHandler(this); + else + fScanner->setDocTypeHandler(0); +} + + +void SAXParser::setErrorHandler(ErrorHandler* const handler) +{ + // + // Store the handler. Then either install or deinstall us as the + // error reporter on the scanner. + // + fErrorHandler = handler; + if (fErrorHandler) { + fScanner->setErrorReporter(this); + fScanner->setErrorHandler(fErrorHandler); + } + else { + fScanner->setErrorReporter(0); + fScanner->setErrorHandler(0); + } +} + + +void SAXParser::setPSVIHandler(PSVIHandler* const handler) +{ + fPSVIHandler = handler; + if (fPSVIHandler) { + fScanner->setPSVIHandler(fPSVIHandler); + } + else { + fScanner->setPSVIHandler(0); + } +} + +void SAXParser::setEntityResolver(EntityResolver* const resolver) +{ + fEntityResolver = resolver; + if (fEntityResolver) { + fScanner->setEntityHandler(this); + fXMLEntityResolver = 0; + } + else { + fScanner->setEntityHandler(0); + } +} + +void SAXParser::setXMLEntityResolver(XMLEntityResolver* const resolver) +{ + fXMLEntityResolver = resolver; + if (fXMLEntityResolver) { + fScanner->setEntityHandler(this); + fEntityResolver = 0; + } + else { + fScanner->setEntityHandler(0); + } +} + +// --------------------------------------------------------------------------- +// SAXParser: Progressive parse methods +// --------------------------------------------------------------------------- +bool SAXParser::parseFirst( const XMLCh* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool SAXParser::parseFirst( const char* const systemId + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(systemId, toFill); +} + +bool SAXParser::parseFirst( const InputSource& source + , XMLPScanToken& toFill) +{ + // + // Avoid multiple entrance. We cannot enter here while a regular parse + // is in progress. + // + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + return fScanner->scanFirst(source, toFill); +} + +bool SAXParser::parseNext(XMLPScanToken& token) +{ + return fScanner->scanNext(token); +} + +void SAXParser::parseReset(XMLPScanToken& token) +{ + // Reset the scanner + fScanner->scanReset(token); +} + + +// --------------------------------------------------------------------------- +// SAXParser: Overrides of the XMLDocumentHandler interface +// --------------------------------------------------------------------------- +void SAXParser::docCharacters( const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Suppress the chars before the root element. + if (fElemDepth) + { + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->characters(chars, length); + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docCharacters(chars, length, cdataSection); +} + + +void SAXParser::docComment(const XMLCh* const commentText) +{ + // + // SAX has no way to report this. But, if there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docComment(commentText); +} + + +void SAXParser::XMLDecl( const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncodingStr + ) +{ + // + // SAX has no way to report this. But, if there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->XMLDecl( versionStr, + encodingStr, + standaloneStr, + actualEncodingStr ); +} + + +void SAXParser::docPI( const XMLCh* const target + , const XMLCh* const data) +{ + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->processingInstruction(target, data); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->docPI(target, data); +} + + +void SAXParser::endDocument() +{ + if (fDocHandler) + fDocHandler->endDocument(); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endDocument(); +} + + +void SAXParser::endElement( const XMLElementDecl& elemDecl + , const unsigned int uriId + , const bool isRoot + , const XMLCh* const elemPrefix) +{ + // Just map to the SAX document handler + if (fDocHandler) { + if (fScanner->getDoNamespaces()) { + + if (elemPrefix && *elemPrefix) { + + fElemQNameBuf.set(elemPrefix); + fElemQNameBuf.append(chColon); + fElemQNameBuf.append(elemDecl.getBaseName()); + fDocHandler->endElement(fElemQNameBuf.getRawBuffer()); + } + else { + fDocHandler->endElement(elemDecl.getBaseName()); + } + } + else + fDocHandler->endElement(elemDecl.getFullName()); + + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endElement(elemDecl, uriId, isRoot, elemPrefix); + + // + // Dump the element depth down again. Don't let it underflow in case + // of malformed XML. + // + if (fElemDepth) + fElemDepth--; +} + + +void SAXParser::endEntityReference(const XMLEntityDecl& entityDecl) +{ + // + // SAX has no way to report this event. But, if there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->endEntityReference(entityDecl); +} + + +void SAXParser::ignorableWhitespace(const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Do not report the whitespace before the root element. + if (!fElemDepth) + return; + + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->ignorableWhitespace(chars, length); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->ignorableWhitespace(chars, length, cdataSection); +} + + +void SAXParser::resetDocument() +{ + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->resetDocument(); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->resetDocument(); + + // Make sure our element depth flag gets set back to zero + fElemDepth = 0; +} + + +void SAXParser::startDocument() +{ + // Just map to the SAX document handler + if (fDocHandler) + fDocHandler->setDocumentLocator(fScanner->getLocator()); + if(fDocHandler) + fDocHandler->startDocument(); + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->startDocument(); +} + + +void SAXParser:: +startElement( const XMLElementDecl& elemDecl + , const unsigned int elemURLId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot) +{ + // Bump the element depth counter if not empty + if (!isEmpty) + fElemDepth++; + + if (fDocHandler) + { + fAttrList.setVector(&attrList, attrCount); + if (fScanner->getDoNamespaces()) { + + if (elemPrefix && *elemPrefix) { + + fElemQNameBuf.set(elemPrefix); + fElemQNameBuf.append(chColon); + fElemQNameBuf.append(elemDecl.getBaseName()); + fDocHandler->startElement(fElemQNameBuf.getRawBuffer(), fAttrList); + + // If its empty, send the end tag event now + if (isEmpty && fDocHandler) + fDocHandler->endElement(fElemQNameBuf.getRawBuffer()); + } + else { + + fDocHandler->startElement(elemDecl.getBaseName(), fAttrList); + + // If its empty, send the end tag event now + if (isEmpty && fDocHandler) + fDocHandler->endElement(elemDecl.getBaseName()); + } + } + else { + fDocHandler->startElement(elemDecl.getFullName(), fAttrList); + + // If its empty, send the end tag event now + if (isEmpty && fDocHandler) + fDocHandler->endElement(elemDecl.getFullName()); + } + } + + // + // If there are any installed advanced handlers, then lets call them + // with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + { + fAdvDHList[index]->startElement + ( + elemDecl + , elemURLId + , elemPrefix + , attrList + , attrCount + , isEmpty + , isRoot + ); + } +} + + +void SAXParser::startEntityReference(const XMLEntityDecl& entityDecl) +{ + // + // SAX has no way to report this. But, If there are any installed + // advanced handlers, then lets call them with this info. + // + for (XMLSize_t index = 0; index < fAdvDHCount; index++) + fAdvDHList[index]->startEntityReference(entityDecl); +} + + + +// --------------------------------------------------------------------------- +// SAXParser: Overrides of the DocTypeHandler interface +// --------------------------------------------------------------------------- +void SAXParser::attDef( const DTDElementDecl& + , const DTDAttDef& + , const bool) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::doctypeComment(const XMLCh* const) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::doctypeDecl(const DTDElementDecl& + , const XMLCh* const + , const XMLCh* const + , const bool + , const bool) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::doctypePI( const XMLCh* const + , const XMLCh* const) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::doctypeWhitespace( const XMLCh* const + , const XMLSize_t) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::elementDecl(const DTDElementDecl&, const bool) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::endAttList(const DTDElementDecl&) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::endIntSubset() +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::endExtSubset() +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::entityDecl( const DTDEntityDecl& entityDecl + , const bool + , const bool isIgnored) +{ + // + // If we have a DTD handler, and this entity is not ignored, and + // its an unparsed entity, then send this one. + // + if (fDTDHandler && !isIgnored) + { + if (entityDecl.isUnparsed()) + { + fDTDHandler->unparsedEntityDecl + ( + entityDecl.getName() + , entityDecl.getPublicId() + , entityDecl.getSystemId() + , entityDecl.getNotationName() + ); + } + } +} + + +void SAXParser::resetDocType() +{ + // Just map to the DTD handler + if (fDTDHandler) + fDTDHandler->resetDocType(); +} + + +void SAXParser::notationDecl( const XMLNotationDecl& notDecl + , const bool isIgnored) +{ + if (fDTDHandler && !isIgnored) + { + fDTDHandler->notationDecl + ( + notDecl.getName() + , notDecl.getPublicId() + , notDecl.getSystemId() + ); + } +} + + +void SAXParser::startAttList(const DTDElementDecl&) +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::startIntSubset() +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::startExtSubset() +{ + // Unused by SAX DTDHandler interface at this time +} + + +void SAXParser::TextDecl( const XMLCh* const + , const XMLCh* const) +{ + // Unused by SAX DTDHandler interface at this time +} + + +// --------------------------------------------------------------------------- +// SAXParser: Overrides of the XMLErrorReporter interface +// --------------------------------------------------------------------------- +void SAXParser::resetErrors() +{ + if (fErrorHandler) + fErrorHandler->resetErrors(); +} + + +void SAXParser::error( const unsigned int + , const XMLCh* const + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum) +{ + SAXParseException toThrow = SAXParseException + ( + errorText + , publicId + , systemId + , lineNum + , colNum + , fMemoryManager + ); + + if (!fErrorHandler) + { + if (errType == XMLErrorReporter::ErrType_Fatal) + throw toThrow; + else + return; + } + + if (errType == XMLErrorReporter::ErrType_Warning) + fErrorHandler->warning(toThrow); + else if (errType == XMLErrorReporter::ErrType_Fatal) + fErrorHandler->fatalError(toThrow); + else + fErrorHandler->error(toThrow); +} + + + +// --------------------------------------------------------------------------- +// SAXParser: Handlers for the XMLEntityHandler interface +// --------------------------------------------------------------------------- +void SAXParser::endInputSource(const InputSource&) +{ +} + +bool SAXParser::expandSystemId(const XMLCh* const, XMLBuffer&) +{ + return false; +} + + +void SAXParser::resetEntities() +{ + // Nothing to do for this one +} + +InputSource* +SAXParser::resolveEntity( XMLResourceIdentifier* resourceIdentifier ) +{ + // Just map to the SAX entity resolver handler + if (fEntityResolver) + return fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(), + resourceIdentifier->getSystemId()); + if (fXMLEntityResolver) + return fXMLEntityResolver->resolveEntity(resourceIdentifier); + return 0; +} + + +void SAXParser::startInputSource(const InputSource&) +{ + // Nothing to do for this one +} + + +// --------------------------------------------------------------------------- +// SAXParser: Grammar preparsing methods +// --------------------------------------------------------------------------- +Grammar* SAXParser::loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +Grammar* SAXParser::loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +Grammar* SAXParser::loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (fParseInProgress) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetInProgressType resetInProgress(this, &SAXParser::resetInProgress); + + Grammar* grammar = 0; + try + { + fParseInProgress = true; + grammar = fScanner->loadGrammar(source, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetInProgress.release(); + + throw; + } + + return grammar; +} + +void SAXParser::resetInProgress() +{ + fParseInProgress = false; +} + +void SAXParser::resetCachedGrammarPool() +{ + fGrammarResolver->resetCachedGrammar(); + fScanner->resetCachedGrammar(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/SAXParser.hpp b/project/jni/xerces/src/xercesc/parsers/SAXParser.hpp new file mode 100644 index 000000000..683ab6fca --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/SAXParser.hpp @@ -0,0 +1,2204 @@ +/* + * 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: SAXParser.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAXPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_SAXPARSER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + + +class DocumentHandler; +class EntityResolver; +class XMLPScanToken; +class XMLScanner; +class XMLValidator; +class GrammarResolver; +class XMLGrammarPool; +class XMLEntityResolver; +class XMLResourceIdentifier; +class PSVIHandler; + +/** + * This class implements the SAX 'Parser' interface and should be + * used by applications wishing to parse the XML files using SAX. + * It allows the client program to install SAX handlers for event + * callbacks. + * + *

It can be used to instantiate a validating or non-validating + * parser, by setting a member flag.

+ * + * @deprecated This interface has been replaced by the SAX2 + * interface, which includes Namespace support. + * See SAX2XMLReader for more information. + * + * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing. + * + * + */ + +class PARSERS_EXPORT SAXParser : + + public XMemory + , public Parser + , public XMLDocumentHandler + , public XMLErrorReporter + , public XMLEntityHandler + , public DocTypeHandler +{ +public : + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** ValScheme enum used in setValidationScheme + * Val_Never: Do not report validation errors. + * Val_Always: The parser will always report validation errors. + * Val_Auto: The parser will report validation errors only if a grammar is specified. + * + * @see #setValidationScheme + */ + + enum ValSchemes + { + Val_Never + , Val_Always + , Val_Auto + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** Constructor with an instance of validator class to use for + * validation. + * @param valToAdopt Pointer to the validator instance to use. The + * parser is responsible for freeing the memory. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @param gramPool The collection of cached grammars. + */ + SAXParser + ( + XMLValidator* const valToAdopt = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + /** + * Destructor + */ + ~SAXParser(); + //@} + + + // ----------------------------------------------------------------------- + // Getter Methods + // ----------------------------------------------------------------------- + /** @name Getter methods */ + //@{ + /** + * This method returns the installed document handler. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed document handler object. + */ + DocumentHandler* getDocumentHandler(); + + /** + * This method returns the installed document handler. Suitable + * only for 'rvalue' usages. + * + * @return A const pointer to the installed document handler object. + */ + const DocumentHandler* getDocumentHandler() const; + + /** + * This method returns the installed entity resolver. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed entity resolver object. + */ + EntityResolver* getEntityResolver(); + + /** + * This method returns the installed entity resolver. Suitable + * for 'rvalue' usages. + * + * @return A const pointer to the installed entity resolver object. + */ + const EntityResolver* getEntityResolver() const; + + /** + * This method returns the installed entity resolver. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed entity resolver object. + */ + XMLEntityResolver* getXMLEntityResolver(); + + /** + * This method returns the installed entity resolver. Suitable + * for 'rvalue' usages. + * + * @return A const pointer to the installed entity resolver object. + */ + const XMLEntityResolver* getXMLEntityResolver() const; + + /** + * This method returns the installed error handler. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed error handler object. + */ + ErrorHandler* getErrorHandler(); + + /** + * This method returns the installed error handler. Suitable + * for 'rvalue' usages. + * + * @return A const pointer to the installed error handler object. + */ + const ErrorHandler* getErrorHandler() const; + + /** + * This method returns the installed PSVI handler. Suitable + * for 'lvalue' usages. + * + * @return The pointer to the installed PSVI handler object. + */ + PSVIHandler* getPSVIHandler(); + + /** + * This method returns the installed PSVI handler. Suitable + * for 'rvalue' usages. + * + * @return A const pointer to the installed PSVI handler object. + */ + const PSVIHandler* getPSVIHandler() const; + + /** + * This method returns a reference to the parser's installed + * validator. + * + * @return A const reference to the installed validator object. + */ + const XMLValidator& getValidator() const; + + /** + * This method returns an enumerated value that indicates the current + * validation scheme set on this parser. + * + * @return The ValSchemes value current set on this parser. + * @see #setValidationScheme + */ + ValSchemes getValidationScheme() const; + + /** Get the 'do schema' flag + * + * This method returns the state of the parser's schema processing + * flag. + * + * @return true, if the parser is currently configured to + * understand schema, false otherwise. + * + * @see #setDoSchema + */ + bool getDoSchema() const; + + /** Get the 'full schema constraint checking' flag + * + * This method returns the state of the parser's full schema constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have full schema constraint checking, false otherwise. + * + * @see #setValidationSchemaFullChecking + */ + bool getValidationSchemaFullChecking() const; + + /** Get the 'identity constraint checking' flag + * + * This method returns the state of the parser's identity constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have identity constraint checking, false otherwise. + * + * @see #setIdentityConstraintChecking + */ + bool getIdentityConstraintChecking() const; + + /** Get error count from the last parse operation. + * + * This method returns the error count from the last parse + * operation. Note that this count is actually stored in the + * scanner, so this method simply returns what the + * scanner reports. + * + * @return number of errors encountered during the latest + * parse operation. + */ + int getErrorCount() const; + + /** + * This method returns the state of the parser's namespace + * handling capability. + * + * @return true, if the parser is currently configured to + * understand namespaces, false otherwise. + * + * @see #setDoNamespaces + */ + bool getDoNamespaces() const; + + /** + * This method returns the state of the parser's + * exit-on-First-Fatal-Error flag. + * + * @return true, if the parser is currently configured to + * exit on the first fatal error, false otherwise. + * + * @see #setExitOnFirstFatalError + */ + bool getExitOnFirstFatalError() const; + + /** + * This method returns the state of the parser's + * validation-constraint-fatal flag. + * + * @return true, if the parser is currently configured to + * set validation constraint errors as fatal, false + * otherwise. + * + * @see #setValidationConstraintFatal + */ + bool getValidationConstraintFatal() const; + + /** Get the set of Namespace/SchemaLocation that is specified externally. + * + * This method returns the list of Namespace/SchemaLocation that was + * specified using setExternalSchemaLocation. + * + * The parser owns the returned string, and the memory allocated for + * the returned string will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else. + * + * @return a pointer to the list of Namespace/SchemaLocation that was + * specified externally. The pointer spans the same life-time as + * the parser. A null pointer is returned if nothing + * was specified externally. + * + * @see #setExternalSchemaLocation(const XMLCh* const) + */ + XMLCh* getExternalSchemaLocation() const; + + /** Get the noNamespace SchemaLocation that is specified externally. + * + * This method returns the no target namespace XML Schema Location + * that was specified using setExternalNoNamespaceSchemaLocation. + * + * The parser owns the returned string, and the memory allocated for + * the returned string will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else. + * + * @return a pointer to the no target namespace Schema Location that was + * specified externally. The pointer spans the same life-time as + * the parser. A null pointer is returned if nothing + * was specified externally. + * + * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) + */ + XMLCh* getExternalNoNamespaceSchemaLocation() const; + + /** Get the SecurityManager instance attached to this parser. + * + * This method returns the security manager + * that was specified using setSecurityManager. + * + * The SecurityManager instance must have been specified by the application; + * this should not be deleted until after the parser has been deleted (or + * a new SecurityManager instance has been supplied to the parser). + * + * @return a pointer to the SecurityManager instance + * specified externally. A null pointer is returned if nothing + * was specified externally. + * + * @see #setSecurityManager(SecurityManager* const) + */ + SecurityManager* getSecurityManager() const; + + /** Get the raw buffer low water mark for this parser. + * + * If the number of available bytes in the raw buffer is less than + * the low water mark the parser will attempt to read more data before + * continuing parsing. By default the value for this parameter is 100 + * bytes. You may want to set this parameter to 0 if you would like + * the parser to parse the available data immediately without + * potentially blocking while waiting for more date. + * + * @return current low water mark + * + * @see #setSecurityManager + */ + XMLSize_t getLowWaterMark() const; + + /** Get the 'Loading External DTD' flag + * + * This method returns the state of the parser's loading external DTD + * flag. + * + * @return false, if the parser is currently configured to + * ignore external DTD completely, true otherwise. + * + * @see #setLoadExternalDTD + * @see #getValidationScheme + */ + bool getLoadExternalDTD() const; + + /** Get the 'Loading Schema' flag + * + * This method returns the state of the parser's loading schema + * flag. + * + * @return true, if the parser is currently configured to + * automatically load schemas that are not in the + * grammar pool, false otherwise. + * + * @see #setLoadSchema + */ + bool getLoadSchema() const; + + /** Get the 'Grammar caching' flag + * + * This method returns the state of the parser's grammar caching when + * parsing an XML document. + * + * @return true, if the parser is currently configured to + * cache grammars, false otherwise. + * + * @see #cacheGrammarFromParse + */ + bool isCachingGrammarFromParse() const; + + /** Get the 'Use cached grammar' flag + * + * This method returns the state of the parser's use of cached grammar + * when parsing an XML document. + * + * @return true, if the parser is currently configured to + * use cached grammars, false otherwise. + * + * @see #useCachedGrammarInParse + */ + bool isUsingCachedGrammarInParse() const; + + /** + * Get the 'calculate src offset flag' + * + * This method returns the state of the parser's src offset calculation + * when parsing an XML document. + * + * @return true, if the parser is currently configured to + * calculate src offsets, false otherwise. + * + * @see #setCalculateSrcOfs + */ + bool getCalculateSrcOfs() const; + + /** + * Get the 'force standard uri flag' + * + * This method returns the state if the parser forces standard uri + * + * @return true, if the parser is currently configured to + * force standard uri, i.e. malformed uri will be rejected. + * + * @see #setStandardUriConformant + */ + bool getStandardUriConformant() const; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + Grammar* getGrammar(const XMLCh* const nameSpaceKey); + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + Grammar* getRootGrammar(); + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + const XMLCh* getURIText(unsigned int uriId) const; + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + XMLFilePos getSrcOffset() const; + + /** Get the 'generate synthetic annotations' flag + * + * @return true, if the parser is currently configured to + * generate synthetic annotations, false otherwise. + * A synthetic XSAnnotation is created when a schema + * component has non-schema attributes but has no + * child annotations so that the non-schema attributes + * can be recovered under PSVI. + * + * @see #setGenerateSyntheticAnnotations + */ + bool getGenerateSyntheticAnnotations() const; + + /** Get the 'validate annotations' flag + * + * @return true, if the parser is currently configured to + * validate annotations, false otherwise. + * + * @see #setValidateAnnotations + */ + bool getValidateAnnotations() const; + + /** Get the 'ignore cached DTD grammar' flag + * + * @return true, if the parser is currently configured to + * ignore cached DTD, false otherwise. + * + * @see #setIgnoreCachedDTD + */ + bool getIgnoreCachedDTD() const; + + /** Get the 'ignore annotations' flag + * + * @return true, if the parser is currently configured to + * ignore annotations, false otherwise. + * + * @see #setIgnoreAnnotations + */ + bool getIgnoreAnnotations() const; + + /** Get the 'disable default entity resolution' flag + * + * @return true, if the parser is currently configured to + * not perform default entity resolution, false otherwise. + * + * @see #setDisableDefaultEntityResolution + */ + bool getDisableDefaultEntityResolution() const; + + /** Get the 'skip DTD validation' flag + * + * @return true, if the parser is currently configured to + * skip DTD validation, false otherwise. + * + * @see #setSkipDTDValidation + */ + bool getSkipDTDValidation() const; + + /** Get the 'handle multiple schema imports' flag + * + * @return true, if the parser is currently configured to + * import multiple schemas with the same namespace, false otherwise. + * + * @see #setHandleMultipleImports + */ + bool getHandleMultipleImports() const; + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + /** set the 'generate synthetic annotations' flag + * + * @param newValue The value for specifying whether Synthetic Annotations + * should be generated or not. + * A synthetic XSAnnotation is created when a schema + * component has non-schema attributes but has no + * child annotations. + * + * @see #getGenerateSyntheticAnnotations + */ + void setGenerateSyntheticAnnotations(const bool newValue); + + /** set the 'validate annotations' flag + * + * @param newValue The value for specifying whether annotations + * should be validate or not. + * + * @see #getValidateAnnotations + */ + void setValidateAnnotations(const bool newValue); + + /** + * This method allows users to enable or disable the parser's + * namespace processing. When set to true, parser starts enforcing + * all the constraints / rules specified by the NameSpace + * specification. + * + *

The parser's default state is: false.

+ * + * @param newState The value specifying whether NameSpace rules should + * be enforced or not. + * + * @see #getDoNamespaces + */ + void setDoNamespaces(const bool newState); + + /** + * This method allows users to set the validation scheme to be used + * by this parser. The value is one of the ValSchemes enumerated values + * defined by this class: + * + *
Val_Never - turn off validation + *
Val_Always - turn on validation + *
Val_Auto - turn on validation if any internal/external + * DTD subset have been seen + * + *

The parser's default state is: Val_Never.

+ * + * @param newScheme The new validation scheme to use. + * + * @see #getValidationScheme + */ + void setValidationScheme(const ValSchemes newScheme); + + /** Set the 'schema support' flag + * + * This method allows users to enable or disable the parser's + * schema processing. When set to false, parser will not process + * any schema found. + * + * The parser's default state is: false. + * + * Note: If set to true, namespace processing must also be turned on. + * + * @param newState The value specifying whether schema support should + * be enforced or not. + * + * @see #getDoSchema + */ + void setDoSchema(const bool newState); + + /** + * This method allows the user to turn full Schema constraint checking on/off. + * Only takes effect if Schema validation is enabled. + * If turned off, partial constraint checking is done. + * + * Full schema constraint checking includes those checking that may + * be time-consuming or memory intensive. Currently, particle unique + * attribution constraint checking and particle derivation restriction checking + * are controlled by this option. + * + * The parser's default state is: false. + * + * @param schemaFullChecking True to turn on full schema constraint checking. + * + * @see #getValidationSchemaFullChecking + */ + void setValidationSchemaFullChecking(const bool schemaFullChecking); + + /** + * This method allows the user to turn identity constraint checking on/off. + * Only takes effect if Schema validation is enabled. + * If turned off, identity constraint checking is not done. + * + * The parser's default state is: true. + * + * @param identityConstraintChecking True to turn on identity constraint checking. + * + * @see #getIdentityConstraintChecking + */ + void setIdentityConstraintChecking(const bool identityConstraintChecking); + + /** + * This method allows users to set the parser's behaviour when it + * encounters the first fatal error. If set to true, the parser + * will exit at the first fatal error. If false, then it will + * report the error and continue processing. + * + *

The default value is 'true' and the parser exits on the + * first fatal error.

+ * + * @param newState The value specifying whether the parser should + * continue or exit when it encounters the first + * fatal error. + * + * @see #getExitOnFirstFatalError + */ + void setExitOnFirstFatalError(const bool newState); + + /** + * This method allows users to set the parser's behaviour when it + * encounters a validation constraint error. If set to true, and the + * the parser will treat validation error as fatal and will exit depends on the + * state of "getExitOnFirstFatalError". If false, then it will + * report the error and continue processing. + * + * Note: setting this true does not mean the validation error will be printed with + * the word "Fatal Error". It is still printed as "Error", but the parser + * will exit if "setExitOnFirstFatalError" is set to true. + * + *

The default value is 'false'.

+ * + * @param newState If true, the parser will exit if "setExitOnFirstFatalError" + * is set to true. + * + * @see #getValidationConstraintFatal + * @see #setExitOnFirstFatalError + */ + void setValidationConstraintFatal(const bool newState); + + /** + * This method allows the user to specify a list of schemas to use. + * If the targetNamespace of a schema specified using this method matches + * the targetNamespace of a schema occurring in the instance document in + * the schemaLocation attribute, or if the targetNamespace matches the + * namespace attribute of the "import" element, the schema specified by the + * user using this method will be used (i.e., the schemaLocation attribute + * in the instance document or on the "import" element will be effectively ignored). + * + * If this method is called more than once, only the last one takes effect. + * + * The syntax is the same as for schemaLocation attributes in instance + * documents: e.g, "http://www.example.com file_name.xsd". The user can + * specify more than one XML Schema in the list. + * + * @param schemaLocation the list of schemas to use + * + * @see #getExternalSchemaLocation + */ + + void setExternalSchemaLocation(const XMLCh* const schemaLocation); + + /** + * This method is same as setExternalSchemaLocation(const XMLCh* const). + * It takes native char string as parameter + * + * @param schemaLocation the list of schemas to use + * + * @see #setExternalSchemaLocation(const XMLCh* const) + */ + void setExternalSchemaLocation(const char* const schemaLocation); + + /** + * This method allows the user to specify the no target namespace XML + * Schema Location externally. If specified, the instance document's + * noNamespaceSchemaLocation attribute will be effectively ignored. + * + * If this method is called more than once, only the last one takes effect. + * + * The syntax is the same as for the noNamespaceSchemaLocation attribute + * that may occur in an instance document: e.g."file_name.xsd". + * + * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace + * + * @see #getExternalNoNamespaceSchemaLocation + */ + void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation); + + /** + * This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const). + * It takes native char string as parameter + * + * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace + * + * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) + */ + void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation); + + /** + * This allows an application to set a SecurityManager on + * the parser; this object stores information that various + * components use to limit their consumption of system + * resources while processing documents. + * + * If this method is called more than once, only the last one takes effect. + * It may not be reset during a parse. + * + * + * @param securityManager the SecurityManager instance to + * be used by this parser + * + * @see #getSecurityManager + */ + void setSecurityManager(SecurityManager* const securityManager); + + /** Set the raw buffer low water mark for this parser. + * + * If the number of available bytes in the raw buffer is less than + * the low water mark the parser will attempt to read more data before + * continuing parsing. By default the value for this parameter is 100 + * bytes. You may want to set this parameter to 0 if you would like + * the parser to parse the available data immediately without + * potentially blocking while waiting for more date. + * + * @param lwm new low water mark + * + * @see #getSecurityManager + */ + void setLowWaterMark(XMLSize_t lwm); + + /** Set the 'Loading External DTD' flag + * + * This method allows users to enable or disable the loading of external DTD. + * When set to false, the parser will ignore any external DTD completely + * if the validationScheme is set to Val_Never. + * + * The parser's default state is: true. + * + * This flag is ignored if the validationScheme is set to Val_Always or Val_Auto. + * + * @param newState The value specifying whether external DTD should + * be loaded or not. + * + * @see #getLoadExternalDTD + * @see #setValidationScheme + */ + void setLoadExternalDTD(const bool newState); + + /** Set the 'Loading Schema' flag + * + * This method allows users to enable or disable the loading of schemas. + * When set to false, the parser not attempt to load schemas beyond + * querying the grammar pool for them. + * + * The parser's default state is: true. + * + * @param newState The value specifying whether schemas should + * be loaded if they're not found in the grammar + * pool. + * + * @see #getLoadSchema + * @see #setDoSchema + */ + void setLoadSchema(const bool newState); + + /** Set the 'Grammar caching' flag + * + * This method allows users to enable or disable caching of grammar when + * parsing XML documents. When set to true, the parser will cache the + * resulting grammar for use in subsequent parses. + * + * If the flag is set to true, the 'Use cached grammar' flag will also be + * set to true. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should cache grammars + * or not. + * + * @see #isCachingGrammarFromParse + * @see #useCachedGrammarInParse + */ + void cacheGrammarFromParse(const bool newState); + + /** Set the 'Use cached grammar' flag + * + * This method allows users to enable or disable the use of cached + * grammars. When set to true, the parser will use the cached grammar, + * instead of building the grammar from scratch, to validate XML + * documents. + * + * If the 'Grammar caching' flag is set to true, this method ignores the + * value passed in. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should use the cached + * grammar or not. + * + * @see #isUsingCachedGrammarInParse + * @see #cacheGrammarFromParse + */ + void useCachedGrammarInParse(const bool newState); + + /** Enable/disable src offset calculation + * + * This method allows users to enable/disable src offset calculation. + * Disabling the calculation will improve performance. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should enable or + * disable src offset calculation + * + * @see #getCalculateSrcOfs + */ + void setCalculateSrcOfs(const bool newState); + + /** Force standard uri + * + * This method allows users to tell the parser to force standard uri conformance. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether the parser should reject malformed URI. + * + * @see #getStandardUriConformant + */ + void setStandardUriConformant(const bool newState); + + /** Set the scanner to use when scanning the XML document + * + * This method allows users to set the scanner to use + * when scanning a given XML document. + * + * @param scannerName The name of the desired scanner + */ + void useScanner(const XMLCh* const scannerName); + + /** Set maximum input buffer size + * + * This method allows users to limit the size of buffers used in parsing + * XML character data. The effect of setting this size is to limit the + * size of a ContentHandler::characters() call. + * + * The parser's default input buffer size is 1 megabyte. + * + * @param bufferSize The maximum input buffer size + */ + void setInputBufferSize(const XMLSize_t bufferSize); + + /** Set the 'ignore cached DTD grammar' flag + * + * This method gives users the option to ignore a cached DTD grammar, when + * an XML document contains both an internal and external DTD, and the use + * cached grammar from parse option is enabled. Currently, we do not allow + * using cached DTD grammar when an internal subset is present in the + * document. This option will only affect the behavior of the parser when + * an internal and external DTD both exist in a document (i.e. no effect + * if document has no internal subset). + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreCachedDTD(const bool newValue); + + /** Set the 'ignore annotation' flag + * + * This method gives users the option to not generate XSAnnotations + * when "traversing" a schema. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreAnnotations(const bool newValue); + + /** Set the 'disable default entity resolution' flag + * + * This method gives users the option to not perform default entity + * resolution. If the user's resolveEntity method returns NULL the + * parser will try to resolve the entity on its own. When this option + * is set to true, the parser will not attempt to resolve the entity + * when the resolveEntity method returns NULL. + * + * The parser's default state is false + * + * @param newValue The state to set + * + * @see #EntityResolver + */ + void setDisableDefaultEntityResolution(const bool newValue); + + /** Set the 'skip DTD validation' flag + * + * This method gives users the option to skip DTD validation only when + * schema validation is on (i.e. when performing validation, we will + * ignore the DTD, except for entities, when schema validation is enabled). + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setSkipDTDValidation(const bool newValue); + + /** Set the 'handle multiple schema imports' flag + * + * This method gives users the ability to import multiple schemas that + * have the same namespace. + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setHandleMultipleImports(const bool newValue); + //@} + + + // ----------------------------------------------------------------------- + // Advanced document handler list maintenance methods + // ----------------------------------------------------------------------- + + /** @name Advanced document handler list maintenance methods */ + //@{ + /** + * This method installs the specified 'advanced' document callback + * handler, thereby allowing the user to customize the processing, + * if they choose to do so. Any number of advanced callback handlers + * maybe installed. + * + *

The methods in the advanced callback interface represent + * Xerces-C extensions. There is no specification for this interface.

+ * + * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing. + * + * @param toInstall A pointer to the users advanced callback handler. + * + * @see #removeAdvDocHandler + */ + void installAdvDocHandler(XMLDocumentHandler* const toInstall); + + /** + * This method removes the 'advanced' document handler callback from + * the underlying parser scanner. If no handler is installed, advanced + * callbacks are not invoked by the scanner. + * @param toRemove A pointer to the advanced callback handler which + * should be removed. + * + * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing. + * + * @see #installAdvDocHandler + */ + bool removeAdvDocHandler(XMLDocumentHandler* const toRemove); + //@} + + + // ----------------------------------------------------------------------- + // Progressive scan methods + // ----------------------------------------------------------------------- + + /** @name Progressive scan methods */ + //@{ + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a Unicode string representing the path + * to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could parse the + * prolog (which means the token will not be valid.) + * + * @see #parseNext + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ); + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a regular native string representing + * the path to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ); + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + */ + bool parseFirst + ( + const InputSource& source + , XMLPScanToken& toFill + ); + + /** Continue a progressive parse operation + * + * This method is used to continue with progressive parsing of + * XML files started by a call to 'parseFirst' method. + * + * It parses the XML file and stops as soon as it comes across + * a XML token (as defined in the XML specification). Relevant + * callback handlers are invoked as required by the SAX + * specification. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the next XML token. + * It indicates the user can go ahead with parsing the rest + * of the file. It returns 'false' to indicate that the parser + * could not find next token as per the XML specification + * production rule. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + bool parseNext(XMLPScanToken& token); + + /** Reset the parser after a progressive parse + * + * If a progressive parse loop exits before the end of the document + * is reached, the parser has no way of knowing this. So it will leave + * open any files or sockets or memory buffers that were in use at + * the time that the parse loop exited. + * + * The next parse operation will cause these open files and such to + * be closed, but the next parse operation might occur at some unknown + * future point. To avoid this problem, you should reset the parser if + * you exit the loop early. + * + * If you exited because of an error, then this cleanup will be done + * for you. Its only when you exit the file prematurely of your own + * accord, because you've found what you wanted in the file most + * likely. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + */ + void parseReset(XMLPScanToken& token); + + //@} + + // ----------------------------------------------------------------------- + // Grammar preparsing interface + // ----------------------------------------------------------------------- + + /** @name Implementation of Grammar preparsing interface's. */ + //@{ + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the SAX InputSource parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param source A const reference to the SAX InputSource object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see InputSource#InputSource + */ + Grammar* loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * This method allows the user to reset the pool of cached grammars. + */ + void resetCachedGrammarPool(); + + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the SAX Parser interface + // ----------------------------------------------------------------------- + + /** @name Implementation of SAX 1.0 Parser interface's. */ + //@{ + /** + * This method invokes the parsing process on the XML file specified + * by the InputSource parameter. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * + * @see Parser#parse(InputSource) + */ + virtual void parse(const InputSource& source); + + /** + * This method invokes the parsing process on the XML file specified by + * the Unicode string parameter 'systemId'. + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML file to be parsed. + * + * @see Parser#parse(XMLCh*) + */ + virtual void parse(const XMLCh* const systemId); + + /** + * This method invokes the parsing process on the XML file specified by + * the native char* string parameter 'systemId'. + * + * @param systemId A const char pointer to a native string which + * contains the path to the XML file to be parsed. + */ + virtual void parse(const char* const systemId); + + /** + * This method installs the user specified SAX Document Handler + * callback function on parser. + * + * @param handler A pointer to the document handler to be called + * when the parser comes across 'document' events + * as per the SAX specification. + * + * @see Parser#parse(char*) + */ + virtual void setDocumentHandler(DocumentHandler* const handler); + + /** + * This method installs the user specified DTD handler on the parser. + * + * @param handler A pointer to the DTD handler to be called + * when the parser comes across 'DTD' events + * as per the SAX specification. + * + * @see Parser#setDTDHandler + */ + virtual void setDTDHandler(DTDHandler* const handler); + + /** + * This method installs the user specified error handler on + * the parser. + * + * @param handler A pointer to the error handler to be called + * when the parser comes across 'error' events + * as per the SAX specification. + * + * @see Parser#setErrorHandler + */ + virtual void setErrorHandler(ErrorHandler* const handler); + + /** + * This method installs the user specified PSVI handler on + * the parser. + * + * @param handler A pointer to the PSVI handler to be called + * when the parser comes across 'PSVI' events + * as per the schema specification. + * + * @see Parser#setPSVIHandler + */ + virtual void setPSVIHandler(PSVIHandler* const handler); + + /** + * This method installs the user specified entity resolver on the + * parser. It allows applications to trap and redirect calls to + * external entities. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one is used. + * + * @param resolver A pointer to the entity resolver to be called + * when the parser comes across references to + * entities in the XML file. + * + * @see Parser#setEntityResolver + */ + virtual void setEntityResolver(EntityResolver* const resolver); + + /** + * This method installs the user specified entity resolver on the + * parser. It allows applications to trap and redirect calls to + * external entities. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one is used. + * + * @param resolver A pointer to the entity resolver to be called + * when the parser comes across references to + * entities in the XML file. + * + * @see Parser#setXMLEntityResolver + */ + virtual void setXMLEntityResolver(XMLEntityResolver* const resolver); + + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLDocumentHandler interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLDocumentHandler Interface. */ + //@{ + /** + * This method is used to report all the characters scanned + * by the parser. The driver will invoke the 'characters' + * method of the user installed SAX Document Handler. + * + *

If any advanced callback handlers are installed, the + * corresponding 'docCharacters' method will also be invoked.

+ * + * @param chars A const pointer to a Unicode string representing the + * character data. + * @param length The length of the Unicode string returned in 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + * @see DocumentHandler#characters + */ + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** + * This method is used to report any comments scanned by the parser. + * This method is a no-op unless, unless an advanced callback handler + * is installed, in which case the corresponding 'docComment' method + * is invoked. + * + * @param comment A const pointer to a null terminated Unicode + * string representing the comment text. + */ + virtual void docComment + ( + const XMLCh* const comment + ); + + /** + * This method is used to report any PI scanned by the parser. + * + *

Any PI's occurring before any 'content' are not reported + * to any SAX handler as per the specification. However, all + * PI's within content are reported via the SAX Document Handler's + * 'processingInstruction' method. + * + *

If any advanced callback handlers are installed, the + * corresponding 'docPI' method will be invoked.

+ * + * @param target A const pointer to a Unicode string representing the + * target of the PI declaration. + * @param data A const pointer to a Unicode string representing the + * data of the PI declaration. See the PI production rule + * in the XML specification for details. + * + * @see DocumentHandler#processingInstruction + */ + virtual void docPI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * This method is used to indicate the end of root element + * was just scanned by the parser. Corresponding 'endDocument' + * method of the user installed SAX Document Handler will also + * be invoked. + * + *

In addition, if any advanced callback handlers are installed, + * the corresponding 'endDocument' method is invoked.

+ * + * @see DocumentHandler#endDocument + */ + virtual void endDocument(); + + /** + * This method is used to indicate the end tag of an element. + * The driver will invoke the corresponding 'endElement' method of + * the SAX Document Handler interface. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endElement' method is also invoked.

+ * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param isRoot A flag indicating whether this element was the + * root element. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @see DocumentHandler#endElement + */ + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix + ); + + /** + * This method is used to indicate that an end of an entity reference + * was just scanned. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endEntityReference' method is invoked.

+ * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void endEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** + * This method is used to report all the whitespace characters, + * which are determined to be 'ignorable'. This distinction + * between characters is only made, if validation is enabled. + * Corresponding 'ignorableWhitespace' method of the user installed + * SAX Document Handler interface is called. + * + *

Any whitespace before content is not reported to the SAX + * Document Handler method, as per the SAX specification. + * However, if any advanced callback handlers are installed, the + * corresponding 'ignorableWhitespace' method is invoked.

+ * + * @param chars A const pointer to a Unicode string representing the + * ignorable whitespace character data. + * @param length The length of the Unicode string 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + * @see DocumentHandler#ignorableWhitespace + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** + * This method allows the user installed Document Handler and + * any advanced callback handlers to 'reset' themselves. + */ + virtual void resetDocument(); + + /** + * This method is used to report the start of the parsing process. + * The corresponding user installed SAX Document Handler's method + * 'startDocument' is invoked. + * + *

If any advanced callback handlers are installed, then the + * corresponding 'startDocument' method is also called.

+ * + * @see DocumentHandler#startDocument + */ + virtual void startDocument(); + + /** + * This method is used to report the start of an element. It is + * called at the end of the element, by which time all attributes + * specified are also parsed. The corresponding user installed + * SAX Document Handler's method 'startElement' is invoked. + * + *

If any advanced callback handlers are installed, then the + * corresponding 'startElement' method is also called.

+ * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @param attrList A const reference to the object containing the + * list of attributes just scanned for this element. + * @param attrCount A count of number of attributes in the list + * specified by the parameter 'attrList'. + * @param isEmpty A flag indicating whether this is an empty element + * or not. + * @param isRoot A flag indicating whether this element was the + * root element. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ); + + /** + * This method is used to indicate the start of an entity reference. + * + *

If any advanced callback handlers are installed, the + * corresponding 'endEntityReference' method is invoked.

+ * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void startEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** + * This method is used to report the XML decl scanned by the parser. + * Refer to the XML specification to see the meaning of parameters. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param versionStr A const pointer to a Unicode string representing + * version string value. + * @param encodingStr A const pointer to a Unicode string representing + * the encoding string value. + * @param standaloneStr A const pointer to a Unicode string + * representing the standalone string value. + * @param actualEncodingStr A const pointer to a Unicode string + * representing the actual encoding string + * value. + */ + virtual void XMLDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + , const XMLCh* const standaloneStr + , const XMLCh* const actualEncodingStr + ); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLErrorReporter interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLErrorReporter Interface. */ + //@{ + /** + * This method is used to report back errors found while parsing the + * XML file. The driver will call the corresponding user installed + * SAX Error Handler methods: 'fatal', 'error', 'warning' depending + * on the severity of the error. This classification is defined by + * the XML specification. + * + * @param errCode An integer code for the error. + * @param msgDomain A const pointer to an Unicode string representing + * the message domain to use. + * @param errType An enumeration classifying the severity of the error. + * @param errorText A const pointer to an Unicode string representing + * the text of the error message. + * @param systemId A const pointer to an Unicode string representing + * the system id of the XML file where this error + * was discovered. + * @param publicId A const pointer to an Unicode string representing + * the public id of the XML file where this error + * was discovered. + * @param lineNum The line number where the error occurred. + * @param colNum The column number where the error occurred. + * @see ErrorHandler + */ + virtual void error + ( + const unsigned int errCode + , const XMLCh* const msgDomain + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ); + + /** + * This method allows the user installed Error Handler + * callback to 'reset' itself. + * + * This method is a no-op for this SAX driver + * implementation. + * + */ + virtual void resetErrors(); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLEntityHandler interface + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLEntityHandler Interface. */ + //@{ + /** + * This method is used to indicate the end of parsing of an external + * entity file. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the XML file being parsed. + * @see InputSource + */ + virtual void endInputSource(const InputSource& inputSource); + + /** + * This method allows an installed XMLEntityHandler to further + * process any system id's of external entities encountered in + * the XML file being parsed, such as redirection etc. + * + * This method always returns 'false' + * for this SAX driver implementation. + * + * @param systemId A const pointer to an Unicode string representing + * the system id scanned by the parser. + * @param toFill A pointer to a buffer in which the application + * processed system id is stored. + * @return 'true', if any processing is done, 'false' otherwise. + */ + virtual bool expandSystemId + ( + const XMLCh* const systemId + , XMLBuffer& toFill + ); + + /** + * This method allows the installed XMLEntityHandler to reset + * itself. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void resetEntities(); + + /** Resolve a public/system id + * + * This method allows a user installed entity handler to further + * process any pointers to external entities. The applications can + * implement 'redirection' via this callback. + * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return The value returned by the user installed resolveEntity + * method or NULL otherwise to indicate no processing was done. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @see XMLEntityHandler + * @see XMLEntityResolver + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ); + + /** + * This method is used to indicate the start of parsing an + * external entity file. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the external entity + * being parsed. + */ + virtual void startInputSource(const InputSource& inputSource); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the Deprecated DocTypeHandler Interface + // ----------------------------------------------------------------------- + /** @name Implementation of the deprecated DocTypeHandler Interface */ + //@{ + /** + * This method is used to report an attribute definition. + * + * This method is a no-op for this SAX + * driver implementation. + * + * @param elemDecl A const reference to the object containing information + * about the element whose attribute definition was just + * parsed. + * @param attDef A const reference to the object containing information + * attribute definition. + * @param ignore The flag indicating whether this attribute definition + * was ignored by the parser or not. + */ + virtual void attDef + ( + const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool ignore + ); + + /** + * This method is used to report a comment occurring within the DTD. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param comment A const pointer to a Unicode string representing the + * text of the comment just parsed. + */ + virtual void doctypeComment + ( + const XMLCh* const comment + ); + + /** + * This method is used to report the DOCTYPE declaration. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing information + * about the root element definition declaration of the + * XML document being parsed. + * @param publicId A const pointer to a Unicode string representing the + * public id of the DTD file. + * @param systemId A const pointer to a Unicode string representing the + * system id of the DTD file. + * @param hasIntSubset A flag indicating if this XML file contains any + * internal subset. + * @param hasExtSubset A flag indicating if this XML file contains any + * external subset. Default is false. + */ + virtual void doctypeDecl + ( + const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool hasIntSubset + , const bool hasExtSubset = false + ); + + /** + * This method is used to report any PI declarations + * occurring inside the DTD definition block. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param target A const pointer to a Unicode string representing the + * target of the PI declaration. + * @param data A const pointer to a Unicode string representing the + * data of the PI declaration. See the PI production rule + * in the XML specification for details. + */ + virtual void doctypePI + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * This method is used to report any whitespaces + * occurring inside the DTD definition block. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param chars A const pointer to a Unicode string representing the + * whitespace characters. + * @param length The length of the whitespace Unicode string. + */ + virtual void doctypeWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * This method is used to report an element declarations + * successfully scanned by the parser. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param decl A const reference to the object containing element + * declaration information. + * @param isIgnored The flag indicating whether this definition was + * ignored by the parser or not. + */ + virtual void elementDecl + ( + const DTDElementDecl& decl + , const bool isIgnored + ); + + /** + * This method is used to report the end of an attribute + * list declaration for an element. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + */ + virtual void endAttList + ( + const DTDElementDecl& elemDecl + ); + + /** + * This method is used to report the end of the internal subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void endIntSubset(); + + /** + * This method is used to report the end of the external subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void endExtSubset(); + + /** + * This method is used to report any entity declarations. + * For unparsed entities, this driver will invoke the + * SAX DTDHandler::unparsedEntityDecl callback. + * + * @param entityDecl A const reference to the object containing + * the entity declaration information. + * @param isPEDecl The flag indicating whether this was a + * parameter entity declaration or not. + * @param isIgnored The flag indicating whether this definition + * was ignored by the parser or not. + * + * @see DTDHandler#unparsedEntityDecl + */ + virtual void entityDecl + ( + const DTDEntityDecl& entityDecl + , const bool isPEDecl + , const bool isIgnored + ); + + /** + * This method allows the user installed DTD handler to + * reset itself. + */ + virtual void resetDocType(); + + /** + * This method is used to report any notation declarations. + * If there is a user installed DTDHandler, then the driver will + * invoke the SAX DTDHandler::notationDecl callback. + * + * @param notDecl A const reference to the object containing the notation + * declaration information. + * @param isIgnored The flag indicating whether this definition was ignored + * by the parser or not. + * + * @see DTDHandler#notationDecl + */ + virtual void notationDecl + ( + const XMLNotationDecl& notDecl + , const bool isIgnored + ); + + /** + * This method is used to indicate the start of an element's attribute + * list declaration. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + */ + virtual void startAttList + ( + const DTDElementDecl& elemDecl + ); + + /** + * This method is used indicate the start of the internal subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void startIntSubset(); + + /** + * This method is used indicate the start of the external subset. + * + * This method is a no-op for this SAX driver + * implementation. + */ + virtual void startExtSubset(); + + /** + * This method is used to report the TextDecl. Refer to the XML + * specification for the syntax of a TextDecl. + * + * This method is a no-op for this SAX driver + * implementation. + * + * @param versionStr A const pointer to a Unicode string representing + * the version number of the 'version' clause. + * @param encodingStr A const pointer to a Unicode string representing + * the encoding name of the 'encoding' clause. + */ + virtual void TextDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + ); + //@} + +protected : + // ----------------------------------------------------------------------- + // Protected Methods + // ----------------------------------------------------------------------- + /** + * This method returns a reference to the underlying scanner object. + * It allows read only access to data maintained in the scanner. + * + * @return A const reference to the underlying scanner object. + */ + const XMLScanner& getScanner() const; + + /** Get the Grammar resolver + * + * This provides derived classes with access to the grammar resolver. + */ + GrammarResolver* getGrammarResolver() const; + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SAXParser(const SAXParser&); + SAXParser& operator=(const SAXParser&); + + // ----------------------------------------------------------------------- + // Initialize/Cleanup methods + // ----------------------------------------------------------------------- + void initialize(); + void cleanUp(); + void resetInProgress(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fAttrList + // A temporary implementation of the basic SAX attribute list + // interface. We use this one over and over on each startElement + // event to allow SAX-like access to the element attributes. + // + // fDocHandler + // The installed SAX doc handler, if any. Null if none. + // + // fDTDHandler + // The installed SAX DTD handler, if any. Null if none. + // + // fElemDepth + // This is used to track the element nesting depth, so that we can + // know when we are inside content. This is so we can ignore char + // data outside of content. + // + // fEntityResolver + // The installed SAX entity handler, if any. Null if none. + // + // fErrorHandler + // The installed SAX error handler, if any. Null if none. + // + // fPSVIHandler + // The installed PSVI handler, if any. Null if none. + // + // fAdvDHCount + // fAdvDHList + // fAdvDHListSize + // This is an array of pointers to XMLDocumentHandlers, which is + // how we see installed advanced document handlers. There will + // usually not be very many at all, so a simple array is used + // instead of a collection, for performance. It will grow if needed, + // but that is unlikely. + // + // The count is how many handlers are currently installed. The size + // is how big the array itself is (for expansion purposes.) When + // count == size, is time to expand. + // + // fParseInProgress + // This flag is set once a parse starts. It is used to prevent + // multiple entrance or reentrance of the parser. + // + // fScanner + // The scanner being used by this parser. It is created internally + // during construction. + // + // fGrammarPool + // The grammar pool passed from external application (through derivatives). + // which could be 0, not owned. + // + // ----------------------------------------------------------------------- + bool fParseInProgress; + XMLSize_t fElemDepth; + XMLSize_t fAdvDHCount; + XMLSize_t fAdvDHListSize; + VecAttrListImpl fAttrList; + DocumentHandler* fDocHandler; + DTDHandler* fDTDHandler; + EntityResolver* fEntityResolver; + XMLEntityResolver* fXMLEntityResolver; + ErrorHandler* fErrorHandler; + PSVIHandler* fPSVIHandler; + XMLDocumentHandler** fAdvDHList; + XMLScanner* fScanner; + GrammarResolver* fGrammarResolver; + XMLStringPool* fURIStringPool; + XMLValidator* fValidator; + MemoryManager* fMemoryManager; + XMLGrammarPool* fGrammarPool; + XMLBuffer fElemQNameBuf; +}; + + +// --------------------------------------------------------------------------- +// SAXParser: Getter methods +// --------------------------------------------------------------------------- +inline DocumentHandler* SAXParser::getDocumentHandler() +{ + return fDocHandler; +} + +inline const DocumentHandler* SAXParser::getDocumentHandler() const +{ + return fDocHandler; +} + +inline EntityResolver* SAXParser::getEntityResolver() +{ + return fEntityResolver; +} + +inline XMLEntityResolver* SAXParser::getXMLEntityResolver() +{ + return fXMLEntityResolver; +} + +inline const XMLEntityResolver* SAXParser::getXMLEntityResolver() const +{ + return fXMLEntityResolver; +} + +inline const EntityResolver* SAXParser::getEntityResolver() const +{ + return fEntityResolver; +} + +inline ErrorHandler* SAXParser::getErrorHandler() +{ + return fErrorHandler; +} + +inline const ErrorHandler* SAXParser::getErrorHandler() const +{ + return fErrorHandler; +} + +inline PSVIHandler* SAXParser::getPSVIHandler() +{ + return fPSVIHandler; +} + +inline const PSVIHandler* SAXParser::getPSVIHandler() const +{ + return fPSVIHandler; +} + +inline const XMLScanner& SAXParser::getScanner() const +{ + return *fScanner; +} + +inline GrammarResolver* SAXParser::getGrammarResolver() const +{ + return fGrammarResolver; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.cpp b/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.cpp new file mode 100644 index 000000000..b60678eb3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.cpp @@ -0,0 +1,349 @@ +/* + * 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. + */ + +/** +* This file contains code to build the DOM tree. It registers a document +* handler with the scanner. In these handler methods, appropriate DOM nodes +* are created and added to the DOM tree. +* +* $Id: XercesDOMParser.cpp 882548 2009-11-20 13:44:14Z borisk $ +* +*/ + + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesDOMParser::XercesDOMParser( XMLValidator* const valToAdopt + , MemoryManager* const manager + , XMLGrammarPool* const gramPool): + +AbstractDOMParser(valToAdopt, manager, gramPool) +, fEntityResolver(0) +, fXMLEntityResolver(0) +, fErrorHandler(0) +{ +} + + +XercesDOMParser::~XercesDOMParser() +{ +} + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Getter methods +// --------------------------------------------------------------------------- +bool XercesDOMParser::isCachingGrammarFromParse() const +{ + return getScanner()->isCachingGrammarFromParse(); +} + +bool XercesDOMParser::isUsingCachedGrammarInParse() const +{ + return getScanner()->isUsingCachedGrammarInParse(); +} + +Grammar* XercesDOMParser::getGrammar(const XMLCh* const nameSpaceKey) +{ + return getGrammarResolver()->getGrammar(nameSpaceKey); +} + +Grammar* XercesDOMParser::getRootGrammar() +{ + return getScanner()->getRootGrammar(); +} + +const XMLCh* XercesDOMParser::getURIText(unsigned int uriId) const +{ + return getScanner()->getURIText(uriId); +} + +XMLFilePos XercesDOMParser::getSrcOffset() const +{ + return getScanner()->getSrcOffset(); +} + +bool XercesDOMParser::getIgnoreCachedDTD() const +{ + return getScanner()->getIgnoreCachedDTD(); +} + +// --------------------------------------------------------------------------- +// XercesDOMParser: Setter methods +// --------------------------------------------------------------------------- +void XercesDOMParser::setErrorHandler(ErrorHandler* const handler) +{ + fErrorHandler = handler; + XMLScanner* scanner = getScanner(); + if (fErrorHandler) { + scanner->setErrorReporter(this); + scanner->setErrorHandler(fErrorHandler); + } + else { + scanner->setErrorReporter(0); + scanner->setErrorHandler(0); + } +} + +void XercesDOMParser::setEntityResolver(EntityResolver* const handler) +{ + fEntityResolver = handler; + if (fEntityResolver) { + getScanner()->setEntityHandler(this); + fXMLEntityResolver = 0; + } + else { + getScanner()->setEntityHandler(0); + } +} + +void XercesDOMParser::setXMLEntityResolver(XMLEntityResolver* const handler) +{ + fXMLEntityResolver = handler; + if (fXMLEntityResolver) { + getScanner()->setEntityHandler(this); + fEntityResolver = 0; + } + else { + getScanner()->setEntityHandler(0); + } +} + +void XercesDOMParser::cacheGrammarFromParse(const bool newState) +{ + getScanner()->cacheGrammarFromParse(newState); + + if (newState) + getScanner()->useCachedGrammarInParse(newState); +} + +void XercesDOMParser::useCachedGrammarInParse(const bool newState) +{ + if (newState || !getScanner()->isCachingGrammarFromParse()) + getScanner()->useCachedGrammarInParse(newState); +} + +void XercesDOMParser::setIgnoreCachedDTD(const bool newValue) +{ + getScanner()->setIgnoredCachedDTD(newValue); +} + +// --------------------------------------------------------------------------- +// XercesDOMParser: Utilities +// --------------------------------------------------------------------------- +void XercesDOMParser::resetDocumentPool() +{ + resetPool(); +} + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Implementation of the XMLErrorReporter interface +// --------------------------------------------------------------------------- +void XercesDOMParser::error( const unsigned int + , const XMLCh* const + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum) +{ + SAXParseException toThrow = SAXParseException + ( + errorText + , publicId + , systemId + , lineNum + , colNum + , getMemoryManager() + ); + + // + // If there is an error handler registered, call it, otherwise ignore + // all but the fatal errors. + // + if (!fErrorHandler) + { + if (errType == XMLErrorReporter::ErrType_Fatal) + throw toThrow; + return; + } + + if (errType == XMLErrorReporter::ErrType_Warning) + fErrorHandler->warning(toThrow); + else if (errType >= XMLErrorReporter::ErrType_Fatal) + fErrorHandler->fatalError(toThrow); + else + fErrorHandler->error(toThrow); +} + +void XercesDOMParser::resetErrors() +{ +} + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Implementation of XMLEntityHandler interface +// --------------------------------------------------------------------------- +InputSource* +XercesDOMParser::resolveEntity(XMLResourceIdentifier* resourceIdentifier) +{ + // + // Just map it to the SAX entity resolver. If there is not one installed, + // return a null pointer to cause the default resolution. + // + if (fEntityResolver) + return fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(), + resourceIdentifier->getSystemId()); + if (fXMLEntityResolver) + return fXMLEntityResolver->resolveEntity(resourceIdentifier); + + return 0; +} + +typedef JanitorMemFunCall ResetParseType; + +// --------------------------------------------------------------------------- +// XercesDOMParser: Grammar preparsing methods +// --------------------------------------------------------------------------- +Grammar* XercesDOMParser::loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &XercesDOMParser::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + grammar = getScanner()->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +Grammar* XercesDOMParser::loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &XercesDOMParser::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + grammar = getScanner()->loadGrammar(systemId, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +Grammar* XercesDOMParser::loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache) +{ + // Avoid multiple entrance + if (getParseInProgress()) + ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); + + ResetParseType resetParse(this, &XercesDOMParser::resetParse); + + Grammar* grammar = 0; + + try + { + setParseInProgress(true); + if (grammarType == Grammar::DTDGrammarType) + getScanner()->setDocTypeHandler(0); + grammar = getScanner()->loadGrammar(source, grammarType, toCache); + } + catch(const OutOfMemoryException&) + { + resetParse.release(); + + throw; + } + + return grammar; +} + +void XercesDOMParser::resetParse() +{ + if (getScanner()->getDocTypeHandler() == 0) + { + getScanner()->setDocTypeHandler(this); + } + + setParseInProgress(false); +} + +void XercesDOMParser::resetCachedGrammarPool() +{ + getGrammarResolver()->resetCachedGrammar(); + getScanner()->resetCachedGrammar(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.hpp b/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.hpp new file mode 100644 index 000000000..de8d13918 --- /dev/null +++ b/project/jni/xerces/src/xercesc/parsers/XercesDOMParser.hpp @@ -0,0 +1,696 @@ +/* + * 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: XercesDOMParser.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESDOMPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESDOMPARSER_HPP + + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +class EntityResolver; +class ErrorHandler; +class XMLEntityResolver; +class XMLResourceIdentifier; + + /** + * This class implements the Document Object Model (DOM) interface. + * It should be used by applications which choose to parse and + * process the XML document using the DOM api's. This implementation + * also allows the applications to install an error and an entity + * handler (useful extensions to the DOM specification). + * + *

It can be used to instantiate a validating or non-validating + * parser, by setting a member flag.

+ */ +class PARSERS_EXPORT XercesDOMParser : public AbstractDOMParser +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors and Destructor */ + //@{ + /** Construct a XercesDOMParser, with an optional validator + * + * Constructor with an instance of validator class to use for + * validation. If you don't provide a validator, a default one will + * be created for you in the scanner. + * + * @param gramPool Pointer to the grammar pool instance from + * external application. + * The parser does NOT own it. + * + * @param valToAdopt Pointer to the validator instance to use. The + * parser is responsible for freeing the memory. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XercesDOMParser + ( + XMLValidator* const valToAdopt = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + /** + * Destructor + */ + virtual ~XercesDOMParser(); + + //@} + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + /** @name Getter methods */ + //@{ + + /** Get a pointer to the error handler + * + * This method returns the installed error handler. If no handler + * has been installed, then it will be a zero pointer. + * + * @return The pointer to the installed error handler object. + */ + ErrorHandler* getErrorHandler(); + + /** Get a const pointer to the error handler + * + * This method returns the installed error handler. If no handler + * has been installed, then it will be a zero pointer. + * + * @return A const pointer to the installed error handler object. + */ + const ErrorHandler* getErrorHandler() const; + + /** Get a pointer to the entity resolver + * + * This method returns the installed entity resolver. If no resolver + * has been installed, then it will be a zero pointer. + * + * @return The pointer to the installed entity resolver object. + */ + EntityResolver* getEntityResolver(); + + /** Get a const pointer to the entity resolver + * + * This method returns the installed entity resolver. If no resolver + * has been installed, then it will be a zero pointer. + * + * @return A const pointer to the installed entity resolver object. + */ + const EntityResolver* getEntityResolver() const; + + /** + * Get a pointer to the entity resolver + * + * This method returns the installed entity resolver. If no resolver + * has been installed, then it will be a zero pointer. + * + * @return The pointer to the installed entity resolver object. + */ + XMLEntityResolver* getXMLEntityResolver(); + + /** + * Get a const pointer to the entity resolver + * + * This method returns the installed entity resolver. If no resolver + * has been installed, then it will be a zero pointer. + * + * @return A const pointer to the installed entity resolver object. + */ + const XMLEntityResolver* getXMLEntityResolver() const; + + /** Get the 'Grammar caching' flag + * + * This method returns the state of the parser's grammar caching when + * parsing an XML document. + * + * @return true, if the parser is currently configured to + * cache grammars, false otherwise. + * + * @see #cacheGrammarFromParse + */ + bool isCachingGrammarFromParse() const; + + /** Get the 'Use cached grammar' flag + * + * This method returns the state of the parser's use of cached grammar + * when parsing an XML document. + * + * @return true, if the parser is currently configured to + * use cached grammars, false otherwise. + * + * @see #useCachedGrammarInParse + */ + bool isUsingCachedGrammarInParse() const; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + Grammar* getGrammar(const XMLCh* const nameSpaceKey); + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + Grammar* getRootGrammar(); + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + const XMLCh* getURIText(unsigned int uriId) const; + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + XMLFilePos getSrcOffset() const; + + /** Get the 'ignore cached DTD grammar' flag + * + * @return true, if the parser is currently configured to + * ignore cached DTD, false otherwise. + * + * @see #setIgnoreCachedDTD + */ + bool getIgnoreCachedDTD() const; + + //@} + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** @name Setter methods */ + //@{ + + /** Set the error handler + * + * This method allows applications to install their own error handler + * to trap error and warning messages. + * + * Any previously set handler is merely dropped, since the parser + * does not own them. + * + * @param handler A const pointer to the user supplied error + * handler. + * + * @see #getErrorHandler + */ + void setErrorHandler(ErrorHandler* const handler); + + /** Set the entity resolver + * + * This method allows applications to install their own entity + * resolver. By installing an entity resolver, the applications + * can trap and potentially redirect references to external + * entities. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one is used. + * + * @param handler A const pointer to the user supplied entity + * resolver. + * + * @see #getEntityResolver + */ + void setEntityResolver(EntityResolver* const handler); + + /** + * Set the entity resolver + * + * This method allows applications to install their own entity + * resolver. By installing an entity resolver, the applications + * can trap and potentially redirect references to external + * entities. + * + * Any previously set entity resolver is merely dropped, since the parser + * does not own them. If both setEntityResolver and setXMLEntityResolver + * are called, then the last one set is used. + * + * @param handler A const pointer to the user supplied entity + * resolver. + * + * @see #getXMLEntityResolver + */ + void setXMLEntityResolver(XMLEntityResolver* const handler); + + /** Set the 'Grammar caching' flag + * + * This method allows users to enable or disable caching of grammar when + * parsing XML documents. When set to true, the parser will cache the + * resulting grammar for use in subsequent parses. + * + * If the flag is set to true, the 'Use cached grammar' flag will also be + * set to true. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should cache grammars + * or not. + * + * @see #isCachingGrammarFromParse + * @see #useCachedGrammarInParse + */ + void cacheGrammarFromParse(const bool newState); + + /** Set the 'Use cached grammar' flag + * + * This method allows users to enable or disable the use of cached + * grammars. When set to true, the parser will use the cached grammar, + * instead of building the grammar from scratch, to validate XML + * documents. + * + * If the 'Grammar caching' flag is set to true, this method ignore the + * value passed in. + * + * The parser's default state is: false. + * + * @param newState The value specifying whether we should use the cached + * grammar or not. + * + * @see #isUsingCachedGrammarInParse + * @see #cacheGrammarFromParse + */ + void useCachedGrammarInParse(const bool newState); + + /** Set the 'ignore cached DTD grammar' flag + * + * This method gives users the option to ignore a cached DTD grammar, when + * an XML document contains both an internal and external DTD, and the use + * cached grammar from parse option is enabled. Currently, we do not allow + * using cached DTD grammar when an internal subset is present in the + * document. This option will only affect the behavior of the parser when + * an internal and external DTD both exist in a document (i.e. no effect + * if document has no internal subset). + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreCachedDTD(const bool newValue); + + //@} + + // ----------------------------------------------------------------------- + // Utility methods + // ----------------------------------------------------------------------- + + /** @name Utility methods */ + //@{ + /** Reset the documents vector pool and release all the associated memory + * back to the system. + * + * When parsing a document using a DOM parser, all memory allocated + * for a DOM tree is associated to the DOM document. + * + * If you do multiple parse using the same DOM parser instance, then + * multiple DOM documents will be generated and saved in a vector pool. + * All these documents (and thus all the allocated memory) + * won't be deleted until the parser instance is destroyed. + * + * If you don't need these DOM documents anymore and don't want to + * destroy the DOM parser instance at this moment, then you can call this method + * to reset the document vector pool and release all the allocated memory + * back to the system. + * + * It is an error to call this method if you are in the middle of a + * parse (e.g. in the mid of a progressive parse). + * + * @exception IOException An exception from the parser if this function + * is called when a parse is in progress. + * + */ + void resetDocumentPool(); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLErrorReporter interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLErrorReporter interface. */ + //@{ + + /** Handle errors reported from the parser + * + * This method is used to report back errors found while parsing the + * XML file. This method is also borrowed from the SAX specification. + * It calls the corresponding user installed Error Handler method: + * 'fatal', 'error', 'warning' depending on the severity of the error. + * This classification is defined by the XML specification. + * + * @param errCode An integer code for the error. + * @param msgDomain A const pointer to an Unicode string representing + * the message domain to use. + * @param errType An enumeration classifying the severity of the error. + * @param errorText A const pointer to an Unicode string representing + * the text of the error message. + * @param systemId A const pointer to an Unicode string representing + * the system id of the XML file where this error + * was discovered. + * @param publicId A const pointer to an Unicode string representing + * the public id of the XML file where this error + * was discovered. + * @param lineNum The line number where the error occurred. + * @param colNum The column number where the error occurred. + * @see ErrorHandler + */ + virtual void error + ( + const unsigned int errCode + , const XMLCh* const msgDomain + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ); + + /** Reset any error data before a new parse + * + * This method allows the user installed Error Handler callback to + * 'reset' itself. + * + * This method is a no-op for this DOM + * implementation. + */ + virtual void resetErrors(); + //@} + + + // ----------------------------------------------------------------------- + // Implementation of the XMLEntityHandler interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLEntityHandler interface. */ + //@{ + + /** Handle an end of input source event + * + * This method is used to indicate the end of parsing of an external + * entity file. + * + * This method is a no-op for this DOM + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the XML file being parsed. + * @see InputSource + */ + virtual void endInputSource(const InputSource& inputSource); + + /** Expand a system id + * + * This method allows an installed XMLEntityHandler to further + * process any system id's of external entities encountered in + * the XML file being parsed, such as redirection etc. + * + * This method always returns 'false' + * for this DOM implementation. + * + * @param systemId A const pointer to an Unicode string representing + * the system id scanned by the parser. + * @param toFill A pointer to a buffer in which the application + * processed system id is stored. + * @return 'true', if any processing is done, 'false' otherwise. + */ + virtual bool expandSystemId + ( + const XMLCh* const systemId + , XMLBuffer& toFill + ); + + /** Reset any entity handler information + * + * This method allows the installed XMLEntityHandler to reset + * itself. + * + * This method is a no-op for this DOM + * implementation. + */ + virtual void resetEntities(); + + /** Resolve a public/system id + * + * This method allows a user installed entity handler to further + * process any pointers to external entities. The applications can + * implement 'redirection' via this callback. + * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return The value returned by the user installed resolveEntity + * method or NULL otherwise to indicate no processing was done. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @see XMLEntityHandler + * @see XMLEntityResolver + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ); + + /** Handle a 'start input source' event + * + * This method is used to indicate the start of parsing an external + * entity file. + * + * This method is a no-op for this DOM parse + * implementation. + * + * @param inputSource A const reference to the InputSource object + * which points to the external entity + * being parsed. + */ + virtual void startInputSource(const InputSource& inputSource); + + //@} + + // ----------------------------------------------------------------------- + // Grammar preparsing interface + // ----------------------------------------------------------------------- + + /** @name Implementation of Grammar preparsing interface's. */ + //@{ + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the SAX InputSource parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param source A const reference to the SAX InputSource object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see InputSource#InputSource + */ + Grammar* loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false); + + /** + * This method allows the user to reset the pool of cached grammars. + */ + void resetCachedGrammarPool(); + + //@} + + +private : + // ----------------------------------------------------------------------- + // Initialize/Cleanup methods + // ----------------------------------------------------------------------- + void resetParse(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesDOMParser(const XercesDOMParser&); + XercesDOMParser& operator=(const XercesDOMParser&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEntityResolver + // The installed SAX entity resolver, if any. Null if none. + // + // fErrorHandler + // The installed SAX error handler, if any. Null if none. + //----------------------------------------------------------------------- + EntityResolver* fEntityResolver; + XMLEntityResolver* fXMLEntityResolver; + ErrorHandler* fErrorHandler; +}; + + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Handlers for the XMLEntityHandler interface +// --------------------------------------------------------------------------- +inline void XercesDOMParser::endInputSource(const InputSource&) +{ + // The DOM entity resolver doesn't handle this +} + +inline bool XercesDOMParser::expandSystemId(const XMLCh* const, XMLBuffer&) +{ + // The DOM entity resolver doesn't handle this + return false; +} + +inline void XercesDOMParser::resetEntities() +{ + // Nothing to do on this one +} + +inline void XercesDOMParser::startInputSource(const InputSource&) +{ + // The DOM entity resolver doesn't handle this +} + + +// --------------------------------------------------------------------------- +// XercesDOMParser: Getter methods +// --------------------------------------------------------------------------- +inline ErrorHandler* XercesDOMParser::getErrorHandler() +{ + return fErrorHandler; +} + +inline const ErrorHandler* XercesDOMParser::getErrorHandler() const +{ + return fErrorHandler; +} + +inline EntityResolver* XercesDOMParser::getEntityResolver() +{ + return fEntityResolver; +} + +inline const EntityResolver* XercesDOMParser::getEntityResolver() const +{ + return fEntityResolver; +} + +inline XMLEntityResolver* XercesDOMParser::getXMLEntityResolver() +{ + return fXMLEntityResolver; +} + +inline const XMLEntityResolver* XercesDOMParser::getXMLEntityResolver() const +{ + return fXMLEntityResolver; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/AttributeList.hpp b/project/jni/xerces/src/xercesc/sax/AttributeList.hpp new file mode 100644 index 000000000..acd8a7128 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/AttributeList.hpp @@ -0,0 +1,229 @@ +/* + * 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: AttributeList.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ATTRIBUTELIST_HPP) +#define XERCESC_INCLUDE_GUARD_ATTRIBUTELIST_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Interface for an element's attribute specifications. + * + * The SAX parser implements this interface and passes an instance + * to the SAX application as the second argument of each startElement + * event. + * + * The instance provided will return valid results only during the + * scope of the startElement invocation (to save it for future + * use, the application must make a copy: the AttributeListImpl + * helper class provides a convenient constructor for doing so). + * + * An AttributeList includes only attributes that have been + * specified or defaulted: \#IMPLIED attributes will not be included. + * + * There are two ways for the SAX application to obtain information + * from the AttributeList. First, it can iterate through the entire + * list: + * + * + * public void startElement (String name, AttributeList atts) {
+ *  for (XMLSize_t i = 0; i < atts.getLength(); i++) {
+ *   String name = atts.getName(i);
+ *   String type = atts.getType(i);
+ *   String value = atts.getValue(i);
+ *   [...]
+ *  }
+ * } + *
+ * + * (Note that the result of getLength() will be zero if there + * are no attributes.) + * + * As an alternative, the application can request the value or + * type of specific attributes: + * + * + * public void startElement (String name, AttributeList atts) {
+ *  String identifier = atts.getValue("id");
+ *  String label = atts.getValue("label");
+ *  [...]
+ * } + *
+ * + * The AttributeListImpl helper class provides a convenience + * implementation for use by parser or application writers. + * + * @see DocumentHandler#startElement + * @see AttributeListImpl#AttributeListImpl + */ + +class SAX_EXPORT AttributeList +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + AttributeList() + { + } + + /** Destructor */ + virtual ~AttributeList() + { + } + //@} + + /** @name The virtual attribute list interface */ + //@{ + /** + * Return the number of attributes in this list. + * + * The SAX parser may provide attributes in any + * arbitrary order, regardless of the order in which they were + * declared or specified. The number of attributes may be + * zero. + * + * @return The number of attributes in the list. + */ + virtual XMLSize_t getLength() const = 0; + + /** + * Return the name of an attribute in this list (by position). + * + * The names must be unique: the SAX parser shall not include the + * same attribute twice. Attributes without values (those declared + * \#IMPLIED without a value specified in the start tag) will be + * omitted from the list. + * + * If the attribute name has a namespace prefix, the prefix + * will still be attached. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The name of the indexed attribute, or null + * if the index is out of range. + * @see #getLength + */ + virtual const XMLCh* getName(const XMLSize_t index) const = 0; + + /** + * Return the type of an attribute in the list (by position). + * + * The attribute type is one of the strings "CDATA", "ID", + * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", + * or "NOTATION" (always in upper case). + * + * If the parser has not read a declaration for the attribute, + * or if the parser does not report attribute types, then it must + * return the value "CDATA" as stated in the XML 1.0 Recommendation + * (clause 3.3.3, "Attribute-Value Normalization"). + * + * For an enumerated attribute that is not a notation, the + * parser will report the type as "NMTOKEN". + * + * @param index The index of the attribute in the list (starting at 0). + * @return The attribute type as a string, or + * null if the index is out of range. + * @see #getLength + * @see #getType + */ + virtual const XMLCh* getType(const XMLSize_t index) const = 0; + + /** + * Return the value of an attribute in the list (by position). + * + * If the attribute value is a list of tokens (IDREFS, + * ENTITIES, or NMTOKENS), the tokens will be concatenated + * into a single string separated by whitespace. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The attribute value as a string, or + * null if the index is out of range. + * @see #getLength + * @see #getValue + */ + virtual const XMLCh* getValue(const XMLSize_t index) const = 0; + + /** + * Return the type of an attribute in the list (by name). + * + * The return value is the same as the return value for + * getType(XMLSize_t). + * + * If the attribute name has a namespace prefix in the document, + * the application must include the prefix here. + * + * @param name The name of the attribute. + * @return The attribute type as a string, or null if no + * such attribute exists. + * @see #getType + */ + virtual const XMLCh* getType(const XMLCh* const name) const = 0; + + /** + * Return the value of an attribute in the list (by name). + * + * The return value is the same as the return value for + * getValue(XMLSize_t). + * + * If the attribute name has a namespace prefix in the document, + * the application must include the prefix here. + * + * @param name The name of the attribute in the list. + * @return The attribute value as a string, or null if + * no such attribute exists. + * @see #getValue + */ + virtual const XMLCh* getValue(const XMLCh* const name) const = 0; + + /** + * Return the value of an attribute in the list (by name). + * + * The return value is the same as the return value for + * getValue(XMLSize_t). + * + * If the attribute name has a namespace prefix in the document, + * the application must include the prefix here. + * + * @param name The name of the attribute in the list. + * @return The attribute value as a string, or null if + * no such attribute exists. + * @see #getValue + */ + virtual const XMLCh* getValue(const char* const name) const = 0; + //@} + +private : + /* Constructors and operators */ + /* Copy constructor */ + AttributeList(const AttributeList&); + /* Assignment operator */ + AttributeList& operator=(const AttributeList&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/DTDHandler.hpp b/project/jni/xerces/src/xercesc/sax/DTDHandler.hpp new file mode 100644 index 000000000..19793ad08 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/DTDHandler.hpp @@ -0,0 +1,159 @@ +/* + * 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: DTDHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DTDHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Receive notification of basic DTD-related events. + * + *

If a SAX application needs information about notations and + * unparsed entities, then the application implements this + * interface and registers an instance with the SAX parser using + * the parser's setDTDHandler method. The parser uses the + * instance to report notation and unparsed entity declarations to + * the application.

+ * + *

The SAX parser may report these events in any order, regardless + * of the order in which the notations and unparsed entities were + * declared; however, all DTD events must be reported after the + * document handler's startDocument event, and before the first + * startElement event.

+ * + *

It is up to the application to store the information for + * future use (perhaps in a hash table or object tree). + * If the application encounters attributes of type "NOTATION", + * "ENTITY", or "ENTITIES", it can use the information that it + * obtained through this interface to find the entity and/or + * notation corresponding with the attribute value.

+ * + *

The HandlerBase class provides a default implementation + * of this interface, which simply ignores the events.

+ * + * @see Parser#setDTDHandler + * @see HandlerBase#HandlerBase + */ + +class SAX_EXPORT DTDHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default Constructor */ + DTDHandler() + { + } + + /** Destructor */ + virtual ~DTDHandler() + { + } + + //@} + + /** @name The DTD handler interface */ + //@{ + /** + * Receive notification of a notation declaration event. + * + *

It is up to the application to record the notation for later + * reference, if necessary.

+ * + *

If a system identifier is present, and it is a URL, the SAX + * parser must resolve it fully before passing it to the + * application.

+ * + * @param name The notation name. + * @param publicId The notation's public identifier, or null if + * none was given. + * @param systemId The notation's system identifier, or null if + * none was given. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #unparsedEntityDecl + * @see AttributeList#AttributeList + */ + virtual void notationDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ) = 0; + + /** + * Receive notification of an unparsed entity declaration event. + * + *

Note that the notation name corresponds to a notation + * reported by the notationDecl() event. It is up to the + * application to record the entity for later reference, if + * necessary.

+ * + *

If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @param name The unparsed entity's name. + * @param publicId The entity's public identifier, or null if none + * was given. + * @param systemId The entity's system identifier (it must always + * have one). + * @param notationName The name of the associated notation. + * @see #notationDecl + * @see AttributeList#AttributeList + */ + virtual void unparsedEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const notationName + ) = 0; + + /** + * Reset the DocType object on its reuse + * + *

This method helps in reseting the DTD object implementation + * defaults each time the DTD is begun.

+ * + */ + virtual void resetDocType() = 0; + + //@} + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + DTDHandler(const DTDHandler&); + + /* Assignment operator */ + DTDHandler& operator=(const DTDHandler&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/DocumentHandler.hpp b/project/jni/xerces/src/xercesc/sax/DocumentHandler.hpp new file mode 100644 index 000000000..e190709a3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/DocumentHandler.hpp @@ -0,0 +1,283 @@ +/* + * 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: DocumentHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOCUMENTHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DOCUMENTHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class AttributeList; +class Locator; + +/** + * Receive notification of general document events. + * + *

This is the main interface that most SAX applications + * implement: if the application needs to be informed of basic parsing + * events, it implements this interface and registers an instance with + * the SAX parser using the setDocumentHandler method. The parser + * uses the instance to report basic document-related events like + * the start and end of elements and character data.

+ * + *

The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, all of an element's content (character data, processing + * instructions, and/or subelements) will appear, in order, between + * the startElement event and the corresponding endElement event.

+ * + *

Application writers who do not want to implement the entire + * interface while can derive a class from HandlerBase, which implements + * the default functionality; parser writers can instantiate + * HandlerBase to obtain a default handler. The application can find + * the location of any document event using the Locator interface + * supplied by the Parser through the setDocumentLocator method.

+ * + * @see Parser#setDocumentHandler + * @see Locator#Locator + * @see HandlerBase#HandlerBase + */ + +class SAX_EXPORT DocumentHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + DocumentHandler() + { + } + + /** Destructor */ + virtual ~DocumentHandler() + { + } + //@} + + /** @name The virtual document handler interface */ + + //@{ + /** + * Receive notification of character data. + * + *

The Parser will call this method to report each chunk of + * character data. SAX parsers may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * must come from the same external entity, so that the Locator + * provides useful information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + *

Note that some parsers will report whitespace using the + * ignorableWhitespace() method rather than this one (validating + * parsers must do so).

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #ignorableWhitespace + * @see Locator#Locator + */ + virtual void characters + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + /** + * Receive notification of the end of a document. + * + *

The SAX parser will invoke this method only once, and it will + * be the last method invoked during the parse. The parser shall + * not invoke this method until it has either abandoned parsing + * (because of an unrecoverable error) or reached the end of + * input.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endDocument () = 0; + + /** + * Receive notification of the end of an element. + * + *

The SAX parser will invoke this method at the end of every + * element in the XML document; there will be a corresponding + * startElement() event for every endElement() event (even when the + * element is empty).

+ * + *

If the element name has a namespace prefix, the prefix will + * still be attached to the name.

+ * + * @param name The element type name + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endElement(const XMLCh* const name) = 0; + + /** + * Receive notification of ignorable whitespace in element content. + * + *

Validating Parsers must use this method to report each chunk + * of ignorable whitespace (see the W3C XML 1.0 recommendation, + * section 2.10): non-validating parsers may also use this method + * if they are capable of parsing and using content models.

+ * + *

SAX parsers may return all contiguous whitespace in a single + * chunk, or they may split it into several chunks; however, all of + * the characters in any single event must come from the same + * external entity, so that the Locator provides useful + * information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #characters + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + /** + * Receive notification of a processing instruction. + * + *

The Parser will invoke this method once for each processing + * instruction found: note that processing instructions may occur + * before or after the main document element.

+ * + *

A SAX parser should never report an XML declaration (XML 1.0, + * section 2.8) or a text declaration (XML 1.0, section 4.3.1) + * using this method.

+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none was supplied. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void processingInstruction + ( + const XMLCh* const target + , const XMLCh* const data + ) = 0; + + /** + * Reset the Document object on its reuse + * + *

This method helps in reseting the document implementation + * defaults each time the document is begun.

+ * + */ + virtual void resetDocument() = 0; + + /** + * Receive an object for locating the origin of SAX document events. + * + * SAX parsers are strongly encouraged (though not absolutely + * required) to supply a locator: if it does so, it must supply + * the locator to the application by invoking this method before + * invoking any of the other methods in the DocumentHandler + * interface. + * + * The locator allows the application to determine the end + * position of any document-related event, even if the parser is + * not reporting an error. Typically, the application will + * use this information for reporting its own errors (such as + * character content that does not match an application's + * business rules). The information returned by the locator + * is probably not sufficient for use with a search engine. + * + * Note that the locator will return correct information only + * during the invocation of the events in this interface. The + * application should not attempt to use it at any other time. + * + * @param locator An object that can return the location of + * any SAX document event. The object is only + * 'on loan' to the client code and they are not + * to attempt to delete or modify it in any way! + * + * @see Locator#Locator + */ + virtual void setDocumentLocator(const Locator* const locator) = 0; + + /** + * Receive notification of the beginning of a document. + * + *

The SAX parser will invoke this method only once, before any + * other methods in this interface or in DTDHandler (except for + * setDocumentLocator).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startDocument() = 0; + + /** + * Receive notification of the beginning of an element. + * + *

The Parser will invoke this method at the beginning of every + * element in the XML document; there will be a corresponding + * endElement() event for every startElement() event (even when the + * element is empty). All of the element's content will be + * reported, in order, before the corresponding endElement() + * event.

+ * + *

If the element name has a namespace prefix, the prefix will + * still be attached. Note that the attribute list provided will + * contain only attributes with explicit values (specified or + * defaulted): \#IMPLIED attributes will be omitted.

+ * + * @param name The element type name. + * @param attrs The attributes attached to the element, if any. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #endElement + * @see AttributeList#AttributeList + */ + virtual void startElement + ( + const XMLCh* const name + , AttributeList& attrs + ) = 0; + + //@} + +private : + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + DocumentHandler(const DocumentHandler&); + /** Assignment operator */ + DocumentHandler& operator=(const DocumentHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/Dummy.cpp b/project/jni/xerces/src/xercesc/sax/Dummy.cpp new file mode 100644 index 000000000..7da384f2e --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/Dummy.cpp @@ -0,0 +1,36 @@ +/* + * 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: Dummy.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/sax/EntityResolver.hpp b/project/jni/xerces/src/xercesc/sax/EntityResolver.hpp new file mode 100644 index 000000000..017ea08db --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/EntityResolver.hpp @@ -0,0 +1,165 @@ +/* + * 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: EntityResolver.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ENTITYRESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_ENTITYRESOLVER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; + +/** + * Basic interface for resolving entities. + * + *

If a SAX application needs to implement customized handling + * for external entities, it must implement this interface and + * register an instance with the SAX parser using the parser's + * setEntityResolver method.

+ * + *

The parser will then allow the application to intercept any + * external entities (including the external DTD subset and external + * parameter entities, if any) before including them.

+ * + *

Many SAX applications will not need to implement this interface, + * but it will be especially useful for applications that build + * XML documents from databases or other specialised input sources, + * or for applications that use URI types other than URLs.

+ * + *

The following resolver would provide the application + * with a special character stream for the entity with the system + * identifier "http://www.myhost.com/today":

+ * + * + *\#include
+ *\#include
+ *
+ *class MyResolver : public EntityResolver {
+ * public:
  + * InputSource resolveEntity (const XMLCh* const publicId, const XMLCh* const systemId);
   + *
+ * ...
   + * };
  + *
+ * MyResolver::resolveEntity {
+ *  if (XMLString::compareString(systemId, "http://www.myhost.com/today")) {
+ *   MyReader* reader = new MyReader();
+ *   return new InputSource(reader);
+ *  } else {
+ *   return null;
+ *  }
+ * }
+ *
+ *
+ * + *

The application can also use this interface to redirect system + * identifiers to local URIs or to look up replacements in a catalog + * (possibly by using the public identifier).

+ * + *

The HandlerBase class implements the default behaviour for + * this interface, which is simply always to return null (to request + * that the parser use the default system identifier).

+ * + * @see Parser#setEntityResolver + * @see InputSource#InputSource + * @see HandlerBase#HandlerBase + */ +class SAX_EXPORT EntityResolver +{ +public: + /** @name Constructors and Destructor */ + //@{ + + /** Default Constructor */ + EntityResolver() + { + } + + /** Destructor */ + virtual ~EntityResolver() + { + } + + //@} + + /** @name The EntityResolver interface */ + //@{ + + /** + * Allow the application to resolve external entities. + * + *

The Parser will call this method before opening any external + * entity except the top-level document entity (including the + * external DTD subset, external entities referenced within the + * DTD, and external entities referenced within the document + * element): the application may request that the parser resolve + * the entity itself, that it use an alternative URI, or that it + * use an entirely different input source.

+ * + *

Application writers can use this method to redirect external + * system identifiers to secure and/or local URIs, to look up + * public identifiers in a catalogue, or to read an entity from a + * database or other input source (including, for example, a dialog + * box).

+ * + *

If the system identifier is a URL, the SAX parser must + * resolve it fully before reporting it to the application.

+ * + * @param publicId The public identifier of the external entity + * being referenced, or null if none was supplied. + * @param systemId The system identifier of the external entity + * being referenced. + * @return An InputSource object describing the new input source, + * or null to request that the parser open a regular + * URI connection to the system identifier. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception, + * possibly the result of creating a new InputStream + * or Reader for the InputSource. + * @see InputSource#InputSource + */ + virtual InputSource* resolveEntity + ( + const XMLCh* const publicId + , const XMLCh* const systemId + ) = 0; + + //@} + +private : + /* Unimplemented constructors and operators */ + + + /* Copy constructor */ + EntityResolver(const EntityResolver&); + + /* Assignment operator */ + EntityResolver& operator=(const EntityResolver&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/ErrorHandler.hpp b/project/jni/xerces/src/xercesc/sax/ErrorHandler.hpp new file mode 100644 index 000000000..73b1b90b2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/ErrorHandler.hpp @@ -0,0 +1,168 @@ +/* + * 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: ErrorHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ERRORHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_ERRORHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class SAXParseException; + + +/** + * Basic interface for SAX error handlers. + * + *

If a SAX application needs to implement customized error + * handling, it must implement this interface and then register an + * instance with the SAX parser using the parser's setErrorHandler + * method. The parser will then report all errors and warnings + * through this interface.

+ * + *

The parser shall use this interface instead of throwing an + * exception: it is up to the application whether to throw an + * exception for different types of errors and warnings. Note, + * however, that there is no requirement that the parser continue to + * provide useful information after a call to fatalError (in other + * words, a SAX driver class could catch an exception and report a + * fatalError).

+ * + *

The HandlerBase class provides a default implementation of this + * interface, ignoring warnings and recoverable errors and throwing a + * SAXParseException for fatal errors. An application may extend + * that class rather than implementing the complete interface + * itself.

+ * + * @see Parser#setErrorHandler + * @see SAXParseException#SAXParseException + * @see HandlerBase#HandlerBase + */ + +class SAX_EXPORT ErrorHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + ErrorHandler() + { + } + + /** Destructor */ + virtual ~ErrorHandler() + { + } + //@} + + /** @name The error handler interface */ + //@{ + /** + * Receive notification of a warning. + * + *

SAX parsers will use this method to report conditions that + * are not errors or fatal errors as defined by the XML 1.0 + * recommendation. The default behaviour is to take no action.

+ * + *

The SAX parser must continue to provide normal parsing events + * after invoking this method: it should still be possible for the + * application to process the document through to the end.

+ * + * @param exc The warning information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void warning(const SAXParseException& exc) = 0; + + /** + * Receive notification of a recoverable error. + * + *

This corresponds to the definition of "error" in section 1.2 + * of the W3C XML 1.0 Recommendation. For example, a validating + * parser would use this callback to report the violation of a + * validity constraint. The default behaviour is to take no + * action.

+ * + *

The SAX parser must continue to provide normal parsing events + * after invoking this method: it should still be possible for the + * application to process the document through to the end. If the + * application cannot do so, then the parser should report a fatal + * error even if the XML 1.0 recommendation does not require it to + * do so.

+ * + * @param exc The error information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void error(const SAXParseException& exc) = 0; + + /** + * Receive notification of a non-recoverable error. + * + *

This corresponds to the definition of "fatal error" in + * section 1.2 of the W3C XML 1.0 Recommendation. For example, a + * parser would use this callback to report the violation of a + * well-formedness constraint.

+ * + *

The application must assume that the document is unusable + * after the parser has invoked this method, and should continue + * (if at all) only for the sake of collecting addition error + * messages: in fact, SAX parsers are free to stop reporting any + * other events once this method has been invoked.

+ * + * @param exc The error information encapsulated in a + * SAX parse exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see SAXParseException#SAXParseException + */ + virtual void fatalError(const SAXParseException& exc) = 0; + + /** + * Reset the Error handler object on its reuse + * + *

This method helps in reseting the Error handler object + * implementation defaults each time the Error handler is begun.

+ * + */ + virtual void resetErrors() = 0; + + + //@} + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + ErrorHandler(const ErrorHandler&); + + /* Assignment operator */ + ErrorHandler& operator=(const ErrorHandler&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/HandlerBase.hpp b/project/jni/xerces/src/xercesc/sax/HandlerBase.hpp new file mode 100644 index 000000000..1dca8d1f8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/HandlerBase.hpp @@ -0,0 +1,466 @@ +/* + * 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: HandlerBase.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_HANDLERBASE_HPP) +#define XERCESC_INCLUDE_GUARD_HANDLERBASE_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class Locator; +class AttributeList; + +/** + * Default base class for handlers. + * + *

This class implements the default behaviour for four SAX + * interfaces: EntityResolver, DTDHandler, DocumentHandler, + * and ErrorHandler.

+ * + *

Application writers can extend this class when they need to + * implement only part of an interface; parser writers can + * instantiate this class to provide default handlers when the + * application has not supplied its own.

+ * + *

Note that the use of this class is optional.

+ * + * @see EntityResolver#EntityResolver + * @see DTDHandler#DTDHandler + * @see DocumentHandler#DocumentHandler + * @see ErrorHandler#ErrorHandler + */ + +class SAX_EXPORT HandlerBase : + + public EntityResolver, public DTDHandler, public DocumentHandler + , public ErrorHandler +{ +public: + /** @name Default handlers for the DocumentHandler interface */ + //@{ + /** + * Receive notification of character data inside an element. + * + *

By default, do nothing. Application writers may override this + * method to take specific actions for each chunk of character data + * (such as adding the data to a node or buffer, or printing it to + * a file).

+ * + * @param chars The characters. + * @param length The number of characters to use from the + * character array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#characters + */ + virtual void characters + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of the end of the document. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the beginning + * of a document (such as finalising a tree or closing an output + * file).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#endDocument + */ + virtual void endDocument(); + + /** + * Receive notification of the end of an element. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the end of + * each element (such as finalising a tree node or writing + * output to a file).

+ * + * @param name The element type name. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#endElement + */ + virtual void endElement(const XMLCh* const name); + + /** + * Receive notification of ignorable whitespace in element content. + * + *

By default, do nothing. Application writers may override this + * method to take specific actions for each chunk of ignorable + * whitespace (such as adding data to a node or buffer, or printing + * it to a file).

+ * + * @param chars The whitespace characters. + * @param length The number of characters to use from the + * character array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#ignorableWhitespace + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of a processing instruction. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions for each + * processing instruction, such as setting status variables or + * invoking other methods.

+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none is supplied. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#processingInstruction + */ + virtual void processingInstruction + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * Reset the Document object on its reuse + * + * @see DocumentHandler#resetDocument + */ + virtual void resetDocument(); + //@} + + /** @name Default implementation of DocumentHandler interface */ + + //@{ + /** + * Receive a Locator object for document events. + * + *

By default, do nothing. Application writers may override this + * method in a subclass if they wish to store the locator for use + * with other document events.

+ * + * @param locator A locator for all SAX document events. + * @see DocumentHandler#setDocumentLocator + * @see Locator + */ + virtual void setDocumentLocator(const Locator* const locator); + + /** + * Receive notification of the beginning of the document. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the beginning + * of a document (such as allocating the root node of a tree or + * creating an output file).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#startDocument + */ + virtual void startDocument(); + + /** + * Receive notification of the start of an element. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the start of + * each element (such as allocating a new tree node or writing + * output to a file).

+ * + * @param name The element type name. + * @param attributes The specified or defaulted attributes. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLCh* const name + , AttributeList& attributes + ); + + //@} + + /** @name Default implementation of the EntityResolver interface. */ + + //@{ + /** + * Resolve an external entity. + * + *

Always return null, so that the parser will use the system + * identifier provided in the XML document. This method implements + * the SAX default behaviour: application writers can override it + * in a subclass to do special translations such as catalog lookups + * or URI redirection.

+ * + * @param publicId The public identifier, or null if none is + * available. + * @param systemId The system identifier provided in the XML + * document. + * @return The new input source, or null to require the + * default behaviour. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see EntityResolver#resolveEntity + */ + virtual InputSource* resolveEntity + ( + const XMLCh* const publicId + , const XMLCh* const systemId + ); + + //@} + + /** @name Default implementation of the ErrorHandler interface */ + //@{ + /** + * Receive notification of a recoverable parser error. + * + *

The default implementation does nothing. Application writers + * may override this method in a subclass to take specific actions + * for each error, such as inserting the message in a log file or + * printing it to the console.

+ * + * @param exc The warning information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#warning + * @see SAXParseException#SAXParseException + */ + virtual void error(const SAXParseException& exc); + + /** + * Report a fatal XML parsing error. + * + *

The default implementation throws a SAXParseException. + * Application writers may override this method in a subclass if + * they need to take specific actions for each fatal error (such as + * collecting all of the errors into a single report): in any case, + * the application must stop all regular processing when this + * method is invoked, since the document is no longer reliable, and + * the parser may no longer report parsing events.

+ * + * @param exc The error information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#fatalError + * @see SAXParseException#SAXParseException + */ + virtual void fatalError(const SAXParseException& exc); + + /** + * Receive notification of a parser warning. + * + *

The default implementation does nothing. Application writers + * may override this method in a subclass to take specific actions + * for each warning, such as inserting the message in a log file or + * printing it to the console.

+ * + * @param exc The warning information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#warning + * @see SAXParseException#SAXParseException + */ + virtual void warning(const SAXParseException& exc); + + /** + * Reset the Error handler object on its reuse + * + * @see ErrorHandler#resetErrors + */ + virtual void resetErrors(); + + //@} + + + /** @name Default implementation of DTDHandler interface. */ + //@{ + + /** + * Receive notification of a notation declaration. + * + *

By default, do nothing. Application writers may override this + * method in a subclass if they wish to keep track of the notations + * declared in a document.

+ * + * @param name The notation name. + * @param publicId The notation public identifier, or null if not + * available. + * @param systemId The notation system identifier. + * @see DTDHandler#notationDecl + */ + virtual void notationDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ); + + /** + * Reset the DTD object on its reuse + * + * @see DTDHandler#resetDocType + */ + virtual void resetDocType(); + + /** + * Receive notification of an unparsed entity declaration. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to keep track of the unparsed entities + * declared in a document.

+ * + * @param name The entity name. + * @param publicId The entity public identifier, or null if not + * available. + * @param systemId The entity system identifier. + * @param notationName The name of the associated notation. + * @see DTDHandler#unparsedEntityDecl + */ + virtual void unparsedEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const notationName + ); + //@} + + HandlerBase() {}; + virtual ~HandlerBase() {}; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + HandlerBase(const HandlerBase&); + HandlerBase& operator=(const HandlerBase&); +}; + + +// --------------------------------------------------------------------------- +// HandlerBase: Inline default implementations +// --------------------------------------------------------------------------- +inline void HandlerBase::characters(const XMLCh* const + , const XMLSize_t) +{ +} + +inline void HandlerBase::endDocument() +{ +} + +inline void HandlerBase::endElement(const XMLCh* const) +{ +} + +inline void HandlerBase::error(const SAXParseException&) +{ +} + +inline void HandlerBase::fatalError(const SAXParseException& exc) +{ + throw exc; +} + +inline void +HandlerBase::ignorableWhitespace( const XMLCh* const + , const XMLSize_t) +{ +} + +inline void HandlerBase::notationDecl( const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void +HandlerBase::processingInstruction( const XMLCh* const + , const XMLCh* const) +{ +} + +inline void HandlerBase::resetErrors() +{ +} + +inline void HandlerBase::resetDocument() +{ +} + +inline void HandlerBase::resetDocType() +{ +} + +inline InputSource* +HandlerBase::resolveEntity( const XMLCh* const + , const XMLCh* const) +{ + return 0; +} + +inline void +HandlerBase::unparsedEntityDecl(const XMLCh* const + , const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void HandlerBase::setDocumentLocator(const Locator* const) +{ +} + +inline void HandlerBase::startDocument() +{ +} + +inline void +HandlerBase::startElement( const XMLCh* const + , AttributeList&) +{ +} + +inline void HandlerBase::warning(const SAXParseException&) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/InputSource.cpp b/project/jni/xerces/src/xercesc/sax/InputSource.cpp new file mode 100644 index 000000000..2fc922bed --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/InputSource.cpp @@ -0,0 +1,133 @@ +/* + * 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: InputSource.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// InputSource: Destructor +// --------------------------------------------------------------------------- +InputSource::~InputSource() +{ + fMemoryManager->deallocate(fEncoding); + fMemoryManager->deallocate(fPublicId); + fMemoryManager->deallocate(fSystemId); +} + + +// --------------------------------------------------------------------------- +// InputSource: Setter methods +// --------------------------------------------------------------------------- +void InputSource::setEncoding(const XMLCh* const encodingStr) +{ + fMemoryManager->deallocate(fEncoding); + fEncoding = XMLString::replicate(encodingStr, fMemoryManager); +} + + +void InputSource::setPublicId(const XMLCh* const publicId) +{ + fMemoryManager->deallocate(fPublicId); + fPublicId = XMLString::replicate(publicId, fMemoryManager); +} + + +void InputSource::setSystemId(const XMLCh* const systemId) +{ + fMemoryManager->deallocate(fSystemId); + fSystemId = XMLString::replicate(systemId, fMemoryManager); +} + + + +// --------------------------------------------------------------------------- +// InputSource: Hidden Constructors +// --------------------------------------------------------------------------- +InputSource::InputSource(MemoryManager* const manager) : + + fMemoryManager(manager) + , fEncoding(0) + , fPublicId(0) + , fSystemId(0) + , fFatalErrorIfNotFound(true) +{ +} + +InputSource::InputSource(const XMLCh* const systemId, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fEncoding(0) + , fPublicId(0) + , fSystemId(0) + , fFatalErrorIfNotFound(true) +{ + fSystemId = XMLString::replicate(systemId, fMemoryManager); +} + +InputSource::InputSource(const XMLCh* const systemId + , const XMLCh* const publicId + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fEncoding(0) + , fPublicId(0) + , fSystemId(0) + , fFatalErrorIfNotFound(true) +{ + fPublicId = XMLString::replicate(publicId, fMemoryManager); + fSystemId = XMLString::replicate(systemId, fMemoryManager); +} + +InputSource::InputSource(const char* const systemId, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fEncoding(0) + , fPublicId(0) + , fSystemId(0) + , fFatalErrorIfNotFound(true) +{ + fSystemId = XMLString::transcode(systemId, fMemoryManager); +} + +InputSource::InputSource(const char* const systemId + , const char* const publicId + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fEncoding(0) + , fPublicId(0) + , fSystemId(0) + , fFatalErrorIfNotFound(true) +{ + fPublicId = XMLString::transcode(publicId, fMemoryManager); + fSystemId = XMLString::transcode(systemId, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/sax/InputSource.hpp b/project/jni/xerces/src/xercesc/sax/InputSource.hpp new file mode 100644 index 000000000..8fa3d2c68 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/InputSource.hpp @@ -0,0 +1,337 @@ +/* + * 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: InputSource.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP) +#define XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + + +/** + * A single input source for an XML entity. + * + *

This class encapsulates information about an input source in a + * single object, which may include a public identifier or a system + * identifier

+ * + *

There are two places that the application will deliver this input + * source to the parser: as the argument to the Parser::parse method, or as + * the return value of the EntityResolver::resolveEntity method.

+ * + *

InputSource is never used directly, but is the base class for a number + * of derived classes for particular types of input sources. Derivatives are + * provided (in the framework/ directory) for URL input sources, memory buffer + * input sources, and so on.

+ * + *

When it is time to parse the input described by an input source, it + * will be asked to create a binary stream for that source. That stream will + * be used to input the data of the source. The derived class provides the + * implementation of the makeStream() method, and provides a type of stream + * of the correct type for the input source it represents. + * + *

An InputSource object belongs to the application: the parser never + * modifies them in any way. They are always passed by const reference so + * the parser will make a copy of any input sources that it must keep + * around beyond the call.

+ * + * @see Parser#parse + * @see EntityResolver#resolveEntity + */ +class SAX_EXPORT InputSource : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // All constructors are hidden, just the destructor is available + // ----------------------------------------------------------------------- + /** @name Destructor */ + //@{ + /** + * Destructor + * + */ + virtual ~InputSource(); + //@} + + + // ----------------------------------------------------------------------- + /** @name Virtual input source interface */ + //@{ + /** + * Makes the byte stream for this input source. + * + *

The derived class must create and return a binary input stream of an + * appropriate type for its kind of data source. The returned stream must + * be dynamically allocated and becomes the parser's property. + *

+ * + * @see BinInputStream + */ + virtual BinInputStream* makeStream() const = 0; + + //@} + + + // ----------------------------------------------------------------------- + /** @name Getter methods */ + //@{ + /** + * An input source can be set to force the parser to assume a particular + * encoding for the data that input source represents, via the setEncoding() + * method. This method returns name of the encoding that is to be forced. + * If the encoding has never been forced, it returns a null pointer. + * + * @return The forced encoding, or null if none was supplied. + * @see #setEncoding + */ + virtual const XMLCh* getEncoding() const; + + + /** + * Get the public identifier for this input source. + * + * @return The public identifier, or null if none was supplied. + * @see #setPublicId + */ + virtual const XMLCh* getPublicId() const; + + + /** + * Get the system identifier for this input source. + * + *

If the system ID is a URL, it will be fully resolved.

+ * + * @return The system identifier. + * @see #setSystemId + */ + virtual const XMLCh* getSystemId() const; + + /** + * Get the flag that indicates if the parser should issue fatal error if this input source + * is not found. + * + * @return True if the parser should issue fatal error if this input source is not found. + * False if the parser issue warning message instead. + * @see #setIssueFatalErrorIfNotFound + */ + virtual bool getIssueFatalErrorIfNotFound() const; + + MemoryManager* getMemoryManager() const; + + //@} + + + // ----------------------------------------------------------------------- + /** @name Setter methods */ + //@{ + + /** + * Set the encoding which will be required for use with the XML text read + * via a stream opened by this input source. + * + *

This is usually not set, allowing the encoding to be sensed in the + * usual XML way. However, in some cases, the encoding in the file is known + * to be incorrect because of intermediate transcoding, for instance + * encapsulation within a MIME document. + * + * @param encodingStr The name of the encoding to force. + */ + virtual void setEncoding(const XMLCh* const encodingStr); + + + /** + * Set the public identifier for this input source. + * + *

The public identifier is always optional: if the application writer + * includes one, it will be provided as part of the location information.

+ * + * @param publicId The public identifier as a string. + * @see Locator#getPublicId + * @see SAXParseException#getPublicId + * @see #getPublicId + */ + virtual void setPublicId(const XMLCh* const publicId); + + /** + * Set the system identifier for this input source. + * + *

Set the system identifier for this input source. + * + *

The system id is always required. The public id may be used to map + * to another system id, but the system id must always be present as a fall + * back. + * + *

If the system ID is a URL, it must be fully resolved.

+ * + * @param systemId The system identifier as a string. + * @see #getSystemId + * @see Locator#getSystemId + * @see SAXParseException#getSystemId + */ + virtual void setSystemId(const XMLCh* const systemId); + + /** + * Indicates if the parser should issue fatal error if this input source + * is not found. If set to false, the parser issue warning message instead. + * + * @param flag True if the parser should issue fatal error if this input source is not found. + * If set to false, the parser issue warning message instead. (Default: true) + * + * @see #getIssueFatalErrorIfNotFound + */ + virtual void setIssueFatalErrorIfNotFound(const bool flag); + + //@} + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Constructor with a system identifier as XMLCh type. + * @param systemId The system identifier (URI). + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + InputSource(const XMLCh* const systemId, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Constructor with a system and public identifiers + * @param systemId The system identifier (URI). + * @param publicId The public identifier as in the entity definition. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + InputSource + ( + const XMLCh* const systemId + , const XMLCh* const publicId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Constructor witha system identifier as string + * @param systemId The system identifier (URI). + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + InputSource(const char* const systemId, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Constructor witha system and public identifiers. Both as string + * @param systemId The system identifier (URI). + * @param publicId The public identifier as in the entity definition. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + InputSource + ( + const char* const systemId + , const char* const publicId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + + + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + InputSource(const InputSource&); + InputSource& operator=(const InputSource&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fEncoding + // This is the encoding to use. Usually this is null, which means + // to use the information found in the file itself. But, if set, + // this encoding will be used without question. + // + // fPublicId + // This is the optional public id for the input source. It can be + // null if none is desired. + // + // fSystemId + // This is the system id for the input source. This is what is + // actually used to open the source. + // + // fFatalErrorIfNotFound + // ----------------------------------------------------------------------- + MemoryManager* const fMemoryManager; + XMLCh* fEncoding; + XMLCh* fPublicId; + XMLCh* fSystemId; + bool fFatalErrorIfNotFound; +}; + + +// --------------------------------------------------------------------------- +// InputSource: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* InputSource::getEncoding() const +{ + return fEncoding; +} + +inline const XMLCh* InputSource::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* InputSource::getSystemId() const +{ + return fSystemId; +} + +inline bool InputSource::getIssueFatalErrorIfNotFound() const +{ + return fFatalErrorIfNotFound; +} + +inline MemoryManager* InputSource::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// InputSource: Setter methods +// --------------------------------------------------------------------------- +inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag) +{ + fFatalErrorIfNotFound = flag; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/Locator.hpp b/project/jni/xerces/src/xercesc/sax/Locator.hpp new file mode 100644 index 000000000..1a451d714 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/Locator.hpp @@ -0,0 +1,125 @@ +/* + * 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: Locator.hpp 672273 2008-06-27 13:57:00Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_LOCATOR_HPP) +#define XERCESC_INCLUDE_GUARD_LOCATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Interface for associating a SAX event with a document location. + * + *

If a SAX parser provides location information to the SAX + * application, it does so by implementing this interface and then + * passing an instance to the application using the document + * handler's setDocumentLocator method. The application can use the + * object to obtain the location of any other document handler event + * in the XML source document.

+ * + *

Note that the results returned by the object will be valid only + * during the scope of each document handler method: the application + * will receive unpredictable results if it attempts to use the + * locator at any other time.

+ * + *

SAX parsers are not required to supply a locator, but they are + * very strong encouraged to do so. If the parser supplies a + * locator, it must do so before reporting any other document events. + * If no locator has been set by the time the application receives + * the startDocument event, the application should assume that a + * locator is not available.

+ * + * @see DocumentHandler#setDocumentLocator + */ + +class SAX_EXPORT Locator +{ +public: + + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + Locator() + { + } + + /** Destructor */ + virtual ~Locator() + { + } + + //@} + + /** @name The locator interface */ + //@{ + /** + * Return the public identifier for the current document event. + *

This will be the public identifier + * @return A string containing the public identifier, or + * null if none is available. + * @see #getSystemId + */ + virtual const XMLCh* getPublicId() const = 0; + + /** + * Return the system identifier for the current document event. + * + *

If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.

+ * + * @return A string containing the system identifier, or null + * if none is available. + * @see #getPublicId + */ + virtual const XMLCh* getSystemId() const = 0; + + /** + * Return the line number where the current document event ends. + * Note that this is the line position of the first character + * after the text associated with the document event. + * @return The line number, or 0 if none is available. + * @see #getColumnNumber + */ + virtual XMLFileLoc getLineNumber() const = 0; + + /** + * Return the column number where the current document event ends. + * Note that this is the column number of the first + * character after the text associated with the document + * event. The first column in a line is position 1. + * @return The column number, or 0 if none is available. + * @see #getLineNumber + */ + virtual XMLFileLoc getColumnNumber() const = 0; + //@} + +private : + /* Copy constructor */ + Locator(const Locator&); + + /* Assignment operator */ + Locator& operator=(const Locator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/Parser.hpp b/project/jni/xerces/src/xercesc/sax/Parser.hpp new file mode 100644 index 000000000..f5aa6ffc2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/Parser.hpp @@ -0,0 +1,245 @@ +/* + * 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: Parser.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PARSER_HPP) +#define XERCESC_INCLUDE_GUARD_PARSER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DTDHandler; +class EntityResolver; +class DocumentHandler; +class ErrorHandler; +class InputSource; + +/** + * Basic interface for SAX (Simple API for XML) parsers. + * + * All SAX parsers must implement this basic interface: it allows + * applications to register handlers for different types of events + * and to initiate a parse from a URI, or a character stream. + * + * All SAX parsers must also implement a zero-argument constructor + * (though other constructors are also allowed). + * + * SAX parsers are reusable but not re-entrant: the application + * may reuse a parser object (possibly with a different input source) + * once the first parse has completed successfully, but it may not + * invoke the parse() methods recursively within a parse. + * + * @see EntityResolver#EntityResolver + * @see DTDHandler#DTDHandler + * @see DocumentHandler#DocumentHandler + * @see ErrorHandler#ErrorHandler + * @see HandlerBase#HandlerBase + * @see InputSource#InputSource + */ + +#include + +class SAX_EXPORT Parser +{ +public: + /** @name Constructors and Destructor */ + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + //@{ + /** The default constructor */ + Parser() + { + } + /** The destructor */ + virtual ~Parser() + { + } + //@} + + //----------------------------------------------------------------------- + // The parser interface + //----------------------------------------------------------------------- + /** @name The parser interfaces */ + //@{ + /** + * Allow an application to register a custom entity resolver. + * + * If the application does not register an entity resolver, the + * SAX parser will resolve system identifiers and open connections + * to entities itself (this is the default behaviour implemented in + * HandlerBase). + * + * Applications may register a new or different entity resolver + * in the middle of a parse, and the SAX parser must begin using + * the new resolver immediately. + * + * @param resolver The object for resolving entities. + * @see EntityResolver#EntityResolver + * @see HandlerBase#HandlerBase + */ + virtual void setEntityResolver(EntityResolver* const resolver) = 0; + + /** + * Allow an application to register a DTD event handler. + * + * If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored (this + * is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the middle + * of a parse, and the SAX parser must begin using the new handler + * immediately. + * + * @param handler The DTD handler. + * @see DTDHandler#DTDHandler + * @see HandlerBase#HandlerBase + */ + virtual void setDTDHandler(DTDHandler* const handler) = 0; + + /** + * Allow an application to register a document event handler. + * + * If the application does not register a document handler, all + * document events reported by the SAX parser will be silently + * ignored (this is the default behaviour implemented by + * HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The document handler. + * @see DocumentHandler#DocumentHandler + * @see HandlerBase#HandlerBase + */ + virtual void setDocumentHandler(DocumentHandler* const handler) = 0; + + /** + * Allow an application to register an error event handler. + * + * If the application does not register an error event handler, + * all error events reported by the SAX parser will be silently + * ignored, except for fatalError, which will throw a SAXException + * (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see ErrorHandler#ErrorHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setErrorHandler(ErrorHandler* const handler) = 0; + + /** + * Parse an XML document. + * + * The application can use this method to instruct the SAX parser + * to begin parsing an XML document from any valid input + * source (a character stream, a byte stream, or a URI). + * + * Applications may not invoke this method while a parse is in + * progress (they should create a new Parser instead for each + * additional XML document). Once a parse is complete, an + * application may reuse the same Parser object, possibly with a + * different input source. + * + * @param source The input source for the top-level of the + * XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see InputSource#InputSource + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setDocumentHandler + * @see #setErrorHandler + */ + virtual void parse + ( + const InputSource& source + ) = 0; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(const InputSource&) + */ + virtual void parse + ( + const XMLCh* const systemId + ) = 0; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(const InputSource&) + */ + virtual void parse + ( + const char* const systemId + ) = 0; + //@} + + +private : + /* The copy constructor, you cannot call this directly */ + Parser(const Parser&); + + /* The assignment operator, you cannot call this directly */ + Parser& operator=(const Parser&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/SAXException.cpp b/project/jni/xerces/src/xercesc/sax/SAXException.cpp new file mode 100644 index 000000000..4d86d1955 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/SAXException.cpp @@ -0,0 +1,74 @@ +/* + * 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: SAXException.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include "SAXException.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + + +// SAXNotSupportedException Constructors +SAXNotSupportedException::SAXNotSupportedException(MemoryManager* const manager) + : SAXException(manager) +{ +} + +SAXNotSupportedException::SAXNotSupportedException(const XMLCh* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) +{ +} + +SAXNotSupportedException::SAXNotSupportedException(const char* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) +{ +} + +SAXNotSupportedException::SAXNotSupportedException(const SAXException& toCopy) + : SAXException(toCopy) +{ +} + +// SAXNotRecognizedException Constructors +SAXNotRecognizedException::SAXNotRecognizedException(MemoryManager* const manager) + : SAXException(manager) +{ +} + +SAXNotRecognizedException::SAXNotRecognizedException(const XMLCh* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) +{ +} + +SAXNotRecognizedException::SAXNotRecognizedException(const char* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) +{ +} + +SAXNotRecognizedException::SAXNotRecognizedException(const SAXException& toCopy) + : SAXException(toCopy) +{ +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/sax/SAXException.hpp b/project/jni/xerces/src/xercesc/sax/SAXException.hpp new file mode 100644 index 000000000..53fa43d3b --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/SAXException.hpp @@ -0,0 +1,230 @@ +/* + * 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: SAXException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Encapsulate a general SAX error or warning. + * + *

This class can contain basic error or warning information from + * either the XML SAX parser or the application: a parser writer or + * application writer can subclass it to provide additional + * functionality. SAX handlers may throw this exception or + * any exception subclassed from it.

+ * + *

If the application needs to pass through other types of + * exceptions, it must wrap those exceptions in a SAXException + * or an exception derived from a SAXException.

+ * + *

If the parser or application needs to include information + * about a specific location in an XML document, it should use the + * SAXParseException subclass.

+ * + * @see SAXParseException#SAXParseException + */ +class SAX_EXPORT SAXException : public XMemory +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : + + fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager)) + , fMemoryManager(manager) + { + } + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : + + fMsg(XMLString::replicate(msg, manager)) + , fMemoryManager(manager) + { + } + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : + + fMsg(XMLString::transcode(msg, manager)) + , fMemoryManager(manager) + { + } + + /** + * Copy constructor + * + * @param toCopy The exception to be copy constructed + */ + SAXException(const SAXException& toCopy) : + XMemory(toCopy) + , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager)) + , fMemoryManager(toCopy.fMemoryManager) + { + } + + /** Destructor */ + virtual ~SAXException() + { + fMemoryManager->deallocate(fMsg);//delete [] fMsg; + } + + //@} + + + /** @name Public Operators */ + //@{ + /** + * Assignment operator + * + * @param toCopy The object to be copied + */ + SAXException& operator=(const SAXException& toCopy) + { + if (this == &toCopy) + return *this; + + fMemoryManager->deallocate(fMsg);//delete [] fMsg; + fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager); + fMemoryManager = toCopy.fMemoryManager; + return *this; + } + //@} + + /** @name Getter Methods */ + //@{ + /** + * Get the contents of the message + * + */ + virtual const XMLCh* getMessage() const + { + return fMsg; + } + //@} + + +protected : + // ----------------------------------------------------------------------- + // Protected data members + // + // fMsg + // This is the text of the error that is being thrown. + // ----------------------------------------------------------------------- + XMLCh* fMsg; + MemoryManager* fMemoryManager; +}; + +class SAX_EXPORT SAXNotSupportedException : public SAXException +{ + +public: + SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXNotSupportedException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXNotSupportedException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor + * + * @param toCopy The exception to be copy constructed + */ + SAXNotSupportedException(const SAXException& toCopy); +}; + +class SAX_EXPORT SAXNotRecognizedException : public SAXException +{ +public: + SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXNotRecognizedException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Create a new SAXException. + * + * @param msg The error or warning message. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + SAXNotRecognizedException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor + * + * @param toCopy The exception to be copy constructed + */ + SAXNotRecognizedException(const SAXException& toCopy); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax/SAXParseException.cpp b/project/jni/xerces/src/xercesc/sax/SAXParseException.cpp new file mode 100644 index 000000000..4e042ca0e --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/SAXParseException.cpp @@ -0,0 +1,125 @@ +/* + * 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: SAXParseException.cpp 672273 2008-06-27 13:57:00Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SAXParseException: Constructors and Destructor +// --------------------------------------------------------------------------- +SAXParseException::SAXParseException(const XMLCh* const message + , const Locator& locator + , MemoryManager* const manager) : + SAXException(message, manager) + , fColumnNumber(locator.getColumnNumber()) + , fLineNumber(locator.getLineNumber()) + , fPublicId(XMLString::replicate(locator.getPublicId(), manager)) + , fSystemId(XMLString::replicate(locator.getSystemId(), manager)) +{ +} + +SAXParseException::SAXParseException(const XMLCh* const message + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLFileLoc lineNumber + , const XMLFileLoc columnNumber + , MemoryManager* const manager) : + SAXException(message, manager) + , fColumnNumber(columnNumber) + , fLineNumber(lineNumber) + , fPublicId(XMLString::replicate(publicId, manager)) + , fSystemId(XMLString::replicate(systemId, manager)) +{ +} + +SAXParseException::SAXParseException(const SAXParseException& toCopy) : + + SAXException(toCopy) + , fColumnNumber(toCopy.fColumnNumber) + , fLineNumber(toCopy.fLineNumber) + , fPublicId(0) + , fSystemId(0) +{ + fPublicId = XMLString::replicate(toCopy.fPublicId, toCopy.fMemoryManager); + fSystemId = XMLString::replicate(toCopy.fSystemId, toCopy.fMemoryManager); +} + +SAXParseException::~SAXParseException() +{ + fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); + fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); +} + + +// --------------------------------------------------------------------------- +// SAXParseException: Public operators +// --------------------------------------------------------------------------- +SAXParseException& +SAXParseException::operator=(const SAXParseException& toAssign) +{ + if (this == &toAssign) + return *this; + + fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); + fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); + + this->SAXException::operator =(toAssign); + fColumnNumber = toAssign.fColumnNumber; + fLineNumber = toAssign.fLineNumber; + + fPublicId = XMLString::replicate(toAssign.fPublicId, fMemoryManager); + fSystemId = XMLString::replicate(toAssign.fSystemId, fMemoryManager); + + return *this; +} + + +// --------------------------------------------------------------------------- +// SAXParseException: Getter methods +// --------------------------------------------------------------------------- +const XMLCh* SAXParseException::getPublicId() const +{ + return fPublicId; +} + +const XMLCh* SAXParseException::getSystemId() const +{ + return fSystemId; +} + +XMLFileLoc SAXParseException::getLineNumber() const +{ + return fLineNumber; +} + +XMLFileLoc SAXParseException::getColumnNumber() const +{ + return fColumnNumber; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/sax/SAXParseException.hpp b/project/jni/xerces/src/xercesc/sax/SAXParseException.hpp new file mode 100644 index 000000000..3117efa65 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax/SAXParseException.hpp @@ -0,0 +1,185 @@ +/* + * 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: SAXParseException.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAXPARSEEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_SAXPARSEEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class Locator; + +/** + * Encapsulate an XML parse error or warning. + * + *

This exception will include information for locating the error + * in the original XML document. Note that although the application + * will receive a SAXParseException as the argument to the handlers + * in the ErrorHandler interface, the application is not actually + * required to throw the exception; instead, it can simply read the + * information in it and take a different action.

+ * + *

Since this exception is a subclass of SAXException, it + * inherits the ability to wrap another exception.

+ * + * @see SAXException#SAXException + * @see Locator#Locator + * @see ErrorHandler#ErrorHandler + */ +class SAX_EXPORT SAXParseException : public SAXException +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** + * Create a new SAXParseException from a message and a Locator. + * + *

This constructor is especially useful when an application is + * creating its own exception from within a DocumentHandler + * callback.

+ * + * @param message The error or warning message. + * @param locator The locator object for the error or warning. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @see Locator#Locator + * @see Parser#setLocale + */ + SAXParseException(const XMLCh* const message, const Locator& locator, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + + /** + * Create a new SAXParseException. + * + *

This constructor is most useful for parser writers.

+ * + *

If the system identifier is a URL, the parser must resolve it + * fully before creating the exception.

+ * + * @param message The error or warning message. + * @param publicId The public identifier of the entity that generated + * the error or warning. + * @param systemId The system identifier of the entity that generated + * the error or warning. + * @param lineNumber The line number of the end of the text that + * caused the error or warning. + * @param columnNumber The column number of the end of the text that + * caused the error or warning. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @see Parser#setLocale + */ + SAXParseException + ( + const XMLCh* const message + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLFileLoc lineNumber + , const XMLFileLoc columnNumber + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Copy constructor + * + * @param toCopy The object to be copied + */ + SAXParseException(const SAXParseException& toCopy); + + /** + * Destructor + */ + ~SAXParseException(); + + //@} + + /** @name Assignment operator */ + //@{ + /** + * Assignment operator + * + * @param toAssign The object to be copied through assignment + * + */ + SAXParseException& operator=(const SAXParseException& toAssign); + //@} + + /** @name Getter methods */ + //@{ + /** + * The column number of the end of the text where the exception occurred. + * + *

The first column in a line is position 1.

+ * + * @return An integer representing the column number, or 0 + * if none is available. + * @see Locator#getColumnNumber + */ + XMLFileLoc getColumnNumber() const; + /** + * The line number of the end of the text where the exception occurred. + * + * @return An integer representing the line number, or 0 + * if none is available. + * @see Locator#getLineNumber + */ + XMLFileLoc getLineNumber() const; + /** + * Get the public identifier of the entity where the exception occurred. + * + * @return A string containing the public identifier, or null + * if none is available. + * @see Locator#getPublicId + */ + const XMLCh* getPublicId() const; + /** + * Get the system identifier of the entity where the exception occurred. + * + *

If the system identifier is a URL, it will be resolved + * fully.

+ * + * @return A string containing the system identifier, or null + * if none is available. + * @see Locator#getSystemId + */ + const XMLCh* getSystemId() const; + //@} + +private: + /* Data Members */ + + /* The column in the source text where the error occured. */ + XMLFileLoc fColumnNumber; + /* The line in the source text where the error occured. */ + XMLFileLoc fLineNumber; + /* The public id of the file where the error occured. */ + XMLCh* fPublicId; + /* The system id of the file where the error occured. */ + XMLCh* fSystemId; + + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/Attributes.hpp b/project/jni/xerces/src/xercesc/sax2/Attributes.hpp new file mode 100644 index 000000000..49c70480b --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/Attributes.hpp @@ -0,0 +1,313 @@ +/* + * 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: Attributes.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ATTRIBUTES_HPP) +#define XERCESC_INCLUDE_GUARD_ATTRIBUTES_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Interface for an element's attribute specifications. + * + * The SAX2 parser implements this interface and passes an instance + * to the SAX2 application as the last argument of each startElement + * event. + * + * The instance provided will return valid results only during the + * scope of the startElement invocation (to save it for future + * use, the application must make a copy: the AttributesImpl + * helper class provides a convenient constructor for doing so). + * + * An Attributes includes only attributes that have been + * specified or defaulted: \#IMPLIED attributes will not be included. + * + * There are two ways for the SAX application to obtain information + * from the Attributes. First, it can iterate through the entire + * list: + * + * + * public void startElement (String uri, String localpart, String qName, Attributes atts) {
+ *  for (XMLSize_t i = 0; i < atts.getLength(); i++) {
+ *   String Qname = atts.getQName(i);
+ *   String URI = atts.getURI(i)
+ *   String local = atts.GetLocalName(i)
+ *   String type = atts.getType(i);
+ *   String value = atts.getValue(i);
+ *   [...]
+ *  }
+ * } + *
+ * + * (Note that the result of getLength() will be zero if there + * are no attributes.) + * + * As an alternative, the application can request the value or + * type of specific attributes: + * + * + * public void startElement (String uri, String localpart, String qName, Attributes atts) {
+ *  String identifier = atts.getValue("id");
+ *  String label = atts.getValue("label");
+ *  [...]
+ * } + *
+ * + * The AttributesImpl helper class provides a convenience + * implementation for use by parser or application writers. + * + * @see Sax2DocumentHandler#startElement + * @see AttributesImpl#AttributesImpl + */ + +class SAX2_EXPORT Attributes +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + Attributes() + { + } + + /** Destructor */ + virtual ~Attributes() + { + } + //@} + + /** @name The virtual attribute list interface */ + //@{ + /** + * Return the number of attributes in this list. + * + * The SAX parser may provide attributes in any + * arbitrary order, regardless of the order in which they were + * declared or specified. The number of attributes may be + * zero. + * + * @return The number of attributes in the list. + */ + virtual XMLSize_t getLength() const = 0; + + /** + * Return the namespace URI of an attribute in this list (by position). + * + * The QNames must be unique: the SAX parser shall not include the + * same attribute twice. Attributes without values (those declared + * \#IMPLIED without a value specified in the start tag) will be + * omitted from the list. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The URI of the indexed attribute, or null + * if the index is out of range. + * @see #getLength + */ + virtual const XMLCh* getURI(const XMLSize_t index) const = 0; + + /** + * Return the local name of an attribute in this list (by position). + * + * The QNames must be unique: the SAX parser shall not include the + * same attribute twice. Attributes without values (those declared + * \#IMPLIED without a value specified in the start tag) will be + * omitted from the list. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The local name of the indexed attribute, or null + * if the index is out of range. + * @see #getLength + */ + virtual const XMLCh* getLocalName(const XMLSize_t index) const = 0; + + /** + * Return the qName of an attribute in this list (by position). + * + * The QNames must be unique: the SAX parser shall not include the + * same attribute twice. Attributes without values (those declared + * \#IMPLIED without a value specified in the start tag) will be + * omitted from the list. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The qName of the indexed attribute, or null + * if the index is out of range. + * @see #getLength + */ + virtual const XMLCh* getQName(const XMLSize_t index) const = 0; + + /** + * Return the type of an attribute in the list (by position). + * + * The attribute type is one of the strings "CDATA", "ID", + * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", + * or "NOTATION" (always in upper case). + * + * If the parser has not read a declaration for the attribute, + * or if the parser does not report attribute types, then it must + * return the value "CDATA" as stated in the XML 1.0 Recommendation + * (clause 3.3.3, "Attribute-Value Normalization"). + * + * For an enumerated attribute that is not a notation, the + * parser will report the type as "NMTOKEN". + * + * @param index The index of the attribute in the list (starting at 0). + * @return The attribute type as a string, or + * null if the index is out of range. + * @see #getLength + * @see #getType + */ + virtual const XMLCh* getType(const XMLSize_t index) const = 0; + + /** + * Return the value of an attribute in the list (by position). + * + * If the attribute value is a list of tokens (IDREFS, + * ENTITIES, or NMTOKENS), the tokens will be concatenated + * into a single string separated by whitespace. + * + * @param index The index of the attribute in the list (starting at 0). + * @return The attribute value as a string, or + * null if the index is out of range. + * @see #getLength + * @see #getValue + */ + virtual const XMLCh* getValue(const XMLSize_t index) const = 0; + + //////////////////////////////////////////////////////////////////// + // Name-based query. + //////////////////////////////////////////////////////////////////// + + /** + * Look up the index of an attribute by Namespace name. Non-standard + * extension. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localPart The attribute's local name. + * @param index Reference to the variable where the index will be stored. + * @return true if the attribute is found and false otherwise. + */ + virtual bool getIndex(const XMLCh* const uri, + const XMLCh* const localPart, + XMLSize_t& index) const = 0 ; + + /** + * Look up the index of an attribute by Namespace name. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localPart The attribute's local name. + * @return The index of the attribute, or -1 if it does not + * appear in the list. + */ + virtual int getIndex(const XMLCh* const uri, + const XMLCh* const localPart ) const = 0 ; + + /** + * Look up the index of an attribute by XML 1.0 qualified name. + * Non-standard extension. + * + * @param qName The qualified (prefixed) name. + * @param index Reference to the variable where the index will be stored. + * @return true if the attribute is found and false otherwise. + */ + virtual bool getIndex(const XMLCh* const qName, + XMLSize_t& index) const = 0 ; + + /** + * Look up the index of an attribute by XML 1.0 qualified name. + * + * @param qName The qualified (prefixed) name. + * @return The index of the attribute, or -1 if it does not + * appear in the list. + */ + virtual int getIndex(const XMLCh* const qName ) const = 0 ; + + /** + * Look up an attribute's type by Namespace name. + * + *

See #getType for a description of the possible types.

+ * + * @param uri The Namespace URI, or the empty String if the + * name has no Namespace URI. + * @param localPart The local name of the attribute. + * @return The attribute type as a string, or null if the + * attribute is not in the list or if Namespace + * processing is not being performed. + */ + virtual const XMLCh* getType(const XMLCh* const uri, + const XMLCh* const localPart ) const = 0 ; + + /** + * Look up an attribute's type by XML 1.0 qualified name. + * + *

See #getType for a description of the possible types.

+ * + * @param qName The XML 1.0 qualified name. + * @return The attribute type as a string, or null if the + * attribute is not in the list or if qualified names + * are not available. + */ + virtual const XMLCh* getType(const XMLCh* const qName) const = 0; + + /** + * Look up an attribute's value by Namespace name. + * + *

See #getValue for a description of the possible values.

+ * + * @param uri The Namespace URI, or the empty String if the + * name has no Namespace URI. + * @param localPart The local name of the attribute. + * @return The attribute value as a string, or null if the + * attribute is not in the list. + */ + virtual const XMLCh* getValue(const XMLCh* const uri, const XMLCh* const localPart ) const = 0 ; + + /** + * Look up an attribute's value by XML 1.0 qualified name. + * + *

See #getValue for a description of the possible values.

+ * + * @param qName The XML 1.0 qualified name. + * @return The attribute value as a string, or null if the + * attribute is not in the list or if qualified names + * are not available. + */ + virtual const XMLCh* getValue(const XMLCh* const qName) const = 0; + + //@} + +private : + /* Constructors and operators */ + /* Copy constructor */ + Attributes(const Attributes&); + /* Assignment operator */ + Attributes& operator=(const Attributes&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/ContentHandler.hpp b/project/jni/xerces/src/xercesc/sax2/ContentHandler.hpp new file mode 100644 index 000000000..bb9ab69e6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/ContentHandler.hpp @@ -0,0 +1,340 @@ +/* + * 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: ContentHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CONTENTHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_CONTENTHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class Attributes; +class Locator; + +/** + * Receive notification of general document events. + * + *

This is the main interface that most SAX2 applications + * implement: if the application needs to be informed of basic parsing + * events, it implements this interface and registers an instance with + * the SAX2 parser using the setDocumentHandler method. The parser + * uses the instance to report basic document-related events like + * the start and end of elements and character data.

+ * + *

The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, all of an element's content (character data, processing + * instructions, and/or subelements) will appear, in order, between + * the startElement event and the corresponding endElement event.

+ * + *

Application writers who do not want to implement the entire + * interface while can derive a class from Sax2HandlerBase, which implements + * the default functionality; parser writers can instantiate + * Sax2HandlerBase to obtain a default handler. The application can find + * the location of any document event using the Locator interface + * supplied by the Parser through the setDocumentLocator method.

+ * + * @see Parser#setDocumentHandler + * @see Locator#Locator + * @see Sax2HandlerBase#Sax2HandlerBase + */ + +class SAX2_EXPORT ContentHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + ContentHandler() + { + } + + /** Destructor */ + virtual ~ContentHandler() + { + } + //@} + + /** @name The virtual document handler interface */ + + //@{ + /** + * Receive notification of character data. + * + *

The Parser will call this method to report each chunk of + * character data. SAX parsers may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * must come from the same external entity, so that the Locator + * provides useful information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + *

Note that some parsers will report whitespace using the + * ignorableWhitespace() method rather than this one (validating + * parsers must do so).

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #ignorableWhitespace + * @see Locator#Locator + */ + virtual void characters + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + /** + * Receive notification of the end of a document. + * + *

The SAX parser will invoke this method only once, and it will + * be the last method invoked during the parse. The parser shall + * not invoke this method until it has either abandoned parsing + * (because of an unrecoverable error) or reached the end of + * input.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endDocument () = 0; + + /** + * Receive notification of the end of an element. + * + *

The SAX parser will invoke this method at the end of every + * element in the XML document; there will be a corresponding + * startElement() event for every endElement() event (even when the + * element is empty).

+ * + * @param uri The URI of the associated namespace for this element + * @param localname The local part of the element name + * @param qname The QName of this element + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname + ) = 0; + + /** + * Receive notification of ignorable whitespace in element content. + * + *

Validating Parsers must use this method to report each chunk + * of ignorable whitespace (see the W3C XML 1.0 recommendation, + * section 2.10): non-validating parsers may also use this method + * if they are capable of parsing and using content models.

+ * + *

SAX parsers may return all contiguous whitespace in a single + * chunk, or they may split it into several chunks; however, all of + * the characters in any single event must come from the same + * external entity, so that the Locator provides useful + * information.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #characters + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + /** + * Receive notification of a processing instruction. + * + *

The Parser will invoke this method once for each processing + * instruction found: note that processing instructions may occur + * before or after the main document element.

+ * + *

A SAX parser should never report an XML declaration (XML 1.0, + * section 2.8) or a text declaration (XML 1.0, section 4.3.1) + * using this method.

+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none was supplied. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void processingInstruction + ( + const XMLCh* const target + , const XMLCh* const data + ) = 0; + + /** + * Receive an object for locating the origin of SAX document events. + * + * SAX parsers are strongly encouraged (though not absolutely + * required) to supply a locator: if it does so, it must supply + * the locator to the application by invoking this method before + * invoking any of the other methods in the DocumentHandler + * interface. + * + * The locator allows the application to determine the end + * position of any document-related event, even if the parser is + * not reporting an error. Typically, the application will + * use this information for reporting its own errors (such as + * character content that does not match an application's + * business rules). The information returned by the locator + * is probably not sufficient for use with a search engine. + * + * Note that the locator will return correct information only + * during the invocation of the events in this interface. The + * application should not attempt to use it at any other time. + * + * @param locator An object that can return the location of + * any SAX document event. The object is only + * 'on loan' to the client code and they are not + * to attempt to delete or modify it in any way! + * + * @see Locator#Locator + */ + virtual void setDocumentLocator(const Locator* const locator) = 0; + + /** + * Receive notification of the beginning of a document. + * + *

The SAX parser will invoke this method only once, before any + * other methods in this interface or in DTDHandler (except for + * setDocumentLocator).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startDocument() = 0; + + /** + * Receive notification of the beginning of an element. + * + *

The Parser will invoke this method at the beginning of every + * element in the XML document; there will be a corresponding + * endElement() event for every startElement() event (even when the + * element is empty). All of the element's content will be + * reported, in order, before the corresponding endElement() + * event.

+ * + *

Note that the attribute list provided will + * contain only attributes with explicit values (specified or + * defaulted): \#IMPLIED attributes will be omitted.

+ * + * @param uri The URI of the associated namespace for this element + * @param localname The local part of the element name + * @param qname The QName of this element + * @param attrs The attributes attached to the element, if any. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #endElement + * @see Attributes#Attributes + */ + virtual void startElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname, + const Attributes& attrs + ) = 0; + + /** + * Receive notification of the start of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the start of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @param uri The namespace URI used. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startPrefixMapping + ( + const XMLCh* const prefix, + const XMLCh* const uri + ) = 0 ; + + /** + * Receive notification of the end of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the end of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endPrefixMapping + ( + const XMLCh* const prefix + ) = 0 ; + + /** + * Receive notification of a skipped entity + * + *

The parser will invoke this method once for each entity + * skipped. All processors may skip external entities, + * depending on the values of the features:
+ * http://xml.org/sax/features/external-general-entities
+ * http://xml.org/sax/features/external-parameter-entities

+ * + *

Note: Xerces (specifically) never skips any entities, regardless + * of the above features. This function is never called in the + * Xerces implementation of SAX2.

+ * + *

Introduced with SAX2

+ * + * @param name The name of the skipped entity. If it is a parameter entity, + * the name will begin with %, and if it is the external DTD subset, + * it will be the string [dtd]. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void skippedEntity + ( + const XMLCh* const name + ) = 0 ; + + //@} +private : + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + ContentHandler(const ContentHandler&); + /** Assignment operator */ + ContentHandler& operator=(const ContentHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/DeclHandler.hpp b/project/jni/xerces/src/xercesc/sax2/DeclHandler.hpp new file mode 100644 index 000000000..8127c000e --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/DeclHandler.hpp @@ -0,0 +1,163 @@ +/* + * 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: DeclHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DECLHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DECLHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Receive notification of DTD declaration events. + * + *

This is an optional extension handler for SAX2 to provide more + * complete information about DTD declarations in an XML document. + * XML readers are not required to recognize this handler, and it is not + * part of core-only SAX2 distributions.

+ * + *

Note that data-related DTD declarations (unparsed entities and + * notations) are already reported through the DTDHandler interface.

+ * + *

If you are using the declaration handler together with a lexical + * handler, all of the events will occur between the startDTD and the endDTD + * events.

+ * + * @see SAX2XMLReader#setLexicalHandler + * @see SAX2XMLReader#setDeclarationHandler + */ + +class SAX2_EXPORT DeclHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + DeclHandler() + { + } + + /** Destructor */ + virtual ~DeclHandler() + { + } + //@} + + /** @name The virtual declaration handler interface */ + + //@{ + /** + * Report an element type declaration. + * + *

The content model will consist of the string "EMPTY", the string + * "ANY", or a parenthesised group, optionally followed by an occurrence + * indicator. The model will be normalized so that all parameter entities + * are fully resolved and all whitespace is removed,and will include the + * enclosing parentheses. Other normalization (such as removing redundant + * parentheses or simplifying occurrence indicators) is at the discretion + * of the parser.

+ * + * @param name The element type name. + * @param model The content model as a normalized string. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void elementDecl + ( + const XMLCh* const name + , const XMLCh* const model + ) = 0; + + /** + * Report an attribute type declaration. + * + *

The Parser will call this method to report each occurrence of + * a comment in the XML document.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param eName The name of the associated element. + * @param aName The name of the attribute. + * @param type A string representing the attribute type. + * @param mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies. + * @param value A string representing the attribute's default value, or null if there is none. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void attributeDecl + ( + const XMLCh* const eName + , const XMLCh* const aName + , const XMLCh* const type + , const XMLCh* const mode + , const XMLCh* const value + ) = 0; + + /** + * Report an internal entity declaration. + * + *

Only the effective (first) declaration for each entity will be + * reported. All parameter entities in the value will be expanded, but + * general entities will not.

+ * + * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. + * @param value The replacement text of the entity. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void internalEntityDecl + ( + const XMLCh* const name + , const XMLCh* const value + ) = 0; + + /** + * Report a parsed external entity declaration. + * + *

Only the effective (first) declaration for each entity will + * be reported.

+ * + * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. + * @param publicId The The declared public identifier of the entity, or null if none was declared. + * @param systemId The declared system identifier of the entity. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void externalEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ) = 0; + + //@} +private : + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + DeclHandler(const DeclHandler&); + /** Assignment operator */ + DeclHandler& operator=(const DeclHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/DefaultHandler.hpp b/project/jni/xerces/src/xercesc/sax2/DefaultHandler.hpp new file mode 100644 index 000000000..307de7497 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/DefaultHandler.hpp @@ -0,0 +1,806 @@ +/* + * 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: DefaultHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DEFAULTHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DEFAULTHANDLER_HPP + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class Locator; +class Attributes; + +/** + * Default base class for SAX2 handlers. + * + *

This class implements the default behaviour for SAX2 + * interfaces: EntityResolver, DTDHandler, ContentHandler, + * ErrorHandler, LexicalHandler, and DeclHandler.

+ * + *

Application writers can extend this class when they need to + * implement only part of an interface; parser writers can + * instantiate this class to provide default handlers when the + * application has not supplied its own.

+ * + *

Note that the use of this class is optional.

+ * + * @see EntityResolver#EntityResolver + * @see DTDHandler#DTDHandler + * @see ContentHandler#ContentHandler + * @see ErrorHandler#ErrorHandler + * @see LexicalHandler#LexicalHandler + * @see DeclHandler#DeclHandler + */ + +class SAX2_EXPORT DefaultHandler : + + public EntityResolver, + public DTDHandler, + public ContentHandler, + public ErrorHandler, + public LexicalHandler, + public DeclHandler +{ +public: + /** @name Default handlers for the DocumentHandler interface */ + //@{ + /** + * Receive notification of character data inside an element. + * + *

By default, do nothing. Application writers may override this + * method to take specific actions for each chunk of character data + * (such as adding the data to a node or buffer, or printing it to + * a file).

+ * + * @param chars The characters. + * @param length The number of characters to use from the + * character array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#characters + */ + virtual void characters + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of the end of the document. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the beginning + * of a document (such as finalising a tree or closing an output + * file).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#endDocument + */ + virtual void endDocument(); + + /** + * Receive notification of the end of an element. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the end of + * each element (such as finalising a tree node or writing + * output to a file).

+ * + * @param uri The URI of the associated namespace for this element + * @param localname The local part of the element name + * @param qname The QName of this element + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#endElement + */ + virtual void endElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname + ); + + /** + * Receive notification of ignorable whitespace in element content. + * + *

By default, do nothing. Application writers may override this + * method to take specific actions for each chunk of ignorable + * whitespace (such as adding data to a node or buffer, or printing + * it to a file).

+ * + * @param chars The whitespace characters. + * @param length The number of characters to use from the + * character array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#ignorableWhitespace + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of a processing instruction. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions for each + * processing instruction, such as setting status variables or + * invoking other methods.

+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none is supplied. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#processingInstruction + */ + virtual void processingInstruction + ( + const XMLCh* const target + , const XMLCh* const data + ); + + /** + * Reset the Document object on its reuse + * + * @see DocumentHandler#resetDocument + */ + virtual void resetDocument(); + //@} + + /** @name Default implementation of DocumentHandler interface */ + + //@{ + /** + * Receive a Locator object for document events. + * + *

By default, do nothing. Application writers may override this + * method in a subclass if they wish to store the locator for use + * with other document events.

+ * + * @param locator A locator for all SAX document events. + * @see DocumentHandler#setDocumentLocator + * @see Locator + */ + virtual void setDocumentLocator(const Locator* const locator); + + /** + * Receive notification of the beginning of the document. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the beginning + * of a document (such as allocating the root node of a tree or + * creating an output file).

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#startDocument + */ + virtual void startDocument(); + + /** + * Receive notification of the start of an element. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the start of + * each element (such as allocating a new tree node or writing + * output to a file).

+ * + * @param uri The URI of the associated namespace for this element + * @param localname the local part of the element name + * @param qname the QName of this element + * @param attrs The specified or defaulted attributes. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLCh* const uri, + const XMLCh* const localname, + const XMLCh* const qname + , const Attributes& attrs + ); + + /** + * Receive notification of the start of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the start of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @param uri The namespace URI used. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#startPrefixMapping + */ + virtual void startPrefixMapping + ( + const XMLCh* const prefix, + const XMLCh* const uri + ) ; + + /** + * Receive notification of the end of an namespace prefix mapping. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to take specific actions at the end of + * each namespace prefix mapping.

+ * + * @param prefix The namespace prefix used + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see DocumentHandler#endPrefixMapping + */ + virtual void endPrefixMapping + ( + const XMLCh* const prefix + ) ; + + /** + * Receive notification of a skipped entity + * + *

The parser will invoke this method once for each entity + * skipped. All processors may skip external entities, + * depending on the values of the features:
+ * http://xml.org/sax/features/external-general-entities
+ * http://xml.org/sax/features/external-parameter-entities

+ * + *

Introduced with SAX2

+ * + * @param name The name of the skipped entity. If it is a parameter entity, + * the name will begin with %, and if it is the external DTD subset, + * it will be the string [dtd]. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void skippedEntity + ( + const XMLCh* const name + ) ; + + //@} + + /** @name Default implementation of the EntityResolver interface. */ + + //@{ + /** + * Resolve an external entity. + * + *

Always return null, so that the parser will use the system + * identifier provided in the XML document. This method implements + * the SAX default behaviour: application writers can override it + * in a subclass to do special translations such as catalog lookups + * or URI redirection.

+ * + * @param publicId The public identifier, or null if none is + * available. + * @param systemId The system identifier provided in the XML + * document. + * @return The new input source, or null to require the + * default behaviour. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see EntityResolver#resolveEntity + */ + virtual InputSource* resolveEntity + ( + const XMLCh* const publicId + , const XMLCh* const systemId + ); + + //@} + + /** @name Default implementation of the ErrorHandler interface */ + //@{ + /** + * Receive notification of a recoverable parser error. + * + *

The default implementation does nothing. Application writers + * may override this method in a subclass to take specific actions + * for each error, such as inserting the message in a log file or + * printing it to the console.

+ * + * @param exc The warning information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#warning + * @see SAXParseException#SAXParseException + */ + virtual void error(const SAXParseException& exc); + + /** + * Report a fatal XML parsing error. + * + *

The default implementation throws a SAXParseException. + * Application writers may override this method in a subclass if + * they need to take specific actions for each fatal error (such as + * collecting all of the errors into a single report): in any case, + * the application must stop all regular processing when this + * method is invoked, since the document is no longer reliable, and + * the parser may no longer report parsing events.

+ * + * @param exc The error information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#fatalError + * @see SAXParseException#SAXParseException + */ + virtual void fatalError(const SAXParseException& exc); + + /** + * Receive notification of a parser warning. + * + *

The default implementation does nothing. Application writers + * may override this method in a subclass to take specific actions + * for each warning, such as inserting the message in a log file or + * printing it to the console.

+ * + * @param exc The warning information encoded as an exception. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @see ErrorHandler#warning + * @see SAXParseException#SAXParseException + */ + virtual void warning(const SAXParseException& exc); + + /** + * Reset the Error handler object on its reuse + * + * @see ErrorHandler#resetErrors + */ + virtual void resetErrors(); + + //@} + + + /** @name Default implementation of DTDHandler interface. */ + //@{ + + /** + * Receive notification of a notation declaration. + * + *

By default, do nothing. Application writers may override this + * method in a subclass if they wish to keep track of the notations + * declared in a document.

+ * + * @param name The notation name. + * @param publicId The notation public identifier, or null if not + * available. + * @param systemId The notation system identifier. + * @see DTDHandler#notationDecl + */ + virtual void notationDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ); + + /** + * Reset the DTD object on its reuse + * + * @see DTDHandler#resetDocType + */ + virtual void resetDocType(); + + /** + * Receive notification of an unparsed entity declaration. + * + *

By default, do nothing. Application writers may override this + * method in a subclass to keep track of the unparsed entities + * declared in a document.

+ * + * @param name The entity name. + * @param publicId The entity public identifier, or null if not + * available. + * @param systemId The entity system identifier. + * @param notationName The name of the associated notation. + * @see DTDHandler#unparsedEntityDecl + */ + virtual void unparsedEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + , const XMLCh* const notationName + ); + //@} + + + /** @name Default implementation of LexicalHandler interface. */ + + //@{ + /** + * Receive notification of comments. + * + *

The Parser will call this method to report each occurrence of + * a comment in the XML document.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void comment + ( + const XMLCh* const chars + , const XMLSize_t length + ); + + /** + * Receive notification of the end of a CDATA section. + * + *

The SAX parser will invoke this method at the end of + * each CDATA parsed.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endCDATA (); + + /** + * Receive notification of the end of the DTD declarations. + * + *

The SAX parser will invoke this method at the end of the + * DTD

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endDTD (); + + /** + * Receive notification of the end of an entity. + * + *

The SAX parser will invoke this method at the end of an + * entity

+ * + * @param name The name of the entity that is ending. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endEntity (const XMLCh* const name); + + /** + * Receive notification of the start of a CDATA section. + * + *

The SAX parser will invoke this method at the start of + * each CDATA parsed.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startCDATA (); + + /** + * Receive notification of the start of the DTD declarations. + * + *

The SAX parser will invoke this method at the start of the + * DTD

+ * + * @param name The document type name. + * @param publicId The declared public identifier for the external DTD subset, or null if none was declared. + * @param systemId The declared system identifier for the external DTD subset, or null if none was declared. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startDTD + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ); + + /** + * Receive notification of the start of an entity. + * + *

The SAX parser will invoke this method at the start of an + * entity

+ * + * @param name The name of the entity that is starting. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startEntity (const XMLCh* const name); + + //@} + + /** @name Default implementation of DeclHandler interface. */ + + //@{ + + /** + * Report an element type declaration. + * + *

The content model will consist of the string "EMPTY", the string + * "ANY", or a parenthesised group, optionally followed by an occurrence + * indicator. The model will be normalized so that all parameter entities + * are fully resolved and all whitespace is removed,and will include the + * enclosing parentheses. Other normalization (such as removing redundant + * parentheses or simplifying occurrence indicators) is at the discretion + * of the parser.

+ * + * @param name The element type name. + * @param model The content model as a normalized string. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void elementDecl + ( + const XMLCh* const name + , const XMLCh* const model + ); + + /** + * Report an attribute type declaration. + * + *

Only the effective (first) declaration for an attribute will + * be reported.

+ * + * @param eName The name of the associated element. + * @param aName The name of the attribute. + * @param type A string representing the attribute type. + * @param mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies. + * @param value A string representing the attribute's default value, or null if there is none. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void attributeDecl + ( + const XMLCh* const eName + , const XMLCh* const aName + , const XMLCh* const type + , const XMLCh* const mode + , const XMLCh* const value + ); + + /** + * Report an internal entity declaration. + * + *

Only the effective (first) declaration for each entity will be + * reported. All parameter entities in the value will be expanded, but + * general entities will not.

+ * + * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. + * @param value The replacement text of the entity. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void internalEntityDecl + ( + const XMLCh* const name + , const XMLCh* const value + ); + + /** + * Report a parsed external entity declaration. + * + *

Only the effective (first) declaration for each entity will + * be reported.

+ * + * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. + * @param publicId The The declared public identifier of the entity, or null if none was declared. + * @param systemId The declared system identifier of the entity. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void externalEntityDecl + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ); + + //@} + + DefaultHandler() {}; + virtual ~DefaultHandler() {}; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DefaultHandler(const DefaultHandler&); + DefaultHandler& operator=(const DefaultHandler&); +}; + + +// --------------------------------------------------------------------------- +// HandlerBase: Inline default implementations +// --------------------------------------------------------------------------- +inline void DefaultHandler::characters(const XMLCh* const + ,const XMLSize_t) +{ +} + +inline void DefaultHandler::endDocument() +{ +} + +inline void DefaultHandler::endElement(const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void DefaultHandler::error(const SAXParseException&) +{ +} + +inline void DefaultHandler::fatalError(const SAXParseException& exc) +{ + throw exc; +} + +inline void +DefaultHandler::ignorableWhitespace( const XMLCh* const + , const XMLSize_t) +{ +} + +inline void DefaultHandler::notationDecl( const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void +DefaultHandler::processingInstruction( const XMLCh* const + , const XMLCh* const) +{ +} + +inline void DefaultHandler::resetErrors() +{ +} + +inline void DefaultHandler::resetDocument() +{ +} + +inline void DefaultHandler::resetDocType() +{ +} + +inline InputSource* +DefaultHandler::resolveEntity( const XMLCh* const + , const XMLCh* const) +{ + return 0; +} + +inline void +DefaultHandler::unparsedEntityDecl(const XMLCh* const + , const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void DefaultHandler::setDocumentLocator(const Locator* const) +{ +} + +inline void DefaultHandler::startDocument() +{ +} + +inline void +DefaultHandler::startElement( const XMLCh* const + , const XMLCh* const + , const XMLCh* const + , const Attributes& +) +{ +} + +inline void DefaultHandler::warning(const SAXParseException&) +{ +} + +inline void DefaultHandler::startPrefixMapping ( const XMLCh* const + ,const XMLCh* const) +{ +} + +inline void DefaultHandler::endPrefixMapping ( const XMLCh* const) +{ +} + +inline void DefaultHandler::skippedEntity ( const XMLCh* const) +{ +} + +inline void DefaultHandler::comment( const XMLCh* const + , const XMLSize_t) +{ +} + +inline void DefaultHandler::endCDATA () +{ +} + +inline void DefaultHandler::endDTD () +{ +} + +inline void DefaultHandler::endEntity (const XMLCh* const) +{ +} + +inline void DefaultHandler::startCDATA () +{ +} + +inline void DefaultHandler::startDTD( const XMLCh* const + , const XMLCh* const + , const XMLCh* const) +{ +} + +inline void DefaultHandler::startEntity (const XMLCh* const) +{ +} + +inline void DefaultHandler::attributeDecl(const XMLCh* const, + const XMLCh* const, + const XMLCh* const, + const XMLCh* const, + const XMLCh* const) +{ +} + +inline void DefaultHandler::elementDecl(const XMLCh* const, + const XMLCh* const) +{ +} + +inline void DefaultHandler::externalEntityDecl(const XMLCh* const, + const XMLCh* const, + const XMLCh* const) +{ +} + +inline void DefaultHandler::internalEntityDecl(const XMLCh* const, + const XMLCh* const) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif // ! DEFAULTHANDLER_HPP diff --git a/project/jni/xerces/src/xercesc/sax2/LexicalHandler.hpp b/project/jni/xerces/src/xercesc/sax2/LexicalHandler.hpp new file mode 100644 index 000000000..96603e74d --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/LexicalHandler.hpp @@ -0,0 +1,172 @@ +/* + * 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: LexicalHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_LEXICALHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_LEXICALHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Receive notification of lexical events. + * + *

This is an extension handler for that provides lexical information + * about an XML document. It does not provide information about document + * content. For those events, an application must register an instance of + * a ContentHandler.

+ * + *

The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, startDTD() and endDTD() events will occur before the + * first element in the document.

+ * + * @see SAX2XMLReader#setLexicalHandler + * @see SAX2XMLReader#setContentHandler + */ + +class SAX2_EXPORT LexicalHandler +{ +public: + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + LexicalHandler() + { + } + + /** Destructor */ + virtual ~LexicalHandler() + { + } + //@} + + /** @name The virtual document handler interface */ + + //@{ + /** + * Receive notification of comments. + * + *

The Parser will call this method to report each occurrence of + * a comment in the XML document.

+ * + *

The application must not attempt to read from the array + * outside of the specified range.

+ * + * @param chars The characters from the XML document. + * @param length The number of characters to read from the array. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void comment + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + /** + * Receive notification of the end of a CDATA section. + * + *

The SAX parser will invoke this method at the end of + * each CDATA parsed.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endCDATA () = 0; + + /** + * Receive notification of the end of the DTD declarations. + * + *

The SAX parser will invoke this method at the end of the + * DTD

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endDTD () = 0; + + /** + * Receive notification of the end of an entity. + * + *

The SAX parser will invoke this method at the end of an + * entity

+ * + * @param name The name of the entity that is ending. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void endEntity (const XMLCh* const name) = 0; + + /** + * Receive notification of the start of a CDATA section. + * + *

The SAX parser will invoke this method at the start of + * each CDATA parsed.

+ * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startCDATA () = 0; + + /** + * Receive notification of the start of the DTD declarations. + * + *

The SAX parser will invoke this method at the start of the + * DTD

+ * + * @param name The document type name. + * @param publicId The declared public identifier for the external DTD subset, or null if none was declared. + * @param systemId The declared system identifier for the external DTD subset, or null if none was declared. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startDTD + ( + const XMLCh* const name + , const XMLCh* const publicId + , const XMLCh* const systemId + ) = 0; + + /** + * Receive notification of the start of an entity. + * + *

The SAX parser will invoke this method at the start of an + * entity

+ * + * @param name The name of the entity that is starting. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + */ + virtual void startEntity (const XMLCh* const name) = 0; + + //@} +private : + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + LexicalHandler(const LexicalHandler&); + /** Assignment operator */ + LexicalHandler& operator=(const LexicalHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/SAX2XMLFilter.hpp b/project/jni/xerces/src/xercesc/sax2/SAX2XMLFilter.hpp new file mode 100644 index 000000000..166d54483 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/SAX2XMLFilter.hpp @@ -0,0 +1,82 @@ +/* + * 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: SAX2XMLFilter.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLFILTER_HPP) +#define XERCESC_INCLUDE_GUARD_SAX2XMLFILTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class SAX2_EXPORT SAX2XMLFilter : public SAX2XMLReader +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** The default constructor */ + SAX2XMLFilter() + { + } + /** The destructor */ + virtual ~SAX2XMLFilter() + { + } + //@} + + //----------------------------------------------------------------------- + // The XMLFilter interface + //----------------------------------------------------------------------- + /** @name Implementation of SAX 2.0 XMLFilter interface's. */ + //@{ + + /** + * This method returns the parent XMLReader object. + * + * @return A pointer to the parent XMLReader object. + */ + virtual SAX2XMLReader* getParent() const = 0 ; + + /** + * Sets the parent XMLReader object; parse requests will be forwarded to this + * object, and callback notifications coming from it will be postprocessed + * + * @param parent The new XMLReader parent. + * @see SAX2XMLReader#SAX2XMLReader + */ + virtual void setParent(SAX2XMLReader* parent) = 0; + + //@} + +private : + /* The copy constructor, you cannot call this directly */ + SAX2XMLFilter(const SAX2XMLFilter&); + + /* The assignment operator, you cannot call this directly */ + SAX2XMLFilter& operator=(const SAX2XMLFilter&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/SAX2XMLReader.hpp b/project/jni/xerces/src/xercesc/sax2/SAX2XMLReader.hpp new file mode 100644 index 000000000..d09e7045e --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/SAX2XMLReader.hpp @@ -0,0 +1,893 @@ +/* + * 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: SAX2XMLReader.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP) +#define XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentHandler ; +class DTDHandler; +class EntityResolver; +class ErrorHandler; +class InputSource; +class LexicalHandler; +class DeclHandler; +class XMLDocumentHandler; + +class SAX2_EXPORT SAX2XMLReader +{ +public: + // ----------------------------------------------------------------------- + // Class types + // ----------------------------------------------------------------------- + /** @name Public constants */ + //@{ + + /** ValScheme enum used in setValidationScheme + * Val_Never: Do not report validation errors. + * Val_Always: The parser will always report validation errors. + * Val_Auto: The parser will report validation errors only if a grammar is specified. + * + * The schemes map to these feature values: + * Val_Never: + * parser->setFeature(XMLUni::fgSAX2CoreValidation, false); + * + * Val_Always: + * parser->setFeature(XMLUni::fgSAX2CoreValidation, true); + * parser->setFeature(XMLUni::fgXercesDynamic, false); + * + * Val_Auto: + * parser->setFeature(XMLUni::fgSAX2CoreValidation, true); + * parser->setFeature(XMLUni::fgXercesDynamic, true); + * + * @see #setFeature + */ + enum ValSchemes + { + Val_Never + , Val_Always + , Val_Auto + }; + //@} + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + /** The default constructor */ + SAX2XMLReader() + { + } + /** The destructor */ + virtual ~SAX2XMLReader() + { + } + //@} + + //----------------------------------------------------------------------- + // The XMLReader interface + //----------------------------------------------------------------------- + /** @name Implementation of SAX 2.0 XMLReader interface's. */ + //@{ + + /** + * This method returns the installed content handler. + * + * @return A pointer to the installed content handler object. + */ + virtual ContentHandler* getContentHandler() const = 0 ; + + /** + * This method returns the installed DTD handler. + * + * @return A pointer to the installed DTD handler object. + */ + virtual DTDHandler* getDTDHandler() const = 0; + + /** + * This method returns the installed entity resolver. + * + * @return A pointer to the installed entity resolver object. + */ + virtual EntityResolver* getEntityResolver() const = 0 ; + + /** + * This method returns the installed error handler. + * + * @return A pointer to the installed error handler object. + */ + virtual ErrorHandler* getErrorHandler() const = 0 ; + + /** + * Query the current state of any feature in a SAX2 XMLReader. + * + * @param name The unique identifier (URI) of the feature being set. + * @return The current state of the feature. + * @exception SAXNotRecognizedException If the requested feature is not known. + */ + virtual bool getFeature(const XMLCh* const name) const = 0; + + /** + * Query the current value of a property in a SAX2 XMLReader. + * + * The parser owns the returned pointer. The memory allocated for + * the returned pointer will be destroyed when the parser is deleted. + * + * To ensure accessibility of the returned information after the parser + * is deleted, callers need to copy and store the returned information + * somewhere else; otherwise you may get unexpected result. Since the returned + * pointer is a generic void pointer, see the SAX2 Programming Guide to learn + * exactly what type of property value each property returns for replication. + * + * @param name The unique identifier (URI) of the property being set. + * @return The current value of the property. The pointer spans the same + * life-time as the parser. A null pointer is returned if nothing + * was specified externally. + * @exception SAXNotRecognizedException If the requested property is not known. + */ + virtual void* getProperty(const XMLCh* const name) const = 0 ; + + /** + * Allow an application to register a document event handler. + * + * If the application does not register a document handler, all + * document events reported by the SAX parser will be silently + * ignored (this is the default behaviour implemented by + * HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The document handler. + * @see ContentHandler#ContentHandler + * @see HandlerBase#HandlerBase + */ + virtual void setContentHandler(ContentHandler* const handler) = 0; + + /** + * Allow an application to register a DTD event handler. + * + * If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored (this + * is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the middle + * of a parse, and the SAX parser must begin using the new handler + * immediately. + * + * @param handler The DTD handler. + * @see DTDHandler#DTDHandler + * @see HandlerBase#HandlerBase + */ + virtual void setDTDHandler(DTDHandler* const handler) = 0; + + /** + * Allow an application to register a custom entity resolver. + * + * If the application does not register an entity resolver, the + * SAX parser will resolve system identifiers and open connections + * to entities itself (this is the default behaviour implemented in + * DefaultHandler). + * + * Applications may register a new or different entity resolver + * in the middle of a parse, and the SAX parser must begin using + * the new resolver immediately. + * + * @param resolver The object for resolving entities. + * @see EntityResolver#EntityResolver + * @see DefaultHandler#DefaultHandler + */ + virtual void setEntityResolver(EntityResolver* const resolver) = 0; + + /** + * Allow an application to register an error event handler. + * + * If the application does not register an error event handler, + * all error events reported by the SAX parser will be silently + * ignored, except for fatalError, which will throw a SAXException + * (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see ErrorHandler#ErrorHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setErrorHandler(ErrorHandler* const handler) = 0; + + /** + * Set the state of any feature in a SAX2 XMLReader. + * Supported features in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://xml.org/sax/features/validation (default: true) + *
http://xml.org/sax/features/namespaces (default: true) + *
http://xml.org/sax/features/namespace-prefixes (default: false) + *
http://apache.org/xml/features/validation/dynamic (default: false) + *
http://apache.org/xml/features/validation/reuse-grammar (default: false) + *
http://apache.org/xml/features/validation/schema (default: true) + *
http://apache.org/xml/features/validation/schema-full-checking (default: false) + *
http://apache.org/xml/features/validating/load-schema (default: true) + *
http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true) + *
http://apache.org/xml/features/continue-after-fatal-error (default: false) + *
http://apache.org/xml/features/validation-error-as-fatal (default: false) + * + * @param name The unique identifier (URI) of the feature. + * @param value The requested state of the feature (true or false). + * @exception SAXNotRecognizedException If the requested feature is not known. + * @exception SAXNotSupportedException Feature modification is not supported during parse + * + */ + virtual void setFeature(const XMLCh* const name, const bool value) = 0; + + /** + * Set the value of any property in a SAX2 XMLReader. + * Supported properties in SAX2 for xerces-c are: + *
(See the SAX2 Programming Guide for detail description). + * + *
http://apache.org/xml/properties/schema/external-schemaLocation + *
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation. + * + * It takes a void pointer as the property value. Application is required to initialize this void + * pointer to a correct type. See the SAX2 Programming Guide + * to learn exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. + * If the same property is set more than once, the last one takes effect. + * + * @param name The unique identifier (URI) of the property being set. + * @param value The requested value for the property. See + * the SAX2 Programming Guide to learn + * exactly what type of property value each property expects for processing. + * Passing a void pointer that was initialized with a wrong type will lead + * to unexpected result. + * @exception SAXNotRecognizedException If the requested property is not known. + * @exception SAXNotSupportedException Property modification is not supported during parse + */ + virtual void setProperty(const XMLCh* const name, void* value) = 0 ; + + /** + * Parse an XML document. + * + * The application can use this method to instruct the SAX parser + * to begin parsing an XML document from any valid input + * source (a character stream, a byte stream, or a URI). + * + * Applications may not invoke this method while a parse is in + * progress (they should create a new Parser instead for each + * additional XML document). Once a parse is complete, an + * application may reuse the same Parser object, possibly with a + * different input source. + * + * @param source The input source for the top-level of the + * XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see InputSource#InputSource + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + */ + virtual void parse + ( + const InputSource& source + ) = 0; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(const InputSource&) + */ + virtual void parse + ( + const XMLCh* const systemId + ) = 0; + + /** + * Parse an XML document from a system identifier (URI). + * + * This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact equivalent + * of the following: + * + * parse(new URLInputSource(systemId)); + * + * If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser. + * + * @param systemId The system identifier (URI). + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @see #parse(const InputSource&) + */ + virtual void parse + ( + const char* const systemId + ) = 0; + + //@} + + // ----------------------------------------------------------------------- + // SAX 2.0-ext + // ----------------------------------------------------------------------- + /** @name SAX 2.0-ext */ + //@{ + /** + * This method returns the installed declaration handler. + * + * @return A pointer to the installed declaration handler object. + */ + virtual DeclHandler* getDeclarationHandler() const = 0 ; + + /** + * This method returns the installed lexical handler. + * + * @return A pointer to the installed lexical handler object. + */ + virtual LexicalHandler* getLexicalHandler() const = 0 ; + + /** + * Allow an application to register a declaration event handler. + * + * If the application does not register a declaration handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by DefaultHandler). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The DTD declaration handler. + * @see DeclHandler#DeclHandler + * @see SAXException#SAXException + * @see DefaultHandler#DefaultHandler + */ + virtual void setDeclarationHandler(DeclHandler* const handler) = 0; + + /** + * Allow an application to register a lexical event handler. + * + * If the application does not register a lexical handler, + * all events reported by the SAX parser will be silently + * ignored. (this is the default behaviour implemented by HandlerBase). + * + * Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately. + * + * @param handler The error handler. + * @see LexicalHandler#LexicalHandler + * @see SAXException#SAXException + * @see HandlerBase#HandlerBase + */ + virtual void setLexicalHandler(LexicalHandler* const handler) = 0; + + //@} + + // ----------------------------------------------------------------------- + // Getter Methods + // ----------------------------------------------------------------------- + /** @name Getter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to get the current validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @return A pointer to the validator. An application should not deleted + * the object returned. + * + */ + virtual XMLValidator* getValidator() const = 0; + + /** Get error count from the last parse operation. + * + * This method returns the error count from the last parse + * operation. Note that this count is actually stored in the + * scanner, so this method simply returns what the + * scanner reports. + * + * @return number of errors encountered during the latest + * parse operation. + */ + virtual XMLSize_t getErrorCount() const = 0 ; + + /** + * This method returns the state of the parser's + * exit-on-First-Fatal-Error flag. + * + *

Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which indicates the opposite state.

+ * + * @return true, if the parser is currently configured to + * exit on the first fatal error, false otherwise. + * + * @see #setExitOnFirstFatalError + * @see #getFeature + */ + virtual bool getExitOnFirstFatalError() const = 0; + + /** + * This method returns the state of the parser's + * validation-constraint-fatal flag. + * + *

Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing. + * + * @return true, if the parser is currently configured to + * set validation constraint errors as fatal, false + * otherwise. + * + * @see #setValidationConstraintFatal + * @see #getFeature + */ + virtual bool getValidationConstraintFatal() const = 0; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param nameSpaceKey Namespace key + * @return Grammar associated with the Namespace key. + */ + virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0; + + /** + * Retrieve the grammar where the root element is declared. + * + * @return Grammar where root element declared + */ + virtual Grammar* getRootGrammar() = 0; + + /** + * Returns the string corresponding to a URI id from the URI string pool. + * + * @param uriId id of the string in the URI string pool. + * @return URI string corresponding to the URI id. + */ + virtual const XMLCh* getURIText(unsigned int uriId) const = 0; + + /** + * Returns the current src offset within the input source. + * To be used only while parsing is in progress. + * + * @return offset within the input source + */ + virtual XMLFilePos getSrcOffset() const = 0; + + //@} + + // ----------------------------------------------------------------------- + // Setter Methods + // ----------------------------------------------------------------------- + /** @name Setter Methods (Xerces-C specific) */ + //@{ + /** + * This method is used to set a validator. + * + * SAX2XMLReader assumes responsibility for the validator. It will be + * deleted when the XMLReader is destroyed. + * + * @param valueToAdopt A pointer to the validator that the reader should use. + * + */ + virtual void setValidator(XMLValidator* valueToAdopt) = 0; + + /** + * This method allows users to set the parser's behaviour when it + * encounters the first fatal error. If set to true, the parser + * will exit at the first fatal error. If false, then it will + * report the error and continue processing. + * + *

The default value is 'true' and the parser exits on the + * first fatal error.

+ * + *

Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error" + * which has the opposite behaviour.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState The value specifying whether the parser should + * continue or exit when it encounters the first + * fatal error. + * + * @see #getExitOnFirstFatalError + * @see #setFeature + */ + virtual void setExitOnFirstFatalError(const bool newState) = 0; + + /** + * This method allows users to set the parser's behaviour when it + * encounters a validation constraint error. If set to true, and the + * the parser will treat validation error as fatal and will exit depends on the + * state of "getExitOnFirstFatalError". If false, then it will + * report the error and continue processing. + * + * Note: setting this true does not mean the validation error will be printed with + * the word "Fatal Error". It is still printed as "Error", but the parser + * will exit if "setExitOnFirstFatalError" is set to true. + * + *

The default value is 'false'.

+ * + *

Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal" + * which means the same thing.

+ * + *

If both the feature above and this function are used, the latter takes effect.

+ * + * @param newState If true, the parser will exit if "setExitOnFirstFatalError" + * is set to true. + * + * @see #getValidationConstraintFatal + * @see #setExitOnFirstFatalError + * @see #setFeature + */ + virtual void setValidationConstraintFatal(const bool newState) = 0; + //@} + + + // ----------------------------------------------------------------------- + // Progressive scan methods + // ----------------------------------------------------------------------- + + /** @name Progressive scan methods */ + //@{ + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a Unicode string representing the path + * to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could parse the + * prolog (which means the token will not be valid.) + * + * @see #parseNext + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const XMLCh* const systemId + , XMLPScanToken& toFill + ) = 0; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param systemId A pointer to a regular native string representing + * the path to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseFirst + ( + const char* const systemId + , XMLPScanToken& toFill + ) = 0; + + /** Begin a progressive parse operation + * + * This method is used to start a progressive parse on a XML file. + * To continue parsing, subsequent calls must be to the parseNext + * method. + * + * It scans through the prolog and returns a token to be used on + * subsequent scanNext() calls. If the return value is true, then the + * token is legal and ready for further use. If it returns false, then + * the scan of the prolog failed and the token is not going to work on + * subsequent scanNext() calls. + * + * @param source A const reference to the InputSource object which + * points to the XML file to be parsed. + * @param toFill A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the prolog. It indicates the + * user can go ahead with parsing the rest of the file. It + * returns 'false' to indicate that the parser could not parse + * the prolog. + * + * @see #parseNext + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + */ + virtual bool parseFirst + ( + const InputSource& source + , XMLPScanToken& toFill + ) = 0; + + /** Continue a progressive parse operation + * + * This method is used to continue with progressive parsing of + * XML files started by a call to 'parseFirst' method. + * + * It parses the XML file and stops as soon as it comes across + * a XML token (as defined in the XML specification). Relevant + * callback handlers are invoked as required by the SAX + * specification. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + * + * @return 'true', if successful in parsing the next XML token. + * It indicates the user can go ahead with parsing the rest + * of the file. It returns 'false' to indicate that the parser + * could not find next token as per the XML specification + * production rule. + * + * @see #parseFirst(XMLCh*,...) + * @see #parseFirst(char*,...) + * @see #parseFirst(InputSource&,...) + */ + virtual bool parseNext(XMLPScanToken& token) = 0; + + /** Reset the parser after a progressive parse + * + * If a progressive parse loop exits before the end of the document + * is reached, the parser has no way of knowing this. So it will leave + * open any files or sockets or memory buffers that were in use at + * the time that the parse loop exited. + * + * The next parse operation will cause these open files and such to + * be closed, but the next parse operation might occur at some unknown + * future point. To avoid this problem, you should reset the parser if + * you exit the loop early. + * + * If you exited because of an error, then this cleanup will be done + * for you. Its only when you exit the file prematurely of your own + * accord, because you've found what you wanted in the file most + * likely. + * + * @param token A token maintaing state information to maintain + * internal consistency between invocation of 'parseNext' + * calls. + */ + virtual void parseReset(XMLPScanToken& token) = 0; + + //@} + + // ----------------------------------------------------------------------- + // Grammar preparsing interface + // ----------------------------------------------------------------------- + + /** @name Grammar preparsing interface's. */ + //@{ + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via an input source + * object. + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the SAX InputSource parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param source A const reference to the SAX InputSource object which + * points to the schema grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + * + * @see InputSource#InputSource + */ + virtual Grammar* loadGrammar(const InputSource& source, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const XMLCh pointer to the Unicode string which + * contains the path to the XML grammar file to be + * preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const XMLCh* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL + * + * This method invokes the preparsing process on a schema grammar XML + * file specified by the file path parameter. If the 'toCache' flag + * is enabled, the parser will cache the grammars for re-use. If a grammar + * key is found in the pool, no caching of any grammar will take place. + * + * + * @param systemId A const char pointer to a native string which contains + * the path to the XML grammar file to be preparsed. + * @param grammarType The grammar type (Schema or DTD). + * @param toCache If true, we cache the preparsed grammar, + * otherwise, no caching. Default is false. + * @return The preparsed schema grammar object (SchemaGrammar or + * DTDGrammar). That grammar object is owned by the parser. + * + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception XMLException An exception from the parser or client + * handler code. + * @exception DOMException A DOM exception as per DOM spec. + */ + virtual Grammar* loadGrammar(const char* const systemId, + const Grammar::GrammarType grammarType, + const bool toCache = false) = 0; + + /** + * Clear the cached grammar pool + */ + virtual void resetCachedGrammarPool() = 0; + + /** Set maximum input buffer size + * + * This method allows users to limit the size of buffers used in parsing + * XML character data. The effect of setting this size is to limit the + * size of a ContentHandler::characters() call. + * + * The parser's default input buffer size is 1 megabyte. + * + * @param bufferSize The maximum input buffer size + */ + virtual void setInputBufferSize(const XMLSize_t bufferSize); + + //@} + + + // ----------------------------------------------------------------------- + // Advanced document handler list maintenance methods + // ----------------------------------------------------------------------- + + /** @name Advanced document handler list maintenance methods */ + //@{ + /** + * This method installs the specified 'advanced' document callback + * handler, thereby allowing the user to customize the processing, + * if they choose to do so. Any number of advanced callback handlers + * maybe installed. + * + *

The methods in the advanced callback interface represent + * Xerces-C extensions. There is no specification for this interface.

+ * + * @param toInstall A pointer to the users advanced callback handler. + * + * @see #removeAdvDocHandler + */ + virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0; + + /** + * This method removes the 'advanced' document handler callback from + * the underlying parser scanner. If no handler is installed, advanced + * callbacks are not invoked by the scanner. + * @param toRemove A pointer to the advanced callback handler which + * should be removed. + * + * @see #installAdvDocHandler + */ + virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0; + //@} + +private : + /* The copy constructor, you cannot call this directly */ + SAX2XMLReader(const SAX2XMLReader&); + + /* The assignment operator, you cannot call this directly */ + SAX2XMLReader& operator=(const SAX2XMLReader&); + +}; + +inline void SAX2XMLReader::setInputBufferSize(const XMLSize_t /*bufferSize*/) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/XMLReaderFactory.hpp b/project/jni/xerces/src/xercesc/sax2/XMLReaderFactory.hpp new file mode 100644 index 000000000..a67462534 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/XMLReaderFactory.hpp @@ -0,0 +1,71 @@ +/* + * 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: XMLReaderFactory.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLREADERFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_XMLREADERFACTORY_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class MemoryManager; +class XMLGrammarPool; + +/** + * Creates a SAX2 parser (SAX2XMLReader). + * + *

Note: The parser object returned by XMLReaderFactory is owned by the + * calling users, and it's the responsibility of the users to delete that + * parser object, once they no longer need it.

+ * + * @see SAX2XMLReader#SAX2XMLReader + */ +class SAX2_EXPORT XMLReaderFactory +{ +protected: // really should be private, but that causes compiler warnings. + XMLReaderFactory() ; + ~XMLReaderFactory() ; + +public: + static SAX2XMLReader * createXMLReader( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ) ; + static SAX2XMLReader * createXMLReader(const XMLCh* className) ; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLReaderFactory(const XMLReaderFactory&); + XMLReaderFactory& operator=(const XMLReaderFactory&); +}; + +inline SAX2XMLReader * XMLReaderFactory::createXMLReader(const XMLCh *) +{ + throw SAXNotSupportedException(); + // unimplemented + return 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/sax2/sax2Dummy.cpp b/project/jni/xerces/src/xercesc/sax2/sax2Dummy.cpp new file mode 100644 index 000000000..bf7f8e481 --- /dev/null +++ b/project/jni/xerces/src/xercesc/sax2/sax2Dummy.cpp @@ -0,0 +1,30 @@ +/* + * 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: sax2Dummy.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/ArrayIndexOutOfBoundsException.hpp b/project/jni/xerces/src/xercesc/util/ArrayIndexOutOfBoundsException.hpp new file mode 100644 index 000000000..5d9aa67d1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ArrayIndexOutOfBoundsException.hpp @@ -0,0 +1,33 @@ +/* + * 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: ArrayIndexOutOfBoundsException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ARRAYINDEXOUTOFBOUNDSEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_ARRAYINDEXOUTOFBOUNDSEXCEPTION_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(ArrayIndexOutOfBoundsException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Base64.cpp b/project/jni/xerces/src/xercesc/util/Base64.cpp new file mode 100644 index 000000000..fbd583757 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Base64.cpp @@ -0,0 +1,636 @@ +/* + * 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. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- +static const int BASELENGTH = 255; +static const int FOURBYTE = 4; + +// --------------------------------------------------------------------------- +// class data member +// --------------------------------------------------------------------------- + +// the base64 alphabet according to definition in RFC 2045 +const XMLByte Base64::base64Alphabet[] = { + chLatin_A, chLatin_B, chLatin_C, chLatin_D, chLatin_E, + chLatin_F, chLatin_G, chLatin_H, chLatin_I, chLatin_J, + chLatin_K, chLatin_L, chLatin_M, chLatin_N, chLatin_O, + chLatin_P, chLatin_Q, chLatin_R, chLatin_S, chLatin_T, + chLatin_U, chLatin_V, chLatin_W, chLatin_X, chLatin_Y, chLatin_Z, + chLatin_a, chLatin_b, chLatin_c, chLatin_d, chLatin_e, + chLatin_f, chLatin_g, chLatin_h, chLatin_i, chLatin_j, + chLatin_k, chLatin_l, chLatin_m, chLatin_n, chLatin_o, + chLatin_p, chLatin_q, chLatin_r, chLatin_s, chLatin_t, + chLatin_u, chLatin_v, chLatin_w, chLatin_x, chLatin_y, chLatin_z, + chDigit_0, chDigit_1, chDigit_2, chDigit_3, chDigit_4, + chDigit_5, chDigit_6, chDigit_7, chDigit_8, chDigit_9, + chPlus, chForwardSlash, chNull +}; + +// This is an inverse table for base64 decoding. So, if +// base64Alphabet[17] = 'R', then base64Inverse['R'] = 17. +// +// For characters not in base64Alphabet then +// base64Inverse[ch] = 0xFF. +const XMLByte Base64::base64Inverse[BASELENGTH] = +{ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, + 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; + +const XMLByte Base64::base64Padding = chEqual; + +/*** + * + * Memory Management Issue: + * + * . For memory allocated for result returned to caller (external memory), + * the plugged memory manager is used if it is provided, otherwise global + * new used to retain the pre-memory-manager behaviour. + * + * . For memory allocated for temperary buffer (internal memory), + * XMLPlatformUtils::fgMemoryManager is used. + * + */ + +static void* getExternalMemory( MemoryManager* const allocator + , XMLSize_t const sizeToAllocate) +{ + return allocator ? allocator->allocate(sizeToAllocate) + : ::operator new(sizeToAllocate); +} + +/*** + * internal memory is deallocated by janitorArray + */ +static void returnExternalMemory( MemoryManager* const allocator + , void* buffer) +{ + allocator ? allocator->deallocate(buffer) + : ::operator delete(buffer); +} + +/** + * E2-9 + * + * Canonical-base64Binary ::= (B64line* B64lastline)? + * + * B64line ::= B64x15 B64x15 B64x15 B64x15 B64x15 B64 #xA + * 76 Base64 characters followed by newline + * + * B64x15 ::= B64 B64 B64 B64 B64 + * B64 B64 B64 B64 B64 + * B64 B64 B64 B64 B64 + * + * B64lastline ::= B64x4? B64x4? B64x4? B64x4? + * B64x4? B64x4? B64x4? B64x4? + * B64x4? B64x4? B64x4? B64x4? + * B64x4? B64x4? B64x4? B64x4? + * B64x4? B64x4? + * (B64x4 | (B64 B64 B16 '=') | (B64 B04 '==')) + * #xA + * + * B64x4 ::= B64 B64 B64 B64 + * B04 ::= [AQgw] + * B16 ::= [AEIMQUYcgkosw048] +*/ + +// number of quadruplets per one line ( must be >1 and <19 ) +const unsigned int Base64::quadsPerLine = 15; + +XMLByte* Base64::encode(const XMLByte* const inputData + , const XMLSize_t inputLength + , XMLSize_t* outputLength + , MemoryManager* const memMgr) +{ + if (!inputData || !outputLength) + return 0; + + int quadrupletCount = ( (int)inputLength + 2 ) / 3; + if (quadrupletCount == 0) + return 0; + + // number of rows in encoded stream ( including the last one ) + int lineCount = ( quadrupletCount + quadsPerLine-1 ) / quadsPerLine; + + // + // convert the triplet(s) to quadruplet(s) + // + XMLByte b1, b2, b3, b4; // base64 binary codes ( 0..63 ) + + XMLSize_t inputIndex = 0; + XMLSize_t outputIndex = 0; + XMLByte *encodedData = (XMLByte*) getExternalMemory(memMgr, (quadrupletCount*FOURBYTE+lineCount+1) * sizeof(XMLByte)); + + // + // Process all quadruplet(s) except the last + // + int quad = 1; + for (; quad <= quadrupletCount-1; quad++ ) + { + // read triplet from the input stream + split1stOctet( inputData[ inputIndex++ ], b1, b2 ); + split2ndOctet( inputData[ inputIndex++ ], b2, b3 ); + split3rdOctet( inputData[ inputIndex++ ], b3, b4 ); + + // write quadruplet to the output stream + encodedData[ outputIndex++ ] = base64Alphabet[ b1 ]; + encodedData[ outputIndex++ ] = base64Alphabet[ b2 ]; + encodedData[ outputIndex++ ] = base64Alphabet[ b3 ]; + encodedData[ outputIndex++ ] = base64Alphabet[ b4 ]; + + if (( quad % quadsPerLine ) == 0 ) + encodedData[ outputIndex++ ] = chLF; + } + + // + // process the last Quadruplet + // + // first octet is present always, process it + split1stOctet( inputData[ inputIndex++ ], b1, b2 ); + encodedData[ outputIndex++ ] = base64Alphabet[ b1 ]; + + if( inputIndex < inputLength ) + { + // second octet is present, process it + split2ndOctet( inputData[ inputIndex++ ], b2, b3 ); + encodedData[ outputIndex++ ] = base64Alphabet[ b2 ]; + + if( inputIndex < inputLength ) + { + // third octet present, process it + // no PAD e.g. 3cQl + split3rdOctet( inputData[ inputIndex++ ], b3, b4 ); + encodedData[ outputIndex++ ] = base64Alphabet[ b3 ]; + encodedData[ outputIndex++ ] = base64Alphabet[ b4 ]; + } + else + { + // third octet not present + // one PAD e.g. 3cQ= + encodedData[ outputIndex++ ] = base64Alphabet[ b3 ]; + encodedData[ outputIndex++ ] = base64Padding; + } + } + else + { + // second octet not present + // two PADs e.g. 3c== + encodedData[ outputIndex++ ] = base64Alphabet[ b2 ]; + encodedData[ outputIndex++ ] = base64Padding; + encodedData[ outputIndex++ ] = base64Padding; + } + + // write out end of the last line + encodedData[ outputIndex++ ] = chLF; + // write out end of string + encodedData[ outputIndex ] = 0; + + *outputLength = outputIndex; + + return encodedData; +} + +// +// delete the buffer allocated by decode() if +// decoding is successfully done. +// +// In previous version, we use XMLString::strLen(decodedData) +// to get the length, this will fail for test case containing +// consequtive "A", such "AAFF", or "ab56AA56". Instead of +// returning 3/6, we have 0 and 3, indicating that "AA", after +// decoded, is interpreted as by the strLen(). +// +// Since decode() has track of length of the decoded data, we +// will get this length from decode(), instead of strLen(). +// +int Base64::getDataLength(const XMLCh* const inputData + , MemoryManager* const manager + , Conformance conform ) + +{ + XMLSize_t retLen = 0; + XMLByte* decodedData = decodeToXMLByte(inputData, &retLen, manager, conform); + + if ( !decodedData ) + return -1; + else + { + returnExternalMemory(manager, decodedData); + return (int)retLen; + } +} + +XMLByte* Base64::decode(const XMLByte* const inputData + , XMLSize_t* decodedLength + , MemoryManager* const memMgr + , Conformance conform ) +{ + XMLByte* canRepInByte = 0; + XMLByte* retStr = decode( + inputData + , decodedLength + , canRepInByte + , memMgr + , conform); + + /*** + * Release the canRepData + */ + if (retStr) + returnExternalMemory(memMgr, canRepInByte); + + return retStr; +} + + +XMLByte* Base64::decodeToXMLByte(const XMLCh* const inputData + , XMLSize_t* decodedLen + , MemoryManager* const memMgr + , Conformance conform ) +{ + if (!inputData || !*inputData) + return 0; + + /*** + * Move input data to a XMLByte buffer + */ + XMLSize_t srcLen = XMLString::stringLen(inputData); + XMLByte *dataInByte = (XMLByte*) getExternalMemory(memMgr, (srcLen+1) * sizeof(XMLByte)); + ArrayJanitor janFill(dataInByte, memMgr ? memMgr : XMLPlatformUtils::fgMemoryManager); + + for (XMLSize_t i = 0; i < srcLen; i++) + dataInByte[i] = (XMLByte)inputData[i]; + + dataInByte[srcLen] = 0; + + /*** + * Forward to the actual decoding method to do the decoding + */ + *decodedLen = 0; + return decode(dataInByte, decodedLen, memMgr, conform); +} + +/*** +* E2-54 +* +* Canonical-base64Binary ::= (B64 B64 B64 B64)*((B64 B64 B16 '=')|(B64 B04 '=='))? +* B04 ::= [AQgw] +* B16 ::= [AEIMQUYcgkosw048] +* B64 ::= [A-Za-z0-9+/] +* +***/ +XMLCh* Base64::getCanonicalRepresentation(const XMLCh* const inputData + , MemoryManager* const memMgr + , Conformance conform) + +{ + if (!inputData || !*inputData) + return 0; + + /*** + * Move input data to a XMLByte buffer + */ + XMLSize_t srcLen = XMLString::stringLen(inputData); + XMLByte *dataInByte = (XMLByte*) getExternalMemory(memMgr, (srcLen+1) * sizeof(XMLByte)); + ArrayJanitor janFill(dataInByte, memMgr ? memMgr : XMLPlatformUtils::fgMemoryManager); + + for (XMLSize_t i = 0; i < srcLen; i++) + dataInByte[i] = (XMLByte)inputData[i]; + + dataInByte[srcLen] = 0; + + /*** + * Forward to the actual decoding method to do the decoding + */ + XMLSize_t decodedLength = 0; + XMLByte* canRepInByte = 0; + XMLByte* retStr = decode( + dataInByte + , &decodedLength + , canRepInByte + , memMgr + , conform); + + if (!retStr) + return 0; + + /*** + * Move canonical representation to a XMLCh buffer to return + */ + XMLSize_t canRepLen = XMLString::stringLen((char*)canRepInByte); + XMLCh *canRepData = (XMLCh*) getExternalMemory(memMgr, (canRepLen + 1) * sizeof(XMLCh)); + + for (XMLSize_t j = 0; j < canRepLen; j++) + canRepData[j] = (XMLCh)canRepInByte[j]; + + canRepData[canRepLen] = 0; + + /*** + * Release the memory allocated in the actual decoding method + */ + returnExternalMemory(memMgr, retStr); + returnExternalMemory(memMgr, canRepInByte); + + return canRepData; +} +// ----------------------------------------------------------------------- +// Helper methods +// ----------------------------------------------------------------------- + +// +// return 0(null) if invalid data found. +// return the buffer containning decoded data otherwise +// the caller is responsible for the de-allocation of the +// buffer returned. +// +// temporary data, rawInputData, is ALWAYS released by this function. +// + +/*** + * E2-9 + * + * Base64Binary ::= S? B64quartet* B64final? + * + * B64quartet ::= B64 S? B64 S? B64 S? B64 S? + * + * B64final ::= B64 S? B04 S? '=' S? '=' S? + * | B64 S? B64 S? B16 S? '=' S? + * + * B04 ::= [AQgw] + * B16 ::= [AEIMQUYcgkosw048] + * B64 ::= [A-Za-z0-9+/] + * + * + * E2-54 + * + * Base64Binary ::= ((B64S B64S B64S B64S)* + * ((B64S B64S B64S B64) | + * (B64S B64S B16S '=') | + * (B64S B04S '=' #x20? '=')))? + * + * B64S ::= B64 #x20? + * B16S ::= B16 #x20? + * B04S ::= B04 #x20? + * + * + * Note that this grammar requires the number of non-whitespace characters + * in the lexical form to be a multiple of four, and for equals signs to + * appear only at the end of the lexical form; strings which do not meet these + * constraints are not legal lexical forms of base64Binary because they + * cannot successfully be decoded by base64 decoders. + * + * Note: + * The above definition of the lexical space is more restrictive than that given + * in [RFC 2045] as regards whitespace -- this is not an issue in practice. Any + * string compatible with the RFC can occur in an element or attribute validated + * by this type, because the whiteSpace facet of this type is fixed to collapse, + * which means that all leading and trailing whitespace will be stripped, and all + * internal whitespace collapsed to single space characters, before the above grammar + * is enforced. + * +*/ + +XMLByte* Base64::decode ( const XMLByte* const inputData + , XMLSize_t* decodedLength + , XMLByte*& canRepData + , MemoryManager* const memMgr + , Conformance conform + ) +{ + if ((!inputData) || (!*inputData)) + return 0; + + // + // remove all XML whitespaces from the base64Data + // + XMLSize_t inputLength = XMLString::stringLen( (const char*)inputData ); + XMLByte* rawInputData = (XMLByte*) getExternalMemory(memMgr, (inputLength+1) * sizeof(XMLByte)); + ArrayJanitor jan(rawInputData, memMgr ? memMgr : XMLPlatformUtils::fgMemoryManager); + + XMLSize_t inputIndex = 0; + XMLSize_t rawInputLength = 0; + bool inWhiteSpace = false; + + switch (conform) + { + case Conf_RFC2045: + while ( inputIndex < inputLength ) + { + if (!XMLChar1_0::isWhitespace(inputData[inputIndex])) + { + rawInputData[ rawInputLength++ ] = inputData[ inputIndex ]; + } + // RFC2045 does not explicitly forbid more than ONE whitespace + // before, in between, or after base64 octects. + // Besides, S? allows more than ONE whitespace as specified in the production + // [3] S ::= (#x20 | #x9 | #xD | #xA)+ + // therefore we do not detect multiple ws + + inputIndex++; + } + + break; + case Conf_Schema: + // no leading #x20 + if (chSpace == inputData[inputIndex]) + return 0; + + while ( inputIndex < inputLength ) + { + if (chSpace != inputData[inputIndex]) + { + rawInputData[ rawInputLength++ ] = inputData[ inputIndex ]; + inWhiteSpace = false; + } + else + { + if (inWhiteSpace) + return 0; // more than 1 #x20 encountered + else + inWhiteSpace = true; + } + + inputIndex++; + } + + // no trailing #x20 + if (inWhiteSpace) + return 0; + + break; + + default: + break; + } + + //now rawInputData contains canonical representation + //if the data is valid Base64 + rawInputData[ rawInputLength ] = 0; + + // the length of raw data should be divisible by four + if (( rawInputLength % FOURBYTE ) != 0 ) + return 0; + + int quadrupletCount = (int)rawInputLength / FOURBYTE; + if ( quadrupletCount == 0 ) + return 0; + + // + // convert the quadruplet(s) to triplet(s) + // + XMLByte d1, d2, d3, d4; // base64 characters + XMLByte b1, b2, b3, b4; // base64 binary codes ( 0..64 ) + + XMLSize_t rawInputIndex = 0; + XMLSize_t outputIndex = 0; + XMLByte *decodedData = (XMLByte*) getExternalMemory(memMgr, (quadrupletCount*3+1) * sizeof(XMLByte)); + + // + // Process all quadruplet(s) except the last + // + int quad = 1; + for (; quad <= quadrupletCount-1; quad++ ) + { + // read quadruplet from the input stream + if (!isData( (d1 = rawInputData[ rawInputIndex++ ]) ) || + !isData( (d2 = rawInputData[ rawInputIndex++ ]) ) || + !isData( (d3 = rawInputData[ rawInputIndex++ ]) ) || + !isData( (d4 = rawInputData[ rawInputIndex++ ]) )) + { + // if found "no data" just return NULL + returnExternalMemory(memMgr, decodedData); + return 0; + } + + b1 = base64Inverse[ d1 ]; + b2 = base64Inverse[ d2 ]; + b3 = base64Inverse[ d3 ]; + b4 = base64Inverse[ d4 ]; + + // write triplet to the output stream + decodedData[ outputIndex++ ] = set1stOctet(b1, b2); + decodedData[ outputIndex++ ] = set2ndOctet(b2, b3); + decodedData[ outputIndex++ ] = set3rdOctet(b3, b4); + } + + // + // process the last Quadruplet + // + // first two octets are present always, process them + if (!isData( (d1 = rawInputData[ rawInputIndex++ ]) ) || + !isData( (d2 = rawInputData[ rawInputIndex++ ]) )) + { + // if found "no data" just return NULL + returnExternalMemory(memMgr, decodedData); + return 0; + } + + b1 = base64Inverse[ d1 ]; + b2 = base64Inverse[ d2 ]; + + // try to process last two octets + d3 = rawInputData[ rawInputIndex++ ]; + d4 = rawInputData[ rawInputIndex++ ]; + + if (!isData( d3 ) || !isData( d4 )) + { + // check if last two are PAD characters + if (isPad( d3 ) && isPad( d4 )) + { + // two PAD e.g. 3c== + if ((b2 & 0xf) != 0) // last 4 bits should be zero + { + returnExternalMemory(memMgr, decodedData); + return 0; + } + + decodedData[ outputIndex++ ] = set1stOctet(b1, b2); + } + else if (!isPad( d3 ) && isPad( d4 )) + { + // one PAD e.g. 3cQ= + b3 = base64Inverse[ d3 ]; + if (( b3 & 0x3 ) != 0 ) // last 2 bits should be zero + { + returnExternalMemory(memMgr, decodedData); + return 0; + } + + decodedData[ outputIndex++ ] = set1stOctet( b1, b2 ); + decodedData[ outputIndex++ ] = set2ndOctet( b2, b3 ); + } + else + { + // an error like "3c[Pad]r", "3cdX", "3cXd", "3cXX" where X is non data + returnExternalMemory(memMgr, decodedData); + return 0; + } + } + else + { + // no PAD e.g 3cQl + b3 = base64Inverse[ d3 ]; + b4 = base64Inverse[ d4 ]; + decodedData[ outputIndex++ ] = set1stOctet( b1, b2 ); + decodedData[ outputIndex++ ] = set2ndOctet( b2, b3 ); + decodedData[ outputIndex++ ] = set3rdOctet( b3, b4 ); + } + + // write out the end of string + decodedData[ outputIndex ] = 0; + *decodedLength = outputIndex; + + //allow the caller to have access to the canonical representation + jan.release(); + canRepData = rawInputData; + + return decodedData; +} + +bool Base64::isData(const XMLByte& octet) +{ + return (base64Inverse[octet]!=(XMLByte)-1); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/Base64.hpp b/project/jni/xerces/src/xercesc/util/Base64.hpp new file mode 100644 index 000000000..134bc880a --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Base64.hpp @@ -0,0 +1,266 @@ +/* + * 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: Base64.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BASE64_HPP) +#define XERCESC_INCLUDE_GUARD_BASE64_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides encode/decode for RFC 2045 Base64 as +// defined by RFC 2045, N. Freed and N. Borenstein. +// RFC 2045: Multipurpose Internet Mail Extensions (MIME) +// Part One: Format of Internet Message Bodies. Reference +// 1996 Available at: http://www.ietf.org/rfc/rfc2045.txt +// This class is used by XML Schema binary format validation +// +// +class XMLUTIL_EXPORT Base64 +{ +public : + + enum Conformance + { + Conf_RFC2045 + , Conf_Schema + }; + + //@{ + + /** + * Encodes octets into Base64 data + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * Use the memory manager to release the returned buffer or + * operator delete() if none was provided. + * + * @param inputData Binary data in XMLByte stream. + * @param inputLength Length of the XMLByte stream. + * @param outputLength Length of the encoded Base64 byte stream. + * @param memMgr client provided memory manager + * @return Encoded Base64 data in XMLByte stream, + * or NULL if input data can not be encoded. + */ + static XMLByte* encode(const XMLByte* const inputData + , const XMLSize_t inputLength + , XMLSize_t* outputLength + , MemoryManager* const memMgr = 0); + + /** + * Decodes Base64 data into octets + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * Use the memory manager to release the returned buffer or + * operator delete() if none was provided. + * + * @param inputData Base64 data in XMLByte stream. + * @param decodedLength Length of decoded XMLByte stream. + * @param memMgr client provided memory manager + * @param conform conformance specified: if the input data conforms to the + * RFC 2045 it is allowed to have any number of whitespace + * characters inside; if it conforms to the XMLSchema specs, + * it is allowed to have at most one whitespace character + * between the quartets + * @return Decoded binary data in XMLByte stream, + * or NULL if input data can not be decoded. + */ + static XMLByte* decode( + const XMLByte* const inputData + , XMLSize_t* decodedLength + , MemoryManager* const memMgr = 0 + , Conformance conform = Conf_RFC2045 + ); + + /** + * Decodes Base64 data into octets + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * Use the memory manager to release the returned buffer or + * operator delete() if none was provided. + * + * @param inputData Base64 data in XMLCh stream. + * @param decodedLength Length of decoded XMLByte stream. + * @param memMgr client provided memory manager + * @param conform conformance specified: if the input data conforms to the + * RFC 2045 it is allowed to have any number of whitespace + * characters inside; if it conforms to the XMLSchema specs, + * it is allowed to have at most one whitespace character + * between the quartets + * @return Decoded binary data in XMLByte stream, + * or NULL if input data can not be decoded. + */ + static XMLByte* decodeToXMLByte( + const XMLCh* const inputData + , XMLSize_t* decodedLength + , MemoryManager* const memMgr = 0 + , Conformance conform = Conf_RFC2045 + ); + /** + * Get data length + * + * Returns length of decoded data given an array + * containing encoded data. + * + * @param inputData Base64 data in XMLCh stream. + * @param memMgr client provided memory manager + * @param conform conformance specified + * @return Length of decoded data, + * or -1 if input data can not be decoded. + */ + static int getDataLength( + const XMLCh* const inputData + , MemoryManager* const memMgr = 0 + , Conformance conform = Conf_RFC2045 + ); + + //@} + + /** + * get canonical representation + * + * Caller is responsible for the proper deallocation + * of the string returned. + * + * @param inputData A string containing the Base64 + * @param memMgr client provided memory manager + * @param conform conformance specified + * + * return: the canonical representation of the Base64 + * if it is a valid Base64 + * 0 otherwise + */ + + static XMLCh* getCanonicalRepresentation + ( + const XMLCh* const inputData + , MemoryManager* const memMgr = 0 + , Conformance conform = Conf_RFC2045 + ); + +private : + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + + static XMLByte* decode( + const XMLByte* const inputData + , XMLSize_t* outputLength + , XMLByte*& canRepData + , MemoryManager* const memMgr = 0 + , Conformance conform = Conf_RFC2045 + ); + + static bool isData(const XMLByte& octet); + static bool isPad(const XMLByte& octet); + + static XMLByte set1stOctet(const XMLByte&, const XMLByte&); + static XMLByte set2ndOctet(const XMLByte&, const XMLByte&); + static XMLByte set3rdOctet(const XMLByte&, const XMLByte&); + + static void split1stOctet(const XMLByte&, XMLByte&, XMLByte&); + static void split2ndOctet(const XMLByte&, XMLByte&, XMLByte&); + static void split3rdOctet(const XMLByte&, XMLByte&, XMLByte&); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Base64(); + Base64(const Base64&); + + // ----------------------------------------------------------------------- + // Private data members + // + // base64Alphabet + // The Base64 alphabet (see RFC 2045). + // + // base64Padding + // Padding character (see RFC 2045). + // + // base64Inverse + // Table used in decoding base64. + // + // isInitialized + // Set once base64Inverse is initialized. + // + // quadsPerLine + // Number of quadruplets per one line. The encoded output + // stream must be represented in lines of no more + // than 19 quadruplets each. + // + // ----------------------------------------------------------------------- + + static const XMLByte base64Alphabet[]; + static const XMLByte base64Padding; + + static const XMLByte base64Inverse[]; + + static const unsigned int quadsPerLine; +}; + +// ----------------------------------------------------------------------- +// Helper methods +// ----------------------------------------------------------------------- +inline bool Base64::isPad(const XMLByte& octet) +{ + return ( octet == base64Padding ); +} + +inline XMLByte Base64::set1stOctet(const XMLByte& b1, const XMLByte& b2) +{ + return (( b1 << 2 ) | ( b2 >> 4 )); +} + +inline XMLByte Base64::set2ndOctet(const XMLByte& b2, const XMLByte& b3) +{ + return (( b2 << 4 ) | ( b3 >> 2 )); +} + +inline XMLByte Base64::set3rdOctet(const XMLByte& b3, const XMLByte& b4) +{ + return (( b3 << 6 ) | b4 ); +} + +inline void Base64::split1stOctet(const XMLByte& ch, XMLByte& b1, XMLByte& b2) { + b1 = ch >> 2; + b2 = ( ch & 0x3 ) << 4; +} + +inline void Base64::split2ndOctet(const XMLByte& ch, XMLByte& b2, XMLByte& b3) { + b2 |= ch >> 4; // combine with previous value + b3 = ( ch & 0xf ) << 2; +} + +inline void Base64::split3rdOctet(const XMLByte& ch, XMLByte& b3, XMLByte& b4) { + b3 |= ch >> 6; // combine with previous value + b4 = ( ch & 0x3f ); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.c b/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.c new file mode 100644 index 000000000..31e03bff9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.c @@ -0,0 +1,344 @@ +/* + * 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. + */ +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BaseRefVectorOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +BaseRefVectorOf::BaseRefVectorOf( const XMLSize_t maxElems + , const bool adoptElems + , MemoryManager* const manager) : + + fAdoptedElems(adoptElems) + , fCurCount(0) + , fMaxCount(maxElems) + , fElemList(0) + , fMemoryManager(manager) +{ + // Allocate and initialize the array + fElemList = (TElem**) fMemoryManager->allocate(maxElems * sizeof(TElem*));//new TElem*[maxElems]; + for (XMLSize_t index = 0; index < maxElems; index++) + fElemList[index] = 0; +} + + +//implemented so code will link +template BaseRefVectorOf::~BaseRefVectorOf() +{ +} + + +// --------------------------------------------------------------------------- +// BaseRefVectorOf: Element management +// --------------------------------------------------------------------------- +template void BaseRefVectorOf::addElement(TElem* const toAdd) +{ + ensureExtraCapacity(1); + fElemList[fCurCount] = toAdd; + fCurCount++; +} + + +template void +BaseRefVectorOf::setElementAt(TElem* const toSet, const XMLSize_t setAt) +{ + if (setAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + if (fAdoptedElems) + delete fElemList[setAt]; + fElemList[setAt] = toSet; +} + +template void BaseRefVectorOf:: +insertElementAt(TElem* const toInsert, const XMLSize_t insertAt) +{ + if (insertAt == fCurCount) + { + addElement(toInsert); + return; + } + + if (insertAt > fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + ensureExtraCapacity(1); + + // Make room for the newbie + for (XMLSize_t index = fCurCount; index > insertAt; index--) + fElemList[index] = fElemList[index-1]; + + // And stick it in and bump the count + fElemList[insertAt] = toInsert; + fCurCount++; +} + +template TElem* BaseRefVectorOf:: +orphanElementAt(const XMLSize_t orphanAt) +{ + if (orphanAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + // Get the element we are going to orphan + TElem* retVal = fElemList[orphanAt]; + + // Optimize if its the last element + if (orphanAt == fCurCount-1) + { + fElemList[orphanAt] = 0; + fCurCount--; + return retVal; + } + + // Copy down every element above orphan point + for (XMLSize_t index = orphanAt; index < fCurCount-1; index++) + fElemList[index] = fElemList[index+1]; + + // Keep unused elements zero for sanity's sake + fElemList[fCurCount-1] = 0; + + // And bump down count + fCurCount--; + + return retVal; +} + +template void BaseRefVectorOf::removeAllElements() +{ + for (XMLSize_t index = 0; index < fCurCount; index++) + { + if (fAdoptedElems) + delete fElemList[index]; + + // Keep unused elements zero for sanity's sake + fElemList[index] = 0; + } + fCurCount = 0; +} + +template void BaseRefVectorOf:: +removeElementAt(const XMLSize_t removeAt) +{ + if (removeAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + if (fAdoptedElems) + delete fElemList[removeAt]; + + // Optimize if its the last element + if (removeAt == fCurCount-1) + { + fElemList[removeAt] = 0; + fCurCount--; + return; + } + + // Copy down every element above remove point + for (XMLSize_t index = removeAt; index < fCurCount-1; index++) + fElemList[index] = fElemList[index+1]; + + // Keep unused elements zero for sanity's sake + fElemList[fCurCount-1] = 0; + + // And bump down count + fCurCount--; +} + +template void BaseRefVectorOf::removeLastElement() +{ + if (!fCurCount) + return; + fCurCount--; + + if (fAdoptedElems) + delete fElemList[fCurCount]; +} + +template +bool BaseRefVectorOf::containsElement(const TElem* const toCheck) { + + for (XMLSize_t i = 0; i < fCurCount; i++) { + if (fElemList[i] == toCheck) { + return true; + } + } + + return false; +} + +// +// cleanup(): +// similar to destructor +// called to cleanup the memory, in case destructor cannot be called +// +template void BaseRefVectorOf::cleanup() +{ + if (fAdoptedElems) + { + for (XMLSize_t index = 0; index < fCurCount; index++) + delete fElemList[index]; + } + fMemoryManager->deallocate(fElemList);//delete [] fElemList; +} + +// +// reinitialize(): +// similar to constructor +// called to re-construct the fElemList from scratch again +// +template void BaseRefVectorOf::reinitialize() +{ + // reinitialize the array + if (fElemList) + cleanup(); + + fElemList = (TElem**) fMemoryManager->allocate(fMaxCount * sizeof(TElem*));//new TElem*[fMaxCount]; + for (XMLSize_t index = 0; index < fMaxCount; index++) + fElemList[index] = 0; + +} + +template +MemoryManager* BaseRefVectorOf::getMemoryManager() const +{ + return fMemoryManager; +} + + +// --------------------------------------------------------------------------- +// BaseRefVectorOf: Getter methods +// --------------------------------------------------------------------------- +template XMLSize_t BaseRefVectorOf::curCapacity() const +{ + return fMaxCount; +} + +template const TElem* BaseRefVectorOf:: +elementAt(const XMLSize_t getAt) const +{ + if (getAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + return fElemList[getAt]; +} + +template TElem* +BaseRefVectorOf::elementAt(const XMLSize_t getAt) +{ + if (getAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + return fElemList[getAt]; +} + +template XMLSize_t BaseRefVectorOf::size() const +{ + return fCurCount; +} + + +// --------------------------------------------------------------------------- +// BaseRefVectorOf: Miscellaneous +// --------------------------------------------------------------------------- +template void BaseRefVectorOf:: +ensureExtraCapacity(const XMLSize_t length) +{ + XMLSize_t newMax = fCurCount + length; + + if (newMax <= fMaxCount) + return; + + // Choose how much bigger based on the current size. + // This will grow half as much again. + if (newMax < fMaxCount + fMaxCount/2) + newMax = fMaxCount + fMaxCount/2; + + // Allocate the new array and copy over the existing stuff + TElem** newList = (TElem**) fMemoryManager->allocate + ( + newMax * sizeof(TElem*) + );//new TElem*[newMax]; + XMLSize_t index = 0; + for (; index < fCurCount; index++) + newList[index] = fElemList[index]; + + // Zero out the rest of them + for (; index < newMax; index++) + newList[index] = 0; + + // Clean up the old array and update our members + fMemoryManager->deallocate(fElemList);//delete [] fElemList; + fElemList = newList; + fMaxCount = newMax; +} + + + +// --------------------------------------------------------------------------- +// AbstractBaseRefVectorEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template BaseRefVectorEnumerator:: +BaseRefVectorEnumerator( BaseRefVectorOf* const toEnum + , const bool adopt) : + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) +{ +} + +template BaseRefVectorEnumerator::~BaseRefVectorEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + +template BaseRefVectorEnumerator:: +BaseRefVectorEnumerator(const BaseRefVectorEnumerator& toCopy) : + XMLEnumerator(toCopy) + , XMemory(toCopy) + , fAdopted(toCopy.fAdopted) + , fCurIndex(toCopy.fCurIndex) + , fToEnum(toCopy.fToEnum) +{ +} +// --------------------------------------------------------------------------- +// RefBaseRefVectorEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool BaseRefVectorEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fToEnum->size()) + return false; + return true; +} + +template TElem& BaseRefVectorEnumerator::nextElement() +{ + return *(fToEnum->elementAt(fCurIndex++)); +} + +template void BaseRefVectorEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.hpp b/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.hpp new file mode 100644 index 000000000..f519e2e73 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BaseRefVectorOf.hpp @@ -0,0 +1,158 @@ +/* + * 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: BaseRefVectorOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACTVECTOROF_HPP) +#define XERCESC_INCLUDE_GUARD_ABSTRACTVECTOROF_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Abstract base class for the xerces internal representation of Vector. + * + * The destructor is abstract, forcing each of RefVectorOf and + * RefArrayVectorOf to implement their own appropriate one. + * + */ +template class BaseRefVectorOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + BaseRefVectorOf + ( + const XMLSize_t maxElems + , const bool adoptElems = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~BaseRefVectorOf(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + void addElement(TElem* const toAdd); + virtual void setElementAt(TElem* const toSet, const XMLSize_t setAt); + void insertElementAt(TElem* const toInsert, const XMLSize_t insertAt); + TElem* orphanElementAt(const XMLSize_t orphanAt); + virtual void removeAllElements(); + virtual void removeElementAt(const XMLSize_t removeAt); + virtual void removeLastElement(); + bool containsElement(const TElem* const toCheck); + virtual void cleanup(); + void reinitialize(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t curCapacity() const; + const TElem* elementAt(const XMLSize_t getAt) const; + TElem* elementAt(const XMLSize_t getAt); + XMLSize_t size() const; + MemoryManager* getMemoryManager() const; + + + // ----------------------------------------------------------------------- + // Miscellaneous + // ----------------------------------------------------------------------- + void ensureExtraCapacity(const XMLSize_t length); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BaseRefVectorOf(const BaseRefVectorOf& copy); + BaseRefVectorOf& operator=(const BaseRefVectorOf& copy); + +protected: + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + bool fAdoptedElems; + XMLSize_t fCurCount; + XMLSize_t fMaxCount; + TElem** fElemList; + MemoryManager* fMemoryManager; +}; + + +// +// An enumerator for a vector. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template class BaseRefVectorEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + BaseRefVectorEnumerator + ( + BaseRefVectorOf* const toEnum + , const bool adopt = false + ); + virtual ~BaseRefVectorEnumerator(); + + BaseRefVectorEnumerator(const BaseRefVectorEnumerator& copy); + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BaseRefVectorEnumerator& operator=(const BaseRefVectorEnumerator& copy); + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurIndex + // This is the current index into the vector. + // + // fToEnum + // The reference vector being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + BaseRefVectorOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BinFileInputStream.cpp b/project/jni/xerces/src/xercesc/util/BinFileInputStream.cpp new file mode 100644 index 000000000..e0631f7c7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinFileInputStream.cpp @@ -0,0 +1,110 @@ +/* + * 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: BinFileInputStream.cpp 670359 2008-06-22 13:43:45Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BinFileInputStream: Constructors and Destructor +// --------------------------------------------------------------------------- +BinFileInputStream::BinFileInputStream(const XMLCh* const fileName + , MemoryManager* const manager) : + + fSource(XMLPlatformUtils::openFile(fileName, manager)) + , fMemoryManager(manager) +{ +} + +BinFileInputStream::BinFileInputStream(const char* const fileName, + MemoryManager* const manager) : + + fSource(XMLPlatformUtils::openFile(fileName, manager)) + , fMemoryManager(manager) +{ +} + +BinFileInputStream::BinFileInputStream(const FileHandle toAdopt + , MemoryManager* const manager) : + + fSource(toAdopt) + , fMemoryManager(manager) +{ +} + +BinFileInputStream::~BinFileInputStream() +{ + if (getIsOpen()) + XMLPlatformUtils::closeFile(fSource, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// BinFileInputStream: Getter methods +// --------------------------------------------------------------------------- +XMLFilePos BinFileInputStream::getSize() const +{ + return XMLPlatformUtils::fileSize(fSource, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// BinFileInputStream: Stream management methods +// --------------------------------------------------------------------------- +void BinFileInputStream::reset() +{ + XMLPlatformUtils::resetFile(fSource, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// BinFileInputStream: Implementation of the input stream interface +// --------------------------------------------------------------------------- +XMLFilePos BinFileInputStream::curPos() const +{ + return XMLPlatformUtils::curFilePos(fSource, fMemoryManager); +} + +XMLSize_t +BinFileInputStream::readBytes( XMLByte* const toFill + , const XMLSize_t maxToRead) +{ + // + // Read up to the maximum bytes requested. We return the number + // actually read. + // + return XMLPlatformUtils::readFileBuffer(fSource, maxToRead, toFill, fMemoryManager); +} + +const XMLCh* BinFileInputStream::getContentType() const +{ + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/BinFileInputStream.hpp b/project/jni/xerces/src/xercesc/util/BinFileInputStream.hpp new file mode 100644 index 000000000..1303a4b17 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinFileInputStream.hpp @@ -0,0 +1,107 @@ +/* + * 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: BinFileInputStream.hpp 670359 2008-06-22 13:43:45Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BINFILEINPUTSTREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BINFILEINPUTSTREAM_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinFileInputStream : public BinInputStream +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + BinFileInputStream + ( + const XMLCh* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + BinFileInputStream + ( + const char* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + BinFileInputStream + ( + const FileHandle toUse + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~BinFileInputStream(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getIsOpen() const; + XMLFilePos getSize() const; + void reset(); + + + // ----------------------------------------------------------------------- + // Implementation of the input stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const; + + virtual XMLSize_t readBytes + ( + XMLByte* const toFill + , const XMLSize_t maxToRead + ); + + virtual const XMLCh* getContentType() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BinFileInputStream(const BinFileInputStream&); + BinFileInputStream& operator=(const BinFileInputStream&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fSource + // The source file that we represent. The FileHandle type is defined + // per platform. + // ----------------------------------------------------------------------- + FileHandle fSource; + MemoryManager* const fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// BinFileInputStream: Getter methods +// --------------------------------------------------------------------------- +inline bool BinFileInputStream::getIsOpen() const +{ + return (fSource != (FileHandle) XERCES_Invalid_File_Handle); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BinInputStream.cpp b/project/jni/xerces/src/xercesc/util/BinInputStream.cpp new file mode 100644 index 000000000..2475f9c01 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinInputStream.cpp @@ -0,0 +1,45 @@ +/* + * 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: BinInputStream.cpp 670359 2008-06-22 13:43:45Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BinInputStream: Virtual destructor! +// --------------------------------------------------------------------------- +BinInputStream::~BinInputStream() +{ +} + + +// --------------------------------------------------------------------------- +// BinInputStream: Hidden Constructors +// --------------------------------------------------------------------------- +BinInputStream::BinInputStream() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/BinInputStream.hpp b/project/jni/xerces/src/xercesc/util/BinInputStream.hpp new file mode 100644 index 000000000..ad9360be0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinInputStream.hpp @@ -0,0 +1,87 @@ +/* + * 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: BinInputStream.hpp 670359 2008-06-22 13:43:45Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BININPUTSTREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BININPUTSTREAM_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinInputStream : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Virtual destructor for derived classes + // ----------------------------------------------------------------------- + virtual ~BinInputStream(); + + + // ----------------------------------------------------------------------- + // The virtual input stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const = 0; + + virtual XMLSize_t readBytes + ( + XMLByte* const toFill + , const XMLSize_t maxToRead + ) = 0; + + /** + * Return the "out-of-band" content type for the data supplied by this + * input stream in the form of the media-type production (mime type + * with optional parameters such as encoding) as defined by the HTTP 1.1 + * specification. If no such content type is provided for the data, 0 is + * returned. This function is expected to return the correct value at + * any time after the construction of the stream. + * + * An example of the stream that may return non-0 from this function is + * an HTTP stream with the value returned taken from the "Content-Type" + * HTTP header. Note also that if the encoding of the data is known + * to the application by some other means then the setEncoding function + * in the InputSource object should be used instead. The getContentType + * function should only be used to return information that is intrinsic + * to the stream. + * + * @return The content type, or 0 if one is not available. + */ + virtual const XMLCh* getContentType() const = 0; + + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + BinInputStream(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented Constructors + // ----------------------------------------------------------------------- + BinInputStream(const BinInputStream&); + BinInputStream& operator=(const BinInputStream&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BinMemInputStream.cpp b/project/jni/xerces/src/xercesc/util/BinMemInputStream.cpp new file mode 100644 index 000000000..baef93f04 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinMemInputStream.cpp @@ -0,0 +1,98 @@ +/* + * 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: BinMemInputStream.cpp 670359 2008-06-22 13:43:45Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BinMemInputStream: Constructors and Destructor +// --------------------------------------------------------------------------- +BinMemInputStream::BinMemInputStream( const XMLByte* const initData + , const XMLSize_t capacity + , const BufOpts bufOpt + , MemoryManager* const manager) : + fBuffer(0) + , fBufOpt(bufOpt) + , fCapacity(capacity) + , fCurIndex(0) + , fMemoryManager(manager) +{ + // According to the buffer option, do the right thing + if (fBufOpt == BufOpt_Copy) + { + XMLByte* tmpBuf = (XMLByte*) fMemoryManager->allocate + ( + fCapacity * sizeof(XMLByte) + );//new XMLByte[fCapacity]; + memcpy(tmpBuf, initData, capacity); + fBuffer = tmpBuf; + } + else + { + fBuffer = initData; + } +} + +BinMemInputStream::~BinMemInputStream() +{ + // + // If we adopted or copied the buffer, then clean it up. We have to + // cast off the const'ness in that case in order to delete it. + // + if ((fBufOpt == BufOpt_Adopt) || (fBufOpt == BufOpt_Copy)) + fMemoryManager->deallocate((XMLByte*)fBuffer);//delete [] (XMLByte*)fBuffer; +} + + +// --------------------------------------------------------------------------- +// MemBinInputStream: Implementation of the input stream interface +// --------------------------------------------------------------------------- +XMLSize_t BinMemInputStream::readBytes( XMLByte* const toFill + , const XMLSize_t maxToRead) +{ + // + // Figure out how much we can really read. Its the smaller of the + // amount available and the amount asked for. + // + const XMLSize_t available = (fCapacity - fCurIndex); + if (!available) + return 0; + + const XMLSize_t actualToRead = available < maxToRead ? available : maxToRead; + + memcpy(toFill, &fBuffer[fCurIndex], actualToRead); + fCurIndex += actualToRead; + return actualToRead; +} + +const XMLCh* BinMemInputStream::getContentType() const +{ + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/BinMemInputStream.hpp b/project/jni/xerces/src/xercesc/util/BinMemInputStream.hpp new file mode 100644 index 000000000..abb65b864 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BinMemInputStream.hpp @@ -0,0 +1,134 @@ +/* + * 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: BinMemInputStream.hpp 670359 2008-06-22 13:43:45Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BINMEMINPUTSTREAM_HPP) +#define XERCESC_INCLUDE_GUARD_BINMEMINPUTSTREAM_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BinMemInputStream : public BinInputStream +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // ----------------------------------------------------------------------- + enum BufOpts + { + BufOpt_Adopt + , BufOpt_Copy + , BufOpt_Reference + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + BinMemInputStream + ( + const XMLByte* const initData + , const XMLSize_t capacity + , const BufOpts bufOpt = BufOpt_Copy + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~BinMemInputStream(); + + + // ----------------------------------------------------------------------- + // Stream management methods + // ----------------------------------------------------------------------- + void reset(); + + + // ----------------------------------------------------------------------- + // Implementation of the input stream interface + // ----------------------------------------------------------------------- + virtual XMLFilePos curPos() const; + + virtual XMLSize_t readBytes + ( + XMLByte* const toFill + , const XMLSize_t maxToRead + ); + + virtual const XMLCh* getContentType() const; + + inline XMLSize_t getSize() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BinMemInputStream(const BinMemInputStream&); + BinMemInputStream& operator=(const BinMemInputStream&); + // ----------------------------------------------------------------------- + // Private data members + // + // fBuffer + // The buffer of bytes that we are streaming. + // + // fBufOpt + // Indicates the ownership status of the buffer. The caller can have + // us adopt it (we delete it), reference it, or just make our own + // copy of it. + // + // fCapacity + // The size of the buffer being streamed. + // + // fCurIndex + // The current index where the next byte will be read from. When it + // hits fCapacity, we are done. + // ----------------------------------------------------------------------- + const XMLByte* fBuffer; + BufOpts fBufOpt; + XMLSize_t fCapacity; + XMLSize_t fCurIndex; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// BinMemInputStream: Stream management methods +// --------------------------------------------------------------------------- +inline void BinMemInputStream::reset() +{ + fCurIndex = 0; +} + + +// --------------------------------------------------------------------------- +// BinMemInputStream: Implementation of the input stream interface +// --------------------------------------------------------------------------- +inline XMLFilePos BinMemInputStream::curPos() const +{ + return fCurIndex; +} + +inline XMLSize_t BinMemInputStream::getSize() const +{ + return fCapacity; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BitOps.hpp b/project/jni/xerces/src/xercesc/util/BitOps.hpp new file mode 100644 index 000000000..fe5451104 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BitOps.hpp @@ -0,0 +1,67 @@ +/* + * 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: BitOps.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BITOPS_HPP) +#define XERCESC_INCLUDE_GUARD_BITOPS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BitOps +{ +public: + // ----------------------------------------------------------------------- + // Public static methods + // ----------------------------------------------------------------------- + static inline XMLCh swapBytes(const XMLUInt16 toSwap) + { + //The mask is required to overcome a compiler error on solaris + return XMLCh(((toSwap >> 8) | (toSwap << 8)) & 0xFFFF); + } + + static inline unsigned int swapBytes(const XMLUInt32 toSwap) + { + return + ( + (toSwap >> 24) + | (toSwap << 24) + | ((toSwap & 0xFF00) << 8) + | ((toSwap & 0xFF0000) >> 8) + ); + } + + + +protected : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators. (These ought to be private, + // but that produces spurious compiler warnings + // on some platforms.) + // ----------------------------------------------------------------------- + BitOps(); + BitOps(const BitOps&); + BitOps& operator=(const BitOps&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/BitSet.cpp b/project/jni/xerces/src/xercesc/util/BitSet.cpp new file mode 100644 index 000000000..ec14bdcd3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BitSet.cpp @@ -0,0 +1,270 @@ +/* + * 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: BitSet.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// +// kBitsPerUnit +// The number of bits in each of our allocation units, which is a 32 +// bit value in this case. +// +// kGrowBy +// The minimum allocation units to grow the buffer by. +// --------------------------------------------------------------------------- +const XMLSize_t kBitsPerUnit = 32; +const XMLSize_t kGrowBy = 1; + + + +// --------------------------------------------------------------------------- +// BitSet: Constructors and Destructor +// --------------------------------------------------------------------------- +BitSet::BitSet( const XMLSize_t size + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fBits(0) + , fUnitLen(0) +{ + ensureCapacity(size); +} + +BitSet::BitSet(const BitSet& toCopy) : + XMemory(toCopy) + , fMemoryManager(toCopy.fMemoryManager) + , fBits(0) + , fUnitLen(toCopy.fUnitLen) +{ + fBits = (unsigned long*) fMemoryManager->allocate + ( + fUnitLen * sizeof(unsigned long) + ); //new unsigned long[fUnitLen]; + for (XMLSize_t i = 0; i < fUnitLen; i++) + fBits[i] = toCopy.fBits[i]; +} + +BitSet::~BitSet() +{ + fMemoryManager->deallocate(fBits); //delete [] fBits; +} + + +// --------------------------------------------------------------------------- +// BitSet: Equality methods +// --------------------------------------------------------------------------- +bool BitSet::equals(const BitSet& other) const +{ + if (this == &other) + return true; + + if (fUnitLen != other.fUnitLen) + return false; + + for (XMLSize_t i = 0; i < fUnitLen; i++) + { + if (fBits[i] != other.fBits[i]) + return false; + } + return true; +} + + +// --------------------------------------------------------------------------- +// BitSet: Getter methods +// --------------------------------------------------------------------------- +bool BitSet::get(const XMLSize_t index) const +{ + const XMLSize_t unitOfBit = (index / kBitsPerUnit); + const XMLSize_t bitWithinUnit = index % kBitsPerUnit; + + // + // If the index is beyond our size, don't actually expand. Just return + // false, which is what the state would be if we did expand it. + // + bool retVal = false; + if (unitOfBit <= fUnitLen) + { + if (fBits[unitOfBit] & (1 << bitWithinUnit)) + retVal = true; + } + return retVal; +} + + +XMLSize_t BitSet::size() const +{ + return fUnitLen * kBitsPerUnit; +} + + + +// --------------------------------------------------------------------------- +// BitSet: Setter methods +// --------------------------------------------------------------------------- +bool BitSet::allAreCleared() const +{ + for (XMLSize_t index = 0; index < fUnitLen; index++) + { + if (fBits[index]) + return false; + } + return true; +} + +bool BitSet::allAreSet() const +{ + for (XMLSize_t index = 0; index < fUnitLen; index++) + { + if (fBits[index] != 0xFFFFFFFF) + return false; + } + return true; +} + +void BitSet::clearAll() +{ + // Just zero out all the units + for (XMLSize_t index = 0; index < fUnitLen; index++) + fBits[index] = 0; +} + +void BitSet::clear(const XMLSize_t index) +{ + ensureCapacity(index+1); + + const XMLSize_t unitOfBit = (index / kBitsPerUnit); + const XMLSize_t bitWithinUnit = index % kBitsPerUnit; + + fBits[unitOfBit] &= ~(1UL << bitWithinUnit); +} + + +void BitSet::set(const XMLSize_t index) +{ + ensureCapacity(index+1); + + const XMLSize_t unitOfBit = (index / kBitsPerUnit); + const XMLSize_t bitWithinUnit = index % kBitsPerUnit; + + fBits[unitOfBit] |= (1UL << bitWithinUnit); +} + + + +// --------------------------------------------------------------------------- +// BitSet: Bitwise logical methods +// --------------------------------------------------------------------------- +void BitSet::andWith(const BitSet& other) +{ + if (fUnitLen < other.fUnitLen) + ensureCapacity(other.fUnitLen * kBitsPerUnit); + + for (XMLSize_t index = 0; index < other.fUnitLen; index++) + fBits[index] &= other.fBits[index]; +} + + +void BitSet::orWith(const BitSet& other) +{ + if (fUnitLen < other.fUnitLen) + ensureCapacity(other.fUnitLen * kBitsPerUnit); + + for (XMLSize_t index = 0; index < other.fUnitLen; index++) + fBits[index] |= other.fBits[index]; +} + + +void BitSet::xorWith(const BitSet& other) +{ + if (fUnitLen < other.fUnitLen) + ensureCapacity(other.fUnitLen * kBitsPerUnit); + + for (XMLSize_t index = 0; index < other.fUnitLen; index++) + fBits[index] ^= other.fBits[index]; +} + + + +// --------------------------------------------------------------------------- +// BitSet: Miscellaneous methods +// --------------------------------------------------------------------------- +XMLSize_t BitSet::hash(const XMLSize_t hashModulus) const +{ + const unsigned char* pBytes = (const unsigned char*)fBits; + const XMLSize_t len = fUnitLen * sizeof(unsigned long); + + XMLSize_t hashVal = 0; + for (XMLSize_t index = 0; index < len; index++) + { + hashVal <<= 1; + hashVal ^= *pBytes; + } + return hashVal % hashModulus; +} + + + +// --------------------------------------------------------------------------- +// BitSet: Private methods +// --------------------------------------------------------------------------- +void BitSet::ensureCapacity(const XMLSize_t size) +{ + // If we have enough space, do nothing + if(fUnitLen * kBitsPerUnit >= size) + return; + + // Calculate the units required to hold the passed bit count. + XMLSize_t unitsNeeded = size / kBitsPerUnit; + if (size % kBitsPerUnit) + unitsNeeded++; + + // Regrow the unit length by at least the expansion unit + if (unitsNeeded < (fUnitLen + kGrowBy)) + unitsNeeded = fUnitLen + kGrowBy; + + // Allocate the array, copy the old stuff, and zero the new stuff + unsigned long* newBits = (unsigned long*) fMemoryManager->allocate + ( + unitsNeeded * sizeof(unsigned long) + ); //new unsigned long[unitsNeeded]; + + XMLSize_t index; + for (index = 0; index < fUnitLen; index++) + newBits[index] = fBits[index]; + + for (; index < unitsNeeded; index++) + newBits[index] = 0; + + fMemoryManager->deallocate(fBits); //delete [] fBits; + fBits = newBits; + fUnitLen = unitsNeeded; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/BitSet.hpp b/project/jni/xerces/src/xercesc/util/BitSet.hpp new file mode 100644 index 000000000..141086502 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/BitSet.hpp @@ -0,0 +1,107 @@ +/* + * 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: BitSet.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BITSET_HPP) +#define XERCESC_INCLUDE_GUARD_BITSET_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BitSet : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + BitSet( const XMLSize_t size + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + BitSet(const BitSet& toCopy); + ~BitSet(); + + + // ----------------------------------------------------------------------- + // Equality methods + // ----------------------------------------------------------------------- + bool equals(const BitSet& other) const; + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool allAreCleared() const; + bool allAreSet() const; + XMLSize_t size() const; + bool get(const XMLSize_t index) const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void clear(const XMLSize_t index); + void clearAll(); + void set(const XMLSize_t index); + + + // ----------------------------------------------------------------------- + // Bitwise logical operations + // ----------------------------------------------------------------------- + void andWith(const BitSet& other); + void orWith(const BitSet& other); + void xorWith(const BitSet& other); + + + // ----------------------------------------------------------------------- + // Miscellaneous + // ----------------------------------------------------------------------- + XMLSize_t hash(const XMLSize_t hashModulus) const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors + // ----------------------------------------------------------------------- + BitSet(); + BitSet& operator=(const BitSet&); + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void ensureCapacity(const XMLSize_t bits); + + + // ----------------------------------------------------------------------- + // Data members + // + // fBits + // The array of unsigned longs used to store the bits. + // + // fUnitLen + // The length of the storage array, in storage units not bits. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + unsigned long* fBits; + XMLSize_t fUnitLen; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/CountedPointer.c b/project/jni/xerces/src/xercesc/util/CountedPointer.c new file mode 100644 index 000000000..d03ab8fce --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/CountedPointer.c @@ -0,0 +1,107 @@ +/* + * 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: CountedPointer.c 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// CountedPointerTo: Constructors and Destructor +// --------------------------------------------------------------------------- +template CountedPointerTo:: +CountedPointerTo(const CountedPointerTo& toCopy) : + + fPtr(toCopy.fPtr) +{ + if (fPtr) + fPtr->addRef(); +} + +template CountedPointerTo::CountedPointerTo(T* p) : + + fPtr(p) +{ + if (fPtr) + fPtr->addRef(); +} + +template CountedPointerTo::~CountedPointerTo() +{ + if (fPtr) + fPtr->removeRef(); +} + + +// --------------------------------------------------------------------------- +// CountedPointerTo: Operators +// --------------------------------------------------------------------------- +template CountedPointerTo& +CountedPointerTo::operator=(const CountedPointerTo& other) +{ + if (this == &other) + return *this; + + if (other.fPtr) + other.fPtr->addRef(); + + if (fPtr) + fPtr->removeRef(); + + fPtr = other.fPtr; + return *this; +} + +template CountedPointerTo::operator T*() +{ + return fPtr; +} + +template const T* CountedPointerTo::operator->() const +{ + return fPtr; +} + +template T* CountedPointerTo::operator->() +{ + return fPtr; +} + +template const T& CountedPointerTo::operator*() const +{ + if (!fPtr) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, 0); + return *fPtr; +} + +template T& CountedPointerTo::operator*() +{ + if (!fPtr) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, 0); + return *fPtr; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/CountedPointer.hpp b/project/jni/xerces/src/xercesc/util/CountedPointer.hpp new file mode 100644 index 000000000..3bcdf6c47 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/CountedPointer.hpp @@ -0,0 +1,69 @@ +/* + * 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: CountedPointer.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_COUNTEDPOINTERTO_HPP) +#define XERCESC_INCLUDE_GUARD_COUNTEDPOINTERTO_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class CountedPointerTo : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + CountedPointerTo(const CountedPointerTo& toCopy); + CountedPointerTo(T* p = 0); + ~CountedPointerTo(); + + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + CountedPointerTo& operator=(const CountedPointerTo& other); + operator T*(); + const T* operator->() const; + T* operator->(); + const T& operator*() const; + T& operator*(); + + +private: + // ----------------------------------------------------------------------- + // Data members + // + // fPtr + // The pointer that we are counting. The T type must implement the + // addRef() and removeRef() APIs but it doesn't have to derive from + // any particular type. + // ----------------------------------------------------------------------- + T* fPtr; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.cpp b/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.cpp new file mode 100644 index 000000000..bf305fe8a --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.cpp @@ -0,0 +1,40 @@ +/* + * 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: DefaultPanicHandler.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +void DefaultPanicHandler::panic(const PanicHandler::PanicReasons reason) +{ + fprintf(stderr, "%s\n", PanicHandler::getPanicReasonString(reason)); + exit(-1); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.hpp b/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.hpp new file mode 100644 index 000000000..ef1944003 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/DefaultPanicHandler.hpp @@ -0,0 +1,80 @@ +/* + * 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: DefaultPanicHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DEFAULT_PANICHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DEFAULT_PANICHANDLER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Receive notification of panic. + * + *

This is Xerces' default implementation of the PanicHanlder + * interface, which will be instantiated and used in the + * absence of an application's panic handler. + *

+ */ + +class XMLUTIL_EXPORT DefaultPanicHandler : public XMemory, public PanicHandler +{ +public: + + /** @name hidden Constructors */ + //@{ + /** Default constructor */ + DefaultPanicHandler(){}; + + /** Destructor */ + virtual ~DefaultPanicHandler(){}; + //@} + + /** @name Implement virtual panic handler interface */ + //@{ + /** + * Receive notification of panic + * + *

Upon invocation, a corresponding error message will be output + * to the stderr, and program exit. + *

+ * + * @param reason The reason of panic + * + */ + virtual void panic(const PanicHandler::PanicReasons reason); + //@} + +private: + + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + DefaultPanicHandler(const PanicHandler&); + + /** Assignment operator */ + DefaultPanicHandler& operator=(const DefaultPanicHandler&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/EmptyStackException.hpp b/project/jni/xerces/src/xercesc/util/EmptyStackException.hpp new file mode 100644 index 000000000..a043f0f48 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/EmptyStackException.hpp @@ -0,0 +1,34 @@ +/* + * 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: EmptyStackException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_EMPTYSTACKEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_EMPTYSTACKEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(EmptyStackException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/EncodingValidator.cpp b/project/jni/xerces/src/xercesc/util/EncodingValidator.cpp new file mode 100644 index 000000000..c04f4e153 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/EncodingValidator.cpp @@ -0,0 +1,96 @@ +/* + * 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: EncodingValidator.cpp 635560 2008-03-10 14:10:09Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +EncodingValidator* EncodingValidator::fInstance = 0; + +void XMLInitializer::initializeEncodingValidator() +{ + EncodingValidator::fInstance = new EncodingValidator(); +} + +void XMLInitializer::terminateEncodingValidator() +{ + delete EncodingValidator::fInstance; + EncodingValidator::fInstance = 0; +} + +// --------------------------------------------------------------------------- +// EncodingValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +EncodingValidator::EncodingValidator() : + fEncodingRegistry(0) +{ + initializeRegistry(); +} + +EncodingValidator::~EncodingValidator() { + + delete fEncodingRegistry; + fEncodingRegistry = 0; +} + +// --------------------------------------------------------------------------- +// EncodingValidator: Validation methods +// --------------------------------------------------------------------------- +bool EncodingValidator::isValidEncoding(const XMLCh* const encName) { + + if (fEncodingRegistry->containsKey(encName)) + return true; + + return false; +} + + +// --------------------------------------------------------------------------- +// EncodingValidator: Initialization methods +// --------------------------------------------------------------------------- +void EncodingValidator::initializeRegistry() { + + fEncodingRegistry = new ValueHashTableOf(109); + + for (unsigned int i=0; i < gEncodingArraySize; i++) { + fEncodingRegistry->put((void*) gEncodingArray[i], true); + } +} + + +// --------------------------------------------------------------------------- +// EncodingValidator: Instance methods +// --------------------------------------------------------------------------- +EncodingValidator* EncodingValidator::instance() +{ + return fInstance; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file EncodingValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/EncodingValidator.hpp b/project/jni/xerces/src/xercesc/util/EncodingValidator.hpp new file mode 100644 index 000000000..4a7b49e09 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/EncodingValidator.hpp @@ -0,0 +1,85 @@ +/* + * 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: EncodingValidator.hpp 635560 2008-03-10 14:10:09Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ENCODINGVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ENCODINGVALIDATOR_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * A singleton class that checks whether an encoding name is a valid IANA + * encoding + */ + +class XMLUTIL_EXPORT EncodingValidator { + +public: + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + bool isValidEncoding(const XMLCh* const encName); + + // ----------------------------------------------------------------------- + // Instance methods + // ----------------------------------------------------------------------- + static EncodingValidator* instance(); + +private: + // ----------------------------------------------------------------------- + // Constructor and destructors + // ----------------------------------------------------------------------- + EncodingValidator(); + ~EncodingValidator(); + + // ----------------------------------------------------------------------- + // Private Helpers methods + // ----------------------------------------------------------------------- + /* + * Initializes the registry with a set of valid IANA encoding names + */ + void initializeRegistry(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEncodingRegistry + // Contains a set of IANA encoding names + // + // fInstance + // An EncodingValidator singleton instance + // ----------------------------------------------------------------------- + ValueHashTableOf* fEncodingRegistry; + static EncodingValidator* fInstance; + friend class XMLInitializer; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file EncodingValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.cpp b/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.cpp new file mode 100644 index 000000000..c70a069c0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.cpp @@ -0,0 +1,229 @@ +/* + * 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: PosixFileMgr.cpp 673975 2008-07-04 09:23:56Z borisk $ + */ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + + +PosixFileMgr::PosixFileMgr() +{ +} + + +PosixFileMgr::~PosixFileMgr() +{ +} + + +FileHandle +PosixFileMgr::fileOpen(const XMLCh* path, bool toWrite, MemoryManager* const manager) +{ + const char* tmpFileName = XMLString::transcode(path, manager); + ArrayJanitor janText((char*)tmpFileName, manager); + return fileOpen(tmpFileName, toWrite, manager); +} + + +FileHandle +PosixFileMgr::fileOpen(const char* path, bool toWrite, MemoryManager* const /*manager*/) +{ + const char* perms = (toWrite) ? "wb" : "rb"; + FileHandle result = (FileHandle)fopen(path , perms); + return result; +} + + +FileHandle +PosixFileMgr::openStdIn(MemoryManager* const /*manager*/) +{ + return (FileHandle)fdopen(dup(0), "rb"); +} + + +void +PosixFileMgr::fileClose(FileHandle f, MemoryManager* const manager) +{ + if (!f) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + if (fclose((FILE*)f)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, + XMLExcepts::File_CouldNotCloseFile, manager); +} + + +void +PosixFileMgr::fileReset(FileHandle f, MemoryManager* const manager) +{ + if (!f) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + // Seek to the start of the file + if (fseek((FILE*)f, 0, SEEK_SET)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, + XMLExcepts::File_CouldNotResetFile, manager); +} + + +XMLFilePos +PosixFileMgr::curPos(FileHandle f, MemoryManager* const manager) +{ + if (!f) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + long curPos = ftell((FILE*)f); + + if (curPos == -1) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetSize, manager); + + return (XMLFilePos)curPos; +} + + +XMLFilePos +PosixFileMgr::fileSize(FileHandle f, MemoryManager* const manager) +{ + if (!f) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + // Get the current position + long curPos = ftell((FILE*)f); + if (curPos == -1) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager); + + // Seek to the end and save that value for return + if (fseek((FILE*)f, 0, SEEK_END)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToEnd, manager); + + long retVal = ftell((FILE*)f); + if (retVal == -1) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToEnd, manager); + + // And put the pointer back + if (fseek((FILE*)f, curPos, SEEK_SET)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToPos, manager); + + return (XMLFilePos)retVal; +} + + +XMLSize_t +PosixFileMgr::fileRead(FileHandle f, XMLSize_t byteCount, XMLByte* buffer, MemoryManager* const manager) +{ + if (!f || !buffer) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + XMLSize_t bytesRead = 0; + if (byteCount > 0) + { + bytesRead = fread((void*)buffer, 1, byteCount, (FILE*)f); + + if (ferror((FILE*)f)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile, manager); + } + + return bytesRead; +} + + +void +PosixFileMgr::fileWrite(FileHandle f, XMLSize_t byteCount, const XMLByte* buffer, MemoryManager* const manager) +{ + if (!f || !buffer) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager); + + while (byteCount > 0) + { + XMLSize_t bytesWritten = fwrite(buffer, sizeof(XMLByte), byteCount, (FILE*)f); + + if (ferror((FILE*)f)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile, manager); + + buffer += bytesWritten; + byteCount -= bytesWritten; + } +} + + +XMLCh* +PosixFileMgr::getFullPath(const XMLCh* const srcPath, MemoryManager* const manager) +{ + // + // NOTE: The path provided has always already been opened successfully, + // so we know that its not some pathological freaky path. It comes in + // in native format, and goes out as Unicode always + // + char* newSrc = XMLString::transcode(srcPath, manager); + ArrayJanitor janText(newSrc, manager); + + // Use a local buffer that is big enough for the largest legal path + char absPath[PATH_MAX + 1]; + + // get the absolute path + if (!realpath(newSrc, absPath)) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager); + + return XMLString::transcode(absPath, manager); +} + + +XMLCh* +PosixFileMgr::getCurrentDirectory(MemoryManager* const manager) +{ + char dirBuf[PATH_MAX + 2]; + char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1); + + if (!curDir) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, + XMLExcepts::File_CouldNotGetBasePathName, manager); + + return XMLString::transcode(curDir, manager); +} + + +bool +PosixFileMgr::isRelative(const XMLCh* const toCheck, MemoryManager* const /*manager*/) +{ + // Check for pathological case of empty path + if (!toCheck || !toCheck[0]) + return false; + + // + // If it starts with a slash, then it cannot be relative. + // + return toCheck[0] != XMLCh('/'); +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.hpp b/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.hpp new file mode 100644 index 000000000..1b3263676 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/FileManagers/PosixFileMgr.hpp @@ -0,0 +1,60 @@ +/* + * 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: PosixFileMgr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_POSIXFILEMGR_HPP) +#define XERCESC_INCLUDE_GUARD_POSIXFILEMGR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Concrete implementation of XMLFileMgr, implementing +// file access on posix compatible systems. +class PosixFileMgr : public XMLFileMgr +{ + public: + PosixFileMgr(); + virtual ~PosixFileMgr(); + + // File access + virtual FileHandle fileOpen(const XMLCh* path, bool toWrite, MemoryManager* const manager); + virtual FileHandle fileOpen(const char* path, bool toWrite, MemoryManager* const manager); + virtual FileHandle openStdIn(MemoryManager* const manager); + + virtual void fileClose(FileHandle f, MemoryManager* const manager); + virtual void fileReset(FileHandle f, MemoryManager* const manager); + + virtual XMLFilePos curPos(FileHandle f, MemoryManager* const manager); + virtual XMLFilePos fileSize(FileHandle f, MemoryManager* const manager); + + virtual XMLSize_t fileRead(FileHandle f, XMLSize_t byteCount, XMLByte* buffer, MemoryManager* const manager); + virtual void fileWrite(FileHandle f, XMLSize_t byteCount, const XMLByte* buffer, MemoryManager* const manager); + + // Ancillary path handling routines + virtual XMLCh* getFullPath(const XMLCh* const srcPath, MemoryManager* const manager); + virtual XMLCh* getCurrentDirectory(MemoryManager* const manager); + virtual bool isRelative(const XMLCh* const toCheck, MemoryManager* const manager); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/FlagJanitor.c b/project/jni/xerces/src/xercesc/util/FlagJanitor.c new file mode 100644 index 000000000..e5f0d4d61 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/FlagJanitor.c @@ -0,0 +1,62 @@ +/* + * 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: FlagJanitor.c 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +template FlagJanitor::FlagJanitor(T* const valPtr, const T newVal) +: fValPtr(valPtr) +{ + // Store the pointer, save the org value, and store the new value + if (fValPtr) + { + fOldVal = *fValPtr; + *fValPtr = newVal; + } +} + +template FlagJanitor::~FlagJanitor() +{ + // Restore the old value + if (fValPtr) + *fValPtr = fOldVal; +} + + +// --------------------------------------------------------------------------- +// Value management methods +// --------------------------------------------------------------------------- +template void FlagJanitor::release() +{ + fValPtr = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/FlagJanitor.hpp b/project/jni/xerces/src/xercesc/util/FlagJanitor.hpp new file mode 100644 index 000000000..dba1b35bf --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/FlagJanitor.hpp @@ -0,0 +1,73 @@ +/* + * 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: FlagJanitor.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_FLAGJANITOR_HPP) +#define XERCESC_INCLUDE_GUARD_FLAGJANITOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class FlagJanitor +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + FlagJanitor(T* const valPtr, const T newVal); + ~FlagJanitor(); + + + // ----------------------------------------------------------------------- + // Value management methods + // ----------------------------------------------------------------------- + void release(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + FlagJanitor(); + FlagJanitor(const FlagJanitor&); + FlagJanitor& operator=(const FlagJanitor&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fOldVal + // The old value that was in the flag when we were constructed. + // + // fValPtr + // A pointer to the flag that we are to restore the value of + // ----------------------------------------------------------------------- + T fOldVal; + T* fValPtr; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.c b/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.c new file mode 100644 index 000000000..50ac774d4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.c @@ -0,0 +1,591 @@ +/* + * 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: Hash2KeysSetOf.c 883368 2009-11-23 15:28:19Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Hash2KeysSetOf: Constructors and Destructor +// --------------------------------------------------------------------------- + +template +Hash2KeysSetOf::Hash2KeysSetOf( + const XMLSize_t modulus, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) + , fAvailable(0) +{ + initialize(modulus); +} + +template +Hash2KeysSetOf::Hash2KeysSetOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) + , fAvailable(0) + , fHasher (hasher) +{ + initialize(modulus); +} + +template +void Hash2KeysSetOf::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (Hash2KeysSetBucketElem**) fMemoryManager->allocate + ( + fHashModulus * sizeof(Hash2KeysSetBucketElem*) + ); //new Hash2KeysSetBucketElem*[fHashModulus]; + memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus); +} + +template +Hash2KeysSetOf::~Hash2KeysSetOf() +{ + Hash2KeysSetBucketElem* nextElem; + if(!isEmpty()) + { + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + Hash2KeysSetBucketElem* curElem = fBucketList[buckInd]; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + } + // Then delete the list of available blocks + Hash2KeysSetBucketElem* curElem = fAvailable; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + fAvailable = 0; + + // Then delete the bucket list & hasher + fMemoryManager->deallocate(fBucketList); //delete [] fBucketList; + fBucketList = 0; +} + + +// --------------------------------------------------------------------------- +// Hash2KeysSetOf: Element management +// --------------------------------------------------------------------------- +template +bool Hash2KeysSetOf::isEmpty() const +{ + return (fCount==0); +} + +template +bool Hash2KeysSetOf::containsKey(const void* const key1, const int key2) const +{ + XMLSize_t hashVal; + const Hash2KeysSetBucketElem* findIt = findBucketElem(key1, key2, hashVal); + return (findIt != 0); +} + +template +void Hash2KeysSetOf::removeKey(const void* const key1, const int key2) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + Hash2KeysSetBucketElem* curElem = fBucketList[hashVal]; + Hash2KeysSetBucketElem* lastElem = 0; + + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // Move the current element to the list of available blocks + curElem->fNext=fAvailable; + fAvailable=curElem; + + fCount--; + return; + } + + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + + // We never found that key + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); +} + +template +void Hash2KeysSetOf:: +removeKey(const void* const key1) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + Hash2KeysSetBucketElem* curElem = fBucketList[hashVal]; + Hash2KeysSetBucketElem* lastElem = 0; + + while (curElem) + { + if(fHasher.equals(key1, curElem->fKey1)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + Hash2KeysSetBucketElem* toBeDeleted=curElem; + curElem = curElem->fNext; + + // Move the current element to the list of available blocks + toBeDeleted->fNext=fAvailable; + fAvailable=toBeDeleted; + + fCount--; + } + else + { + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + } +} + +template +void Hash2KeysSetOf::removeAll() +{ + if(isEmpty()) + return; + + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + if(fBucketList[buckInd]!=0) + { + // Advance to the end of the chain, and connect it to the list of + // available blocks + Hash2KeysSetBucketElem* curElem = fBucketList[buckInd]; + while (curElem->fNext) + curElem = curElem->fNext; + curElem->fNext=fAvailable; + fAvailable=fBucketList[buckInd]; + fBucketList[buckInd] = 0; + } + } + fCount=0; +} + +// --------------------------------------------------------------------------- +// Hash2KeysSetOf: Getters +// --------------------------------------------------------------------------- +template +MemoryManager* Hash2KeysSetOf::getMemoryManager() const +{ + return fMemoryManager; +} + +template +XMLSize_t Hash2KeysSetOf::getHashModulus() const +{ + return fHashModulus; +} + +// --------------------------------------------------------------------------- +// Hash2KeysSetOf: Putters +// --------------------------------------------------------------------------- +template +void Hash2KeysSetOf::put(const void* key1, int key2) +{ + // Apply 4 load factor to find threshold. + XMLSize_t threshold = fHashModulus * 4; + + // If we've grown too big, expand the table and rehash. + if (fCount >= threshold) + rehash(); + + // First see if the key exists already + XMLSize_t hashVal; + Hash2KeysSetBucketElem* newBucket = findBucketElem(key1, key2, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + newBucket->fKey1 = key1; + newBucket->fKey2 = key2; + } + else + { + if(fAvailable==0) + newBucket = (Hash2KeysSetBucketElem*)fMemoryManager->allocate(sizeof(Hash2KeysSetBucketElem)); + else + { + newBucket = fAvailable; + fAvailable = fAvailable->fNext; + } + newBucket->fKey1 = key1; + newBucket->fKey2 = key2; + newBucket->fNext = fBucketList[hashVal]; + fBucketList[hashVal] = newBucket; + fCount++; + } +} + +template +bool Hash2KeysSetOf::putIfNotPresent(const void* key1, int key2) +{ + // First see if the key exists already + XMLSize_t hashVal; + Hash2KeysSetBucketElem* newBucket = findBucketElem(key1, key2, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + return false; + + // Apply 4 load factor to find threshold. + XMLSize_t threshold = fHashModulus * 4; + + // If we've grown too big, expand the table and rehash. + if (fCount >= threshold) + rehash(); + + if(fAvailable==0) + newBucket = (Hash2KeysSetBucketElem*)fMemoryManager->allocate(sizeof(Hash2KeysSetBucketElem)); + else + { + newBucket = fAvailable; + fAvailable = fAvailable->fNext; + } + newBucket->fKey1 = key1; + newBucket->fKey2 = key2; + newBucket->fNext = fBucketList[hashVal]; + fBucketList[hashVal] = newBucket; + fCount++; + return true; +} + + +// --------------------------------------------------------------------------- +// Hash2KeysSetOf: Private methods +// --------------------------------------------------------------------------- +template +inline Hash2KeysSetBucketElem* Hash2KeysSetOf:: +findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + Hash2KeysSetBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + +template +inline const Hash2KeysSetBucketElem* Hash2KeysSetOf:: +findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + const Hash2KeysSetBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + + +template +void Hash2KeysSetOf:: +rehash() +{ + const XMLSize_t newMod = (fHashModulus * 8)+1; + + Hash2KeysSetBucketElem** newBucketList = + (Hash2KeysSetBucketElem**) fMemoryManager->allocate + ( + newMod * sizeof(Hash2KeysSetBucketElem*) + );//new Hash2KeysSetBucketElem*[fHashModulus]; + + // Make sure the new bucket list is destroyed if an + // exception is thrown. + ArrayJanitor guard(newBucketList, fMemoryManager); + + memset(newBucketList, 0, newMod * sizeof(newBucketList[0])); + + // Rehash all existing entries. + for (XMLSize_t index = 0; index < fHashModulus; index++) + { + // Get the bucket list head for this entry + Hash2KeysSetBucketElem* curElem = fBucketList[index]; + while (curElem) + { + // Save the next element before we detach this one + Hash2KeysSetBucketElem* nextElem = curElem->fNext; + + const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey1, newMod); + assert(hashVal < newMod); + + Hash2KeysSetBucketElem* newHeadElem = newBucketList[hashVal]; + + // Insert at the start of this bucket's list. + curElem->fNext = newHeadElem; + newBucketList[hashVal] = curElem; + + curElem = nextElem; + } + } + + Hash2KeysSetBucketElem** const oldBucketList = fBucketList; + + // Everything is OK at this point, so update the + // member variables. + fBucketList = guard.release(); + fHashModulus = newMod; + + // Delete the old bucket list. + fMemoryManager->deallocate(oldBucketList);//delete[] oldBucketList; + +} + + + +// --------------------------------------------------------------------------- +// Hash2KeysSetOfEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template +Hash2KeysSetOfEnumerator:: +Hash2KeysSetOfEnumerator(Hash2KeysSetOf* const toEnum + , const bool adopt + , MemoryManager* const manager) + : fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum) + , fMemoryManager(manager) + , fLockPrimaryKey(0) +{ + if (!toEnum) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, fMemoryManager); + + // + // Find the next available bucket element in the hash table. If it + // comes back zero, that just means the table is empty. + // + // Note that the -1 in the current hash tells it to start + // from the beginning. + // + findNext(); +} + +template +Hash2KeysSetOfEnumerator::~Hash2KeysSetOfEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// Hash2KeysSetOfEnumerator: Enum interface +// --------------------------------------------------------------------------- +template +bool Hash2KeysSetOfEnumerator::hasMoreElements() const +{ + // + // If our current has is at the max and there are no more elements + // in the current bucket, then no more elements. + // + if (!fCurElem && (fCurHash == fToEnum->fHashModulus)) + return false; + return true; +} + +template +void Hash2KeysSetOfEnumerator::nextElementKey(const void*& retKey1, int& retKey2) +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + Hash2KeysSetBucketElem* saveElem = fCurElem; + findNext(); + + retKey1 = saveElem->fKey1; + retKey2 = saveElem->fKey2; + + return; +} + +template +void Hash2KeysSetOfEnumerator::Reset() +{ + if(fLockPrimaryKey) + fCurHash=fToEnum->fHasher.getHashVal(fLockPrimaryKey, fToEnum->fHashModulus); + else + fCurHash = (XMLSize_t)-1; + + fCurElem = 0; + findNext(); +} + + +template +void Hash2KeysSetOfEnumerator::setPrimaryKey(const void* key) +{ + fLockPrimaryKey=key; + Reset(); +} + +// --------------------------------------------------------------------------- +// Hash2KeysSetOfEnumerator: Private helper methods +// --------------------------------------------------------------------------- +template +void Hash2KeysSetOfEnumerator::findNext() +{ + // Code to execute if we have to return only values with the primary key + if(fLockPrimaryKey) + { + if(!fCurElem) + fCurElem = fToEnum->fBucketList[fCurHash]; + else + fCurElem = fCurElem->fNext; + while (fCurElem && (!fToEnum->fHasher.equals(fLockPrimaryKey, fCurElem->fKey1))) + fCurElem = fCurElem->fNext; + // if we didn't found it, make so hasMoreElements() returns false + if(!fCurElem) + fCurHash = fToEnum->fHashModulus; + return; + } + // + // If there is a current element, move to its next element. If this + // hits the end of the bucket, the next block will handle the rest. + // + if (fCurElem) + fCurElem = fCurElem->fNext; + + // + // If the current element is null, then we have to move up to the + // next hash value. If that is the hash modulus, then we cannot + // go further. + // + if (!fCurElem) + { + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + + // Else find the next non-empty bucket + while (fToEnum->fBucketList[fCurHash]==0) + { + // Bump to the next hash value. If we max out return + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + } + fCurElem = fToEnum->fBucketList[fCurHash]; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.hpp b/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.hpp new file mode 100644 index 000000000..e827d8293 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Hash2KeysSetOf.hpp @@ -0,0 +1,223 @@ +/* + * 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: Hash2KeysSetOf.hpp 883368 2009-11-23 15:28:19Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_HASH2KEYSSETOF_HPP) +#define XERCESC_INCLUDE_GUARD_HASH2KEYSSETOF_HPP + + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// This hash table is similar to Hash2KeysSetOf with an additional integer as key2 + +// Forward declare the enumerator so it can be our friend. +// +template +class Hash2KeysSetOfEnumerator; + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +struct Hash2KeysSetBucketElem +{ + Hash2KeysSetBucketElem* fNext; + const void* fKey1; + int fKey2; +}; + + +template +class Hash2KeysSetOf : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + Hash2KeysSetOf( + const XMLSize_t modulus, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + Hash2KeysSetOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~Hash2KeysSetOf(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key1, const int key2) const; + void removeKey(const void* const key1, const int key2); + void removeKey(const void* const key1); + void removeAll(); + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + MemoryManager* getMemoryManager() const; + XMLSize_t getHashModulus() const; + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + void put(const void* key1, int key2); + bool putIfNotPresent(const void* key1, int key2); + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class Hash2KeysSetOfEnumerator; + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Hash2KeysSetOf(const Hash2KeysSetOf&); + Hash2KeysSetOf& operator=(const Hash2KeysSetOf&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + Hash2KeysSetBucketElem* findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal); + const Hash2KeysSetBucketElem* findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) const; + void initialize(const XMLSize_t modulus); + void rehash(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fCount + // The number of elements currently in the map + // + // fHash + // The hasher for the key1 data type. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + Hash2KeysSetBucketElem** fBucketList; + XMLSize_t fHashModulus; + XMLSize_t fCount; + Hash2KeysSetBucketElem* fAvailable; + THasher fHasher; +}; + + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template +class Hash2KeysSetOfEnumerator : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + Hash2KeysSetOfEnumerator(Hash2KeysSetOf* const toEnum + , const bool adopt = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~Hash2KeysSetOfEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + void Reset(); + + // ----------------------------------------------------------------------- + // New interface + // ----------------------------------------------------------------------- + void nextElementKey(const void*&, int&); + void setPrimaryKey(const void* key); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Hash2KeysSetOfEnumerator(const Hash2KeysSetOfEnumerator&); + Hash2KeysSetOfEnumerator& operator=(const Hash2KeysSetOfEnumerator&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void findNext(); + + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurElem + // This is the current bucket bucket element that we are on. + // + // fCurHash + // The is the current hash buck that we are working on. Once we hit + // the end of the bucket that fCurElem is in, then we have to start + // working this one up to the next non-empty bucket. + // + // fToEnum + // The value array being enumerated. + // + // fLockPrimaryKey + // Indicates that we are requested to iterate over the secondary keys + // associated with the given primary key + // + // ----------------------------------------------------------------------- + bool fAdopted; + Hash2KeysSetBucketElem* fCurElem; + XMLSize_t fCurHash; + Hash2KeysSetOf* fToEnum; + MemoryManager* const fMemoryManager; + const void* fLockPrimaryKey; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Hashers.hpp b/project/jni/xerces/src/xercesc/util/Hashers.hpp new file mode 100644 index 000000000..dd2d704a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Hashers.hpp @@ -0,0 +1,95 @@ +/* + * 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: Hashers.hpp 679382 2008-07-24 12:09:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_HASHERS_HPP) +#define XERCESC_INCLUDE_GUARD_HASHERS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// Common hashers. Only widely-used hashers should be placed here. +// + +/** + * Hasher for keys that are const XMLCh*. + */ +struct StringHasher +{ + /** + * Returns a hash value based on the key + * + * @param key the key to be hashed + * @param mod the modulus the hasher should use + */ + XMLSize_t getHashVal(const void* key, XMLSize_t mod) const + { + return XMLString::hash ((const XMLCh*)key, mod); + } + + /** + * Compares two keys and determines if they are semantically equal + * + * @param key1 the first key to be compared + * @param key2 the second key to be compared + * + * @return true if they are equal + */ + bool equals(const void *const key1, const void *const key2) const + { + return XMLString::equals ((const XMLCh*)key1, (const XMLCh*)key2); + } +}; + +/** + * Hasher for keys that are pointers. + */ +struct PtrHasher +{ + /** + * Returns a hash value based on the key + * + * @param key the key to be hashed + * @param mod the modulus the hasher should use + */ + XMLSize_t getHashVal(const void* key, XMLSize_t mod) const + { + return ((XMLSize_t)key) % mod; + } + + /** + * Compares two keys and determines if they are semantically equal + * + * @param key1 the first key to be compared + * @param key2 the second key to be compared + * + * @return true if they are equal + */ + bool equals(const void *const key1, const void *const key2) const + { + return key1 == key2; + } +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/HeaderDummy.cpp b/project/jni/xerces/src/xercesc/util/HeaderDummy.cpp new file mode 100644 index 000000000..57a17f7bb --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/HeaderDummy.cpp @@ -0,0 +1,40 @@ +/* + * 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: HeaderDummy.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/HexBin.cpp b/project/jni/xerces/src/xercesc/util/HexBin.cpp new file mode 100644 index 000000000..28e3ab254 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/HexBin.cpp @@ -0,0 +1,138 @@ +/* + * 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. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- +static const int BASELENGTH = 255; + +// --------------------------------------------------------------------------- +// class data member +// --------------------------------------------------------------------------- +const XMLByte HexBin::hexNumberTable[BASELENGTH] = +{ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; + + +int HexBin::getDataLength(const XMLCh* const hexData) +{ + if (!isArrayByteHex(hexData)) + return -1; + + return (int)XMLString::stringLen(hexData)/2; +} + +bool HexBin::isArrayByteHex(const XMLCh* const hexData) +{ + if (( hexData == 0 ) || ( *hexData == 0 )) // zero length + return true; + + XMLSize_t strLen = XMLString::stringLen(hexData); + if ( strLen%2 != 0 ) + return false; + + for ( XMLSize_t i = 0; i < strLen; i++ ) + if( !isHex(hexData[i]) ) + return false; + + return true; +} + +XMLCh* HexBin::getCanonicalRepresentation(const XMLCh* const hexData + , MemoryManager* const manager) +{ + + if (getDataLength(hexData) == -1) + return 0; + + XMLCh* retStr = XMLString::replicate(hexData, manager); + XMLString::upperCaseASCII(retStr); + + return retStr; +} + +XMLByte* HexBin::decodeToXMLByte(const XMLCh* const hexData + , MemoryManager* const manager) +{ + if (( hexData == 0 ) || ( *hexData == 0 )) // zero length + return 0; + + XMLSize_t strLen = XMLString::stringLen(hexData); + if ( strLen%2 != 0 ) + return 0; + + //prepare the return string + int decodeLength = (int)strLen/2; + XMLByte *retVal = (XMLByte*) manager->allocate( (decodeLength + 1) * sizeof(XMLByte)); + ArrayJanitor janFill(retVal, manager); + + XMLByte temp1, temp2; + for( int i = 0; i= BASELENGTH ) + return false; + + return (hexNumberTable[octet] != (XMLByte) -1); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/HexBin.hpp b/project/jni/xerces/src/xercesc/util/HexBin.hpp new file mode 100644 index 000000000..5a0328b88 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/HexBin.hpp @@ -0,0 +1,128 @@ +/* + * 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: HexBin.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_HEXBIN_HPP) +#define XERCESC_INCLUDE_GUARD_HEXBIN_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT HexBin +{ +public : + //@{ + + /** + * return the length of hexData in terms of HexBinary. + * + * @param hexData A string containing the HexBinary + * + * return: -1 if it contains any invalid HexBinary + * the length of the HexNumber otherwise. + */ + + static int getDataLength(const XMLCh* const hexData); + + /** + * check an array of data against the Hex table. + * + * @param hexData A string containing the HexBinary + * + * return: false if it contains any invalid HexBinary + * true otherwise. + */ + + static bool isArrayByteHex(const XMLCh* const hexData); + + /** + * get canonical representation + * + * Caller is responsible for the proper deallocation + * of the string returned. + * + * @param hexData A string containing the HexBinary + * @param manager The MemoryManager to use to allocate the string + * + * return: the canonical representation of the HexBinary + * if it is a valid HexBinary, + * 0 otherwise + */ + + static XMLCh* getCanonicalRepresentation + ( + const XMLCh* const hexData + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Decodes HexBinary data into XMLByte + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * Use the memory manager to release the returned buffer. + * + * @param hexData HexBinary data in XMLCh stream. + * @param manager client provided memory manager + * @return Decoded binary data in XMLByte stream, + * or NULL if input data can not be decoded. + */ + static XMLByte* decodeToXMLByte( + const XMLCh* const hexData + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + //@} + +private : + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + + static bool isHex(const XMLCh& octet); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + HexBin(); + HexBin(const HexBin&); + HexBin& operator=(const HexBin&); + + // ----------------------------------------------------------------------- + // Private data members + // + // isInitialized + // + // set once hexNumberTable is initialized. + // + // hexNumberTable + // + // arrany holding valid hexNumber character. + // + // ----------------------------------------------------------------------- + static const XMLByte hexNumberTable[]; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/IOException.hpp b/project/jni/xerces/src/xercesc/util/IOException.hpp new file mode 100644 index 000000000..bc73fb0e3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/IOException.hpp @@ -0,0 +1,34 @@ +/* + * 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: IOException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IOEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_IOEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(IOException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/IllegalArgumentException.hpp b/project/jni/xerces/src/xercesc/util/IllegalArgumentException.hpp new file mode 100644 index 000000000..52380d882 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/IllegalArgumentException.hpp @@ -0,0 +1,34 @@ +/* + * 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: IllegalArgumentException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ILLEGALARGUMENTEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_ILLEGALARGUMENTEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(IllegalArgumentException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/InvalidCastException.hpp b/project/jni/xerces/src/xercesc/util/InvalidCastException.hpp new file mode 100644 index 000000000..bfb040deb --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/InvalidCastException.hpp @@ -0,0 +1,34 @@ +/* + * 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: InvalidCastException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_INVALIDCASTEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_INVALIDCASTEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(InvalidCastException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Janitor.c b/project/jni/xerces/src/xercesc/util/Janitor.c new file mode 100644 index 000000000..2786f99c3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Janitor.c @@ -0,0 +1,248 @@ +/* + * 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: Janitor.c 669844 2008-06-20 10:11:44Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Janitor: Constructors and Destructor +// --------------------------------------------------------------------------- +template Janitor::Janitor(T* const toDelete) : + fData(toDelete) +{ +} + + +template Janitor::~Janitor() +{ + reset(); +} + + +// --------------------------------------------------------------------------- +// Janitor: Public, non-virtual methods +// --------------------------------------------------------------------------- +template void +Janitor::orphan() +{ + release(); +} + + +template T& +Janitor::operator*() const +{ + return *fData; +} + + +template T* +Janitor::operator->() const +{ + return fData; +} + + +template T* +Janitor::get() const +{ + return fData; +} + + +template T* +Janitor::release() +{ + T* p = fData; + fData = 0; + return p; +} + + +template void Janitor::reset(T* p) +{ + if (fData) + delete fData; + + fData = p; +} + +template bool Janitor::isDataNull() +{ + return (fData == 0); +} + + +// ----------------------------------------------------------------------- +// ArrayJanitor: Constructors and Destructor +// ----------------------------------------------------------------------- +template ArrayJanitor::ArrayJanitor(T* const toDelete) : + fData(toDelete) + , fMemoryManager(0) +{ +} + +template +ArrayJanitor::ArrayJanitor(T* const toDelete, + MemoryManager* const manager) : + fData(toDelete) + , fMemoryManager(manager) +{ +} + + +template ArrayJanitor::~ArrayJanitor() +{ + reset(); +} + + +// ----------------------------------------------------------------------- +// ArrayJanitor: Public, non-virtual methods +// ----------------------------------------------------------------------- +template void +ArrayJanitor::orphan() +{ + release(); +} + + +// Look, Ma! No hands! Don't call this with null data! +template T& +ArrayJanitor::operator[](int index) const +{ + // TODO: Add appropriate exception + return fData[index]; +} + + +template T* +ArrayJanitor::get() const +{ + return fData; +} + + +template T* +ArrayJanitor::release() +{ + T* p = fData; + fData = 0; + return p; +} + + +template void +ArrayJanitor::reset(T* p) +{ + if (fData) { + + if (fMemoryManager) + fMemoryManager->deallocate((void*)fData); + else + delete [] fData; + } + + fData = p; + fMemoryManager = 0; +} + +template void +ArrayJanitor::reset(T* p, MemoryManager* const manager) +{ + if (fData) { + + if (fMemoryManager) + fMemoryManager->deallocate((void*)fData); + else + delete [] fData; + } + + fData = p; + fMemoryManager = manager; +} + +// +// JanitorMemFunCall +// + +template +JanitorMemFunCall::JanitorMemFunCall( + T* object, + MFPT toCall) : + fObject(object), + fToCall(toCall) +{ +} + +template +JanitorMemFunCall::~JanitorMemFunCall() +{ + reset (); +} + +template +T& JanitorMemFunCall::operator*() const +{ + return *fObject; +} + + +template +T* JanitorMemFunCall::operator->() const +{ + return fObject; +} + + +template +T* JanitorMemFunCall::get() const +{ + return fObject; +} + + +template +T* JanitorMemFunCall::release() +{ + T* p = fObject; + fObject = 0; + return p; +} + +template +void JanitorMemFunCall::reset(T* p) +{ + if (fObject != 0 && fToCall != 0) + (fObject->*fToCall)(); + + fObject = p; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/Janitor.hpp b/project/jni/xerces/src/xercesc/util/Janitor.hpp new file mode 100644 index 000000000..18596bf76 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Janitor.hpp @@ -0,0 +1,166 @@ +/* + * 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: Janitor.hpp 669844 2008-06-20 10:11:44Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_JANITOR_HPP) +#define XERCESC_INCLUDE_GUARD_JANITOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class Janitor : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + Janitor(T* const toDelete); + ~Janitor(); + + // ----------------------------------------------------------------------- + // Public, non-virtual methods + // ----------------------------------------------------------------------- + void orphan(); + + // small amount of auto_ptr compatibility + T& operator*() const; + T* operator->() const; + T* get() const; + T* release(); + void reset(T* p = 0); + bool isDataNull(); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Janitor(); + Janitor(const Janitor&); + Janitor& operator=(const Janitor&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fData + // This is the pointer to the object or structure that must be + // destroyed when this object is destroyed. + // ----------------------------------------------------------------------- + T* fData; +}; + + + +template class ArrayJanitor : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ArrayJanitor(T* const toDelete); + ArrayJanitor(T* const toDelete, MemoryManager* const manager); + ~ArrayJanitor(); + + + // ----------------------------------------------------------------------- + // Public, non-virtual methods + // ----------------------------------------------------------------------- + void orphan(); + + // small amount of auto_ptr compatibility + T& operator[](int index) const; + T* get() const; + T* release(); + void reset(T* p = 0); + void reset(T* p, MemoryManager* const manager); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ArrayJanitor(); + ArrayJanitor(const ArrayJanitor& copy); + ArrayJanitor& operator=(const ArrayJanitor& copy); + + // ----------------------------------------------------------------------- + // Private data members + // + // fData + // This is the pointer to the object or structure that must be + // destroyed when this object is destroyed. + // ----------------------------------------------------------------------- + T* fData; + MemoryManager* fMemoryManager; +}; + + + +template class JanitorMemFunCall +{ +public : + + typedef void (T::*MFPT) (); + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + JanitorMemFunCall( + T* object, + MFPT toCall); + + ~JanitorMemFunCall(); + + // small amount of auto_ptr compatibility + T& operator*() const; + T* operator->() const; + T* get() const; + T* release(); + void reset(T* p = 0); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + JanitorMemFunCall(); + JanitorMemFunCall(const JanitorMemFunCall&); + JanitorMemFunCall& operator=(const JanitorMemFunCall&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fObject + // This is the pointer to the object for which we will call the + // member function when this object is destroyed. + // ----------------------------------------------------------------------- + T* fObject; + MFPT fToCall; +}; + + + + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/KVStringPair.cpp b/project/jni/xerces/src/xercesc/util/KVStringPair.cpp new file mode 100644 index 000000000..6456d013b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KVStringPair.cpp @@ -0,0 +1,126 @@ +/* + * 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: KVStringPair.cpp 554580 2007-07-09 09:09:51Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// KVStringPair: Constructors and Destructor +// --------------------------------------------------------------------------- +KVStringPair::KVStringPair(MemoryManager* const manager) +:fKeyAllocSize(0) +,fValueAllocSize(0) +,fKey(0) +,fValue(0) +,fMemoryManager(manager) +{ +} + +KVStringPair::KVStringPair(const XMLCh* const key, + const XMLCh* const value, + MemoryManager* const manager) +:fKeyAllocSize(0) +,fValueAllocSize(0) +,fKey(0) +,fValue(0) +,fMemoryManager(manager) +{ + set(key, value); +} + +KVStringPair::KVStringPair(const XMLCh* const key, + const XMLCh* const value, + const XMLSize_t valueLength, + MemoryManager* const manager) +:fKeyAllocSize(0) +,fValueAllocSize(0) +,fKey(0) +,fValue(0) +,fMemoryManager(manager) +{ + setKey(key); + setValue(value, valueLength); +} + +KVStringPair::KVStringPair(const XMLCh* const key, + const XMLSize_t keyLength, + const XMLCh* const value, + const XMLSize_t valueLength, + MemoryManager* const manager) +:fKeyAllocSize(0) +,fValueAllocSize(0) +,fKey(0) +,fValue(0) +,fMemoryManager(manager) +{ + setKey(key, keyLength); + setValue(value, valueLength); +} + +KVStringPair::KVStringPair(const KVStringPair& toCopy) +:XSerializable(toCopy) +,XMemory(toCopy) +,fKeyAllocSize(0) +,fValueAllocSize(0) +,fKey(0) +,fValue(0) +,fMemoryManager(toCopy.fMemoryManager) +{ + set(toCopy.fKey, toCopy.fValue); +} + +KVStringPair::~KVStringPair() +{ + fMemoryManager->deallocate(fKey); //delete [] fKey; + fMemoryManager->deallocate(fValue); //delete [] fValue; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(KVStringPair) + +void KVStringPair::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + + serEng.writeString(fKey, fKeyAllocSize, XSerializeEngine::toWriteBufferLen); + serEng.writeString(fValue, fValueAllocSize, XSerializeEngine::toWriteBufferLen); + } + else + { + XMLSize_t dataLen = 0; + serEng.readString(fKey, fKeyAllocSize, dataLen, XSerializeEngine::toReadBufferLen); + serEng.readString(fValue, fValueAllocSize, dataLen, XSerializeEngine::toReadBufferLen); + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/KVStringPair.hpp b/project/jni/xerces/src/xercesc/util/KVStringPair.hpp new file mode 100644 index 000000000..685b0cb1e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KVStringPair.hpp @@ -0,0 +1,223 @@ +/* + * 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: KVStringPair.hpp 554580 2007-07-09 09:09:51Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_KVSTRINGPAIR_HPP) +#define XERCESC_INCLUDE_GUARD_KVSTRINGPAIR_HPP + +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides a commonly used data structure, which is that of +// a pair of strings which represent a 'key=value' type mapping. It works +// only in terms of XMLCh type raw strings. +// +class XMLUTIL_EXPORT KVStringPair : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + KVStringPair(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + KVStringPair + ( + const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + KVStringPair + ( + const XMLCh* const key + , const XMLCh* const value + , const XMLSize_t valueLength + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + KVStringPair + ( + const XMLCh* const key + , const XMLSize_t keyLength + , const XMLCh* const value + , const XMLSize_t valueLength + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + KVStringPair(const KVStringPair& toCopy); + ~KVStringPair(); + + + // ----------------------------------------------------------------------- + // Getters + // + // We support the + // ----------------------------------------------------------------------- + const XMLCh* getKey() const; + XMLCh* getKey(); + const XMLCh* getValue() const; + XMLCh* getValue(); + + + // ----------------------------------------------------------------------- + // Setters + // ----------------------------------------------------------------------- + void setKey(const XMLCh* const newKey); + void setValue(const XMLCh* const newValue); + void setKey + ( + const XMLCh* const newKey + , const XMLSize_t newKeyLength + ); + void setValue + ( + const XMLCh* const newValue + , const XMLSize_t newValueLength + ); + void set + ( + const XMLCh* const newKey + , const XMLCh* const newValue + ); + void set + ( + const XMLCh* const newKey + , const XMLSize_t newKeyLength + , const XMLCh* const newValue + , const XMLSize_t newValueLength + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(KVStringPair) + +private : + // unimplemented: + + KVStringPair& operator=(const KVStringPair&); + // ----------------------------------------------------------------------- + // Private data members + // + // fKey + // The string that represents the key field of this object. + // + // fKeyAllocSize + // The amount of memory allocated for fKey. + // + // fValue + // The string that represents the value of this pair object. + // + // fValueAllocSize + // The amount of memory allocated for fValue. + // + // ----------------------------------------------------------------------- + XMLSize_t fKeyAllocSize; + XMLSize_t fValueAllocSize; + XMLCh* fKey; + XMLCh* fValue; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// KVStringPair: Getters +// --------------------------------------------------------------------------- +inline const XMLCh* KVStringPair::getKey() const +{ + return fKey; +} + +inline XMLCh* KVStringPair::getKey() +{ + return fKey; +} + +inline const XMLCh* KVStringPair::getValue() const +{ + return fValue; +} + +inline XMLCh* KVStringPair::getValue() +{ + return fValue; +} + +// --------------------------------------------------------------------------- +// KVStringPair: Setters +// --------------------------------------------------------------------------- +inline void KVStringPair::setKey(const XMLCh* const newKey) +{ + setKey(newKey, XMLString::stringLen(newKey)); +} + +inline void KVStringPair::setValue(const XMLCh* const newValue) +{ + setValue(newValue, XMLString::stringLen(newValue)); +} + +inline void KVStringPair::setKey( const XMLCh* const newKey + , const XMLSize_t newKeyLength) +{ + if (newKeyLength >= fKeyAllocSize) + { + fMemoryManager->deallocate(fKey); //delete [] fKey; + fKey = 0; + fKeyAllocSize = newKeyLength + 1; + fKey = (XMLCh*) fMemoryManager->allocate(fKeyAllocSize * sizeof(XMLCh)); //new XMLCh[fKeyAllocSize]; + } + + memcpy(fKey, newKey, (newKeyLength+1) * sizeof(XMLCh)); // len+1 because of the 0 at the end +} + +inline void KVStringPair::setValue( const XMLCh* const newValue + , const XMLSize_t newValueLength) +{ + if (newValueLength >= fValueAllocSize) + { + fMemoryManager->deallocate(fValue); //delete [] fValue; + fValue = 0; + fValueAllocSize = newValueLength + 1; + fValue = (XMLCh*) fMemoryManager->allocate(fValueAllocSize * sizeof(XMLCh)); //new XMLCh[fValueAllocSize]; + } + + memcpy(fValue, newValue, (newValueLength+1) * sizeof(XMLCh)); // len+1 because of the 0 at the end +} + +inline void KVStringPair::set( const XMLCh* const newKey + , const XMLCh* const newValue) +{ + setKey(newKey, XMLString::stringLen(newKey)); + setValue(newValue, XMLString::stringLen(newValue)); +} + +inline void KVStringPair::set( const XMLCh* const newKey + , const XMLSize_t newKeyLength + , const XMLCh* const newValue + , const XMLSize_t newValueLength) +{ + setKey(newKey, newKeyLength); + setValue(newValue, newValueLength); +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/KeyRefPair.c b/project/jni/xerces/src/xercesc/util/KeyRefPair.c new file mode 100644 index 000000000..52f1649d8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KeyRefPair.c @@ -0,0 +1,113 @@ +/* + * 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: KeyRefPair.c 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// KeyRefPair: Constructors and Destructor +// --------------------------------------------------------------------------- +template KeyRefPair::KeyRefPair() +{ +} + +template KeyRefPair:: +KeyRefPair(TKey* key, TValue* value) : + + fKey(key) + , fValue(value) +{ +} + +template KeyRefPair:: +KeyRefPair(const KeyRefPair* toCopy) : + + fKey(toCopy->fKey) + , fValue(toCopy->fValue) +{ +} + +template KeyRefPair:: +KeyRefPair(const KeyRefPair& toCopy) : + + fKey(toCopy.fKey) + , fValue(toCopy.fValue) +{ +} + + +template KeyRefPair::~KeyRefPair() +{ +} + + +// --------------------------------------------------------------------------- +// KeyRefPair: Getters +// --------------------------------------------------------------------------- +template const TKey* +KeyRefPair::getKey() const +{ + return fKey; + +} + +template TKey* KeyRefPair::getKey() +{ + return fKey; +} + +template const TValue* +KeyRefPair::getValue() const +{ + return fValue; +} + +template TValue* KeyRefPair::getValue() +{ + return fValue; +} + + +// --------------------------------------------------------------------------- +// KeyRefPair: Setters +// --------------------------------------------------------------------------- +template TKey* +KeyRefPair::setKey(TKey* newKey) +{ + fKey = newKey; + return fKey; +} + +template TValue* +KeyRefPair::setValue(TValue* newValue) +{ + fValue = newValue; + return fValue; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/KeyRefPair.hpp b/project/jni/xerces/src/xercesc/util/KeyRefPair.hpp new file mode 100644 index 000000000..ee04c7027 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KeyRefPair.hpp @@ -0,0 +1,81 @@ +/* + * 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: KeyRefPair.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_KEYREFPAIR_HPP) +#define XERCESC_INCLUDE_GUARD_KEYREFPAIR_HPP + + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class KeyRefPair : public XMemory +{ + public : + // ------------------------------------------------------------------- + // Constructors and Destructor + // ------------------------------------------------------------------- + KeyRefPair(); + KeyRefPair(TKey* key, TValue* value); + KeyRefPair(const KeyRefPair* toCopy); + KeyRefPair(const KeyRefPair& toCopy); + ~KeyRefPair(); + + + // ------------------------------------------------------------------- + // Getters + // ------------------------------------------------------------------- + const TKey* getKey() const; + TKey* getKey(); + const TValue* getValue() const; + TValue* getValue(); + + + // ------------------------------------------------------------------- + // Setters + // ------------------------------------------------------------------- + TKey* setKey(TKey* newKey); + TValue* setValue(TValue* newValue); + + + private : + // unimplemented: + KeyRefPair& operator=(const KeyRefPair&); + // ------------------------------------------------------------------- + // Private data members + // + // fKey + // The object that represents the key of the pair + // + // fValue + // The object that represents the value of the pair + // ------------------------------------------------------------------- + TKey* fKey; + TValue* fValue; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/KeyValuePair.c b/project/jni/xerces/src/xercesc/util/KeyValuePair.c new file mode 100644 index 000000000..11f9334b8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KeyValuePair.c @@ -0,0 +1,104 @@ +/* + * 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: KeyValuePair.c 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// KeyValuePair: Constructors and Destructor +// --------------------------------------------------------------------------- +template KeyValuePair::KeyValuePair() +{ +} + +template KeyValuePair:: +KeyValuePair(const TKey& key, const TValue& value) : + + fKey(key) + , fValue(value) +{ +} + +template KeyValuePair:: +KeyValuePair(const KeyValuePair& toCopy) : + + fKey(toCopy.fKey) + , fValue(toCopy.fValue) +{ +} + +template KeyValuePair::~KeyValuePair() +{ +} + + +// --------------------------------------------------------------------------- +// KeyValuePair: Getters +// --------------------------------------------------------------------------- +template const TKey& +KeyValuePair::getKey() const +{ + return fKey; + +} + +template TKey& KeyValuePair::getKey() +{ + return fKey; +} + +template const TValue& +KeyValuePair::getValue() const +{ + return fValue; +} + +template TValue& KeyValuePair::getValue() +{ + return fValue; +} + + +// --------------------------------------------------------------------------- +// KeyValuePair: Setters +// --------------------------------------------------------------------------- +template TKey& +KeyValuePair::setKey(const TKey& newKey) +{ + fKey = newKey; + return fKey; +} + +template TValue& +KeyValuePair::setValue(const TValue& newValue) +{ + fValue = newValue; + return fValue; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/KeyValuePair.hpp b/project/jni/xerces/src/xercesc/util/KeyValuePair.hpp new file mode 100644 index 000000000..11e783391 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/KeyValuePair.hpp @@ -0,0 +1,81 @@ +/* + * 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: KeyValuePair.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_KEYVALUEPAIR_HPP) +#define XERCESC_INCLUDE_GUARD_KEYVALUEPAIR_HPP + + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class KeyValuePair : public XMemory +{ + public : + // ------------------------------------------------------------------- + // Constructors and Destructor + // ------------------------------------------------------------------- + KeyValuePair(); + KeyValuePair(const TKey& key, const TValue& value); + KeyValuePair(const KeyValuePair& toCopy); + ~KeyValuePair(); + + + // ------------------------------------------------------------------- + // Getters + // ------------------------------------------------------------------- + const TKey& getKey() const; + TKey& getKey(); + const TValue& getValue() const; + TValue& getValue(); + + + // ------------------------------------------------------------------- + // Setters + // ------------------------------------------------------------------- + TKey& setKey(const TKey& newKey); + TValue& setValue(const TValue& newValue); + + + private : + // unimplemented: + KeyValuePair& operator=(const KeyValuePair&); + + // ------------------------------------------------------------------- + // Private data members + // + // fKey + // The object that represents the key of the pair + // + // fValue + // The object that represents the value of the pair + // ------------------------------------------------------------------- + TKey fKey; + TValue fValue; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/LogicalPath.c b/project/jni/xerces/src/xercesc/util/LogicalPath.c new file mode 100644 index 000000000..3c7ba9da0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/LogicalPath.c @@ -0,0 +1,275 @@ +/* + * 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: LogicalPath.c 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_WEAVEPATH_CPP) +#define XERCESC_INCLUDE_GUARD_WEAVEPATH_CPP + +/*** + * + * Previously, each PlatformUtils.cpp has its onw copy of the + * method weavePaths(), and almost of them implemented the same logic, + * with few platform specific difference, and unfortunately that + * implementation was wrong. + * + * The only platform specific issue is slash character. + * On all platforms other than Windows, chForwardSlash and chBackSlash + * are considered slash, while on Windows, two additional characters, + * chYenSign and chWonSign are slash as well. + * + * The idea is to maintain a SINGLE copy of this method rather than + * each PlatformUtils.cpp has its own copy, we introduce a new + * method, XMLPlatformUtils::isAnySlash(), to replace the direct checking + * code ( if ( c == chForwardSlash || c == chBackSlash). + * + * With this approach, we might have a performance hit since isAnySlash() + * is so frequently used in this implementation, so we intend to make it + * inline. Then we face a complier issue. + * + * There are two compilation units involved, one is PlatformUtils.cpp and + * the other PlatformUtils.cpp. When PlatformUtils.cp get compiled, + * the weavePath(), remove**Slash() have dependency upon isAnySlash() which + * is in PlatformUtils.cpp (and what is worse, it is inlined), so we have + * undefined/unresolved symbol: isAnySlash() on AIX/xlc_r, Solaris/cc and + * Linux/gcc, while MSVC and HP/aCC are fine with this. + * + * That means we can not place these new methods in PlatformUtils.cpp with + * inlined XMLPlatformUtils::isAnySlash() in PlatformUtils.cpp. + * + * The solution to this is PlatformUtils.cpp will include this file so that + * we have only one copy of these methods while get compiled in PlatformUtils + * inlined isAnySlash(). + * + ***/ +XMLCh* XMLPlatformUtils::weavePaths(const XMLCh* const basePath + , const XMLCh* const relativePath + , MemoryManager* const manager) + +{ + // Create a buffer as large as both parts and empty it + XMLCh* tmpBuf = (XMLCh*) manager->allocate + ( + (XMLString::stringLen(basePath) + + XMLString::stringLen(relativePath) + 2) * sizeof(XMLCh) + );//new XMLCh[XMLString::stringLen(basePath) + XMLString::stringLen(relativePath) + 2]; + *tmpBuf = 0; + + // + // If we have no base path, then just take the relative path as is. + // + if ((!basePath) || (!*basePath)) + { + XMLString::copyString(tmpBuf, relativePath); + return tmpBuf; + } + + // + // Remove anything after the last slash + // + const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) - 1); + while ((basePtr >= basePath) && ((isAnySlash(*basePtr) == false))) + { + basePtr--; + } + + // There is no relevant base path, so just take the relative part + if (basePtr < basePath) + { + XMLString::copyString(tmpBuf, relativePath); + return tmpBuf; + } + + // + // 1. concatenate the base and relative + // 2. remove all occurrences of "/./" + // 3. remove all occurrences of segment/../ where segment is not ../ + // + + XMLString::subString(tmpBuf, basePath, 0, (basePtr - basePath + 1), manager); + tmpBuf[basePtr - basePath + 1] = 0; + XMLString::catString(tmpBuf, relativePath); + + removeDotSlash(tmpBuf, manager); + + removeDotDotSlash(tmpBuf, manager); + + return tmpBuf; + +} + +// +// Remove all occurrences of './' when it is part of '/./' +// +// Since it could be '.\' or other combination on windows ( eg, '.'+chYanSign) +// we can't make use of patterMatch(). +// +// +void XMLPlatformUtils::removeDotSlash(XMLCh* const path + , MemoryManager* const manager) +{ + if ((!path) || (!*path)) + return; + + XMLCh* srcPtr = XMLString::replicate(path, manager); + int srcLen = XMLString::stringLen(srcPtr); + ArrayJanitor janName(srcPtr, manager); + XMLCh* tarPtr = path; + + while (*srcPtr) + { + if ( 3 <= srcLen ) + { + if ( (isAnySlash(*srcPtr)) && + (chPeriod == *(srcPtr+1)) && + (isAnySlash(*(srcPtr+2))) ) + { + // "\.\x" seen + // skip the first two, and start from the 3rd, + // since "\x" could be another "\." + srcPtr+=2; + srcLen-=2; + } + else + { + *tarPtr++ = *srcPtr++; // eat the current char + srcLen--; + } + } + else if ( 1 == srcLen ) + { + *tarPtr++ = *srcPtr++; + } + else if ( 2 == srcLen) + { + *tarPtr++ = *srcPtr++; + *tarPtr++ = *srcPtr++; + } + + } + + *tarPtr = 0; + + return; +} + +// +// Remove all occurrences of '/segment/../' when segment is not '..' +// +// Cases with extra /../ is left to the underlying file system. +// +void XMLPlatformUtils::removeDotDotSlash(XMLCh* const path + , MemoryManager* const manager) +{ + int pathLen = XMLString::stringLen(path); + XMLCh* tmp1 = (XMLCh*) manager->allocate + ( + (pathLen+1) * sizeof(XMLCh) + );//new XMLCh [pathLen+1]; + ArrayJanitor tmp1Name(tmp1, manager); + + XMLCh* tmp2 = (XMLCh*) manager->allocate + ( + (pathLen+1) * sizeof(XMLCh) + );//new XMLCh [pathLen+1]; + ArrayJanitor tmp2Name(tmp2, manager); + + // remove all "/../" where "" is a complete + // path segment not equal to ".." + int index = -1; + int segIndex = -1; + int offset = 1; + + while ((index = searchSlashDotDotSlash(&(path[offset]))) != -1) + { + // Undo offset + index += offset; + + // Find start of within substring ending at found point. + XMLString::subString(tmp1, path, 0, index-1, manager); + segIndex = index - 1; + while ((segIndex >= 0) && (!isAnySlash(tmp1[segIndex]))) + { + segIndex--; + } + + // Ensure exists and != ".." + if (segIndex >= 0 && + (path[segIndex+1] != chPeriod || + path[segIndex+2] != chPeriod || + segIndex + 3 != index)) + { + + XMLString::subString(tmp1, path, 0, segIndex, manager); + XMLString::subString(tmp2, path, index+3, XMLString::stringLen(path), manager); + + path[0] = 0; + XMLString::catString(path, tmp1); + XMLString::catString(path, tmp2); + + offset = (segIndex == 0 ? 1 : segIndex); + } + else + { + offset += 4; + } + + }// while + +} + +int XMLPlatformUtils::searchSlashDotDotSlash(XMLCh* const srcPath) +{ + if ((!srcPath) || (!*srcPath)) + return -1; + + XMLCh* srcPtr = srcPath; + int srcLen = XMLString::stringLen(srcPath); + int retVal = -1; + + while (*srcPtr) + { + if ( 4 <= srcLen ) + { + if ( (isAnySlash(*srcPtr)) && + (chPeriod == *(srcPtr+1)) && + (chPeriod == *(srcPtr+2)) && + (isAnySlash(*(srcPtr+3))) ) + { + retVal = (srcPtr - srcPath); + break; + } + else + { + srcPtr++; + srcLen--; + } + } + else + { + break; + } + + } // while + + return retVal; + +} + +#endif diff --git a/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp new file mode 100644 index 000000000..911755bdf --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp @@ -0,0 +1,177 @@ +/* + * 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: InMemMsgLoader.cpp 570552 2007-08-28 19:57:36Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include "InMemMsgLoader.hpp" +#include "XercesMessages_en_US.hpp" + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Public Constructors and Destructor +// --------------------------------------------------------------------------- +InMemMsgLoader::InMemMsgLoader(const XMLCh* const msgDomain) +:fMsgDomain(0) +{ + if (!XMLString::equals(msgDomain, XMLUni::fgXMLErrDomain) + && !XMLString::equals(msgDomain, XMLUni::fgExceptDomain) + && !XMLString::equals(msgDomain, XMLUni::fgXMLDOMMsgDomain) + && !XMLString::equals(msgDomain, XMLUni::fgValidityDomain)) + { + XMLPlatformUtils::panic(PanicHandler::Panic_UnknownMsgDomain); + } + + fMsgDomain = XMLString::replicate(msgDomain, XMLPlatformUtils::fgMemoryManager); +} + +InMemMsgLoader::~InMemMsgLoader() +{ + XMLPlatformUtils::fgMemoryManager->deallocate(fMsgDomain);//delete [] fMsgDomain; +} + + +// --------------------------------------------------------------------------- +// Implementation of the virtual message loader API +// --------------------------------------------------------------------------- +bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars) +{ + // + // Just use the id to map into the correct array of messages. Then + // copy that to the caller's buffer. + // + // NOTE: The source text is in little endian form. So, if we are a + // big endian machine, flip them in the process. + // + XMLCh* endPtr = toFill + maxChars; + XMLCh* outPtr = toFill; + const XMLCh* srcPtr = 0; + + if (XMLString::equals(fMsgDomain, XMLUni::fgXMLErrDomain)) + { + if ( msgToLoad > gXMLErrArraySize) + return false; + else + srcPtr = gXMLErrArray[msgToLoad - 1]; + } + else if (XMLString::equals(fMsgDomain, XMLUni::fgExceptDomain)) + { + if ( msgToLoad > gXMLExceptArraySize) + return false; + else + srcPtr = gXMLExceptArray[msgToLoad - 1]; + } + else if (XMLString::equals(fMsgDomain, XMLUni::fgValidityDomain)) + { + if ( msgToLoad > gXMLValidityArraySize) + return false; + else + srcPtr = gXMLValidityArray[msgToLoad - 1]; + } + else if (XMLString::equals(fMsgDomain, XMLUni::fgXMLDOMMsgDomain)) + { + if ( msgToLoad > gXMLDOMMsgArraySize) + return false; + else + srcPtr = gXMLDOMMsgArray[msgToLoad - 1]; + } + + while (*srcPtr && (outPtr < endPtr)) + { + *outPtr++ = *srcPtr++; + } + *outPtr = 0; + + return true; +} + + +bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const XMLCh* const repText1 + , const XMLCh* const repText2 + , const XMLCh* const repText3 + , const XMLCh* const repText4 + , MemoryManager* const manager) +{ + // Call the other version to load up the message + if (!loadMsg(msgToLoad, toFill, maxChars)) + return false; + + // And do the token replacement + XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4, manager); + return true; +} + + +bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const char* const repText1 + , const char* const repText2 + , const char* const repText3 + , const char* const repText4 + , MemoryManager * const manager) +{ + // + // Transcode the provided parameters and call the other version, + // which will do the replacement work. + // + XMLCh* tmp1 = 0; + XMLCh* tmp2 = 0; + XMLCh* tmp3 = 0; + XMLCh* tmp4 = 0; + + bool bRet = false; + if (repText1) + tmp1 = XMLString::transcode(repText1, manager); + if (repText2) + tmp2 = XMLString::transcode(repText2, manager); + if (repText3) + tmp3 = XMLString::transcode(repText3, manager); + if (repText4) + tmp4 = XMLString::transcode(repText4, manager); + + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); + + if (tmp1) + manager->deallocate(tmp1);//delete [] tmp1; + if (tmp2) + manager->deallocate(tmp2);//delete [] tmp2; + if (tmp3) + manager->deallocate(tmp3);//delete [] tmp3; + if (tmp4) + manager->deallocate(tmp4);//delete [] tmp4; + + return bRet; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp new file mode 100644 index 000000000..17a2d7b1e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp @@ -0,0 +1,101 @@ +/* + * 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: InMemMsgLoader.hpp 570552 2007-08-28 19:57:36Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_INMEMMSGLOADER_HPP) +#define XERCESC_INCLUDE_GUARD_INMEMMSGLOADER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This is a simple in memory message loader implementation. For those +// folks who just want a single language and want something very fast and +// efficient, can basically just provide a couple of arrays of Unicode +// strings that can be looked up by the message id. +// +class XMLUTIL_EXPORT InMemMsgLoader : public XMLMsgLoader +{ +public : + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + InMemMsgLoader(const XMLCh* const msgDomain); + ~InMemMsgLoader(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual message loader API + // ----------------------------------------------------------------------- + virtual bool loadMsg + ( + const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + ); + + virtual bool loadMsg + ( + const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const XMLCh* const repText1 + , const XMLCh* const repText2 = 0 + , const XMLCh* const repText3 = 0 + , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual bool loadMsg + ( + const XMLMsgLoader::XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const char* const repText1 + , const char* const repText2 = 0 + , const char* const repText3 = 0 + , const char* const repText4 = 0 + , MemoryManager * const manager = XMLPlatformUtils::fgMemoryManager + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + InMemMsgLoader(); + InMemMsgLoader(const InMemMsgLoader&); + InMemMsgLoader& operator=(const InMemMsgLoader&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fMsgDomain + // This is the message domain that we are for loading message from. + // ----------------------------------------------------------------------- + XMLCh* fMsgDomain; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp new file mode 100644 index 000000000..08fdabc86 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp @@ -0,0 +1,1501 @@ +// ---------------------------------------------------------------- +// This file was generated from the XML error message source. +// so do not edit this file directly!! +// ---------------------------------------------------------------- + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const XMLCh gXMLErrArray[][128] = +{ + { 0x0057,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0062,0x0065,0x0065,0x006E,0x0020,0x0064,0x0065,0x0063, + 0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0062,0x0065,0x0065,0x006E,0x0020,0x0064,0x0065, + 0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0058,0x004D,0x004C,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E, + 0x0020,0x006F,0x0072,0x0020,0x006D,0x0061,0x006E,0x0075,0x0061,0x006C,0x006C,0x0079,0x0020,0x0073,0x0065,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0072,0x0061,0x0064,0x0069,0x0063,0x0074,0x0073,0x0020,0x0074,0x0068,0x0065,0x0020,0x0061,0x0075, + 0x0074,0x006F,0x002D,0x0073,0x0065,0x006E,0x0073,0x0065,0x0064,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x003B,0x0020,0x0069,0x0067,0x006E,0x006F,0x0072,0x0069,0x006E,0x0067,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0061,0x0020,0x0063,0x006F, + 0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0062,0x0075,0x0074,0x0020,0x0077,0x0061,0x0073,0x0020,0x006E,0x0065,0x0076,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0061,0x006E,0x0020,0x0041, + 0x0054,0x0054,0x004C,0x0049,0x0053,0x0054,0x0020,0x0062,0x0075,0x0074,0x0020,0x0077,0x0061,0x0073,0x0020,0x006E,0x0065,0x0076,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x007B,0x0030,0x007D,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0074,0x0065,0x0078,0x0074,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0072,0x0065,0x0073,0x006F,0x0075,0x0072,0x0063,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0057,0x005F,0x0045,0x006E,0x0064,0x00 } + , { 0x0045,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0068,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E, + 0x0074,0x0020,0x006F,0x0066,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x003B,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x006C,0x0069,0x0073,0x0074,0x002C,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x002C,0x0020, + 0x0061,0x006E,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0061,0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x006C,0x0079,0x002D,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020, + 0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x006C,0x0079,0x002D,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061, + 0x0076,0x0065,0x0020,0x0061,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006E,0x0061,0x006D, + 0x0065,0x0020,0x006F,0x0072,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020, + 0x006F,0x0072,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x006F,0x0072, + 0x0020,0x0061,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0047,0x0072,0x006F,0x0075,0x0070,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076, + 0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x006F,0x0072,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0061,0x006E,0x006F,0x006E,0x0079,0x006D,0x006F,0x0075,0x0073,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0061,0x006E,0x006F,0x006E,0x0079,0x006D,0x006F,0x0075,0x0073,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074, + 0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0028,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x003F,0x002C,0x0020,0x0028,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x007C,0x0020, + 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0029,0x003F,0x002C,0x0020,0x0028,0x0075,0x006E,0x0069,0x0071,0x0075,0x0065,0x0020,0x007C,0x0020,0x006B,0x0065,0x0079,0x0020,0x007C,0x0020,0x006B,0x0065,0x0079,0x0072, + 0x0065,0x0066,0x0029,0x002A,0x0029,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x003B,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x006C,0x0069,0x0073,0x0074,0x002C,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x002C,0x0020,0x0061,0x006E,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F, + 0x006E,0x0020,0x0061,0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x006C,0x0069,0x0073,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074, + 0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006C,0x0069,0x0073,0x0074,0x002C,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x002C,0x0020,0x006F,0x0072,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074, + 0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x006C,0x0069,0x0073,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020, + 0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020, + 0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069, + 0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073, + 0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069, + 0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0043,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0066,0x006F, + 0x0072,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069, + 0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069, + 0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0043,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0027,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0027,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074, + 0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0064,0x0020,0x0074,0x006F, + 0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0055,0x0052,0x0049,0x00 } + , { 0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x003A,0x007B,0x0031,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079, + 0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x006F,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0043,0x006F,0x006E, + 0x0074,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0043,0x006F, + 0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0066,0x0069, + 0x0078,0x0065,0x0064,0x0020,0x0061,0x006E,0x0064,0x0020,0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020, + 0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006F,0x0070,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020, + 0x006F,0x006E,0x0063,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0073,0x0063,0x006F,0x0070,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0027,0x0074, + 0x0079,0x0070,0x0065,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E, + 0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x003A,0x007B,0x0031,0x007D,0x0027,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020, + 0x0027,0x007B,0x0032,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0066,0x0069,0x0078,0x0065, + 0x0064,0x0020,0x0061,0x006E,0x0064,0x0020,0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x007B,0x0030,0x007D,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0027,0x0074,0x0079,0x0070, + 0x0065,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x002F,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078, + 0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006F,0x0072,0x0020,0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020, + 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006D,0x0069,0x0078,0x0065,0x0064,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0020,0x006F,0x0072, + 0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x00 } + , { 0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0064,0x0073, + 0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0066,0x0069,0x006E,0x0061,0x006C,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065, + 0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0061,0x0073,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0069,0x006E, + 0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0043,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020, + 0x0068,0x0061,0x0076,0x0065,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x0063,0x0061,0x006E, + 0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0062,0x0079,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069, + 0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069, + 0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C, + 0x0065,0x0043,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069, + 0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C, + 0x0065,0x0078,0x0043,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x00 } + , { 0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0069,0x0074,0x0073,0x0020,0x006F,0x0077, + 0x006E,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x002C,0x0020,0x006C,0x0069,0x0073,0x0074,0x002C,0x0020,0x006F,0x0072,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E, + 0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0062,0x006C,0x006F,0x0063,0x006B,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x00 } + , { 0x0066,0x0069,0x006E,0x0061,0x006C,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0070,0x0061,0x0072,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065, + 0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0068,0x0065,0x0061,0x0064,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020,0x0064,0x006F,0x0065,0x0073, + 0x0020,0x006E,0x006F,0x0074,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x006C, + 0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0068,0x0065,0x0061,0x0064,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069, + 0x006F,0x006E,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E, + 0x0063,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0073,0x0063,0x006F,0x0070,0x0065,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027, + 0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072, + 0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x0069,0x006E,0x006C,0x0069,0x006E,0x0065,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074, + 0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0027,0x0066,0x006F,0x0072,0x006D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0074,0x0079,0x0070,0x0065,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x003A, + 0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0064,0x0065,0x0072,0x0069,0x0076,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0062,0x0079,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0066,0x006F,0x0072,0x0062,0x0069,0x0064, + 0x0064,0x0065,0x006E,0x0020,0x0062,0x0079,0x0020,0x0065,0x0069,0x0074,0x0068,0x0065,0x0072,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0067,0x006C, + 0x006F,0x0062,0x0061,0x006C,0x006C,0x0079,0x00 } + , { 0x0064,0x0065,0x0072,0x0069,0x0076,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0062,0x0079,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065, + 0x006E,0x0020,0x0062,0x0079,0x0020,0x0065,0x0069,0x0074,0x0068,0x0065,0x0072,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0067,0x006C,0x006F,0x0062, + 0x0061,0x006C,0x006C,0x0079,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0043,0x006F,0x006E,0x0074,0x0065, + 0x006E,0x0074,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070, + 0x0065,0x00 } + , { 0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074, + 0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x003B,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027, + 0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0027,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x004C,0x006F,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020, + 0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0064,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074, + 0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0020,0x006D,0x006F,0x0073,0x0074,0x0020,0x006F,0x006E,0x0065,0x0020,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006D,0x0061,0x0074, + 0x0063,0x0068,0x0020,0x0028,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x003F,0x002C,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x003F,0x0029,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0069,0x006E,0x0020,0x0067,0x006C,0x006F,0x0062, + 0x0061,0x006C,0x0020,0x007B,0x0031,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0069,0x006E,0x0020,0x006C,0x006F,0x0063,0x0061, + 0x006C,0x0020,0x007B,0x0031,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0069,0x006E,0x0020,0x0067,0x006C, + 0x006F,0x0062,0x0061,0x006C,0x0020,0x007B,0x0031,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0069,0x006E,0x0020,0x006C,0x006F, + 0x0063,0x0061,0x006C,0x0020,0x007B,0x0031,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x006D,0x0069,0x006E,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067, + 0x0072,0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0061,0x0078,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0061,0x006E,0x0079,0x0041,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074, + 0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x0020,0x007B,0x0030,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006E,0x0061, + 0x006D,0x0065,0x00 } + , { 0x0063,0x0069,0x0072,0x0063,0x0075,0x006C,0x0061,0x0072,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x003A,0x007B,0x0031,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x006D,0x006F,0x0072,0x0065, + 0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0063,0x0065,0x0020,0x006F,0x0072,0x0020,0x0061,0x006C,0x0073,0x006F,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0061,0x0073,0x0020,0x007B,0x0032,0x007D,0x00 } + , { 0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x0020,0x007B,0x0030,0x007D,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E, + 0x0020,0x006F,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0066,0x006F,0x0072,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020, + 0x0066,0x0061,0x0063,0x0065,0x0074,0x003B,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x0063,0x006F,0x006C,0x006C,0x0061,0x0070,0x0073,0x0065,0x0027,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006F,0x0066,0x0020,0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073, + 0x0074,0x0020,0x0062,0x0065,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063, + 0x0065,0x0020,0x006F,0x0066,0x0020,0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0069,0x006E,0x0067,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x00 } + , { 0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0069,0x006E,0x0067,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E, + 0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0069,0x0066,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0069,0x006E,0x0020,0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0020,0x0064,0x0065,0x0063, + 0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0063,0x006F,0x006E, + 0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x0066,0x0020,0x0069,0x0074,0x0073,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065, + 0x0064,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0049,0x0044,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x002F,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006F,0x0066,0x0020,0x004E,0x004F,0x0054,0x0041,0x0054, + 0x0049,0x004F,0x004E,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006D,0x0069,0x0078,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070, + 0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x0074,0x0068,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0027,0x0073,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x0020,0x006D, + 0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x006D,0x0070,0x0074,0x0069,0x0061,0x0062,0x006C,0x0065,0x00 } + , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0068,0x0061,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0063,0x006F, + 0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0062,0x0075,0x0074,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x006F,0x0072, + 0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0065,0x006D,0x0070,0x0074,0x0069,0x0061,0x0062,0x006C,0x0065,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0073,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0061,0x006E, + 0x0064,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x0062,0x0065,0x0020,0x006D, + 0x0069,0x0078,0x0065,0x0064,0x0020,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x002D,0x006F,0x006E,0x006C,0x0079,0x00 } + , { 0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064, + 0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0064,0x0065,0x0072,0x0069,0x0076,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0062,0x0079,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074, + 0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065,0x006E,0x0020,0x0062,0x0079,0x0020,0x0065,0x0069,0x0074,0x0068,0x0065,0x0072,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070, + 0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0067,0x006C,0x006F,0x0062,0x0061,0x006C,0x006C,0x0079,0x00 } + , { 0x0069,0x0074,0x0065,0x006D,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0076,0x0061,0x0072,0x0069, + 0x0065,0x0074,0x0079,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x006F,0x006D,0x0069,0x0063,0x0020,0x006F,0x0072,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x0020,0x0077,0x0068,0x0065,0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x006D,0x0065, + 0x006D,0x0062,0x0065,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0073,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0074,0x006F,0x006D,0x0069,0x0063,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0061,0x006C,0x006C,0x002C,0x0020,0x0063,0x0068,0x006F,0x0069,0x0063, + 0x0065,0x002C,0x0020,0x006F,0x0072,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0047,0x0072,0x006F,0x0075,0x0070,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073, + 0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0028,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x003F,0x002C,0x0020,0x0028,0x0028,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x007C, + 0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0047,0x0072,0x006F,0x0075,0x0070,0x0029,0x002A,0x002C,0x0020,0x0061,0x006E,0x0079,0x0041,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x003F,0x0029,0x0029,0x00 } + , { 0x0074,0x006F,0x0070,0x002D,0x006C,0x0065,0x0076,0x0065,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x0061,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x006D,0x0075,0x0073, + 0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0027,0x006D,0x0069,0x006E,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x006D,0x0061,0x0078,0x004F,0x0063,0x0063,0x0075,0x0072, + 0x0073,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0027,0x007B,0x0031,0x007D,0x003A,0x007B,0x0032,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020, + 0x006F,0x006E,0x006C,0x0079,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0061,0x0073,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020,0x0063,0x006F, + 0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074, + 0x0069,0x0074,0x0075,0x0074,0x0069,0x006E,0x0067,0x0020,0x0074,0x0068,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C, + 0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0062,0x006F,0x0074,0x0068,0x0020,0x006D,0x0069,0x006E,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0061,0x006E, + 0x0064,0x0020,0x006D,0x0061,0x0078,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0031,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070, + 0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006D,0x0069,0x006E,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0061,0x0078,0x004F, + 0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0030,0x0020,0x006F,0x0072,0x0020,0x0031,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020, + 0x0069,0x006E,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0069,0x006E,0x0074,0x0065,0x0072,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075, + 0x0074,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0073,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x0062,0x006C,0x0065,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x006E,0x0079,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075, + 0x0074,0x0065,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0069,0x006E,0x0063,0x006F,0x006D,0x0070,0x0061,0x0074,0x0069,0x0062,0x006C,0x0065,0x0020,0x0075,0x0073, + 0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0064,0x0065,0x0072, + 0x0069,0x0076,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068, + 0x0065,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061, + 0x0073,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0020,0x0066,0x0069,0x0078, + 0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x006F,0x0072,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0076, + 0x0061,0x006C,0x0075,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020, + 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0072,0x0065,0x0073,0x0070,0x0065,0x0063,0x0074,0x0020,0x0074,0x006F,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020, + 0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x006F,0x0072,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x006F,0x0020, + 0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x0073,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068, + 0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0062,0x0075,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0074, + 0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0069, + 0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065, + 0x006E,0x0074,0x0020,0x0075,0x0073,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x0066, + 0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0075,0x0073,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x0070, + 0x0072,0x006F,0x0068,0x0069,0x0062,0x0069,0x0074,0x0065,0x0064,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0074, + 0x0079,0x0070,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0063,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006F,0x0072,0x0020,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0065, + 0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x006E,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020, + 0x0074,0x0068,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x003B,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0061, + 0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072, + 0x0065,0x006E,0x0074,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0020, + 0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066,0x0069, + 0x006E,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x0072,0x0069,0x0067,0x0069,0x006E,0x0061,0x006C,0x0020,0x0074,0x0079,0x0070,0x0065, + 0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061, + 0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0078,0x0074,0x0065,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F, + 0x006E,0x00 } + , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0054,0x0079,0x0070,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066, + 0x0069,0x006E,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x0072,0x0069,0x0067,0x0069,0x006E,0x0061,0x006C,0x0020,0x0074,0x0079,0x0070, + 0x0065,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x006D,0x0069,0x006E,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0061,0x006E,0x0064, + 0x0020,0x006D,0x0061,0x0078,0x004F,0x0063,0x0063,0x0075,0x0072,0x0073,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0031,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x006E,0x0064,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073, + 0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0062,0x0065,0x0069,0x006E,0x0067,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067, + 0x0020,0x0074,0x006F,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0020,0x006D,0x0061,0x0079,0x0020,0x006F, + 0x006E,0x006C,0x0079,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x006F,0x0020,0x0069,0x0074,0x0073,0x0065,0x006C,0x0066, + 0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0047,0x0072,0x006F,0x0075,0x0070,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0064,0x0065,0x0066, + 0x0069,0x006E,0x0065,0x0020,0x006D,0x0061,0x0079,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020, + 0x0074,0x006F,0x0020,0x0069,0x0074,0x0073,0x0065,0x006C,0x0066,0x00 } + , { 0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E, + 0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x003A,0x007B,0x0031,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020, + 0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0068, + 0x0061,0x0073,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073, + 0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0028,0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x003F,0x002C,0x0020,0x0073,0x0065,0x006C,0x0065,0x0063,0x0074,0x006F,0x0072,0x002C,0x0020,0x0066,0x0069,0x0065, + 0x006C,0x0064,0x002B,0x0029,0x00 } + , { 0x006B,0x0065,0x0079,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0072,0x0065,0x0066, + 0x0065,0x0072,0x0073,0x0020,0x0074,0x006F,0x0020,0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x006B,0x0065,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0066,0x0069,0x0065,0x006C,0x0064,0x0020,0x0063,0x0061,0x0072,0x0064,0x0069,0x006E,0x0061,0x006C,0x0069,0x0074,0x0069,0x0065,0x0073,0x0020,0x0066,0x006F,0x0072,0x0020,0x006B,0x0065,0x0079,0x0072,0x0065,0x0066,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x0020,0x0061,0x006E,0x0064,0x0020,0x006B,0x0065,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x00 } + , { 0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x006F,0x0072,0x0020,0x0065,0x006D,0x0070,0x0074, + 0x0079,0x00 } + , { 0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x006E,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020, + 0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0065,0x0074,0x0020,0x006F,0x0072,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0073,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0066,0x0069,0x0078,0x0065, + 0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x006F,0x0066,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006F,0x0066,0x0020,0x0049,0x0044,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0072,0x0020,0x0074,0x0079, + 0x0070,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0049,0x0044,0x0020,0x0061,0x006E,0x0064,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020, + 0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x002F,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0074, + 0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0061,0x0020, + 0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0049,0x0044,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0074, + 0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0077,0x0069,0x0074,0x0068, + 0x0020,0x0061,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0049,0x0044,0x00 } + , { 0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x004E,0x0061,0x006D,0x0065, + 0x0073,0x0070,0x0061,0x0063,0x0065,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x003B,0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020, + 0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0062,0x0073,0x0065,0x006E,0x0074,0x0020,0x006F,0x0072,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x006E,0x006F,0x006E,0x002D,0x0065,0x006D,0x0070,0x0074,0x0079, + 0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x007B,0x0030,0x007D,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0062,0x0065,0x0065,0x006E,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0064,0x0020,0x006F,0x0072,0x0020, + 0x0072,0x0065,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x006F, + 0x0075,0x0074,0x0020,0x0069,0x006D,0x0070,0x006F,0x0072,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0069,0x0073,0x0020,0x0070,0x0061,0x0072,0x0074,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020,0x0063,0x006F, + 0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0069,0x0074,0x0075, + 0x0074,0x0065,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x006E,0x0074,0x0069,0x0072,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069, + 0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0061,0x006E,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0061,0x0070,0x0070,0x0069,0x006E,0x0066,0x006F, + 0x0020,0x0061,0x006E,0x0064,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x006F,0x0066,0x0020,0x0058,0x004D,0x004C,0x0020,0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0064,0x006F,0x0063, + 0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0027,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0027,0x00 } + , { 0x0063,0x0069,0x0072,0x0063,0x0075,0x006C,0x0061,0x0072,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0069,0x006E,0x0020,0x0065,0x006C,0x0065,0x006D, + 0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0058,0x004D,0x004C,0x0020, + 0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027, + 0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0068,0x0074,0x0074,0x0070,0x003A,0x002F,0x002F,0x0077,0x0077,0x0077,0x002E,0x0077,0x0033,0x002E,0x006F,0x0072,0x0067,0x002F,0x0032,0x0030,0x0030,0x0031,0x002F,0x0058, + 0x004D,0x004C,0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x002D,0x0069,0x006E,0x0073,0x0074,0x0061,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0066,0x0069,0x0078,0x002D,0x0075,0x0070,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0070,0x0065,0x0072,0x0066,0x006F,0x0072,0x006D,0x0065, + 0x0064,0x0020,0x006F,0x006E,0x0020,0x0044,0x004F,0x004D,0x0020,0x004C,0x0065,0x0076,0x0065,0x006C,0x0020,0x0031,0x0020,0x006E,0x006F,0x0064,0x0065,0x00 } + , { 0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0061,0x006E,0x0079,0x0041,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074, + 0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069, + 0x006F,0x006E,0x00 } + , { 0x0061,0x006E,0x0079,0x0041,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062, + 0x0079,0x0020,0x006F,0x0074,0x0068,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0045,0x005F,0x0045,0x006E,0x0064,0x00 } + , { 0x0046,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x0070,0x0061,0x0072,0x0073,0x0065,0x0072,0x0020,0x0068,0x0061,0x0073,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0065,0x0078,0x0070,0x0061,0x006E,0x0073,0x0069,0x006F,0x006E,0x0073,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065, + 0x006E,0x0074,0x003B,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0069,0x0073,0x0020,0x0074,0x0068,0x0065,0x0020,0x006C,0x0069,0x006D,0x0069,0x0074,0x0020,0x0069,0x006D,0x0070,0x006F,0x0073,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0074,0x0068, + 0x0065,0x0020,0x0061,0x0070,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x0020,0x006F,0x0072,0x0020,0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0072,0x0065,0x0070,0x0065,0x0074,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0069,0x006E,0x0020,0x006D, + 0x0069,0x0078,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x00 } + , { 0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063, + 0x0074,0x0065,0x0064,0x00 } + , { 0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0073,0x0069,0x0067,0x006E,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x003C,0x0021,0x002D,0x002D,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0075,0x0072,0x0065,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0076,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x002C,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x002C,0x0020,0x006F,0x0072,0x0020,0x0073,0x0074,0x0061,0x006E, + 0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0058,0x004D,0x004C,0x0020,0x0076,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0058,0x004D,0x004C,0x0020,0x0076,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0058,0x004D,0x004C,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0058,0x004D,0x004C,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065, + 0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0069,0x006F,0x006E, + 0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0030,0x0078,0x007B,0x0030,0x007D,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0074,0x0061,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x0074,0x0061,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006F, + 0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0074,0x0061,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0074,0x0061,0x0067,0x0020,0x006E,0x0061,0x006D,0x0065,0x002C,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x002C,0x0020,0x0050,0x0049,0x002C,0x0020,0x006F,0x0072,0x0020, + 0x006F,0x0074,0x0068,0x0065,0x0072,0x0020,0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0027, + 0x0073,0x0020,0x0065,0x006E,0x0064,0x0020,0x0074,0x0061,0x0067,0x00 } + , { 0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x0020,0x006F,0x0072,0x0020,0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0065, + 0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0044,0x004F,0x0043,0x0054,0x0059,0x0050,0x0045,0x0020,0x0064,0x0065, + 0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0071,0x0075,0x006F,0x0074,0x0065,0x0064,0x0020,0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0070,0x0075,0x0062,0x006C,0x0069,0x0063,0x0020,0x0069,0x0064,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0030,0x0078,0x007B,0x0030,0x007D,0x0020,0x0069,0x006E,0x0020,0x0070,0x0075,0x0062,0x006C,0x0069,0x0063,0x0020,0x0069, + 0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0044,0x004F,0x0043,0x0054,0x0059,0x0050,0x0045,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0030,0x0078,0x007B,0x0030,0x007D,0x0020,0x0069,0x006E,0x0020,0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C, + 0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0030,0x0078,0x007B,0x0031,0x007D,0x0020,0x0069,0x006E,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074, + 0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0054,0x0045,0x0058,0x0054,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073, + 0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x00 } + , { 0x0063,0x006F,0x006E,0x0064,0x0069,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0073,0x0075,0x0062, + 0x0073,0x0065,0x0074,0x00 } + , { 0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0075,0x006E,0x0070,0x0061,0x0072,0x0073,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020, + 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027, + 0x00 } + , { 0x0072,0x0065,0x0063,0x0075,0x0072,0x0073,0x0069,0x0076,0x0065,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0065,0x0078,0x0070,0x0061,0x006E,0x0073,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0070,0x0061,0x0072,0x0074,0x0069,0x0061,0x006C,0x0020,0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x0020,0x0069,0x006E,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0072,0x0020, + 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0027,0x002A,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x006D,0x0069,0x0078,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0074,0x0065,0x0072,0x006D,0x0069, + 0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0070,0x0072,0x006F,0x0070,0x0065,0x0072,0x006C,0x0079,0x00 } + , { 0x0073,0x0079,0x0073,0x0074,0x0065,0x006D,0x0020,0x006F,0x0072,0x0020,0x0070,0x0075,0x0062,0x006C,0x0069,0x0063,0x0020,0x0069,0x0064,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x002C,0x0027,0x002C,0x0020,0x0027,0x007C,0x0027,0x002C,0x0020,0x006F,0x0072,0x0020,0x0027,0x0029,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x007C,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0029,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x002C,0x0027,0x002C,0x0020,0x0027,0x007C,0x0027,0x002C,0x0020,0x006F,0x0072,0x0020,0x0027,0x0029,0x0027,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E, + 0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0075,0x006D,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072, + 0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x007C,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0029,0x0027,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x006C,0x0069,0x0074,0x0065,0x0072,0x0061,0x006C,0x00 } + , { 0x0075,0x006E,0x006D,0x0061,0x0074,0x0063,0x0068,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x0074,0x0061,0x0067,0x0020,0x0064,0x0065,0x0074,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x0028,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065, + 0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0027,0x003C,0x0027,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0061,0x0074,0x0074, + 0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x0075,0x0073,0x0065,0x0020,0x0026,0x006C,0x0074,0x003B,0x0020,0x0069,0x006E,0x0073,0x0074,0x0065,0x0061, + 0x0064,0x00 } + , { 0x006C,0x0065,0x0061,0x0064,0x0069,0x006E,0x0067,0x0020,0x0073,0x0075,0x0072,0x0072,0x006F,0x0067,0x0061,0x0074,0x0065,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020, + 0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0061,0x0020,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0073,0x0065,0x0063,0x006F,0x006E,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065, + 0x0072,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x005D,0x005D,0x003E,0x0027,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x006F,0x0020,0x0065,0x006E,0x0064,0x0020,0x0063,0x006F,0x006E,0x0064, + 0x0069,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0049,0x004E,0x0043,0x004C,0x0055,0x0044,0x0045,0x0020,0x006F,0x0072,0x0020,0x0049,0x0047,0x004E,0x004F,0x0052,0x0045,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020, + 0x0070,0x006F,0x0069,0x006E,0x0074,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x005B,0x0027,0x0020,0x0074,0x006F,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0020,0x0049,0x004E,0x0043,0x004C,0x0055,0x0044,0x0045,0x0020,0x006F,0x0072,0x0020,0x0049, + 0x0047,0x004E,0x004F,0x0052,0x0045,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0070,0x0072,0x006F,0x0070,0x0061,0x0067,0x0061,0x0074,0x0065,0x0064,0x0020,0x006F,0x0075,0x0074,0x0020,0x006F,0x0066,0x0020, + 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x002F,0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x00 } + , { 0x0075,0x006E,0x006D,0x0061,0x0074,0x0063,0x0068,0x0065,0x0064,0x0020,0x0027,0x005D,0x0027,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0064,0x0065,0x0074,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x006E,0x006F,0x0074, + 0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0069,0x006E,0x0073,0x0069,0x0064,0x0065,0x0020,0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x0020,0x0069,0x006E,0x0020,0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020, + 0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x00 } + , { 0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0070,0x0072,0x006F,0x0070,0x0061,0x0067,0x0061,0x0074,0x0065,0x0064,0x0020,0x006F,0x0075,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E, + 0x0074,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0074,0x006F,0x0020,0x006D,0x0069,0x0073,0x0063,0x0065,0x006C,0x006C,0x0061,0x006E,0x0065,0x006F,0x0075,0x0073,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0026,0x0023,0x0020,0x0074,0x006F,0x0020,0x0062,0x0065,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0061,0x0020,0x006E,0x0075,0x006D, + 0x0065,0x0072,0x0069,0x0063,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0027,0x005B,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x005D,0x005D,0x003E,0x0027,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0063,0x0068, + 0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0064,0x0061,0x0074,0x0061,0x00 } + , { 0x0027,0x002D,0x002D,0x0027,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074, + 0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x004E,0x0044,0x0041,0x0054,0x0041,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x004E,0x0044,0x0041,0x0054,0x0041,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0066,0x006F,0x0072,0x0020,0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069, + 0x0074,0x0069,0x0065,0x0073,0x00 } + , { 0x0068,0x0065,0x0078,0x0020,0x0072,0x0061,0x0064,0x0069,0x0078,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0073,0x0020,0x006D,0x0075,0x0073,0x0074, + 0x0020,0x0075,0x0073,0x0065,0x0020,0x0027,0x0078,0x0027,0x002C,0x0020,0x006E,0x006F,0x0074,0x0020,0x0027,0x0058,0x0027,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0073,0x0065,0x0065,0x006E,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x006F,0x0072, + 0x0064,0x0065,0x0072,0x003A,0x0020,0x0076,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x002C,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x002C,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x00 } + , { 0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0072,0x0065,0x0064,0x0020, + 0x0074,0x006F,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x006F,0x0072,0x0020,0x0054,0x0045,0x0058,0x0054,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020, + 0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x003C,0x003F,0x0078,0x006D,0x006C,0x0020,0x0027,0x002C,0x0020,0x006E,0x006F,0x0074,0x0020,0x0027,0x003C,0x003F,0x0058,0x004D,0x004C,0x0020,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x006C,0x0069,0x0074,0x0065,0x0072,0x0061,0x006C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x006F,0x0072,0x0020,0x0070,0x0075, + 0x0062,0x006C,0x0069,0x0063,0x002F,0x0073,0x0079,0x0073,0x0074,0x0065,0x006D,0x0020,0x0069,0x0064,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0064,0x0069,0x0067,0x0069,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0074,0x0068,0x0065,0x0020, + 0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0072,0x0061,0x0064,0x0069,0x0078,0x00 } + , { 0x0069,0x006E,0x0070,0x0075,0x0074,0x0020,0x0065,0x006E,0x0064,0x0065,0x0064,0x0020,0x0062,0x0065,0x0066,0x006F,0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0065,0x0064,0x0020,0x0074,0x0061,0x0067,0x0073, + 0x0020,0x0077,0x0065,0x0072,0x0065,0x0020,0x0065,0x006E,0x0064,0x0065,0x0064,0x003B,0x0020,0x006C,0x0061,0x0073,0x0074,0x0020,0x0074,0x0061,0x0067,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0065,0x0064,0x0020,0x0069,0x0073,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x00 } + , { 0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0064,0x0020,0x0074,0x006F, + 0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0055,0x0052,0x0049,0x00 } + , { 0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0061,0x006E,0x0064,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x006E,0x0064,0x0020,0x0074,0x0061,0x0067,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x0069,0x006E,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065, + 0x0072,0x0065,0x006E,0x0074,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0069,0x0065,0x0073,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x006F,0x0075,0x0074,0x0073,0x0069,0x0064,0x0065,0x0020,0x0074,0x0068, + 0x0065,0x0020,0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0074,0x0072,0x0061,0x0069,0x006C,0x0069,0x006E,0x0067,0x0020,0x0073,0x0075,0x0072,0x0072,0x006F,0x0067,0x0061,0x0074,0x0065,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061, + 0x0063,0x0074,0x0065,0x0072,0x00 } + , { 0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074, + 0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x0078,0x006D,0x006C,0x0027,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x006F,0x0072,0x0020,0x0054,0x0045,0x0058,0x0054,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020, + 0x0061,0x0074,0x0020,0x006C,0x0069,0x006E,0x0065,0x0020,0x0031,0x002C,0x0020,0x0063,0x006F,0x006C,0x0075,0x006D,0x006E,0x0020,0x0031,0x00 } + , { 0x0076,0x0065,0x0072,0x0073,0x0069,0x006F,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020, + 0x0058,0x004D,0x004C,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x006C,0x0065,0x0067,0x0061, + 0x006C,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x006D,0x0061,0x0069,0x006E,0x0020,0x0058,0x004D,0x004C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x00 } + , { 0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x0064,0x0020,0x0069,0x006E, + 0x0020,0x0054,0x0045,0x0058,0x0054,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0063,0x006F,0x006C,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0069,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0020,0x0077,0x0068,0x0065,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065, + 0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x0065,0x006E,0x0061,0x0062,0x006C,0x0065,0x0064,0x00 } + , { 0x007B,0x0030,0x007D,0x00 } + , { 0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x004C,0x006F,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x006E,0x0061,0x006D, + 0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x002D,0x006C,0x006F,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0070,0x0061,0x0069,0x0072,0x0073,0x00 } + , { 0x0066,0x0061,0x0074,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0064,0x0075,0x0072,0x0069,0x006E,0x0067,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0073,0x0063,0x0061,0x006E,0x00 } + , { 0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x006F,0x0020,0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072, + 0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E, + 0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0070,0x0061,0x0072,0x0074,0x0069,0x0061,0x006C,0x0020,0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x0020,0x0069,0x006E,0x0020,0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020, + 0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0074,0x0065,0x0078,0x0074,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072, + 0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x006E,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x002D,0x006E, + 0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006D,0x0061,0x0070,0x0070,0x0069,0x006E,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0027,0x0078,0x006D,0x006C,0x006E,0x0073,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0078,0x0070,0x006C,0x0069,0x0063,0x0069,0x0074,0x006C,0x0079, + 0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0020,0x0074,0x006F,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x0078,0x006D,0x006C,0x006E,0x0073,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0078,0x0070, + 0x006C,0x0069,0x0063,0x0069,0x0074,0x006C,0x0079,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0020,0x0074,0x006F,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x00 } + , { 0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0027,0x0078,0x006D,0x006C,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0020,0x0074,0x006F,0x0020,0x006E,0x0061,0x006D, + 0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006F,0x0074,0x0068,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0069,0x0074,0x0073,0x0020,0x0063,0x0061,0x006E,0x006F,0x006E,0x0069,0x0063,0x0061,0x006C,0x0020,0x006E,0x0061,0x006D, + 0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x0078,0x006D,0x006C,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064, + 0x0020,0x0074,0x006F,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x006F,0x0074,0x0068,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0027,0x0078,0x006D,0x006C,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0027,0x0078,0x006D,0x006C,0x006E,0x0073,0x0027,0x0020,0x0061, + 0x0073,0x0020,0x0069,0x0074,0x0073,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x00 } + , { 0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0054,0x0079,0x0070,0x0065, + 0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0044,0x004F,0x0043,0x0054,0x0059, + 0x0050,0x0045,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027, + 0x00 } + , { 0x0044,0x004F,0x0043,0x0054,0x0059,0x0050,0x0045,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0073,0x0065,0x0065,0x006E,0x00 } + , { 0x0066,0x0061,0x006C,0x006C,0x0062,0x0061,0x0063,0x006B,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0064,0x0069,0x0072,0x0065,0x0063,0x0074,0x0020,0x0063,0x0068, + 0x0069,0x006C,0x0064,0x0020,0x006F,0x0066,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0077,0x0069,0x0074,0x0068,0x006F,0x0075,0x0074,0x0020,0x0027,0x0068,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072, + 0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0058,0x0050,0x006F,0x0069,0x006E,0x0074,0x0065,0x0072,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069, + 0x0066,0x0069,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x003B,0x0020,0x0058,0x0050,0x006F,0x0069,0x006E,0x0074,0x0065,0x0072,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0079,0x0065,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F, + 0x0072,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0027,0x0070,0x0061,0x0072,0x0073,0x0065,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x003B,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x0074,0x0065,0x0078,0x0074,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0078,0x006D,0x006C,0x0027,0x00 } + , { 0x006D,0x0075,0x006C,0x0074,0x0069,0x0070,0x006C,0x0065,0x0020,0x0066,0x0061,0x006C,0x006C,0x0062,0x0061,0x0063,0x006B,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0069,0x006E,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D, + 0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0066,0x0061,0x0069,0x006C,0x0065,0x0064,0x0020,0x0061,0x006E,0x0064,0x0020,0x006E,0x006F,0x0020,0x0066,0x0061,0x006C,0x006C,0x0062,0x0061,0x0063,0x006B,0x0020,0x0065,0x006C,0x0065,0x006D, + 0x0065,0x006E,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0069,0x006E,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0063,0x0069,0x0072,0x0063,0x0075,0x006C,0x0061,0x0072,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x00 } + , { 0x0073,0x0065,0x006C,0x0066,0x002D,0x0069,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0061,0x0073,0x0020,0x0061,0x0020,0x0063, + 0x0068,0x0069,0x006C,0x0064,0x0020,0x006F,0x0066,0x0020,0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0064,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x006F,0x006E,0x0066,0x006C,0x0069,0x0063,0x0074,0x0073,0x0020,0x0077, + 0x0069,0x0074,0x0068,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0063,0x006C,0x0075,0x0064,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x006F,0x006E,0x0066,0x006C,0x0069,0x0063,0x0074,0x0073,0x0020,0x0077,0x0069,0x0074, + 0x0068,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x00 } + , { 0x0046,0x005F,0x0045,0x006E,0x0064,0x00 } + +}; +const unsigned int gXMLErrArraySize = 288; + +const XMLCh gXMLValidityArray[][128] = +{ + { 0x0045,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x006E,0x006F,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x006F,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020, + 0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0062,0x0075,0x0074,0x0020,0x0077,0x0061, + 0x0073,0x0020,0x006E,0x0065,0x0076,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0073,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C, + 0x0061,0x0072,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0044,0x004F,0x0043,0x0054,0x0059,0x0050,0x0045,0x00 } + , { 0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x0064,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0063,0x006F, + 0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0049,0x0044,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0023,0x0049,0x004D,0x0050,0x004C,0x0049,0x0045,0x0044,0x0020,0x006F,0x0072,0x0020,0x0023,0x0052, + 0x0045,0x0051,0x0055,0x0049,0x0052,0x0045,0x0044,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0062,0x0065,0x0065,0x006E,0x0020,0x0064,0x0065,0x0063,0x006C, + 0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0049,0x0044,0x0020, + 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0049,0x0044,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0062,0x0065,0x0065,0x006E,0x0020,0x0075,0x0073,0x0065, + 0x0064,0x00 } + , { 0x0049,0x0044,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0064,0x0020,0x0062,0x0075, + 0x0074,0x0020,0x0077,0x0061,0x0073,0x0020,0x006E,0x0065,0x0076,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0073,0x0020,0x0074,0x006F,0x0020,0x0075,0x006E,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065, + 0x0064,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0044,0x004F,0x0043,0x0054,0x0059, + 0x0050,0x0045,0x0020,0x0062,0x0075,0x0074,0x0020,0x0077,0x0061,0x0073,0x0020,0x006E,0x0065,0x0076,0x0065,0x0072,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x00 } + , { 0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0063,0x006F,0x006E,0x0074, + 0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0066,0x006F,0x0072, + 0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006F,0x0066,0x0020, + 0x0074,0x0079,0x0070,0x0065,0x0020,0x0045,0x004E,0x0054,0x0049,0x0054,0x0059,0x002F,0x0045,0x004E,0x0054,0x0049,0x0054,0x0049,0x0045,0x0053,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0020,0x0074,0x006F,0x0020, + 0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x002C,0x0020,0x0075,0x006E,0x0070,0x0061,0x0072,0x0073,0x0065,0x0064,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0073,0x0020,0x0074,0x006F,0x0020,0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0065, + 0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0049,0x0044,0x002F,0x0049,0x0044,0x0052,0x0045,0x0046,0x002F,0x0049,0x0044,0x0052,0x0045,0x0046,0x0053,0x002F,0x0045, + 0x004E,0x0054,0x0049,0x0054,0x0059,0x002F,0x0045,0x004E,0x0054,0x0049,0x0054,0x0049,0x0045,0x0053,0x002F,0x004E,0x004F,0x0054,0x0041,0x0054,0x0049,0x004F,0x004E,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074, + 0x0061,0x0069,0x006E,0x0020,0x0063,0x006F,0x006C,0x006F,0x006E,0x0020,0x0077,0x0068,0x0065,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x0065,0x006E,0x0061,0x0062,0x006C, + 0x0065,0x0064,0x00 } + , { 0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0027, + 0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x006F,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0064,0x0061,0x0074,0x0061,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0063,0x006F,0x006E, + 0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065, + 0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0069,0x0074,0x0073,0x0020,0x0074,0x0079,0x0070,0x0065,0x0027,0x0073,0x0020,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020,0x0065,0x006E,0x0075,0x006D, + 0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0072,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006C,0x0069,0x0073,0x0074,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020, + 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x004E,0x0061,0x006D,0x0065,0x0020,0x006F,0x0072,0x0020,0x004E,0x004D,0x0054,0x004F,0x004B,0x0045,0x004E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0020,0x006D,0x0075,0x006C,0x0074, + 0x0069,0x0070,0x006C,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0074,0x0068,0x0061, + 0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0069,0x0074,0x0073,0x0020,0x0023,0x0046,0x0049,0x0058,0x0045,0x0044,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027, + 0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0073,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0064,0x0020, + 0x0069,0x006E,0x0020,0x006D,0x0069,0x0078,0x0065,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x007B,0x0031,0x007D,0x0020,0x0063,0x006F,0x006D, + 0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x003B,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x002C,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x002C,0x0020,0x0063,0x0068,0x006F,0x0069,0x0063, + 0x0065,0x002C,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x002C,0x0020,0x0061,0x006E,0x0064,0x0020,0x0061,0x006E,0x0079,0x0020,0x0061,0x0072,0x0065,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020, + 0x0064,0x0065,0x0066,0x0069,0x006E,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x0072,0x0065,0x0066,0x0027,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074, + 0x0065,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x00 } + , { 0x007B,0x0030,0x007D,0x00 } + , { 0x0070,0x0072,0x006F,0x0068,0x0069,0x0062,0x0069,0x0074,0x0065,0x0064,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065, + 0x006E,0x0074,0x00 } + , { 0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0027,0x0078,0x006D,0x006C,0x003A,0x0073,0x0070,0x0061,0x0063,0x0065,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074, + 0x0020,0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x006E,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063, + 0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0069,0x006E,0x0073,0x0074,0x0061,0x006E,0x0063,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006F,0x0066,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0061,0x006E,0x0064, + 0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0069,0x006E,0x0020,0x0069,0x0074,0x0073,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E, + 0x0074,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x006E,0x0064,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x006F,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065, + 0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x007B,0x0030,0x007D,0x00 } + , { 0x0027,0x0078,0x0073,0x0069,0x003A,0x006E,0x0069,0x006C,0x0027,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x006E,0x006F,0x006E,0x002D,0x006E,0x0069,0x006C,0x006C,0x0061,0x0062,0x006C, + 0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x0069,0x006C,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x006D, + 0x0070,0x0074,0x0079,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0073,0x0020,0x0066,0x0072, + 0x006F,0x006D,0x0020,0x0069,0x0074,0x0073,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x006E,0x0064,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x006F,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x0073,0x0069,0x006D,0x0070,0x006C,0x0065, + 0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0064,0x0075,0x0072,0x0069,0x006E,0x0067,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0073,0x0063,0x0061,0x006E,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x006E,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 } + , { 0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0074,0x006F,0x0020,0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072, + 0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064, + 0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0068,0x0061, + 0x0073,0x0020,0x0064,0x0065,0x0066,0x0061,0x0075,0x006C,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069, + 0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0063,0x0068,0x0061,0x006E,0x0067,0x0065,0x0064, + 0x0020,0x0062,0x0079,0x0020,0x006E,0x006F,0x0072,0x006D,0x0061,0x006C,0x0069,0x007A,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x006F,0x0063, + 0x0075,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x006F,0x0063,0x0063,0x0075,0x0072,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E,0x0020,0x0065, + 0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x006C,0x0079,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0065,0x006C, + 0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x006E,0x0064,0x0061,0x006C,0x006F,0x006E,0x0065,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E, + 0x0074,0x00 } + , { 0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0070,0x0061,0x0072,0x0074,0x0069,0x0061,0x006C,0x0020,0x006D,0x0061,0x0072,0x006B,0x0075,0x0070,0x0020,0x0069,0x006E,0x0020,0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020, + 0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0074,0x0065,0x0078,0x0074,0x00 } + , { 0x0066,0x0061,0x0069,0x006C,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0076,0x0069,0x006F,0x006C,0x0061,0x0074,0x0065,0x0073,0x0020,0x0074,0x0068,0x0065,0x0020,0x0075,0x006E,0x0069, + 0x0071,0x0075,0x0065,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0069,0x006F,0x006E,0x0020,0x0072,0x0075,0x006C,0x0065,0x0020,0x0069,0x006E,0x0020,0x0069,0x0074, + 0x0073,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x006E,0x0065,0x006E,0x0074,0x0073,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0061,0x006E,0x0064,0x0020,0x0027,0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0061,0x0062,0x0073,0x0074,0x0072,0x0061,0x0063,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020, + 0x0069,0x006E,0x0020,0x0027,0x0078,0x0073,0x0069,0x003A,0x0074,0x0079,0x0070,0x0065,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x0062,0x0073,0x0074,0x0072,0x0061,0x0063,0x0074,0x003B,0x0020,0x0075,0x0073,0x0065,0x0020,0x006E,0x006F,0x006E,0x002D, + 0x0061,0x0062,0x0073,0x0074,0x0072,0x0061,0x0063,0x0074,0x0020,0x006D,0x0065,0x006D,0x0062,0x0065,0x0072,0x0020,0x006F,0x0066,0x0020,0x0069,0x0074,0x0073,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E, + 0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0069,0x006E,0x0073,0x0074,0x0065,0x0061,0x0064,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x0062,0x0073,0x0074,0x0072,0x0061,0x0063,0x0074,0x003B,0x0020, + 0x0075,0x0073,0x0065,0x0020,0x0027,0x0078,0x0073,0x0069,0x003A,0x0074,0x0079,0x0070,0x0065,0x0027,0x0020,0x0074,0x006F,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0079,0x0020,0x006E,0x006F,0x006E,0x002D,0x0061,0x0062,0x0073,0x0074,0x0072, + 0x0061,0x0063,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0073,0x0074,0x0065,0x0061,0x0064,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0027,0x0078,0x0073,0x0069,0x003A,0x0074,0x0079,0x0070,0x0065,0x0027,0x0020, + 0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0064,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0027,0x0078,0x0073,0x0069,0x003A,0x0074,0x0079,0x0070,0x0065,0x0027,0x0020, + 0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E, + 0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074, + 0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0020, + 0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x006E,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064, + 0x00 } + , { 0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0066,0x0069,0x0065,0x006C,0x0064,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0065,0x0073,0x0020,0x006D, + 0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0077,0x0069,0x0074,0x0068,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0063,0x006F,0x0070,0x0065, + 0x0020,0x006F,0x0066,0x0020,0x0069,0x0074,0x0073,0x0020,0x0073,0x0065,0x006C,0x0065,0x0063,0x0074,0x006F,0x0072,0x003B,0x0020,0x0066,0x0069,0x0065,0x006C,0x0064,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020, + 0x0075,0x006E,0x0069,0x0071,0x0075,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0066,0x0069,0x0065,0x006C,0x0064,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069, + 0x006E,0x0074,0x0020,0x006B,0x0065,0x0079,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x006E,0x006F,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0065,0x006E,0x006F,0x0075,0x0067,0x0068,0x0020, + 0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x0020,0x0066,0x006F,0x0072,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x006B,0x0065,0x0079,0x0020, + 0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0073,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E, + 0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x006B,0x0065,0x0079,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0065,0x0073,0x0020,0x006E,0x0069,0x006C,0x006C,0x0061,0x0062,0x006C,0x0065,0x0020,0x0065, + 0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0073,0x0020,0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0069,0x0064, + 0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x0075,0x006E,0x0069,0x0071,0x0075,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0073,0x0020,0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0069,0x0064, + 0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x006B,0x0065,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x00 } + , { 0x006B,0x0065,0x0079,0x0072,0x0065,0x0066,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0073,0x0020,0x0074,0x006F,0x0020,0x006F,0x0075,0x0074,0x0020,0x006F,0x0066,0x0020,0x0073,0x0063,0x006F,0x0070,0x0065, + 0x0020,0x006B,0x0065,0x0079,0x002F,0x0075,0x006E,0x0069,0x0071,0x0075,0x0065,0x00 } + , { 0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0020,0x006B,0x0065,0x0079,0x0020,0x0066,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074, + 0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x006E,0x006F,0x006E,0x002D,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061, + 0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x0020,0x006F,0x0074,0x0068,0x0065,0x0072, + 0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0061,0x0070,0x0070,0x0069,0x006E,0x0066,0x006F,0x0020,0x0061,0x006E,0x0064,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0045,0x004D,0x0050,0x0054,0x0059,0x0020,0x0062,0x0075,0x0074,0x0020,0x0068,0x0061, + 0x0073,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006F,0x0066,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x004E,0x004F,0x0054,0x0041,0x0054,0x0049,0x004F,0x004E,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0065,0x0064,0x0020,0x0045,0x004D,0x0050,0x0054,0x0059,0x0020,0x0061,0x006E,0x0064,0x0020,0x0063,0x0061, + 0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x002C,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x0076,0x0065,0x006E,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020, + 0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0073,0x002C,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x0073,0x002C,0x0020,0x0050,0x0049,0x0073,0x002C,0x0020,0x006F,0x0072,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065, + 0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0061,0x0074,0x0074, + 0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x004E,0x004F,0x0054,0x0041,0x0054,0x0049,0x004F,0x004E,0x00 } + , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x006F,0x006E,0x002D,0x0064,0x0069,0x0073,0x0074,0x0069,0x006E,0x0063,0x0074,0x0020,0x0074,0x006F, + 0x006B,0x0065,0x006E,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073, + 0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0020,0x0065,0x0073,0x0063,0x0061,0x0070,0x0065,0x0064,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x00 } + , { 0x0045,0x005F,0x0045,0x006E,0x0064,0x00 } + +}; +const unsigned int gXMLValidityArraySize = 84; + +const XMLCh gXMLExceptArray[][128] = +{ + { 0x0057,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0070,0x0072,0x0069,0x006D,0x0061,0x0072,0x0079,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0065,0x006E,0x0074, + 0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0057,0x005F,0x0045,0x006E,0x0064,0x00 } + , { 0x0046,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0062,0x0065,0x0079,0x006F,0x006E,0x0064,0x0020,0x0061,0x0072,0x0072,0x0061,0x0079,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0073,0x00 } + , { 0x006E,0x0065,0x0077,0x0020,0x0061,0x0072,0x0072,0x0061,0x0079,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0069,0x0073,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x006C,0x0064, + 0x00 } + , { 0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0062,0x0065,0x0079,0x006F,0x006E,0x0064,0x0020,0x006D,0x0061,0x0078,0x0069,0x006D,0x0075,0x006D,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0069, + 0x006E,0x0064,0x0065,0x0078,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0041,0x0074,0x0074,0x0054,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0044,0x0065,0x0066,0x0041,0x0074,0x0074,0x0054,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0062,0x0069,0x0074,0x0020,0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0062,0x0065,0x0079,0x006F,0x006E,0x0064,0x0020,0x0073,0x0065,0x0074,0x0020,0x0073,0x0069,0x007A,0x0065,0x00 } + , { 0x0062,0x0069,0x0074,0x0020,0x0073,0x0065,0x0074,0x0073,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074,0x0020,0x0073,0x0069,0x007A,0x0065,0x0073,0x00 } + , { 0x006E,0x006F,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0073,0x0020,0x0061,0x0076,0x0061,0x0069,0x006C,0x0061,0x0062,0x006C,0x0065,0x00 } + , { 0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x006D,0x0061,0x006E,0x0061,0x0067,0x0065,0x0072,0x0027, + 0x0073,0x0020,0x0070,0x006F,0x006F,0x006C,0x00 } + , { 0x004E,0x0055,0x004C,0x004C,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0065,0x0072,0x00 } + , { 0x0062,0x0069,0x006E,0x0061,0x0072,0x0079,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0068,0x0061,0x0073,0x0020,0x0075,0x006E,0x0061,0x0072,0x0079,0x0020,0x006E,0x006F,0x0064, + 0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006D,0x0069,0x0078,0x0065,0x0064,0x0020,0x006F,0x0072,0x0020,0x0063,0x0068,0x0069,0x006C,0x0064, + 0x0072,0x0065,0x006E,0x00 } + , { 0x0050,0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0070,0x006F,0x0069,0x006E, + 0x0074,0x00 } + , { 0x0075,0x006E,0x0061,0x0072,0x0079,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0068,0x0061,0x0073,0x0020,0x0062,0x0069,0x006E,0x0061,0x0072,0x0079,0x0020,0x006E,0x006F,0x0064, + 0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x006D,0x006F,0x0064,0x0065,0x006C,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0070,0x0061,0x0072,0x0065,0x006E,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x006F,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0020, + 0x006E,0x006F,0x0064,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0073,0x0070,0x0065,0x0063,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0072,0x0065,0x0061,0x0073,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0073,0x0074,0x0061,0x0063,0x006B,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0070,0x006F,0x0070,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0072,0x0065,0x0071,0x0075,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x006F,0x006E,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0073,0x0074, + 0x0061,0x0063,0x006B,0x00 } + , { 0x0070,0x0061,0x0072,0x0065,0x006E,0x0074,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0072,0x0065,0x0071,0x0075,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x006F,0x006E,0x006C, + 0x0079,0x0020,0x006F,0x006E,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0073,0x0074,0x0061,0x0063,0x006B,0x00 } + , { 0x006E,0x006F,0x0020,0x006D,0x006F,0x0072,0x0065,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x0020,0x0069,0x006E,0x0020,0x0065,0x006E,0x0075,0x006D,0x0065,0x0072,0x0061,0x0074,0x006F,0x0072,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0071,0x0075,0x0065,0x0072,0x0079,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0070,0x006F,0x0073,0x0069,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x006C,0x006F,0x0073,0x0065,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0073,0x0065,0x0065,0x006B,0x0020,0x0074,0x006F,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0073,0x0065,0x0065,0x006B,0x0020,0x0074,0x006F,0x0020,0x0074,0x0068,0x0065,0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x0064,0x0020,0x0070,0x006F,0x0073,0x0069, + 0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x006E,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0064,0x0075,0x0070,0x006C,0x0069,0x0063,0x0061,0x0074,0x0065,0x0020,0x0068,0x0061,0x006E,0x0064,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0072,0x0065,0x0061,0x0064,0x0020,0x0064,0x0061,0x0074,0x0061,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0077,0x0072,0x0069,0x0074,0x0065,0x0020,0x0064,0x0061,0x0074,0x0061,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0072,0x0065,0x0073,0x0065,0x0074,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0070,0x006F,0x0073,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x0074,0x006F,0x0020,0x0074,0x0068, + 0x0065,0x0020,0x0062,0x0065,0x0067,0x0069,0x006E,0x006E,0x0069,0x006E,0x0067,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0067,0x0065,0x0074,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0073,0x0069,0x007A,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0064,0x0065,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0065,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0070,0x0061,0x0074,0x0068,0x006E, + 0x0061,0x006D,0x0065,0x00 } + , { 0x0070,0x0061,0x0072,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0020,0x0070,0x0072,0x006F,0x0067,0x0072,0x0065,0x0073,0x0073,0x00 } + , { 0x0044,0x004F,0x0043,0x0054,0x0059,0x0050,0x0045,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0077,0x0061,0x0073,0x0020,0x0073,0x0065,0x0065,0x006E,0x0020,0x0062,0x0075,0x0074,0x0020,0x0069,0x006E, + 0x0073,0x0074,0x0061,0x006C,0x006C,0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x006F,0x0072,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0020, + 0x0044,0x0054,0x0044,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0044,0x0054,0x0044,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0065,0x0078,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0069,0x006E,0x0070,0x0075,0x0074,0x00 } + , { 0x007A,0x0065,0x0072,0x006F,0x0020,0x0068,0x0061,0x0073,0x0068,0x0020,0x006D,0x006F,0x0064,0x0075,0x006C,0x0075,0x0073,0x00 } + , { 0x0068,0x0061,0x0073,0x0068,0x0069,0x006E,0x0067,0x0020,0x006B,0x0065,0x0079,0x0020,0x0070,0x0072,0x006F,0x0064,0x0075,0x0063,0x0065,0x0064,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0068,0x0061,0x0073,0x0068,0x00 } + , { 0x006E,0x006F,0x0020,0x0073,0x0075,0x0063,0x0068,0x0020,0x006B,0x0065,0x0079,0x0020,0x0069,0x006E,0x0020,0x0068,0x0061,0x0073,0x0068,0x0020,0x0074,0x0061,0x0062,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0064,0x0065,0x0073,0x0074,0x0072,0x006F,0x0079,0x0020,0x006D,0x0075,0x0074,0x0065,0x0078,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x004E,0x0065,0x0074,0x0041,0x0063,0x0063,0x0065,0x0073,0x0073,0x006F,0x0072,0x00 } + , { 0x004E,0x0065,0x0074,0x0041,0x0063,0x0063,0x0065,0x0073,0x0073,0x006F,0x0072,0x0020,0x0069,0x0073,0x0020,0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0064,0x0065,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0065,0x0020, + 0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x006F,0x0066,0x0020,0x0072,0x0065,0x006D,0x006F,0x0074,0x0065,0x0020,0x0066,0x0069,0x006C,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0069,0x006E,0x0069,0x0074,0x0069,0x0061,0x006C,0x0069,0x007A,0x0065,0x0020,0x004E,0x0065,0x0074,0x0041,0x0063,0x0063,0x0065,0x0073,0x0073,0x006F,0x0072,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0020,0x0068,0x006F,0x0073,0x0074,0x002F,0x0061,0x0064,0x0064,0x0072,0x0065,0x0073,0x0073,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x0020,0x0073,0x006F,0x0063,0x006B,0x0065,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0055,0x0052,0x004C,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x006F,0x006E,0x006E,0x0065,0x0063,0x0074,0x0020,0x0073,0x006F,0x0063,0x006B,0x0065,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0055,0x0052,0x004C,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0077,0x0072,0x0069,0x0074,0x0065,0x0020,0x0074,0x006F,0x0020,0x0073,0x006F,0x0063,0x006B,0x0065,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0055,0x0052,0x004C,0x0020,0x0027, + 0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0072,0x0065,0x0061,0x0064,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0073,0x006F,0x0063,0x006B,0x0065,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0055,0x0052,0x004C,0x0020, + 0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0048,0x0054,0x0054,0x0050,0x0020,0x006D,0x0065,0x0074,0x0068,0x006F,0x0064,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072, + 0x0074,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x004E,0x0065,0x0074,0x0041,0x0063,0x0063,0x0065,0x0073,0x0073,0x006F,0x0072,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0069,0x006E,0x0020,0x0070,0x006F,0x006F,0x006C,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x0064,0x00 } + , { 0x007A,0x0065,0x0072,0x006F,0x0020,0x0068,0x0061,0x0073,0x0068,0x0020,0x006D,0x006F,0x0064,0x0075,0x006C,0x0075,0x0073,0x00 } + , { 0x0072,0x0065,0x0061,0x0064,0x0065,0x0072,0x0020,0x0069,0x0064,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0061,0x0075,0x0074,0x006F,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0064,0x0065,0x0063,0x006F,0x0064,0x0065,0x0020,0x0066,0x0069,0x0072,0x0073,0x0074,0x0020,0x006C,0x0069,0x006E,0x0065,0x0020,0x0069,0x006E,0x0020,0x0065,0x006E,0x0074,0x0069, + 0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x006F,0x0072,0x0020,0x0054,0x0045,0x0058,0x0054,0x0020,0x0064,0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F, + 0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x004E,0x0045,0x004C,0x0020,0x006F,0x0072,0x0020,0x006C,0x0073,0x0065,0x0070,0x00 } + , { 0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0074,0x0020,0x0074,0x0072,0x0061,0x006E,0x0073,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0073,0x0065,0x0072,0x0076,0x0069,0x0063,0x0065,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F, + 0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0020,0x0073,0x006F,0x0075,0x0072,0x0063,0x0065,0x0020,0x006F,0x0066,0x0066,0x0073,0x0065,0x0074,0x0020,0x0069,0x006E,0x0066,0x006F,0x0072,0x006D,0x0061,0x0074,0x0069,0x006F,0x006E, + 0x00 } + , { 0x0045,0x0042,0x0043,0x0044,0x0049,0x0043,0x0020,0x0066,0x0069,0x006C,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0070,0x0072,0x006F,0x0076,0x0069,0x0064,0x0065,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x0020,0x0064, + 0x0065,0x0063,0x006C,0x0061,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x006F,0x0070,0x0065,0x006E,0x0020,0x0070,0x0072,0x0069,0x006D,0x0061,0x0072,0x0079,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x0065,0x006E,0x0074, + 0x0069,0x0074,0x0079,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0062,0x0061,0x006C,0x0061,0x006E,0x0063,0x0065,0x0064,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x002F,0x0065,0x006E,0x0064,0x0020,0x0074,0x0061,0x0067,0x0073,0x00 } + , { 0x0063,0x0061,0x006C,0x006C,0x0020,0x0074,0x006F,0x0020,0x0073,0x0063,0x0061,0x006E,0x004E,0x0065,0x0078,0x0074,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073, + 0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x00 } + , { 0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0070,0x0061,0x0073,0x0074,0x0020,0x0074,0x006F,0x0070,0x0020,0x006F,0x0066,0x0020,0x0073,0x0074,0x0061,0x0063,0x006B,0x00 } + , { 0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0073,0x0074,0x0061,0x0063,0x006B,0x00 } + , { 0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x007A,0x0065,0x0072,0x006F,0x0020,0x006D,0x0061,0x0078,0x0020, + 0x0073,0x0069,0x007A,0x0065,0x00 } + , { 0x0075,0x006E,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0072,0x0061,0x0064,0x0069,0x0078,0x003B,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0032,0x002C,0x0020,0x0038,0x002C,0x0020,0x0031, + 0x0030,0x002C,0x0020,0x006F,0x0072,0x0020,0x0031,0x0036,0x00 } + , { 0x0074,0x0061,0x0072,0x0067,0x0065,0x0074,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0069,0x0073,0x0020,0x0074,0x006F,0x006F,0x0020,0x0073,0x006D,0x0061,0x006C,0x006C,0x00 } + , { 0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0070,0x0061,0x0073,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0073,0x0074,0x0072,0x0069, + 0x006E,0x0067,0x00 } + , { 0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0072,0x0065,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0076,0x0065,0x0072,0x0066,0x006C,0x006F,0x0077,0x0073,0x0020,0x006F,0x0075,0x0074, + 0x0070,0x0075,0x0074,0x0020,0x0062,0x0069,0x006E,0x0061,0x0072,0x0079,0x0020,0x0072,0x0065,0x0073,0x0075,0x006C,0x0074,0x00 } + , { 0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0069,0x0064,0x00 } + , { 0x0063,0x0068,0x0061,0x0072,0x0020,0x0030,0x0078,0x007B,0x0030,0x007D,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0072,0x0065,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0061,0x0062,0x006C,0x0065,0x0020,0x0069,0x006E,0x0020, + 0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0075,0x006C,0x0074,0x0069,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0063,0x006F,0x0064,0x0065,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0020,0x0030,0x0078,0x007B,0x0030,0x007D,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x006C,0x0065,0x0061,0x0064,0x0069,0x006E,0x0067,0x0020,0x0073,0x0075,0x0072,0x0072,0x006F,0x0067,0x0061,0x0074,0x0065,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C, + 0x0069,0x0064,0x0020,0x0074,0x0072,0x0061,0x0069,0x006C,0x0069,0x006E,0x0067,0x0020,0x0073,0x0075,0x0072,0x0072,0x006F,0x0067,0x0061,0x0074,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x0020,0x0063,0x006F,0x006E,0x0076,0x0065,0x0072,0x0074,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D, + 0x0027,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x006D,0x0061,0x006C,0x0066,0x006F,0x0072,0x006D,0x0065,0x0064,0x0020,0x0055,0x0052,0x004C,0x00 } + , { 0x0075,0x006E,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0070,0x0072,0x006F,0x0074,0x006F,0x0063,0x006F,0x006C,0x0020,0x0069,0x006E,0x0020,0x0055,0x0052,0x004C,0x00 } + , { 0x0055,0x0052,0x004C,0x0020,0x0070,0x0072,0x006F,0x0074,0x006F,0x0063,0x006F,0x006C,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0075,0x006E,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x00 } + , { 0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0070,0x0072,0x006F,0x0074,0x006F,0x0063,0x006F,0x006C,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x002F,0x002F,0x0027,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0070,0x0072,0x006F,0x0074,0x006F,0x0063,0x006F,0x006C,0x00 } + , { 0x0062,0x0061,0x0073,0x0065,0x0020,0x0070,0x0061,0x0072,0x0074,0x0020,0x006F,0x0066,0x0020,0x0055,0x0052,0x004C,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x006C,0x0061,0x0074,0x0069,0x0076,0x0065, + 0x00 } + , { 0x0070,0x006F,0x0072,0x0074,0x0020,0x0066,0x0069,0x0065,0x006C,0x0064,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0031,0x0036,0x002D,0x0062,0x0069,0x0074,0x0020,0x0064,0x0065,0x0063,0x0069,0x006D,0x0061,0x006C,0x0020,0x006E, + 0x0075,0x006D,0x0062,0x0065,0x0072,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0062,0x0079,0x0074,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0061,0x0074,0x0020,0x0070,0x006F,0x0073,0x0069,0x0074,0x0069,0x006F,0x006E,0x0020,0x007B,0x0030,0x007D,0x0020, + 0x006F,0x0066,0x0020,0x0061,0x0020,0x007B,0x0032,0x007D,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0062,0x0079,0x0074,0x0065,0x0073,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0061,0x006E,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020, + 0x0033,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x0072,0x0072,0x0065,0x0067,0x0075,0x006C,0x0061,0x0072,0x0020,0x0062,0x0079,0x0074,0x0065,0x0073,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0061,0x006E,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006F,0x0066,0x0020, + 0x0061,0x0020,0x0033,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0062,0x0079,0x0074,0x0065,0x0073,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0061,0x006E,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020, + 0x0034,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0065,0x0064,0x0020,0x0062,0x0079,0x0074,0x0065,0x0020,0x006C,0x0069,0x006D,0x0069,0x0074,0x0020,0x0061,0x0074,0x0020,0x0062,0x0079,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069, + 0x006E,0x0020,0x0061,0x0020,0x007B,0x0031,0x007D,0x002D,0x0062,0x0079,0x0074,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0069,0x0073,0x0020,0x0062,0x0065,0x0079,0x006F,0x006E,0x0064,0x0020,0x0076,0x0065,0x0063,0x0074,0x006F,0x0072,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0073,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x0064,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0077,0x0068,0x0065,0x006E, + 0x0020,0x0072,0x0065,0x0075,0x0073,0x0069,0x006E,0x0067,0x0020,0x0074,0x0068,0x0065,0x0020,0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0072,0x0065,0x0063,0x006F,0x0067,0x006E,0x0069,0x007A,0x0065,0x0072,0x0020,0x0065,0x006E,0x0063,0x006F,0x0064,0x0069,0x006E,0x0067,0x00 } + , { 0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0061,0x0074,0x0020,0x006F,0x0066,0x0066,0x0073,0x0065,0x0074,0x0020,0x007B,0x0030,0x007D,0x0020,0x0069,0x006E,0x0020, + 0x0072,0x0065,0x0067,0x0075,0x006C,0x0061,0x0072,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x006E,0x0075,0x006D,0x0062,0x0065,0x0072,0x00 } + , { 0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0062,0x0061,0x0063,0x006B,0x0073,0x006C,0x0061,0x0073,0x0068,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x003F,0x0027,0x003B,0x0020,0x0027,0x0028,0x003F,0x003A,0x0027,0x002C,0x0020,0x0027,0x0028,0x003F,0x003D,0x0027,0x002C,0x0020,0x0027,0x0028,0x003F,0x0021,0x0027, + 0x002C,0x0020,0x0027,0x0028,0x003F,0x003C,0x0027,0x002C,0x0020,0x0027,0x0028,0x003F,0x0023,0x0027,0x002C,0x0020,0x006F,0x0072,0x0020,0x0027,0x0028,0x003F,0x003E,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x0028,0x003F,0x003C,0x003D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0028,0x003F,0x003C,0x0021,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0074,0x0065,0x0072,0x006D,0x0069,0x006E,0x0061,0x0074,0x0065,0x0064,0x0020,0x0063,0x006F,0x006D,0x006D,0x0065,0x006E,0x0074,0x00 } + , { 0x0027,0x0029,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x0020,0x0069,0x006E,0x0020,0x006D,0x006F,0x0064,0x0069,0x0066,0x0069, + 0x0065,0x0072,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x00 } + , { 0x0027,0x003A,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006E,0x0064,0x0069,0x0074, + 0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x00 } + , { 0x0062,0x0061,0x0063,0x006B,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x002C,0x0020,0x0061,0x006E,0x0063,0x0068,0x006F,0x0072,0x002C,0x0020,0x006C,0x006F,0x006F,0x006B,0x0061,0x0068,0x0065,0x0061,0x0064,0x002C,0x0020, + 0x006F,0x0072,0x0020,0x006C,0x006F,0x006F,0x006B,0x0062,0x0065,0x0068,0x0069,0x006E,0x0064,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006E,0x0064,0x0069,0x0074,0x0069,0x006F,0x006E, + 0x0061,0x006C,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x00 } + , { 0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0074,0x0068,0x0072,0x0065,0x0065,0x0020,0x0063,0x0068,0x006F,0x0069,0x0063,0x0065,0x0073,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x006E,0x0064,0x0069,0x0074,0x0069,0x006F, + 0x006E,0x0061,0x006C,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x00 } + , { 0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0055,0x002B,0x0030,0x0030,0x0034,0x0030,0x002D,0x0055,0x002B,0x0030,0x0030,0x0035,0x0066,0x0020,0x0072,0x0061,0x006E,0x0067, + 0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0020,0x0027,0x005C,0x0063,0x0027,0x00 } + , { 0x0027,0x007B,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0062,0x0065,0x0066,0x006F,0x0072,0x0065,0x0020,0x0063,0x0061,0x0074,0x0065,0x0067,0x006F,0x0072,0x0079,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063, + 0x0074,0x0065,0x0072,0x00 } + , { 0x0070,0x0072,0x006F,0x0070,0x0065,0x0072,0x0074,0x0079,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0063,0x006C,0x006F,0x0073,0x0065,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027, + 0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x006D,0x0065,0x0074,0x0061,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0070,0x0072,0x006F,0x0070,0x0065,0x0072,0x0074,0x0079,0x00 } + , { 0x0050,0x004F,0x0053,0x0049,0x0058,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0063,0x006C,0x0061,0x0073,0x0073,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0063,0x006C,0x006F,0x0073,0x0065, + 0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x003A,0x005D,0x0027,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0065,0x006E,0x0064,0x0020,0x006F,0x0066,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x0020,0x0069,0x006E,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063, + 0x0074,0x0065,0x0072,0x0020,0x0063,0x006C,0x0061,0x0073,0x0073,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0066,0x006F,0x0072,0x0020,0x0050,0x004F,0x0053,0x0049,0x0058,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0063,0x006C, + 0x0061,0x0073,0x0073,0x00 } + , { 0x0027,0x005D,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x003B,0x0020,0x0075, + 0x0073,0x0065,0x0020,0x0027,0x005C,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0073,0x0074,0x0065,0x0061,0x0064,0x00 } + , { 0x0027,0x005B,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0027,0x0029,0x0027,0x002C,0x0020,0x0027,0x002D,0x005B,0x0027,0x002C,0x0020,0x0027,0x002B,0x005B,0x0027,0x002C,0x0020,0x006F,0x0072,0x0020,0x0027,0x0026,0x005B,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x0065,0x006E,0x0064,0x0020,0x0063,0x006F,0x0064,0x0065,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020, + 0x0074,0x0068,0x0061,0x006E,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0063,0x006F,0x0064,0x0065,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0020,0x0068,0x0065,0x0078,0x0020,0x006E,0x006F,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0027,0x005C,0x0020,0x0078,0x007B,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0063,0x006C,0x006F,0x0073,0x0065,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0055,0x006E,0x0069,0x0063,0x006F,0x0064,0x0065,0x0020,0x0063,0x006F,0x0064,0x0065,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x00 } + , { 0x0061,0x006E,0x0063,0x0068,0x006F,0x0072,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0069,0x0073,0x0020,0x0070,0x006F, + 0x0069,0x006E,0x0074,0x00 } + , { 0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0065,0x0073,0x0063,0x0061,0x0070,0x0065,0x0020,0x0073, + 0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0066,0x0069,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x0064,0x0069,0x0067,0x0069,0x0074,0x0020, + 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0066,0x0069,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069, + 0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x006F,0x0072,0x0020,0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0020,0x0027,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0066,0x0069,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x0064,0x0069,0x0067,0x0069,0x0074,0x0020, + 0x006F,0x0072,0x0020,0x0027,0x007D,0x0027,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0066,0x0069,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x006D,0x0069,0x006E,0x0020,0x0071,0x0075, + 0x0061,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x006D, + 0x0061,0x0078,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0074,0x0079,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069,0x0066,0x0069,0x0065,0x0072,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x003B,0x0020,0x0071,0x0075,0x0061,0x006E,0x0074,0x0069, + 0x0074,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x006F,0x0076,0x0065,0x0072,0x0066,0x006C,0x006F,0x0077,0x00 } + , { 0x0058,0x004D,0x004C,0x0020,0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0077,0x0061,0x0073,0x0020,0x0073,0x0065,0x0065,0x006E,0x0020,0x0062,0x0075,0x0074,0x0020,0x0069,0x006E,0x0073,0x0074,0x0061,0x006C,0x006C,0x0065,0x0064,0x0020,0x0076, + 0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x006F,0x0072,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0020,0x0058,0x004D,0x004C,0x0020,0x0053,0x0063,0x0068,0x0065,0x006D, + 0x0061,0x00 } + , { 0x0053,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x0047,0x0072,0x006F,0x0075,0x0070,0x0043,0x006F,0x006D,0x0070,0x0061,0x0072,0x0061,0x0074,0x006F,0x0072,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x006F,0x0020, + 0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0072,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0020,0x006E,0x006F,0x006E,0x002D,0x006E,0x0065, + 0x0067,0x0061,0x0074,0x0069,0x0076,0x0065,0x0020,0x0069,0x006E,0x0074,0x0065,0x0067,0x0065,0x0072,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0020,0x006E,0x006F,0x006E, + 0x002D,0x006E,0x0065,0x0067,0x0061,0x0074,0x0069,0x0076,0x0065,0x0020,0x0069,0x006E,0x0074,0x0065,0x0067,0x0065,0x0072,0x00 } + , { 0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0020,0x006E,0x006F,0x006E, + 0x002D,0x006E,0x0065,0x0067,0x0061,0x0074,0x0069,0x0076,0x0065,0x0020,0x0069,0x006E,0x0074,0x0065,0x0067,0x0065,0x0072,0x00 } + , { 0x0062,0x006F,0x0074,0x0068,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065, + 0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0074,0x0069,0x006D,0x0065,0x00 } + , { 0x0062,0x006F,0x0074,0x0068,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065, + 0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0074,0x0069,0x006D,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074, + 0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0074,0x0061,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F, + 0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074, + 0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065, + 0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020, + 0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B, + 0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020, + 0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B, + 0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074, + 0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065, + 0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074,0x0065,0x0072,0x0020, + 0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B, + 0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061, + 0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020, + 0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074, + 0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B, + 0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006E,0x0075,0x006D,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072,0x006F, + 0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006F,0x006E,0x0065,0x0020, + 0x006F,0x0066,0x0020,0x0027,0x0070,0x0072,0x0065,0x0073,0x0065,0x0072,0x0076,0x0065,0x0027,0x002C,0x0020,0x0027,0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x0027,0x002C,0x0020,0x006F,0x0072,0x0020,0x0027,0x0063,0x006F,0x006C,0x006C,0x0061, + 0x0070,0x0073,0x0065,0x0027,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x0070,0x0072,0x0065,0x0073,0x0065,0x0072,0x0076,0x0065,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027, + 0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x0027,0x0020,0x0077,0x0068,0x0069,0x006C,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065, + 0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x0063,0x006F,0x006C,0x006C,0x0061,0x0070,0x0073,0x0065,0x0027,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x0070,0x0072,0x0065,0x0073,0x0065,0x0072,0x0076,0x0065,0x0027,0x0020,0x0077,0x0068,0x0069,0x006C, + 0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x0072,0x0065, + 0x0070,0x006C,0x0061,0x0063,0x0065,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0061,0x0020,0x0070, + 0x006F,0x0073,0x0069,0x0074,0x0069,0x0076,0x0065,0x0020,0x0069,0x006E,0x0074,0x0065,0x0067,0x0065,0x0072,0x00 } + , { 0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020, + 0x0061,0x0020,0x006E,0x006F,0x006E,0x002D,0x006E,0x0065,0x0067,0x0061,0x0074,0x0069,0x0076,0x0065,0x0020,0x0069,0x006E,0x0074,0x0065,0x0067,0x0065,0x0072,0x00 } + , { 0x0062,0x006F,0x0074,0x0068,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020, + 0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0074,0x0069,0x006D,0x0065,0x00 } + , { 0x0062,0x006F,0x0074,0x0068,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0061,0x006E,0x0064,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020, + 0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0073,0x0061,0x006D,0x0065,0x0020,0x0074,0x0069,0x006D,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065, + 0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D, + 0x0027,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E, + 0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061, + 0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065, + 0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061, + 0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061, + 0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E, + 0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061, + 0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E, + 0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065, + 0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061, + 0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065, + 0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072, + 0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072, + 0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072, + 0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072, + 0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0066,0x0072, + 0x006F,0x006D,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0073,0x0070,0x0061,0x0063,0x0065,0x00 } + , { 0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073, + 0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075, + 0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020, + 0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076, + 0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020, + 0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074, + 0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071, + 0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071, + 0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071, + 0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071, + 0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071,0x0075, + 0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020, + 0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065, + 0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C, + 0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020, + 0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C, + 0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020, + 0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0065,0x0071,0x0075,0x0061, + 0x006C,0x0020,0x0074,0x006F,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0053,0x0070,0x0061,0x0063,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069, + 0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0077,0x0068,0x0069,0x006C,0x0065,0x0020,0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0066,0x0069,0x0078, + 0x0065,0x0064,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x00 } + , { 0x006C,0x0069,0x0073,0x0074,0x0020,0x0069,0x0074,0x0065,0x006D,0x0054,0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0075,0x006E,0x0069,0x006F,0x006E,0x0020,0x006D,0x0065,0x006D,0x0062,0x0065,0x0072,0x0054,0x0079,0x0070,0x0065,0x0073,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0069,0x0073,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0073, + 0x0074,0x0065,0x0061,0x0064,0x0020,0x006F,0x0066,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0072,0x0065,0x0067,0x0075,0x006C,0x0061,0x0072,0x0020, + 0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0042,0x0061,0x0073,0x0065,0x0036,0x0034,0x002D,0x0065,0x006E,0x0063,0x006F,0x0064, + 0x0065,0x0064,0x0020,0x0062,0x0069,0x006E,0x0061,0x0072,0x0079,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0048,0x0065,0x0078,0x002D,0x0065,0x006E,0x0063,0x006F,0x0064,0x0065,0x0064,0x0020, + 0x0062,0x0069,0x006E,0x0061,0x0072,0x0079,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020, + 0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x006D,0x0061,0x0078,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0032,0x007D,0x0027, + 0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020, + 0x0069,0x0073,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0069,0x006E,0x004C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020, + 0x0027,0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020, + 0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020, + 0x0027,0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0069,0x006E,0x0020,0x0065,0x006E,0x0075,0x006D,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0020,0x0064,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020, + 0x0077,0x0068,0x0069,0x0063,0x0068,0x0020,0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x0074,0x006F,0x0074,0x0061,0x006C,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C, + 0x0075,0x0065,0x0020,0x0027,0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x0069,0x0067,0x0069, + 0x0074,0x0073,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020,0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0044,0x0069,0x0067,0x0069,0x0074,0x0073,0x0020,0x0066,0x0061,0x0063, + 0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0032,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072,0x0020,0x0065,0x0071, + 0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0061,0x0078,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031, + 0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006D,0x0061,0x0078,0x0045,0x0078, + 0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072, + 0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x0049,0x006E,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020, + 0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x0072, + 0x0020,0x0065,0x0071,0x0075,0x0061,0x006C,0x0020,0x0074,0x006F,0x0020,0x006D,0x0069,0x006E,0x0045,0x0078,0x0063,0x006C,0x0075,0x0073,0x0069,0x0076,0x0065,0x0020,0x0066,0x0061,0x0063,0x0065,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020, + 0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0072,0x0065,0x0070,0x006C,0x0061, + 0x0063,0x0065,0x0064,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0063,0x006F,0x006C,0x006C,0x0061, + 0x0070,0x0073,0x0065,0x0064,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x004E,0x0043,0x004E,0x0061,0x006D,0x0065,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x007B,0x0031,0x007D,0x00 } + , { 0x0049,0x0044,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0075,0x006E,0x0069,0x0071,0x0075,0x0065,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0045,0x004E,0x0054,0x0049,0x0054,0x0059,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0051,0x004E,0x0061,0x006D,0x0065,0x00 } + , { 0x004E,0x004F,0x0054,0x0041,0x0054,0x0049,0x004F,0x004E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0051,0x004E,0x0061,0x006D,0x0065,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0061,0x006E,0x0079,0x0020,0x006D,0x0065,0x006D,0x0062, + 0x0065,0x0072,0x0020,0x0074,0x0079,0x0070,0x0065,0x0073,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0075,0x006E,0x0069,0x006F,0x006E,0x00 } + , { 0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0061,0x006E,0x0079,0x0055,0x0052,0x0049,0x00 } + , { 0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x00 } + , { 0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0073,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0077,0x0068,0x0069,0x0074,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x00 } + , { 0x006D,0x006F,0x0072,0x0065,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x006F,0x006E,0x0065,0x0020,0x0064,0x0065,0x0063,0x0069,0x006D,0x0061,0x006C,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074, + 0x0065,0x0072,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x00 } + , { 0x004E,0x0055,0x004C,0x004C,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0075,0x0063,0x0074,0x0020,0x0055,0x0052,0x0049,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x004E,0x0055,0x004C,0x004C,0x002F,0x0065, + 0x006D,0x0070,0x0074,0x0079,0x0020,0x007B,0x0030,0x007D,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0062,0x0065,0x0020,0x0073,0x0065,0x0074,0x0020,0x0066,0x006F,0x0072,0x0020,0x0061,0x0020,0x0067,0x0065,0x006E, + 0x0065,0x0072,0x0069,0x0063,0x0020,0x0055,0x0052,0x0049,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0065,0x0073,0x0063,0x0061,0x0070,0x0065,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063, + 0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0027,0x007B,0x0031,0x007D, + 0x0027,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x004E,0x0055,0x004C,0x004C,0x00 } + , { 0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0063,0x006F,0x006E,0x0066,0x006F,0x0072,0x006D,0x0061,0x006E,0x0074,0x0020,0x0074,0x006F,0x0020,0x007B,0x0030,0x007D,0x00 } + , { 0x006E,0x006F,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0065,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x0020,0x0069,0x006E,0x0020,0x0055,0x0052,0x0049,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006D,0x0061,0x0079,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x0066,0x0020,0x0068, + 0x006F,0x0073,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 } + , { 0x007B,0x0030,0x007D,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x006D,0x0061,0x0079,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0069,0x0066,0x0020,0x0070, + 0x0061,0x0074,0x0068,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 } + , { 0x0070,0x006F,0x0072,0x0074,0x0020,0x006E,0x0075,0x006D,0x0062,0x0065,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0028,0x0030, + 0x002C,0x0036,0x0035,0x0035,0x0033,0x0035,0x0029,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0077,0x0068,0x0069,0x006C,0x0065,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0061,0x0074,0x0069,0x006E,0x0067,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x0072,0x0065,0x0073,0x0075,0x006C,0x0074,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0065,0x0074,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x0043,0x006F,0x006D,0x0070,0x0061,0x0063,0x0074,0x0052,0x0061,0x006E,0x0067,0x0065,0x0073,0x00 } + , { 0x006D,0x0069,0x0073,0x006D,0x0061,0x0074,0x0063,0x0068,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x006E,0x0020,0x004D,0x0065,0x0072,0x0067,0x0065,0x0052,0x0061,0x006E,0x0067,0x0065,0x0073,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x0053,0x0075,0x0062,0x0074,0x0072,0x0061,0x0063,0x0074,0x0052,0x0061,0x006E,0x0067,0x0065,0x0073,0x00 } + , { 0x0069,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x0049,0x006E,0x0074,0x0065,0x0072,0x0073,0x0065,0x0063,0x0074,0x0052,0x0061,0x006E,0x0067,0x0065,0x0073,0x00 } + , { 0x0061,0x0072,0x0067,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0052,0x0061,0x006E,0x0067,0x0065,0x0054,0x006F,0x006B,0x0065,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0061,0x0074,0x0065,0x0067,0x006F,0x0072,0x0079,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006B,0x0065,0x0079,0x0077,0x006F,0x0072,0x0064,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x006F,0x0075,0x006E,0x0064,0x00 } + , { 0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x006E,0x0075,0x006D,0x0062,0x0065,0x0072,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074,0x0065,0x0072,0x0020,0x0074,0x0068, + 0x0061,0x006E,0x0020,0x007A,0x0065,0x0072,0x006F,0x00 } + , { 0x006F,0x0070,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x00 } + , { 0x0075,0x006E,0x006B,0x006E,0x006F,0x0077,0x006E,0x0020,0x0074,0x006F,0x006B,0x0065,0x006E,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0075,0x006E,0x0061,0x0062,0x006C,0x0065,0x0020,0x0074,0x006F,0x0020,0x0067,0x0065,0x0074,0x0020,0x0052,0x0061,0x006E,0x0067,0x0065,0x0054,0x006F,0x006B,0x0065,0x006E,0x0020,0x0066,0x006F,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0069,0x006C,0x0064,0x0020,0x0069,0x006E,0x0064,0x0065,0x0078,0x00 } + , { 0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x007A,0x0065,0x0072,0x006F,0x002D,0x006C, + 0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x0065,0x0070,0x006C,0x0061,0x0063,0x0065,0x0020,0x0070,0x0061,0x0074,0x0074,0x0065,0x0072,0x006E,0x00 } + , { 0x0065,0x006E,0x0061,0x0062,0x006C,0x0069,0x006E,0x0067,0x0020,0x004E,0x0045,0x004C,0x0020,0x006F,0x0070,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0062,0x0065,0x0020,0x0064,0x006F,0x006E, + 0x0065,0x0020,0x006F,0x006E,0x0063,0x0065,0x0020,0x0070,0x0065,0x0072,0x0020,0x0070,0x0072,0x006F,0x0063,0x0065,0x0073,0x0073,0x00 } + , { 0x006F,0x0075,0x0074,0x0020,0x006F,0x0066,0x0020,0x006D,0x0065,0x006D,0x006F,0x0072,0x0079,0x00 } + , { 0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x00 } + , { 0x0073,0x0065,0x006C,0x0065,0x0063,0x0074,0x006F,0x0072,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0073,0x0065,0x006C,0x0065,0x0063,0x0074,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x00 } + , { 0x0027,0x007C,0x0027,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0065,0x0067,0x0069,0x006E,0x006E,0x0069,0x006E,0x0067,0x0020,0x006F,0x0066,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065, + 0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x00 } + , { 0x0027,0x007C,0x007C,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C, + 0x00 } + , { 0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070, + 0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0074,0x006F,0x006B,0x0065,0x006E,0x003B,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0071,0x006E, + 0x0061,0x006D,0x0065,0x002C,0x0020,0x0061,0x006E,0x0079,0x002C,0x0020,0x006F,0x0072,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0074,0x0065,0x0073,0x0074,0x00 } + , { 0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069, + 0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x0020,0x006E,0x006F,0x0074,0x0020,0x0062,0x0065,0x0020,0x0072,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065, + 0x0020,0x0055,0x0052,0x0049,0x00 } + , { 0x0027,0x003A,0x003A,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C, + 0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0074,0x0065,0x0070,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0027,0x0063,0x0068,0x0069,0x006C,0x0064,0x0027,0x0020,0x0074,0x006F,0x006B, + 0x0065,0x006E,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0074,0x0065,0x0070,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0027,0x002F,0x002F,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061, + 0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0073,0x0074,0x0065,0x0070,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0069,0x006E,0x0067,0x0020,0x0027,0x002F,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074, + 0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0027,0x002F,0x0027,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027,0x002F,0x002F,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068, + 0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0027,0x002F,0x002F,0x0027,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027,0x002E,0x0027,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020, + 0x0062,0x0065,0x0067,0x0069,0x006E,0x006E,0x0069,0x006E,0x0067,0x0020,0x006F,0x0066,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0027,0x002F,0x0027,0x0020,0x0061,0x0074,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0065,0x0067,0x0069,0x006E,0x006E,0x0069,0x006E,0x0067,0x0020,0x006F,0x0066,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065, + 0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x00 } + , { 0x0072,0x006F,0x006F,0x0074,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0073,0x0065,0x006C,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0069, + 0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0065,0x006D,0x0070,0x0074,0x0079,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0063,0x0061,0x006E,0x006E,0x006F,0x0074,0x0020,0x0065,0x006E,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0027,0x007C, + 0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078, + 0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0075,0x006E,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0074,0x006F,0x006B,0x0065,0x006E,0x00 } + , { 0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020, + 0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0064,0x0061,0x0074,0x0065,0x0054,0x0069,0x006D,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0027,0x0054,0x0027,0x0020,0x0073,0x0065,0x0070,0x0061,0x0072,0x0061,0x0074,0x006F,0x0072,0x0020,0x0069,0x006E,0x0020,0x0064,0x0061,0x0074,0x0065,0x0054,0x0069,0x006D,0x0065,0x0020,0x0076, + 0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0067,0x0044,0x0061,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0067,0x004D,0x006F,0x006E,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0067,0x004D,0x006F,0x006E,0x0074,0x0068,0x0044,0x0061,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0073,0x0074,0x0061,0x0072,0x0074,0x0020,0x0077,0x0069,0x0074, + 0x0068,0x0020,0x0027,0x002D,0x0027,0x0020,0x006F,0x0072,0x0020,0x0027,0x0050,0x0027,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0027, + 0x0050,0x0027,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x0061,0x006E,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0027,0x002D, + 0x0027,0x0020,0x006F,0x006E,0x006C,0x0079,0x0020,0x0061,0x0073,0x0020,0x0074,0x0068,0x0065,0x0020,0x0066,0x0069,0x0072,0x0073,0x0074,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0073,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C, + 0x0069,0x0064,0x0020,0x0074,0x0065,0x0078,0x0074,0x0020,0x0062,0x0065,0x0066,0x006F,0x0072,0x0065,0x0020,0x0027,0x0054,0x0027,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x006E,0x006F,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x0063,0x006F, + 0x006D,0x0070,0x006F,0x006E,0x0065,0x006E,0x0074,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027,0x0054,0x0027,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0074,0x0020,0x006C, + 0x0065,0x0061,0x0073,0x0074,0x0020,0x006F,0x006E,0x0065,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x006E,0x0065,0x006E,0x0074,0x00 } + , { 0x0064,0x0075,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0074,0x0020,0x006C, + 0x0065,0x0061,0x0073,0x0074,0x0020,0x006F,0x006E,0x0065,0x0020,0x0064,0x0069,0x0067,0x0069,0x0074,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027,0x002E,0x0027,0x00 } + , { 0x0069,0x006E,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0064,0x0061,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0064,0x0061,0x0074,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0066,0x0072,0x0061,0x0063,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x0073,0x0065,0x0063,0x006F,0x006E,0x0064,0x0073,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027, + 0x002E,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0067,0x0059,0x0065,0x0061,0x0072,0x004D,0x006F,0x006E,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0067,0x0059,0x0065,0x0061,0x0072,0x004D,0x006F,0x006E,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0067,0x0059,0x0065,0x0061,0x0072,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0079,0x0065,0x0061,0x0072,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0066,0x006F,0x006C,0x006C,0x006F,0x0077,0x0020,0x0027,0x0043,0x0043,0x0059,0x0059,0x0027, + 0x0020,0x0066,0x006F,0x0072,0x006D,0x0061,0x0074,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006C,0x0065,0x0061,0x0064,0x0069,0x006E,0x0067,0x0020,0x007A,0x0065,0x0072,0x006F,0x0020,0x0069,0x006E,0x0020,0x0067,0x0059,0x0065,0x0061,0x0072,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065, + 0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006D,0x006F,0x006E,0x0074,0x0068,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x006E,0x0065,0x006E,0x0074,0x0020,0x006D,0x0069,0x0073,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0020,0x0067,0x0059,0x0065,0x0061,0x0072,0x004D,0x006F,0x006E, + 0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0074,0x0069,0x006D,0x0065,0x0020,0x007A,0x006F,0x006E,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0074,0x0065,0x0078,0x0074,0x0020,0x0061,0x0066,0x0074,0x0065,0x0072,0x0020,0x0027,0x005A,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x007A, + 0x006F,0x006E,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x0069,0x006D,0x0065,0x0020,0x007A,0x006F,0x006E,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0079,0x0065,0x0061,0x0072,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x006D,0x006F,0x006E,0x0074,0x0068,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E,0x0020,0x0031, + 0x0020,0x0061,0x006E,0x0064,0x0020,0x0031,0x0032,0x00 } + , { 0x0064,0x0061,0x0079,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E,0x0020,0x0031,0x0020,0x0061, + 0x006E,0x0064,0x0020,0x007B,0x0031,0x007D,0x00 } + , { 0x0068,0x006F,0x0075,0x0072,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E,0x0020,0x0030, + 0x0020,0x0061,0x006E,0x0064,0x0020,0x0032,0x0033,0x00 } + , { 0x006D,0x0069,0x006E,0x0075,0x0074,0x0065,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E, + 0x0020,0x0030,0x0020,0x0061,0x006E,0x0064,0x0020,0x0035,0x0039,0x00 } + , { 0x0073,0x0065,0x0063,0x006F,0x006E,0x0064,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E, + 0x0020,0x0030,0x0020,0x0061,0x006E,0x0064,0x0020,0x0036,0x0030,0x00 } + , { 0x006D,0x0069,0x006E,0x0075,0x0074,0x0065,0x0073,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0062,0x0065,0x0074,0x0077,0x0065,0x0065,0x006E, + 0x0020,0x0030,0x0020,0x0061,0x006E,0x0064,0x0020,0x0035,0x0039,0x00 } + , { 0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065, + 0x0020,0x0068,0x0061,0x0073,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0077,0x0068,0x0069,0x006C,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070, + 0x0074,0x0079,0x00 } + , { 0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061, + 0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006F,0x0063,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069, + 0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0065, + 0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0027,0x0073,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x006E,0x0061,0x006D,0x0065,0x002F,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0020,0x0069,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069, + 0x006F,0x006E,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x006F,0x0066,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E, + 0x0064,0x0069,0x006E,0x0067,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006E,0x0069,0x006C,0x006C,0x0061,0x0062,0x006C,0x0065,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0072,0x0065, + 0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x0077,0x0068,0x0069,0x006C,0x0065,0x0020,0x0069,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x006E,0x002D,0x006E,0x0069,0x006C,0x006C,0x0061,0x0062,0x006C,0x0065,0x0020, + 0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0065,0x0069,0x0074,0x0068,0x0065,0x0072,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x006F, + 0x0072,0x0020,0x0069,0x0073,0x0020,0x0066,0x0069,0x0078,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x0061,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0063,0x006F,0x006D, + 0x0070,0x0061,0x0072,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074, + 0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0064,0x0069,0x0073,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x0073,0x0020,0x0066,0x006F,0x0072,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E, + 0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0061,0x0072,0x0065,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0073,0x0075,0x0070,0x0065,0x0072,0x0073,0x0065,0x0074,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x006F,0x0073,0x0065, + 0x0020,0x0066,0x006F,0x0072,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062, + 0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F, + 0x0074,0x0020,0x0064,0x0065,0x0072,0x0069,0x0076,0x0065,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067, + 0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0066,0x0065,0x0077,0x0065,0x0072,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F, + 0x006E,0x0073,0x0074,0x0072,0x0061,0x0069,0x006E,0x0074,0x0073,0x0020,0x0063,0x006F,0x006D,0x0070,0x0061,0x0072,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F,0x006E,0x0064,0x0069,0x006E,0x0067, + 0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0068,0x0061,0x0073,0x0020,0x0069,0x0064,0x0065,0x006E,0x0074,0x0069,0x0074,0x0079,0x0020,0x0063,0x006F,0x006E,0x0073,0x0074,0x0072,0x0061,0x0069, + 0x006E,0x0074,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0070,0x0070,0x0065,0x0061,0x0072,0x0020,0x0069,0x006E,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070,0x006F, + 0x006E,0x0064,0x0069,0x006E,0x0067,0x0020,0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006F,0x0063,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020, + 0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x006F,0x0063,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0072,0x0061,0x006E, + 0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x00 } + , { 0x006E,0x006F,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0066,0x0075,0x006E,0x0063,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x006D,0x0061,0x0070,0x0070,0x0069,0x006E,0x0067,0x0020,0x0062,0x0065,0x0074,0x0077, + 0x0065,0x0065,0x006E,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x0073,0x00 } + , { 0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0061,0x006E,0x0079,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063, + 0x006C,0x0065,0x00 } + , { 0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0061,0x006C,0x006C,0x0020,0x0063,0x006F,0x006D,0x0070,0x006F,0x0073, + 0x0069,0x0074,0x006F,0x0072,0x00 } + , { 0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0063,0x0068,0x006F,0x0069,0x0063,0x0065,0x0020,0x0063,0x006F,0x006D, + 0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x00 } + , { 0x0066,0x006F,0x0072,0x0062,0x0069,0x0064,0x0064,0x0065,0x006E,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0073,0x0065,0x0071,0x0075,0x0065,0x006E,0x0063,0x0065,0x0020,0x0063, + 0x006F,0x006D,0x0070,0x006F,0x0073,0x0069,0x0074,0x006F,0x0072,0x00 } + , { 0x006F,0x0063,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074, + 0x0020,0x0061,0x0020,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061, + 0x0072,0x0064,0x0027,0x0073,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x00 } + , { 0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x0020,0x006F,0x0066,0x0020,0x0063,0x006F,0x0072,0x0072,0x0065,0x0073,0x0070, + 0x006F,0x006E,0x0064,0x0069,0x006E,0x0067,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0062,0x0061,0x0073,0x0065,0x00 } + , { 0x006F,0x0063,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0067,0x0072,0x006F,0x0075,0x0070,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x0020, + 0x0072,0x0065,0x0073,0x0074,0x0072,0x0069,0x0063,0x0074,0x0069,0x006F,0x006E,0x0020,0x006F,0x0066,0x0020,0x0062,0x0061,0x0073,0x0065,0x0020,0x0077,0x0069,0x006C,0x0064,0x0063,0x0061,0x0072,0x0064,0x0027,0x0073,0x0020,0x0072,0x0061,0x006E,0x0067, + 0x0065,0x00 } + , { 0x006E,0x006F,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0066,0x0075,0x006E,0x0063,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x006D,0x0061,0x0070,0x0070,0x0069,0x006E,0x0067,0x0020,0x0062,0x0065,0x0074,0x0077, + 0x0065,0x0065,0x006E,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x0073,0x00 } + , { 0x006E,0x006F,0x0020,0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0074,0x0065,0x0020,0x0066,0x0075,0x006E,0x0063,0x0074,0x0069,0x006F,0x006E,0x0061,0x006C,0x0020,0x006D,0x0061,0x0070,0x0070,0x0069,0x006E,0x0067,0x0020,0x0062,0x0065,0x0074,0x0077, + 0x0065,0x0065,0x006E,0x0020,0x0070,0x0061,0x0072,0x0074,0x0069,0x0063,0x006C,0x0065,0x0073,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x006E,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x004E,0x006F,0x0064,0x0065,0x0049,0x0044,0x004D,0x0061,0x0070,0x0020,0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x006C,0x0061,0x0072,0x0067,0x0065,0x0073,0x0074,0x0020,0x0061,0x0076,0x0061,0x0069,0x006C,0x0061,0x0062,0x006C,0x0065, + 0x0020,0x0073,0x0069,0x007A,0x0065,0x00 } + , { 0x0050,0x0072,0x006F,0x0074,0x006F,0x0054,0x0079,0x0070,0x0065,0x0020,0x0068,0x0061,0x0073,0x0020,0x004E,0x0055,0x004C,0x004C,0x0020,0x0063,0x006C,0x0061,0x0073,0x0073,0x0020,0x006E,0x0061,0x006D,0x0065,0x00 } + , { 0x0050,0x0072,0x006F,0x0074,0x006F,0x0054,0x0079,0x0070,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x006C,0x0065,0x006E,0x0067,0x0074,0x0068,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0073, + 0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0050,0x0072,0x006F,0x0074,0x006F,0x0054,0x0079,0x0070,0x0065,0x0020,0x006E,0x0061,0x006D,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0073,0x0020,0x0066,0x0072,0x006F,0x006D,0x0020,0x0065, + 0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0049,0x006E,0x0070,0x0075,0x0074,0x0053,0x0074,0x0072,0x0065,0x0061,0x006D,0x0020,0x0072,0x0065,0x0061,0x0064,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x006C,0x0065,0x0073,0x0073,0x0020,0x0074,0x0068,0x0061,0x006E, + 0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x0064,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0049,0x006E,0x0070,0x0075,0x0074,0x0053,0x0074,0x0072,0x0065,0x0061,0x006D,0x0020,0x0072,0x0065,0x0061,0x0064,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0069,0x0073,0x0020,0x0062,0x0065,0x0079,0x006F,0x006E,0x0064,0x0020,0x0061,0x0076, + 0x0061,0x0069,0x006C,0x0061,0x0062,0x006C,0x0065,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0073,0x0074,0x006F,0x0072,0x0069,0x006E,0x0067,0x0020,0x0076,0x0069,0x006F,0x006C,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x0073,0x0074,0x006F,0x0072,0x0065,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0076,0x0069,0x006F,0x006C,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x002C,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027, + 0x00 } + , { 0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0074,0x0061,0x0067,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x006C,0x006F,0x0061,0x0064,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020, + 0x0075,0x0070,0x0070,0x0065,0x0072,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0061,0x0072,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x006C,0x006F,0x0061,0x0064,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0074,0x0061,0x006C,0x006C,0x0079, + 0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0063,0x006F,0x0075,0x006E,0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x006C,0x006F,0x0061,0x0064,0x0069,0x006E,0x0067,0x0020,0x0076,0x0069,0x006F,0x006C,0x0061,0x0074,0x0069,0x006F,0x006E,0x00 } + , { 0x006C,0x006F,0x0061,0x0064,0x0020,0x0062,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0076,0x0069,0x006F,0x006C,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x002C,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x006C,0x0061,0x0073,0x0073,0x0020,0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x002C,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0065,0x0063,0x006B,0x0046,0x0069,0x006C,0x006C,0x0042,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0063,0x0068,0x0065,0x0063,0x006B,0x0046,0x006C,0x0075,0x0073,0x0068,0x0042,0x0075,0x0066,0x0066,0x0065,0x0072,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027, + 0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x004E,0x0055,0x004C,0x004C,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0065,0x0072,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x0020,0x0027,0x007B, + 0x0030,0x007D,0x0027,0x00 } + , { 0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x004F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0066,0x0061,0x0069,0x006C,0x0073,0x00 } + , { 0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0063,0x006F,0x0075,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0065,0x0078,0x0063,0x0065,0x0065,0x0064,0x0073,0x0020,0x0075,0x0070,0x0070,0x0065,0x0072,0x0020,0x0062,0x006F, + 0x0075,0x006E,0x0064,0x0061,0x0072,0x0079,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0069,0x0073,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x0020,0x0070,0x006F,0x006F,0x006C,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x006D,0x0070,0x0074,0x0079,0x00 } + , { 0x0073,0x0074,0x006F,0x0072,0x0065,0x0072,0x0020,0x006C,0x0065,0x0076,0x0065,0x006C,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D,0x0061,0x0074,0x0063,0x0068,0x0020,0x006C, + 0x006F,0x0061,0x0064,0x0065,0x0072,0x0020,0x006C,0x0065,0x0076,0x0065,0x006C,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 } + , { 0x0075,0x006E,0x0064,0x0065,0x0066,0x0069,0x006E,0x0065,0x0064,0x0020,0x0070,0x0072,0x0065,0x0066,0x0069,0x0078,0x0020,0x0069,0x006E,0x0020,0x0051,0x004E,0x0061,0x006D,0x0065,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0020,0x0027,0x007B,0x0030, + 0x007D,0x0027,0x00 } + , { 0x0046,0x005F,0x0045,0x006E,0x0064,0x00 } + +}; +const unsigned int gXMLExceptArraySize = 369; + +const XMLCh gXMLDOMMsgArray[][128] = +{ + { 0x0046,0x005F,0x0053,0x0074,0x0061,0x0072,0x0074,0x00 } + , { 0x0064,0x0075,0x006D,0x006D,0x0079,0x00 } + , { 0x0069,0x006E,0x0064,0x0065,0x0078,0x0020,0x006F,0x0072,0x0020,0x0073,0x0069,0x007A,0x0065,0x0020,0x0069,0x0073,0x0020,0x006E,0x0065,0x0067,0x0061,0x0074,0x0069,0x0076,0x0065,0x002C,0x0020,0x006F,0x0072,0x0020,0x0067,0x0072,0x0065,0x0061,0x0074, + 0x0065,0x0072,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065,0x0064,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x00 } + , { 0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0065,0x0064,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0065,0x0078,0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0066,0x0069, + 0x0074,0x0020,0x0069,0x006E,0x0074,0x006F,0x0020,0x0044,0x004F,0x004D,0x0053,0x0074,0x0072,0x0069,0x006E,0x0067,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x0069,0x006E,0x0073,0x0065,0x0072,0x0074,0x0020,0x0061,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0077,0x0068, + 0x0065,0x0072,0x0065,0x0020,0x0069,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0074,0x0065,0x0064,0x00 } + , { 0x006E,0x006F,0x0064,0x0065,0x0020,0x0069,0x0073,0x0020,0x0075,0x0073,0x0065,0x0064,0x0020,0x0069,0x006E,0x0020,0x0061,0x0020,0x0064,0x0069,0x0066,0x0066,0x0065,0x0072,0x0065,0x006E,0x0074,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E, + 0x0074,0x0020,0x0074,0x0068,0x0061,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x006E,0x0065,0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x0064,0x0020,0x0069,0x0074,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006F,0x0072,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0058,0x004D,0x004C,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x00 } + , { 0x006E,0x006F,0x0064,0x0065,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0020,0x0073,0x0074,0x006F,0x0072,0x0069,0x006E,0x0067,0x0020,0x0064,0x0061,0x0074,0x0061,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x006D,0x006F,0x0064,0x0069,0x0066,0x0079,0x0020,0x0061,0x006E,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074, + 0x0020,0x0077,0x0068,0x0065,0x0072,0x0065,0x0020,0x006D,0x006F,0x0064,0x0069,0x0066,0x0069,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0073,0x0020,0x0061,0x0072,0x0065,0x0020,0x006E,0x006F,0x0074,0x0020,0x0061,0x006C,0x006C,0x006F,0x0077,0x0065, + 0x0064,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x0072,0x0065,0x0066,0x0065,0x0072,0x0065,0x006E,0x0063,0x0065,0x0020,0x0061,0x0020,0x006E,0x006F,0x0064,0x0065, + 0x0020,0x0069,0x006E,0x0020,0x0061,0x0020,0x0063,0x006F,0x006E,0x0074,0x0065,0x0078,0x0074,0x0020,0x0077,0x0068,0x0065,0x0072,0x0065,0x0020,0x0069,0x0074,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0065,0x0078,0x0069, + 0x0073,0x0074,0x00 } + , { 0x0069,0x006D,0x0070,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0020,0x0074,0x0068,0x0065, + 0x0020,0x0072,0x0065,0x0071,0x0075,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x006F,0x0072,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074, + 0x0069,0x006F,0x006E,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x0061,0x0064,0x0064,0x0020,0x0061,0x006E,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065, + 0x0020,0x0074,0x0068,0x0061,0x0074,0x0020,0x0069,0x0073,0x0020,0x0061,0x006C,0x0072,0x0065,0x0061,0x0064,0x0079,0x0020,0x0069,0x006E,0x0020,0x0075,0x0073,0x0065,0x0020,0x0065,0x006C,0x0073,0x0065,0x0077,0x0068,0x0065,0x0072,0x0065,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x0075,0x0073,0x0065,0x0020,0x0061,0x006E,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0074,0x0068, + 0x0061,0x0074,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x006F,0x0072,0x0020,0x0069,0x0073,0x0020,0x006E,0x006F,0x0020,0x006C,0x006F,0x006E,0x0067,0x0065,0x0072,0x0020,0x0075,0x0073,0x0061,0x0062,0x006C,0x0065,0x00 } + , { 0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x006F,0x0072,0x0020,0x0069,0x006C,0x006C,0x0065,0x0067,0x0061,0x006C,0x0020,0x0073,0x0074,0x0072,0x0069,0x006E,0x0067,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x006D,0x006F,0x0064,0x0069,0x0066,0x0079,0x0020,0x0074,0x0068,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020, + 0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0075,0x006E,0x0064,0x0065,0x0072,0x006C,0x0079,0x0069,0x006E,0x0067,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x00 } + , { 0x0061,0x0074,0x0074,0x0065,0x006D,0x0070,0x0074,0x0020,0x0069,0x0073,0x0020,0x006D,0x0061,0x0064,0x0065,0x0020,0x0074,0x006F,0x0020,0x0063,0x0072,0x0065,0x0061,0x0074,0x0065,0x0020,0x006F,0x0072,0x0020,0x0063,0x0068,0x0061,0x006E,0x0067,0x0065, + 0x0020,0x0061,0x006E,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0069,0x006E,0x0020,0x0061,0x0020,0x0077,0x0061,0x0079,0x0020,0x0077,0x0068,0x0069,0x0063,0x0068,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0063,0x006F,0x0072,0x0072, + 0x0065,0x0063,0x0074,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0072,0x0065,0x0073,0x0070,0x0065,0x0063,0x0074,0x0020,0x0074,0x006F,0x0020,0x006E,0x0061,0x006D,0x0065,0x0073,0x0070,0x0061,0x0063,0x0065,0x0073,0x00 } + , { 0x0070,0x0061,0x0072,0x0061,0x006D,0x0065,0x0074,0x0065,0x0072,0x0020,0x006F,0x0072,0x0020,0x0072,0x0065,0x0071,0x0075,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x006F,0x0070,0x0065,0x0072,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0069,0x0073, + 0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0074,0x0068,0x0065,0x0020,0x0075,0x006E,0x0064,0x0065,0x0072,0x006C,0x0079,0x0069,0x006E,0x0067,0x0020,0x006F,0x0062, + 0x006A,0x0065,0x0063,0x0074,0x00 } + , { 0x0063,0x0061,0x006C,0x006C,0x0020,0x0074,0x006F,0x0020,0x0061,0x0020,0x006D,0x0065,0x0074,0x0068,0x006F,0x0064,0x0020,0x0073,0x0075,0x0063,0x0068,0x0020,0x0061,0x0073,0x0020,0x0069,0x006E,0x0073,0x0065,0x0072,0x0074,0x0042,0x0065,0x0066,0x006F, + 0x0072,0x0065,0x0020,0x006F,0x0072,0x0020,0x0072,0x0065,0x006D,0x006F,0x0076,0x0065,0x0043,0x0068,0x0069,0x006C,0x0064,0x0020,0x0077,0x006F,0x0075,0x006C,0x0064,0x0020,0x006D,0x0061,0x006B,0x0065,0x0020,0x0074,0x0068,0x0065,0x0020,0x006E,0x006F, + 0x0064,0x0065,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0072,0x0065,0x0073,0x0070,0x0065,0x0063,0x0074,0x0020,0x0074,0x006F,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074, + 0x0020,0x0067,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x00 } + , { 0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x006E,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x0020,0x0069,0x0073,0x0020,0x0069,0x006E,0x0063,0x006F,0x006D,0x0070,0x0061,0x0074,0x0069,0x0062,0x006C,0x0065,0x0020,0x0077, + 0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006F,0x0066,0x0020,0x0074,0x0068,0x0065,0x0020,0x0070,0x0061,0x0072,0x0061,0x006D,0x0065, + 0x0074,0x0065,0x0072,0x0020,0x0061,0x0073,0x0073,0x006F,0x0063,0x0069,0x0061,0x0074,0x0065,0x0064,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0074,0x0068,0x0065,0x0020,0x006F,0x0062,0x006A,0x0065,0x0063,0x0074,0x00 } + , { 0x0064,0x0075,0x006D,0x006D,0x0079,0x00 } + , { 0x0062,0x006F,0x0075,0x006E,0x0064,0x0061,0x0072,0x0079,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074,0x0073,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x0064,0x006F,0x0020,0x006E,0x006F,0x0074,0x0020,0x006D, + 0x0065,0x0065,0x0074,0x0020,0x0073,0x0070,0x0065,0x0063,0x0069,0x0066,0x0069,0x0063,0x0020,0x0072,0x0065,0x0071,0x0075,0x0069,0x0072,0x0065,0x006D,0x0065,0x006E,0x0074,0x0073,0x00 } + , { 0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0065,0x0072,0x0020,0x006F,0x0066,0x0020,0x0061,0x0020,0x0072,0x0061,0x006E,0x0067,0x0065,0x0020,0x0062,0x006F,0x0075,0x006E,0x0064,0x0061,0x0072,0x0079,0x0020,0x0070,0x006F,0x0069,0x006E,0x0074, + 0x0020,0x0069,0x0073,0x0020,0x0073,0x0065,0x0074,0x0020,0x0074,0x006F,0x0020,0x0061,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x006F,0x0066,0x0020,0x0061,0x006E,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x0079,0x0070, + 0x0065,0x0020,0x006F,0x0072,0x0020,0x0074,0x006F,0x0020,0x0061,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0077,0x0069,0x0074,0x0068,0x0020,0x0061,0x006E,0x0020,0x0061,0x006E,0x0063,0x0065,0x0073,0x0074,0x006F,0x0072,0x0020,0x006F,0x0066,0x0020, + 0x0061,0x006E,0x0020,0x0069,0x006E,0x0076,0x0061,0x006C,0x0069,0x0064,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0064,0x0075,0x006D,0x006D,0x0079,0x00 } + , { 0x0066,0x0061,0x0069,0x006C,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x006C,0x006F,0x0061,0x0064,0x0020,0x0061,0x0020,0x0064,0x006F,0x0063,0x0075,0x006D,0x0065,0x006E,0x0074,0x0020,0x006F,0x0072,0x0020,0x0061,0x006E,0x0020,0x0058,0x004D,0x004C, + 0x0020,0x0066,0x0072,0x0061,0x0067,0x006D,0x0065,0x006E,0x0074,0x0020,0x0075,0x0073,0x0069,0x006E,0x0067,0x0020,0x0044,0x004F,0x004D,0x004C,0x0053,0x0050,0x0061,0x0072,0x0073,0x0065,0x0072,0x00 } + , { 0x0066,0x0061,0x0069,0x006C,0x0065,0x0064,0x0020,0x0074,0x006F,0x0020,0x0073,0x0065,0x0072,0x0069,0x0061,0x006C,0x0069,0x007A,0x0065,0x0020,0x0061,0x0020,0x0044,0x004F,0x004D,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0075,0x0073,0x0069,0x006E, + 0x0067,0x0020,0x0044,0x004F,0x004D,0x004C,0x0053,0x0053,0x0065,0x0072,0x0069,0x0061,0x006C,0x0069,0x007A,0x0065,0x0072,0x00 } + , { 0x0064,0x0075,0x006D,0x006D,0x0079,0x00 } + , { 0x0065,0x0078,0x0070,0x0072,0x0065,0x0073,0x0073,0x0069,0x006F,0x006E,0x0020,0x0068,0x0061,0x0073,0x0020,0x0069,0x006E,0x0063,0x006F,0x0072,0x0072,0x0065,0x0063,0x0074,0x0020,0x0073,0x0079,0x006E,0x0074,0x0061,0x0078,0x0020,0x006F,0x0072,0x0020, + 0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0073,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0066,0x0065,0x0061,0x0074,0x0075,0x0072,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074, + 0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0074,0x0068,0x0065,0x0020,0x0058,0x004D,0x004C,0x0020,0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0058,0x0050,0x0061,0x0074,0x0068,0x0020,0x0073,0x0075,0x0062,0x0073,0x0065,0x0074,0x00 } + , { 0x0072,0x0065,0x0071,0x0075,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x0072,0x0065,0x0073,0x0075,0x006C,0x0074,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x006E,0x006F,0x0074,0x0020,0x0073,0x0075,0x0070,0x0070,0x006F,0x0072,0x0074,0x0065,0x0064, + 0x00 } + , { 0x006E,0x006F,0x0020,0x0063,0x0075,0x0072,0x0072,0x0065,0x006E,0x0074,0x0020,0x0072,0x0065,0x0073,0x0075,0x006C,0x0074,0x0020,0x0069,0x006E,0x0020,0x0074,0x0068,0x0065,0x0020,0x0072,0x0065,0x0073,0x0075,0x006C,0x0074,0x0020,0x006F,0x0062,0x006A, + 0x0065,0x0063,0x0074,0x00 } + , { 0x006E,0x0065,0x0073,0x0074,0x0065,0x0064,0x0020,0x0043,0x0044,0x0041,0x0054,0x0041,0x0020,0x0073,0x0065,0x0063,0x0074,0x0069,0x006F,0x006E,0x0073,0x00 } + , { 0x0075,0x006E,0x0072,0x0065,0x0070,0x0072,0x0065,0x0073,0x0065,0x006E,0x0074,0x0061,0x0062,0x006C,0x0065,0x0020,0x0063,0x0068,0x0061,0x0072,0x0061,0x0063,0x0074,0x0065,0x0072,0x00 } + , { 0x0075,0x006E,0x0072,0x0065,0x0063,0x006F,0x0067,0x006E,0x0069,0x007A,0x0065,0x0064,0x0020,0x006E,0x006F,0x0064,0x0065,0x0020,0x0074,0x0079,0x0070,0x0065,0x00 } + , { 0x0070,0x0061,0x0072,0x0073,0x0069,0x006E,0x0067,0x0020,0x0069,0x006E,0x0020,0x0070,0x0072,0x006F,0x0067,0x0072,0x0065,0x0073,0x0073,0x00 } + , { 0x0070,0x0061,0x0072,0x0073,0x0069,0x006E,0x0067,0x0020,0x0061,0x0062,0x006F,0x0072,0x0074,0x0065,0x0064,0x0020,0x0062,0x0079,0x0020,0x0074,0x0068,0x0065,0x0020,0x0075,0x0073,0x0065,0x0072,0x00 } + , { 0x0070,0x0061,0x0072,0x0073,0x0069,0x006E,0x0067,0x0020,0x0066,0x0061,0x0069,0x006C,0x0065,0x0064,0x00 } + , { 0x0046,0x005F,0x0045,0x006E,0x0064,0x00 } + +}; +const unsigned int gXMLDOMMsgArraySize = 41; + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.cpp b/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.cpp new file mode 100644 index 000000000..e50bc7b47 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.cpp @@ -0,0 +1,69 @@ +/* + * 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: NoThreadMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + The NoThread mutex manager is for use where no threading is used + in an environment. Since no threading is used, mutexes are not + needed, so the implementation does essentially nothing. +*/ + + +NoThreadMutexMgr::NoThreadMutexMgr() +{ +} + + +NoThreadMutexMgr::~NoThreadMutexMgr() +{ +} + + +XMLMutexHandle +NoThreadMutexMgr::create(MemoryManager* const manager) +{ + return 0; +} + + +void +NoThreadMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager) +{ +} + + +void +NoThreadMutexMgr::lock(XMLMutexHandle mtx) +{ +} + + +void +NoThreadMutexMgr::unlock(XMLMutexHandle mtx) +{ +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.hpp b/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.hpp new file mode 100644 index 000000000..be684411c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MutexManagers/NoThreadMutexMgr.hpp @@ -0,0 +1,51 @@ +/* + * 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: NoThreadMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NOTHREADMUTEXMGR_HPP) +#define XERCESC_INCLUDE_GUARD_NOTHREADMUTEXMGR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + The NoThread mutex manager is for use where no threading is used + in an environment. Since no threading is used, mutexes are not + needed, so the implementation does essentially nothing. +*/ +class NoThreadMutexMgr : public XMLMutexMgr +{ + public: + NoThreadMutexMgr(); + virtual ~NoThreadMutexMgr(); + + // Mutex operations + virtual XMLMutexHandle create(MemoryManager* const manager); + virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager); + virtual void lock(XMLMutexHandle mtx); + virtual void unlock(XMLMutexHandle mtx); +}; + +XERCES_CPP_NAMESPACE_END + + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp b/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp new file mode 100644 index 000000000..5b171579c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp @@ -0,0 +1,113 @@ +/* + * 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: PosixMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// on some platforms, THREAD_MUTEX_RECURSIVE is defined only if _GNU_SOURCE is defined +#ifndef _GNU_SOURCE + #define _GNU_SOURCE +#endif + +#include + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// Wrap up the mutex with XMemory +class PosixMutexWrap : public XMemory { +public: + pthread_mutex_t m; +}; + + +PosixMutexMgr::PosixMutexMgr() +{ +} + + +PosixMutexMgr::~PosixMutexMgr() +{ +} + + +XMLMutexHandle +PosixMutexMgr::create(MemoryManager* const manager) +{ + PosixMutexWrap* mutex = new (manager) PosixMutexWrap; + + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + + if (pthread_mutex_init(&mutex->m, &attr)) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + + pthread_mutexattr_destroy(&attr); + + return (void*)(mutex); +} + + +void +PosixMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager) +{ + PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx); + if (mutex != NULL) + { + if (pthread_mutex_destroy(&mutex->m)) + { + ThrowXMLwithMemMgr(XMLPlatformUtilsException, + XMLExcepts::Mutex_CouldNotDestroy, manager); + } + delete mutex; + } +} + + +void +PosixMutexMgr::lock(XMLMutexHandle mtx) +{ + PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx); + if (mutex != NULL) + { + if (pthread_mutex_lock(&mutex->m)) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + } +} + + +void +PosixMutexMgr::unlock(XMLMutexHandle mtx) +{ + PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx); + if (mutex != NULL) + { + if (pthread_mutex_unlock(&mutex->m)) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + } +} + + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.hpp b/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.hpp new file mode 100644 index 000000000..cfdcf306c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/MutexManagers/PosixMutexMgr.hpp @@ -0,0 +1,47 @@ +/* + * 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: PosixMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_POSIXMUTEXMGR_HPP) +#define XERCESC_INCLUDE_GUARD_POSIXMUTEXMGR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Posix mutex implementation. +class PosixMutexMgr : public XMLMutexMgr +{ + public: + PosixMutexMgr(); + virtual ~PosixMutexMgr(); + + // Mutex operations + virtual XMLMutexHandle create(MemoryManager* const manager); + virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager); + virtual void lock(XMLMutexHandle mtx); + virtual void unlock(XMLMutexHandle mtx); +}; + +XERCES_CPP_NAMESPACE_END + + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/Mutexes.cpp b/project/jni/xerces/src/xercesc/util/Mutexes.cpp new file mode 100644 index 000000000..c0808b860 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Mutexes.cpp @@ -0,0 +1,87 @@ +/* + * 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: Mutexes.cpp 734985 2009-01-16 12:21:14Z johns $ + */ + + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLMutex: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLMutex::XMLMutex(MemoryManager* const manager) : + + fHandle(0), + fManager(manager) +{ + // Ask the per-platform driver to make us a mutex + fHandle = XMLPlatformUtils::makeMutex(manager); +} + + +XMLMutex::~XMLMutex() +{ + if (fHandle) + { + XMLPlatformUtils::closeMutex(fHandle, fManager); + fHandle = 0; + } +} + + +// --------------------------------------------------------------------------- +// XMLMutex: Lock control methods +// --------------------------------------------------------------------------- +void XMLMutex::lock() +{ + XMLPlatformUtils::lockMutex(fHandle); +} + +void XMLMutex::unlock() +{ + XMLPlatformUtils::unlockMutex(fHandle); +} + + + +// --------------------------------------------------------------------------- +// XMLMutexLock: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLMutexLock::XMLMutexLock(XMLMutex* const toLock) : + + fToLock(toLock) +{ + fToLock->lock(); +} + + +XMLMutexLock::~XMLMutexLock() +{ + fToLock->unlock(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/Mutexes.hpp b/project/jni/xerces/src/xercesc/util/Mutexes.hpp new file mode 100644 index 000000000..614883181 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Mutexes.hpp @@ -0,0 +1,108 @@ +/* + * 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: Mutexes.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MUTEXES_HPP) +#define XERCESC_INCLUDE_GUARD_MUTEXES_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLMutex : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~XMLMutex(); + + + // ----------------------------------------------------------------------- + // Lock control methods + // ----------------------------------------------------------------------- + void lock(); + void unlock(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLMutex(const XMLMutex&); + XMLMutex& operator=(const XMLMutex&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fHandle + // The raw mutex handle. Its just a void pointer so we do not + // pass judgement on its value at all. We just pass it into the + // platform utilities methods which knows what's really in it. + // fManager + // The MemoryManager that this XMLMutex was initialized with. + // ----------------------------------------------------------------------- + void* fHandle; + MemoryManager* fManager; + + + // ----------------------------------------------------------------------- + // Sun PlatformUtils needs access to fHandle to initialize the + // atomicOpsMutex at startup. + // ----------------------------------------------------------------------- + friend class XMLPlatformUtils; +}; + + +class XMLUTIL_EXPORT XMLMutexLock : public XMemory +{ + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- +public: + XMLMutexLock(XMLMutex* const toLock); + ~XMLMutexLock(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLMutexLock(); + XMLMutexLock(const XMLMutexLock&); + XMLMutexLock& operator=(const XMLMutexLock&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fToLock + // The mutex object that we are locking + // ----------------------------------------------------------------------- + XMLMutex* fToLock; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/NameIdPool.c b/project/jni/xerces/src/xercesc/util/NameIdPool.c new file mode 100644 index 000000000..c25af90a7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NameIdPool.c @@ -0,0 +1,284 @@ +/* + * 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: NameIdPool.c 883368 2009-11-23 15:28:19Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// NameIdPool: Constructors and Destructor +// --------------------------------------------------------------------------- +template +NameIdPool::NameIdPool( const XMLSize_t hashModulus + , const XMLSize_t initSize + , MemoryManager* const manager) : + fMemoryManager(manager) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fBucketList(hashModulus, manager) +{ + if (!hashModulus) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_ZeroModulus, fMemoryManager); + + // + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + fIdPtrs = (TElem**) fMemoryManager->allocate + ( + fIdPtrsCount * sizeof(TElem*) + ); + fIdPtrs[0] = 0; +} + +template NameIdPool::~NameIdPool() +{ + // + // Delete the id pointers list. The stuff it points to will be cleaned + // up when we clean the bucket lists. + // + fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs; +} + + +// --------------------------------------------------------------------------- +// NameIdPool: Element management +// --------------------------------------------------------------------------- +template +inline bool NameIdPool:: +containsKey(const XMLCh* const key) const +{ + if (fIdCounter == 0) return false; + return fBucketList.containsKey(key); +} + + +template void NameIdPool::removeAll() +{ + if (fIdCounter == 0) return; + + fBucketList.removeAll(); + + // Reset the id counter + fIdCounter = 0; +} + + +// --------------------------------------------------------------------------- +// NameIdPool: Getters +// --------------------------------------------------------------------------- +template +inline TElem* NameIdPool:: +getByKey(const XMLCh* const key) +{ + if (fIdCounter == 0) return 0; + return fBucketList.get(key); +} + +template +inline const TElem* NameIdPool:: +getByKey(const XMLCh* const key) const +{ + if (fIdCounter == 0) return 0; + return fBucketList.get(key); +} + +template +inline TElem* NameIdPool:: +getById(const XMLSize_t elemId) +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +template +inline const TElem* NameIdPool:: +getById(const XMLSize_t elemId) const +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +template +inline MemoryManager* NameIdPool::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// NameIdPool: Setters +// --------------------------------------------------------------------------- +template +XMLSize_t NameIdPool::put(TElem* const elemToAdopt) +{ + // First see if the key exists already. If so, its an error + if(containsKey(elemToAdopt->getKey())) + { + ThrowXMLwithMemMgr1 + ( + IllegalArgumentException + , XMLExcepts::Pool_ElemAlreadyExists + , elemToAdopt->getKey() + , fMemoryManager + ); + } + + fBucketList.put((void*)elemToAdopt->getKey(), elemToAdopt); + + // + // Give this new one the next available id and add to the pointer list. + // Expand the list if that is now required. + // + if (fIdCounter + 1 == fIdPtrsCount) + { + // Create a new count 1.5 times larger and allocate a new array + XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5); + TElem** newArray = (TElem**) fMemoryManager->allocate + ( + newCount * sizeof(TElem*) + ); //new TElem*[newCount]; + + // Copy over the old contents to the new array + memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TElem*)); + + // Ok, toss the old array and store the new data + fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs; + fIdPtrs = newArray; + fIdPtrsCount = newCount; + } + const XMLSize_t retId = ++fIdCounter; + fIdPtrs[retId] = elemToAdopt; + + // Set the id on the passed element + elemToAdopt->setId(retId); + + // Return the id that we gave to this element + return retId; +} + + +// --------------------------------------------------------------------------- +// NameIdPoolEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template NameIdPoolEnumerator:: +NameIdPoolEnumerator(NameIdPool* const toEnum + , MemoryManager* const manager) : + + XMLEnumerator() + , fCurIndex(0) + , fToEnum(toEnum) + , fMemoryManager(manager) +{ + Reset(); +} + +template NameIdPoolEnumerator:: +NameIdPoolEnumerator(const NameIdPoolEnumerator& toCopy) : + XMLEnumerator(toCopy) + , XMemory(toCopy) + , fCurIndex(toCopy.fCurIndex) + , fToEnum(toCopy.fToEnum) + , fMemoryManager(toCopy.fMemoryManager) +{ +} + +template NameIdPoolEnumerator::~NameIdPoolEnumerator() +{ + // We don't own the pool being enumerated, so no cleanup required +} + + +// --------------------------------------------------------------------------- +// NameIdPoolEnumerator: Public operators +// --------------------------------------------------------------------------- +template NameIdPoolEnumerator& NameIdPoolEnumerator:: +operator=(const NameIdPoolEnumerator& toAssign) +{ + if (this == &toAssign) + return *this; + fMemoryManager = toAssign.fMemoryManager; + fCurIndex = toAssign.fCurIndex; + fToEnum = toAssign.fToEnum; + return *this; +} + +// --------------------------------------------------------------------------- +// NameIdPoolEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool NameIdPoolEnumerator:: +hasMoreElements() const +{ + // If our index is zero or past the end, then we are done + if (!fCurIndex || (fCurIndex > fToEnum->fIdCounter)) + return false; + return true; +} + +template TElem& NameIdPoolEnumerator::nextElement() +{ + // If our index is zero or past the end, then we are done + if (!fCurIndex || (fCurIndex > fToEnum->fIdCounter)) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // Return the current element and bump the index + return *fToEnum->fIdPtrs[fCurIndex++]; +} + + +template void NameIdPoolEnumerator::Reset() +{ + // + // Find the next available bucket element in the pool. We use the id + // array since its very easy to enumerator through by just maintaining + // an index. If the id counter is zero, then its empty and we leave the + // current index to zero. + // + fCurIndex = fToEnum->fIdCounter ? 1:0; +} + +template XMLSize_t NameIdPoolEnumerator::size() const +{ + return fToEnum->fIdCounter; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/NameIdPool.hpp b/project/jni/xerces/src/xercesc/util/NameIdPool.hpp new file mode 100644 index 000000000..465d09f15 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NameIdPool.hpp @@ -0,0 +1,207 @@ +/* + * 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: NameIdPool.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NAMEIDPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_NAMEIDPOOL_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// Forward declare the enumerator so he can be our friend. Can you say +// friend? Sure... +// +template class NameIdPoolEnumerator; + + +// +// This class is provided to serve as the basis of many of the pools that +// are used by the scanner and validators. They often need to be able to +// store objects in such a way that they can be quickly accessed by the +// name field of the object, and such that each element added is assigned +// a unique id via which it can be accessed almost instantly. +// +// Object names are enforced as being unique, since that's what all these +// pools require. So its effectively a hash table in conjunction with an +// array of references into the hash table by id. Ids are assigned such that +// id N can be used to get the Nth element from the array of references. +// This provides very fast access by id. +// +// The way these pools are used, elements are never removed except when the +// whole thing is flushed. This makes it very easy to maintain the two +// access methods in sync. +// +// For efficiency reasons, the id reference array is never flushed until +// the dtor. This way, it does not have to be regrown every time its reused. +// +// All elements are assumed to be owned by the pool! +// + +template class NameIdPool : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + NameIdPool + ( + const XMLSize_t hashModulus + , const XMLSize_t initSize = 128 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~NameIdPool(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool containsKey(const XMLCh* const key) const; + void removeAll(); + + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TElem* getByKey(const XMLCh* const key); + const TElem* getByKey(const XMLCh* const key) const; + TElem* getById(const XMLSize_t elemId); + const TElem* getById(const XMLSize_t elemId) const; + + MemoryManager* getMemoryManager() const; + // ----------------------------------------------------------------------- + // Putters + // + // Dups are not allowed and cause an IllegalArgumentException. The id + // of the new element is returned. + // ----------------------------------------------------------------------- + XMLSize_t put(TElem* const valueToAdopt); + + +protected : + // ----------------------------------------------------------------------- + // Declare the enumerator our friend so he can see our members + // ----------------------------------------------------------------------- + friend class NameIdPoolEnumerator; + + +private : + // ----------------------------------------------------------------------- + // Unused constructors and operators + // ----------------------------------------------------------------------- + NameIdPool(const NameIdPool&); + NameIdPool& operator=(const NameIdPool&); + + // ----------------------------------------------------------------------- + // Data members + // + // fBucketList + // This is the hash table that contains the values. + // + // fIdPtrs + // fIdPtrsCount + // This is the array of pointers to the bucket elements in order of + // their assigned ids. So taking id N and referencing this array + // gives you the element with that id. The count field indicates + // the current size of this list. When fIdCounter+1 reaches this + // value the list must be expanded. + // + // fIdCounter + // This is used to give out unique ids to added elements. It starts + // at zero (which means empty), and is bumped up for each newly added + // element. So the first element is 1, the next is 2, etc... This + // means that this value is set to the top index of the fIdPtrs array. + // + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + TElem** fIdPtrs; + XMLSize_t fIdPtrsCount; + XMLSize_t fIdCounter; + RefHashTableOf fBucketList; +}; + + +// +// An enumerator for a name id pool. It derives from the basic enumerator +// class, so that pools can be generically enumerated. +// +template class NameIdPoolEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + NameIdPoolEnumerator + ( + NameIdPool* const toEnum + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + NameIdPoolEnumerator + ( + const NameIdPoolEnumerator& toCopy + ); + + virtual ~NameIdPoolEnumerator(); + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + NameIdPoolEnumerator& operator= + ( + const NameIdPoolEnumerator& toAssign + ); + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + XMLSize_t size() const; + +private : + // ----------------------------------------------------------------------- + // Data Members + // + // fCurIndex + // This is the current index into the pool's id mapping array. This + // is now we enumerate it. + // + // fToEnum + // The name id pool that is being enumerated. + // ----------------------------------------------------------------------- + XMLSize_t fCurIndex; + NameIdPool* fToEnum; + MemoryManager* fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp b/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp new file mode 100644 index 000000000..51f4b5d19 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp @@ -0,0 +1,296 @@ +/* + * 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: BinFileInputStream.cpp 553903 2007-07-06 14:43:42Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +BinHTTPInputStreamCommon::BinHTTPInputStreamCommon(MemoryManager *manager) + : fBytesProcessed(0) + , fBuffer(1023, manager) + , fContentType(0) + , fMemoryManager(manager) +{ +} + + +BinHTTPInputStreamCommon::~BinHTTPInputStreamCommon() +{ + if(fContentType) fMemoryManager->deallocate(fContentType); +} + +static const char *CRLF = "\r\n"; + +void BinHTTPInputStreamCommon::createHTTPRequest(const XMLURL &urlSource, const XMLNetHTTPInfo *httpInfo, CharBuffer &buffer) +{ + static const char *GET = "GET "; + static const char *PUT = "PUT "; + static const char *POST = "POST "; + static const char *HTTP10 = " HTTP/1.0\r\n"; + static const char *HOST = "Host: "; + static const char *AUTHORIZATION = "Authorization: Basic "; + static const char *COLON = ":"; + + XMLTransService::Codes failReason; + const XMLSize_t blockSize = 2048; + + XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor("ISO8859-1", failReason, blockSize, fMemoryManager); + Janitor janTrans(trans); + + TranscodeToStr hostName(urlSource.getHost(), trans, fMemoryManager); + TranscodeToStr path(urlSource.getPath(), trans, fMemoryManager); + TranscodeToStr fragment(urlSource.getFragment(), trans, fMemoryManager); + TranscodeToStr query(urlSource.getQuery(), trans, fMemoryManager); + + // Build up the http GET command to send to the server. + // To do: We should really support http 1.1. This implementation + // is weak. + if(httpInfo) { + switch(httpInfo->fHTTPMethod) { + case XMLNetHTTPInfo::GET: buffer.append(GET); break; + case XMLNetHTTPInfo::PUT: buffer.append(PUT); break; + case XMLNetHTTPInfo::POST: buffer.append(POST); break; + } + } + else { + buffer.append(GET); + } + + if(path.str() != 0) { + buffer.append((char*)path.str()); + } + else { + buffer.append("/"); + } + + if(query.str() != 0) { + buffer.append("?"); + buffer.append((char*)query.str()); + } + + if(fragment.str() != 0) { + buffer.append((char*)fragment.str()); + } + buffer.append(HTTP10); + + buffer.append(HOST); + buffer.append((char*)hostName.str()); + if(urlSource.getPortNum() != 80) + { + buffer.append(COLON); + buffer.appendDecimalNumber(urlSource.getPortNum()); + } + buffer.append(CRLF); + + const XMLCh *username = urlSource.getUser(); + const XMLCh *password = urlSource.getPassword(); + if(username && password) { + XMLBuffer userPassBuf(256, fMemoryManager); + userPassBuf.append(username); + userPassBuf.append(chColon); + userPassBuf.append(password); + + TranscodeToStr userPass(userPassBuf.getRawBuffer(), trans, fMemoryManager); + + XMLSize_t len; + XMLByte* encodedData = Base64::encode(userPass.str(), userPass.length(), &len, fMemoryManager); + ArrayJanitor janBuf2(encodedData, fMemoryManager); + + if(encodedData) { + // HTTP doesn't want the 0x0A separating the data in chunks of 76 chars per line + XMLByte* authData = (XMLByte*)fMemoryManager->allocate((len+1)*sizeof(XMLByte)); + ArrayJanitor janBuf(authData, fMemoryManager); + XMLByte *cursor = authData; + for(XMLSize_t i = 0; i < len; ++i) + if(encodedData[i] != chLF) + *cursor++ = encodedData[i]; + *cursor++ = 0; + buffer.append(AUTHORIZATION); + buffer.append((char*)authData); + buffer.append(CRLF); + } + } + + if(httpInfo && httpInfo->fHeaders) + buffer.append(httpInfo->fHeaders, httpInfo->fHeadersLen); + + buffer.append(CRLF); +} + +XMLCh *BinHTTPInputStreamCommon::findHeader(const char *name) +{ + XMLSize_t len = strlen(name); + + char *p = strstr(fBuffer.getRawBuffer(), name); + while(p != 0) { + if(*(p - 1) == '\n' && + *(p + len) == ':' && + *(p + len + 1) == ' ') { + + p += len + 2; + + char *endP = strstr(p, CRLF); + if(endP == 0) { + for(endP = p; *endP != 0; ++endP) ; + } + + // Transcode from iso-8859-1 + TranscodeFromStr value((XMLByte*)p, endP - p, "ISO8859-1", fMemoryManager); + return value.adopt(); + } + + p = strstr(p + 1, name); + } + + return 0; +} + +int BinHTTPInputStreamCommon::sendRequest(const XMLURL &url, const XMLNetHTTPInfo *httpInfo) +{ + // + // Constants in ASCII to send/check in the HTTP request/response + // + + static const char *CRLF2X = "\r\n\r\n"; + static const char *LF2X = "\n\n"; + + // The port is open and ready to go. + // Build up the http GET command to send to the server. + CharBuffer requestBuffer(1023, fMemoryManager); + createHTTPRequest(url, httpInfo, requestBuffer); + + // Send the http request + if(!send(requestBuffer.getRawBuffer(), requestBuffer.getLen())) { + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_WriteSocket, url.getURLText(), fMemoryManager); + } + + if(httpInfo && httpInfo->fPayload) { + if(!send(httpInfo->fPayload, httpInfo->fPayloadLen)) { + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_WriteSocket, url.getURLText(), fMemoryManager); + } + } + + // + // get the response, check the http header for errors from the server. + // + char tmpBuf[1024]; + int ret; + + fBuffer.reset(); + while(true) { + ret = receive(tmpBuf, sizeof(tmpBuf)); + if(ret == -1) { + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, url.getURLText(), fMemoryManager); + } + + fBuffer.append(tmpBuf, ret); + + fBufferPos = strstr(fBuffer.getRawBuffer(), CRLF2X); + if(fBufferPos != 0) { + fBufferPos += 4; + *(fBufferPos - 2) = 0; + break; + } + + fBufferPos = strstr(fBuffer.getRawBuffer(), LF2X); + if(fBufferPos != 0) { + fBufferPos += 2; + *(fBufferPos - 1) = 0; + break; + } + } + + // Parse the response status + char *p = strstr(fBuffer.getRawBuffer(), "HTTP"); + if(p == 0) { + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, url.getURLText(), fMemoryManager); + } + + p = strchr(p, chSpace); + if(p == 0) { + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, url.getURLText(), fMemoryManager); + } + + return atoi(p); +} + +const XMLCh *BinHTTPInputStreamCommon::getContentType() const +{ + if(fContentType == 0) { + // mutable + const_cast(this)->fContentType = + const_cast(this)->findHeader("Content-Type"); + } + return fContentType; +} + +XMLSize_t BinHTTPInputStreamCommon::readBytes(XMLByte* const toFill, + const XMLSize_t maxToRead) +{ + XMLSize_t len = fBuffer.getRawBuffer() + fBuffer.getLen() - fBufferPos; + if(len > 0) + { + // If there's any data left over in the buffer into which we first + // read from the server (to get the http header), return that. + if (len > maxToRead) + len = maxToRead; + memcpy(toFill, fBufferPos, len); + fBufferPos += len; + } + else + { + // There was no data in the local buffer. + // Read some from the socket, straight into our caller's buffer. + // + int cbRead = receive((char *)toFill, maxToRead); + if (cbRead == -1) + { + ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, fMemoryManager); + } + len = cbRead; + } + + fBytesProcessed += len; + return len; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp b/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp new file mode 100644 index 000000000..463d9a061 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NetAccessors/BinHTTPInputStreamCommon.hpp @@ -0,0 +1,228 @@ +/* + * 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: BinFileInputStream.hpp 553903 2007-07-06 14:43:42Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BINHTTPINPUTSTREAMCOMMON_HPP) +#define XERCESC_INCLUDE_GUARD_BINHTTPINPUTSTREAMCOMMON_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class implements a simple expanding character buffer +// +class XMLUTIL_EXPORT CharBuffer +{ +public: + CharBuffer(XMLSize_t capacity = 1023, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager) + : fCapacity(capacity), + fIndex(0), + fMemoryManager(manager) + { + fBuffer = (char*)fMemoryManager->allocate((fCapacity + 1) * sizeof(char)); + } + + ~CharBuffer() + { + fMemoryManager->deallocate(fBuffer); + } + + const char* getRawBuffer() const + { + fBuffer[fIndex] = 0; + return fBuffer; + } + + char* getRawBuffer() + { + fBuffer[fIndex] = 0; + return fBuffer; + } + + XMLSize_t getLen() const + { + return fIndex; + } + + void reset() + { + fIndex = 0; + } + + void append(const char *chars) + { + if(chars != 0 && *chars != 0) { + // get length of chars + XMLSize_t count = 0; + for(; *(chars+count); ++count) ; + + if(fIndex + count >= fCapacity) { + ensureCapacity(count); + } + memcpy(&fBuffer[fIndex], chars, count * sizeof(char)); + fIndex += count; + } + } + + void append(const char *chars, XMLSize_t len) + { + if(chars != 0 && len != 0) { + if(fIndex + len >= fCapacity) { + ensureCapacity(len); + } + memcpy(&fBuffer[fIndex], chars, len * sizeof(char)); + fIndex += len; + } + } + + void appendDecimalNumber(unsigned int n) + { + if(n >= 10) { + appendDecimalNumber(n / 10); + n = n % 10; + } + + if(fIndex + 1 >= fCapacity) + ensureCapacity(1); + + fBuffer[fIndex] = '0' + n; + ++fIndex; + } + + void set(const char *chars) + { + reset(); + append(chars); + } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CharBuffer(const CharBuffer &); + CharBuffer &operator=(const CharBuffer &); + + void ensureCapacity(XMLSize_t extraNeeded) + { + // If we can't handle it, try doubling the buffer size. + XMLSize_t newCap = (fIndex + extraNeeded) * 2; + + if(newCap > fCapacity) + { + // Allocate new buffer + char* newBuf = (char*)fMemoryManager->allocate((newCap + 1) * sizeof(char)); + + // Copy over the old stuff + memcpy(newBuf, fBuffer, fIndex * sizeof(char)); + + // Clean up old buffer and store new stuff + fMemoryManager->deallocate(fBuffer); + fBuffer = newBuf; + fCapacity = newCap; + } + } + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + char *fBuffer; + XMLSize_t fCapacity; + XMLSize_t fIndex; + MemoryManager *fMemoryManager; +}; + +// +// Common base implementation of HTTP BinInputStream that is used by some +// platform-specific implementations. +// +class XMLUTIL_EXPORT BinHTTPInputStreamCommon : public BinInputStream +{ +public : + virtual XMLFilePos curPos() const; + virtual XMLSize_t readBytes + ( + XMLByte* const toFill + , const XMLSize_t maxToRead + ); + + virtual const XMLCh *getContentType() const; + +protected : + BinHTTPInputStreamCommon(MemoryManager *manager); + virtual ~BinHTTPInputStreamCommon(); + + /** + * \return The HTTP status code + */ + int sendRequest(const XMLURL &url, const XMLNetHTTPInfo *httpInfo); + XMLCh *findHeader(const char *name); + + virtual bool send(const char *buf, XMLSize_t len) = 0; + /** + * \return The length of the data received, or -1 if an error occured + */ + virtual int receive(char *buf, XMLSize_t len) = 0; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BinHTTPInputStreamCommon(const BinHTTPInputStreamCommon&); + BinHTTPInputStreamCommon& operator=(const BinHTTPInputStreamCommon&); + + void createHTTPRequest(const XMLURL &urlSource, const XMLNetHTTPInfo *httpInfo, CharBuffer &buffer); + + // ----------------------------------------------------------------------- + // Private data members + // + // fBytesProcessed + // Its a rolling count of the number of bytes processed off this + // input stream. + // fBuffer + // Holds the http header, plus the first part of the actual + // data. Filled at the time the stream is opened, data goes + // out to user in response to readBytes(). + // fBufferPos + // Pointers into fBuffer, showing start and end+1 of content + // that readBytes must return. + // ----------------------------------------------------------------------- + + XMLSize_t fBytesProcessed; + CharBuffer fBuffer; + char * fBufferPos; + XMLCh * fContentType; + MemoryManager* fMemoryManager; +}; + + +inline XMLFilePos BinHTTPInputStreamCommon::curPos() const +{ + return fBytesProcessed; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/NoSuchElementException.hpp b/project/jni/xerces/src/xercesc/util/NoSuchElementException.hpp new file mode 100644 index 000000000..a76e80f54 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NoSuchElementException.hpp @@ -0,0 +1,34 @@ +/* + * 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: NoSuchElementException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NOSUCHELEMENTEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_NOSUCHELEMENTEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(NoSuchElementException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/NullPointerException.hpp b/project/jni/xerces/src/xercesc/util/NullPointerException.hpp new file mode 100644 index 000000000..d4890e015 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NullPointerException.hpp @@ -0,0 +1,35 @@ +/* + * 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: NullPointerException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NULLPOINTEREXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_NULLPOINTEREXCEPTION_HPP + + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(NullPointerException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/NumberFormatException.hpp b/project/jni/xerces/src/xercesc/util/NumberFormatException.hpp new file mode 100644 index 000000000..cafc3e0d8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/NumberFormatException.hpp @@ -0,0 +1,34 @@ +/* + * 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: NumberFormatException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NUMBERFORMATEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_NUMBERFORMATEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(NumberFormatException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/OutOfMemoryException.hpp b/project/jni/xerces/src/xercesc/util/OutOfMemoryException.hpp new file mode 100644 index 000000000..93e4a2fe6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/OutOfMemoryException.hpp @@ -0,0 +1,96 @@ +/* + * 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: OutOfMemoryException.hpp 673960 2008-07-04 08:50:12Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_OUT_OF_MEMORY_EXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_OUT_OF_MEMORY_EXCEPTION_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const XMLCh gDefOutOfMemoryErrMsg[] = +{ + chLatin_O, chLatin_u, chLatin_t, chLatin_O + , chLatin_f, chLatin_M, chLatin_e, chLatin_m + , chLatin_o, chLatin_r, chLatin_y, chNull +}; + +class XMLUTIL_EXPORT OutOfMemoryException : public XMemory +{ +public: + + OutOfMemoryException(); + ~OutOfMemoryException(); + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLExcepts::Codes getCode() const; + const XMLCh* getMessage() const; + const XMLCh* getType() const; + const char* getSrcFile() const; + XMLFileLoc getSrcLine() const; + + OutOfMemoryException(const OutOfMemoryException& toCopy); + OutOfMemoryException& operator=(const OutOfMemoryException& toAssign); +}; + +// constructors/destructors... +inline OutOfMemoryException::OutOfMemoryException() {} +inline OutOfMemoryException::~OutOfMemoryException() {} +inline OutOfMemoryException::OutOfMemoryException(const OutOfMemoryException& other) : XMemory(other) {} +inline OutOfMemoryException& OutOfMemoryException::operator=(const OutOfMemoryException&) +{ + return *this; +} + +// --------------------------------------------------------------------------- +// OutOfMemoryException: Getter methods +// --------------------------------------------------------------------------- +inline XMLExcepts::Codes OutOfMemoryException::getCode() const +{ + return XMLExcepts::Out_Of_Memory; +} + +inline const XMLCh* OutOfMemoryException::getMessage() const +{ + return gDefOutOfMemoryErrMsg; +} + +inline const XMLCh* OutOfMemoryException::getType() const +{ + return gDefOutOfMemoryErrMsg; +} + +inline const char* OutOfMemoryException::getSrcFile() const +{ + return ""; +} + +inline XMLFileLoc OutOfMemoryException::getSrcLine() const { + return 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/PSVIUni.cpp b/project/jni/xerces/src/xercesc/util/PSVIUni.cpp new file mode 100644 index 000000000..23ace3e04 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PSVIUni.cpp @@ -0,0 +1,971 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include "PSVIUni.hpp" + +XERCES_CPP_NAMESPACE_USE + + +const XMLCh PSVIUni::fgPsvColon[] = { + chLatin_p, chLatin_s, chLatin_v, chColon, chNull +}; + +const XMLCh PSVIUni::fgAllDeclarationsProcessed[] = +{ + chLatin_a, chLatin_l, chLatin_l, chLatin_D, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chLatin_P, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgAttribute[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgAttributes[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgAttributeType[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgBaseURI[] = +{ + chLatin_b, chLatin_a, chLatin_s, chLatin_e, chLatin_U, chLatin_R, chLatin_I, chNull +}; + +const XMLCh PSVIUni::fgCanonicalRepresentation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_c, chLatin_a, chLatin_n, chLatin_o, chLatin_n, chLatin_i, chLatin_c, chLatin_a, + chLatin_l, chLatin_R, chLatin_e, chLatin_p, chNull + +}; + +const XMLCh PSVIUni::fgCharacter[] = +{ + chLatin_c, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_e, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgCharacterEncodingScheme[] = +{ + chLatin_c, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_e, chLatin_r, chLatin_E, chLatin_n, chLatin_c, chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chLatin_S, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgChildren[] = +{ + chLatin_c, chLatin_h, chLatin_i, chLatin_l, chLatin_d, chLatin_r, chLatin_e, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgComment[] = +{ + chLatin_c, chLatin_o, chLatin_m, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgContent[] = +{ + chLatin_c, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgDocument[] = +{ + chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgDocTypeDeclaration[] = +{ + chLatin_d, chLatin_o, chLatin_c, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgDocumentElement[] = +{ + chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_E, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgElement[] = +{ + chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgInScopeNamespaces[] = +{ + chLatin_i, chLatin_n, chLatin_S, chLatin_c, chLatin_o, chLatin_p, chLatin_e, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgLocalName[] = +{ + chLatin_l, chLatin_o, chLatin_c, chLatin_a, chLatin_l, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNamespace[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNamespaceAttributes[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_A, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgNamespaceName[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNormalizedValue[] = +{ + chLatin_n, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_l, chLatin_i, chLatin_z, chLatin_e, chLatin_d, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNotations[] = +{ + chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgPrefix[] = +{ + chLatin_p, chLatin_r, chLatin_e, chLatin_f, chLatin_i, chLatin_x, chNull +}; + +const XMLCh PSVIUni::fgProcessingInstruction[] = +{ + chLatin_p, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_n, chLatin_g, chLatin_I, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_u, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgReferences[] = +{ + chLatin_r, chLatin_e, chLatin_f, chLatin_e, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgSpecified[] = +{ + chLatin_s, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgStandalone[] = +{ + chLatin_s, chLatin_t, chLatin_a, chLatin_n, chLatin_d, chLatin_a, chLatin_l, chLatin_o, chLatin_n, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgTarget[] = +{ + chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgText[] = +{ + chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgTextContent[] = +{ + chLatin_t, chLatin_e, chLatin_x, chLatin_t, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgUnparsedEntities[] = +{ + chLatin_u, chLatin_n, chLatin_p, chLatin_a, chLatin_r, chLatin_s, chLatin_e, chLatin_d, chLatin_E, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_i, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgVersion[] = +{ + chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgAbstract[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_b, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgAnnotation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgAnnotations[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgApplicationInformation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_p, chLatin_p, chLatin_l, chLatin_i, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_I, chLatin_n, chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgAttributeDeclaration[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_D, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgAttributeGroupDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgAttributeUse[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_U, chLatin_s, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgAttributeUses[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_U, chLatin_s, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgAttributeWildcard[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chLatin_W, chLatin_i, chLatin_l, chLatin_d, chLatin_c, chLatin_a, chLatin_r, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgBaseTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_b, chLatin_a, chLatin_s, chLatin_e, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgComplexTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_c, chLatin_o, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chLatin_x, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgCompositor[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_c, chLatin_o, chLatin_m, chLatin_p, chLatin_o, chLatin_s, chLatin_i, chLatin_t, chLatin_o, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgContentType[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_c, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgDeclaration[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_d, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgDerivationMethod[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_d, chLatin_e, chLatin_r, chLatin_i, chLatin_v, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_M, chLatin_e, chLatin_t, chLatin_h, chLatin_o, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgDisallowedSubstitutions[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_d, chLatin_i, chLatin_s, chLatin_a, chLatin_l, chLatin_l, chLatin_o, chLatin_w, chLatin_e, chLatin_d, chLatin_S, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgDocumentLocation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgPsvDocument[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgElementDeclaration[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_D, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgFacetFixed[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgFacets[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_a, chLatin_c, chLatin_e, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgFields[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_i, chLatin_e, chLatin_l, chLatin_d, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgFinal[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_i, chLatin_n, chLatin_a, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgFundamentalFacets[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_u, chLatin_n, chLatin_d, chLatin_a, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_l, chLatin_F, chLatin_a, chLatin_c, chLatin_e, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgIdentityConstraintCategory[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chLatin_C, chLatin_a, chLatin_t, chLatin_e, chLatin_g, chLatin_o, chLatin_r, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgIdentityConstraintDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgIdentityConstraintDefinitions[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgIdentityConstraintTable[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chLatin_T, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgIdIdrefTable[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_d, chLatin_I, chLatin_d, chLatin_r, chLatin_e, chLatin_f, chLatin_T, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgItemTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_i, chLatin_t, chLatin_e, chLatin_m, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgMaxOccurs[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_a, chLatin_x, chLatin_O, chLatin_c, chLatin_c, chLatin_u, chLatin_r, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgMemberTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_e, chLatin_m, chLatin_b, chLatin_e, chLatin_r, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgMemberTypeDefinitions[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_e, chLatin_m, chLatin_b, chLatin_e, chLatin_r, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgMinOccurs[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_i, chLatin_n, chLatin_O, chLatin_c, chLatin_c, chLatin_u, chLatin_r, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgModelGroup[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_o, chLatin_d, chLatin_e, chLatin_l, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chNull +}; + +const XMLCh PSVIUni::fgModelGroupDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_o, chLatin_d, chLatin_e, chLatin_l, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgName[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNamespaceConstraint[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgNamespaces[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgNamespaceSchemaInformation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_S, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_I, chLatin_n, chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgNil[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_i, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgNillable[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_i, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNotation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgNotationDeclaration[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_D, chLatin_e, chLatin_c, chLatin_l, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgParticle[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_c, chLatin_l, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgParticles[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_c, chLatin_l, chLatin_e, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgPrimitiveTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_r, chLatin_i, chLatin_m, chLatin_i, chLatin_t, chLatin_i, chLatin_v, chLatin_e, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgProcessContents[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgProhibitedSubstitutions[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_h, chLatin_i, chLatin_b, chLatin_i, chLatin_t, chLatin_e, chLatin_d, chLatin_S, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgPublicIdentifier[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_u, chLatin_b, chLatin_l, chLatin_i, chLatin_c, chLatin_I, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgReferencedKey[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_r, chLatin_e, chLatin_f, chLatin_e, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_e, chLatin_d, chLatin_K, chLatin_e, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgRequired[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_r, chLatin_e, chLatin_q, chLatin_u, chLatin_i, chLatin_r, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgSchemaAnnotations[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_A, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgSchemaComponents[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_C, chLatin_o, chLatin_m, chLatin_p, chLatin_o, chLatin_n, chLatin_e, chLatin_n, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgSchemaDefault[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_D, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgSchemaDocument[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_D, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgSchemaDocuments[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_D, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgSchemaErrorCode[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_E, chLatin_r, chLatin_r, chLatin_o, chLatin_r, chLatin_C, chLatin_o, chLatin_d, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSchemaInformation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_I, chLatin_n, chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgSchemaNamespace[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSchemaNormalizedValue[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_N, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_l, chLatin_i, chLatin_z, chLatin_e, chLatin_d, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSchemaSpecified[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_S, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgScope[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_c, chLatin_o, chLatin_p, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSelector[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_e, chLatin_l, chLatin_e, chLatin_c, chLatin_t, chLatin_o, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgSimpleTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_i, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgSubstitutionGroupAffiliation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chLatin_A, chLatin_f, chLatin_f, chLatin_i, chLatin_l, chLatin_i, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgSubstitutionGroupExclusions[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chLatin_E, chLatin_x, chLatin_c, chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgSystemIdentifier[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_s, chLatin_y, chLatin_s, chLatin_t, chLatin_e, chLatin_m, chLatin_I, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgTargetNamespace[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgTerm[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_t, chLatin_e, chLatin_r, chLatin_m, chNull +}; + +const XMLCh PSVIUni::fgTypeDefinition[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_t, chLatin_y, chLatin_p, chLatin_e, chLatin_D, chLatin_e, chLatin_f, chLatin_i, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgUserInformation[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_u, chLatin_s, chLatin_e, chLatin_r, chLatin_I, chLatin_n, chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgValidationAttempted[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_A, chLatin_t, chLatin_t, chLatin_e, chLatin_m, chLatin_p, chLatin_t, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgValidationContext[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgValidity[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, chLatin_i, chLatin_t, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgValue[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgValueConstraint[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chLatin_C, chLatin_o, chLatin_n, chLatin_s, chLatin_t, chLatin_r, chLatin_a, chLatin_i, chLatin_n, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgVariety[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_v, chLatin_a, chLatin_r, chLatin_i, chLatin_e, chLatin_t, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgWildcard[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_w, chLatin_i, chLatin_l, chLatin_d, chLatin_c, chLatin_a, chLatin_r, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgXpath[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_x, chLatin_p, chLatin_a, chLatin_t, chLatin_h, chNull +}; + +const XMLCh PSVIUni::fgAll[] = +{ + chLatin_a, chLatin_l, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgAny[] = +{ + chLatin_a, chLatin_n, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgAppinfo[] = +{ + chLatin_a, chLatin_p, chLatin_p, chLatin_i, chLatin_n, chLatin_f, chLatin_o, chNull +}; + +const XMLCh PSVIUni::fgAtomic[] = +{ + chLatin_a, chLatin_t, chLatin_o, chLatin_m, chLatin_i, chLatin_c, chNull +}; + +const XMLCh PSVIUni::fgChoice[] = +{ + chLatin_c, chLatin_h, chLatin_o, chLatin_i, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgDefault[] = +{ + chLatin_d, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgDocumentation[] = +{ + chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgElementOnly[] = +{ + chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_O, chLatin_n, chLatin_l, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgEmpty[] = +{ + chLatin_e, chLatin_m, chLatin_p, chLatin_t, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgExtension[] = +{ + chLatin_e, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgFalse[] = +{ + chLatin_f, chLatin_a, chLatin_l, chLatin_s, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgFull[] = +{ + chLatin_f, chLatin_u, chLatin_l, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgGlobal[] = +{ + chLatin_g, chLatin_l, chLatin_o, chLatin_b, chLatin_a, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgInfoset[] = +{ + chLatin_i, chLatin_n, chLatin_f, chLatin_o, chLatin_s, chLatin_e, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgInvalid[] = +{ + chLatin_i, chLatin_n, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgKey[] = +{ + chLatin_k, chLatin_e, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgKeyref[] = +{ + chLatin_k, chLatin_e, chLatin_y, chLatin_r, chLatin_e, chLatin_f, chNull +}; + +const XMLCh PSVIUni::fgLax[] = +{ + chLatin_l, chLatin_a, chLatin_x, chNull +}; + +const XMLCh PSVIUni::fgList[] = +{ + chLatin_l, chLatin_i, chLatin_s, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgLocal[] = +{ + chLatin_l, chLatin_o, chLatin_c, chLatin_a, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgMixed[] = +{ + chLatin_m, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgNone[] = +{ + chLatin_n, chLatin_o, chLatin_n, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNotKnown[] = +{ + chLatin_n, chLatin_o, chLatin_t, chLatin_K, chLatin_n, chLatin_o, chLatin_w, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgNsNamespace[] = +{ + chLatin_n, chLatin_s, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgOnePointZero[] = +{ + chDigit_1, chPeriod, chDigit_0, chNull +}; + +const XMLCh PSVIUni::fgPartial[] = +{ + chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_a, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgRestrict[] = +{ + chLatin_r, chLatin_e, chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_c, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgRestriction[] = +{ + chLatin_r, chLatin_e, chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgSchema[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chNull +}; + +const XMLCh PSVIUni::fgSequence[] = +{ + chLatin_s, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_n, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSimple[] = +{ + chLatin_s, chLatin_i, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgSkip[] = +{ + chLatin_s, chLatin_k, chLatin_i, chLatin_p, chNull +}; + +const XMLCh PSVIUni::fgStrict[] = +{ + chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_c, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgSubstitution[] = +{ + chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgTotal[] = +{ + chLatin_t, chLatin_o, chLatin_t, chLatin_a, chLatin_l, chNull +}; + +const XMLCh PSVIUni::fgTrue[] = +{ + chLatin_t, chLatin_r, chLatin_u, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgUnbounded[] = +{ + chLatin_u, chLatin_n, chLatin_b, chLatin_o, chLatin_u, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgUnion[] = +{ + chLatin_u, chLatin_n, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgUnique[] = +{ + chLatin_u, chLatin_n, chLatin_i, chLatin_q, chLatin_u, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgUnknown[] = +{ + chLatin_u, chLatin_n, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgValid[] = +{ + chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgVCFixed[] = +{ + chLatin_f, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgXMLChNull[] = +{ + chNull +}; + +const XMLCh PSVIUni::fgAg[] = +{ + chLatin_a, chLatin_g, chNull +}; + +const XMLCh PSVIUni::fgAnnot[] = +{ + chLatin_a, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgAttr[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chNull +}; + +const XMLCh PSVIUni::fgAu[] = +{ + chLatin_a, chLatin_u, chNull +}; + +const XMLCh PSVIUni::fgElt[] = +{ + chLatin_e, chLatin_l, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgIdc[] = +{ + chLatin_i, chLatin_d, chLatin_c, chNull +}; + +const XMLCh PSVIUni::fgMg[] = +{ + chLatin_m, chLatin_g, chNull +}; + +const XMLCh PSVIUni::fgNot[] = +{ + chLatin_n, chLatin_o, chLatin_t, chNull +}; + +const XMLCh PSVIUni::fgType[] = +{ + chLatin_t, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgBounded[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_b, chLatin_o, chLatin_u, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgCardinality[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_c, chLatin_a, chLatin_r, chLatin_d, chLatin_i, chLatin_n, chLatin_a, chLatin_l, chLatin_i, chLatin_t, chLatin_y, chNull +}; + +const XMLCh PSVIUni::fgEnumeration[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_e, chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgFractionDigits[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_f, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_D, chLatin_i, chLatin_g, chLatin_i, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgLength[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_l, chLatin_e, chLatin_n, chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh PSVIUni::fgMaxExclusive[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_a, chLatin_x, chLatin_E, chLatin_x, chLatin_c, chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgMaxInclusive[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_a, chLatin_x, chLatin_I, chLatin_n, chLatin_c, chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgMaxLength[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_a, chLatin_x, chLatin_L, chLatin_e, chLatin_n, chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh PSVIUni::fgMinExclusive[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_i, chLatin_n, chLatin_E, chLatin_x, chLatin_c, chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgMinInclusive[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_i, chLatin_n, chLatin_I, chLatin_n, chLatin_c, chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgMinLength[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_m, chLatin_i, chLatin_n, chLatin_L, chLatin_e, chLatin_n, chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh PSVIUni::fgNumeric[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, chLatin_i, chLatin_c, chNull +}; + +const XMLCh PSVIUni::fgOrdered[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_o, chLatin_r, chLatin_d, chLatin_e, chLatin_r, chLatin_e, chLatin_d, chNull +}; + +const XMLCh PSVIUni::fgPattern[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_p, chLatin_a, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_n, chNull +}; + +const XMLCh PSVIUni::fgTotalDigits[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_t, chLatin_o, chLatin_t, chLatin_a, chLatin_l, chLatin_D, chLatin_i, chLatin_g, chLatin_i, chLatin_t, chLatin_s, chNull +}; + +const XMLCh PSVIUni::fgWhiteSpace[] = +{ + chLatin_p, chLatin_s, chLatin_v, chColon, chLatin_w, chLatin_h, chLatin_i, chLatin_t, chLatin_e, chLatin_S, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh PSVIUni::fgNamespaceInfoset[] = { //http://www.w3.org/2001/05/XMLInfoset + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash, + chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, + chForwardSlash, chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, chDigit_0, chDigit_5, + chForwardSlash, chLatin_X, chLatin_M, chLatin_L, chLatin_I, chLatin_n, chLatin_f, chLatin_o, chLatin_s, + chLatin_e, chLatin_t, chNull +}; +const XMLCh PSVIUni::fgXsi[] = { //xsi + chLatin_x, chLatin_s, chLatin_i, chNull +}; +const XMLCh PSVIUni::fgNamespaceInstance[] = { //http://www.w3.org/2001/XMLSchema-instance + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash, + chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, + chLatin_g, chForwardSlash, chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, chLatin_X, + chLatin_M, chLatin_L, chLatin_S, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chDash, chLatin_i, + chLatin_n, chLatin_s, chLatin_t, chLatin_a, chLatin_n, chLatin_c, chLatin_e, chNull +}; +const XMLCh PSVIUni::fgPsv[] = { //psv + chLatin_p, chLatin_s, chLatin_v, chNull +}; +const XMLCh PSVIUni::fgNamespacePsvi[] = { //http://apache.org/xml/2001/PSVInfosetExtension + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash, + chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, + chForwardSlash, chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chDigit_2, chDigit_0, chDigit_0, + chDigit_1, chForwardSlash, chLatin_P, chLatin_S, chLatin_V, chLatin_I, chLatin_n, chLatin_f, chLatin_o, + chLatin_s, chLatin_e, chLatin_t, chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, + chLatin_i, chLatin_o, chLatin_n, chNull +}; +const XMLCh PSVIUni::fgXml[] = +{ + chLatin_x, chLatin_m, chLatin_l, chNull +}; +const XMLCh PSVIUni::fgNamespaceXmlSchema[] = { //http://www.w3.org/2001/XMLSchema + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash, chLatin_w, + chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, + chForwardSlash, chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, chLatin_X, chLatin_M, + chLatin_L, chLatin_S, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chNull +}; diff --git a/project/jni/xerces/src/xercesc/util/PSVIUni.hpp b/project/jni/xerces/src/xercesc/util/PSVIUni.hpp new file mode 100644 index 000000000..483c5da2b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PSVIUni.hpp @@ -0,0 +1,239 @@ +/* + * 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: PSVIUni.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIUNI_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIUNI_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT PSVIUni +{ +public : + + static const XMLCh fgPsvColon[]; + + //Infoset Element Names + static const XMLCh fgAllDeclarationsProcessed[]; + static const XMLCh fgAttribute[]; + static const XMLCh fgAttributes[]; + static const XMLCh fgAttributeType[]; + static const XMLCh fgBaseURI[]; + static const XMLCh fgCharacter[]; + static const XMLCh fgCharacterEncodingScheme[]; + static const XMLCh fgChildren[]; + static const XMLCh fgComment[]; + static const XMLCh fgContent[]; + static const XMLCh fgDocument[]; + static const XMLCh fgDocTypeDeclaration[]; + static const XMLCh fgDocumentElement[]; + static const XMLCh fgElement[]; + static const XMLCh fgInScopeNamespaces[]; + static const XMLCh fgLocalName[]; + static const XMLCh fgNamespace[]; + static const XMLCh fgNamespaceAttributes[]; + static const XMLCh fgNamespaceName[]; + static const XMLCh fgNormalizedValue[]; + static const XMLCh fgNotations[]; + static const XMLCh fgPrefix[]; + static const XMLCh fgProcessingInstruction[]; + static const XMLCh fgReferences[]; + static const XMLCh fgSpecified[]; + static const XMLCh fgStandalone[]; + static const XMLCh fgTarget[]; + static const XMLCh fgText[]; + static const XMLCh fgTextContent[]; + static const XMLCh fgUnparsedEntities[]; + static const XMLCh fgVersion[]; + + //PSVI Element Names + static const XMLCh fgAbstract[]; + static const XMLCh fgAnnotation[]; + static const XMLCh fgAnnotations[]; + static const XMLCh fgApplicationInformation[]; + static const XMLCh fgAttributeDeclaration[]; + static const XMLCh fgAttributeGroupDefinition[]; + static const XMLCh fgAttributeUse[]; + static const XMLCh fgAttributeUses[]; + static const XMLCh fgAttributeWildcard[]; + static const XMLCh fgBaseTypeDefinition[]; + static const XMLCh fgCanonicalRepresentation[]; + static const XMLCh fgComplexTypeDefinition[]; + static const XMLCh fgCompositor[]; + static const XMLCh fgContentType[]; + static const XMLCh fgDeclaration[]; + static const XMLCh fgDerivationMethod[]; + static const XMLCh fgDisallowedSubstitutions[]; + static const XMLCh fgPsvDocument[]; + static const XMLCh fgDocumentLocation[]; + static const XMLCh fgElementDeclaration[]; + static const XMLCh fgFacets[]; + static const XMLCh fgFacetFixed[]; + static const XMLCh fgFields[]; + static const XMLCh fgFinal[]; + static const XMLCh fgFundamentalFacets[]; + static const XMLCh fgIdentityConstraintCategory[]; + static const XMLCh fgIdentityConstraintDefinition[]; + static const XMLCh fgIdentityConstraintDefinitions[]; + static const XMLCh fgIdentityConstraintTable[]; + static const XMLCh fgIdIdrefTable[]; + static const XMLCh fgItemTypeDefinition[]; + static const XMLCh fgMaxOccurs[]; + static const XMLCh fgMemberTypeDefinition[]; + static const XMLCh fgMemberTypeDefinitions[]; + static const XMLCh fgMinOccurs[]; + static const XMLCh fgModelGroup[]; + static const XMLCh fgModelGroupDefinition[]; + static const XMLCh fgName[]; + static const XMLCh fgNamespaceConstraint[]; + static const XMLCh fgNamespaces[]; + static const XMLCh fgNamespaceSchemaInformation[]; + static const XMLCh fgNil[]; + static const XMLCh fgNillable[]; + static const XMLCh fgNotation[]; + static const XMLCh fgNotationDeclaration[]; + static const XMLCh fgParticle[]; + static const XMLCh fgParticles[]; + static const XMLCh fgPrimitiveTypeDefinition[]; + static const XMLCh fgProcessContents[]; + static const XMLCh fgProhibitedSubstitutions[]; + static const XMLCh fgPublicIdentifier[]; + static const XMLCh fgReferencedKey[]; + static const XMLCh fgRequired[]; + static const XMLCh fgSchemaAnnotations[]; + static const XMLCh fgSchemaComponents[]; + static const XMLCh fgSchemaDefault[]; + static const XMLCh fgSchemaDocument[]; + static const XMLCh fgSchemaDocuments[]; + static const XMLCh fgSchemaErrorCode[]; + static const XMLCh fgSchemaInformation[]; + static const XMLCh fgSchemaNamespace[]; + static const XMLCh fgSchemaNormalizedValue[]; + static const XMLCh fgSchemaSpecified[]; + static const XMLCh fgScope[]; + static const XMLCh fgSelector[]; + static const XMLCh fgSimpleTypeDefinition[]; + static const XMLCh fgSubstitutionGroupAffiliation[]; + static const XMLCh fgSubstitutionGroupExclusions[]; + static const XMLCh fgSystemIdentifier[]; + static const XMLCh fgTargetNamespace[]; + static const XMLCh fgTerm[]; + static const XMLCh fgTypeDefinition[]; + static const XMLCh fgUserInformation[]; + static const XMLCh fgValidationAttempted[]; + static const XMLCh fgValidationContext[]; + static const XMLCh fgValidity[]; + static const XMLCh fgValue[]; + static const XMLCh fgValueConstraint[]; + static const XMLCh fgVariety[]; + static const XMLCh fgWildcard[]; + static const XMLCh fgXpath[]; + + //PSVI Element Values + static const XMLCh fgAll[]; + static const XMLCh fgAny[]; + static const XMLCh fgAppinfo[]; + static const XMLCh fgAtomic[]; + static const XMLCh fgChoice[]; + static const XMLCh fgDefault[]; + static const XMLCh fgDocumentation[]; + static const XMLCh fgElementOnly[]; + static const XMLCh fgEmpty[]; + static const XMLCh fgExtension[]; + static const XMLCh fgFalse[]; + static const XMLCh fgFull[]; + static const XMLCh fgGlobal[]; + static const XMLCh fgInfoset[]; + static const XMLCh fgInvalid[]; + static const XMLCh fgKey[]; + static const XMLCh fgKeyref[]; + static const XMLCh fgLax[]; + static const XMLCh fgList[]; + static const XMLCh fgLocal[]; + static const XMLCh fgMixed[]; + static const XMLCh fgNone[]; + static const XMLCh fgNotKnown[]; + static const XMLCh fgNsNamespace[]; + static const XMLCh fgOnePointZero[]; + static const XMLCh fgPartial[]; + static const XMLCh fgRestrict[]; + static const XMLCh fgRestriction[]; + static const XMLCh fgSchema[]; + static const XMLCh fgSequence[]; + static const XMLCh fgSimple[]; + static const XMLCh fgSkip[]; + static const XMLCh fgStrict[]; + static const XMLCh fgSubstitution[]; + static const XMLCh fgTotal[]; + static const XMLCh fgTrue[]; + static const XMLCh fgUnbounded[]; + static const XMLCh fgUnion[]; + static const XMLCh fgUnique[]; + static const XMLCh fgUnknown[]; + static const XMLCh fgValid[]; + static const XMLCh fgVCFixed[]; + static const XMLCh fgXMLChNull[]; + + //PSVI Element Types (Shortened) + static const XMLCh fgAg[]; + static const XMLCh fgAnnot[]; + static const XMLCh fgAttr[]; + static const XMLCh fgAu[]; + static const XMLCh fgElt[]; + static const XMLCh fgIdc[]; + static const XMLCh fgMg[]; + static const XMLCh fgNot[]; + static const XMLCh fgType[]; + + //Facets + static const XMLCh fgBounded[]; + static const XMLCh fgCardinality[]; + static const XMLCh fgEnumeration[]; + static const XMLCh fgFractionDigits[]; + static const XMLCh fgLength[]; + static const XMLCh fgMaxExclusive[]; + static const XMLCh fgMaxInclusive[]; + static const XMLCh fgMaxLength[]; + static const XMLCh fgMinExclusive[]; + static const XMLCh fgMinInclusive[]; + static const XMLCh fgMinLength[]; + static const XMLCh fgNumeric[]; + static const XMLCh fgOrdered[]; + static const XMLCh fgPattern[]; + static const XMLCh fgTotalDigits[]; + static const XMLCh fgWhiteSpace[]; + + //Namespaces and prefixes + + static const XMLCh fgNamespaceInfoset[]; + static const XMLCh fgXsi[]; + static const XMLCh fgNamespaceInstance[]; + static const XMLCh fgPsv[]; + static const XMLCh fgNamespacePsvi[]; + static const XMLCh fgXml[]; + static const XMLCh fgNamespaceXmlSchema[]; + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/PanicHandler.cpp b/project/jni/xerces/src/xercesc/util/PanicHandler.cpp new file mode 100644 index 000000000..22cc8eb55 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PanicHandler.cpp @@ -0,0 +1,70 @@ +/* + * 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: PanicHandler.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const char* PanicHandler::getPanicReasonString(const PanicReasons reason) +{ + const char* reasonStr; + + switch (reason) + { + case Panic_NoTransService: + reasonStr = "Could not load a transcoding service"; + break; + case Panic_NoDefTranscoder: + reasonStr = "Could not load a local code page transcoder"; + break; + case Panic_CantFindLib: + reasonStr = "Could not find the xerces-c DLL"; + break; + case Panic_UnknownMsgDomain: + reasonStr = "Unknown message domain"; + break; + case Panic_CantLoadMsgDomain: + reasonStr = "Cannot load message domain"; + break; + case Panic_SynchronizationErr: + reasonStr = "Cannot synchronize system or mutex"; + break; + case Panic_SystemInit: + reasonStr = "Cannot initialize the system or mutex"; + break; + case Panic_MutexErr: + reasonStr = "Cannot create, lock or unlock a mutex"; + break; + default: + reasonStr = "Unknown reason"; + break; + } + + return reasonStr; + +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/PanicHandler.hpp b/project/jni/xerces/src/xercesc/util/PanicHandler.hpp new file mode 100644 index 000000000..1c43e2659 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PanicHandler.hpp @@ -0,0 +1,112 @@ +/* + * 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: PanicHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PANICHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_PANICHANDLER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Receive notification of panic. + * + *

This is the interface, through which the Xercesc reports + * a panic to the application. + *

+ * + *

Application may implement this interface, instantiate an + * object of the derivative, and plug it to Xercesc in the + * invocation to XMLPlatformUtils::Initialize(), if it prefers + * to handling panic itself rather than Xercesc doing it. + *

+ * + */ + +class XMLUTIL_EXPORT PanicHandler +{ +public: + + /** @name Public Types */ + //@{ + enum PanicReasons + { + Panic_NoTransService + , Panic_NoDefTranscoder + , Panic_CantFindLib + , Panic_UnknownMsgDomain + , Panic_CantLoadMsgDomain + , Panic_SynchronizationErr + , Panic_SystemInit + , Panic_AllStaticInitErr + , Panic_MutexErr + , PanicReasons_Count + }; + //@} + +protected: + + /** @name hidden Constructors */ + //@{ + /** Default constructor */ + PanicHandler(){}; + +public: + + /** Destructor */ + virtual ~PanicHandler(){}; + //@} + + /** @name The virtual panic handler interface */ + //@{ + /** + * Receive notification of panic + * + * This method is called when an unrecoverable error has occurred in the Xerces library. + * + * This method must not return normally, otherwise, the results are undefined. + * + * Ways of handling this call could include throwing an exception or exiting the process. + * + * Once this method has been called, the results of calling any other Xerces API, + * or using any existing Xerces objects are undefined. + * + * @param reason The reason of panic + * + */ + virtual void panic(const PanicHandler::PanicReasons reason) = 0; + //@} + + static const char* getPanicReasonString(const PanicHandler::PanicReasons reason); + +private: + + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + PanicHandler(const PanicHandler&); + + /** Assignment operator */ + PanicHandler& operator=(const PanicHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/ParseException.hpp b/project/jni/xerces/src/xercesc/util/ParseException.hpp new file mode 100644 index 000000000..cca0328b7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ParseException.hpp @@ -0,0 +1,34 @@ +/* + * 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: ParseException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PARSEEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_PARSEEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(ParseException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/PlatformUtils.cpp b/project/jni/xerces/src/xercesc/util/PlatformUtils.cpp new file mode 100644 index 000000000..eee1dc5ab --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PlatformUtils.cpp @@ -0,0 +1,1092 @@ +/* + * 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: PlatformUtils.cpp 932877 2010-04-11 12:17:34Z borisk $ + * + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_LIMITS_H +# include +#endif +#if HAVE_SYS_TIME_H +# include +#endif +#if HAVE_SYS_TIMEB_H +# include +#endif +#if HAVE_CPUID_H && !XERCES_HAVE_INTRIN_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if XERCES_HAVE_INTRIN_H +# include +#endif + +#include +#if XERCES_USE_FILEMGR_POSIX +# include +#endif +#if XERCES_USE_FILEMGR_WINDOWS +# include +#endif + +#include +#if XERCES_USE_MUTEXMGR_NOTHREAD +# include +#endif +#if XERCES_USE_MUTEXMGR_POSIX +# include +#endif +#if XERCES_USE_MUTEXMGR_WINDOWS +# include +#endif + +#include +#if XERCES_USE_NETACCESSOR_CURL +# include +#endif +#if XERCES_USE_NETACCESSOR_SOCKET +# include +#endif +#if XERCES_USE_NETACCESSOR_CFURL +# include +#endif +#if XERCES_USE_NETACCESSOR_WINSOCK +# include +#endif + + +#include +#if XERCES_USE_MSGLOADER_ICU +# include +#endif +#if XERCES_USE_MSGLOADER_ICONV +# include +#endif +#if XERCES_USE_MSGLOADER_INMEMORY +# include +#endif +#if XERCES_USE_WIN32_MSGLOADER +# include +#endif + +#include +#if XERCES_USE_TRANSCODER_ICU +# include +#endif +#if XERCES_USE_TRANSCODER_GNUICONV +# include +#endif +#if XERCES_USE_TRANSCODER_ICONV +# include +#endif +#if XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER +# include +#endif +#if XERCES_USE_TRANSCODER_WINDOWS +# include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local data members +// +// gSyncMutex +// This is a mutex that will be used to synchronize access to some of +// the static data of the platform utilities class and here locally. +// --------------------------------------------------------------------------- +static XMLMutex* gSyncMutex = 0; +static long gInitFlag = 0; + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: Static Data Members +// --------------------------------------------------------------------------- +XMLNetAccessor* XMLPlatformUtils::fgNetAccessor = 0; +XMLTransService* XMLPlatformUtils::fgTransService = 0; +#ifdef OS390 +XMLTransService* XMLPlatformUtils::fgTransService2 = 0; +#endif +PanicHandler* XMLPlatformUtils::fgUserPanicHandler = 0; +PanicHandler* XMLPlatformUtils::fgDefaultPanicHandler = 0; +MemoryManager* XMLPlatformUtils::fgMemoryManager = 0; +bool XMLPlatformUtils::fgMemMgrAdopted = true; + +XMLFileMgr* XMLPlatformUtils::fgFileMgr = 0; +XMLMutexMgr* XMLPlatformUtils::fgMutexMgr = 0; + +XMLMutex* XMLPlatformUtils::fgAtomicMutex = 0; + +bool XMLPlatformUtils::fgXMLChBigEndian = true; +bool XMLPlatformUtils::fgSSE2ok = false; + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: Init/term methods +// --------------------------------------------------------------------------- +void XMLPlatformUtils::Initialize(const char* const locale + , const char* const nlsHome + , PanicHandler* const panicHandler + , MemoryManager* const memoryManager) +{ + // + // Effects of overflow: + // . resouce re-allocations + // . consequently resource leaks + // . potentially terminate() may never get executed + // + // We got to prevent overflow from happening. + // no error or exception + // + if (gInitFlag == LONG_MAX) + return; + + // + // Make sure we haven't already been initialized. Note that this is not + // thread safe and is not intended for that. Its more for those COM + // like processes that cannot keep up with whether they have initialized + // us yet or not. + // + gInitFlag++; + + if (gInitFlag > 1) + return; + + // Set pluggable memory manager + if (!fgMemoryManager) + { + if (memoryManager) + { + fgMemoryManager = memoryManager; + fgMemMgrAdopted = false; + } + else + { + fgMemoryManager = new MemoryManagerImpl(); + } + } + + /*** + * Panic Handler: + * + ***/ + if (!panicHandler) + { + fgDefaultPanicHandler = new DefaultPanicHandler(); + } + else + { + fgUserPanicHandler = panicHandler; + } + + + // Determine our endianness (with regard to a XMLCh 16-bit word) + union { + XMLCh ch; + unsigned char ar[sizeof(XMLCh)]; + } endianTest; + endianTest.ch = 1; + fgXMLChBigEndian = (endianTest.ar[sizeof(XMLCh)-1] == 1); + + // Determine if we can use SSE2 functions +#if defined(XERCES_HAVE_CPUID_INTRINSIC) + int CPUInfo[4]={0}; + __cpuid(CPUInfo, 1); + if(CPUInfo[3] & (1UL << 26)) + fgSSE2ok = true; + else + fgSSE2ok = false; +#elif defined(XERCES_HAVE_GETCPUID) + unsigned int eax, ebx, ecx, edx; + if(!__get_cpuid (1, &eax, &ebx, &ecx, &edx) || (edx & (1UL << 26))==0) + fgSSE2ok = false; + else + fgSSE2ok = true; +#elif defined(XERCES_HAVE_SSE2_INTRINSIC) + // if we cannot find out at runtime, assume the define has it right + fgSSE2ok = true; +#else + fgSSE2ok = false; +#endif + + // Initialize the platform-specific mutex and file mgrs + fgMutexMgr = makeMutexMgr(fgMemoryManager); + fgFileMgr = makeFileMgr(fgMemoryManager); + + + // Create the local sync mutex + gSyncMutex = new XMLMutex(fgMemoryManager); + + // Create the global "atomic operations" mutex. + fgAtomicMutex = new XMLMutex(fgMemoryManager); + + // + // Ask the per-platform code to make the desired transcoding service for + // us to use. This call cannot throw any exceptions or do anything that + // cause any transcoding to happen. It should create the service and + // return it or zero if it cannot. + // + // This one also cannot use any utility services. It can only create a + // transcoding service object and return it. + // + // If we cannot make one, then we call panic to end the process. + // + XMLInitializer::initializeTransService(); // TransService static data. + + fgTransService = makeTransService(); + + if (!fgTransService) + panic(PanicHandler::Panic_NoTransService); + + // Initialize the transcoder service + fgTransService->initTransService(); + + // + // Try to create a default local code page transcoder. This is the one + // that will be used internally by the XMLString class. If we cannot + // create one, then call the panic method. + // + XMLLCPTranscoder* defXCode = XMLPlatformUtils::fgTransService->makeNewLCPTranscoder(fgMemoryManager); + if (!defXCode) + panic(PanicHandler::Panic_NoDefTranscoder); + XMLString::initString(defXCode, fgMemoryManager); + + // + // Now lets ask the per-platform code to give us an instance of the type + // of network access implementation he wants to use. This can return + // a zero pointer if this platform doesn't want to support this. + // + fgNetAccessor = makeNetAccessor(); + + /*** + * Message Loader: + * + * Locale setting + * nlsHome setting + ***/ + XMLMsgLoader::setLocale(locale); + XMLMsgLoader::setNLSHome(nlsHome); + + // Initialize static data. + // + XMLInitializer::initializeStaticData(); +} + +void XMLPlatformUtils::Initialize(XMLSize_t initialDOMHeapAllocSize + , XMLSize_t maxDOMHeapAllocSize + , XMLSize_t maxDOMSubAllocationSize + , const char* const locale + , const char* const nlsHome + , PanicHandler* const panicHandler + , MemoryManager* const memoryManager) +{ + Initialize (locale, nlsHome, panicHandler, memoryManager); + + // Don't change the parameters unless it is the first time. + // + if (gInitFlag == 1) + XMLInitializer::initializeDOMHeap(initialDOMHeapAllocSize, + maxDOMHeapAllocSize, + maxDOMSubAllocationSize); +} + +void XMLPlatformUtils::Terminate() +{ + // + // To prevent it from running underflow. + // otherwise we come to delete non-existing resources. + // + // no error or exception + // + if (gInitFlag == 0) + return; + + gInitFlag--; + + if (gInitFlag > 0) + return; + + // Terminate static data. + // + XMLInitializer::terminateStaticData(); + + // Delete any net accessor that got installed + delete fgNetAccessor; + fgNetAccessor = 0; + + // + // Call some other internal modules to give them a chance to clean up. + // Do the string class last in case something tries to use it during + // cleanup. + // + XMLString::termString(); + + // Clean up the the transcoding service + delete fgTransService; + fgTransService = 0; + + XMLInitializer::terminateTransService(); // TransService static data. + + // Clean up mutexes + delete gSyncMutex; gSyncMutex = 0; + delete fgAtomicMutex; fgAtomicMutex = 0; + + // Clean up our mgrs + delete fgFileMgr; fgFileMgr = 0; + delete fgMutexMgr; fgMutexMgr = 0; + + /*** + * de-allocate resource + * + * refer to discussion in the Initialize() + ***/ + XMLMsgLoader::setLocale(0); + XMLMsgLoader::setNLSHome(0); + + delete fgDefaultPanicHandler; + fgDefaultPanicHandler = 0; + fgUserPanicHandler = 0; + + // de-allocate default memory manager + if (fgMemMgrAdopted) + delete fgMemoryManager; + else + fgMemMgrAdopted = true; + + // set memory manager to 0 + fgMemoryManager = 0; + + // And say we are no longer initialized + gInitFlag = 0; +} + + + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: The panic method +// --------------------------------------------------------------------------- +void XMLPlatformUtils::panic(const PanicHandler::PanicReasons reason) +{ + fgUserPanicHandler? fgUserPanicHandler->panic(reason) : fgDefaultPanicHandler->panic(reason); +} + + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: Private Static Methods +// --------------------------------------------------------------------------- + +XMLNetAccessor* XMLPlatformUtils::makeNetAccessor() +{ + XMLNetAccessor* na = 0; + +#if defined (XERCES_USE_NETACCESSOR_CURL) + na = new CurlNetAccessor(); +#elif defined (XERCES_USE_NETACCESSOR_SOCKET) + na = new SocketNetAccessor(); +#elif defined (XERCES_USE_NETACCESSOR_CFURL) + na = new MacOSURLAccessCF(); +#elif defined (XERCES_USE_NETACCESSOR_WINSOCK) + na = new WinSockNetAccessor(); +#endif + + return na; +} + + +// +// This method is called by the platform independent part of this class +// when client code asks to have one of the supported message sets loaded. +// + +XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain) +{ + XMLMsgLoader* ms=0; + + try + { + #if defined (XERCES_USE_MSGLOADER_ICU) + ms = new ICUMsgLoader(msgDomain); + #elif defined (XERCES_USE_MSGLOADER_ICONV) + ms = new MsgCatalogLoader(msgDomain); + #elif defined (XERCES_USE_WIN32_MSGLOADER) + ms = new Win32MsgLoader(msgDomain); + #elif defined (XERCES_USE_MSGLOADER_INMEMORY) + ms = new InMemMsgLoader(msgDomain); + #else + #error No MsgLoader configured for platform! You must configure it. + #endif + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) + { + panic(PanicHandler::Panic_CantLoadMsgDomain); + } + + return ms; +} + + +// +// This method is called very early in the bootstrapping process. This guy +// must create a transcoding service and return it. It cannot use any string +// methods, any transcoding services, throw any exceptions, etc... It just +// makes a transcoding service and returns it, or returns zero on failure. +// + +XMLTransService* XMLPlatformUtils::makeTransService() +{ + XMLTransService* tc = 0; + + #if defined (XERCES_USE_TRANSCODER_ICU) + tc = new ICUTransService(fgMemoryManager); + #elif defined (XERCES_USE_TRANSCODER_GNUICONV) + tc = new IconvGNUTransService(fgMemoryManager); + #elif defined (XERCES_USE_TRANSCODER_ICONV) + tc = new IconvTransService(fgMemoryManager); + #elif defined (XERCES_USE_TRANSCODER_MACOSUNICODECONVERTER) + tc = new MacOSUnicodeConverter(fgMemoryManager); + #elif defined (XERCES_USE_TRANSCODER_WINDOWS) + tc = new Win32TransService(fgMemoryManager); + #else + #error No Transcoder configured for platform! You must configure it. + #endif + + return tc; +} + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: File Methods +// --------------------------------------------------------------------------- +XMLFileMgr* +XMLPlatformUtils::makeFileMgr(MemoryManager* const memmgr) +{ + XMLFileMgr* mgr = NULL; + + #if XERCES_USE_FILEMGR_POSIX + mgr = new (memmgr) PosixFileMgr; + #elif XERCES_USE_FILEMGR_WINDOWS + mgr = new (memmgr) WindowsFileMgr; + #else + #error No File Manager configured for platform! You must configure it. + #endif + + return mgr; +} + + +FileHandle +XMLPlatformUtils::openFile(const char* const fileName + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileOpen(fileName, false, memmgr); +} + + +FileHandle +XMLPlatformUtils::openFile(const XMLCh* const fileName, MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileOpen(fileName, false, memmgr); +} + + +FileHandle +XMLPlatformUtils::openFileToWrite(const char* const fileName + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileOpen(fileName, true, memmgr); +} + + +FileHandle +XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileOpen(fileName, true, memmgr); +} + + +FileHandle +XMLPlatformUtils::openStdInHandle(MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->openStdIn(memmgr); +} + + +void +XMLPlatformUtils::closeFile(FileHandle theFile + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + fgFileMgr->fileClose(theFile, memmgr); +} + +void +XMLPlatformUtils::resetFile(FileHandle theFile + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + fgFileMgr->fileReset(theFile, memmgr); +} + + +XMLFilePos +XMLPlatformUtils::curFilePos(FileHandle theFile + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->curPos(theFile, memmgr); +} + +XMLFilePos +XMLPlatformUtils::fileSize(FileHandle theFile + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileSize(theFile, memmgr); +} + + +XMLSize_t +XMLPlatformUtils::readFileBuffer( FileHandle theFile + , const XMLSize_t toRead + , XMLByte* const toFill + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->fileRead(theFile, toRead, toFill, memmgr); +} + + +void +XMLPlatformUtils::writeBufferToFile( const FileHandle theFile + , XMLSize_t toWrite + , const XMLByte* const toFlush + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + fgFileMgr->fileWrite(theFile, toWrite, toFlush, memmgr); +} + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: File system methods +// --------------------------------------------------------------------------- +XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, + MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->getFullPath(srcPath, memmgr); +} + + +XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->getCurrentDirectory(memmgr); +} + + +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const memmgr) +{ + if (!fgFileMgr) + ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, memmgr); + + return fgFileMgr->isRelative(toCheck, memmgr); +} + + +inline bool +XMLPlatformUtils::isAnySlash(XMLCh c) +{ + // As far as we know, all supported Xerces + // platforms use at least a forward slash + // as a path delimiter. So we always check for + // that. + // + // If XERCES_PATH_DELIMITER_BACKSLASH evaluates to true, + // we also consider that as a slash. + // + // XERCES_PATH_DELIMITER_BACKSLASH may be set in config.h + // by configure, or elsewhere by platform-specific + // code. + return ( + false + || chForwardSlash == c + #if XERCES_PATH_DELIMITER_BACKSLASH + || chBackSlash == c + #endif + ); +} + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: Timing Methods +// --------------------------------------------------------------------------- +unsigned long XMLPlatformUtils::getCurrentMillis() +{ + unsigned long ms = 0; + + // *** TODO: additional platform support? + #if HAVE_GETTIMEOFDAY + struct timeval aTime; + gettimeofday(&aTime, NULL); + ms = (unsigned long) (aTime.tv_sec * 1000 + aTime.tv_usec / 1000); + #elif HAVE_FTIME + timeb aTime; + ftime(&aTime); + ms = (unsigned long)(aTime.time*1000 + aTime.millitm); + #else + // Make this a warning instead? + #error No timing support is configured for this platform. You must configure it. + #endif + + return ms; +} + + +// ----------------------------------------------------------------------- +// Mutex methods +// ----------------------------------------------------------------------- +XMLMutexMgr* XMLPlatformUtils::makeMutexMgr(MemoryManager* const memmgr) +{ + XMLMutexMgr* mgr = NULL; + + #if XERCES_USE_MUTEXMGR_NOTHREAD + mgr = new (memmgr) NoThreadMutexMgr; + #elif XERCES_USE_MUTEXMGR_POSIX + mgr = new (memmgr) PosixMutexMgr; + #elif XERCES_USE_MUTEXMGR_WINDOWS + mgr = new (memmgr) WindowsMutexMgr; + #else + #error No Mutex Manager configured for platform! You must configure it. + #endif + + return mgr; +} + + +XMLMutexHandle XMLPlatformUtils::makeMutex(MemoryManager* const memmgr) +{ + if (!fgMutexMgr) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + + return fgMutexMgr->create(memmgr); +} + + +void XMLPlatformUtils::closeMutex(XMLMutexHandle const mtx, MemoryManager* const memmgr) +{ + if (!fgMutexMgr) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + + fgMutexMgr->destroy(mtx, memmgr); +} + + +void XMLPlatformUtils::lockMutex(XMLMutexHandle const mtx) +{ + if (!fgMutexMgr) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + + fgMutexMgr->lock(mtx); +} + + +void XMLPlatformUtils::unlockMutex(XMLMutexHandle const mtx) +{ + if (!fgMutexMgr) + XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr); + + fgMutexMgr->unlock(mtx); +} + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: Msg support methods +// --------------------------------------------------------------------------- +XMLMsgLoader* XMLPlatformUtils::loadMsgSet(const XMLCh* const msgDomain) +{ + // + // Ask the platform support to load up the correct type of message + // loader for the indicated message set. We don't check here whether it + // works or not. That's their decision. + // + return loadAMsgSet(msgDomain); +} + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: NEL Character Handling +// --------------------------------------------------------------------------- +void XMLPlatformUtils::recognizeNEL(bool state, MemoryManager* const manager) { + + //Make sure initialize has been called + if (gInitFlag == 0) { + return; + } + + if (state) { + + if (!XMLChar1_0::isNELRecognized()) { + XMLChar1_0::enableNELWS(); + } + } + else { + + if (XMLChar1_0::isNELRecognized()) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::NEL_RepeatedCalls, manager); + } + } +} + + +bool XMLPlatformUtils::isNELRecognized() { + + return XMLChar1_0::isNELRecognized(); +} + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: IANA Encoding checking setting +// --------------------------------------------------------------------------- +void XMLPlatformUtils::strictIANAEncoding(const bool state) { + + //Make sure initialize has been called + if (gInitFlag == 0) { + return; + } + + fgTransService->strictIANAEncoding(state); +} + + +bool XMLPlatformUtils::isStrictIANAEncoding() { + + if (gInitFlag) + return fgTransService->isStrictIANAEncoding(); + + return false; +} + +/*** + * + * Previously, each PlatformUtils.cpp has its onw copy of the + * method weavePaths(), and almost of them implemented the same logic, + * with few platform specific difference, and unfortunately that + * implementation was wrong. + * + * The only platform specific issue is slash character. + * On all platforms other than Windows, chForwardSlash and chBackSlash + * are considered slash, while on Windows, two additional characters, + * chYenSign and chWonSign are slash as well. + * + * The idea is to maintain a SINGLE copy of this method rather than + * each PlatformUtils.cpp has its own copy, we introduce a new + * method, XMLPlatformUtils::isAnySlash(), to replace the direct checking + * code ( if ( c == chForwardSlash || c == chBackSlash). + * + * With this approach, we might have a performance hit since isAnySlash() + * is so frequently used in this implementation, so we intend to make it + * inline. Then we face a complier issue. + * + * There are two compilation units involved, one is PlatformUtils.cpp and + * the other PlatformUtils.cpp. When PlatformUtils.cp get compiled, + * the weavePath(), remove**Slash() have dependency upon isAnySlash() which + * is in PlatformUtils.cpp (and what is worse, it is inlined), so we have + * undefined/unresolved symbol: isAnySlash() on AIX/xlc_r, Solaris/cc and + * Linux/gcc, while MSVC and HP/aCC are fine with this. + * + * That means we can not place these new methods in PlatformUtils.cpp with + * inlined XMLPlatformUtils::isAnySlash() in PlatformUtils.cpp. + * + * The solution to this is PlatformUtils.cpp will include this file so that + * we have only one copy of these methods while get compiled in PlatformUtils + * inlined isAnySlash(). + * + ***/ +XMLCh* XMLPlatformUtils::weavePaths(const XMLCh* const basePath + , const XMLCh* const relativePath + , MemoryManager* const manager) + +{ + // Create a buffer as large as both parts and empty it + XMLCh* tmpBuf = (XMLCh*) manager->allocate + ( + (XMLString::stringLen(basePath) + + XMLString::stringLen(relativePath) + 2) * sizeof(XMLCh) + );//new XMLCh[XMLString::stringLen(basePath) + XMLString::stringLen(relativePath) + 2]; + *tmpBuf = 0; + + // + // If we have no base path, then just take the relative path as is. + // + if ((!basePath) || (!*basePath)) + { + XMLString::copyString(tmpBuf, relativePath); + return tmpBuf; + } + + // + // Remove anything after the last slash + // + const XMLCh* basePtr = basePath + (XMLString::stringLen(basePath) - 1); + while ((basePtr >= basePath) && ((isAnySlash(*basePtr) == false))) + { + basePtr--; + } + + // There is no relevant base path, so just take the relative part + if (basePtr < basePath) + { + XMLString::copyString(tmpBuf, relativePath); + return tmpBuf; + } + + // + // 1. concatenate the base and relative + // 2. remove all occurences of "/./" + // 3. remove all occurences of segment/../ where segment is not ../ + // + + XMLString::subString(tmpBuf, basePath, 0, (basePtr - basePath + 1), manager); + tmpBuf[basePtr - basePath + 1] = 0; + XMLString::catString(tmpBuf, relativePath); + + removeDotSlash(tmpBuf, manager); + + removeDotDotSlash(tmpBuf, manager); + + return tmpBuf; + +} + +// +// Remove all occurences of './' when it is part of '/./' +// +// Since it could be '.\' or other combination on windows ( eg, '.'+chYanSign) +// we can't make use of patterMatch(). +// +// +void XMLPlatformUtils::removeDotSlash(XMLCh* const path + , MemoryManager* const manager) +{ + if ((!path) || (!*path)) + return; + + XMLCh* srcPtr = XMLString::replicate(path, manager); + XMLSize_t srcLen = XMLString::stringLen(srcPtr); + ArrayJanitor janName(srcPtr, manager); + XMLCh* tarPtr = path; + + while (*srcPtr) + { + if ( 3 <= srcLen ) + { + if ( (isAnySlash(*srcPtr)) && + (chPeriod == *(srcPtr+1)) && + (isAnySlash(*(srcPtr+2))) ) + { + // "\.\x" seen + // skip the first two, and start from the 3rd, + // since "\x" could be another "\." + srcPtr+=2; + srcLen-=2; + } + else + { + *tarPtr++ = *srcPtr++; // eat the current char + srcLen--; + } + } + else if ( 1 == srcLen ) + { + *tarPtr++ = *srcPtr++; + } + else if ( 2 == srcLen) + { + *tarPtr++ = *srcPtr++; + *tarPtr++ = *srcPtr++; + } + + } + + *tarPtr = 0; + + return; +} + +// +// Remove all occurences of '/segment/../' when segment is not '..' +// +// Cases with extra /../ is left to the underlying file system. +// +void XMLPlatformUtils::removeDotDotSlash(XMLCh* const path + , MemoryManager* const manager) +{ + XMLSize_t pathLen = XMLString::stringLen(path); + XMLCh* tmp1 = (XMLCh*) manager->allocate + ( + (pathLen+1) * sizeof(XMLCh) + );//new XMLCh [pathLen+1]; + ArrayJanitor tmp1Name(tmp1, manager); + + XMLCh* tmp2 = (XMLCh*) manager->allocate + ( + (pathLen+1) * sizeof(XMLCh) + );//new XMLCh [pathLen+1]; + ArrayJanitor tmp2Name(tmp2, manager); + + // remove all "/../" where "" is a complete + // path segment not equal to ".." + int index = -1; + int segIndex = -1; + int offset = 1; + + while ((index = searchSlashDotDotSlash(&(path[offset]))) != -1) + { + // Undo offset + index += offset; + + // Find start of within substring ending at found point. + XMLString::subString(tmp1, path, 0, index-1, manager); + segIndex = index - 1; + while ((segIndex >= 0) && (!isAnySlash(tmp1[segIndex]))) + { + segIndex--; + } + + // Ensure exists and != ".." + if (segIndex >= 0 && + (path[segIndex+1] != chPeriod || + path[segIndex+2] != chPeriod || + segIndex + 3 != index)) + { + + XMLString::subString(tmp1, path, 0, segIndex, manager); + XMLString::subString(tmp2, path, index+3, XMLString::stringLen(path), manager); + + path[0] = 0; + XMLString::catString(path, tmp1); + XMLString::catString(path, tmp2); + + offset = (segIndex == 0 ? 1 : segIndex); + } + else + { + offset += 4; + } + + }// while + +} + +int XMLPlatformUtils::searchSlashDotDotSlash(XMLCh* const srcPath) +{ + if ((!srcPath) || (!*srcPath)) + return -1; + + XMLCh* srcPtr = srcPath; + XMLSize_t srcLen = XMLString::stringLen(srcPath); + int retVal = -1; + + while (*srcPtr) + { + if ( 4 <= srcLen ) + { + if ( (isAnySlash(*srcPtr)) && + (chPeriod == *(srcPtr+1)) && + (chPeriod == *(srcPtr+2)) && + (isAnySlash(*(srcPtr+3))) ) + { + retVal = (int)(srcPtr - srcPath); + break; + } + else + { + srcPtr++; + srcLen--; + } + } + else + { + break; + } + + } // while + + return retVal; + +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/PlatformUtils.hpp b/project/jni/xerces/src/xercesc/util/PlatformUtils.hpp new file mode 100644 index 000000000..f4856a590 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/PlatformUtils.hpp @@ -0,0 +1,839 @@ +/* + * 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: PlatformUtils.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP) +#define XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP + +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLMsgLoader; +class XMLNetAccessor; +class XMLTransService; +class MemoryManager; +class XMLMutex; + +// +// For internal use only +// +// This class provides a simple abstract API via which lazily evaluated +// data can be cleaned up. +// +class XMLUTIL_EXPORT XMLDeleter +{ +public : + virtual ~XMLDeleter(); + +protected : + XMLDeleter(); + +private : + XMLDeleter(const XMLDeleter&); + XMLDeleter& operator=(const XMLDeleter&); +}; + + +/** + * Utilities that must be implemented in a platform-specific way. + * + * This class contains methods that must be implemented in a platform + * specific manner. The actual implementations of these methods are + * available in the per-platform files inside src/util/Platforms + * . + */ +class XMLUTIL_EXPORT XMLPlatformUtils +{ +public : + + /** @name Public Static Data */ + //@{ + + /** The network accessor + * + * This is provided by the per-platform driver, so each platform can + * choose what actual implementation it wants to use. The object must + * be dynamically allocated. + * + * Note that you may optionally, if your platform driver does not + * install a network accessor, set it manually from your client code + * after calling Initialize(). This works because this object is + * not required during initialization, and only comes into play during + * actual XML parsing. + */ + static XMLNetAccessor* fgNetAccessor; + + /** The transcoding service. + * + * This is provided by the per platform driver, so each platform can + * choose what implementation it wants to use. When the platform + * independent initialization code needs to get a transcoding service + * object, it will call makeTransService() to ask the + * per-platform code to create one. Only one transcoding service + * object is requested per-process, so it is shared and synchronized + * among parser instances within that process. + */ + static XMLTransService* fgTransService; +#ifdef OS390 + static XMLTransService* fgTransService2; +#endif + + /** The Panic Handler + * + * This is the application provided panic handler. + */ + static PanicHandler* fgUserPanicHandler; + + /** The Panic Handler + * + * This is the default panic handler. + */ + static PanicHandler* fgDefaultPanicHandler; + + /** The configurable memory manager + * + * This is the pluggable memory manager. If it is not provided by an + * application, a default implementation is used. + */ + static MemoryManager* fgMemoryManager; + + static XMLFileMgr* fgFileMgr; + static XMLMutexMgr* fgMutexMgr; + + /** Global mutex for fast or infrequent operations. + * + * Use this mutex only for fast (e.g., increment an integer, + * check flag, etc.) or infrequent (e.g., once-off initialization) + * operations. + */ + static XMLMutex* fgAtomicMutex; + + static bool fgXMLChBigEndian; + static bool fgSSE2ok; + //@} + + + /** @name Initialization and Panic methods */ + //@{ + + /** Perform per-process parser initialization + * + * Initialization must be called first in any client code. + * + * @param locale The locale to use for messages. + * + * The locale is set iff the Initialize() is invoked for the very first time, + * to ensure that each and every message loader, in the process space, share + * the same locale. + * + * All subsequent invocations of Initialize(), with a different locale, have + * no effect on the message loaders, either instantiated, or to be instantiated. + * + * To set to a different locale, client application needs to Terminate() (or + * multiple Terminate() in the case where multiple Initialize() have been invoked + * before), followed by Initialize(new_locale). + * + * The default locale is "en_US". + * + * @param nlsHome User specified location where MsgLoader retrieves error message files. + * the discussion above with regard to locale, applies to nlsHome as well. + * + * @param panicHandler Application's panic handler, application owns this handler. + * Application shall make sure that the plugged panic handler persists + * through the call to XMLPlatformUtils::Terminate(). + * + * @param memoryManager Plugged-in memory manager which is owned by the + * application. Applications must make sure that the + * plugged-in memory manager persist through the call to + * XMLPlatformUtils::Terminate() + */ + static void Initialize(const char* const locale = XMLUni::fgXercescDefaultLocale + , const char* const nlsHome = 0 + , PanicHandler* const panicHandler = 0 + , MemoryManager* const memoryManager = 0); + + /** Perform per-process parser initialization + * + * Initialization must be called first in any client code. + * + * @param initialDOMHeapAllocSize The size of the first memory block + * allocated by the DOMDocument heap. Note that changing this parameter + * may result in poor performance and/or excessive memory usage. For + * the default value refer to dom/impl/DOMDocumentImpl.cpp. + * + * @param maxDOMHeapAllocSize The maximum size of the memory block + * allocated by the DOMDocument heap. As the document grows, the + * allocated by the heap memory blocks grow from initialDOMHeapAllocSize + * to maxDOMHeapAllocSize. Note that changing this parameter may result + * in poor performance and/or excessive memory usage. For the default + * value refer to dom/impl/DOMDocumentImpl.cpp. + * + * @param maxDOMSubAllocationSize The maximum size of the memory block + * requested that is handled by the DOMDocument heap. A request for a + * larger block is handled directly by the memory manager. Note that + * changing this parameter may result in poor performance and/or + * excessive memory usage. For the default value refer to + * dom/impl/DOMDocumentImpl.cpp. + * + * @param locale The locale to use for messages. + * + * The locale is set iff the Initialize() is invoked for the very first time, + * to ensure that each and every message loader, in the process space, share + * the same locale. + * + * All subsequent invocations of Initialize(), with a different locale, have + * no effect on the message loaders, either instantiated, or to be instantiated. + * + * To set to a different locale, client application needs to Terminate() (or + * multiple Terminate() in the case where multiple Initialize() have been invoked + * before), followed by Initialize(new_locale). + * + * The default locale is "en_US". + * + * @param nlsHome User specified location where MsgLoader retrieves error message files. + * the discussion above with regard to locale, applies to nlsHome as well. + * + * @param panicHandler Application's panic handler, application owns this handler. + * Application shall make sure that the plugged panic handler persists + * through the call to XMLPlatformUtils::Terminate(). + * + * @param memoryManager Plugged-in memory manager which is owned by the + * application. Applications must make sure that the plugged-in memory + * manager persist through the call to XMLPlatformUtils::Terminate() + */ + static void Initialize(XMLSize_t initialDOMHeapAllocSize + , XMLSize_t maxDOMHeapAllocSize + , XMLSize_t maxDOMSubAllocationSize + , const char* const locale = XMLUni::fgXercescDefaultLocale + , const char* const nlsHome = 0 + , PanicHandler* const panicHandler = 0 + , MemoryManager* const memoryManager = 0); + + /** Perform per-process parser termination + * + * The termination call is currently optional, to aid those dynamically + * loading the parser to clean up before exit, or to avoid spurious + * reports from leak detectors. + */ + static void Terminate(); + + /** The panic mechanism. + * + * If, during initialization, we cannot even get far enough along + * to get transcoding up or get message loading working, we call + * this method.

+ * + * Each platform can implement it however they want. This method will + * delegate the panic handling to a user specified panic handler or + * in the absence of it, the default panic handler. + * + * In case the default panic handler does not support a particular + * platform, the platform specific panic handling shall be implemented + * here

. + * + * @param reason The enumeration that defines the cause of the failure + */ + static void panic + ( + const PanicHandler::PanicReasons reason + ); + + //@} + + /** @name File Methods */ + //@{ + + /** Make a new file object appropriate for the platform. + * + * @param manager The MemoryManager to use to allocate objects + */ + static XMLFileMgr* makeFileMgr(MemoryManager* const manager); + + /** Get the current file position + * + * This must be implemented by the per-platform driver, which should + * use local file services to determine the current position within + * the passed file. + * + * Since the file API provided here only reads, if the host platform + * supports separate read/write positions, only the read position is + * of any interest, and hence should be the one returned. + * + * @param theFile The file handle + * @param manager The MemoryManager to use to allocate objects + */ + static XMLFilePos curFilePos(FileHandle theFile + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Closes the file handle + * + * This must be implemented by the per-platform driver, which should + * use local file services to close the passed file handle, and to + * destroy the passed file handle and any allocated data or system + * resources it contains. + * + * @param theFile The file handle to close + * @param manager The MemoryManager to use to allocate objects + */ + static void closeFile(FileHandle theFile + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Returns the file size + * + * This must be implemented by the per-platform driver, which should + * use local file services to determine the current size of the file + * represented by the passed handle. + * + * @param theFile The file handle whose size you want + * @param manager The MemoryManager to use to allocate objects + * @return Returns the size of the file in bytes + */ + static XMLFilePos fileSize(FileHandle theFile + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Opens the file + * + * This must be implemented by the per-platform driver, which should + * use local file services to open passed file. If it fails, a + * null handle pointer should be returned. + * + * @param fileName The string containing the name of the file + * @param manager The MemoryManager to use to allocate objects + * @return The file handle of the opened file + */ + static FileHandle openFile(const char* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Opens a named file + * + * This must be implemented by the per-platform driver, which should + * use local file services to open the passed file. If it fails, a + * null handle pointer should be returned. + * + * @param fileName The string containing the name of the file + * @param manager The MemoryManager to use to allocate objects + * @return The file handle of the opened file + */ + static FileHandle openFile(const XMLCh* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Open a named file to write + * + * This must be implemented by the per-platform driver, which should + * use local file services to open passed file. If it fails, a + * null handle pointer should be returned. + * + * @param fileName The string containing the name of the file + * @param manager The MemoryManager to use to allocate objects + * @return The file handle of the opened file + */ + static FileHandle openFileToWrite(const char* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Open a named file to write + * + * This must be implemented by the per-platform driver, which should + * use local file services to open the passed file. If it fails, a + * null handle pointer should be returned. + * + * @param fileName The string containing the name of the file + * @param manager The MemoryManager to use to allocate objects + * @return The file handle of the opened file + */ + static FileHandle openFileToWrite(const XMLCh* const fileName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Opens the standard input as a file + * + * This must be implemented by the per-platform driver, which should + * use local file services to open a handle to the standard input. + * It should be a copy of the standard input handle, since it will + * be closed later! + * + * @param manager The MemoryManager to use to allocate objects + * @return The file handle of the standard input stream + */ + static FileHandle openStdInHandle(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Reads the file buffer + * + * This must be implemented by the per-platform driver, which should + * use local file services to read up to 'toRead' bytes of data from + * the passed file, and return those bytes in the 'toFill' buffer. It + * is not an error not to read the requested number of bytes. When the + * end of file is reached, zero should be returned. + * + * @param theFile The file handle to be read from. + * @param toRead The maximum number of byte to read from the current + * position + * @param toFill The byte buffer to fill + * @param manager The MemoryManager to use to allocate objects + * + * @return Returns the number of bytes read from the stream or file + */ + static XMLSize_t readFileBuffer + ( + FileHandle theFile + , const XMLSize_t toRead + , XMLByte* const toFill + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Writes the buffer to the file + * + * This must be implemented by the per-platform driver, which should + * use local file services to write up to 'toWrite' bytes of data to + * the passed file. Unless exception raised by local file services, + * 'toWrite' bytes of data is to be written to the passed file. + * + * @param theFile The file handle to be written to. + * @param toWrite The maximum number of byte to write from the current + * position + * @param toFlush The byte buffer to flush + * @param manager The MemoryManager to use to allocate objects + * @return void + */ + static void writeBufferToFile + ( + FileHandle const theFile + , XMLSize_t toWrite + , const XMLByte* const toFlush + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Resets the file handle + * + * This must be implemented by the per-platform driver which will use + * local file services to reset the file position to the start of the + * the file. + * + * @param theFile The file handle that you want to reset + * @param manager The MemoryManager to use to allocate objects + */ + static void resetFile(FileHandle theFile + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + + /** @name File System Methods */ + //@{ + /** Gets the full path from a relative path + * + * This must be implemented by the per-platform driver. It should + * complete a relative path using the 'current directory', or whatever + * the local equivalent of a current directory is. If the passed + * source path is actually fully qualified, then a straight copy of it + * will be returned. + * + * @param srcPath The path of the file for which you want the full path + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + * @return Returns the fully qualified path of the file name including + * the file name. This is dyanmically allocated and must be + * deleted by the caller when its no longer needed! The memory + * returned will beallocated using the static memory manager, if + * user do not supply a memory manager. Users then need to make + * sure to use either the default or user specific memory manager + * to deallocate the memory. + */ + static XMLCh* getFullPath + ( + const XMLCh* const srcPath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Gets the current working directory + * + * This must be implemented by the per-platform driver. It returns + * the current working directory is. + * @param manager The MemoryManager to use to allocate objects + * @return Returns the current working directory. + * This is dyanmically allocated and must be deleted + * by the caller when its no longer needed! The memory returned + * will be allocated using the static memory manager, if users + * do not supply a memory manager. Users then need to make sure + * to use either the default or user specific memory manager to + * deallocate the memory. + */ + static XMLCh* getCurrentDirectory + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Check if a character is a slash + * + * This must be implemented by the per-platform driver. + * + * @param c the character to be examined + * + * @return true if the character examined is a slash + * false otherwise + */ + static inline bool isAnySlash(XMLCh c); + + /** Remove occurrences of the pair of dot slash + * + * To remove the sequence, dot slash if it is part of the sequence, + * slash dot slash. + * + * @param srcPath The path for which you want to remove the dot slash sequence. + * @param manager The MemoryManager to use to allocate objects + * @return + */ + static void removeDotSlash(XMLCh* const srcPath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Remove occurrences of the dot dot slash + * + * To remove the sequence, slash dot dot slash and its preceding path segment + * if and only if the preceding path segment is not slash dot dot slash. + * + * @param srcPath The path for which you want to remove the slash dot + * dot slash sequence and its preceding path segment. + * @param manager The MemoryManager to use to allocate objects + * @return + */ + static void removeDotDotSlash(XMLCh* const srcPath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Determines if a path is relative or absolute + * + * This must be implemented by the per-platform driver, which should + * determine whether the passed path is relative or not. The concept + * of relative and absolute might be... well relative on different + * platforms. But, as long as the determination is made consistently + * and in coordination with the weavePaths() method, it should work + * for any platform. + * + * @param toCheck The file name which you want to check + * @param manager The MemoryManager to use to allocate objects + * @return Returns true if the filename appears to be relative + */ + static bool isRelative(const XMLCh* const toCheck + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Utility to join two paths + * + * This must be implemented by the per-platform driver, and should + * weave the relative path part together with the base part and return + * a new path that represents this combination. + * + * If the relative part turns out to be fully qualified, it will be + * returned as is. If it is not, then it will be woven onto the + * passed base path, by removing one path component for each leading + * "../" (or whatever is the equivalent in the local system) in the + * relative path. + * + * @param basePath The string containing the base path + * @param relativePath The string containing the relative path + * @param manager The MemoryManager to use to allocate objects + * @return Returns a string containing the 'woven' path. It should + * be dynamically allocated and becomes the responsibility of the + * caller to delete. + */ + static XMLCh* weavePaths + ( + const XMLCh* const basePath + , const XMLCh* const relativePath + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Timing Methods */ + //@{ + + /** Gets the system time in milliseconds + * + * This must be implemented by the per-platform driver, which should + * use local services to return the current value of a running + * millisecond timer. Note that the value returned is only as accurate + * as the millisecond time of the underlying host system. + * + * @return Returns the system time as an unsigned long + */ + static unsigned long getCurrentMillis(); + //@} + + /** @name Mutex Methods */ + //@{ + + /** Factory method for creating MutexMgr object. + * + * This factory method creates a mutexmgr that will be used + * on the particular platform. + * + * @param manager The MemoryManager to use to allocate objects + */ + static XMLMutexMgr* makeMutexMgr(MemoryManager* const manager); + + /** Closes a mutex handle + * + * Each per-platform driver must implement this. Only it knows what + * the actual content of the passed mutex handle is. + * + * @param mtxHandle The mutex handle that you want to close + * @param manager The MemoryManager used to allocate the object + */ + static void closeMutex(void* const mtxHandle, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Locks a mutex handle + * + * Each per-platform driver must implement this. Only it knows what + * the actual content of the passed mutex handle is. + * + * @param mtxHandle The mutex handle that you want to lock + */ + static void lockMutex(void* const mtxHandle); + + /** Make a new mutex + * + * Each per-platform driver must implement this. Only it knows what + * the actual content of the passed mutex handle is. The returned + * handle pointer will be eventually passed to closeMutex() which is + * also implemented by the platform driver. + * + * @param manager The MemoryManager to use to allocate objects + */ + static void* makeMutex(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Unlocks a mutex + * + * Each per-platform driver must implement this. Only it knows what + * the actual content of the passed mutex handle is. + * + * Note that, since the underlying system synchronization services + * are used, Xerces cannot guarantee that lock/unlock operations are + * correctly enforced on a per-thread basis or that incorrect nesting + * of lock/unlock operations will be caught. + * + * @param mtxHandle The mutex handle that you want to unlock + */ + static void unlockMutex(void* const mtxHandle); + + //@} + + + /** @name External Message Support */ + //@{ + + /** Loads the message set from among the available domains + * + * The returned object must be dynamically allocated and the caller + * becomes responsible for cleaning it up. + * + * @param msgDomain The message domain which you want to load + */ + static XMLMsgLoader* loadMsgSet(const XMLCh* const msgDomain); + + //@} + + + /** @name NEL Character Handling */ + //@{ + /** + * This function enables the recognition of NEL(0x85) char and LSEP (0x2028) as newline chars + * which is disabled by default. + * It is only called once per process. Once it is set, any subsequent calls + * will result in exception being thrown. + * + * Note: 1. Turning this option on will make the parser non compliant to XML 1.0. + * 2. This option has no effect to document conforming to XML 1.1 compliant, + * which always recognize these two chars (0x85 and 0x2028) as newline characters. + * + */ + static void recognizeNEL(bool state + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Return the value of fgNEL flag. + */ + static bool isNELRecognized(); + //@} + + /** @name Strict IANA Encoding Checking */ + //@{ + /** + * This function enables/disables strict IANA encoding names checking. + * + * The strict checking is disabled by default. + * + * @param state If true, a strict IANA encoding name check is performed, + * otherwise, no checking. + * + */ + static void strictIANAEncoding(const bool state); + + /** + * Returns whether a strict IANA encoding name check is enabled or + * disabled. + */ + static bool isStrictIANAEncoding(); + //@} + + /** + * Aligns the specified pointer per platform block allocation + * requirements. + * + * The results of this function may be altered by defining + * XML_PLATFORM_NEW_BLOCK_ALIGNMENT. + */ + static inline XMLSize_t alignPointerForNewBlockAllocation(XMLSize_t ptrSize); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLPlatformUtils(); + + /** @name Private static methods */ + //@{ + + /** Loads a message set from the available domains + * + * @param msgDomain The message domain containing the message to be + * loaded + */ + static XMLMsgLoader* loadAMsgSet(const XMLCh* const msgDomain); + + /** Creates a net accessor object. + * + * Each per-platform driver must implement this method. However, + * having a Net Accessor is optional and this method can return a + * null pointer if remote access via HTTP and FTP URLs is not required. + * + * @return An object derived from XMLNetAccessor. It must be dynamically + * allocated, since it will be deleted later. + */ + static XMLNetAccessor* makeNetAccessor(); + + /** Creates a Transcoding service + * + * Each per-platform driver must implement this method and return some + * derivative of the XMLTransService class. This object serves as the + * transcoder factory for this process. The object must be dynamically + * allocated and the caller is responsible for cleaning it up. + * + * @return A dynamically allocated object of some class derived from + * the XMLTransService class. + */ + static XMLTransService* makeTransService(); + + /** Search for sequence, slash dot dot slash + * + * @param srcPath the path to search + * + * @return the position of the first occurrence of slash dot dot slash + * -1 if no such sequence is found + */ + static int searchSlashDotDotSlash(XMLCh* const srcPath); + + //@} + + /** @name Private static methods */ + //@{ + + /** + * Indicates whether the memory manager was supplied by the user + * or not. Users own the memory manager, and if none is supplied, + * Xerces uses a default one that it owns and is responsible for + * deleting in Terminate(). + */ + static bool fgMemMgrAdopted; + + //@} +}; + + +MakeXMLException(XMLPlatformUtilsException, XMLUTIL_EXPORT) + + +// --------------------------------------------------------------------------- +// XMLPlatformUtils: alignPointerForNewBlockAllocation +// --------------------------------------------------------------------------- +// Calculate alignment required by platform for a new +// block allocation. We use this in our custom allocators +// to ensure that returned blocks are properly aligned. +// Note that, although this will take a pointer and return the position +// at which it should be placed for correct alignment, in our code +// we normally use XMLSize_t parameters to discover what the alignment +// of header blocks should be. Thus, if this is to be +// used for the former purpose, to make compilers happy +// some casting will be necessary - neilg. +// +// Note: XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be specified on a +// per-architecture basis to dictate the alignment requirements +// of the architecture. In the absense of this specification, +// this routine guesses at the correct alignment value. +// +// A XML_PLATFORM_NEW_BLOCK_ALIGNMENT value of zero is illegal. +// If a platform requires absolutely no alignment, a value +// of 1 should be specified ("align pointers on 1 byte boundaries"). +// +inline XMLSize_t +XMLPlatformUtils::alignPointerForNewBlockAllocation(XMLSize_t ptrSize) +{ + // Macro XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be defined + // as needed to dictate alignment requirements on a + // per-architecture basis. In the absense of that we + // take an educated guess. +#ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT + static const XMLSize_t alignment = XML_PLATFORM_NEW_BLOCK_ALIGNMENT; +#else + static const XMLSize_t alignment = (sizeof(void*) >= sizeof(double)) ? sizeof(void*) : sizeof(double); +#endif + + // Calculate current alignment of pointer + XMLSize_t current = ptrSize % alignment; + + // Adjust pointer alignment as needed + return (current == 0) + ? ptrSize + : (ptrSize + alignment - current); +} + + + +// --------------------------------------------------------------------------- +// XMLDeleter: Public Destructor +// --------------------------------------------------------------------------- +inline XMLDeleter::~XMLDeleter() +{ +} + +// --------------------------------------------------------------------------- +// XMLDeleter: Hidden constructors and operators +// --------------------------------------------------------------------------- +inline XMLDeleter::XMLDeleter() +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/QName.cpp b/project/jni/xerces/src/xercesc/util/QName.cpp new file mode 100644 index 000000000..8b0354d34 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/QName.cpp @@ -0,0 +1,426 @@ +/* + * 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: QName.cpp 810580 2009-09-02 15:52:22Z amassari $ + */ + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// QName: Constructors and Destructor +// --------------------------------------------------------------------------- +QName::QName(MemoryManager* const manager) +:fPrefixBufSz(0) +,fLocalPartBufSz(0) +,fRawNameBufSz(0) +,fURIId(0) +,fPrefix(0) +,fLocalPart(0) +,fRawName(0) +,fMemoryManager(manager) +{ +} + +typedef JanitorMemFunCall CleanupType; + +QName::QName( const XMLCh* const prefix + , const XMLCh* const localPart + , const unsigned int uriId + , MemoryManager* const manager) +:fPrefixBufSz(0) +,fLocalPartBufSz(0) +,fRawNameBufSz(0) +,fURIId(0) +,fPrefix(0) +,fLocalPart(0) +,fRawName(0) +,fMemoryManager(manager) +{ + CleanupType cleanup(this, &QName::cleanUp); + + try + { + // + // Just call the local setters to set up everything. Too much + // work is required to replicate that functionality here. + // + setName(prefix, localPart, uriId); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +QName::QName( const XMLCh* const rawName + , const unsigned int uriId + , MemoryManager* const manager) +:fPrefixBufSz(0) +,fLocalPartBufSz(0) +,fRawNameBufSz(0) +,fURIId(0) +,fPrefix(0) +,fLocalPart(0) +,fRawName(0) +,fMemoryManager(manager) +{ + CleanupType cleanup(this, &QName::cleanUp); + + try + { + // + // Just call the local setters to set up everything. Too much + // work is required to replicate that functionality here. + // + setName(rawName, uriId); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +QName::~QName() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// QName: Copy Constructors +// --------------------------------------------------------------------------- +QName::QName(const QName& qname) +:XSerializable(qname) +,XMemory(qname) +,fPrefixBufSz(0) +,fLocalPartBufSz(0) +,fRawNameBufSz(0) +,fURIId(0) +,fPrefix(0) +,fLocalPart(0) +,fRawName(0) +,fMemoryManager(qname.fMemoryManager) +{ + XMLSize_t newLen; + + newLen = XMLString::stringLen(qname.getLocalPart()); + fLocalPartBufSz = newLen + 8; + fLocalPart = (XMLCh*) fMemoryManager->allocate + ( + (fLocalPartBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fLocalPartBufSz + 1]; + XMLString::moveChars(fLocalPart, qname.getLocalPart(), newLen + 1); + + newLen = XMLString::stringLen(qname.getPrefix()); + fPrefixBufSz = newLen + 8; + fPrefix = (XMLCh*) fMemoryManager->allocate + ( + (fPrefixBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fPrefixBufSz + 1]; + XMLString::moveChars(fPrefix, qname.getPrefix(), newLen + 1); + + fURIId = qname.getURI(); +} + +// --------------------------------------------------------------------------- +// QName: Getter methods +// --------------------------------------------------------------------------- +const XMLCh* QName::getRawName() const +{ + // + // If there is no buffer, or if there is but we've not faulted in the + // value yet, then we have to do that now. + // + if (!fRawName || !*fRawName) + { + // + // If we have a prefix, then do the prefix:name version. Else, its + // just the name. + // + if (*fPrefix) + { + // + // Calculate the worst case size buffer we will need. We use the + // current high water marks of the prefix and name buffers, so it + // might be a little wasteful of memory but we don't have to do + // string len operations on the two strings. + // + const XMLSize_t neededLen = fPrefixBufSz + fLocalPartBufSz + 1; + + // + // If no buffer, or the current one is too small, then allocate one + // and get rid of any old one. + // + if (!fRawName || (neededLen > fRawNameBufSz)) + { + fMemoryManager->deallocate(fRawName); //delete [] fRawName; + + ((QName*)this)->fRawName = 0; + // We have to cast off the const'ness to do this + ((QName*)this)->fRawNameBufSz = neededLen; + ((QName*)this)->fRawName = (XMLCh*) fMemoryManager->allocate + ( + (neededLen + 1) * sizeof(XMLCh) + ); //new XMLCh[neededLen + 1]; + + // Make sure its initially empty + *fRawName = 0; + } + + const XMLSize_t prefixLen = XMLString::stringLen(fPrefix); + + XMLString::moveChars(fRawName, fPrefix, prefixLen); + fRawName[prefixLen] = chColon; + XMLString::copyString(&fRawName[prefixLen+1], fLocalPart); + } + else + { + return fLocalPart; + } + } + return fRawName; +} + +XMLCh* QName::getRawName() +{ + // + // If there is no buffer, or if there is but we've not faulted in the + // value yet, then we have to do that now. + // + if (!fRawName || !*fRawName) + { + // + // If we have a prefix, then do the prefix:name version. Else, its + // just the name. + // + if (*fPrefix) + { + // + // Calculate the worst case size buffer we will need. We use the + // current high water marks of the prefix and name buffers, so it + // might be a little wasteful of memory but we don't have to do + // string len operations on the two strings. + // + const XMLSize_t neededLen = fPrefixBufSz + fLocalPartBufSz + 1; + + // + // If no buffer, or the current one is too small, then allocate one + // and get rid of any old one. + // + if (!fRawName || (neededLen > fRawNameBufSz)) + { + fMemoryManager->deallocate(fRawName); //delete [] fRawName; + + fRawName = 0; + // We have to cast off the const'ness to do this + ((QName*)this)->fRawNameBufSz = neededLen; + ((QName*)this)->fRawName = (XMLCh*) fMemoryManager->allocate + ( + (neededLen + 1) * sizeof(XMLCh) + ); //new XMLCh[neededLen + 1]; + + // Make sure its initially empty + *fRawName = 0; + } + + + const XMLSize_t prefixLen = XMLString::stringLen(fPrefix); + + XMLString::moveChars(fRawName, fPrefix, prefixLen); + fRawName[prefixLen] = chColon; + XMLString::copyString(&fRawName[prefixLen+1], fLocalPart); + } + else + { + return fLocalPart; + } + } + return fRawName; +} + +// --------------------------------------------------------------------------- +// QName: Setter methods +// --------------------------------------------------------------------------- +void QName::setName(const XMLCh* const prefix + , const XMLCh* const localPart + , const unsigned int uriId) +{ + setPrefix(prefix); + setLocalPart(localPart); + + // And clean up any QName and leave it undone until/if asked for again + if (fRawName) + *fRawName = 0; + + // And finally store the URI id parameter + fURIId = uriId; +} + +void QName::setName(const XMLCh* const rawName + , const unsigned int uriId) +{ + //set the rawName + XMLSize_t newLen = XMLString::stringLen(rawName); + //find out the prefix and localPart from the rawName + const int colonInd = XMLString::indexOf(rawName, chColon); + + if (colonInd >= 0) + { + if (!fRawNameBufSz || (newLen > fRawNameBufSz)) + { + fMemoryManager->deallocate(fRawName); //delete [] fRawName; + fRawName = 0; + fRawNameBufSz = newLen + 8; + fRawName = (XMLCh*) fMemoryManager->allocate + ( + (fRawNameBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fRawNameBufSz + 1]; + } + XMLString::moveChars(fRawName, rawName, newLen + 1); + setNPrefix(rawName, colonInd); + } + else + { + // No colon, so we just have a name with no prefix + setNPrefix(XMLUni::fgZeroLenString, 0); + + // And clean up any QName and leave it undone until/if asked for again + if (fRawName) + *fRawName = 0; + } + + setNLocalPart(&rawName[colonInd+1], newLen-colonInd-1); + + // And finally store the URI id parameter + fURIId = uriId; +} + +void QName::setNPrefix(const XMLCh* prefix, const XMLSize_t newLen) +{ + if (!fPrefixBufSz || (newLen > fPrefixBufSz)) + { + fMemoryManager->deallocate(fPrefix); //delete [] fPrefix; + fPrefix = 0; + fPrefixBufSz = newLen + 8; + fPrefix = (XMLCh*) fMemoryManager->allocate + ( + (fPrefixBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fPrefixBufSz + 1]; + } + XMLString::moveChars(fPrefix, prefix, newLen); + fPrefix[newLen] = chNull; +} + +void QName::setNLocalPart(const XMLCh* localPart, const XMLSize_t newLen) +{ + if (!fLocalPartBufSz || (newLen > fLocalPartBufSz)) + { + fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart; + fLocalPart = 0; + fLocalPartBufSz = newLen + 8; + fLocalPart = (XMLCh*) fMemoryManager->allocate + ( + (fLocalPartBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fLocalPartBufSz + 1]; + } + XMLString::moveChars(fLocalPart, localPart, newLen); + fLocalPart[newLen] = chNull; +} + +void QName::setValues(const QName& qname) +{ + setPrefix(qname.getPrefix()); + setLocalPart(qname.getLocalPart()); + setURI(qname.getURI()); +} + +// ----------------------------------------------------------------------- +// comparison +// ----------------------------------------------------------------------- +bool QName::operator==(const QName& qname) const +{ + // if we are an unitialized QName, check that the other is unitialized too + if (!fLocalPart && !fPrefix) + return !qname.fLocalPart && !qname.fPrefix; + + if (fURIId == 0) // null URI + return (XMLString::equals(getRawName(),qname.getRawName())); + + return ((fURIId == qname.getURI()) && + (XMLString::equals(fLocalPart, qname.getLocalPart()))); +} + +// --------------------------------------------------------------------------- +// QName: Private, helper methods +// --------------------------------------------------------------------------- +void QName::cleanUp() +{ + fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart; + fMemoryManager->deallocate(fPrefix); //delete [] fPrefix; + fMemoryManager->deallocate(fRawName); //delete [] fRawName; + fLocalPart = fPrefix = fRawName = 0; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(QName) + +void QName::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng.writeString(fPrefix, fPrefixBufSz, XSerializeEngine::toWriteBufferLen); + + serEng.writeString(fLocalPart, fLocalPartBufSz, XSerializeEngine::toWriteBufferLen); + + //do not serialize rawName + + serEng<>fURIId; + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/QName.hpp b/project/jni/xerces/src/xercesc/util/QName.hpp new file mode 100644 index 000000000..493d53028 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/QName.hpp @@ -0,0 +1,217 @@ +/* + * 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: QName.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_QNAME_HPP) +#define XERCESC_INCLUDE_GUARD_QNAME_HPP + +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT QName : public XSerializable, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + /** Default constructor. */ + QName(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Constructs a specified qname using prefix, and localpart. */ + QName + ( + const XMLCh* const prefix + , const XMLCh* const localPart + , const unsigned int uriId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Constructs a specified qname using rawName. */ + QName + ( + const XMLCh* const rawName + , const unsigned int uriId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Copy constructor. */ + QName(const QName& qname); + + ~QName(); + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + const XMLCh* getPrefix() const; + XMLCh* getPrefix(); + + const XMLCh* getLocalPart() const; + XMLCh* getLocalPart(); + + unsigned int getURI() const; + + const XMLCh* getRawName() const; + XMLCh* getRawName(); + + MemoryManager* getMemoryManager() const; + + // ----------------------------------------------------------------------- + // Setters + // ----------------------------------------------------------------------- + void setName + ( + const XMLCh* const prefix + , const XMLCh* const localPart + , const unsigned int uriId + ); + + void setName + ( + const XMLCh* const rawName + , const unsigned int uriId + ); + + void setPrefix(const XMLCh*) ; + void setLocalPart(const XMLCh*) ; + void setNPrefix(const XMLCh*, const XMLSize_t ) ; + void setNLocalPart(const XMLCh*, const XMLSize_t ) ; + void setURI(const unsigned int) ; + + void setValues(const QName& qname); + + // ----------------------------------------------------------------------- + // comparison + // ----------------------------------------------------------------------- + bool operator==(const QName&) const; + + // ----------------------------------------------------------------------- + // Misc + // ----------------------------------------------------------------------- + void cleanUp(); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(QName) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + QName& operator=(const QName&); + + // ----------------------------------------------------------------------- + // Private instance variables + // + // We copy the followings from XMLAttr.hpp, but stick to Java version's + // naming convention + // + // fPrefix + // fPrefixBufSz + // The prefix that was applied to this attribute's name, and the + // current size of the buffer (minus one for the null.) Prefixes + // really don't matter technically but it might be required for + // practical reasons, to recreate the original document for instance. + // + // fLocalPart + // fLocalPartBufSz + // The base part of the name of the attribute, and the current size + // of the buffer (minus one, where the null is.) + // + // fRawName + // fRawNameBufSz + // This is the QName form of the name, which is faulted in (from the + // prefix and name) upon request. The size field indicates the + // current size of the buffer (minus one for the null.) It will be + // zero until filled in. + // + // fURIId + // The id of the URI that this attribute belongs to. + // ----------------------------------------------------------------------- + XMLSize_t fPrefixBufSz; + XMLSize_t fLocalPartBufSz; + XMLSize_t fRawNameBufSz; + unsigned int fURIId; + XMLCh* fPrefix; + XMLCh* fLocalPart; + XMLCh* fRawName; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// QName: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* QName::getPrefix() const +{ + return fPrefix; +} + +inline XMLCh* QName::getPrefix() +{ + return fPrefix; +} + +inline const XMLCh* QName::getLocalPart() const +{ + return fLocalPart; +} + +inline XMLCh* QName::getLocalPart() +{ + return fLocalPart; +} + +inline unsigned int QName::getURI() const +{ + return fURIId; +} + +inline MemoryManager* QName::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// QName: Setter methods +// --------------------------------------------------------------------------- +inline void QName::setURI(const unsigned int uriId) +{ + fURIId = uriId; +} + +inline void QName::setPrefix(const XMLCh* prefix) +{ + setNPrefix(prefix, XMLString::stringLen(prefix)); +} + +inline void QName::setLocalPart(const XMLCh* localPart) +{ + setNLocalPart(localPart, XMLString::stringLen(localPart)); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefArrayOf.c b/project/jni/xerces/src/xercesc/util/RefArrayOf.c new file mode 100644 index 000000000..27aead78c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefArrayOf.c @@ -0,0 +1,269 @@ +/* + * 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: RefArrayOf.c 932887 2010-04-11 13:04:59Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefArrayOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefArrayOf::RefArrayOf(const XMLSize_t size, + MemoryManager* const manager) : + + fSize(size) + , fArray(0) + , fMemoryManager(manager) +{ + fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize]; + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = 0; +} + +template +RefArrayOf::RefArrayOf(TElem* values[], + const XMLSize_t size, + MemoryManager* const manager) : + + fSize(size) + , fArray(0) + , fMemoryManager(manager) +{ + fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize]; + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = values[index]; +} + +template RefArrayOf:: +RefArrayOf(const RefArrayOf& source) : + + fSize(source.fSize) + , fArray(0) + , fMemoryManager(source.fMemoryManager) +{ + fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize]; + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = source.fArray[index]; +} + +template RefArrayOf::~RefArrayOf() +{ + fMemoryManager->deallocate(fArray);//delete [] fArray; +} + + +// --------------------------------------------------------------------------- +// RefArrayOf: Public operators +// --------------------------------------------------------------------------- +template TElem*& RefArrayOf:: +operator[](const XMLSize_t index) +{ + if (index >= fSize) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + return fArray[index]; +} + +template const TElem* RefArrayOf:: +operator[](const XMLSize_t index) const +{ + if (index >= fSize) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + return fArray[index]; +} + +template RefArrayOf& RefArrayOf:: +operator=(const RefArrayOf& toAssign) +{ + if (this == &toAssign) + return *this; + + // Reallocate if not the same size + if (toAssign.fSize != fSize) + { + fMemoryManager->deallocate(fArray);//delete [] fArray; + fSize = toAssign.fSize; + fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize]; + } + + // Copy over the source elements + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = toAssign.fArray[index]; + + return *this; +} + +template bool RefArrayOf:: +operator==(const RefArrayOf& toCompare) const +{ + if (this == &toCompare) + return true; + + if (fSize != toCompare.fSize) + return false; + + for (XMLSize_t index = 0; index < fSize; index++) + { + if (fArray[index] != toCompare.fArray[index]) + return false; + } + return true; +} + +template bool RefArrayOf:: +operator!=(const RefArrayOf& toCompare) const +{ + return !operator==(toCompare); +} + + +// --------------------------------------------------------------------------- +// RefArrayOf: Copy operations +// --------------------------------------------------------------------------- +template XMLSize_t RefArrayOf:: +copyFrom(const RefArrayOf& srcArray) +{ + // + // Copy over as many of the source elements as will fit into + // this array. + // + const XMLSize_t count = fSize < srcArray.fSize ? + fSize : srcArray.fSize; + + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = srcArray.fArray[index]; + + return count; +} + + +// --------------------------------------------------------------------------- +// RefArrayOf: Getter methods +// --------------------------------------------------------------------------- +template XMLSize_t RefArrayOf::length() const +{ + return fSize; +} + +template TElem** RefArrayOf::rawData() const +{ + return fArray; +} + + +// --------------------------------------------------------------------------- +// RefArrayOf: Element management methods +// --------------------------------------------------------------------------- +template void RefArrayOf::deleteAt(const XMLSize_t index) +{ + if (index >= fSize) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + + delete fArray[index]; + fArray[index] = 0; +} + +template void RefArrayOf::deleteAllElements() +{ + for (XMLSize_t index = 0; index < fSize; index++) + { + delete fArray[index]; + fArray[index] = 0; + } +} + +template void RefArrayOf::resize(const XMLSize_t newSize) +{ + if (newSize == fSize) + return; + + if (newSize < fSize) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Array_BadNewSize, fMemoryManager); + + // Allocate the new array + TElem** newArray = (TElem**) fMemoryManager->allocate + ( + newSize * sizeof(TElem*) + );//new TElem*[newSize]; + + // Copy the existing values + XMLSize_t index = 0; + for (; index < fSize; index++) + newArray[index] = fArray[index]; + + for (; index < newSize; index++) + newArray[index] = 0; + + // Delete the old array and update our members + fMemoryManager->deallocate(fArray);//delete [] fArray; + fArray = newArray; + fSize = newSize; +} + + + + +// --------------------------------------------------------------------------- +// RefArrayEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template RefArrayEnumerator:: +RefArrayEnumerator( RefArrayOf* const toEnum + , const bool adopt) : + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) +{ +} + +template RefArrayEnumerator::~RefArrayEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// RefArrayEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool RefArrayEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fToEnum->length()) + return false; + return true; +} + +template TElem& RefArrayEnumerator::nextElement() +{ + return *(*fToEnum)[fCurIndex++]; +} + +template void RefArrayEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefArrayOf.hpp b/project/jni/xerces/src/xercesc/util/RefArrayOf.hpp new file mode 100644 index 000000000..a3c1cac24 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefArrayOf.hpp @@ -0,0 +1,150 @@ +/* + * 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: RefArrayOf.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFARRAY_HPP) +#define XERCESC_INCLUDE_GUARD_REFARRAY_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class RefArrayOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefArrayOf + ( + const XMLSize_t size + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + RefArrayOf + ( + TElem* values[] + , const XMLSize_t size + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + RefArrayOf(const RefArrayOf& source); + ~RefArrayOf(); + + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + TElem*& operator[](const XMLSize_t index); + const TElem* operator[](const XMLSize_t index) const; + RefArrayOf& operator=(const RefArrayOf& toAssign); + bool operator==(const RefArrayOf& toCompare) const; + bool operator!=(const RefArrayOf& toCompare) const; + + + // ----------------------------------------------------------------------- + // Copy operations + // ----------------------------------------------------------------------- + XMLSize_t copyFrom(const RefArrayOf& srcArray); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t length() const; + TElem** rawData() const; + + + // ----------------------------------------------------------------------- + // Element management methods + // ----------------------------------------------------------------------- + void deleteAt(const XMLSize_t index); + void deleteAllElements(); + void resize(const XMLSize_t newSize); + + +private : + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + XMLSize_t fSize; + TElem** fArray; + MemoryManager* fMemoryManager; +}; + + +// +// An enumerator for a reference array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template class RefArrayEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefArrayEnumerator + ( + RefArrayOf* const toEnum + , const bool adopt = false + ); + virtual ~RefArrayEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefArrayEnumerator(const RefArrayEnumerator&); + RefArrayEnumerator& operator=(const RefArrayEnumerator&); + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed array. If so then + // we delete it when we are destroyed. + // + // fCurIndex + // This is the current index into the array. + // + // fToEnum + // The reference array being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + RefArrayOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.c b/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.c new file mode 100644 index 000000000..d932773d2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.c @@ -0,0 +1,122 @@ +/* + * 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. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include "RefArrayVectorOf.hpp" +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefArrayVectorOf: Constructor and Destructor +// --------------------------------------------------------------------------- +template +RefArrayVectorOf::RefArrayVectorOf( const XMLSize_t maxElems + , const bool adoptElems + , MemoryManager* const manager) + : BaseRefVectorOf(maxElems, adoptElems, manager) +{ +} + + +template RefArrayVectorOf::~RefArrayVectorOf() +{ + if (this->fAdoptedElems) + { + for (XMLSize_t index = 0; index < this->fCurCount; index++) + this->fMemoryManager->deallocate(this->fElemList[index]);//delete[] fElemList[index]; + } + this->fMemoryManager->deallocate(this->fElemList);//delete [] fElemList; +} + +template void +RefArrayVectorOf::setElementAt(TElem* const toSet, const XMLSize_t setAt) +{ + if (setAt >= this->fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, this->fMemoryManager); + + if (this->fAdoptedElems) + this->fMemoryManager->deallocate(this->fElemList[setAt]); + + this->fElemList[setAt] = toSet; +} + +template void RefArrayVectorOf::removeAllElements() +{ + for (XMLSize_t index = 0; index < this->fCurCount; index++) + { + if (this->fAdoptedElems) + this->fMemoryManager->deallocate(this->fElemList[index]); + + // Keep unused elements zero for sanity's sake + this->fElemList[index] = 0; + } + this->fCurCount = 0; +} + +template void RefArrayVectorOf:: +removeElementAt(const XMLSize_t removeAt) +{ + if (removeAt >= this->fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, this->fMemoryManager); + + if (this->fAdoptedElems) + this->fMemoryManager->deallocate(this->fElemList[removeAt]); + + // Optimize if its the last element + if (removeAt == this->fCurCount-1) + { + this->fElemList[removeAt] = 0; + this->fCurCount--; + return; + } + + // Copy down every element above remove point + for (XMLSize_t index = removeAt; index < this->fCurCount-1; index++) + this->fElemList[index] = this->fElemList[index+1]; + + // Keep unused elements zero for sanity's sake + this->fElemList[this->fCurCount-1] = 0; + + // And bump down count + this->fCurCount--; +} + +template void RefArrayVectorOf::removeLastElement() +{ + if (!this->fCurCount) + return; + this->fCurCount--; + + if (this->fAdoptedElems) + this->fMemoryManager->deallocate(this->fElemList[this->fCurCount]); +} + +template void RefArrayVectorOf::cleanup() +{ + if (this->fAdoptedElems) + { + for (XMLSize_t index = 0; index < this->fCurCount; index++) + this->fMemoryManager->deallocate(this->fElemList[index]); + } + this->fMemoryManager->deallocate(this->fElemList);//delete [] fElemList; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.hpp b/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.hpp new file mode 100644 index 000000000..ea81115f0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefArrayVectorOf.hpp @@ -0,0 +1,70 @@ +/* + * 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: RefArrayVectorOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFARRAYVECTOROF_HPP) +#define XERCESC_INCLUDE_GUARD_REFARRAYVECTOROF_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Class with implementation for vectors of pointers to arrays - implements from + * the Abstract class Vector + */ +template class RefArrayVectorOf : public BaseRefVectorOf +{ +public : + // ----------------------------------------------------------------------- + // Constructor + // ----------------------------------------------------------------------- + RefArrayVectorOf( const XMLSize_t maxElems + , const bool adoptElems = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + ~RefArrayVectorOf(); + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + void setElementAt(TElem* const toSet, const XMLSize_t setAt); + void removeAllElements(); + void removeElementAt(const XMLSize_t removeAt); + void removeLastElement(); + void cleanup(); +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefArrayVectorOf(const RefArrayVectorOf&); + RefArrayVectorOf& operator=(const RefArrayVectorOf&); +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.c b/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.c new file mode 100644 index 000000000..fa972e823 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.c @@ -0,0 +1,692 @@ +/* + * 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: RefHash2KeysTableOf.c 679340 2008-07-24 10:28:29Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOf: Constructors and Destructor +// --------------------------------------------------------------------------- + +template +RefHash2KeysTableOf::RefHash2KeysTableOf( + const XMLSize_t modulus, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) +{ + initialize(modulus); +} + +template +RefHash2KeysTableOf::RefHash2KeysTableOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) + , fHasher (hasher) +{ + initialize(modulus); +} + +template +RefHash2KeysTableOf::RefHash2KeysTableOf( + const XMLSize_t modulus, + const bool adoptElems, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) + +{ + initialize(modulus); +} + +template +RefHash2KeysTableOf::RefHash2KeysTableOf( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fCount(0) + , fHasher (hasher) +{ + initialize(modulus); +} + +template +void RefHash2KeysTableOf::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (RefHash2KeysTableBucketElem**) fMemoryManager->allocate + ( + fHashModulus * sizeof(RefHash2KeysTableBucketElem*) + ); //new RefHash2KeysTableBucketElem*[fHashModulus]; + memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus); +} + +template +RefHash2KeysTableOf::~RefHash2KeysTableOf() +{ + removeAll(); + + // Then delete the bucket list & hasher + fMemoryManager->deallocate(fBucketList); //delete [] fBucketList; + fBucketList = 0; +} + + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOf: Element management +// --------------------------------------------------------------------------- +template +bool RefHash2KeysTableOf::isEmpty() const +{ + return (fCount==0); +} + +template +bool RefHash2KeysTableOf:: +containsKey(const void* const key1, const int key2) const +{ + XMLSize_t hashVal; + const RefHash2KeysTableBucketElem* findIt = findBucketElem(key1, key2, hashVal); + return (findIt != 0); +} + +template +void RefHash2KeysTableOf:: +removeKey(const void* const key1, const int key2) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + RefHash2KeysTableBucketElem* curElem = fBucketList[hashVal]; + RefHash2KeysTableBucketElem* lastElem = 0; + + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // If we adopted the elements, then delete the data + if (fAdoptedElems) + delete curElem->fData; + + // Delete the current element + // delete curElem; + // destructor is empty... + // curElem->~RefHash2KeysTableBucketElem(); + fMemoryManager->deallocate(curElem); + fCount--; + return; + } + + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + + // We never found that key + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); +} + +template +void RefHash2KeysTableOf:: +removeKey(const void* const key1) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + RefHash2KeysTableBucketElem* curElem = fBucketList[hashVal]; + RefHash2KeysTableBucketElem* lastElem = 0; + + while (curElem) + { + if(fHasher.equals(key1, curElem->fKey1)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // If we adopted the elements, then delete the data + if (fAdoptedElems) + delete curElem->fData; + + RefHash2KeysTableBucketElem* toBeDeleted=curElem; + curElem = curElem->fNext; + + // Delete the current element + // delete curElem; + // destructor is empty... + // curElem->~RefHash2KeysTableBucketElem(); + fMemoryManager->deallocate(toBeDeleted); + fCount--; + } + else + { + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + } +} + +template +void RefHash2KeysTableOf::removeAll() +{ + if(isEmpty()) + return; + + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + RefHash2KeysTableBucketElem* curElem = fBucketList[buckInd]; + RefHash2KeysTableBucketElem* nextElem; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + + // If we adopted the data, then delete it too + // (Note: the userdata hash table instance has data type of void *. + // This will generate compiler warnings here on some platforms, but they + // can be ignored since fAdoptedElements is false. + if (fAdoptedElems) + delete curElem->fData; + + // Then delete the current element and move forward + // destructor is empty... + // curElem->~RefHash2KeysTableBucketElem(); + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + fCount=0; +} + +// this function transfer the data from key1 to key2 +template +void RefHash2KeysTableOf::transferElement(const void* const key1, void* key2) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + RefHash2KeysTableBucketElem* curElem = fBucketList[hashVal]; + RefHash2KeysTableBucketElem* lastElem = 0; + + while (curElem) + { + // if this element has the same primary key, remove it and add it using the new primary key + if(fHasher.equals(key1, curElem->fKey1)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // this code comes from put(), but it doesn't update fCount + XMLSize_t hashVal2; + RefHash2KeysTableBucketElem* newBucket = findBucketElem(key2, curElem->fKey2, hashVal2); + if (newBucket) + { + if (fAdoptedElems) + delete newBucket->fData; + newBucket->fData = curElem->fData; + newBucket->fKey1 = key2; + newBucket->fKey2 = curElem->fKey2; + } + else + { + newBucket = + new (fMemoryManager->allocate(sizeof(RefHash2KeysTableBucketElem))) + RefHash2KeysTableBucketElem(key2, curElem->fKey2, curElem->fData, fBucketList[hashVal2]); + fBucketList[hashVal2] = newBucket; + } + + RefHash2KeysTableBucketElem* elemToDelete = curElem; + + // Update just curElem; lastElem must stay the same + curElem = curElem->fNext; + + // Delete the current element + // delete elemToDelete; + // destructor is empty... + // curElem->~RefHash2KeysTableBucketElem(); + fMemoryManager->deallocate(elemToDelete); + } + else + { + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + } +} + + + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOf: Getters +// --------------------------------------------------------------------------- +template +TVal* RefHash2KeysTableOf::get(const void* const key1, const int key2) +{ + XMLSize_t hashVal; + RefHash2KeysTableBucketElem* findIt = findBucketElem(key1, key2, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +const TVal* RefHash2KeysTableOf:: +get(const void* const key1, const int key2) const +{ + XMLSize_t hashVal; + const RefHash2KeysTableBucketElem* findIt = findBucketElem(key1, key2, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +MemoryManager* RefHash2KeysTableOf::getMemoryManager() const +{ + return fMemoryManager; +} + +template +XMLSize_t RefHash2KeysTableOf::getHashModulus() const +{ + return fHashModulus; +} + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOf: Putters +// --------------------------------------------------------------------------- +template +void RefHash2KeysTableOf::put(void* key1, int key2, TVal* const valueToAdopt) +{ + // Apply 4 load factor to find threshold. + XMLSize_t threshold = fHashModulus * 4; + + // If we've grown too big, expand the table and rehash. + if (fCount >= threshold) + rehash(); + + // First see if the key exists already + XMLSize_t hashVal; + RefHash2KeysTableBucketElem* newBucket = findBucketElem(key1, key2, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + if (fAdoptedElems) + delete newBucket->fData; + newBucket->fData = valueToAdopt; + newBucket->fKey1 = key1; + newBucket->fKey2 = key2; + } + else + { + newBucket = + new (fMemoryManager->allocate(sizeof(RefHash2KeysTableBucketElem))) + RefHash2KeysTableBucketElem(key1, key2, valueToAdopt, fBucketList[hashVal]); + fBucketList[hashVal] = newBucket; + fCount++; + } +} + + + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOf: Private methods +// --------------------------------------------------------------------------- +template +inline RefHash2KeysTableBucketElem* RefHash2KeysTableOf:: +findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + RefHash2KeysTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + +template +inline const RefHash2KeysTableBucketElem* RefHash2KeysTableOf:: +findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + const RefHash2KeysTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + + +template +void RefHash2KeysTableOf:: +rehash() +{ + const XMLSize_t newMod = (fHashModulus * 8)+1; + + RefHash2KeysTableBucketElem** newBucketList = + (RefHash2KeysTableBucketElem**) fMemoryManager->allocate + ( + newMod * sizeof(RefHash2KeysTableBucketElem*) + );//new RefHash2KeysTableBucketElem*[fHashModulus]; + + // Make sure the new bucket list is destroyed if an + // exception is thrown. + ArrayJanitor*> guard(newBucketList, fMemoryManager); + + memset(newBucketList, 0, newMod * sizeof(newBucketList[0])); + + // Rehash all existing entries. + for (XMLSize_t index = 0; index < fHashModulus; index++) + { + // Get the bucket list head for this entry + RefHash2KeysTableBucketElem* curElem = fBucketList[index]; + while (curElem) + { + // Save the next element before we detach this one + RefHash2KeysTableBucketElem* nextElem = curElem->fNext; + + const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey1, newMod); + assert(hashVal < newMod); + + RefHash2KeysTableBucketElem* newHeadElem = newBucketList[hashVal]; + + // Insert at the start of this bucket's list. + curElem->fNext = newHeadElem; + newBucketList[hashVal] = curElem; + + curElem = nextElem; + } + } + + RefHash2KeysTableBucketElem** const oldBucketList = fBucketList; + + // Everything is OK at this point, so update the + // member variables. + fBucketList = guard.release(); + fHashModulus = newMod; + + // Delete the old bucket list. + fMemoryManager->deallocate(oldBucketList);//delete[] oldBucketList; + +} + + + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOfEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefHash2KeysTableOfEnumerator:: +RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf* const toEnum + , const bool adopt + , MemoryManager* const manager) + : fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum) + , fMemoryManager(manager) + , fLockPrimaryKey(0) +{ + if (!toEnum) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, fMemoryManager); + + // + // Find the next available bucket element in the hash table. If it + // comes back zero, that just means the table is empty. + // + // Note that the -1 in the current hash tells it to start + // from the beginning. + // + findNext(); +} + +template +RefHash2KeysTableOfEnumerator::~RefHash2KeysTableOfEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOfEnumerator: Enum interface +// --------------------------------------------------------------------------- +template +bool RefHash2KeysTableOfEnumerator::hasMoreElements() const +{ + // + // If our current has is at the max and there are no more elements + // in the current bucket, then no more elements. + // + if (!fCurElem && (fCurHash == fToEnum->fHashModulus)) + return false; + return true; +} + +template +TVal& RefHash2KeysTableOfEnumerator::nextElement() +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + RefHash2KeysTableBucketElem* saveElem = fCurElem; + findNext(); + + return *saveElem->fData; +} + +template +void RefHash2KeysTableOfEnumerator::nextElementKey(void*& retKey1, int& retKey2) +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + RefHash2KeysTableBucketElem* saveElem = fCurElem; + findNext(); + + retKey1 = saveElem->fKey1; + retKey2 = saveElem->fKey2; + + return; +} + +template +void RefHash2KeysTableOfEnumerator::Reset() +{ + if(fLockPrimaryKey) + fCurHash=fToEnum->fHasher.getHashVal(fLockPrimaryKey, fToEnum->fHashModulus); + else + fCurHash = (XMLSize_t)-1; + + fCurElem = 0; + findNext(); +} + + +template +void RefHash2KeysTableOfEnumerator::setPrimaryKey(const void* key) +{ + fLockPrimaryKey=key; + Reset(); +} + +// --------------------------------------------------------------------------- +// RefHash2KeysTableOfEnumerator: Private helper methods +// --------------------------------------------------------------------------- +template +void RefHash2KeysTableOfEnumerator::findNext() +{ + // Code to execute if we have to return only values with the primary key + if(fLockPrimaryKey) + { + if(!fCurElem) + fCurElem = fToEnum->fBucketList[fCurHash]; + else + fCurElem = fCurElem->fNext; + while (fCurElem && (!fToEnum->fHasher.equals(fLockPrimaryKey, fCurElem->fKey1))) + fCurElem = fCurElem->fNext; + // if we didn't found it, make so hasMoreElements() returns false + if(!fCurElem) + fCurHash = fToEnum->fHashModulus; + return; + } + // + // If there is a current element, move to its next element. If this + // hits the end of the bucket, the next block will handle the rest. + // + if (fCurElem) + fCurElem = fCurElem->fNext; + + // + // If the current element is null, then we have to move up to the + // next hash value. If that is the hash modulus, then we cannot + // go further. + // + if (!fCurElem) + { + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + + // Else find the next non-empty bucket + while (fToEnum->fBucketList[fCurHash]==0) + { + // Bump to the next hash value. If we max out return + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + } + fCurElem = fToEnum->fBucketList[fCurHash]; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.hpp b/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.hpp new file mode 100644 index 000000000..9f1b4b5b5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHash2KeysTableOf.hpp @@ -0,0 +1,258 @@ +/* + * 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: RefHash2KeysTableOf.hpp 883368 2009-11-23 15:28:19Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFHASH2KEYSTABLEOF_HPP) +#define XERCESC_INCLUDE_GUARD_REFHASH2KEYSTABLEOF_HPP + + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// This hash table is similar to RefHashTableOf with an additional integer as key2 + +// Forward declare the enumerator so it can be our friend. +// +template +class RefHash2KeysTableOfEnumerator; + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +template +struct RefHash2KeysTableBucketElem +{ + RefHash2KeysTableBucketElem(void* key1, int key2, TVal* const value, RefHash2KeysTableBucketElem* next) + : fData(value), fNext(next), fKey1(key1), fKey2(key2) + { + } + ~RefHash2KeysTableBucketElem() {}; + + TVal* fData; + RefHash2KeysTableBucketElem* fNext; + void* fKey1; + int fKey2; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash2KeysTableBucketElem(const RefHash2KeysTableBucketElem&); + RefHash2KeysTableBucketElem& operator=(const RefHash2KeysTableBucketElem&); +}; + + +template +class RefHash2KeysTableOf : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + RefHash2KeysTableOf( + const XMLSize_t modulus, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash2KeysTableOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash2KeysTableOf( + const XMLSize_t modulus, + const bool adoptElems, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash2KeysTableOf( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~RefHash2KeysTableOf(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key1, const int key2) const; + void removeKey(const void* const key1, const int key2); + void removeKey(const void* const key1); + void removeAll(); + void transferElement(const void* const key1, void* key2); + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TVal* get(const void* const key1, const int key2); + const TVal* get(const void* const key1, const int key2) const; + + MemoryManager* getMemoryManager() const; + XMLSize_t getHashModulus() const; + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + void put(void* key1, int key2, TVal* const valueToAdopt); + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class RefHash2KeysTableOfEnumerator; + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash2KeysTableOf(const RefHash2KeysTableOf&); + RefHash2KeysTableOf& operator=(const RefHash2KeysTableOf&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + RefHash2KeysTableBucketElem* findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal); + const RefHash2KeysTableBucketElem* findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) const; + void initialize(const XMLSize_t modulus); + void rehash(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fAdoptedElems + // Indicates whether the values added are adopted or just referenced. + // If adopted, then they are deleted when they are removed from the + // hash table. + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fCount + // The number of elements currently in the map + // + // fHash + // The hasher for the key1 data type. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + bool fAdoptedElems; + RefHash2KeysTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + XMLSize_t fCount; + THasher fHasher; +}; + + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template +class RefHash2KeysTableOfEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf* const toEnum + , const bool adopt = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~RefHash2KeysTableOfEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TVal& nextElement(); + void Reset(); + + // ----------------------------------------------------------------------- + // New interface + // ----------------------------------------------------------------------- + void nextElementKey(void*&, int&); + void setPrimaryKey(const void* key); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash2KeysTableOfEnumerator(const RefHash2KeysTableOfEnumerator&); + RefHash2KeysTableOfEnumerator& operator=(const RefHash2KeysTableOfEnumerator&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void findNext(); + + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurElem + // This is the current bucket bucket element that we are on. + // + // fCurHash + // The is the current hash buck that we are working on. Once we hit + // the end of the bucket that fCurElem is in, then we have to start + // working this one up to the next non-empty bucket. + // + // fToEnum + // The value array being enumerated. + // + // fLockPrimaryKey + // Indicates that we are requested to iterate over the secondary keys + // associated with the given primary key + // + // ----------------------------------------------------------------------- + bool fAdopted; + RefHash2KeysTableBucketElem* fCurElem; + XMLSize_t fCurHash; + RefHash2KeysTableOf* fToEnum; + MemoryManager* const fMemoryManager; + const void* fLockPrimaryKey; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.c b/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.c new file mode 100644 index 000000000..d2452724b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.c @@ -0,0 +1,572 @@ +/* + * 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: RefHash3KeysIdPool.c 883368 2009-11-23 15:28:19Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPool: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefHash3KeysIdPool::RefHash3KeysIdPool( + const XMLSize_t modulus, + const XMLSize_t initSize, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) +{ + initialize(modulus); + + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +RefHash3KeysIdPool::RefHash3KeysIdPool( + const XMLSize_t modulus, + const THasher& hasher, + const XMLSize_t initSize, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fHasher(hasher) +{ + initialize(modulus); + + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +RefHash3KeysIdPool::RefHash3KeysIdPool( + const XMLSize_t modulus, + const bool adoptElems, + const XMLSize_t initSize, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + +{ + initialize(modulus); + + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +RefHash3KeysIdPool::RefHash3KeysIdPool( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + const XMLSize_t initSize, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fIdPtrs(0) + , fIdPtrsCount(initSize) + , fIdCounter(0) + , fHasher(hasher) +{ + initialize(modulus); + + // Allocate the initial id pointers array. We don't have to zero them + // out since the fIdCounter value tells us which ones are valid. The + // zeroth element is never used (and represents an invalid pool id.) + // + if (!fIdPtrsCount) + fIdPtrsCount = 256; + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount]; + fIdPtrs[0] = 0; +} + +template +void RefHash3KeysIdPool::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (RefHash3KeysTableBucketElem**) fMemoryManager->allocate + ( + fHashModulus * sizeof(RefHash3KeysTableBucketElem*) + ); //new RefHash3KeysTableBucketElem*[fHashModulus]; + memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus); +} + +template +RefHash3KeysIdPool::~RefHash3KeysIdPool() +{ + removeAll(); + + // Then delete the bucket list & hasher & id pointers list + fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs; + fIdPtrs = 0; + fMemoryManager->deallocate(fBucketList); //delete [] fBucketList; + fBucketList = 0; +} + + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPool: Element management +// --------------------------------------------------------------------------- +template +bool RefHash3KeysIdPool::isEmpty() const +{ + // Just check the bucket list for non-empty elements + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + if (fBucketList[buckInd] != 0) + return false; + } + return true; +} + +template +bool RefHash3KeysIdPool:: +containsKey(const void* const key1, const int key2, const int key3) const +{ + XMLSize_t hashVal; + const RefHash3KeysTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + return (findIt != 0); +} + +template +void RefHash3KeysIdPool::removeAll() +{ + if (fIdCounter == 0) return; + + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + RefHash3KeysTableBucketElem* curElem = fBucketList[buckInd]; + RefHash3KeysTableBucketElem* nextElem; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + + // If we adopted the data, then delete it too + // (Note: the userdata hash table instance has data type of void *. + // This will generate compiler warnings here on some platforms, but they + // can be ignored since fAdoptedElements is false. + if (fAdoptedElems) + delete curElem->fData; + + // Then delete the current element and move forward + // delete curElem; + // destructor is empty... + // curElem->~RefHash3KeysTableBucketElem(); + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + + // Reset the id counter + fIdCounter = 0; +} + + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPool: Getters +// --------------------------------------------------------------------------- +template +TVal* +RefHash3KeysIdPool::getByKey(const void* const key1, const int key2, const int key3) +{ + XMLSize_t hashVal; + RefHash3KeysTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +const TVal* +RefHash3KeysIdPool::getByKey(const void* const key1, const int key2, const int key3) const +{ + XMLSize_t hashVal; + const RefHash3KeysTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + if (!findIt) + return 0; + return findIt->fData; +} + +template +TVal* +RefHash3KeysIdPool::getById(const unsigned int elemId) +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +template +const TVal* +RefHash3KeysIdPool::getById(const unsigned int elemId) const +{ + // If its either zero or beyond our current id, its an error + if (!elemId || (elemId > fIdCounter)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); + + return fIdPtrs[elemId]; +} + +template +MemoryManager* RefHash3KeysIdPool::getMemoryManager() const +{ + return fMemoryManager; +} + +template +XMLSize_t RefHash3KeysIdPool::getHashModulus() const +{ + return fHashModulus; +} + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPool: Putters +// --------------------------------------------------------------------------- +template +XMLSize_t +RefHash3KeysIdPool::put(void* key1, int key2, int key3, TVal* const valueToAdopt) +{ + // First see if the key exists already + XMLSize_t hashVal; + XMLSize_t retId; + RefHash3KeysTableBucketElem* newBucket = findBucketElem(key1, key2, key3, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + retId = newBucket->fData->getId(); + if (fAdoptedElems) + delete newBucket->fData; + newBucket->fData = valueToAdopt; + newBucket->fKey1 = key1; + newBucket->fKey2 = key2; + newBucket->fKey3 = key3; + } + else + { + // Revisit: the gcc compiler 2.95.x is generating an + // internal compiler error message. So we use the default + // memory manager for now. +#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600) + newBucket = new RefHash3KeysTableBucketElem(key1, key2, key3, valueToAdopt, fBucketList[hashVal]); +#else + newBucket = + new (fMemoryManager->allocate(sizeof(RefHash3KeysTableBucketElem))) + RefHash3KeysTableBucketElem(key1, key2, key3, valueToAdopt, fBucketList[hashVal]); +#endif + fBucketList[hashVal] = newBucket; + + // + // Give this new one the next available id and add to the pointer list. + // Expand the list if that is now required. + // + if (fIdCounter + 1 == fIdPtrsCount) + { + // Create a new count 1.5 times larger and allocate a new array + XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5); + TVal** newArray = (TVal**) fMemoryManager->allocate + ( + newCount * sizeof(TVal*) + ); //new TVal*[newCount]; + + // Copy over the old contents to the new array + memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*)); + + // Ok, toss the old array and store the new data + fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs; + fIdPtrs = newArray; + fIdPtrsCount = newCount; + } + retId = ++fIdCounter; + } + + fIdPtrs[retId] = valueToAdopt; + + // Set the id on the passed element + valueToAdopt->setId(retId); + + // Return the id that we gave to this element + return retId; +} + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPool: Private methods +// --------------------------------------------------------------------------- +template +inline RefHash3KeysTableBucketElem* RefHash3KeysIdPool:: +findBucketElem(const void* const key1, const int key2, const int key3, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + RefHash3KeysTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (key3==curElem->fKey3) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + +template +inline const RefHash3KeysTableBucketElem* RefHash3KeysIdPool:: +findBucketElem(const void* const key1, const int key2, const int key3, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key1, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + const RefHash3KeysTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if((key2==curElem->fKey2) && (key3==curElem->fKey3) && (fHasher.equals(key1, curElem->fKey1))) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPoolEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefHash3KeysIdPoolEnumerator:: +RefHash3KeysIdPoolEnumerator(RefHash3KeysIdPool* const toEnum + , const bool adopt + , MemoryManager* const manager) + : fAdoptedElems(adopt), fCurIndex(0), fToEnum(toEnum), fMemoryManager(manager) +{ + if (!toEnum) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, fMemoryManager); + + Reset(); + resetKey(); +} + +template +RefHash3KeysIdPoolEnumerator::~RefHash3KeysIdPoolEnumerator() +{ + if (fAdoptedElems) + delete fToEnum; +} + +template +RefHash3KeysIdPoolEnumerator:: +RefHash3KeysIdPoolEnumerator(const RefHash3KeysIdPoolEnumerator& toCopy) : + XMLEnumerator(toCopy) + , XMemory(toCopy) + , fAdoptedElems(toCopy.fAdoptedElems) + , fCurIndex(toCopy.fCurIndex) + , fToEnum(toCopy.fToEnum) + , fCurElem(toCopy.fCurElem) + , fCurHash(toCopy.fCurHash) + , fMemoryManager(toCopy.fMemoryManager) +{ +} + +// --------------------------------------------------------------------------- +// RefHash3KeysIdPoolEnumerator: Enum interface +// --------------------------------------------------------------------------- +template +bool RefHash3KeysIdPoolEnumerator::hasMoreElements() const +{ + // If our index is zero or past the end, then we are done + if (!fCurIndex || (fCurIndex > fToEnum->fIdCounter)) + return false; + return true; +} + +template +TVal& RefHash3KeysIdPoolEnumerator::nextElement() +{ + // If our index is zero or past the end, then we are done + if (!fCurIndex || (fCurIndex > fToEnum->fIdCounter)) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // Return the current element and bump the index + return *fToEnum->fIdPtrs[fCurIndex++]; +} + +template +void RefHash3KeysIdPoolEnumerator::Reset() +{ + // + // Find the next available bucket element in the pool. We use the id + // array since its very easy to enumerator through by just maintaining + // an index. If the id counter is zero, then its empty and we leave the + // current index to zero. + // + fCurIndex = fToEnum->fIdCounter ? 1:0; + +} + +template +XMLSize_t RefHash3KeysIdPoolEnumerator::size() const +{ + return fToEnum->fIdCounter; +} + +template +void RefHash3KeysIdPoolEnumerator::resetKey() +{ + fCurHash = (XMLSize_t)-1; + fCurElem = 0; + findNext(); +} + +template +bool RefHash3KeysIdPoolEnumerator::hasMoreKeys() const +{ + // + // If our current has is at the max and there are no more elements + // in the current bucket, then no more elements. + // + if (!fCurElem && (fCurHash == fToEnum->fHashModulus)) + return false; + + return true; +} + +template +void RefHash3KeysIdPoolEnumerator::nextElementKey(void*& retKey1, int& retKey2, int& retKey3) +{ + // Make sure we have an element to return + if (!hasMoreKeys()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + RefHash3KeysTableBucketElem* saveElem = fCurElem; + findNext(); + + retKey1 = saveElem->fKey1; + retKey2 = saveElem->fKey2; + retKey3 = saveElem->fKey3; + + return; +} + +template +void RefHash3KeysIdPoolEnumerator::findNext() +{ + // + // If there is a current element, move to its next element. If this + // hits the end of the bucket, the next block will handle the rest. + // + if (fCurElem) + fCurElem = fCurElem->fNext; + + // + // If the current element is null, then we have to move up to the + // next hash value. If that is the hash modulus, then we cannot + // go further. + // + if (!fCurElem) + { + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + + // Else find the next non-empty bucket + while (fToEnum->fBucketList[fCurHash]==0) + { + // Bump to the next hash value. If we max out return + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + } + fCurElem = fToEnum->fBucketList[fCurHash]; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.hpp b/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.hpp new file mode 100644 index 000000000..961f7e13e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHash3KeysIdPool.hpp @@ -0,0 +1,279 @@ +/* + * 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: RefHash3KeysIdPool.hpp 883368 2009-11-23 15:28:19Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFHASH3KEYSIDPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_REFHASH3KEYSIDPOOL_HPP + + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// This hash table is a combination of RefHash2KeyTableOf (with an additional integer as key3) +// and NameIdPool with an id as index + +// Forward declare the enumerator so it can be our friend. +// +template +class RefHash3KeysIdPoolEnumerator; + + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +template +struct RefHash3KeysTableBucketElem +{ + RefHash3KeysTableBucketElem( + void* key1 + , int key2 + , int key3 + , TVal* const value + , RefHash3KeysTableBucketElem* next) : + fData(value) + , fNext(next) + , fKey1(key1) + , fKey2(key2) + , fKey3(key3) + { + } + + RefHash3KeysTableBucketElem() {}; + ~RefHash3KeysTableBucketElem() {}; + + TVal* fData; + RefHash3KeysTableBucketElem* fNext; + void* fKey1; + int fKey2; + int fKey3; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash3KeysTableBucketElem(const RefHash3KeysTableBucketElem&); + RefHash3KeysTableBucketElem& operator=(const RefHash3KeysTableBucketElem&); +}; + + +template +class RefHash3KeysIdPool : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefHash3KeysIdPool( + const XMLSize_t modulus, + const XMLSize_t initSize = 128, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash3KeysIdPool( + const XMLSize_t modulus, + const THasher& hasher, + const XMLSize_t initSize = 128, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash3KeysIdPool( + const XMLSize_t modulus, + const bool adoptElems, + const XMLSize_t initSize = 128, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHash3KeysIdPool( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + const XMLSize_t initSize = 128, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~RefHash3KeysIdPool(); + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key1, const int key2, const int key3) const; + void removeAll(); + + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TVal* getByKey(const void* const key1, const int key2, const int key3); + const TVal* getByKey(const void* const key1, const int key2, const int key3) const; + + TVal* getById(const unsigned int elemId); + const TVal* getById(const unsigned int elemId) const; + + MemoryManager* getMemoryManager() const; + XMLSize_t getHashModulus() const; + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + XMLSize_t put(void* key1, int key2, int key3, TVal* const valueToAdopt); + + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class RefHash3KeysIdPoolEnumerator; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash3KeysIdPool(const RefHash3KeysIdPool&); + RefHash3KeysIdPool& operator=(const RefHash3KeysIdPool&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + RefHash3KeysTableBucketElem* findBucketElem(const void* const key1, const int key2, const int key3, XMLSize_t& hashVal); + const RefHash3KeysTableBucketElem* findBucketElem(const void* const key1, const int key2, const int key3, XMLSize_t& hashVal) const; + void initialize(const XMLSize_t modulus); + + + // ----------------------------------------------------------------------- + // Data members + // + // fAdoptedElems + // Indicates whether the values added are adopted or just referenced. + // If adopted, then they are deleted when they are removed from the + // hash table. + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fHash + // The hasher for the key1 data type. + // + // fIdPtrs + // fIdPtrsCount + // This is the array of pointers to the bucket elements in order of + // their assigned ids. So taking id N and referencing this array + // gives you the element with that id. The count field indicates + // the current size of this list. When fIdCounter+1 reaches this + // value the list must be expanded. + // + // fIdCounter + // This is used to give out unique ids to added elements. It starts + // at zero (which means empty), and is bumped up for each newly added + // element. So the first element is 1, the next is 2, etc... This + // means that this value is set to the top index of the fIdPtrs array. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + bool fAdoptedElems; + RefHash3KeysTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + TVal** fIdPtrs; + XMLSize_t fIdPtrsCount; + XMLSize_t fIdCounter; + THasher fHasher; +}; + + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template +class RefHash3KeysIdPoolEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefHash3KeysIdPoolEnumerator(RefHash3KeysIdPool* const toEnum + , const bool adopt = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~RefHash3KeysIdPoolEnumerator(); + + RefHash3KeysIdPoolEnumerator(const RefHash3KeysIdPoolEnumerator&); + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TVal& nextElement(); + void Reset(); + XMLSize_t size() const; + + // ----------------------------------------------------------------------- + // New interface + // ----------------------------------------------------------------------- + void resetKey(); + void nextElementKey(void*&, int&, int&); + bool hasMoreKeys() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHash3KeysIdPoolEnumerator& + operator=(const RefHash3KeysIdPoolEnumerator&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void findNext(); + + // ----------------------------------------------------------------------- + // Data Members + // fAdoptedElems + // Indicates whether the values added are adopted or just referenced. + // If adopted, then they are deleted when they are removed from the + // hash table + // + // fCurIndex + // This is the current index into the pool's id mapping array. This + // is now we enumerate it. + // + // fToEnum + // The name id pool that is being enumerated. + // ----------------------------------------------------------------------- + bool fAdoptedElems; + XMLSize_t fCurIndex; + RefHash3KeysIdPool* fToEnum; + RefHash3KeysTableBucketElem* fCurElem; + XMLSize_t fCurHash; + MemoryManager* const fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefHashTableOf.c b/project/jni/xerces/src/xercesc/util/RefHashTableOf.c new file mode 100644 index 000000000..7fa85f6bc --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHashTableOf.c @@ -0,0 +1,663 @@ +/* + * 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: RefHashTableOf.c 678409 2008-07-21 13:08:10Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefHashTableOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefHashTableOf::RefHashTableOf( + const XMLSize_t modulus, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) +{ + initialize(modulus); +} + +template +RefHashTableOf::RefHashTableOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(true) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) + , fHasher (hasher) +{ + initialize(modulus); +} + +template +RefHashTableOf::RefHashTableOf( + const XMLSize_t modulus, + const bool adoptElems, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) + +{ + initialize(modulus); +} + +template +RefHashTableOf::RefHashTableOf( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + MemoryManager* const manager) + + : fMemoryManager(manager) + , fAdoptedElems(adoptElems) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) + , fHasher (hasher) +{ + initialize(modulus); +} + +template +void RefHashTableOf::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (RefHashTableBucketElem**) fMemoryManager->allocate + ( + fHashModulus * sizeof(RefHashTableBucketElem*) + ); + for (XMLSize_t index = 0; index < fHashModulus; index++) + fBucketList[index] = 0; +} + +template +RefHashTableOf::~RefHashTableOf() +{ + cleanup(); +} + + +// --------------------------------------------------------------------------- +// RefHashTableOf: Element management +// --------------------------------------------------------------------------- +template +inline bool RefHashTableOf::isEmpty() const +{ + return fCount==0; +} + +template +inline bool RefHashTableOf::containsKey(const void* const key) const +{ + XMLSize_t hashVal; + const RefHashTableBucketElem* findIt = findBucketElem(key, hashVal); + return (findIt != 0); +} + +template +void RefHashTableOf:: +removeKey(const void* const key) +{ + // Hash the key + XMLSize_t hashVal = fHasher.getHashVal(key, fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + RefHashTableBucketElem* curElem = fBucketList[hashVal]; + RefHashTableBucketElem* lastElem = 0; + + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // If we adopted the data, then delete it too + // (Note: the userdata hash table instance has data type of void *. + // This will generate compiler warnings here on some platforms, but they + // can be ignored since fAdoptedElements is false. + if (fAdoptedElems) + delete curElem->fData; + + // Then delete the current element and move forward + // delete curElem; + // destructor doesn't do anything... + fMemoryManager->deallocate(curElem); + + fCount--; + + return; + } + + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + + // We never found that key + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); +} + +template +void RefHashTableOf::removeAll() +{ + if(isEmpty()) + return; + + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + RefHashTableBucketElem* curElem = fBucketList[buckInd]; + RefHashTableBucketElem* nextElem; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + + // If we adopted the data, then delete it too + // (Note: the userdata hash table instance has data type of void *. + // This will generate compiler warnings here on some platforms, but they + // can be ignored since fAdoptedElements is false. + if (fAdoptedElems) + delete curElem->fData; + + // Then delete the current element and move forward + // delete curElem; + // destructor doesn't do anything... + // curElem->~RefHashTableBucketElem(); + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + + fCount = 0; +} + +// This method returns the data associated with a key. The key entry is deleted. The caller +// now owns the returned data (case of hashtable adopting the data). +// This function is called by transferElement so that the undeleted data can be transferred +// to a new key which will own that data. +template TVal* RefHashTableOf:: +orphanKey(const void* const key) +{ + // Hash the key + TVal* retVal = 0; + XMLSize_t hashVal = fHasher.getHashVal(key, fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + RefHashTableBucketElem* curElem = fBucketList[hashVal]; + RefHashTableBucketElem* lastElem = 0; + + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + retVal = curElem->fData; + + // Delete the current element + // delete curElem; + // destructor doesn't do anything... + // curElem->~RefHashTableBucketElem(); + fMemoryManager->deallocate(curElem); + break; + } + + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + + // We never found that key + if (!retVal) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); + + return retVal; +} + +// +// cleanup(): +// similar to destructor +// called to cleanup the memory, in case destructor cannot be called +// +template +void RefHashTableOf::cleanup() +{ + removeAll(); + + // Then delete the bucket list & hasher + fMemoryManager->deallocate(fBucketList); + fBucketList = 0; +} + +// +// reinitialize(): +// similar to constructor +// called to re-construct the fElemList from scratch again +// +template +void RefHashTableOf::reinitialize(const THasher& hasher) +{ + if (fBucketList) + cleanup(); + + fHasher = hasher; + + fHashModulus = fInitialModulus; + initialize(fHashModulus); +} + + + +// this function transfer the data from key1 to key2 +// this is equivalent to calling +// 1. get(key1) to retrieve the data, +// 2. removeKey(key1), +// 3. and then put(key2, data) +// except that the data is not deleted in "removeKey" even it is adopted so that it +// can be transferred to key2. +// whatever key2 has originally will be purged (if adopted) +template +inline void RefHashTableOf::transferElement(const void* const key1, void* key2) +{ + put(key2, orphanKey(key1)); +} + + +// --------------------------------------------------------------------------- +// RefHashTableOf: Getters +// --------------------------------------------------------------------------- +template +inline TVal* RefHashTableOf::get(const void* const key) +{ + XMLSize_t hashVal; + RefHashTableBucketElem* findIt = findBucketElem(key, hashVal); + return findIt ? findIt->fData : 0; +} + +template +inline const TVal* RefHashTableOf:: +get(const void* const key) const +{ + XMLSize_t hashVal; + const RefHashTableBucketElem* findIt = findBucketElem(key, hashVal); + return findIt ? findIt->fData : 0; +} + +template +inline MemoryManager* RefHashTableOf::getMemoryManager() const +{ + return fMemoryManager; +} + +template +inline XMLSize_t RefHashTableOf::getHashModulus() const +{ + return fHashModulus; +} + +template +inline XMLSize_t RefHashTableOf::getCount() const +{ + return fCount; +} + +// --------------------------------------------------------------------------- +// RefHashTableOf: Getters +// --------------------------------------------------------------------------- +template +inline void RefHashTableOf::setAdoptElements(const bool aValue) +{ + fAdoptedElems = aValue; +} + +// --------------------------------------------------------------------------- +// RefHashTableOf: Putters +// --------------------------------------------------------------------------- +template +void RefHashTableOf::put(void* key, TVal* const valueToAdopt) +{ + // Apply 0.75 load factor to find threshold. + XMLSize_t threshold = fHashModulus * 3 / 4; + + // If we've grown too big, expand the table and rehash. + if (fCount >= threshold) + rehash(); + + // First see if the key exists already + XMLSize_t hashVal; + RefHashTableBucketElem* newBucket = findBucketElem(key, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + if (fAdoptedElems) + delete newBucket->fData; + newBucket->fData = valueToAdopt; + newBucket->fKey = key; + } + else + { + newBucket = + new (fMemoryManager->allocate(sizeof(RefHashTableBucketElem))) + RefHashTableBucketElem(key, valueToAdopt, fBucketList[hashVal]); + fBucketList[hashVal] = newBucket; + fCount++; + } +} + + + +// --------------------------------------------------------------------------- +// RefHashTableOf: Private methods +// --------------------------------------------------------------------------- +template +void RefHashTableOf::rehash() +{ + const XMLSize_t newMod = (fHashModulus * 2) + 1; + + RefHashTableBucketElem** newBucketList = + (RefHashTableBucketElem**) fMemoryManager->allocate + ( + newMod * sizeof(RefHashTableBucketElem*) + ); + + // Make sure the new bucket list is destroyed if an + // exception is thrown. + ArrayJanitor*> guard(newBucketList, fMemoryManager); + + memset(newBucketList, 0, newMod * sizeof(newBucketList[0])); + + + // Rehash all existing entries. + for (XMLSize_t index = 0; index < fHashModulus; index++) + { + // Get the bucket list head for this entry + RefHashTableBucketElem* curElem = fBucketList[index]; + + while (curElem) + { + // Save the next element before we detach this one + RefHashTableBucketElem* const nextElem = curElem->fNext; + + const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey, newMod); + + RefHashTableBucketElem* const newHeadElem = newBucketList[hashVal]; + + // Insert at the start of this bucket's list. + curElem->fNext = newHeadElem; + newBucketList[hashVal] = curElem; + + curElem = nextElem; + } + } + + RefHashTableBucketElem** const oldBucketList = fBucketList; + + // Everything is OK at this point, so update the + // member variables. + fBucketList = guard.release(); + fHashModulus = newMod; + + // Delete the old bucket list. + fMemoryManager->deallocate(oldBucketList);//delete[] oldBucketList; + +} + +template +inline RefHashTableBucketElem* RefHashTableOf:: +findBucketElem(const void* const key, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key, fHashModulus); + + // Search that bucket for the key + RefHashTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + +template +inline const RefHashTableBucketElem* RefHashTableOf:: +findBucketElem(const void* const key, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key, fHashModulus); + + // Search that bucket for the key + const RefHashTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + + +// --------------------------------------------------------------------------- +// RefHashTableOfEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template RefHashTableOfEnumerator:: +RefHashTableOfEnumerator(RefHashTableOf* const toEnum + , const bool adopt + , MemoryManager* const manager) + : fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum) + , fMemoryManager(manager) +{ + if (!toEnum) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, fMemoryManager); + + // + // Find the next available bucket element in the hash table. If it + // comes back zero, that just means the table is empty. + // + // Note that the -1 in the current hash tells it to start + // from the beginning. + // + findNext(); +} + +template +RefHashTableOfEnumerator::~RefHashTableOfEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +template RefHashTableOfEnumerator:: +RefHashTableOfEnumerator(const RefHashTableOfEnumerator& toCopy) : + XMLEnumerator(toCopy) + , XMemory(toCopy) + , fAdopted(toCopy.fAdopted) + , fCurElem(toCopy.fCurElem) + , fCurHash(toCopy.fCurHash) + , fToEnum(toCopy.fToEnum) + , fMemoryManager(toCopy.fMemoryManager) +{ +} +// --------------------------------------------------------------------------- +// RefHashTableOfEnumerator: Enum interface +// --------------------------------------------------------------------------- +template +bool RefHashTableOfEnumerator::hasMoreElements() const +{ + // + // If our current has is at the max and there are no more elements + // in the current bucket, then no more elements. + // + if (!fCurElem && (fCurHash == fToEnum->fHashModulus)) + return false; + return true; +} + +template +TVal& RefHashTableOfEnumerator::nextElement() +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + RefHashTableBucketElem* saveElem = fCurElem; + findNext(); + + return *saveElem->fData; +} + +template +void* RefHashTableOfEnumerator::nextElementKey() +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + RefHashTableBucketElem* saveElem = fCurElem; + findNext(); + + return saveElem->fKey; +} + +template +void RefHashTableOfEnumerator::Reset() +{ + fCurHash = (XMLSize_t)-1; + fCurElem = 0; + findNext(); +} + + + +// --------------------------------------------------------------------------- +// RefHashTableOfEnumerator: Private helper methods +// --------------------------------------------------------------------------- +template +void RefHashTableOfEnumerator::findNext() +{ + // + // If there is a current element, move to its next element. If this + // hits the end of the bucket, the next block will handle the rest. + // + if (fCurElem) + fCurElem = fCurElem->fNext; + + // + // If the current element is null, then we have to move up to the + // next hash value. If that is the hash modulus, then we cannot + // go further. + // + if (!fCurElem) + { + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + + // Else find the next non-empty bucket + while (fToEnum->fBucketList[fCurHash]==0) + { + // Bump to the next hash value. If we max out return + fCurHash++; + if (fCurHash == fToEnum->fHashModulus) + return; + } + fCurElem = fToEnum->fBucketList[fCurHash]; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefHashTableOf.hpp b/project/jni/xerces/src/xercesc/util/RefHashTableOf.hpp new file mode 100644 index 000000000..5cd059348 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefHashTableOf.hpp @@ -0,0 +1,255 @@ +/* + * 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: RefHashTableOf.hpp 679340 2008-07-24 10:28:29Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFHASHTABLEOF_HPP) +#define XERCESC_INCLUDE_GUARD_REFHASHTABLEOF_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Forward declare the enumerator so it can be our friend. +// +template +class RefHashTableOfEnumerator; + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +template +struct RefHashTableBucketElem +{ + RefHashTableBucketElem(void* key, TVal* const value, RefHashTableBucketElem* next) + : fData(value), fNext(next), fKey(key) + { + } + + RefHashTableBucketElem(){}; + ~RefHashTableBucketElem(){}; + + TVal* fData; + RefHashTableBucketElem* fNext; + void* fKey; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHashTableBucketElem(const RefHashTableBucketElem&); + RefHashTableBucketElem& operator=(const RefHashTableBucketElem&); +}; + + +template +class RefHashTableOf : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefHashTableOf( + const XMLSize_t modulus, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHashTableOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHashTableOf( + const XMLSize_t modulus, + const bool adoptElems, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + RefHashTableOf( + const XMLSize_t modulus, + const bool adoptElems, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~RefHashTableOf(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key) const; + void removeKey(const void* const key); + void removeAll(); + void cleanup(); + void reinitialize(const THasher& hasher); + void transferElement(const void* const key1, void* key2); + TVal* orphanKey(const void* const key); + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TVal* get(const void* const key); + const TVal* get(const void* const key) const; + MemoryManager* getMemoryManager() const; + XMLSize_t getHashModulus() const; + XMLSize_t getCount() const; + + // ----------------------------------------------------------------------- + // Setters + // ----------------------------------------------------------------------- + void setAdoptElements(const bool aValue); + + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + void put(void* key, TVal* const valueToAdopt); + + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class RefHashTableOfEnumerator; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHashTableOf(const RefHashTableOf&); + RefHashTableOf& operator=(const RefHashTableOf&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + RefHashTableBucketElem* findBucketElem(const void* const key, XMLSize_t& hashVal); + const RefHashTableBucketElem* findBucketElem(const void* const key, XMLSize_t& hashVal) const; + void initialize(const XMLSize_t modulus); + void rehash(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fAdoptedElems + // Indicates whether the values added are adopted or just referenced. + // If adopted, then they are deleted when they are removed from the + // hash table. + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fHash + // The hasher for the key data type. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + bool fAdoptedElems; + RefHashTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + XMLSize_t fInitialModulus; + XMLSize_t fCount; + THasher fHasher; +}; + + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template +class RefHashTableOfEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefHashTableOfEnumerator(RefHashTableOf* const toEnum + , const bool adopt = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~RefHashTableOfEnumerator(); + + RefHashTableOfEnumerator(const RefHashTableOfEnumerator&); + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TVal& nextElement(); + void Reset(); + + // ----------------------------------------------------------------------- + // New interface specific for key used in RefHashable + // ----------------------------------------------------------------------- + void* nextElementKey(); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefHashTableOfEnumerator& + operator=(const RefHashTableOfEnumerator&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void findNext(); + + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurElem + // This is the current bucket bucket element that we are on. + // + // fCurHash + // The current hash buck that we are working on. Once we hit the + // end of the bucket that fCurElem is in, then we have to start + // working this one up to the next non-empty bucket. + // + // fToEnum + // The value array being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + RefHashTableBucketElem* fCurElem; + XMLSize_t fCurHash; + RefHashTableOf* fToEnum; + MemoryManager* const fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefStackOf.c b/project/jni/xerces/src/xercesc/util/RefStackOf.c new file mode 100644 index 000000000..152ea5a69 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefStackOf.c @@ -0,0 +1,160 @@ +/* + * 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: RefStackOf.c 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefStackOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefStackOf::RefStackOf(const XMLSize_t initElems, + const bool adoptElems, + MemoryManager* const manager) : + + fVector(initElems, adoptElems, manager) +{ +} + +template RefStackOf::~RefStackOf() +{ +} + + +// --------------------------------------------------------------------------- +// RefStackOf: Element management methods +// --------------------------------------------------------------------------- +template const TElem* RefStackOf:: +elementAt(const XMLSize_t index) const +{ + if (index >= fVector.size()) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Stack_BadIndex, fVector.getMemoryManager()); + return fVector.elementAt(index); +} + +template TElem* RefStackOf::popAt(const XMLSize_t index) +{ + if (index >= fVector.size()) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Stack_BadIndex, fVector.getMemoryManager()); + + // Orphan off the element from the slot in the vector + return fVector.orphanElementAt(index); +} + +template void RefStackOf::push(TElem* const toPush) +{ + fVector.addElement(toPush); +} + +template const TElem* RefStackOf::peek() const +{ + const XMLSize_t curSize = fVector.size(); + if (curSize == 0) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack, fVector.getMemoryManager()); + + return fVector.elementAt(curSize-1); +} + +template TElem* RefStackOf::pop() +{ + const XMLSize_t curSize = fVector.size(); + if (curSize == 0) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack, fVector.getMemoryManager()); + + // Orphan off the element from the last slot in the vector + return fVector.orphanElementAt(curSize-1); +} + +template void RefStackOf::removeAllElements() +{ + fVector.removeAllElements(); +} + + +// --------------------------------------------------------------------------- +// RefStackOf: Getter methods +// --------------------------------------------------------------------------- +template bool RefStackOf::empty() +{ + return (fVector.size() == 0); +} + +template XMLSize_t RefStackOf::curCapacity() +{ + return fVector.curCapacity(); +} + +template XMLSize_t RefStackOf::size() +{ + return fVector.size(); +} + + + + +// --------------------------------------------------------------------------- +// RefStackEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template RefStackEnumerator:: +RefStackEnumerator( RefStackOf* const toEnum + , const bool adopt) : + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) + , fVector(&toEnum->fVector) +{ +} + +template RefStackEnumerator::~RefStackEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// RefStackEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool RefStackEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fVector->size()) + return false; + return true; +} + +template TElem& RefStackEnumerator::nextElement() +{ + return *fVector->elementAt(fCurIndex++); +} + +template void RefStackEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefStackOf.hpp b/project/jni/xerces/src/xercesc/util/RefStackOf.hpp new file mode 100644 index 000000000..611c351ea --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefStackOf.hpp @@ -0,0 +1,152 @@ +/* + * 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: RefStackOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFSTACKOF_HPP) +#define XERCESC_INCLUDE_GUARD_REFSTACKOF_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// Forward declare the enumerator so he can be our friend. Can you say +// friend? Sure... +// +template class RefStackEnumerator; + + +template class RefStackOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefStackOf(const XMLSize_t initElems, + const bool adoptElems = true, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~RefStackOf(); + + + // ----------------------------------------------------------------------- + // Element management methods + // ----------------------------------------------------------------------- + const TElem* elementAt(const XMLSize_t index) const; + TElem* popAt(const XMLSize_t index); + void push(TElem* const toPush); + const TElem* peek() const; + TElem* pop(); + void removeAllElements(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool empty(); + XMLSize_t curCapacity(); + XMLSize_t size(); + + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class RefStackEnumerator; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefStackOf(const RefStackOf&); + RefStackOf& operator=(const RefStackOf&); + + // ----------------------------------------------------------------------- + // Data Members + // + // fVector + // The vector that is used as the backing data structure for the + // stack. + // ----------------------------------------------------------------------- + RefVectorOf fVector; +}; + + + +// +// An enumerator for a value stack. It derives from the basic enumerator +// class, so that value stacks can be generically enumerated. +// +template class RefStackEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + RefStackEnumerator + ( + RefStackOf* const toEnum + , const bool adopt = false + ); + virtual ~RefStackEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefStackEnumerator(const RefStackEnumerator&); + RefStackEnumerator& operator=(const RefStackEnumerator&); + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed stack. If so then + // we delete the stack when we are destroyed. + // + // fCurIndex + // This is the current index into the vector inside the stack being + // enumerated. + // + // fToEnum + // The stack that is being enumerated. This is just kept for + // adoption purposes, since we really are enumerating the vector + // inside of it. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + RefVectorOf* fVector; + RefStackOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RefVectorOf.c b/project/jni/xerces/src/xercesc/util/RefVectorOf.c new file mode 100644 index 000000000..dc17f9dff --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefVectorOf.c @@ -0,0 +1,54 @@ +/* + * 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: RefVectorOf.c 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RefVectorOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +RefVectorOf::RefVectorOf(const XMLSize_t maxElems, + const bool adoptElems, + MemoryManager* const manager) + : BaseRefVectorOf(maxElems, adoptElems, manager) +{ +} + +template RefVectorOf::~RefVectorOf() +{ + if (this->fAdoptedElems) + { + for (XMLSize_t index = 0; index < this->fCurCount; index++) + delete this->fElemList[index]; + } + this->fMemoryManager->deallocate(this->fElemList);//delete [] this->fElemList; +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/RefVectorOf.hpp b/project/jni/xerces/src/xercesc/util/RefVectorOf.hpp new file mode 100644 index 000000000..3ba72c1ed --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RefVectorOf.hpp @@ -0,0 +1,62 @@ +/* + * 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: RefVectorOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REFVECTOROF_HPP) +#define XERCESC_INCLUDE_GUARD_REFVECTOROF_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Class with implementation for vectors of References - implements from the + * Abstract class Vector + */ +template class RefVectorOf : public BaseRefVectorOf +{ +public : + // ----------------------------------------------------------------------- + // Constructor + // ----------------------------------------------------------------------- + RefVectorOf(const XMLSize_t maxElems, + const bool adoptElems = true, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + ~RefVectorOf(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RefVectorOf(const RefVectorOf&); + RefVectorOf& operator=(const RefVectorOf&); +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/RuntimeException.hpp b/project/jni/xerces/src/xercesc/util/RuntimeException.hpp new file mode 100644 index 000000000..c2abff280 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/RuntimeException.hpp @@ -0,0 +1,35 @@ +/* + * 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: RuntimeException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_RUNTIMEEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_RUNTIMEEXCEPTION_HPP + + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(RuntimeException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/SchemaDateTimeException.hpp b/project/jni/xerces/src/xercesc/util/SchemaDateTimeException.hpp new file mode 100644 index 000000000..45d49de9a --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/SchemaDateTimeException.hpp @@ -0,0 +1,35 @@ +/* + * 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: SchemaDateTimeException.hpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +#if !defined(SCHEMA_DATETIME_EXCEPTION_HPP) +#define SCHEMA_DATETIME_EXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(SchemaDateTimeException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/SecurityManager.hpp b/project/jni/xerces/src/xercesc/util/SecurityManager.hpp new file mode 100644 index 000000000..d01af449b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/SecurityManager.hpp @@ -0,0 +1,116 @@ +/* + * 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: SecurityManager.hpp 673960 2008-07-04 08:50:12Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SECURITYMANAGER_HPP) +#define XERCESC_INCLUDE_GUARD_SECURITYMANAGER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Allow application to force the parser to behave in a security-conscious + * way. + * + *

There are cases in which an XML- or XmL-schema- + * conformant processor can be presented with documents the + * processing of which can involve the consumption of + * prohibitive amounts of system resources. Applications can + * attach instances of this class to parsers that they've + * created, via the + * http://apache.org/xml/properties/security-manager property. + *

+ * + *

Defaults will be provided for all known security holes. + * Setter methods will be provided on this class to ensure that + * an application can customize each limit as it chooses. + * Components that are vulnerable to any given hole need to be + * written to act appropriately when an instance of this class + * has been set on the calling parser. + *

+ */ + +class XMLUTIL_EXPORT SecurityManager +{ +public: + + enum { ENTITY_EXPANSION_LIMIT = 50000}; + + /** @name default Constructors */ + //@{ + /** Default constructor */ + SecurityManager() + : fEntityExpansionLimit((XMLSize_t)ENTITY_EXPANSION_LIMIT) + { + } + + /** Destructor */ + virtual ~SecurityManager(){}; + //@} + + /** @name The Security Manager */ + //@{ + /** + * An application should call this method when it wishes to specify a particular + * limit to the number of entity expansions the parser will permit in a + * particular document. The default behaviour should allow the parser + * to validate nearly all XML non-malicious XML documents; if an + * application knows that it is operating in a domain where entities are + * uncommon, for instance, it may wish to provide a limit lower than the + * parser's default. + * + * @param newLimit the new entity expansion limit + * + */ + virtual void setEntityExpansionLimit(XMLSize_t newLimit) + { + fEntityExpansionLimit = newLimit; + } + + /** + * Permits the application or a parser component to query the current + * limit for entity expansions. + * + * @return the current setting of the entity expansion limit + * + */ + virtual XMLSize_t getEntityExpansionLimit() const + { + return fEntityExpansionLimit; + } + //@} + +protected: + XMLSize_t fEntityExpansionLimit; + +private: + + /* Unimplemented Constructors and operators */ + /* Copy constructor */ + SecurityManager(const SecurityManager&); + + /** Assignment operator */ + SecurityManager& operator=(const SecurityManager&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/StringPool.cpp b/project/jni/xerces/src/xercesc/util/StringPool.cpp new file mode 100644 index 000000000..590c7f901 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/StringPool.cpp @@ -0,0 +1,191 @@ +/* + * 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: StringPool.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLStringPool: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLStringPool::XMLStringPool(const unsigned int modulus, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fIdMap(0) + , fHashTable(0) + , fMapCapacity(64) + , fCurId(1) +{ + // Create the hash table, passing it the modulus + fHashTable = new (fMemoryManager) RefHashTableOf(modulus, false, fMemoryManager); + + // Do an initial allocation of the id map and zero it all out + fIdMap = (PoolElem**) fMemoryManager->allocate + ( + fMapCapacity * sizeof(PoolElem*) + ); //new PoolElem*[fMapCapacity]; + memset(fIdMap, 0, sizeof(PoolElem*) * fMapCapacity); +} + +XMLStringPool::~XMLStringPool() +{ + // delete all buckelements, since the hashtable doesn't adopt the elements anymore + for (unsigned int index = 1; index < fCurId; index++) + { + //fIdMap[index]->~PoolElem(); // we have no destructor + fMemoryManager->deallocate((void*) fIdMap[index]->fString); // deallocate memory + fMemoryManager->deallocate(fIdMap[index]); // deallocate memory + } + delete fHashTable; + fMemoryManager->deallocate(fIdMap); //delete [] fIdMap; +} + +// --------------------------------------------------------------------------- +// XMLStringPool: Pool management methods +// --------------------------------------------------------------------------- +void XMLStringPool::flushAll() +{ + // delete all buckelements, since the hashtable doesn't adopt the elements anymore + for (unsigned int index = 1; index < fCurId; index++) + { + //fIdMap[index]->~PoolElem(); // we have no destructor + fMemoryManager->deallocate((void*) fIdMap[index]->fString); // deallocate memory + fMemoryManager->deallocate(fIdMap[index]); // deallocate memory + } + fCurId = 1; + fHashTable->removeAll(); +} + +// --------------------------------------------------------------------------- +// XMLStringPool: Private helper methods +// --------------------------------------------------------------------------- +unsigned int XMLStringPool::addNewEntry(const XMLCh* const newString) +{ + // See if we need to expand the id map + if (fCurId == fMapCapacity) + { + // Calculate the new capacity, create a temp new map, and zero it + const unsigned int newCap = (unsigned int)(fMapCapacity * 1.5); + PoolElem** newMap = (PoolElem**) fMemoryManager->allocate + ( + newCap * sizeof(PoolElem*) + ); //new PoolElem*[newCap]; + memset(newMap, 0, sizeof(PoolElem*) * newCap); + + // + // Copy over the old elements from the old map. They are just pointers + // so we can do it all at once. + // + memcpy(newMap, fIdMap, sizeof(PoolElem*) * fMapCapacity); + + // Clean up the old map and store the new info + fMemoryManager->deallocate(fIdMap); //delete [] fIdMap; + fIdMap = newMap; + fMapCapacity = newCap; + } + + // + // Ok, now create a new element and add it to the hash table. Then store + // this new element in the id map at the current id index, then bump the + // id index. + // + PoolElem* newElem = (PoolElem*) fMemoryManager->allocate(sizeof(PoolElem)); + newElem->fId = fCurId; + newElem->fString = XMLString::replicate(newString, fMemoryManager); + fHashTable->put((void*)newElem->fString, newElem); + fIdMap[fCurId] = newElem; + + // Bump the current id and return the id of the new elem we just added + fCurId++; + return newElem->fId; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLStringPool) + +void XMLStringPool::serialize(XSerializeEngine& serEng) +{ + /*** + * Since we are pretty sure that fIdMap and fHashTable is + * not shared by any other object, therefore there is no owned/referenced + * issue. Thus we can serialize the raw data only, rather than serializing + * both fIdMap and fHashTable. + * + * And we can rebuild the fIdMap and fHashTable out of the raw data during + * deserialization. + * + ***/ + if (serEng.isStoring()) + { + serEng<>mapSize; + assert(1 == fCurId); //make sure empty + + for (unsigned int index = 1; index < mapSize; index++) + { + XMLCh* stringData; + serEng.readString(stringData); + addNewEntry(stringData); + + //we got to deallocate this string + //since stringpool will duplicate this string in the PoolElem and own that copy + fMemoryManager->deallocate(stringData); + } + } +} + +XMLStringPool::XMLStringPool(MemoryManager* const manager) : + fMemoryManager(manager) + , fIdMap(0) + , fHashTable(0) + , fMapCapacity(64) + , fCurId(1) +{ + // Create the hash table, passing it the modulus + fHashTable = new (fMemoryManager) RefHashTableOf(109, false, fMemoryManager); + + // Do an initial allocation of the id map and zero it all out + fIdMap = (PoolElem**) fMemoryManager->allocate + ( + fMapCapacity * sizeof(PoolElem*) + ); //new PoolElem*[fMapCapacity]; + memset(fIdMap, 0, sizeof(PoolElem*) * fMapCapacity); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/StringPool.hpp b/project/jni/xerces/src/xercesc/util/StringPool.hpp new file mode 100644 index 000000000..12879918e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/StringPool.hpp @@ -0,0 +1,175 @@ +/* + * 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: StringPool.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_STRINGPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_STRINGPOOL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class implements a string pool, in which strings can be added and +// given a unique id by which they can be referred. It has to provide fast +// access both mapping from a string to its id and mapping from an id to +// its string. This requires that it provide two separate data structures. +// The map one is a hash table for quick storage and look up by name. The +// other is an array ordered by unique id which maps to the element in the +// hash table. +// +// This works because strings cannot be removed from the pool once added, +// other than flushing it completely, and because ids are assigned +// sequentially from 1. +// +class XMLUTIL_EXPORT XMLStringPool : public XSerializable, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLStringPool + ( + const unsigned int modulus = 109 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~XMLStringPool(); + + + // ----------------------------------------------------------------------- + // Pool management methods + // ----------------------------------------------------------------------- + virtual unsigned int addOrFind(const XMLCh* const newString); + virtual bool exists(const XMLCh* const newString) const; + virtual bool exists(const unsigned int id) const; + virtual void flushAll(); + virtual unsigned int getId(const XMLCh* const toFind) const; + virtual const XMLCh* getValueForId(const unsigned int id) const; + virtual unsigned int getStringCount() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLStringPool) + + XMLStringPool(MemoryManager* const manager); + +private : + // ----------------------------------------------------------------------- + // Private data types + // ----------------------------------------------------------------------- + struct PoolElem + { + unsigned int fId; + XMLCh* fString; + }; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLStringPool(const XMLStringPool&); + XMLStringPool& operator=(const XMLStringPool&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + unsigned int addNewEntry(const XMLCh* const newString); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fIdMap + // This is an array of pointers to the pool elements. It is ordered + // by unique id, so using an id to index it gives instant access to + // the string of that id. This is grown as required. + // + // fHashTable + // This is the hash table used to store and quickly access the + // strings. + // + // fMapCapacity + // The current capacity of the id map. When the current id hits this + // value the map must must be expanded. + // + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + PoolElem** fIdMap; + RefHashTableOf* fHashTable; + unsigned int fMapCapacity; + +protected: + // protected data members + // fCurId + // This is the counter used to assign unique ids. It is just bumped + // up one for each new string added. + unsigned int fCurId; +}; + + +// Provide inline versions of some of the simple functions to improve performance. +inline unsigned int XMLStringPool::addOrFind(const XMLCh* const newString) +{ + PoolElem* elemToFind = fHashTable->get(newString); + if (elemToFind) + return elemToFind->fId; + + return addNewEntry(newString); +} + +inline unsigned int XMLStringPool::getId(const XMLCh* const toFind) const +{ + PoolElem* elemToFind = fHashTable->get(toFind); + if (elemToFind) + return elemToFind->fId; + + // Not found, so return zero, which is never a legal id + return 0; +} + +inline bool XMLStringPool::exists(const XMLCh* const newString) const +{ + return fHashTable->containsKey(newString); +} + +inline bool XMLStringPool::exists(const unsigned int id) const +{ + return (id > 0 && (id < fCurId)); +} + +inline const XMLCh* XMLStringPool::getValueForId(const unsigned int id) const +{ + if (!id || (id >= fCurId)) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::StrPool_IllegalId, fMemoryManager); + + // Just index the id map and return that element's string + return fIdMap[id]->fString; +} + +inline unsigned int XMLStringPool::getStringCount() const +{ + return fCurId-1; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.cpp b/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.cpp new file mode 100644 index 000000000..f8c714c7b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.cpp @@ -0,0 +1,129 @@ +/* + * 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: SynchronizedStringPool.cpp 903137 2010-01-26 09:26:28Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLSynchronizedStringPool: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLSynchronizedStringPool::XMLSynchronizedStringPool(const XMLStringPool *constPool + , const unsigned int modulus + , MemoryManager* const manager) : + + XMLStringPool(modulus, manager) + , fConstPool(constPool) + , fMutex(manager) +{ +} + +XMLSynchronizedStringPool::~XMLSynchronizedStringPool() +{ +} + + +// --------------------------------------------------------------------------- +// XMLSynchronizedStringPool: Pool management methods +// --------------------------------------------------------------------------- +unsigned int XMLSynchronizedStringPool::addOrFind(const XMLCh* const newString) +{ + unsigned int id = fConstPool->getId(newString); + if(id) + return id; + // might have to add it to our own table. + // synchronize this bit + unsigned int constCount = fConstPool->getStringCount(); + XMLMutexLock lockInit(&fMutex); + id = XMLStringPool::addOrFind(newString); + return id+constCount; +} + +bool XMLSynchronizedStringPool::exists(const XMLCh* const newString) const +{ + if(fConstPool->exists(newString)) + return true; + + XMLMutexLock lockInit(&const_cast(this)->fMutex); + return XMLStringPool::exists(newString); +} + +bool XMLSynchronizedStringPool::exists(const unsigned int id) const +{ + if (!id) + return false; + + // First see if this id belongs to the const pool. + // + unsigned int constCount = fConstPool->getStringCount(); + + if (id <= constCount) + return true; + + // The rest needs to be synchronized. + // + XMLMutexLock lockInit(&const_cast(this)->fMutex); + return id < fCurId + constCount; +} + +void XMLSynchronizedStringPool::flushAll() +{ + // don't touch const pool! + XMLStringPool::flushAll(); +} + + +unsigned int XMLSynchronizedStringPool::getId(const XMLCh* const toFind) const +{ + unsigned int retVal = fConstPool->getId(toFind); + if(retVal) + return retVal; + + // make sure we return a truly unique id + unsigned int constCount = fConstPool->getStringCount(); + XMLMutexLock lockInit(&const_cast(this)->fMutex); + return XMLStringPool::getId(toFind)+constCount; +} + + +const XMLCh* XMLSynchronizedStringPool::getValueForId(const unsigned int id) const +{ + if (id <= fConstPool->getStringCount()) + return fConstPool->getValueForId(id); + + unsigned int constCount = fConstPool->getStringCount(); + XMLMutexLock lockInit(&const_cast(this)->fMutex); + return XMLStringPool::getValueForId(id-constCount); +} + +unsigned int XMLSynchronizedStringPool::getStringCount() const +{ + unsigned int constCount = fConstPool->getStringCount(); + XMLMutexLock lockInit(&const_cast(this)->fMutex); + return fCurId+constCount-1; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.hpp b/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.hpp new file mode 100644 index 000000000..6348da8dc --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/SynchronizedStringPool.hpp @@ -0,0 +1,86 @@ +/* + * 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: SynchronizedStringPool.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SYNCHRONIZEDSTRINGPOOL_HPP) +#define XERCESC_INCLUDE_GUARD_SYNCHRONIZEDSTRINGPOOL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides a synchronized string pool implementation. +// This will necessarily be slower than the regular XMLStringPool, so it +// should only be used when updates need to be made in a thread-safe +// way. Updates will be made on datastructures local to this object; +// all queries that don't involve mutation will first be directed at +// the XMLStringPool implementation with which this object is +// constructed. +class XMLUTIL_EXPORT XMLSynchronizedStringPool : public XMLStringPool +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLSynchronizedStringPool + ( + const XMLStringPool * constPool + , const unsigned int modulus = 109 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~XMLSynchronizedStringPool(); + + + // ----------------------------------------------------------------------- + // Pool management methods + // ----------------------------------------------------------------------- + virtual unsigned int addOrFind(const XMLCh* const newString); + virtual bool exists(const XMLCh* const newString) const; + virtual bool exists(const unsigned int id) const; + virtual void flushAll(); + virtual unsigned int getId(const XMLCh* const toFind) const; + virtual const XMLCh* getValueForId(const unsigned int id) const; + virtual unsigned int getStringCount() const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLSynchronizedStringPool(const XMLSynchronizedStringPool&); + XMLSynchronizedStringPool& operator=(const XMLSynchronizedStringPool&); + + + // ----------------------------------------------------------------------- + // private data members + // fConstPool + // the pool whose immutability we're protecting + // fMutex + // mutex to permit synchronous updates of our StringPool + const XMLStringPool* fConstPool; + XMLMutex fMutex; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/TransENameMap.c b/project/jni/xerces/src/xercesc/util/TransENameMap.c new file mode 100644 index 000000000..bbe27f31d --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/TransENameMap.c @@ -0,0 +1,81 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ENameMapFor: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ENameMapFor::ENameMapFor(const XMLCh* const encodingName) : + + ENameMap(encodingName) +{ +} + +template ENameMapFor::~ENameMapFor() +{ +} + + +// --------------------------------------------------------------------------- +// ENameMapFor: Implementation of virtual factory method +// --------------------------------------------------------------------------- +template XMLTranscoder* +ENameMapFor::makeNew(const XMLSize_t blockSize, + MemoryManager* const manager) const +{ + return new (manager) TType(getKey(), blockSize, manager); +} + + + + +// --------------------------------------------------------------------------- +// ENameMapFor: Constructors and Destructor +// --------------------------------------------------------------------------- +template EEndianNameMapFor::EEndianNameMapFor(const XMLCh* const encodingName, const bool swapped) : + + ENameMap(encodingName) + , fSwapped(swapped) +{ +} + +template EEndianNameMapFor::~EEndianNameMapFor() +{ +} + + +// --------------------------------------------------------------------------- +// ENameMapFor: Implementation of virtual factory method +// --------------------------------------------------------------------------- +template XMLTranscoder* +EEndianNameMapFor::makeNew(const XMLSize_t blockSize, + MemoryManager* const manager) const +{ + return new (manager) TType(getKey(), blockSize, fSwapped, manager); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/TransENameMap.hpp b/project/jni/xerces/src/xercesc/util/TransENameMap.hpp new file mode 100644 index 000000000..b308ceb94 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/TransENameMap.hpp @@ -0,0 +1,166 @@ +/* + * 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: TransENameMap.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP) +#define XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class is really private to the TransService class. However, some +// compilers are too dumb to allow us to hide this class there in the Cpp +// file that uses it. +// +class ENameMap : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + virtual ~ENameMap() + { + //delete [] fEncodingName; + XMLPlatformUtils::fgMemoryManager->deallocate(fEncodingName); + } + + + + // ----------------------------------------------------------------------- + // Virtual factory method + // ----------------------------------------------------------------------- + virtual XMLTranscoder* makeNew + ( + const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const = 0; + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const XMLCh* getKey() const + { + return fEncodingName; + } + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + ENameMap(const XMLCh* const encodingName) : + fEncodingName(XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager)) + { + } + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ENameMap(); + ENameMap(const ENameMap&); + ENameMap& operator=(const ENameMap&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fEncodingName + // This is the encoding name for the transcoder that is controlled + // by this map instance. + // ----------------------------------------------------------------------- + XMLCh* fEncodingName; +}; + + +template class ENameMapFor : public ENameMap +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ENameMapFor(const XMLCh* const encodingName); + ~ENameMapFor(); + + + // ----------------------------------------------------------------------- + // Implementation of virtual factory method + // ----------------------------------------------------------------------- + virtual XMLTranscoder* makeNew(const XMLSize_t blockSize, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ENameMapFor(); + ENameMapFor(const ENameMapFor&); + ENameMapFor& operator=(const ENameMapFor&); +}; + + +template class EEndianNameMapFor : public ENameMap +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + EEndianNameMapFor(const XMLCh* const encodingName, const bool swapped); + ~EEndianNameMapFor(); + + + // ----------------------------------------------------------------------- + // Implementation of virtual factory method + // ----------------------------------------------------------------------- + virtual XMLTranscoder* makeNew(const XMLSize_t blockSize, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + EEndianNameMapFor(const EEndianNameMapFor&); + EEndianNameMapFor& operator=(const EEndianNameMapFor&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fSwapped + // Indicates whether the endianness of the encoding is opposite of + // that of the local host. + // ----------------------------------------------------------------------- + bool fSwapped; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/TransService.cpp b/project/jni/xerces/src/xercesc/util/TransService.cpp new file mode 100644 index 000000000..464badd59 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/TransService.cpp @@ -0,0 +1,736 @@ +/* + * 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: TransService.cpp 933523 2010-04-13 08:53:39Z amassari $ + */ +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local, static data +// +// gStrictIANAEncoding +// A flag to control whether strict IANA encoding names checking should +// be done +// +// --------------------------------------------------------------------------- +static bool gStrictIANAEncoding = false; +RefHashTableOf* XMLTransService::gMappings = 0; +RefVectorOf * XMLTransService::gMappingsRecognizer = 0; + +void XMLInitializer::initializeTransService() +{ + XMLTransService::gMappings = new RefHashTableOf(103); + XMLTransService::gMappingsRecognizer = new RefVectorOf( + (XMLSize_t)XMLRecognizer::Encodings_Count); +} + +void XMLInitializer::terminateTransService() +{ + delete XMLTransService::gMappingsRecognizer; + XMLTransService::gMappingsRecognizer = 0; + + delete XMLTransService::gMappings; + XMLTransService::gMappings = 0; +} + +// --------------------------------------------------------------------------- +// XMLTransService: Constructors and destructor +// --------------------------------------------------------------------------- +XMLTransService::XMLTransService() +{ +} + +XMLTransService::~XMLTransService() +{ +} + +// --------------------------------------------------------------------------- +// Allow user specific encodings to be added to the mappings table. +// Should be called after platform init +// --------------------------------------------------------------------------- +void XMLTransService::addEncoding(const XMLCh* const encoding, + ENameMap* const ownMapping) +{ + gMappings->put((void *) encoding, ownMapping); +} + +// --------------------------------------------------------------------------- +// XMLTransService: Non-virtual API +// --------------------------------------------------------------------------- +XMLTranscoder* +XMLTransService::makeNewTranscoderFor( const char* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager) +{ + XMLCh* tmpName = XMLString::transcode(encodingName, manager); + ArrayJanitor janName(tmpName, manager); + + return makeNewTranscoderFor(tmpName, resValue, blockSize, manager); +} + +XMLTranscoder* +XMLTransService::makeNewTranscoderFor( const XMLCh* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager) +{ + // + // If strict IANA encoding flag is set, validate encoding name + // + if (gStrictIANAEncoding) + { + if (!EncodingValidator::instance()->isValidEncoding(encodingName)) + { + resValue = XMLTransService::UnsupportedEncoding; + return 0; + } + } + + // + // First try to find it in our list of mappings to intrinsically + // supported encodings. We have to upper case the passed encoding + // name because we use a hash table and we stored all our mappings + // in all uppercase. + // + const XMLSize_t bufSize = 2048; + XMLCh upBuf[bufSize + 1]; + if (!XMLString::copyNString(upBuf, encodingName, bufSize)) + { + resValue = XMLTransService::InternalFailure; + return 0; + } + XMLString::upperCaseASCII(upBuf); + ENameMap* ourMapping = gMappings->get(upBuf); + + // If we found it, then call the factory method for it + if (ourMapping) + { + XMLTranscoder* temp = ourMapping->makeNew(blockSize, manager); + resValue = temp ? XMLTransService::Ok : XMLTransService::InternalFailure; + return temp; + } + + // + // It wasn't an intrinsic and it wasn't disallowed, so pass it on + // to the trans service to see if he can make anything of it. + // + + XMLTranscoder* temp = makeNewXMLTranscoder(encodingName, resValue, blockSize, manager); + + // if successful, set resValue to OK + // if failed, the makeNewXMLTranscoder has already set the proper failing resValue + if (temp) resValue = XMLTransService::Ok; + + return temp; + +} + + +XMLTranscoder* +XMLTransService::makeNewTranscoderFor( XMLRecognizer::Encodings encodingEnum + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager) +{ + // + // We can only make transcoder if the passed encodingEnum is under this range + // + if (encodingEnum < XMLRecognizer::Encodings_Min || encodingEnum > XMLRecognizer::Encodings_Max) { + resValue = XMLTransService::InternalFailure; + return 0; + } + + ENameMap* ourMapping = gMappingsRecognizer->elementAt(encodingEnum); + + // If we found it, then call the factory method for it + if (ourMapping) { + XMLTranscoder* temp = ourMapping->makeNew(blockSize, manager); + resValue = temp ? XMLTransService::Ok : XMLTransService::InternalFailure; + return temp; + } + else { + XMLTranscoder* temp = makeNewXMLTranscoder(XMLRecognizer::nameForEncoding(encodingEnum, manager), resValue, blockSize, manager); + + // if successful, set resValue to OK + // if failed, the makeNewXMLTranscoder has already set the proper failing resValue + if (temp) resValue = XMLTransService::Ok; + + return temp; + } + +} + + +// --------------------------------------------------------------------------- +// XMLTransTransService: Hidden Init Method +// +// This is called by platform utils during startup. +// --------------------------------------------------------------------------- +void XMLTransService::initTransService() +{ + // + // A stupid way to increment the fCurCount inside the RefVectorOf + // + for (XMLSize_t i = 0; i < (XMLSize_t)XMLRecognizer::Encodings_Count; i++) + gMappingsRecognizer->addElement(0); + + // + // Add in the magical mapping for the native XMLCh transcoder. This + // is used for internal entities. + // + gMappingsRecognizer->setElementAt(new ENameMapFor(XMLUni::fgXMLChEncodingString), XMLRecognizer::XERCES_XMLCH); + gMappings->put((void*)XMLUni::fgXMLChEncodingString, new ENameMapFor(XMLUni::fgXMLChEncodingString)); + + // + // Add in our mappings for ASCII. + // + gMappingsRecognizer->setElementAt(new ENameMapFor(XMLUni::fgUSASCIIEncodingString), XMLRecognizer::US_ASCII); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString, new ENameMapFor(XMLUni::fgUSASCIIEncodingString)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString2, new ENameMapFor(XMLUni::fgUSASCIIEncodingString2)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString3, new ENameMapFor(XMLUni::fgUSASCIIEncodingString3)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString4, new ENameMapFor(XMLUni::fgUSASCIIEncodingString4)); + + + // + // Add in our mappings for UTF-8 + // + gMappingsRecognizer->setElementAt(new ENameMapFor(XMLUni::fgUTF8EncodingString), XMLRecognizer::UTF_8); + gMappings->put((void*)XMLUni::fgUTF8EncodingString, new ENameMapFor(XMLUni::fgUTF8EncodingString)); + gMappings->put((void*)XMLUni::fgUTF8EncodingString2, new ENameMapFor(XMLUni::fgUTF8EncodingString2)); + + // + // Add in our mappings for Latin1 + // + gMappings->put((void*)XMLUni::fgISO88591EncodingString, new ENameMapFor(XMLUni::fgISO88591EncodingString)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString2, new ENameMapFor(XMLUni::fgISO88591EncodingString2)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString3, new ENameMapFor(XMLUni::fgISO88591EncodingString3)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString4, new ENameMapFor(XMLUni::fgISO88591EncodingString4)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString5, new ENameMapFor(XMLUni::fgISO88591EncodingString5)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString6, new ENameMapFor(XMLUni::fgISO88591EncodingString6)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString7, new ENameMapFor(XMLUni::fgISO88591EncodingString7)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString8, new ENameMapFor(XMLUni::fgISO88591EncodingString8)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString9, new ENameMapFor(XMLUni::fgISO88591EncodingString9)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString10, new ENameMapFor(XMLUni::fgISO88591EncodingString10)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString11, new ENameMapFor(XMLUni::fgISO88591EncodingString11)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString12, new ENameMapFor(XMLUni::fgISO88591EncodingString12)); + + // + // Add in our mappings for UTF-16 and UCS-4, little endian + // + bool swapped = XMLPlatformUtils::fgXMLChBigEndian; + + gMappingsRecognizer->setElementAt(new EEndianNameMapFor(XMLUni::fgUTF16LEncodingString, swapped), XMLRecognizer::UTF_16L); + gMappings->put + ( + (void*)XMLUni::fgUTF16LEncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUTF16LEncodingString + , swapped + ) + ); + + gMappings->put + ( + (void*)XMLUni::fgUTF16LEncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUTF16LEncodingString2 + , swapped + ) + ); + + gMappingsRecognizer->setElementAt(new EEndianNameMapFor(XMLUni::fgUCS4LEncodingString, swapped), XMLRecognizer::UCS_4L); + gMappings->put + ( + (void*)XMLUni::fgUCS4LEncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUCS4LEncodingString + , swapped + ) + ); + + gMappings->put + ( + (void*)XMLUni::fgUCS4LEncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUCS4LEncodingString2 + , swapped + ) + ); + + // + // Add in our mappings for UTF-16 and UCS-4, big endian + // + swapped = !XMLPlatformUtils::fgXMLChBigEndian; + + gMappingsRecognizer->setElementAt(new EEndianNameMapFor(XMLUni::fgUTF16BEncodingString, swapped), XMLRecognizer::UTF_16B); + gMappings->put + ( + (void*)XMLUni::fgUTF16BEncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUTF16BEncodingString + , swapped + ) + ); + + gMappings->put + ( + (void*)XMLUni::fgUTF16BEncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUTF16BEncodingString2 + , swapped + ) + ); + + gMappingsRecognizer->setElementAt(new EEndianNameMapFor(XMLUni::fgUCS4BEncodingString, swapped), XMLRecognizer::UCS_4B); + gMappings->put + ( + (void*)XMLUni::fgUCS4BEncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUCS4BEncodingString + , swapped + ) + ); + + gMappings->put + ( + (void*)XMLUni::fgUCS4BEncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUCS4BEncodingString2 + , swapped + ) + ); + + // + // Add in our mappings for UTF-16 and UCS-4 which does not indicate endian + // assumes the same endian encoding as the OS + // + + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString2 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString3, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString3 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString4, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString4 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString5, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString5 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString6, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString6 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUTF16EncodingString7, + new EEndianNameMapFor + ( + XMLUni::fgUTF16EncodingString7 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString, + new EEndianNameMapFor + ( + XMLUni::fgUCS4EncodingString + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString2, + new EEndianNameMapFor + ( + XMLUni::fgUCS4EncodingString2 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString3, + new EEndianNameMapFor + ( + XMLUni::fgUCS4EncodingString3 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString4, + new EEndianNameMapFor + ( + XMLUni::fgUCS4EncodingString4 + , false + ) + ); + gMappings->put + ( + (void*)XMLUni::fgUCS4EncodingString5, + new EEndianNameMapFor + ( + XMLUni::fgUCS4EncodingString5 + , false + ) + ); + + // + // Add in our mappings for IBM037, and the one alias we support for + // it, which is EBCDIC-CP-US. + // + gMappingsRecognizer->setElementAt(new ENameMapFor(XMLUni::fgEBCDICEncodingString), XMLRecognizer::EBCDIC); + gMappings->put((void*)XMLUni::fgIBM037EncodingString, new ENameMapFor(XMLUni::fgIBM037EncodingString)); + gMappings->put((void*)XMLUni::fgIBM037EncodingString2, new ENameMapFor(XMLUni::fgIBM037EncodingString2)); + + + //hhe + gMappings->put((void*)XMLUni::fgIBM1047EncodingString, new ENameMapFor(XMLUni::fgIBM1047EncodingString)); + gMappings->put((void*)XMLUni::fgIBM1047EncodingString2, new ENameMapFor(XMLUni::fgIBM1047EncodingString2)); + + // + // Add in our mappings for IBM037 with Euro update, i.e. IBM1140. It + // has alias IBM01140, the one suggested by IANA + // + gMappings->put((void*)XMLUni::fgIBM1140EncodingString, new ENameMapFor(XMLUni::fgIBM1140EncodingString)); + gMappings->put((void*)XMLUni::fgIBM1140EncodingString2, new ENameMapFor(XMLUni::fgIBM1140EncodingString2)); + gMappings->put((void*)XMLUni::fgIBM1140EncodingString3, new ENameMapFor(XMLUni::fgIBM1140EncodingString3)); + gMappings->put((void*)XMLUni::fgIBM1140EncodingString4, new ENameMapFor(XMLUni::fgIBM1140EncodingString4)); + + // + // Add in our mappings for Windows-1252. We don't have any aliases for + // this one, so there is just one mapping. + // + gMappings->put((void*)XMLUni::fgWin1252EncodingString, new ENameMapFor(XMLUni::fgWin1252EncodingString)); + +} + +// --------------------------------------------------------------------------- +// XMLTransService: IANA encoding setting +// --------------------------------------------------------------------------- +void XMLTransService::strictIANAEncoding(const bool newState) +{ + gStrictIANAEncoding = newState; +} + +bool XMLTransService::isStrictIANAEncoding() +{ + return gStrictIANAEncoding; +} + +// --------------------------------------------------------------------------- +// XMLTranscoder: Public Destructor +// --------------------------------------------------------------------------- +XMLTranscoder::~XMLTranscoder() +{ + fMemoryManager->deallocate(fEncodingName);//delete [] fEncodingName; +} + + +// --------------------------------------------------------------------------- +// XMLTranscoder: Hidden Constructors +// --------------------------------------------------------------------------- +XMLTranscoder::XMLTranscoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + fBlockSize(blockSize) + , fEncodingName(0) + , fMemoryManager(manager) +{ + fEncodingName = XMLString::replicate(encodingName, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// XMLTranscoder: Protected helpers +// --------------------------------------------------------------------------- + + +// --------------------------------------------------------------------------- +// XMLLCPTranscoder: Public Destructor +// --------------------------------------------------------------------------- +XMLLCPTranscoder::XMLLCPTranscoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLLCPTranscoder: Hidden Constructors +// --------------------------------------------------------------------------- +XMLLCPTranscoder::~XMLLCPTranscoder() +{ +} + +// --------------------------------------------------------------------------- +// TranscodeToStr: Public constructors and destructor +// --------------------------------------------------------------------------- +TranscodeToStr::TranscodeToStr(const XMLCh *in, const char *encoding, + MemoryManager *manager) + : fString(0), + fBytesWritten(0), + fMemoryManager(manager) +{ + XMLTransService::Codes failReason; + const XMLSize_t blockSize = 2048; + + XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor(encoding, failReason, blockSize, fMemoryManager); + Janitor janTrans(trans); + + transcode(in, XMLString::stringLen(in), trans); +} + +TranscodeToStr::TranscodeToStr(const XMLCh *in, XMLSize_t length, const char *encoding, + MemoryManager *manager) + : fString(0), + fBytesWritten(0), + fMemoryManager(manager) +{ + XMLTransService::Codes failReason; + const XMLSize_t blockSize = 2048; + + XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor(encoding, failReason, blockSize, fMemoryManager); + Janitor janTrans(trans); + + transcode(in, length, trans); +} + +TranscodeToStr::TranscodeToStr(const XMLCh *in, XMLTranscoder* trans, + MemoryManager *manager) + : fString(0), + fBytesWritten(0), + fMemoryManager(manager) +{ + transcode(in, XMLString::stringLen(in), trans); +} + +TranscodeToStr::TranscodeToStr(const XMLCh *in, XMLSize_t length, XMLTranscoder* trans, + MemoryManager *manager) + : fString(0), + fBytesWritten(0), + fMemoryManager(manager) +{ + transcode(in, length, trans); +} + +TranscodeToStr::~TranscodeToStr() +{ + if(fString) + fMemoryManager->deallocate(fString); +} + +// --------------------------------------------------------------------------- +// TranscodeToStr: Private helper methods +// --------------------------------------------------------------------------- +void TranscodeToStr::transcode(const XMLCh *in, XMLSize_t len, XMLTranscoder* trans) +{ + if(!in) return; + + XMLSize_t allocSize = len * sizeof(XMLCh); + fString = (XMLByte*)fMemoryManager->allocate(allocSize); + + XMLSize_t charsRead = 0; + XMLSize_t charsDone = 0; + + while(true) { + fBytesWritten += trans->transcodeTo(in + charsDone, len - charsDone, + fString + fBytesWritten, allocSize - fBytesWritten, + charsRead, XMLTranscoder::UnRep_Throw); + if(charsRead == 0) + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, fMemoryManager); + + charsDone += charsRead; + + if(charsDone == len) break; + + allocSize *= 2; + XMLByte *newBuf = (XMLByte*)fMemoryManager->allocate(allocSize); + memcpy(newBuf, fString, fBytesWritten); + fMemoryManager->deallocate(fString); + fString = newBuf; + } + + // null terminate + if((fBytesWritten + 4) > allocSize) { + allocSize = fBytesWritten + 4; + XMLByte *newBuf = (XMLByte*)fMemoryManager->allocate(allocSize); + memcpy(newBuf, fString, fBytesWritten); + fMemoryManager->deallocate(fString); + fString = newBuf; + } + fString[fBytesWritten + 0] = 0; + fString[fBytesWritten + 1] = 0; + fString[fBytesWritten + 2] = 0; + fString[fBytesWritten + 3] = 0; +} + +// --------------------------------------------------------------------------- +// TranscodeFromStr: Public constructors and destructor +// --------------------------------------------------------------------------- +TranscodeFromStr::TranscodeFromStr(const XMLByte *data, XMLSize_t length, const char *encoding, + MemoryManager *manager) + : fString(0), + fCharsWritten(0), + fMemoryManager(manager) +{ + XMLTransService::Codes failReason; + const XMLSize_t blockSize = 2048; + + XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor(encoding, failReason, blockSize, fMemoryManager); + Janitor janTrans(trans); + + transcode(data, length, trans); +} + +TranscodeFromStr::TranscodeFromStr(const XMLByte *data, XMLSize_t length, XMLTranscoder *trans, + MemoryManager *manager) + : fString(0), + fCharsWritten(0), + fMemoryManager(manager) +{ + transcode(data, length, trans); +} + +TranscodeFromStr::~TranscodeFromStr() +{ + if(fString) + fMemoryManager->deallocate(fString); +} + +// --------------------------------------------------------------------------- +// TranscodeFromStr: Private helper methods +// --------------------------------------------------------------------------- +void TranscodeFromStr::transcode(const XMLByte *in, XMLSize_t length, XMLTranscoder *trans) +{ + if(!in) return; + + XMLSize_t allocSize = length + 1; + fString = (XMLCh*)fMemoryManager->allocate(allocSize * sizeof(XMLCh)); + + XMLSize_t csSize = length; + ArrayJanitor charSizes((unsigned char*)fMemoryManager->allocate(csSize * sizeof(unsigned char)), + fMemoryManager); + + XMLSize_t bytesRead = 0; + XMLSize_t bytesDone = 0; + + while(true) { + fCharsWritten += trans->transcodeFrom(in + bytesDone, length - bytesDone, + fString + fCharsWritten, allocSize - fCharsWritten, + bytesRead, charSizes.get()); + if(bytesRead == 0) + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, fMemoryManager); + + bytesDone += bytesRead; + if(bytesDone == length) break; + + allocSize *= 2; + XMLCh *newBuf = (XMLCh*)fMemoryManager->allocate(allocSize * sizeof(XMLCh)); + memcpy(newBuf, fString, fCharsWritten); + fMemoryManager->deallocate(fString); + fString = newBuf; + + if((allocSize - fCharsWritten) > csSize) { + csSize = allocSize - fCharsWritten; + charSizes.reset((unsigned char*)fMemoryManager->allocate(csSize * sizeof(unsigned char)), + fMemoryManager); + } + } + + // null terminate + if(fCharsWritten == allocSize) { + allocSize += 1; + XMLCh *newBuf = (XMLCh*)fMemoryManager->allocate(allocSize * sizeof(XMLCh)); + memcpy(newBuf, fString, fCharsWritten); + fMemoryManager->deallocate(fString); + fString = newBuf; + } + fString[fCharsWritten] = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/TransService.hpp b/project/jni/xerces/src/xercesc/util/TransService.hpp new file mode 100644 index 000000000..8c6a2ac11 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/TransService.hpp @@ -0,0 +1,708 @@ +/* + * 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: TransService.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TRANSSERVICE_HPP) +#define XERCESC_INCLUDE_GUARD_TRANSSERVICE_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Forward references +//class XMLPlatformUtils; +class XMLLCPTranscoder; +class XMLTranscoder; +class ENameMap; + + +// +// This class is an abstract base class which are used to abstract the +// transcoding services that Xerces uses. The parser's actual transcoding +// needs are small so it is desirable to allow different implementations +// to be provided. +// +// The transcoding service has to provide a couple of required string +// and character operations, but its most important service is the creation +// of transcoder objects. There are two types of transcoders, which are +// discussed below in the XMLTranscoder class' description. +// +class XMLUTIL_EXPORT XMLTransService : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // ----------------------------------------------------------------------- + enum Codes + { + Ok + , UnsupportedEncoding + , InternalFailure + , SupportFilesNotFound + }; + + struct TransRec + { + XMLCh intCh; + XMLByte extCh; + }; + + + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + virtual ~XMLTransService(); + + + // ----------------------------------------------------------------------- + // Non-virtual API + // ----------------------------------------------------------------------- + XMLTranscoder* makeNewTranscoderFor + ( + const XMLCh* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLTranscoder* makeNewTranscoderFor + ( + const char* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + XMLTranscoder* makeNewTranscoderFor + ( + XMLRecognizer::Encodings encodingEnum + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + // ----------------------------------------------------------------------- + // The virtual transcoding service API + // ----------------------------------------------------------------------- + virtual int compareIString + ( + const XMLCh* const comp1 + , const XMLCh* const comp2 + ) = 0; + + virtual int compareNIString + ( + const XMLCh* const comp1 + , const XMLCh* const comp2 + , const XMLSize_t maxChars + ) = 0; + + virtual const XMLCh* getId() const = 0; + + // ----------------------------------------------------------------------- + // Create a new transcoder for the local code page. + // + // @param manager The memory manager to use. + // ----------------------------------------------------------------------- + virtual XMLLCPTranscoder* makeNewLCPTranscoder(MemoryManager* manager) = 0; + + virtual bool supportsSrcOfs() const = 0; + + virtual void upperCase(XMLCh* const toUpperCase) = 0; + virtual void lowerCase(XMLCh* const toLowerCase) = 0; + + // ----------------------------------------------------------------------- + // Allow users to add their own encodings to the intrinsic mapping + // table + // Usage: + // XMLTransService::addEncoding ( + // gMyEncodingNameString + // , new ENameMapFor(gMyEncodingNameString) + // ); + // ----------------------------------------------------------------------- + static void addEncoding(const XMLCh* const encoding, ENameMap* const ownMapping); + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLTransService(); + + + // ----------------------------------------------------------------------- + // Protected virtual methods. + // ----------------------------------------------------------------------- +#ifdef OS390 + friend class Uniconv390TransService; +#endif + virtual XMLTranscoder* makeNewXMLTranscoder + ( + const XMLCh* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager + ) = 0; + + // ----------------------------------------------------------------------- + // Protected init method for platform utils to call + // ----------------------------------------------------------------------- + friend class XMLPlatformUtils; + virtual void initTransService(); + + // ----------------------------------------------------------------------- + // protected static members + // gMappings + // This is a hash table of ENameMap objects. It is created and filled + // in when the platform init calls our initTransService() method. + // + // gMappingsRecognizer + // This is an array of ENameMap objects, predefined for those + // already recognized by XMLRecognizer::Encodings. + // + + static RefHashTableOf* gMappings; + static RefVectorOf* gMappingsRecognizer; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLTransService(const XMLTransService&); + XMLTransService& operator=(const XMLTransService&); + + // ----------------------------------------------------------------------- + // Hidden method to enable/disable strict IANA encoding check + // Caller: XMLPlatformUtils + // ----------------------------------------------------------------------- + void strictIANAEncoding(const bool newState); + bool isStrictIANAEncoding(); + + friend class XMLInitializer; +}; + +/** + * XMLTranscoder is for transcoding non-local code + * page encodings, i.e. named encodings. These are used internally + * by the scanner to internalize raw XML into the internal Unicode + * format, and by writer classes to convert that internal Unicode + * format (which comes out of the parser) back out to a format that + * the receiving client code wants to use. + */ +class XMLUTIL_EXPORT XMLTranscoder : public XMemory +{ +public : + + /** + * This enum is used by the transcodeTo() method + * to indicate how to react to unrepresentable characters. The + * transcodeFrom() method always works the + * same. It will consider any invalid data to be an error and + * throw. + */ + enum UnRepOpts + { + UnRep_Throw /**< Throw an exception */ + , UnRep_RepChar /**< Use the replacement char */ + }; + + + /** @name Destructor. */ + //@{ + + /** + * Destructor for XMLTranscoder + * + */ + virtual ~XMLTranscoder(); + //@} + + + + /** @name The virtual transcoding interface */ + //@{ + + /** Converts from the encoding of the service to the internal XMLCh* encoding + * + * @param srcData the source buffer to be transcoded + * @param srcCount number of bytes in the source buffer + * @param toFill the destination buffer + * @param maxChars the max number of characters in the destination buffer + * @param bytesEaten after transcoding, this will hold the number of bytes + * that were processed from the source buffer + * @param charSizes an array which must be at least as big as maxChars + * into which will be inserted values that indicate how many + * bytes from the input went into each XMLCh that was created + * into toFill. Since many encodings use variable numbers of + * byte per character, this provides a means to find out what + * bytes in the input went into making a particular output + * UTF-16 character. + * @return Returns the number of chars put into the target buffer + */ + + + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ) = 0; + + /** Converts from the internal XMLCh* encoding to the encoding of the service + * + * @param srcData the source buffer to be transcoded + * @param srcCount number of characters in the source buffer + * @param toFill the destination buffer + * @param maxBytes the max number of bytes in the destination buffer + * @param charsEaten after transcoding, this will hold the number of chars + * that were processed from the source buffer + * @param options options to pass to the transcoder that explain how to + * respond to an unrepresentable character + * @return Returns the number of chars put into the target buffer + */ + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ) = 0; + + /** Query whether the transcoder can handle a given character + * + * @param toCheck the character code point to check + */ + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ) = 0; + + //@} + + /** @name Getter methods */ + //@{ + + /** Get the internal block size + * + * @return The block size indicated in the constructor. + */ + XMLSize_t getBlockSize() const; + + /** Get the encoding name + * + * @return the name of the encoding that this + * XMLTranscoder object is for + */ + const XMLCh* getEncodingName() const; + //@} + + /** @name Getter methods*/ + //@{ + + /** Get the plugged-in memory manager + * + * This method returns the plugged-in memory manager user for dynamic + * memory allocation/deallocation. + * + * @return the plugged-in memory manager + */ + MemoryManager* getMemoryManager() const; + + //@} + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLTranscoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + // ----------------------------------------------------------------------- + // Protected helper methods + // ----------------------------------------------------------------------- + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLTranscoder(const XMLTranscoder&); + XMLTranscoder& operator=(const XMLTranscoder&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fBlockSize + // This is the block size indicated in the constructor. + // + // fEncodingName + // This is the name of the encoding this encoder is for. All basic + // XML transcoder's are for named encodings. + // ----------------------------------------------------------------------- + XMLSize_t fBlockSize; + XMLCh* fEncodingName; + MemoryManager* fMemoryManager; +}; + + +// +// This class is a specialized transcoder that only transcodes between +// the internal XMLCh format and the local code page. It is specialized +// for the very common job of translating data from the client app's +// native code page to the internal format and vice versa. +// +class XMLUTIL_EXPORT XMLLCPTranscoder : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + virtual ~XMLLCPTranscoder(); + + + // ----------------------------------------------------------------------- + // The virtual transcoder API + // + // NOTE: All these APIs don't include null terminator characters in + // their parameters. So calcRequiredSize() returns the number + // of actual chars, not including the null. maxBytes and maxChars + // parameters refer to actual chars, not including the null so + // its assumed that the buffer is physically one char or byte + // larger. + // ----------------------------------------------------------------------- + + // ----------------------------------------------------------------------- + // The 'normal' way to transcode a XMLCh-string from/to local string + // representation + // + // NOTE: Both methods return a string allocated via the MemoryManager. + // It is the responsibility of the calling environment to + // release this string after use. + // ----------------------------------------------------------------------- + virtual char* transcode(const XMLCh* const toTranscode, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + virtual XMLCh* transcode(const char* const toTranscode, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + + // ----------------------------------------------------------------------- + // DEPRECATED old transcode interface + // ----------------------------------------------------------------------- + virtual XMLSize_t calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + virtual XMLSize_t calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; + + virtual bool transcode + ( + const char* const toTranscode + , XMLCh* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + virtual bool transcode + ( + const XMLCh* const toTranscode + , char* const toFill + , const XMLSize_t maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLLCPTranscoder(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLLCPTranscoder(const XMLLCPTranscoder&); + XMLLCPTranscoder& operator=(const XMLLCPTranscoder&); +}; + +// +// This class can be used to transcode to a target encoding. It manages the +// memory allocated for the transcode in an exception safe manner, automatically +// deleting it when the class goes out of scope. +// +class XMLUTIL_EXPORT TranscodeToStr +{ +public: + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + + /** Converts from the internal XMLCh* encoding to the specified encoding + * + * @param in the null terminated source buffer to be transcoded + * @param encoding the name of the encoding to transcode to + * @param manager the memory manager to use + */ + TranscodeToStr(const XMLCh *in, const char *encoding, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + /** Converts from the internal XMLCh* encoding to the specified encoding + * + * @param in the source buffer to be transcoded + * @param length the length of the source buffer + * @param encoding the name of the encoding to transcode to + * @param manager the memory manager to use + */ + TranscodeToStr(const XMLCh *in, XMLSize_t length, const char *encoding, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + /** Converts from the internal XMLCh* encoding to the specified encoding + * + * @param in the null terminated source buffer to be transcoded + * @param trans the transcoder to use + * @param manager the memory manager to use + */ + TranscodeToStr(const XMLCh *in, XMLTranscoder* trans, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + /** Converts from the internal XMLCh* encoding to the specified encoding + * + * @param in the source buffer to be transcoded + * @param length the length of the source buffer + * @param trans the transcoder to use + * @param manager the memory manager to use + */ + TranscodeToStr(const XMLCh *in, XMLSize_t length, XMLTranscoder* trans, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + ~TranscodeToStr(); + + /** @name Getter methods */ + //@{ + + /** Returns the transcoded, null terminated string + * @return the transcoded string + */ + const XMLByte *str() const; + + /** Returns the transcoded, null terminated string - adopting + * the memory allocated to it from the TranscodeToStr object + * @return the transcoded string + */ + XMLByte *adopt(); + + /** Returns the length of the transcoded string in bytes. The length + * does not include the null terminator. + * @return the length of the transcoded string in bytes + */ + XMLSize_t length () const; + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + TranscodeToStr(const TranscodeToStr &); + TranscodeToStr &operator=(const TranscodeToStr &); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void transcode(const XMLCh *in, XMLSize_t len, XMLTranscoder* trans); + + // ----------------------------------------------------------------------- + // Private data members + // + // fString + // The transcoded string + // + // fBytesWritten + // The length of the transcoded string in bytes + // ----------------------------------------------------------------------- + XMLByte *fString; + XMLSize_t fBytesWritten; + MemoryManager *fMemoryManager; +}; + +// +// This class can be used to transcode from a source encoding. It manages the +// memory allocated for the transcode in an exception safe manner, automatically +// deleting it when the class goes out of scope. +// +class XMLUTIL_EXPORT TranscodeFromStr +{ +public: + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + + /** Converts from the specified encoding to the internal XMLCh* encoding + * + * @param data the source buffer to be transcoded + * @param length the length of the source buffer + * @param encoding the name of the encoding to transcode to + * @param manager the memory manager to use + */ + TranscodeFromStr(const XMLByte *data, XMLSize_t length, const char *encoding, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + /** Converts from the specified encoding to the internal XMLCh* encoding + * + * @param data the source buffer to be transcoded + * @param length the length of the source buffer + * @param trans the transcoder to use + * @param manager the memory manager to use + */ + TranscodeFromStr(const XMLByte *data, XMLSize_t length, XMLTranscoder *trans, + MemoryManager *manager = XMLPlatformUtils::fgMemoryManager); + + ~TranscodeFromStr(); + + /** @name Getter methods */ + //@{ + + /** Returns the transcoded, null terminated string + * @return the transcoded string + */ + const XMLCh *str() const; + + /** Returns the transcoded, null terminated string - adopting + * the memory allocated to it from the TranscodeFromStr object + * @return the transcoded string + */ + XMLCh *adopt(); + + /** Returns the length of the transcoded string in characters. The length + * does not include the null terminator. + * @return the length of the transcoded string in characters + */ + XMLSize_t length() const; + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + TranscodeFromStr(const TranscodeFromStr &); + TranscodeFromStr &operator=(const TranscodeFromStr &); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void transcode(const XMLByte *in, XMLSize_t length, XMLTranscoder *trans); + + // ----------------------------------------------------------------------- + // Private data members + // + // fString + // The transcoded string + // + // fBytesWritten + // The length of the transcoded string in characters + // ----------------------------------------------------------------------- + XMLCh *fString; + XMLSize_t fCharsWritten; + MemoryManager *fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XMLTranscoder: Getter methods +// --------------------------------------------------------------------------- +inline MemoryManager* XMLTranscoder::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// XMLTranscoder: Protected helper methods +// --------------------------------------------------------------------------- +inline XMLSize_t XMLTranscoder::getBlockSize() const +{ + return fBlockSize; +} + +inline const XMLCh* XMLTranscoder::getEncodingName() const +{ + return fEncodingName; +} + +// --------------------------------------------------------------------------- +// TranscodeToStr: Getter methods +// --------------------------------------------------------------------------- +inline const XMLByte *TranscodeToStr::str() const +{ + return fString; +} + +inline XMLByte *TranscodeToStr::adopt() +{ + XMLByte *tmp = fString; + fString = 0; + return tmp; +} + +inline XMLSize_t TranscodeToStr::length () const +{ + return fBytesWritten; +} + +// --------------------------------------------------------------------------- +// TranscodeFromStr: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh *TranscodeFromStr::str() const +{ + return fString; +} + +inline XMLCh *TranscodeFromStr::adopt() +{ + XMLCh *tmp = fString; + fString = 0; + return tmp; +} + +inline XMLSize_t TranscodeFromStr::length() const +{ + return fCharsWritten; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp b/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp new file mode 100644 index 000000000..fe22fdb42 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp @@ -0,0 +1,1140 @@ +/* + * 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: IconvGNUTransService.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if HAVE_CONFIG_H + #include +#endif + +#include + +#include +#include + +#if HAVE_ENDIAN_H + #include +#elif HAVE_MACHINE_ENDIAN_H + #include +#elif HAVE_ARPA_NAMESER_COMPAT_H + #include +#endif + +#define MAX_UCHSIZE 4 + +//-------------------------------------------------- +// Macro-definitions to translate "native unicode" +// characters <-> XMLCh with different host byte order +// and encoding schemas. + +# if BYTE_ORDER == LITTLE_ENDIAN +# define IXMLCh2WC16(x,w) \ + *(w) = ((*(x)) >> 8) & 0xFF; \ + *((w)+1) = (*(x)) & 0xFF +# define IWC162XMLCh(w,x) *(x) = ((*(w)) << 8) | (*((w)+1)) +# define XMLCh2WC16(x,w) \ + *(w) = (*(x)) & 0xFF; \ + *((w)+1) = ((*(x)) >> 8) & 0xFF +# define WC162XMLCh(w,x) *(x) = ((*((w)+1)) << 8) | (*(w)) + +# define IXMLCh2WC32(x,w) \ + *(w) = ((*(x)) >> 24) & 0xFF; \ + *((w)+1) = ((*(x)) >> 16) & 0xFF; \ + *((w)+2) = ((*(x)) >> 8) & 0xFF; \ + *((w)+3) = (*(x)) & 0xFF +# define IWC322XMLCh(w,x) \ + *(x) = ((*(w)) << 24) | ((*((w)+1)) << 16) | \ + ((*((w)+2)) << 8) | (*((w)+3)) +# define XMLCh2WC32(x,w) \ + *((w)+3) = ((*(x)) >> 24) & 0xFF; \ + *((w)+2) = ((*(x)) >> 16) & 0xFF; \ + *((w)+1) = ((*(x)) >> 8) & 0xFF; \ + *(w) = (*(x)) & 0xFF +# define WC322XMLCh(w,x) \ + *(x) = ((*((w)+3)) << 24) | ((*((w)+2)) << 16) | \ + ((*((w)+1)) << 8) | (*(w)) + +# else /* BYTE_ORDER != LITTLE_ENDIAN */ + +# define XMLCh2WC16(x,w) \ + *(w) = ((*(x)) >> 8) & 0xFF; \ + *((w)+1) = (*(x)) & 0xFF +# define WC162XMLCh(w,x) *(x) = ((*(w)) << 8) | (*((w)+1)) +# define IXMLCh2WC16(x,w) \ + *(w) = (*(x)) & 0xFF; \ + *((w)+1) = ((*(x)) >> 8) & 0xFF +# define IWC162XMLCh(w,x) *(x) = ((*((w)+1)) << 8) | (*(w)) + +# define XMLCh2WC32(x,w) \ + *(w) = ((*(x)) >> 24) & 0xFF; \ + *((w)+1) = ((*(x)) >> 16) & 0xFF; \ + *((w)+2) = ((*(x)) >> 8) & 0xFF; \ + *((w)+3) = (*(x)) & 0xFF +# define WC322XMLCh(w,x) \ + *(x) = ((*(w)) << 24) | ((*((w)+1)) << 16) | \ + ((*((w)+2)) << 8) | (*((w)+3)) +# define IXMLCh2WC32(x,w) \ + *((w)+3) = ((*(x)) >> 24) & 0xFF; \ + *((w)+2) = ((*(x)) >> 16) & 0xFF; \ + *((w)+1) = ((*(x)) >> 8) & 0xFF; \ + *(w) = (*(x)) & 0xFF +# define IWC322XMLCh(w,x) \ + *(x) = ((*((w)+3)) << 24) | ((*((w)+2)) << 16) | \ + ((*((w)+1)) << 8) | (*(w)) +# endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "IconvGNUTransService.hpp" + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Description of encoding schemas, supported by iconv() +// --------------------------------------------------------------------------- +typedef struct __IconvGNUEncoding { + const char* fSchema; // schema name + size_t fUChSize; // size of the character + unsigned int fUBO; // byte order, relative to the host +} IconvGNUEncoding; + +static const IconvGNUEncoding gIconvGNUEncodings[] = { + { "UTF-16LE", 2, LITTLE_ENDIAN }, + { "UTF-16BE", 2, BIG_ENDIAN }, + { "UCS-2LE", 2, LITTLE_ENDIAN }, + { "UCS-2BE", 2, BIG_ENDIAN }, + { "UCS-2-INTERNAL", 2, BYTE_ORDER }, + { NULL, 0, 0 } +}; + +// --------------------------------------------------------------------------- +// Local, const data +// --------------------------------------------------------------------------- +static const unsigned int gTempBuffArraySize = 4096; +static const XMLCh gMyServiceId[] = +{ + chLatin_I, chLatin_C, chLatin_o, chLatin_n, chLatin_v, chNull +}; + + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- +static XMLSize_t getWideCharLength(const XMLCh* const src) +{ + if (!src) + return 0; + + XMLSize_t len = 0; + const XMLCh* pTmp = src; + while (*pTmp++) + len++; + return len; +} + + +//---------------------------------------------------------------------------- +// There is implementation of the libiconv for FreeBSD (available through the +// ports collection). The following is a wrapper around the iconv(). +//---------------------------------------------------------------------------- + +IconvGNUWrapper::IconvGNUWrapper (MemoryManager* manager) + : fUChSize(0), fUBO(LITTLE_ENDIAN), + fCDTo((iconv_t)-1), fCDFrom((iconv_t)-1), fMutex(manager) +{ +} + +IconvGNUWrapper::IconvGNUWrapper ( iconv_t cd_from, + iconv_t cd_to, + size_t uchsize, + unsigned int ubo, + MemoryManager* manager) + : fUChSize(uchsize), fUBO(ubo), + fCDTo(cd_to), fCDFrom(cd_from), fMutex(manager) +{ + if (fCDFrom == (iconv_t) -1 || fCDTo == (iconv_t) -1) { + XMLPlatformUtils::panic (PanicHandler::Panic_NoTransService); + } +} + +IconvGNUWrapper::~IconvGNUWrapper() +{ +} + +// Convert "native unicode" character into XMLCh +void IconvGNUWrapper::mbcToXMLCh (const char *mbc, XMLCh *toRet) const +{ + if (fUBO == BYTE_ORDER) { + if (fUChSize == sizeof(XMLCh)) + *toRet = *((XMLCh*) mbc); + else if (fUChSize == 2) { + WC162XMLCh( mbc, toRet ); + } else { + WC322XMLCh( mbc, toRet ); + } + } else { + if (fUChSize == 2) { + IWC162XMLCh( mbc, toRet ); + } else { + IWC322XMLCh( mbc, toRet ); + } + } +} + +// Convert XMLCh into "native unicode" character +void IconvGNUWrapper::xmlChToMbc (XMLCh xch, char *mbc) const +{ + if (fUBO == BYTE_ORDER) { + if (fUChSize == sizeof(XMLCh)) { + memcpy (mbc, &xch, fUChSize); + return; + } + if (fUChSize == 2) { + XMLCh2WC16( &xch, mbc ); + } else { + XMLCh2WC32( &xch, mbc ); + } + } else { + if (fUChSize == 2) { + IXMLCh2WC16( &xch, mbc ); + } else { + IXMLCh2WC32( &xch, mbc ); + } + } +} + +// Return uppercase equivalent for XMLCh +XMLCh IconvGNUWrapper::toUpper (const XMLCh ch) +{ + if (ch <= 0x7F) + return toupper(ch); + + char wcbuf[MAX_UCHSIZE * 2]; + xmlChToMbc (ch, wcbuf); + + char tmpArr[4]; +#if ICONV_USES_CONST_POINTER + const char* ptr = wcbuf; +#else + char* ptr = wcbuf; +#endif + size_t len = fUChSize; + char *pTmpArr = tmpArr; + size_t bLen = 2; + + if (::iconv (fCDTo, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1) + return 0; + tmpArr[1] = toupper (*((unsigned char *)tmpArr)); + *tmpArr = tmpArr[1]; + len = 1; + pTmpArr = wcbuf; + bLen = fUChSize; + ptr = tmpArr; + if (::iconv (fCDFrom, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1) + return 0; + mbcToXMLCh (wcbuf, (XMLCh*) &ch); + return ch; +} + +// Return lowercase equivalent for XMLCh +XMLCh IconvGNUWrapper::toLower (const XMLCh ch) +{ + if (ch <= 0x7F) + return tolower(ch); + + char wcbuf[MAX_UCHSIZE * 2]; + xmlChToMbc (ch, wcbuf); + + char tmpArr[4]; +#if ICONV_USES_CONST_POINTER + const char* ptr = wcbuf; +#else + char* ptr = wcbuf; +#endif + size_t len = fUChSize; + char *pTmpArr = tmpArr; + size_t bLen = 2; + + if (::iconv (fCDTo, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1) + return 0; + tmpArr[1] = tolower (*((unsigned char*)tmpArr)); + *tmpArr = tmpArr[1]; + len = 1; + pTmpArr = wcbuf; + bLen = fUChSize; + ptr = tmpArr; + if (::iconv (fCDFrom, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1) + return 0; + mbcToXMLCh (wcbuf, (XMLCh*) &ch); + return ch; +} + +// Fill array of XMLCh characters with data, supplyed in the array +// of "native unicode" characters. +XMLCh* IconvGNUWrapper::mbsToXML +( + const char* mbs_str + , XMLCh* xml_str + , size_t cnt +) const +{ + if (mbs_str == NULL || xml_str == NULL || cnt == 0) + return NULL; + if (fUBO == BYTE_ORDER) { + if (fUChSize == sizeof(XMLCh)) { + // null-transformation + memcpy (xml_str, mbs_str, fUChSize * cnt); + return xml_str; + } + if (fUChSize == 2) + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize) { + WC162XMLCh( mbs_str, xml_str + i); + } + else + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize) { + WC322XMLCh( mbs_str, xml_str + i ); + } + } else { + if (fUChSize == 2) + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize) { + IWC162XMLCh( mbs_str, xml_str + i ); + } + else + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize) { + IWC322XMLCh( mbs_str, xml_str + i ); + } + } + return xml_str; +} + +// Fill array of "native unicode" characters with data, supplyed +// in the array of XMLCh characters. +char* IconvGNUWrapper::xmlToMbs +( + const XMLCh* xml_str + , char* mbs_str + , size_t cnt +) const +{ + if (mbs_str == NULL || xml_str == NULL || cnt == 0) + return NULL; + char *toReturn = mbs_str; + if (fUBO == BYTE_ORDER) { + if (fUChSize == sizeof(XMLCh)) { + // null-transformation + memcpy (mbs_str, xml_str, fUChSize * cnt); + return toReturn; + } + if (fUChSize == 2) + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize, xml_str++) { + XMLCh2WC16( xml_str, mbs_str ); + } + else + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize, xml_str++) { + XMLCh2WC32( xml_str, mbs_str ); + } + } else { + if (fUChSize == 2) + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize, xml_str++) { + IXMLCh2WC16( xml_str, mbs_str ); + } + else + for (size_t i = 0; i < cnt; i++, mbs_str += fUChSize, xml_str++) { + IXMLCh2WC32( xml_str, mbs_str ); + } + } + return toReturn; +} + +size_t IconvGNUWrapper::iconvFrom ( const char *fromPtr, + size_t *fromLen, + char **toPtr, + size_t toLen ) +{ +#if ICONV_USES_CONST_POINTER + const char ** tmpPtr = &fromPtr; +#else + char ** tmpPtr = (char**)&fromPtr; +#endif + return ::iconv (fCDFrom, tmpPtr, fromLen, toPtr, &toLen); +} + +size_t IconvGNUWrapper::iconvTo ( const char *fromPtr, + size_t *fromLen, + char **toPtr, + size_t toLen ) +{ +#if ICONV_USES_CONST_POINTER + const char ** tmpPtr = &fromPtr; +#else + char ** tmpPtr = (char**)&fromPtr; +#endif + return ::iconv (fCDTo, tmpPtr, fromLen, toPtr, &toLen); +} + + +// --------------------------------------------------------------------------- +// IconvGNUTransService: Constructors and Destructor +// --------------------------------------------------------------------------- + +IconvGNUTransService::IconvGNUTransService(MemoryManager* manager) + : IconvGNUWrapper(manager), fUnicodeCP(0) +{ + // Try to obtain local (host) characterset from the setlocale + // and through the environment. Do not call setlocale(LC_*, "")! + // Using an empty string instead of NULL, will modify the libc + // behavior. + // + const char* fLocalCP = setlocale (LC_CTYPE, NULL); + if (fLocalCP == NULL || *fLocalCP == 0 || + strcmp (fLocalCP, "C") == 0 || + strcmp (fLocalCP, "POSIX") == 0) { + fLocalCP = getenv ("LC_ALL"); + if (fLocalCP == NULL) { + fLocalCP = getenv ("LC_CTYPE"); + if (fLocalCP == NULL) + fLocalCP = getenv ("LANG"); + } + } + + if (fLocalCP == NULL || *fLocalCP == 0 || + strcmp (fLocalCP, "C") == 0 || + strcmp (fLocalCP, "POSIX") == 0) + fLocalCP = "iso-8859-1"; // fallback locale + else { + const char *ptr = strchr (fLocalCP, '.'); + if (ptr == NULL) + fLocalCP = "iso-8859-1"; // fallback locale + else + fLocalCP = ptr + 1; + } + + // Select the native unicode characters encoding schema + const IconvGNUEncoding *eptr; + // first - try to use the schema with character size equal to XMLCh, and same endianness + for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++) + { + if (eptr->fUChSize != sizeof(XMLCh) || eptr->fUBO != BYTE_ORDER) + continue; + + // try to create conversion descriptor + iconv_t cd_to = iconv_open(fLocalCP, eptr->fSchema); + if (cd_to == (iconv_t)-1) + continue; + iconv_t cd_from = iconv_open(eptr->fSchema, fLocalCP); + if (cd_from == (iconv_t)-1) { + iconv_close (cd_to); + continue; + } + + // got it + setUChSize(eptr->fUChSize); + setUBO(eptr->fUBO); + setCDTo(cd_to); + setCDFrom(cd_from); + fUnicodeCP = eptr->fSchema; + break; + } + if (fUnicodeCP == NULL) + // try to use any known schema + for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++) + { + // try to create conversion descriptor + iconv_t cd_to = iconv_open(fLocalCP, eptr->fSchema); + if (cd_to == (iconv_t)-1) + continue; + iconv_t cd_from = iconv_open(eptr->fSchema, fLocalCP); + if (cd_from == (iconv_t)-1) { + iconv_close (cd_to); + continue; + } + + // got it + setUChSize(eptr->fUChSize); + setUBO(eptr->fUBO); + setCDTo(cd_to); + setCDFrom(cd_from); + fUnicodeCP = eptr->fSchema; + break; + } + + if (fUnicodeCP == NULL || cdTo() == (iconv_t)-1 || cdFrom() == (iconv_t)-1) + XMLPlatformUtils::panic (PanicHandler::Panic_NoTransService); +} + +IconvGNUTransService::~IconvGNUTransService() +{ + if (cdTo() != (iconv_t) -1) { + iconv_close (cdTo()); + setCDTo ((iconv_t)-1); + } + if (cdFrom() != (iconv_t) -1) { + iconv_close (cdFrom()); + setCDFrom ((iconv_t)-1); + } +} + +// --------------------------------------------------------------------------- +// IconvGNUTransService: The virtual transcoding service API +// --------------------------------------------------------------------------- +int IconvGNUTransService::compareIString(const XMLCh* const comp1 + , const XMLCh* const comp2) +{ + const XMLCh* cptr1 = comp1; + const XMLCh* cptr2 = comp2; + + XMLMutexLock lockConverter(&fMutex); + + XMLCh c1 = toUpper(*cptr1); + XMLCh c2 = toUpper(*cptr2); + while ( (*cptr1 != 0) && (*cptr2 != 0) ) { + if (c1 != c2) + break; + c1 = toUpper(*(++cptr1)); + c2 = toUpper(*(++cptr2)); + + } + return (int) ( c1 - c2 ); +} + + +int IconvGNUTransService::compareNIString(const XMLCh* const comp1 + , const XMLCh* const comp2 + , const XMLSize_t maxChars) +{ + unsigned int n = 0; + const XMLCh* cptr1 = comp1; + const XMLCh* cptr2 = comp2; + + XMLMutexLock lockConverter(&fMutex); + + while (true && maxChars) + { + XMLCh c1 = toUpper(*cptr1); + XMLCh c2 = toUpper(*cptr2); + + if (c1 != c2) + return (int) (c1 - c2); + + // If either ended, then both ended, so equal + if (!*cptr1 || !*cptr2) + break; + + cptr1++; + cptr2++; + + // Bump the count of chars done. If it equals the count then we + // are equal for the requested count, so break out and return + // equal. + n++; + if (n == maxChars) + break; + } + + return 0; +} + + +const XMLCh* IconvGNUTransService::getId() const +{ + return gMyServiceId; +} + +XMLLCPTranscoder* IconvGNUTransService::makeNewLCPTranscoder(MemoryManager* manager) +{ + return new (manager) IconvGNULCPTranscoder (cdFrom(), cdTo(), uChSize(), UBO(), manager); +} + +bool IconvGNUTransService::supportsSrcOfs() const +{ + return true; +} + +// --------------------------------------------------------------------------- +// IconvGNUTransService: The protected virtual transcoding service API +// --------------------------------------------------------------------------- +XMLTranscoder* +IconvGNUTransService::makeNewXMLTranscoder +( + const XMLCh* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager +) +{ + resValue = XMLTransService::UnsupportedEncoding; + IconvGNUTranscoder *newTranscoder = NULL; + + char *encLocal = XMLString::transcode(encodingName, manager); + ArrayJanitor janBuf(encLocal, manager); + iconv_t cd_from, cd_to; + + cd_from = iconv_open (fUnicodeCP, encLocal); + if (cd_from == (iconv_t)-1) { + resValue = XMLTransService::SupportFilesNotFound; + return NULL; + } + cd_to = iconv_open (encLocal, fUnicodeCP); + if (cd_to == (iconv_t)-1) { + resValue = XMLTransService::SupportFilesNotFound; + iconv_close (cd_from); + return NULL; + } + newTranscoder = new (manager) IconvGNUTranscoder (encodingName, + blockSize, + cd_from, cd_to, + uChSize(), UBO(), manager); + if (newTranscoder) + resValue = XMLTransService::Ok; + return newTranscoder; +} + +void IconvGNUTransService::upperCase(XMLCh* const toUpperCase) +{ + XMLCh* outPtr = toUpperCase; + + XMLMutexLock lockConverter(&fMutex); + + while (*outPtr) + { + *outPtr = toUpper(*outPtr); + outPtr++; + } +} + +void IconvGNUTransService::lowerCase(XMLCh* const toLowerCase) +{ + XMLCh* outPtr = toLowerCase; + + XMLMutexLock lockConverter(&fMutex); + + while (*outPtr) + { + *outPtr = toLower(*outPtr); + outPtr++; + } +} + +// --------------------------------------------------------------------------- +// IconvGNULCPTranscoder: The virtual transcoder API +// --------------------------------------------------------------------------- +XMLSize_t IconvGNULCPTranscoder::calcRequiredSize (const char* const srcText + , MemoryManager* const manager) +{ + if (!srcText) + return 0; + + size_t len, srcLen; + len = srcLen = strlen(srcText); + if (len == 0) + return 0; + + char tmpWideArr[gTempBuffArraySize]; + size_t totalLen = 0; + + XMLMutexLock lockConverter(&fMutex); + + for (;;) { + char *pTmpArr = tmpWideArr; + const char *ptr = srcText + srcLen - len; + size_t rc = iconvFrom(ptr, &len, &pTmpArr, gTempBuffArraySize); + if (rc == (size_t) -1 && errno != E2BIG) { + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); + /* return 0; */ + } + rc = pTmpArr - (char *) tmpWideArr; + totalLen += rc; + if (rc == 0 || len == 0) + break; + } + return totalLen / uChSize(); +} + + +XMLSize_t IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) +{ + if (!srcText) + return 0; + XMLSize_t wLent = getWideCharLength(srcText); + if (wLent == 0) + return 0; + + char tmpWBuff[gTempBuffArraySize]; + char *wBuf = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, manager); + size_t len = wLent * uChSize(); + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) manager->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, manager); + wBuf = wBufPtr; + } else + wBuf = tmpWBuff; + xmlToMbs (srcText, wBuf, wLent); + } else + wBuf = (char *) srcText; + + char tmpBuff[gTempBuffArraySize]; + size_t totalLen = 0; + char *srcEnd = wBuf + wLent * uChSize(); + + XMLMutexLock lockConverter(&fMutex); + + for (;;) { + char *pTmpArr = tmpBuff; + const char *ptr = srcEnd - len; + size_t rc = iconvTo(ptr, &len, &pTmpArr, gTempBuffArraySize); + if (rc == (size_t) -1 && errno != E2BIG) { + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); + /* return 0; */ + } + rc = pTmpArr - tmpBuff; + totalLen += rc; + if (rc == 0 || len == 0) + break; + } + return totalLen; +} + + +char* IconvGNULCPTranscoder::transcode(const XMLCh* const toTranscode, + MemoryManager* const manager) +{ + if (!toTranscode) + return 0; + + char* retVal = 0; + if (!*toTranscode) { + retVal = (char*) manager->allocate(sizeof(char));//new char[1]; + retVal[0] = 0; + return retVal; + } + + XMLSize_t wLent = getWideCharLength(toTranscode); + + // Calc needed size. + XMLSize_t neededLen = calcRequiredSize (toTranscode, manager); + if (neededLen == 0) + return 0; + // allocate output buffer + retVal = (char*) manager->allocate((neededLen + 1) * sizeof(char));//new char[neededLen + 1]; + // prepare the original + char tmpWBuff[gTempBuffArraySize]; + char *wideCharBuf = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, manager); + size_t len = wLent * uChSize(); + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) manager->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, manager); + wideCharBuf = wBufPtr; + } else + wideCharBuf = tmpWBuff; + xmlToMbs (toTranscode, wideCharBuf, wLent); + } else + wideCharBuf = (char *) toTranscode; + + // perform conversion + char* ptr = retVal; + size_t rc; + + { + XMLMutexLock lockConverter(&fMutex); + rc = iconvTo(wideCharBuf, &len, &ptr, neededLen); + } + + if (rc == (size_t)-1) { + return 0; + } + retVal[neededLen] = 0; + + return retVal; +} + + +bool IconvGNULCPTranscoder::transcode( const XMLCh* const toTranscode + , char* const toFill + , const XMLSize_t maxBytes + , MemoryManager* const manager) +{ + // Watch for a couple of pyscho corner cases + if (!toTranscode || !maxBytes) { + toFill[0] = 0; + return true; + } + if (!*toTranscode) { + toFill[0] = 0; + return true; + } + + XMLSize_t wLent = getWideCharLength(toTranscode); + if (wLent > maxBytes) + wLent = maxBytes; + + // Fill the "unicode" string + char tmpWBuff[gTempBuffArraySize]; + char *wideCharBuf = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, manager); + size_t len = wLent * uChSize(); + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) manager->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, manager); + wideCharBuf = wBufPtr; + } else + wideCharBuf = tmpWBuff; + xmlToMbs (toTranscode, wideCharBuf, wLent); + } else + wideCharBuf = (char *) toTranscode; + + // Ok, go ahead and try the transcoding. If it fails, then ... + char *ptr = toFill; + size_t rc; + + { + XMLMutexLock lockConverter(&fMutex); + rc = iconvTo(wideCharBuf, &len, &ptr, maxBytes); + } + + if (rc == (size_t)-1) { + return false; + } + + // Cap it off + *ptr = 0; + return true; +} + + +XMLCh* IconvGNULCPTranscoder::transcode(const char* const toTranscode, + MemoryManager* const manager) +{ + if (!toTranscode) + return 0; + + XMLCh* retVal = 0; + if (!*toTranscode) { + retVal = (XMLCh*) manager->allocate(sizeof(XMLCh));//new XMLCh[1]; + retVal[0] = 0; + return retVal; + } + + XMLSize_t wLent = calcRequiredSize(toTranscode, manager); + if (wLent == 0) { + retVal = (XMLCh*) manager->allocate(sizeof(XMLCh));//new XMLCh[1]; + retVal[0] = 0; + return retVal; + } + + char tmpWBuff[gTempBuffArraySize]; + char *wideCharBuf = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, manager); + size_t len = wLent * uChSize(); + + retVal = (XMLCh*) manager->allocate((wLent + 1) * sizeof(XMLCh));//new XMLCh[wLent + 1]; + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) manager->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, manager); + wideCharBuf = wBufPtr; + } else + wideCharBuf = tmpWBuff; + } else + wideCharBuf = (char *) retVal; + + size_t flen = strlen(toTranscode); + char *ptr = wideCharBuf; + size_t rc; + + { + XMLMutexLock lockConverter(&fMutex); + rc = iconvFrom(toTranscode, &flen, &ptr, len); + } + + if (rc == (size_t) -1) { + return NULL; + } + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) + mbsToXML (wideCharBuf, retVal, wLent); + retVal[wLent] = 0x00; + + return retVal; +} + + +bool IconvGNULCPTranscoder::transcode(const char* const toTranscode + , XMLCh* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager) +{ + // Check for a couple of psycho corner cases + if (!toTranscode || !maxChars) + { + toFill[0] = 0; + return true; + } + + if (!*toTranscode) + { + toFill[0] = 0; + return true; + } + + XMLSize_t wLent = calcRequiredSize(toTranscode); + if (wLent > maxChars) + wLent = maxChars; + + char tmpWBuff[gTempBuffArraySize]; + char *wideCharBuf = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, manager); + size_t len = wLent * uChSize(); + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) manager->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, manager); + wideCharBuf = wBufPtr; + } else + wideCharBuf = tmpWBuff; + } else + wideCharBuf = (char *) toFill; + + size_t flen = strlen(toTranscode); // wLent; + char *ptr = wideCharBuf; + size_t rc; + + { + XMLMutexLock lockConverter(&fMutex); + rc = iconvFrom(toTranscode, &flen, &ptr, len); + } + + if (rc == (size_t)-1) { + return false; + } + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) + mbsToXML (wideCharBuf, toFill, wLent); + + toFill[wLent] = 0x00; + return true; +} + + +// --------------------------------------------------------------------------- +// IconvGNULCPTranscoder: Constructors and Destructor +// --------------------------------------------------------------------------- + + +IconvGNULCPTranscoder::IconvGNULCPTranscoder (iconv_t cd_from, + iconv_t cd_to, + size_t uchsize, + unsigned int ubo, + MemoryManager* manager) + : IconvGNUWrapper (cd_from, cd_to, uchsize, ubo, manager) +{ +} + + +IconvGNULCPTranscoder::~IconvGNULCPTranscoder() +{ +} + + +// --------------------------------------------------------------------------- +// IconvGNUTranscoder: Constructors and Destructor +// --------------------------------------------------------------------------- +IconvGNUTranscoder::IconvGNUTranscoder (const XMLCh* const encodingName + , const XMLSize_t blockSize + , iconv_t cd_from + , iconv_t cd_to + , size_t uchsize + , unsigned int ubo + , MemoryManager* const manager + ) + : XMLTranscoder(encodingName, blockSize, manager) + , IconvGNUWrapper (cd_from, cd_to, uchsize, ubo, manager) +{ +} + +IconvGNUTranscoder::~IconvGNUTranscoder() +{ + if (cdTo() != (iconv_t)-1) { + iconv_close (cdTo()); + setCDTo ((iconv_t)-1); + } + if (cdFrom() != (iconv_t)-1) { + iconv_close (cdFrom()); + setCDFrom ((iconv_t)-1); + } +} + +// --------------------------------------------------------------------------- +// IconvGNUTranscoder: Implementation of the virtual transcoder API +// --------------------------------------------------------------------------- +XMLSize_t IconvGNUTranscoder::transcodeFrom +( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes ) +{ + // Transcode TO XMLCh + const char* startSrc = (const char*) srcData; + const char* endSrc = (const char*) srcData + srcCount; + + char tmpWBuff[gTempBuffArraySize]; + char *startTarget = 0; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, getMemoryManager()); + size_t len = maxChars * uChSize(); + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) getMemoryManager()->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, getMemoryManager()); + startTarget = wBufPtr; + } else + startTarget = tmpWBuff; + } else + startTarget = (char *) toFill; + + // Do character-by-character transcoding + char *orgTarget = startTarget; + size_t srcLen = srcCount; + size_t prevSrcLen = srcLen; + unsigned int toReturn = 0; + bytesEaten = 0; + + XMLMutexLock lockConverter(&fMutex); + + for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) { + size_t rc = iconvFrom(startSrc, &srcLen, &orgTarget, uChSize()); + if (rc == (size_t)-1) { + if (errno != E2BIG || prevSrcLen == srcLen) { + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); + } + } + charSizes[cnt] = prevSrcLen - srcLen; + prevSrcLen = srcLen; + bytesEaten += charSizes[cnt]; + startSrc = endSrc - srcLen; + toReturn++; + } + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) + mbsToXML (startTarget, toFill, toReturn); + return toReturn; +} + +XMLSize_t IconvGNUTranscoder::transcodeTo +( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts /*options*/ ) +{ + // Transcode FROM XMLCh + char tmpWBuff[gTempBuffArraySize]; + char *startSrc = tmpWBuff; + char *wBufPtr = 0; + ArrayJanitor janBuf(wBufPtr, getMemoryManager()); + size_t len = srcCount * uChSize(); + + if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { + if (len > gTempBuffArraySize) { + wBufPtr = (char*) getMemoryManager()->allocate(len * sizeof(char));//new char[len]; + janBuf.reset(wBufPtr, getMemoryManager()); + startSrc = wBufPtr; + } else + startSrc = tmpWBuff; + xmlToMbs (srcData, startSrc, srcCount); + } else + startSrc = (char *) srcData; + + char* startTarget = (char *) toFill; + size_t srcLen = len; + + size_t rc; + + { + XMLMutexLock lockConverter(&fMutex); + rc = iconvTo (startSrc, &srcLen, &startTarget, maxBytes); + } + + if (rc == (size_t)-1 && errno != E2BIG) { + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); + } + charsEaten = srcCount - srcLen / uChSize(); + return startTarget - (char *)toFill; +} + +bool IconvGNUTranscoder::canTranscodeTo +( + const unsigned int toCheck +) +{ + // + // If the passed value is really a surrogate embedded together, then + // we need to break it out into its two chars. Else just one. + // + char srcBuf[MAX_UCHSIZE * 2]; + unsigned int srcCount = 1; + if (toCheck & 0xFFFF0000) { + XMLCh ch1 = (toCheck >> 10) + 0xD800; + XMLCh ch2 = (toCheck & 0x3FF) + 0xDC00; + xmlToMbs(&ch1, srcBuf, 1); + xmlToMbs(&ch2, srcBuf + uChSize(), 1); + srcCount++; + } else + xmlToMbs((const XMLCh*) &toCheck, srcBuf, 1); + size_t len = srcCount * uChSize(); + char tmpBuf[64]; + char* pTmpBuf = tmpBuf; + + XMLMutexLock lockConverter(&fMutex); + size_t rc = iconvTo( srcBuf, &len, &pTmpBuf, 64); + + return (rc != (size_t)-1) && (len == 0); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp b/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp new file mode 100644 index 000000000..d7457cb2b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp @@ -0,0 +1,359 @@ +/* + * 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: IconvGNUTransService.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ICONVGNUTRANSSERVICE_HPP) +#define XERCESC_INCLUDE_GUARD_ICONVGNUTRANSSERVICE_HPP + +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Libiconv wrapper (low-level conversion utilities collection) +// --------------------------------------------------------------------------- + +class XMLUTIL_EXPORT IconvGNUWrapper +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + IconvGNUWrapper + ( + iconv_t cd_from, + iconv_t cd_to, + size_t uchsize, + unsigned int ubo, + MemoryManager* manager + ); + virtual ~IconvGNUWrapper(); + + // Convert "native unicode" character into XMLCh + void mbcToXMLCh (const char *mbc, XMLCh *toRet) const; + + // Convert XMLCh into "native unicode" character + void xmlChToMbc (XMLCh xch, char *mbc) const; + + // Fill array of XMLCh characters with data, supplied in the array + // of "native unicode" characters. + XMLCh* mbsToXML ( + const char* mbs_str, + XMLCh* xml_str, + size_t cnt + ) const; + + + // Fill array of "native unicode" characters with data, supplied + // in the array of XMLCh characters. + char* xmlToMbs + ( + const XMLCh* xml_str, + char* mbs_str, + size_t cnt + ) const; + + // Private data accessors + inline iconv_t cdTo () const { return fCDTo; } + inline iconv_t cdFrom () const { return fCDFrom; } + inline size_t uChSize () const { return fUChSize; } + inline unsigned int UBO () const { return fUBO; } + +protected: + // The following four functions should called with the fMutex + // locked. + // + + // Return uppercase equivalent for XMLCh + XMLCh toUpper (const XMLCh ch); + + // Return uppercase equivalent for XMLCh + XMLCh toLower (const XMLCh ch); + + // Wrapper around the iconv() for transcoding from the local charset + size_t iconvFrom + ( + const char *fromPtr, + size_t *fromLen, + char **toPtr, + size_t toLen + ); + + // Wrapper around the iconv() for transcoding to the local charset + size_t iconvTo + ( + const char *fromPtr, + size_t *fromLen, + char **toPtr, + size_t toLen + ); + +protected: + + // Hidden constructor + IconvGNUWrapper(MemoryManager* manager); + + // Private data accessors + inline void setCDTo (iconv_t cd) { fCDTo = cd; } + inline void setCDFrom (iconv_t cd) { fCDFrom = cd; } + inline void setUChSize (size_t sz) { fUChSize = sz; } + inline void setUBO (unsigned int u) { fUBO = u; } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IconvGNUWrapper(const IconvGNUWrapper&); + IconvGNUWrapper& operator=(const IconvGNUWrapper&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fCDTo + // Characterset conversion descriptor TO the local-host encoding + // fCDFrom + // Characterset conversion descriptor FROM the local-host encoding + // fUChSize + // Sizeof the "native unicode" character in bytes + // fUBO + // "Native unicode" characters byte order + // ----------------------------------------------------------------------- + size_t fUChSize; + unsigned int fUBO; + iconv_t fCDTo; + iconv_t fCDFrom; + +protected: + XMLMutex fMutex; +}; + + + +// --------------------------------------------------------------------------- +// FreeBSD-specific Transcoding Service implementation +// --------------------------------------------------------------------------- + +class XMLUTIL_EXPORT IconvGNUTransService : public XMLTransService, IconvGNUWrapper +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + IconvGNUTransService(MemoryManager* manager); + ~IconvGNUTransService(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual transcoding service API + // ----------------------------------------------------------------------- + virtual int compareIString + ( + const XMLCh* const comp1 + , const XMLCh* const comp2 + ); + + virtual int compareNIString + ( + const XMLCh* const comp1 + , const XMLCh* const comp2 + , const XMLSize_t maxChars + ); + + virtual const XMLCh* getId() const; + + virtual XMLLCPTranscoder* makeNewLCPTranscoder(MemoryManager* manager); + + virtual bool supportsSrcOfs() const; + + virtual void upperCase(XMLCh* const toUpperCase); + virtual void lowerCase(XMLCh* const toUpperCase); + +protected : + // ----------------------------------------------------------------------- + // Protected virtual methods + // ----------------------------------------------------------------------- + virtual XMLTranscoder* makeNewXMLTranscoder + ( + const XMLCh* const encodingName + , XMLTransService::Codes& resValue + , const XMLSize_t blockSize + , MemoryManager* const manager + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IconvGNUTransService(const IconvGNUTransService&); + IconvGNUTransService& operator=(const IconvGNUTransService&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fUnicodeCP + // Unicode encoding schema name + // ----------------------------------------------------------------------- + const char* fUnicodeCP; + +}; + + +//---------------------------------------------------------------------------- +// Implementation of the transcoders for arbitrary input characterset is +// supported ONLY through libiconv interface +//---------------------------------------------------------------------------- + +class XMLUTIL_EXPORT IconvGNUTranscoder : public XMLTranscoder, IconvGNUWrapper +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + IconvGNUTranscoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , iconv_t cd_from + , iconv_t cd_to + , size_t uchsize + , unsigned int ubo + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~IconvGNUTranscoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual transcoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IconvGNUTranscoder(); + IconvGNUTranscoder(const IconvGNUTranscoder&); + IconvGNUTranscoder& operator=(const IconvGNUTranscoder&); +}; + + +// --------------------------------------------------------------------------- +// GNU-specific XMLCh <-> local (host) characterset transcoder +// --------------------------------------------------------------------------- + +class XMLUTIL_EXPORT IconvGNULCPTranscoder : public XMLLCPTranscoder, IconvGNUWrapper +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + IconvGNULCPTranscoder + ( + iconv_t from, + iconv_t to, + size_t uchsize, + unsigned int ubo, + MemoryManager* manager + ); + +protected: + IconvGNULCPTranscoder(); // Unimplemented + +public: + + ~IconvGNULCPTranscoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual transcoder interface + // ----------------------------------------------------------------------- + virtual char* transcode(const XMLCh* const toTranscode, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + virtual XMLCh* transcode(const char* const toTranscode, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + + // ----------------------------------------------------------------------- + // DEPRECATED old transcode interface + // ----------------------------------------------------------------------- + virtual XMLSize_t calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + virtual XMLSize_t calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + virtual bool transcode + ( + const char* const toTranscode + , XMLCh* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual bool transcode + ( + const XMLCh* const toTranscode + , char* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IconvGNULCPTranscoder(const IconvGNULCPTranscoder&); + IconvGNULCPTranscoder& operator=(const IconvGNULCPTranscoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif /* ICONVGNUTRANSSERVICE */ + + diff --git a/project/jni/xerces/src/xercesc/util/TranscodingException.hpp b/project/jni/xerces/src/xercesc/util/TranscodingException.hpp new file mode 100644 index 000000000..eafdc7580 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/TranscodingException.hpp @@ -0,0 +1,34 @@ +/* + * 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: TranscodingException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TRANSCODINGEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_TRANSCODINGEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(TranscodingException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/UTFDataFormatException.hpp b/project/jni/xerces/src/xercesc/util/UTFDataFormatException.hpp new file mode 100644 index 000000000..69c6067f4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/UTFDataFormatException.hpp @@ -0,0 +1,35 @@ +/* + * 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: UTFDataFormatException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UTFDATAFORMATEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_UTFDATAFORMATEXCEPTION_HPP + + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(UTFDataFormatException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/UnexpectedEOFException.hpp b/project/jni/xerces/src/xercesc/util/UnexpectedEOFException.hpp new file mode 100644 index 000000000..0b8903854 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/UnexpectedEOFException.hpp @@ -0,0 +1,34 @@ +/* + * 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: UnexpectedEOFException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UNEXPECTEDEOFEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_UNEXPECTEDEOFEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(UnexpectedEOFException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/UnsupportedEncodingException.hpp b/project/jni/xerces/src/xercesc/util/UnsupportedEncodingException.hpp new file mode 100644 index 000000000..54e556a83 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/UnsupportedEncodingException.hpp @@ -0,0 +1,34 @@ +/* + * 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: UnsupportedEncodingException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UNSUPPORTEDENCODINGEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_UNSUPPORTEDENCODINGEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(UnsupportedEncodingException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/ValueArrayOf.c b/project/jni/xerces/src/xercesc/util/ValueArrayOf.c new file mode 100644 index 000000000..7b9f4bc81 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueArrayOf.c @@ -0,0 +1,252 @@ +/* + * 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: ValueArrayOf.c 932887 2010-04-11 13:04:59Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ValueArrayOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ValueArrayOf::ValueArrayOf(const XMLSize_t size, + MemoryManager* const manager) : + + fSize(size) + , fArray(0) + , fMemoryManager(manager) +{ + fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize]; +} + +template +ValueArrayOf::ValueArrayOf( const TElem* values + , const XMLSize_t size + , MemoryManager* const manager) : + + fSize(size) + , fArray(0) + , fMemoryManager(manager) +{ + fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize]; + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = values[index]; +} + +template +ValueArrayOf::ValueArrayOf(const ValueArrayOf& source) : + XMemory(source) + , fSize(source.fSize) + , fArray(0) + , fMemoryManager(source.fMemoryManager) +{ + fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize]; + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = source.fArray[index]; +} + +template ValueArrayOf::~ValueArrayOf() +{ + fMemoryManager->deallocate(fArray); //delete [] fArray; +} + + +// --------------------------------------------------------------------------- +// ValueArrayOf: Public operators +// --------------------------------------------------------------------------- +template TElem& ValueArrayOf:: +operator[](const XMLSize_t index) +{ + if (index >= fSize) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + return fArray[index]; +} + +template const TElem& ValueArrayOf:: +operator[](const XMLSize_t index) const +{ + if (index >= fSize) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + return fArray[index]; +} + +template ValueArrayOf& ValueArrayOf:: +operator=(const ValueArrayOf& toAssign) +{ + if (this == &toAssign) + return *this; + + // Reallocate if not the same size + if (toAssign.fSize != fSize) + { + fMemoryManager->deallocate(fArray); //delete [] fArray; + fSize = toAssign.fSize; + fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize]; + } + + // Copy over the source elements + for (XMLSize_t index = 0; index < fSize; index++) + fArray[index] = toAssign.fArray[index]; + + return *this; +} + +template bool ValueArrayOf:: +operator==(const ValueArrayOf& toCompare) const +{ + if (this == &toCompare) + return true; + + if (fSize != toCompare.fSize) + return false; + + for (XMLSize_t index = 0; index < fSize; index++) + { + if (fArray[index] != toCompare.fArray[index]) + return false; + } + + return true; +} + +template bool ValueArrayOf:: +operator!=(const ValueArrayOf& toCompare) const +{ + return !operator==(toCompare); +} + + +// --------------------------------------------------------------------------- +// ValueArrayOf: Copy operations +// --------------------------------------------------------------------------- +template XMLSize_t ValueArrayOf:: +copyFrom(const ValueArrayOf& srcArray) +{ + // + // Copy over as many of the source elements as will fit into + // this array. + // + const XMLSize_t count = fSize < srcArray.fSize ? + fSize : srcArray.fSize; + + for (XMLSize_t index = 0; index < count; index++) + fArray[index] = srcArray.fArray[index]; + + return count; +} + + +// --------------------------------------------------------------------------- +// ValueArrayOf: Getter methods +// --------------------------------------------------------------------------- +template XMLSize_t ValueArrayOf:: +length() const +{ + return fSize; +} + +template TElem* ValueArrayOf:: +rawData() const +{ + return fArray; +} + + +// --------------------------------------------------------------------------- +// ValueArrayOf: Miscellaneous methods +// --------------------------------------------------------------------------- +template void ValueArrayOf:: +resize(const XMLSize_t newSize) +{ + if (newSize == fSize) + return; + + if (newSize < fSize) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Array_BadNewSize, fMemoryManager); + + // Allocate the new array + TElem* newArray = (TElem*) fMemoryManager->allocate + ( + newSize * sizeof(TElem) + ); //new TElem[newSize]; + + // Copy the existing values + XMLSize_t index = 0; + for (; index < fSize; index++) + newArray[index] = fArray[index]; + + for (; index < newSize; index++) + newArray[index] = TElem(0); + + // Delete the old array and update our members + fMemoryManager->deallocate(fArray); //delete [] fArray; + fArray = newArray; + fSize = newSize; +} + + + +// --------------------------------------------------------------------------- +// ValueArrayEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template ValueArrayEnumerator:: +ValueArrayEnumerator(ValueArrayOf* const toEnum, const bool adopt) : + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) +{ +} + +template ValueArrayEnumerator::~ValueArrayEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// ValueArrayEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool ValueArrayEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fToEnum->length()) + return false; + return true; +} + +template TElem& ValueArrayEnumerator::nextElement() +{ + return (*fToEnum)[fCurIndex++]; +} + +template void ValueArrayEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/ValueArrayOf.hpp b/project/jni/xerces/src/xercesc/util/ValueArrayOf.hpp new file mode 100644 index 000000000..77d935140 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueArrayOf.hpp @@ -0,0 +1,150 @@ +/* + * 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: ValueArrayOf.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUEARRAY_HPP) +#define XERCESC_INCLUDE_GUARD_VALUEARRAY_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class ValueArrayOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueArrayOf + ( + const XMLSize_t size + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ValueArrayOf + ( + const TElem* values + , const XMLSize_t size + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ValueArrayOf(const ValueArrayOf& source); + ~ValueArrayOf(); + + + // ----------------------------------------------------------------------- + // Public operators + // ----------------------------------------------------------------------- + TElem& operator[](const XMLSize_t index); + const TElem& operator[](const XMLSize_t index) const; + ValueArrayOf& operator=(const ValueArrayOf& toAssign); + bool operator==(const ValueArrayOf& toCompare) const; + bool operator!=(const ValueArrayOf& toCompare) const; + + + // ----------------------------------------------------------------------- + // Copy operations + // ----------------------------------------------------------------------- + XMLSize_t copyFrom(const ValueArrayOf& srcArray); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t length() const; + TElem* rawData() const; + + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + void resize(const XMLSize_t newSize); + + +private : + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + XMLSize_t fSize; + TElem* fArray; + MemoryManager* fMemoryManager; +}; + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template class ValueArrayEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueArrayEnumerator + ( + ValueArrayOf* const toEnum + , const bool adopt = false + ); + virtual ~ValueArrayEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueArrayEnumerator(const ValueArrayEnumerator&); + ValueArrayEnumerator& operator=(const ValueArrayEnumerator&); + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurIndex + // This is the current index into the vector. + // + // fToEnum + // The value array being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + ValueArrayOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/ValueHashTableOf.c b/project/jni/xerces/src/xercesc/util/ValueHashTableOf.c new file mode 100644 index 000000000..aa57acfce --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueHashTableOf.c @@ -0,0 +1,489 @@ +/* + * 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: ValueHashTableOf.c 679340 2008-07-24 10:28:29Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Include +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ValueHashTableOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ValueHashTableOf::ValueHashTableOf( const XMLSize_t modulus + , const THasher& hasher + , MemoryManager* const manager) + : fMemoryManager(manager) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) + , fHasher(hasher) +{ + initialize(modulus); +} + +template +ValueHashTableOf::ValueHashTableOf( const XMLSize_t modulus + , MemoryManager* const manager) + : fMemoryManager(manager) + , fBucketList(0) + , fHashModulus(modulus) + , fInitialModulus(modulus) + , fCount(0) + , fHasher() +{ + initialize(modulus); +} + +template +void ValueHashTableOf::initialize(const XMLSize_t modulus) +{ + if (modulus == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + + // Allocate the bucket list and zero them + fBucketList = (ValueHashTableBucketElem**) fMemoryManager->allocate + ( + fHashModulus * sizeof(ValueHashTableBucketElem*) + ); //new ValueHashTableBucketElem*[fHashModulus]; + memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus); +} + +template +ValueHashTableOf::~ValueHashTableOf() +{ + removeAll(); + + // Then delete the bucket list & hasher + fMemoryManager->deallocate(fBucketList); //delete [] fBucketList; +} + + +// --------------------------------------------------------------------------- +// ValueHashTableOf: Element management +// --------------------------------------------------------------------------- +template +bool ValueHashTableOf::isEmpty() const +{ + return fCount==0; +} + +template +bool ValueHashTableOf:: +containsKey(const void* const key) const +{ + XMLSize_t hashVal; + const ValueHashTableBucketElem* findIt = findBucketElem(key, hashVal); + return (findIt != 0); +} + +template +void ValueHashTableOf:: +removeKey(const void* const key) +{ + XMLSize_t hashVal; + removeBucketElem(key, hashVal); +} + +template +void ValueHashTableOf::removeAll() +{ + if(isEmpty()) + return; + + // Clean up the buckets first + for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++) + { + // Get the bucket list head for this entry + ValueHashTableBucketElem* curElem = fBucketList[buckInd]; + ValueHashTableBucketElem* nextElem; + while (curElem) + { + // Save the next element before we hose this one + nextElem = curElem->fNext; + + // delete the current element and move forward + // destructor is empty... + // curElem->~ValueHashTableBucketElem(); + fMemoryManager->deallocate(curElem); + curElem = nextElem; + } + + // Clean out this entry + fBucketList[buckInd] = 0; + } + fCount = 0; +} + + +// --------------------------------------------------------------------------- +// ValueHashTableOf: Getters +// --------------------------------------------------------------------------- +template +TVal& ValueHashTableOf::get(const void* const key, MemoryManager* const manager) +{ + XMLSize_t hashVal; + ValueHashTableBucketElem* findIt = findBucketElem(key, hashVal); + if (!findIt) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, manager); + + return findIt->fData; +} + +template +const TVal& ValueHashTableOf:: +get(const void* const key) const +{ + XMLSize_t hashVal; + const ValueHashTableBucketElem* findIt = findBucketElem(key, hashVal); + if (!findIt) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); + + return findIt->fData; +} + + +// --------------------------------------------------------------------------- +// ValueHashTableOf: Putters +// --------------------------------------------------------------------------- +template +void ValueHashTableOf::put(void* key, const TVal& valueToAdopt) +{ + // Apply 0.75 load factor to find threshold. + XMLSize_t threshold = fHashModulus * 3 / 4; + + // If we've grown too big, expand the table and rehash. + if (fCount >= threshold) + rehash(); + + // First see if the key exists already + XMLSize_t hashVal; + ValueHashTableBucketElem* newBucket = findBucketElem(key, hashVal); + + // + // If so,then update its value. If not, then we need to add it to + // the right bucket + // + if (newBucket) + { + newBucket->fData = valueToAdopt; + newBucket->fKey = key; + } + else + { + newBucket = + new (fMemoryManager->allocate(sizeof(ValueHashTableBucketElem))) + ValueHashTableBucketElem(key, valueToAdopt, fBucketList[hashVal]); + fBucketList[hashVal] = newBucket; + fCount++; + } +} + + + +// --------------------------------------------------------------------------- +// ValueHashTableOf: Private methods +// --------------------------------------------------------------------------- +template +void ValueHashTableOf::rehash() +{ + const XMLSize_t newMod = (fHashModulus * 2) + 1; + + ValueHashTableBucketElem** newBucketList = + (ValueHashTableBucketElem**) fMemoryManager->allocate + ( + newMod * sizeof(ValueHashTableBucketElem*) + );//new RefHashTableBucketElem*[newMod]; + + // Make sure the new bucket list is destroyed if an + // exception is thrown. + ArrayJanitor*> guard(newBucketList, fMemoryManager); + + memset(newBucketList, 0, newMod * sizeof(newBucketList[0])); + + + // Rehash all existing entries. + for (XMLSize_t index = 0; index < fHashModulus; index++) + { + // Get the bucket list head for this entry + ValueHashTableBucketElem* curElem = fBucketList[index]; + + while (curElem) + { + // Save the next element before we detach this one + ValueHashTableBucketElem* const nextElem = curElem->fNext; + + const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey, newMod); + assert(hashVal < newMod); + + ValueHashTableBucketElem* const newHeadElem = newBucketList[hashVal]; + + // Insert at the start of this bucket's list. + curElem->fNext = newHeadElem; + newBucketList[hashVal] = curElem; + + curElem = nextElem; + } + } + + ValueHashTableBucketElem** const oldBucketList = fBucketList; + + // Everything is OK at this point, so update the + // member variables. + fBucketList = guard.release(); + fHashModulus = newMod; + + // Delete the old bucket list. + fMemoryManager->deallocate(oldBucketList);//delete[] oldBucketList; + +} + +template +inline ValueHashTableBucketElem* ValueHashTableOf:: +findBucketElem(const void* const key, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + ValueHashTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + +template +inline const ValueHashTableBucketElem* ValueHashTableOf:: +findBucketElem(const void* const key, XMLSize_t& hashVal) const +{ + // Hash the key + hashVal = fHasher.getHashVal(key, fHashModulus); + assert(hashVal < fHashModulus); + + // Search that bucket for the key + const ValueHashTableBucketElem* curElem = fBucketList[hashVal]; + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + return curElem; + + curElem = curElem->fNext; + } + return 0; +} + + +template +void ValueHashTableOf:: +removeBucketElem(const void* const key, XMLSize_t& hashVal) +{ + // Hash the key + hashVal = fHasher.getHashVal(key, fHashModulus); + assert(hashVal < fHashModulus); + + // + // Search the given bucket for this key. Keep up with the previous + // element so we can patch around it. + // + ValueHashTableBucketElem* curElem = fBucketList[hashVal]; + ValueHashTableBucketElem* lastElem = 0; + + while (curElem) + { + if (fHasher.equals(key, curElem->fKey)) + { + if (!lastElem) + { + // It was the first in the bucket + fBucketList[hashVal] = curElem->fNext; + } + else + { + // Patch around the current element + lastElem->fNext = curElem->fNext; + } + + // Delete the current element + // delete curElem; + // destructor is empty... + // curElem->~ValueHashTableBucketElem(); + fMemoryManager->deallocate(curElem); + + fCount--; + + return; + } + + // Move both pointers upwards + lastElem = curElem; + curElem = curElem->fNext; + } + + // We never found that key + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager); +} + + + + +// --------------------------------------------------------------------------- +// ValueHashTableOfEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ValueHashTableOfEnumerator:: +ValueHashTableOfEnumerator(ValueHashTableOf* const toEnum + , const bool adopt + , MemoryManager* const manager) + : fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum), fMemoryManager(manager) +{ + if (!toEnum) + ThrowXMLwithMemMgr(NullPointerException, XMLExcepts::CPtr_PointerIsZero, manager); + + // + // Find the next available bucket element in the hash table. If it + // comes back zero, that just means the table is empty. + // + // Note that the -1 in the current hash tells it to start from the + // beginning. + // + findNext(); +} + +template +ValueHashTableOfEnumerator::~ValueHashTableOfEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// ValueHashTableOfEnumerator: Enum interface +// --------------------------------------------------------------------------- +template +bool ValueHashTableOfEnumerator::hasMoreElements() const +{ + // + // If our current has is at the max and there are no more elements + // in the current bucket, then no more elements. + // + if (!fCurElem && (fCurHash == fToEnum->fHashModulus)) + return false; + return true; +} + +template +TVal& ValueHashTableOfEnumerator::nextElement() +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + ValueHashTableBucketElem* saveElem = fCurElem; + findNext(); + + return saveElem->fData; +} + +template +void* ValueHashTableOfEnumerator::nextElementKey() +{ + // Make sure we have an element to return + if (!hasMoreElements()) + ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::Enum_NoMoreElements, fMemoryManager); + + // + // Save the current element, then move up to the next one for the + // next time around. + // + ValueHashTableBucketElem* saveElem = fCurElem; + findNext(); + + return saveElem->fKey; +} + + +template +void ValueHashTableOfEnumerator::Reset() +{ + fCurHash = (XMLSize_t)-1; + fCurElem = 0; + findNext(); +} + + + +// --------------------------------------------------------------------------- +// ValueHashTableOfEnumerator: Private helper methods +// --------------------------------------------------------------------------- +template +void ValueHashTableOfEnumerator::findNext() +{ + // + // If there is a current element, move to its next element. If this + // hits the end of the bucket, the next block will handle the rest. + // + if (fCurElem) + fCurElem = fCurElem->fNext; + + // + // If the current element is null, then we have to move up to the + // next hash value. If that is the hash modulus, then we cannot + // go further. + // + if (!fCurElem) + { + if (++fCurHash == fToEnum->fHashModulus) + return; + + // Else find the next non-empty bucket + while (fToEnum->fBucketList[fCurHash]==0) + { + // Bump to the next hash value. If we max out return + if (++fCurHash == fToEnum->fHashModulus) + return; + } + fCurElem = fToEnum->fBucketList[fCurHash]; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/ValueHashTableOf.hpp b/project/jni/xerces/src/xercesc/util/ValueHashTableOf.hpp new file mode 100644 index 000000000..cc6e13475 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueHashTableOf.hpp @@ -0,0 +1,229 @@ +/* + * 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: ValueHashTableOf.hpp 679340 2008-07-24 10:28:29Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUEHASHTABLEOF_HPP) +#define XERCESC_INCLUDE_GUARD_VALUEHASHTABLEOF_HPP + + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Forward declare the enumerator so it can be our friend. +// +template +class ValueHashTableOfEnumerator; + + +// +// This should really be a nested class, but some of the compilers we +// have to support cannot deal with that! +// +template +struct ValueHashTableBucketElem +{ + ValueHashTableBucketElem(void* key, const TVal& value, ValueHashTableBucketElem* next) + : fData(value), fNext(next), fKey(key) + { + } + ValueHashTableBucketElem(){}; + ~ValueHashTableBucketElem(){}; + + TVal fData; + ValueHashTableBucketElem* fNext; + void* fKey; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueHashTableBucketElem(const ValueHashTableBucketElem&); + ValueHashTableBucketElem& operator=(const ValueHashTableBucketElem&); +}; + + +template +class ValueHashTableOf : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueHashTableOf( + const XMLSize_t modulus, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ValueHashTableOf( + const XMLSize_t modulus, + const THasher& hasher, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~ValueHashTableOf(); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + bool isEmpty() const; + bool containsKey(const void* const key) const; + void removeKey(const void* const key); + void removeAll(); + + + // ----------------------------------------------------------------------- + // Getters + // ----------------------------------------------------------------------- + TVal& get(const void* const key, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + const TVal& get(const void* const key) const; + + + // ----------------------------------------------------------------------- + // Putters + // ----------------------------------------------------------------------- + void put(void* key, const TVal& valueToAdopt); + + +private : + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class ValueHashTableOfEnumerator; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueHashTableOf(const ValueHashTableOf&); + ValueHashTableOf& operator=(const ValueHashTableOf&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + ValueHashTableBucketElem* findBucketElem(const void* const key, XMLSize_t& hashVal); + const ValueHashTableBucketElem* findBucketElem(const void* const key, XMLSize_t& hashVal) const; + void removeBucketElem(const void* const key, XMLSize_t& hashVal); + void initialize(const XMLSize_t modulus); + void rehash(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fBucketList + // This is the array that contains the heads of all of the list + // buckets, one for each possible hash value. + // + // fHashModulus + // The modulus used for this hash table, to hash the keys. This is + // also the number of elements in the bucket list. + // + // fHash + // The hasher for the key data type. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + ValueHashTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + XMLSize_t fInitialModulus; + XMLSize_t fCount; + THasher fHasher; +}; + + + +// +// An enumerator for a value array. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template +class ValueHashTableOfEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueHashTableOfEnumerator(ValueHashTableOf* const toEnum + , const bool adopt = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~ValueHashTableOfEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TVal& nextElement(); + void Reset(); + + // ----------------------------------------------------------------------- + // New interface specific for key used in ValueHashable + // ----------------------------------------------------------------------- + void* nextElementKey(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueHashTableOfEnumerator(const ValueHashTableOfEnumerator&); + ValueHashTableOfEnumerator& operator=(const ValueHashTableOfEnumerator&); + + // ----------------------------------------------------------------------- + // Private methods + // ----------------------------------------------------------------------- + void findNext(); + + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurElem + // This is the current bucket bucket element that we are on. + // + // fCurHash + // The is the current hash buck that we are working on. Once we hit + // the end of the bucket that fCurElem is in, then we have to start + // working this one up to the next non-empty bucket. + // + // fToEnum + // The value array being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + ValueHashTableBucketElem* fCurElem; + XMLSize_t fCurHash; + ValueHashTableOf* fToEnum; + MemoryManager* const fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/ValueStackOf.c b/project/jni/xerces/src/xercesc/util/ValueStackOf.c new file mode 100644 index 000000000..8e3cc5901 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueStackOf.c @@ -0,0 +1,146 @@ +/* + * 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: ValueStackOf.c 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// ValueStackOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ValueStackOf::ValueStackOf(const XMLSize_t fInitCapacity, + MemoryManager* const manager, + const bool toCallDestructor) : + + fVector(fInitCapacity, manager, toCallDestructor) +{ +} + +template ValueStackOf::~ValueStackOf() +{ +} + + +// --------------------------------------------------------------------------- +// ValueStackOf: Element management methods +// --------------------------------------------------------------------------- +template void ValueStackOf::push(const TElem& toPush) +{ + fVector.addElement(toPush); +} + +template const TElem& ValueStackOf::peek() const +{ + const XMLSize_t curSize = fVector.size(); + if (curSize == 0) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack, fVector.getMemoryManager()); + + return fVector.elementAt(curSize-1); +} + +template TElem ValueStackOf::pop() +{ + const XMLSize_t curSize = fVector.size(); + if (curSize == 0) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack, fVector.getMemoryManager()); + + TElem retVal = fVector.elementAt(curSize-1); + fVector.removeElementAt(curSize-1); + return retVal; +} + +template void ValueStackOf::removeAllElements() +{ + fVector.removeAllElements(); +} + + +// --------------------------------------------------------------------------- +// ValueStackOf: Getter methods +// --------------------------------------------------------------------------- +template bool ValueStackOf::empty() +{ + return (fVector.size() == 0); +} + +template XMLSize_t ValueStackOf::curCapacity() +{ + return fVector.curCapacity(); +} + +template XMLSize_t ValueStackOf::size() +{ + return fVector.size(); +} + + + + +// --------------------------------------------------------------------------- +// ValueStackEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template ValueStackEnumerator:: +ValueStackEnumerator( ValueStackOf* const toEnum + , const bool adopt) : + + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) + , fVector(&toEnum->fVector) +{ +} + +template ValueStackEnumerator::~ValueStackEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// ValueStackEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool ValueStackEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fVector->size()) + return false; + return true; +} + +template TElem& ValueStackEnumerator::nextElement() +{ + return fVector->elementAt(fCurIndex++); +} + +template void ValueStackEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/ValueStackOf.hpp b/project/jni/xerces/src/xercesc/util/ValueStackOf.hpp new file mode 100644 index 000000000..337920aa0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueStackOf.hpp @@ -0,0 +1,155 @@ +/* + * 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: ValueStackOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUESTACKOF_HPP) +#define XERCESC_INCLUDE_GUARD_VALUESTACKOF_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// Forward declare the enumerator so he can be our friend. Can you say +// friend? Sure... +// +template class ValueStackEnumerator; + + +template class ValueStackOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueStackOf + ( + const XMLSize_t fInitCapacity + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , const bool toCallDestructor = false + ); + ~ValueStackOf(); + + + // ----------------------------------------------------------------------- + // Element management methods + // ----------------------------------------------------------------------- + void push(const TElem& toPush); + const TElem& peek() const; + TElem pop(); + void removeAllElements(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool empty(); + XMLSize_t curCapacity(); + XMLSize_t size(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueStackOf(const ValueStackOf&); + ValueStackOf& operator=(const ValueStackOf&); + + // ----------------------------------------------------------------------- + // Declare our friends + // ----------------------------------------------------------------------- + friend class ValueStackEnumerator; + + + // ----------------------------------------------------------------------- + // Data Members + // + // fVector + // The vector that is used as the backing data structure for the + // stack. + // ----------------------------------------------------------------------- + ValueVectorOf fVector; +}; + + + +// +// An enumerator for a value stack. It derives from the basic enumerator +// class, so that value stacks can be generically enumerated. +// +template class ValueStackEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueStackEnumerator + ( + ValueStackOf* const toEnum + , const bool adopt = false + ); + virtual ~ValueStackEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueStackEnumerator(const ValueStackEnumerator&); + ValueStackEnumerator& operator=(const ValueStackEnumerator&); + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed stack. If so then + // we delete the stack when we are destroyed. + // + // fCurIndex + // This is the current index into the vector inside the stack being + // enumerated. + // + // fToEnum + // The stack that is being enumerated. This is just kept for + // adoption purposes, since we really are enumerating the vector + // inside of it. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + ValueVectorOf* fVector; + ValueStackOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/ValueVectorOf.c b/project/jni/xerces/src/xercesc/util/ValueVectorOf.c new file mode 100644 index 000000000..f06d9928f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueVectorOf.c @@ -0,0 +1,295 @@ +/* + * 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: ValueVectorOf.c 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if defined(XERCES_TMPLSINC) +#include +#endif +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ValueVectorOf: Constructors and Destructor +// --------------------------------------------------------------------------- +template +ValueVectorOf::ValueVectorOf(const XMLSize_t maxElems, + MemoryManager* const manager, + const bool toCallDestructor) : + + fCallDestructor(toCallDestructor) + , fCurCount(0) + , fMaxCount(maxElems) + , fElemList(0) + , fMemoryManager(manager) +{ + fElemList = (TElem*) fMemoryManager->allocate + ( + fMaxCount * sizeof(TElem) + ); //new TElem[fMaxCount]; + + memset(fElemList, 0, fMaxCount * sizeof(TElem)); +} + +template +ValueVectorOf::ValueVectorOf(const ValueVectorOf& toCopy) : + XMemory(toCopy) + , fCallDestructor(toCopy.fCallDestructor) + , fCurCount(toCopy.fCurCount) + , fMaxCount(toCopy.fMaxCount) + , fElemList(0) + , fMemoryManager(toCopy.fMemoryManager) +{ + fElemList = (TElem*) fMemoryManager->allocate + ( + fMaxCount * sizeof(TElem) + ); //new TElem[fMaxCount]; + + memset(fElemList, 0, fMaxCount * sizeof(TElem)); + for (XMLSize_t index = 0; index < fCurCount; index++) + fElemList[index] = toCopy.fElemList[index]; +} + +template ValueVectorOf::~ValueVectorOf() +{ + if (fCallDestructor) { + for (XMLSize_t index=fMaxCount; index > 0; index--) + fElemList[index-1].~TElem(); + } + fMemoryManager->deallocate(fElemList); //delete [] fElemList; +} + + + +// --------------------------------------------------------------------------- +// ValueVectorOf: Operators +// --------------------------------------------------------------------------- +template ValueVectorOf& +ValueVectorOf::operator=(const ValueVectorOf& toAssign) +{ + if (this == &toAssign) + return *this; + + // Reallocate if required + if (fMaxCount < toAssign.fCurCount) + { + fMemoryManager->deallocate(fElemList); //delete [] fElemList; + fElemList = (TElem*) fMemoryManager->allocate + ( + toAssign.fMaxCount * sizeof(TElem) + ); //new TElem[toAssign.fMaxCount]; + fMaxCount = toAssign.fMaxCount; + } + + fCurCount = toAssign.fCurCount; + for (XMLSize_t index = 0; index < fCurCount; index++) + fElemList[index] = toAssign.fElemList[index]; + + return *this; +} + + +// --------------------------------------------------------------------------- +// ValueVectorOf: Element management +// --------------------------------------------------------------------------- +template void ValueVectorOf::addElement(const TElem& toAdd) +{ + ensureExtraCapacity(1); + fElemList[fCurCount++] = toAdd; +} + +template void ValueVectorOf:: +setElementAt(const TElem& toSet, const XMLSize_t setAt) +{ + if (setAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + fElemList[setAt] = toSet; +} + +template void ValueVectorOf:: +insertElementAt(const TElem& toInsert, const XMLSize_t insertAt) +{ + if (insertAt == fCurCount) + { + addElement(toInsert); + return; + } + + if (insertAt > fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + // Make room for the newbie + ensureExtraCapacity(1); + for (XMLSize_t index = fCurCount; index > insertAt; index--) + fElemList[index] = fElemList[index-1]; + + // And stick it in and bump the count + fElemList[insertAt] = toInsert; + fCurCount++; +} + +template void ValueVectorOf:: +removeElementAt(const XMLSize_t removeAt) +{ + if (removeAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + // Copy down every element above remove point + for (XMLSize_t index = removeAt; index < fCurCount-1; index++) + fElemList[index] = fElemList[index+1]; + + // And bump down count + fCurCount--; +} + +template void ValueVectorOf::removeAllElements() +{ + fCurCount = 0; +} + +template +bool ValueVectorOf::containsElement(const TElem& toCheck, + const XMLSize_t startIndex) { + + for (XMLSize_t i = startIndex; i < fCurCount; i++) { + if (fElemList[i] == toCheck) { + return true; + } + } + + return false; +} + + +// --------------------------------------------------------------------------- +// ValueVectorOf: Getter methods +// --------------------------------------------------------------------------- +template const TElem& ValueVectorOf:: +elementAt(const XMLSize_t getAt) const +{ + if (getAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + return fElemList[getAt]; +} + +template TElem& ValueVectorOf:: +elementAt(const XMLSize_t getAt) +{ + if (getAt >= fCurCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + return fElemList[getAt]; +} + +template XMLSize_t ValueVectorOf::curCapacity() const +{ + return fMaxCount; +} + +template XMLSize_t ValueVectorOf::size() const +{ + return fCurCount; +} + +template +MemoryManager* ValueVectorOf::getMemoryManager() const +{ + return fMemoryManager; +} + +// --------------------------------------------------------------------------- +// ValueVectorOf: Miscellaneous +// --------------------------------------------------------------------------- +template void ValueVectorOf:: +ensureExtraCapacity(const XMLSize_t length) +{ + XMLSize_t newMax = fCurCount + length; + + if (newMax > fMaxCount) + { + // Avoid too many reallocations by expanding by a percentage + XMLSize_t minNewMax = (XMLSize_t)((double)fCurCount * 1.25); + if (newMax < minNewMax) + newMax = minNewMax; + + TElem* newList = (TElem*) fMemoryManager->allocate + ( + newMax * sizeof(TElem) + ); //new TElem[newMax]; + for (XMLSize_t index = 0; index < fCurCount; index++) + newList[index] = fElemList[index]; + + fMemoryManager->deallocate(fElemList); //delete [] fElemList; + fElemList = newList; + fMaxCount = newMax; + } +} + +template const TElem* ValueVectorOf::rawData() const +{ + return fElemList; +} + + + +// --------------------------------------------------------------------------- +// ValueVectorEnumerator: Constructors and Destructor +// --------------------------------------------------------------------------- +template ValueVectorEnumerator:: +ValueVectorEnumerator( ValueVectorOf* const toEnum + , const bool adopt) : + fAdopted(adopt) + , fCurIndex(0) + , fToEnum(toEnum) +{ +} + +template ValueVectorEnumerator::~ValueVectorEnumerator() +{ + if (fAdopted) + delete fToEnum; +} + + +// --------------------------------------------------------------------------- +// ValueVectorEnumerator: Enum interface +// --------------------------------------------------------------------------- +template bool +ValueVectorEnumerator::hasMoreElements() const +{ + if (fCurIndex >= fToEnum->size()) + return false; + return true; +} + +template TElem& ValueVectorEnumerator::nextElement() +{ + return fToEnum->elementAt(fCurIndex++); +} + +template void ValueVectorEnumerator::Reset() +{ + fCurIndex = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/ValueVectorOf.hpp b/project/jni/xerces/src/xercesc/util/ValueVectorOf.hpp new file mode 100644 index 000000000..af63de567 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/ValueVectorOf.hpp @@ -0,0 +1,162 @@ +/* + * 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: ValueVectorOf.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUEVECTOROF_HPP) +#define XERCESC_INCLUDE_GUARD_VALUEVECTOROF_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class ValueVectorOf : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueVectorOf + ( + const XMLSize_t maxElems + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , const bool toCallDestructor = false + ); + ValueVectorOf(const ValueVectorOf& toCopy); + ~ValueVectorOf(); + + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + ValueVectorOf& operator=(const ValueVectorOf& toAssign); + + + // ----------------------------------------------------------------------- + // Element management + // ----------------------------------------------------------------------- + void addElement(const TElem& toAdd); + void setElementAt(const TElem& toSet, const XMLSize_t setAt); + void insertElementAt(const TElem& toInsert, const XMLSize_t insertAt); + void removeElementAt(const XMLSize_t removeAt); + void removeAllElements(); + bool containsElement(const TElem& toCheck, const XMLSize_t startIndex = 0); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const TElem& elementAt(const XMLSize_t getAt) const; + TElem& elementAt(const XMLSize_t getAt); + XMLSize_t curCapacity() const; + XMLSize_t size() const; + MemoryManager* getMemoryManager() const; + + + // ----------------------------------------------------------------------- + // Miscellaneous + // ----------------------------------------------------------------------- + void ensureExtraCapacity(const XMLSize_t length); + const TElem* rawData() const; + + +private: + // ----------------------------------------------------------------------- + // Data members + // + // fCurCount + // The count of values current added to the vector, which may be + // less than the internal capacity. + // + // fMaxCount + // The current capacity of the vector. + // + // fElemList + // The list of elements, which is dynamically allocated to the needed + // size. + // ----------------------------------------------------------------------- + bool fCallDestructor; + XMLSize_t fCurCount; + XMLSize_t fMaxCount; + TElem* fElemList; + MemoryManager* fMemoryManager; +}; + + +// +// An enumerator for a value vector. It derives from the basic enumerator +// class, so that value vectors can be generically enumerated. +// +template class ValueVectorEnumerator : public XMLEnumerator, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ValueVectorEnumerator + ( + ValueVectorOf* const toEnum + , const bool adopt = false + ); + virtual ~ValueVectorEnumerator(); + + + // ----------------------------------------------------------------------- + // Enum interface + // ----------------------------------------------------------------------- + bool hasMoreElements() const; + TElem& nextElement(); + void Reset(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueVectorEnumerator(const ValueVectorEnumerator&); + ValueVectorEnumerator& operator=(const ValueVectorEnumerator&); + + // ----------------------------------------------------------------------- + // Data Members + // + // fAdopted + // Indicates whether we have adopted the passed vector. If so then + // we delete the vector when we are destroyed. + // + // fCurIndex + // This is the current index into the vector. + // + // fToEnum + // The value vector being enumerated. + // ----------------------------------------------------------------------- + bool fAdopted; + XMLSize_t fCurIndex; + ValueVectorOf* fToEnum; +}; + +XERCES_CPP_NAMESPACE_END + +#if !defined(XERCES_TMPLSINC) +#include +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.cpp b/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.cpp new file mode 100644 index 000000000..f70858c2f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.cpp @@ -0,0 +1,218 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// XML256TableTranscoder: Public Destructor +// --------------------------------------------------------------------------- +XML256TableTranscoder::~XML256TableTranscoder() +{ + // We don't own the tables, we just reference them +} + + +// --------------------------------------------------------------------------- +// XML256TableTranscoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XML256TableTranscoder::transcodeFrom(const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the number of chars in the source. + // + const XMLSize_t countToDo = srcCount < maxChars ? srcCount : maxChars; + + // + // Loop through the count we have to do and map each char via the + // lookup table. + // + const XMLByte* srcPtr = srcData; + const XMLByte* endPtr = (srcPtr + countToDo); + XMLCh* outPtr = toFill; + while (srcPtr < endPtr) + { + const XMLCh uniCh = fFromTable[*srcPtr++]; + if (uniCh != 0xFFFF) + { + *outPtr++ = uniCh; + continue; + } + } + + + // Set the bytes eaten + bytesEaten = countToDo; + + // Set the character sizes to the fixed size + memset(charSizes, 1, countToDo); + + // Return the chars we transcoded + return countToDo; +} + + +XMLSize_t +XML256TableTranscoder::transcodeTo( const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the number of chars in the source. + // + const XMLSize_t countToDo = srcCount < maxBytes ? srcCount : maxBytes; + + // + // Loop through the count we have to do and map each char via the + // lookup table. + // + const XMLCh* srcPtr = srcData; + const XMLCh* endPtr = (srcPtr + countToDo); + XMLByte* outPtr = toFill; + XMLByte nextOut; + while (srcPtr < endPtr) + { + // + // Get the next src char out to a temp, then do a binary search + // of the 'to' table for this entry. + // + if ((nextOut = xlatOneTo(*srcPtr))!=0) + { + *outPtr++ = nextOut; + srcPtr++; + continue; + } + + // + // Its not representable so, according to the options, either + // throw or use the replacement. + // + if (options == UnRep_Throw) + { + XMLCh tmpBuf[17]; + XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager()); + ThrowXMLwithMemMgr2 + ( + TranscodingException + , XMLExcepts::Trans_Unrepresentable + , tmpBuf + , getEncodingName() + , getMemoryManager() + ); + } + + // Eat the source char and use the replacement char + srcPtr++; + *outPtr++ = 0x3F; + } + + // Set the chars eaten + charsEaten = countToDo; + + // Return the bytes we transcoded + return countToDo; +} + + +bool XML256TableTranscoder::canTranscodeTo(const unsigned int toCheck) +{ + return (xlatOneTo(toCheck) != 0); +} + + +// --------------------------------------------------------------------------- +// XML256TableTranscoder: Hidden constructor +// --------------------------------------------------------------------------- +XML256TableTranscoder:: +XML256TableTranscoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , const XMLCh* const fromTable + , const XMLTransService::TransRec* const toTable + , const XMLSize_t toTableSize + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) + , fFromTable(fromTable) + , fToSize(toTableSize) + , fToTable(toTable) +{ +} + + +// --------------------------------------------------------------------------- +// XML256TableTranscoder: Private helper methods +// --------------------------------------------------------------------------- +XMLByte XML256TableTranscoder::xlatOneTo(const XMLCh toXlat) const +{ + XMLSize_t lowOfs = 0; + XMLSize_t hiOfs = fToSize - 1; + do + { + // Calc the mid point of the low and high offset. + const XMLSize_t midOfs = ((hiOfs - lowOfs) / 2) + lowOfs; + + // + // If our test char is greater than the mid point char, then + // we move up to the upper half. Else we move to the lower + // half. If its equal, then its our guy. + // + if (toXlat > fToTable[midOfs].intCh) + { + lowOfs = midOfs; + } + else if (toXlat < fToTable[midOfs].intCh) + { + hiOfs = midOfs; + } + else + { + return fToTable[midOfs].extCh; + } + } while (lowOfs + 1 < hiOfs); + + // Check the high end of the range otherwise the + // last item in the table may never be found. + if (toXlat == fToTable[hiOfs].intCh) + { + return fToTable[hiOfs].extCh; + } + + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.hpp b/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.hpp new file mode 100644 index 000000000..7f0907e2f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XML256TableTranscoder.hpp @@ -0,0 +1,146 @@ +/* + * 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: XML256TableTranscoder.hpp 635560 2008-03-10 14:10:09Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML256TABLETRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XML256TABLETRANSCODER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class implements the functionality of a common type of transcoder +// for an 8 bit, single byte encoding based on a set of 'to' and 'from' +// translation tables. Actual derived classes are trivial and just have to +// provide us with pointers to their tables and we do all the work. +// +class XMLUTIL_EXPORT XML256TableTranscoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + virtual ~XML256TableTranscoder(); + + + // ----------------------------------------------------------------------- + // The virtual transcoding interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XML256TableTranscoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , const XMLCh* const fromTable + , const XMLTransService::TransRec* const toTable + , const XMLSize_t toTableSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + // ----------------------------------------------------------------------- + // Protected helper methods + // ----------------------------------------------------------------------- + XMLByte xlatOneTo + ( + const XMLCh toXlat + ) const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XML256TableTranscoder(); + XML256TableTranscoder(const XML256TableTranscoder&); + XML256TableTranscoder& operator=(const XML256TableTranscoder&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fFromTable + // This is the 'from' table that we were given during construction. + // It is a 256 entry table of XMLCh chars. Each entry is the + // Unicode code point for the external encoding point of that value. + // So fFromTable[N] is the Unicode translation of code point N of + // the source encoding. + // + // We don't own this table, we just refer to it. It is assumed that + // the table is static, for performance reasons. + // + // fToSize + // The 'to' table is variable sized. This indicates how many records + // are in it. + // + // fToTable + // This is a variable sized table of TransRec structures. It must + // be sorted by the intCh field, i.e. the XMLCh field. It is searched + // binarily to find the record for a particular Unicode char. Then + // that record's extch field is the translation record. + // + // We don't own this table, we just refer to it. It is assumed that + // the table is static, for performance reasons. + // + // NOTE: There may be dups of the extCh field, since there might be + // multiple Unicode code points which map to the same external code + // point. Normally this won't happen, since the parser assumes that + // internalization is normalized, but we have to be prepared to do + // the right thing if some client code gives us non-normalized data + // itself. + // ----------------------------------------------------------------------- + const XMLCh* fFromTable; + XMLSize_t fToSize; + const XMLTransService::TransRec* fToTable; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XML88591Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XML88591Transcoder.cpp new file mode 100644 index 000000000..09646be57 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XML88591Transcoder.cpp @@ -0,0 +1,146 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XML88591Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XML88591Transcoder::XML88591Transcoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) +{ +} + + +XML88591Transcoder::~XML88591Transcoder() +{ +} + + +// --------------------------------------------------------------------------- +// XML88591Transcoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XML88591Transcoder::transcodeFrom( const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the number of bytes in the source. + // + const XMLSize_t countToDo = srcCount < maxChars ? srcCount : maxChars; + + // + // Loop through the bytes to do and convert over each byte. Its just + // a cast to the wide char type. + // + const XMLByte* srcPtr = srcData; + XMLCh* destPtr = toFill; + const XMLByte* srcEnd = srcPtr + countToDo; + while (srcPtr < srcEnd) + *destPtr++ = XMLCh(*srcPtr++); + + // Set the bytes eaten, and set the char size array to the fixed size + bytesEaten = countToDo; + memset(charSizes, 1, countToDo); + + // Return the chars we transcoded + return countToDo; +} + + +XMLSize_t +XML88591Transcoder::transcodeTo(const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output bytes and the number of chars in the source. + // + const XMLSize_t countToDo = srcCount < maxBytes ? srcCount : maxBytes; + + // + // Loop through the bytes to do and convert over each byte. Its just + // a downcast of the wide char, checking for unrepresentable chars. + // + const XMLCh* srcPtr = srcData; + const XMLCh* srcEnd = srcPtr + countToDo; + XMLByte* destPtr = toFill; + while (srcPtr < srcEnd) + { + // If its legal, take it and jump back to top + if (*srcPtr < 256) + { + *destPtr++ = XMLByte(*srcPtr++); + continue; + } + + // + // Its not representable so use a replacement char. According to + // the options, either throw or use the replacement. + // + if (options == UnRep_Throw) + { + XMLCh tmpBuf[17]; + XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager()); + ThrowXMLwithMemMgr2 + ( + TranscodingException + , XMLExcepts::Trans_Unrepresentable + , tmpBuf + , getEncodingName() + , getMemoryManager() + ); + } + *destPtr++ = 0x1A; + srcPtr++; + } + + // Set the chars eaten + charsEaten = countToDo; + + // Return the bytes we transcoded + return countToDo; +} + + +bool XML88591Transcoder::canTranscodeTo(const unsigned int toCheck) +{ + return (toCheck < 256); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XML88591Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XML88591Transcoder.hpp new file mode 100644 index 000000000..623969e31 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XML88591Transcoder.hpp @@ -0,0 +1,93 @@ +/* + * 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: XML88591Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML88591TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XML88591TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple 8859-1 transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XML88591Transcoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XML88591Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XML88591Transcoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XML88591Transcoder(const XML88591Transcoder&); + XML88591Transcoder& operator=(const XML88591Transcoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.cpp b/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.cpp new file mode 100644 index 000000000..a5302bd90 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.cpp @@ -0,0 +1,172 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLASCIITranscoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLASCIITranscoder::XMLASCIITranscoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) +{ +} + + +XMLASCIITranscoder::~XMLASCIITranscoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLASCIITranscoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XMLASCIITranscoder::transcodeFrom( const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the source byte count. + // + const XMLSize_t countToDo = srcCount < maxChars ? srcCount : maxChars; + + // + // Now loop through that many source chars and just cast each one + // over to the XMLCh format. Check each source that its really a + // valid ASCI char. + // + const XMLByte* srcPtr = srcData; + XMLCh* outPtr = toFill; + XMLSize_t countDone = 0; + for (; countDone < countToDo; countDone++) + { + // Do the optimistic work up front + if (*srcPtr < 0x80) + { + *outPtr++ = XMLCh(*srcPtr++); + continue; + } + + // + // We got non source encoding char. If we got more than 32 chars, + // the just break out. We'll come back here later to hit this again + // and give an error much closer to the real source position. + // + if (countDone > 32) + break; + + XMLCh tmpBuf[17]; + XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager()); + ThrowXMLwithMemMgr2 + ( + TranscodingException + , XMLExcepts::Trans_Unrepresentable + , tmpBuf + , getEncodingName() + , getMemoryManager() + ); + } + + // Set the bytes we ate + bytesEaten = countDone; + + // Set the char sizes to the fixed size + memset(charSizes, 1, countDone); + + // Return the chars we transcoded + return countDone; +} + + +XMLSize_t +XMLASCIITranscoder::transcodeTo(const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the source byte count. + // + const XMLSize_t countToDo = srcCount < maxBytes ? srcCount : maxBytes; + + const XMLCh* srcPtr = srcData; + XMLByte* outPtr = toFill; + for (XMLSize_t index = 0; index < countToDo; index++) + { + // If its legal, do it and jump back to the top + if (*srcPtr < 0x80) + { + *outPtr++ = XMLByte(*srcPtr++); + continue; + } + + // + // Its not representable so use a replacement char. According to + // the options, either throw or use the replacement. + // + if (options == UnRep_Throw) + { + XMLCh tmpBuf[17]; + XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager()); + ThrowXMLwithMemMgr2 + ( + TranscodingException + , XMLExcepts::Trans_Unrepresentable + , tmpBuf + , getEncodingName() + , getMemoryManager() + ); + } + + // Use the replacement char + *outPtr++ = 0x1A; + srcPtr++; + } + + // Set the chars we ate + charsEaten = countToDo; + + // Return the byte we transcoded + return countToDo; +} + + +bool XMLASCIITranscoder::canTranscodeTo(const unsigned int toCheck) +{ + return (toCheck < 0x80); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.hpp b/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.hpp new file mode 100644 index 000000000..0c0e63524 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLASCIITranscoder.hpp @@ -0,0 +1,93 @@ +/* + * 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: XMLASCIITranscoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLASCIITRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLASCIITRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple ASCII transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XMLASCIITranscoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Constructors and destructor + // ----------------------------------------------------------------------- + XMLASCIITranscoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLASCIITranscoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLASCIITranscoder(const XMLASCIITranscoder&); + XMLASCIITranscoder& operator=(const XMLASCIITranscoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.cpp b/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.cpp new file mode 100644 index 000000000..4340b08bd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.cpp @@ -0,0 +1,693 @@ +/* + * 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: XMLAbstractDoubleFloat.cpp 673155 2008-07-01 17:55:39Z dbertoni $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// local data member +// --------------------------------------------------------------------------- +static const int BUF_LEN = 64; + +static XMLCh expSign[] = {chLatin_e, chLatin_E, chNull}; + +// --------------------------------------------------------------------------- +// ctor/dtor +// --------------------------------------------------------------------------- +XMLAbstractDoubleFloat::XMLAbstractDoubleFloat(MemoryManager* const manager) +: fValue(0) +, fType(Normal) +, fDataConverted(false) +, fDataOverflowed(false) +, fSign(0) +, fRawData(0) +, fFormattedString(0) +, fMemoryManager(manager) +{ +} + +XMLAbstractDoubleFloat::~XMLAbstractDoubleFloat() +{ + fMemoryManager->deallocate(fRawData);//delete [] fRawData; + fMemoryManager->deallocate(fFormattedString);//delete [] fFormattedString; +} + +void XMLAbstractDoubleFloat::init(const XMLCh* const strValue) +{ + if ((!strValue) || (!*strValue)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, fMemoryManager); + + fRawData = XMLString::replicate(strValue, fMemoryManager); // preserve the raw data form + + XMLCh* tmpStrValue = XMLString::replicate(strValue, fMemoryManager); + ArrayJanitor janTmpName(tmpStrValue, fMemoryManager); + XMLString::trim(tmpStrValue); + + if (!*tmpStrValue) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, fMemoryManager); + + normalizeZero(tmpStrValue); + + if (XMLString::equals(tmpStrValue, XMLUni::fgNegINFString) ) + { + fType = NegINF; + fSign = -1; + } + else if (XMLString::equals(tmpStrValue, XMLUni::fgPosINFString) ) + { + fType = PosINF; + fSign = 1; + } + else if (XMLString::equals(tmpStrValue, XMLUni::fgNaNString) ) + { + fType = NaN; + fSign = 1; + } + else + // + // Normal case + // + { + // Use a stack-based buffer when possible. Since all + // valid doubles or floats will only contain ASCII + // digits, a decimal point, or the exponent character, + // they will all be single byte characters, and this will + // work. + static const XMLSize_t maxStackSize = 100; + + XMLSize_t lenTempStrValue = 0; + + + // Need to check that the string only contains valid schema characters + // since the call to strtod may allow other values. For example, AIX + // allows "infinity" and "+INF" + XMLCh curChar; + while ((curChar = tmpStrValue[lenTempStrValue])!=0) { + if (!((curChar >= chDigit_0 && + curChar <= chDigit_9) || + curChar == chPeriod || + curChar == chDash || + curChar == chPlus || + curChar == chLatin_E || + curChar == chLatin_e)) { + ThrowXMLwithMemMgr( + NumberFormatException, + XMLExcepts::XMLNUM_Inv_chars, + getMemoryManager()); + } + lenTempStrValue++; + } + + if (lenTempStrValue < maxStackSize) + { + char buffer[maxStackSize + 1]; + + XMLString::transcode( + tmpStrValue, + buffer, + sizeof(buffer) - 1, + getMemoryManager()); + + // Do this for safety, because we've + // no guarantee we didn't overrun the + // capacity of the buffer when transcoding + // a bogus value. + buffer[maxStackSize] = '\0'; + + // If they aren't the same length, then some + // non-ASCII multibyte character was present. + // This will only happen in the case where the + // string has a bogus character, and it's long + // enough to overrun this buffer, but we need + // to check, even if it's unlikely to happen. + if (XMLString::stringLen(buffer) != lenTempStrValue) + { + ThrowXMLwithMemMgr( + NumberFormatException, + XMLExcepts::XMLNUM_Inv_chars, + getMemoryManager()); + } + + checkBoundary(buffer); + } + else + { + char *nptr = XMLString::transcode(tmpStrValue, getMemoryManager()); + const ArrayJanitor janStr(nptr, fMemoryManager); + + checkBoundary(nptr); + } + } + +} + +XMLCh* XMLAbstractDoubleFloat::getRawData() const +{ + return fRawData; +} + +const XMLCh* XMLAbstractDoubleFloat::getFormattedString() const +{ + if (!fDataConverted) + { + return fRawData; + } + else + { + if (!fFormattedString) + { + XMLAbstractDoubleFloat *temp = (XMLAbstractDoubleFloat *) this; + temp->formatString(); + } + + return fFormattedString; + } + +} + +void XMLAbstractDoubleFloat::formatString() +{ + + XMLSize_t rawDataLen = XMLString::stringLen(fRawData); + fFormattedString = (XMLCh*) fMemoryManager->allocate + ( + (rawDataLen + 8) * sizeof(XMLCh) + );//new XMLCh [ rawDataLen + 8]; + for (XMLSize_t i = 0; i < rawDataLen + 8; i++) + fFormattedString[i] = chNull; + + XMLString::copyString(fFormattedString, fRawData); + + fFormattedString[rawDataLen] = chSpace; + fFormattedString[rawDataLen + 1] = chOpenParen; + + switch (fType) + { + case NegINF: + XMLString::catString(fFormattedString, XMLUni::fgNegINFString); + break; + case PosINF: + XMLString::catString(fFormattedString, XMLUni::fgPosINFString); + break; + case NaN: + XMLString::catString(fFormattedString, XMLUni::fgNaNString); + break; + default: + // its zero + XMLString::catString(fFormattedString, XMLUni::fgPosZeroString); + break; + } + + fFormattedString[XMLString::stringLen(fFormattedString)] = chCloseParen; + +} + +int XMLAbstractDoubleFloat::getSign() const +{ + return fSign; +} + +// +// +// +int XMLAbstractDoubleFloat::compareValues(const XMLAbstractDoubleFloat* const lValue + , const XMLAbstractDoubleFloat* const rValue + , MemoryManager* const manager) +{ + // + // case#1: lValue normal + // rValue normal + // + if ((!lValue->isSpecialValue()) && + (!rValue->isSpecialValue()) ) + { + if (lValue->fValue == rValue->fValue) + return EQUAL; + else + return (lValue->fValue > rValue->fValue) ? GREATER_THAN : LESS_THAN; + + } + // + // case#2: lValue special + // rValue special + // + // Schema Errata E2-40 + // + // Positive Infinity is greater than all other non-NAN value. + // Nan equals itself but is not comparable with (neither greater than nor less than) + // any other value in the value space + // Negative Infinity is less than all other non-NAN values. + // + else + if ((lValue->isSpecialValue()) && + (rValue->isSpecialValue()) ) + { + if (lValue->fType == rValue->fType) + return EQUAL; + else + { + if ((lValue->fType == NaN) || + (rValue->fType == NaN) ) + { + return INDETERMINATE; + } + else + { + return (lValue->fType > rValue->fType) ? GREATER_THAN : LESS_THAN; + } + } + + } + // + // case#3: lValue special + // rValue normal + // + else + if ((lValue->isSpecialValue()) && + (!rValue->isSpecialValue()) ) + { + return compareSpecial(lValue, manager); + } + // + // case#4: lValue normal + // rValue special + // + else + { + return (-1) * compareSpecial(rValue, manager); + } +} + +int XMLAbstractDoubleFloat::compareSpecial(const XMLAbstractDoubleFloat* const specialValue + , MemoryManager* const manager) +{ + switch (specialValue->fType) + { + case NegINF: + return LESS_THAN; + case PosINF: + return GREATER_THAN; + case NaN: + // NaN is not comparable to any other value + return INDETERMINATE; + + default: + XMLCh value1[BUF_LEN+1]; + XMLString::binToText(specialValue->fType, value1, 16, 10, manager); + ThrowXMLwithMemMgr1(NumberFormatException + , XMLExcepts::XMLNUM_DBL_FLT_InvalidType + , value1, manager); + //internal error + return 0; + } +} + +// +// Assumption: no leading space +// +// 1. The valid char set is "+-.0" +// 2. There shall be only one sign at the first position, if there is one. +// 3. There shall be only one dot '.', if there is one. +// +// Return: +// +// for input comforming to [+]? [0]* '.'? [0]*, +// normalize the input to positive zero string +// for input comforming to '-' [0]* '.'? [0]*, +// normalize the input to negative zero string +// otherwise, do nothing +// +void XMLAbstractDoubleFloat::normalizeZero(XMLCh* const inData) +{ + + // do a quick check + if (!inData || + !*inData || + (XMLString::equals(inData, XMLUni::fgNegZeroString) ) || + (XMLString::equals(inData, XMLUni::fgPosZeroString) ) ) + return; + + XMLCh* srcStr = inData; + bool minusSeen = false; + bool dotSeen = false; + + // process sign if any + if (*srcStr == chDash) + { + minusSeen = true; + srcStr++; + if (!*srcStr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager()); + } + } + else if (*srcStr == chPlus) + { + srcStr++; + if (!*srcStr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager()); + } + } + else if (*srcStr == chPeriod) + { + dotSeen = true; + srcStr++; + if (!*srcStr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager()); + } + } + + // scan the string + + bool isValidStr = true; + XMLCh theChar; + while ((theChar=*srcStr++)!=0 && isValidStr) + { + if ( theChar != chPeriod && theChar != chDigit_0 ) + isValidStr = false; // invalid char + else if (theChar == chPeriod) // process dot + dotSeen ? isValidStr = false : dotSeen = true; + } + + // need not to worry about the memory problem + // since either fgNegZeroString or fgPosZeroString + // is the canonical form (meaning the shortest in length) + // of their category respectively. + if (isValidStr) + { + if (minusSeen) + XMLString::copyString(inData, XMLUni::fgNegZeroString); + else + XMLString::copyString(inData, XMLUni::fgPosZeroString); + } + else + { + // we got to set the sign first, since this string may + // eventaully turn out to be beyond the minimum representable + // number and reduced to -0 or +0. + fSign = minusSeen ? -1 : 1; + } + + return; +} + +void XMLAbstractDoubleFloat::normalizeDecimalPoint(char* const toNormal) +{ + // find the locale-specific decimal point delimiter + char delimiter = '.'; + + // replace '.' with the locale-specific decimal point delimiter + if ( delimiter != '.' ) + { + char* period = strchr( toNormal, '.' ); + if ( period ) + { + *period = delimiter; + } + } +} + + +void +XMLAbstractDoubleFloat::convert(char* const strValue) +{ + normalizeDecimalPoint(strValue); + + char *endptr = 0; + errno = 0; + fValue = strtod(strValue, &endptr); + + // check if all chars are valid char. If they are, endptr will + // pointer to the null terminator. + if (*endptr != '\0') + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager()); + } + + // check if overflow/underflow occurs + if (errno == ERANGE) + { + + fDataConverted = true; + + if ( fValue < 0 ) + { + if (fValue > (-1)*DBL_MIN) + { + fValue = 0; + } + else + { + fType = NegINF; + fDataOverflowed = true; + } + } + else if ( fValue > 0) + { + if (fValue < DBL_MIN ) + { + fValue = 0; + } + else + { + fType = PosINF; + fDataOverflowed = true; + } + } + } +} + + + +/*** + * E2-40 + * + * 3.2.4 float + * 3.2.5 double + * + * . the exponent must be indicated by "E". + * if the exponent is zero, it must be indicated by "E0". + * + * . For the mantissa, + * the preceding optional "+" sign is prohibited and + * the decimal point is required. + * + * . For the exponent, + * the preceding optional "+" sign is prohibited. + * Leading zeroes are prohibited. + * + * . Leading and trailing zeroes are prohibited subject to the following: + * number representations must be normalized such that + * . there is a single digit, which is non-zero, to the left of the decimal point and + * . at least a single digit to the right of the decimal point. + * . unless the value being represented is zero. + * The canonical representation for zero is 0.0E0 + * + ***/ +XMLCh* XMLAbstractDoubleFloat::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr) +{ + // before anything, let's look for special tokens since that + // breaks the calls to parse below. + if(XMLString::equals(rawData, XMLUni::fgNegINFString) || + XMLString::equals(rawData, XMLUni::fgPosINFString) || + XMLString::equals(rawData, XMLUni::fgNaNString) ) + { + return XMLString::replicate(rawData, memMgr); + } + + try + { + XMLSize_t strLen = XMLString::stringLen(rawData); + XMLCh* manStr = (XMLCh*) memMgr->allocate((strLen + 1) * sizeof(XMLCh)); + ArrayJanitor janManStr(manStr, memMgr); + XMLCh* manBuf = (XMLCh*) memMgr->allocate((strLen + 1) * sizeof(XMLCh)); + ArrayJanitor janManBuf(manBuf, memMgr); + XMLCh* expStr = (XMLCh*) memMgr->allocate((strLen + 1) * sizeof(XMLCh)); + ArrayJanitor janExpStr(expStr, memMgr); + XMLCh* retBuffer = (XMLCh*) memMgr->allocate((strLen + 8) * sizeof(XMLCh)); + ArrayJanitor janRetBuffer(retBuffer, memMgr); + retBuffer[0] = 0; + + int sign, totalDigits, fractDigits, expValue = 0; + + const XMLCh* ePosition = XMLString::findAny(rawData, expSign); + + /*** + * parse mantissa and exp separately + ***/ + if (!ePosition) + { + XMLBigDecimal::parseDecimal(rawData, manBuf, sign, totalDigits, fractDigits, memMgr); + expValue = 0; + } + else + { + XMLSize_t manLen = ePosition - rawData; + XMLString::copyNString(manStr, rawData, manLen); + *(manStr + manLen) = chNull; + XMLBigDecimal::parseDecimal(manStr, manBuf, sign, totalDigits, fractDigits, memMgr); + + XMLSize_t expLen = strLen - manLen - 1; + ePosition++; + XMLString::copyNString(expStr, ePosition, expLen); + *(expStr + expLen) = chNull; + expValue = XMLString::parseInt(expStr); + } + + if ( (sign == 0) || (totalDigits == 0) ) + { + retBuffer[0] = chDigit_0; + retBuffer[1] = chPeriod; + retBuffer[2] = chDigit_0; + retBuffer[3] = chLatin_E; + retBuffer[4] = chDigit_0; + retBuffer[5] = chNull; + } + else + { + XMLCh* retPtr = retBuffer; + + if (sign == -1) + { + *retPtr++ = chDash; + } + + *retPtr++ = manBuf[0]; + *retPtr++ = chPeriod; + + //XMLBigDecimal::parseDecimal() will eliminate trailing zeros + // iff there is a decimal points + // eg. 56.7800e0 -> manBuf = 5678, totalDigits = 4, fractDigits = 2 + // we print it as 5.678e1 + // + // but it wont remove trailing zeros if there is no decimal point. + // eg. 567800e0 -> manBuf = 567800, totalDigits = 6, fractDigits = 0 + // we print it 5.67800e5 + // + // for the latter, we need to print it as 5.678e5 instead + // + XMLCh* endPtr = manBuf + totalDigits; + + if (fractDigits == 0) + { + while(*(endPtr - 1) == chDigit_0) + endPtr--; + } + + XMLSize_t remainLen = endPtr - &(manBuf[1]); + + if (remainLen) + { + XMLString::copyNString(retPtr, &(manBuf[1]), remainLen); + retPtr += remainLen; + } + else + { + *retPtr++ = chDigit_0; + } + + /*** + * + * . adjust expValue + * + * new_fractDigits = totalDigits - 1 + * new_expValue = old_expValue + (new_fractDigits - fractDigits) + * + ***/ + expValue += (totalDigits - 1) - fractDigits ; + XMLString::binToText(expValue, expStr, strLen, 10, memMgr); + *retPtr++ = chLatin_E; + *retPtr = chNull; + + XMLString::catString(&(retBuffer[0]), expStr); + } + + janRetBuffer.release(); + return retBuffer; + } + catch (const NumberFormatException&) + { + return 0; + } +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLAbstractDoubleFloat) + +void XMLAbstractDoubleFloat::serialize(XSerializeEngine& serEng) +{ + //REVISIT: may not need to call base since it does nothing + XMLNumber::serialize(serEng); + + if (serEng.isStoring()) + { + serEng << fValue; + serEng << fType; + serEng << fDataConverted; + serEng << fDataOverflowed; + serEng << fSign; + + serEng.writeString(fRawData); + + // Do not serialize fFormattedString + + } + else + { + serEng >> fValue; + + int type = 0; + serEng >> type; + fType = (LiteralType) type; + + serEng >> fDataConverted; + serEng >> fDataOverflowed; + serEng >> fSign; + + serEng.readString(fRawData); + + // Set it to 0 force it to re-format if needed + fFormattedString = 0; + + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.hpp b/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.hpp new file mode 100644 index 000000000..412959c6f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLAbstractDoubleFloat.hpp @@ -0,0 +1,221 @@ +/* + * 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: XMLAbstractDoubleFloat.hpp 605828 2007-12-20 08:05:47Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_ABSTRACT_DOUBLE_FLOAT_HPP) +#define XERCESC_INCLUDE_GUARD_XML_ABSTRACT_DOUBLE_FLOAT_HPP + + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * 3.2.5.1 Lexical representation + * + * double values have a lexical representation consisting of a mantissa followed, + * optionally, by the character "E" or "e", followed by an exponent. + * + * The exponent must be an integer. + * The mantissa must be a decimal number. + * The representations for exponent and mantissa must follow the lexical rules + * for integer and decimal. + * + * If the "E" or "e" and the following exponent are omitted, + * an exponent value of 0 is assumed. +***/ + +/*** + * 3.2.4.1 Lexical representation + * + * float values have a lexical representation consisting of a mantissa followed, + * optionally, by the character "E" or "e", followed by an exponent. + * + * The exponent must be an integer. + * The mantissa must be a decimal number. + * The representations for exponent and mantissa must follow the lexical rules + * for integer and decimal. + * + * If the "E" or "e" and the following exponent are omitted, + * an exponent value of 0 is assumed. +***/ + +class XMLUTIL_EXPORT XMLAbstractDoubleFloat : public XMLNumber +{ +public: + + enum LiteralType + { + NegINF, + PosINF, + NaN, + SpecialTypeNum, + Normal + }; + + virtual ~XMLAbstractDoubleFloat(); + + static XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager + ); + + virtual XMLCh* getRawData() const; + + virtual const XMLCh* getFormattedString() const; + + virtual int getSign() const; + + MemoryManager* getMemoryManager() const; + + inline bool isDataConverted() const; + + inline bool isDataOverflowed() const; + + inline double getValue() const; + + inline LiteralType getType() const; + + /*** + * + * The decimal point delimiter for the schema double/float type is + * defined to be a period and is not locale-specific. So, it must + * be replaced with the local-specific delimiter before converting + * from string to double/float. + * + ***/ + static void normalizeDecimalPoint(char* const toNormal); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLAbstractDoubleFloat) + +protected: + + // + // To be used by derived class exclusively + // + XMLAbstractDoubleFloat(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + void init(const XMLCh* const strValue); + + /** + * Compares this object to the specified object. + * The result is true if and only if the argument is not + * null and is an XMLAbstractDoubleFloat object that contains + * the same int value as this object. + * + * @param lValue the object to compare with. + * @param rValue the object to compare against. + * @param manager The MemoryManager to use to allocate objects + * @return true if the objects are the same; + * false otherwise. + */ + + static int compareValues(const XMLAbstractDoubleFloat* const lValue + , const XMLAbstractDoubleFloat* const rValue + , MemoryManager* const manager); + + // + // to be overridden by derived class + // + virtual void checkBoundary(char* const strValue) = 0; + + void + convert(char* const strValue); + +private: + // + // Unimplemented + // + // copy ctor + // assignment ctor + // + XMLAbstractDoubleFloat(const XMLAbstractDoubleFloat& toCopy); + XMLAbstractDoubleFloat& operator=(const XMLAbstractDoubleFloat& toAssign); + + void normalizeZero(XMLCh* const); + + inline bool isSpecialValue() const; + + static int compareSpecial(const XMLAbstractDoubleFloat* const specialValue + , MemoryManager* const manager); + + void formatString(); + +protected: + double fValue; + LiteralType fType; + bool fDataConverted; + bool fDataOverflowed; + +private: + int fSign; + XMLCh* fRawData; + + // + // If the original string is not lexcially the same as the five + // special value notations, and the value is converted to + // special value due underlying platform restriction on data + // representation, then this string is constructed and + // takes the form "original_string (special_value_notation)", + // otherwise it is empty. + // + XMLCh* fFormattedString; + MemoryManager* fMemoryManager; + +}; + +inline bool XMLAbstractDoubleFloat::isSpecialValue() const +{ + return (fType < SpecialTypeNum); +} + +inline MemoryManager* XMLAbstractDoubleFloat::getMemoryManager() const +{ + return fMemoryManager; +} + +inline bool XMLAbstractDoubleFloat::isDataConverted() const +{ + return fDataConverted; +} + +inline bool XMLAbstractDoubleFloat::isDataOverflowed() const +{ + return fDataOverflowed; +} + +inline double XMLAbstractDoubleFloat::getValue() const +{ + return fValue; +} + +inline XMLAbstractDoubleFloat::LiteralType XMLAbstractDoubleFloat::getType() const +{ + return fType; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLBigDecimal.cpp b/project/jni/xerces/src/xercesc/util/XMLBigDecimal.cpp new file mode 100644 index 000000000..7ebc0acd6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLBigDecimal.cpp @@ -0,0 +1,519 @@ +/* + * 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: XMLBigDecimal.cpp 557254 2007-07-18 13:28:54Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Constructs a BigDecimal from a string containing an optional (plus | minus) + * sign followed by a sequence of zero or more decimal digits, optionally + * followed by a fraction, which consists of a decimal point followed by + * zero or more decimal digits. The string must contain at least one + * digit in the integer or fractional part. The scale of the resulting + * BigDecimal will be the number of digits to the right of the decimal + * point in the string, or 0 if the string contains no decimal point. + * Any extraneous characters (including whitespace) will result in + * a NumberFormatException. + + * since parseBigDecimal() may throw exception, + * caller of XMLBigDecimal need to catch it. +// +**/ + +typedef JanitorMemFunCall CleanupType; + +XMLBigDecimal::XMLBigDecimal(const XMLCh* const strValue, + MemoryManager* const manager) +: fSign(0) +, fTotalDigits(0) +, fScale(0) +, fRawDataLen(0) +, fRawData(0) +, fIntVal(0) +, fMemoryManager(manager) +{ + if ((!strValue) || (!*strValue)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, fMemoryManager); + + CleanupType cleanup(this, &XMLBigDecimal::cleanUp); + + try + { + fRawDataLen = XMLString::stringLen(strValue); + fRawData = (XMLCh*) fMemoryManager->allocate + ( + ((fRawDataLen*2) + 2) * sizeof(XMLCh) //fRawData and fIntVal + ); + memcpy(fRawData, strValue, fRawDataLen * sizeof(XMLCh)); + fRawData[fRawDataLen] = chNull; + fIntVal = fRawData + fRawDataLen + 1; + parseDecimal(strValue, fIntVal, fSign, (int&) fTotalDigits, (int&) fScale, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLBigDecimal::~XMLBigDecimal() +{ + cleanUp(); +} + +void XMLBigDecimal::cleanUp() +{ + if (fRawData) + fMemoryManager->deallocate(fRawData); //XMLString::release(&fRawData); +} + +void XMLBigDecimal::setDecimalValue(const XMLCh* const strValue) +{ + fScale = fTotalDigits = 0; + XMLSize_t valueLen = XMLString::stringLen(strValue); + + if (valueLen > fRawDataLen) + { + fMemoryManager->deallocate(fRawData); + fRawData = (XMLCh*) fMemoryManager->allocate + ( + ((valueLen * 2) + 4) * sizeof(XMLCh) + );//XMLString::replicate(strValue, fMemoryManager); + } + + memcpy(fRawData, strValue, valueLen * sizeof(XMLCh)); + fRawData[valueLen] = chNull; + fRawDataLen = valueLen; + fIntVal = fRawData + fRawDataLen + 1; + parseDecimal(strValue, fIntVal, fSign, (int&) fTotalDigits, (int&) fScale, fMemoryManager); + +} + +/*** + * 3.2.3 decimal + * + * . the preceding optional "+" sign is prohibited. + * . The decimal point is required. + * . Leading and trailing zeroes are prohibited subject to the following: + * there must be at least one digit to the right and to the left of the decimal point which may be a zero. + * + ***/ +XMLCh* XMLBigDecimal::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr) +{ + + XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData)+1) * sizeof(XMLCh)); + ArrayJanitor janName(retBuf, memMgr); + int sign, totalDigits, fractDigits; + + try + { + parseDecimal(rawData, retBuf, sign, totalDigits, fractDigits, memMgr); + } + catch (const NumberFormatException&) + { + return 0; + } + + + //Extra space reserved in case strLen is zero + XMLSize_t strLen = XMLString::stringLen(retBuf); + XMLCh* retBuffer = (XMLCh*) memMgr->allocate( (strLen + 4) * sizeof(XMLCh)); + + if ( (sign == 0) || (totalDigits == 0)) + { + retBuffer[0] = chDigit_0; + retBuffer[1] = chPeriod; + retBuffer[2] = chDigit_0; + retBuffer[3] = chNull; + } + else + { + XMLCh* retPtr = retBuffer; + + if (sign == -1) + { + *retPtr++ = chDash; + } + + if (fractDigits == totalDigits) // no integer + { + *retPtr++ = chDigit_0; + *retPtr++ = chPeriod; + XMLString::copyNString(retPtr, retBuf, strLen); + retPtr += strLen; + *retPtr = chNull; + } + else if (fractDigits == 0) // no fraction + { + XMLString::copyNString(retPtr, retBuf, strLen); + retPtr += strLen; + *retPtr++ = chPeriod; + *retPtr++ = chDigit_0; + *retPtr = chNull; + } + else // normal + { + int intLen = totalDigits - fractDigits; + XMLString::copyNString(retPtr, retBuf, intLen); + retPtr += intLen; + *retPtr++ = chPeriod; + XMLString::copyNString(retPtr, &(retBuf[intLen]), fractDigits); + retPtr += fractDigits; + *retPtr = chNull; + } + + } + + return retBuffer; +} + +void XMLBigDecimal::parseDecimal(const XMLCh* const toParse + , XMLCh* const retBuffer + , int& sign + , int& totalDigits + , int& fractDigits + , MemoryManager* const manager) +{ + //init + retBuffer[0] = chNull; + totalDigits = 0; + fractDigits = 0; + + // Strip leading white space, if any. + const XMLCh* startPtr = toParse; + while (XMLChar1_0::isWhitespace(*startPtr)) + startPtr++; + + // If we hit the end, then return failure + if (!*startPtr) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_WSString, manager); + + // Strip tailing white space, if any. + const XMLCh* endPtr = toParse + XMLString::stringLen(toParse); + while (XMLChar1_0::isWhitespace(*(endPtr - 1))) + endPtr--; + + // '+' or '-' is allowed only at the first position + // and is NOT included in the return parsed string + sign = 1; + if (*startPtr == chDash) + { + sign = -1; + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + else if (*startPtr == chPlus) + { + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + + // Strip leading zeros + while (*startPtr == chDigit_0) + startPtr++; + + // containning zero, only zero, nothing but zero + // it is a zero, indeed + if (startPtr >= endPtr) + { + sign = 0; + return; + } + + XMLCh* retPtr = (XMLCh*) retBuffer; + + // Scan data + bool dotSignFound = false; + while (startPtr < endPtr) + { + if (*startPtr == chPeriod) + { + if (!dotSignFound) + { + dotSignFound = true; + fractDigits = (int)(endPtr - startPtr - 1); + startPtr++; + continue; + } + else // '.' is allowed only once + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_2ManyDecPoint, manager); + } + + // If not valid decimal digit, then an error + if ((*startPtr < chDigit_0) || (*startPtr > chDigit_9)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + + // copy over + *retPtr++ = *startPtr++; + totalDigits++; + } + + /*** + E2-44 totalDigits + + ... by restricting it to numbers that are expressible as i x 10^-n + where i and n are integers such that |i| < 10^totalDigits and 0 <= n <= totalDigits. + + normalization: remove all trailing zero after the '.' + and adjust the scaleValue as well. + ***/ + while ((fractDigits > 0) && (*(retPtr-1) == chDigit_0)) + { + retPtr--; + fractDigits--; + totalDigits--; + } + // 0.0 got past the check for zero because of the decimal point, so we need to double check it here + if(totalDigits==0) + sign = 0; + + *retPtr = chNull; //terminated + return; +} + +void XMLBigDecimal::parseDecimal(const XMLCh* const toParse + , MemoryManager* const manager) +{ + + // Strip leading white space, if any. + const XMLCh* startPtr = toParse; + while (XMLChar1_0::isWhitespace(*startPtr)) + startPtr++; + + // If we hit the end, then return failure + if (!*startPtr) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_WSString, manager); + + // Strip tailing white space, if any. + const XMLCh* endPtr = toParse + XMLString::stringLen(toParse); + while (XMLChar1_0::isWhitespace(*(endPtr - 1))) + endPtr--; + + // '+' or '-' is allowed only at the first position + // and is NOT included in the return parsed string + + if (*startPtr == chDash) + { + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + else if (*startPtr == chPlus) + { + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + + // Strip leading zeros + while (*startPtr == chDigit_0) + startPtr++; + + // containning zero, only zero, nothing but zero + // it is a zero, indeed + if (startPtr >= endPtr) + { + return; + } + + // Scan data + bool dotSignFound = false; + while (startPtr < endPtr) + { + if (*startPtr == chPeriod) + { + if (!dotSignFound) + { + dotSignFound = true; + startPtr++; + continue; + } + else // '.' is allowed only once + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_2ManyDecPoint, manager); + } + + // If not valid decimal digit, then an error + if ((*startPtr < chDigit_0) || (*startPtr > chDigit_9)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + + startPtr++; + + } + + return; +} + +int XMLBigDecimal::compareValues( const XMLBigDecimal* const lValue + , const XMLBigDecimal* const rValue + , MemoryManager* const manager) +{ + if ((!lValue) || (!rValue) ) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager); + + return lValue->toCompare(*rValue); +} + +/** + * Returns -1, 0 or 1 as this is less than, equal to, or greater + * than rValue. + * + * This method is based on the fact, that parsebigDecimal() would eliminate + * unnecessary leading/trailing zeros. +**/ +int XMLBigDecimal::toCompare(const XMLBigDecimal& other) const +{ + /*** + * different sign + */ + int lSign = this->getSign(); + if (lSign != other.getSign()) + return (lSign > other.getSign() ? 1 : -1); + + /*** + * same sign, zero + */ + if (lSign == 0) // optimization + return 0; + + /*** + * same sign, non-zero + */ + unsigned int lIntDigit = this->getTotalDigit() - this->getScale(); + unsigned int rIntDigit = other.getTotalDigit() - other.getScale(); + + if (lIntDigit > rIntDigit) + { + return 1 * lSign; + } + else if (lIntDigit < rIntDigit) + { + return -1 * lSign; + } + else // compare fraction + { + int res = XMLString::compareString + ( this->getValue() + , other.getValue() + ); + + if (res > 0) + return 1 * lSign; + else if (res < 0) + return -1 * lSign; + else + return 0; + } + +} + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLBigDecimal) + +XMLBigDecimal::XMLBigDecimal(MemoryManager* const manager) +: fSign(0) +, fTotalDigits(0) +, fScale(0) +, fRawDataLen(0) +, fRawData(0) +, fIntVal(0) +, fMemoryManager(manager) +{ +} + +void XMLBigDecimal::serialize(XSerializeEngine& serEng) +{ + //REVISIT: may not need to call base since it does nothing + XMLNumber::serialize(serEng); + + if (serEng.isStoring()) + { + serEng<>fSign; + serEng>>fTotalDigits; + serEng>>fScale; + + XMLCh* rawdataStr; + serEng.readString(rawdataStr); + ArrayJanitor rawdataName(rawdataStr, serEng.getMemoryManager()); + fRawDataLen = XMLString::stringLen(rawdataStr); + + XMLCh* intvalStr; + serEng.readString(intvalStr); + ArrayJanitor intvalName(intvalStr, serEng.getMemoryManager()); + XMLSize_t intvalStrLen = XMLString::stringLen(intvalStr); + + if (fRawData) + fMemoryManager->deallocate(fRawData); + + fRawData = (XMLCh*) fMemoryManager->allocate + ( + ((fRawDataLen + intvalStrLen) + 4) * sizeof(XMLCh) + ); + + memcpy(fRawData, rawdataStr, fRawDataLen * sizeof(XMLCh)); + fRawData[fRawDataLen] = chNull; + fIntVal = fRawData + fRawDataLen + 1; + memcpy(fIntVal, intvalStr, intvalStrLen * sizeof(XMLCh)); + fIntVal[intvalStrLen] = chNull; + + } + +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/XMLBigDecimal.hpp b/project/jni/xerces/src/xercesc/util/XMLBigDecimal.hpp new file mode 100644 index 000000000..e2440209b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLBigDecimal.hpp @@ -0,0 +1,206 @@ +/* + * 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: XMLBigDecimal.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP) +#define XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLBigDecimal : public XMLNumber +{ +public: + + /** + * Constructs a newly allocated XMLBigDecimal object that + * represents the value represented by the string. + * + * @param strValue the String to be converted to an + * XMLBigDecimal. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @exception NumberFormatException if the String does not + * contain a parsable XMLBigDecimal. + */ + + XMLBigDecimal + ( + const XMLCh* const strValue + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~XMLBigDecimal(); + + static int compareValues(const XMLBigDecimal* const lValue + , const XMLBigDecimal* const rValue + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + static XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager + ); + + static void parseDecimal + ( + const XMLCh* const toParse + , XMLCh* const retBuffer + , int& sign + , int& totalDigits + , int& fractDigits + , MemoryManager* const manager + ); + + static void parseDecimal + ( + const XMLCh* const toParse + , MemoryManager* const manager + ); + + virtual XMLCh* getRawData() const; + + virtual const XMLCh* getFormattedString() const; + + virtual int getSign() const; + + const XMLCh* getValue() const; + + unsigned int getScale() const; + + unsigned int getTotalDigit() const; + + inline XMLCh* getIntVal() const; + + /** + * Compares this object to the specified object. + * + * @param other the object to compare with. + * @return -1 value is less than other's + * 0 value equals to other's + * +1 value is greater than other's + */ + int toCompare(const XMLBigDecimal& other) const; + + /* + * Sets the value to be converted + * + * @param strValue the value to convert + */ + void setDecimalValue(const XMLCh* const strValue); + + MemoryManager* getMemoryManager() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLBigDecimal) + + XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + + void cleanUp(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLBigDecimal(const XMLBigDecimal& other); + XMLBigDecimal& operator=(const XMLBigDecimal& other); + + // ----------------------------------------------------------------------- + // Private data members + // + // fSign + // sign + // + // fTotalDigits + // the total number of digits + // + // fScale + // the number of digits to the right of the decimal point + // + // fIntVal + // The value of this BigDecimal, w/o + // leading whitespace, leading zero + // decimal point + // trailing zero, trailing whitespace + // + // fRawData + // to preserve the original string used to construct this object, + // needed for pattern matching. + // + // ----------------------------------------------------------------------- + int fSign; + unsigned int fTotalDigits; + unsigned int fScale; + XMLSize_t fRawDataLen; + XMLCh* fRawData; + XMLCh* fIntVal; + MemoryManager* fMemoryManager; + +}; + +inline int XMLBigDecimal::getSign() const +{ + return fSign; +} + +inline const XMLCh* XMLBigDecimal::getValue() const +{ + return fIntVal; +} + +inline unsigned int XMLBigDecimal::getScale() const +{ + return fScale; +} + +inline unsigned int XMLBigDecimal::getTotalDigit() const +{ + return fTotalDigits; +} + +inline XMLCh* XMLBigDecimal::getRawData() const +{ + return fRawData; +} + +inline const XMLCh* XMLBigDecimal::getFormattedString() const +{ + return fRawData; +} + +inline MemoryManager* XMLBigDecimal::getMemoryManager() const +{ + return fMemoryManager; +} + +inline XMLCh* XMLBigDecimal::getIntVal() const +{ + return fIntVal; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLBigInteger.cpp b/project/jni/xerces/src/xercesc/util/XMLBigInteger.cpp new file mode 100644 index 000000000..81b3d6f08 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLBigInteger.cpp @@ -0,0 +1,402 @@ +/* + * 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: XMLBigInteger.cpp 555320 2007-07-11 16:05:13Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLCh* XMLBigInteger::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool /* isNonPositiveInteger */) +{ + try + { + XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData) + 2) * sizeof(XMLCh)); + ArrayJanitor jan(retBuf, memMgr); + int sign = 0; + + XMLBigInteger::parseBigInteger(rawData, retBuf, sign); + + if (sign == 0) + { + retBuf[0] = chDigit_0; + retBuf[1] = chNull; + } + else if (sign == -1) + { + XMLCh* retBuffer = (XMLCh*) memMgr->allocate( (XMLString::stringLen(retBuf) + 2) * sizeof(XMLCh)); + retBuffer[0] = chDash; + XMLString::copyString(&(retBuffer[1]), retBuf); + return retBuffer; + } + + jan.release(); + return retBuf; + + } + catch (const NumberFormatException&) + { + return 0; + } + +} + +/*** + * + * Leading and trailing whitespaces are allowed, and trimmed + * + * Only one and either of (+,-) after the leading whitespace, before + * any other characters are allowed, and trimmed + * + * Leading zero, after leading whitespace, (+|-), before any other + * characters are allowed, and trimmed + * + * '.' NOT allowed + + * return status: void + * ret_buf: w/o leading and/or trailing whitespace + * w/o '+' and '-' + * w/o leading zero + * + * see XMLString::parseInt(); + * XMLString::textToBin(); + * + * " +000203456" "203456" + * " -000203456" "203456" + * +***/ + +void XMLBigInteger::parseBigInteger(const XMLCh* const toConvert + , XMLCh* const retBuffer + , int& signValue + , MemoryManager* const manager) +{ + // If no string, then its a failure + if ((!toConvert) || (!*toConvert)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, manager); + + // + // Note: in Java's BigInteger, it seems any leading and/or trailing + // whitespaces are not allowed. If this is the case, we may + // need to skip the trimming below. + // + + // Scan past any whitespace. If we hit the end, then return failure + const XMLCh* startPtr = toConvert; + while (XMLChar1_0::isWhitespace(*startPtr)) + startPtr++; + + if (!*startPtr) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_WSString, manager); + + // Start at the end and work back through any whitespace + const XMLCh* endPtr = toConvert + XMLString::stringLen(toConvert); + while (XMLChar1_0::isWhitespace(*(endPtr - 1))) + endPtr--; + + // + // Work through what remains and convert each char to a digit. + // anything other than ' + // + XMLCh* retPtr = retBuffer; + signValue = 1; + + // + // '+' or '-' is allowed only at the first position + // + if (*startPtr == chDash) + { + signValue = -1; + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + else if (*startPtr == chPlus) + { + // skip the '+' + startPtr++; + if (startPtr == endPtr) + { + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + } + } + + + // Scan past any leading zero. + while (*startPtr == chDigit_0) + startPtr++; + + if (startPtr >= endPtr) + { + signValue = 0; + // containning zero, only zero, nothing but zero + // it is a zero, indeed + return; + } + + while (startPtr < endPtr) + { + // If not valid decimal digit, then an error + if ((*startPtr < chDigit_0) || (*startPtr > chDigit_9)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + + // copy over + *retPtr = *startPtr; + retPtr++; + startPtr++; + } + + *retPtr = 0; //terminated + return; +} + + +/** + * Translates a string containing an optional minus sign followed by a + * sequence of one or more digits into a BigInteger. + * Any extraneous characters (including whitespace), + * inclusive, will result in a NumberFormatException. + */ + +XMLBigInteger::XMLBigInteger(const XMLCh* const strValue, + MemoryManager* const manager) +: fSign(0) +, fMagnitude(0) +, fRawData(0) +, fMemoryManager(manager) +{ + if (!strValue) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, fMemoryManager); + + XMLCh* ret_value = (XMLCh*) fMemoryManager->allocate + ( + (XMLString::stringLen(strValue) + 1) * sizeof(XMLCh) + );//new XMLCh[XMLString::stringLen(strValue)+1]; + ArrayJanitor janName(ret_value, fMemoryManager); + + parseBigInteger(strValue, ret_value, fSign, fMemoryManager); + + if (fSign == 0) + fMagnitude = XMLString::replicate(XMLUni::fgZeroLenString, fMemoryManager); + else + fMagnitude = XMLString::replicate(ret_value, fMemoryManager); + + fRawData = XMLString::replicate(strValue, fMemoryManager); +} + +XMLBigInteger::~XMLBigInteger() +{ + fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude; + if (fRawData) + fMemoryManager->deallocate(fRawData);//delete[] fRawData; +} + +XMLBigInteger::XMLBigInteger(const XMLBigInteger& toCopy) +: XMemory(toCopy) +, fSign(toCopy.fSign) +, fMagnitude(0) +, fRawData(0) +, fMemoryManager(toCopy.fMemoryManager) +{ + fMagnitude = XMLString::replicate(toCopy.fMagnitude, fMemoryManager); + fRawData = XMLString::replicate(toCopy.fRawData, fMemoryManager); +} + +/** + * Returns -1, 0 or 1 as lValue is less than, equal to, or greater + * than rValue. +*/ +int XMLBigInteger::compareValues(const XMLBigInteger* const lValue + , const XMLBigInteger* const rValue + , MemoryManager* const manager) +{ + if ((!lValue) || (!rValue) ) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager); + + int lSign = lValue->getSign(); + int rSign = rValue->getSign(); + + // + // different sign + // + if (lSign != rSign) + return(lSign > rSign ? 1 : -1); + + // + // same sign + // + if (lSign == 0) // optimization + return 0; + + XMLSize_t lStrLen = XMLString::stringLen(lValue->fMagnitude); + XMLSize_t rStrLen = XMLString::stringLen(rValue->fMagnitude); + + // + // different length + // + if (lStrLen > rStrLen) + return ( lSign > 0 ? 1 : -1 ); + else if (lStrLen < rStrLen) + return ( lSign > 0 ? -1 : 1 ); + + // + // same length + // XMLString::compareString() return > 0, 0 and <0 + // we need to convert it to 1, 0, and -1 + // + int retVal = XMLString::compareString(lValue->fMagnitude, rValue->fMagnitude); + + if ( retVal > 0 ) + { + return ( lSign > 0 ? 1 : -1 ); + } + else if ( retVal < 0 ) + { + return ( lSign > 0 ? -1 : 1 ); + } + else + return 0; + +} + +int XMLBigInteger::compareValues(const XMLCh* const lString + , const int& lSign + , const XMLCh* const rString + , const int& rSign + , MemoryManager* const manager) +{ + if ((!lString) || (!rString) ) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager); + + // + // different sign + // + if (lSign != rSign) + return(lSign > rSign ? 1 : -1); + + // + // same sign + // + if (lSign == 0) // optimization + return 0; + + XMLSize_t lStrLen = XMLString::stringLen(lString); + XMLSize_t rStrLen = XMLString::stringLen(rString); + + // + // different length + // + if (lStrLen > rStrLen) + return ( lSign > 0 ? 1 : -1 ); + else if (lStrLen < rStrLen) + return ( lSign > 0 ? -1 : 1 ); + + // + // same length + // XMLString::compareString() return > 0, 0 and <0 + // we need to convert it to 1, 0, and -1 + // + int retVal = XMLString::compareString(lString, rString); + + if ( retVal > 0 ) + { + return ( lSign > 0 ? 1 : -1 ); + } + else if ( retVal < 0 ) + { + return ( lSign > 0 ? -1 : 1 ); + } + else + return 0; + +} + +/** + * Shift the fMagnitude to the left + */ + +void XMLBigInteger::multiply(const unsigned int byteToShift) +{ + if (byteToShift <= 0) + return; + + XMLSize_t strLen = XMLString::stringLen(fMagnitude); + XMLCh* tmp = (XMLCh*) fMemoryManager->allocate + ( + (strLen + byteToShift + 1) * sizeof(XMLCh) + );//new XMLCh[strLen+byteToShift+1]; + XMLString::moveChars(tmp, fMagnitude, strLen); + + unsigned int i = 0; + for ( ; i < byteToShift; i++) + tmp[strLen+i] = chDigit_0; + + tmp[strLen+i] = chNull; + + fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude; + fMagnitude = tmp; +} + +/** + * Shift the fMagnitude to the right + * by doing this, we lose precision. + */ +void XMLBigInteger::divide(const unsigned int byteToShift) +{ + if (byteToShift <= 0) + return; + + XMLSize_t strLen = XMLString::stringLen(fMagnitude); + XMLCh* tmp = (XMLCh*) fMemoryManager->allocate + ( + (strLen - byteToShift + 1) * sizeof(XMLCh) + );//new XMLCh[strLen-byteToShift+1]; + XMLString::moveChars(tmp, fMagnitude, strLen-byteToShift); + + tmp[strLen-byteToShift] = chNull; + + fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude; + fMagnitude = tmp; +} + +// +// +// +int XMLBigInteger::intValue() const +{ + unsigned int retVal; + XMLString::textToBin(fMagnitude, retVal, fMemoryManager); + return retVal * getSign(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLBigInteger.hpp b/project/jni/xerces/src/xercesc/util/XMLBigInteger.hpp new file mode 100644 index 000000000..c51e9e9cd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLBigInteger.hpp @@ -0,0 +1,175 @@ +/* + * 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: XMLBigInteger.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_BIGINTEGER_HPP) +#define XERCESC_INCLUDE_GUARD_XML_BIGINTEGER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLBigInteger : public XMemory +{ +public: + + /** + * Constructs a newly allocated XMLBigInteger object that + * represents the value represented by the string. The string is + * converted to an int value as if by the valueOf method. + * + * @param strValue the String to be converted to an + * XMLBigInteger. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @exception NumberFormatException if the String does not + * contain a parsable XMLBigInteger. + */ + + XMLBigInteger + ( + const XMLCh* const strValue + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~XMLBigInteger(); + + XMLBigInteger(const XMLBigInteger& toCopy); + + static XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager + , bool isNonPositiveInteger = false + ); + + static void parseBigInteger(const XMLCh* const toConvert + , XMLCh* const retBuffer + , int& signValue + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + static int compareValues(const XMLBigInteger* const lValue + ,const XMLBigInteger* const rValue + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + + static int compareValues(const XMLCh* const lString + , const int& lSign + , const XMLCh* const rString + , const int& rSign + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + void multiply(const unsigned int byteToShift); + + void divide(const unsigned int byteToShift); + + unsigned int getTotalDigit() const; + + /** + * Return a copy of the fMagnitude. + * This is similar to toString, except the internal buffer is returned directly + * Caller is not required to delete the returned memory. + */ + inline XMLCh* getRawData() const; + + /** + * Compares this object to the specified object. + * The result is true if and only if the argument is not + * null and is an XMLBigInteger object that contains + * the same int value as this object. + * + * @param toCompare the object to compare with. + * @return true if the objects are the same; + * false otherwise. + */ + bool operator==(const XMLBigInteger& toCompare) const; + + /** + * Returns the signum function of this number (i.e., -1, 0 or 1 as + * the value of this number is negative, zero or positive). + */ + int getSign() const; + + int intValue() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLBigInteger& operator=(const XMLBigInteger&); + + + void setSign(int); + + /* + * The number is internally stored in "minimal" sign-fMagnitude format + * (i.e., no BigIntegers have a leading zero byte in their magnitudes). + * Zero is represented with a signum of 0 (and a zero-length fMagnitude). + * Thus, there is exactly one representation for each value. + */ + // ----------------------------------------------------------------------- + // Private data members + // + // fSign + // to represent the sign of the number. + // + // fMagnitude + // the buffer holding the number. + // + // fRawData + // to preserve the original string used to construct this object, + // needed for pattern matching. + // + // ----------------------------------------------------------------------- + + int fSign; + XMLCh* fMagnitude; //null terminated + XMLCh* fRawData; + MemoryManager* fMemoryManager; +}; + +inline int XMLBigInteger::getSign() const +{ + return fSign; +} + +inline unsigned int XMLBigInteger::getTotalDigit() const +{ + return ((getSign() ==0) ? 0 : (unsigned int)XMLString::stringLen(fMagnitude)); +} + +inline bool XMLBigInteger::operator==(const XMLBigInteger& toCompare) const +{ + return ( compareValues(this, &toCompare, fMemoryManager) ==0 ? true : false); +} + +inline void XMLBigInteger::setSign(int newSign) +{ + fSign = newSign; +} + +inline XMLCh* XMLBigInteger::getRawData() const +{ + return fRawData; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLChTranscoder.cpp b/project/jni/xerces/src/xercesc/util/XMLChTranscoder.cpp new file mode 100644 index 000000000..66a352d75 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLChTranscoder.cpp @@ -0,0 +1,117 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLChTranscoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLChTranscoder::XMLChTranscoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) +{ +} + + +XMLChTranscoder::~XMLChTranscoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLChTranscoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XMLChTranscoder::transcodeFrom( const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the number of chars in the source. + // + const XMLSize_t srcChars = srcCount / sizeof(XMLCh); + const XMLSize_t countToDo = srcChars < maxChars ? srcChars : maxChars; + + // + // Copy over the count of chars that we precalculated. Notice we + // convert char count to byte count here!!! + // + memcpy(toFill, srcData, countToDo * sizeof(XMLCh)); + + // Set the bytes eaten + bytesEaten = countToDo * sizeof(XMLCh); + + // Set the character sizes to the fixed size + memset(charSizes, sizeof(XMLCh), countToDo); + + // Return the chars we transcoded + return countToDo; +} + + +XMLSize_t +XMLChTranscoder::transcodeTo(const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max chars we can store in the output byte buffer, and the number + // of chars in the source. + // + const XMLSize_t maxOutChars = maxBytes / sizeof(XMLCh); + const XMLSize_t countToDo = maxOutChars < srcCount + ? maxOutChars : srcCount; + + // + // Copy over the number of chars we calculated. Note that we have + // to convert the char count to a byte count!! + // + memcpy(toFill, srcData, countToDo * sizeof(XMLCh)); + + // Set the chars eaten + charsEaten = countToDo; + + // Return the bytes we transcoded + return countToDo * sizeof(XMLCh); +} + + +bool XMLChTranscoder::canTranscodeTo(const unsigned int) +{ + // We can handle anything + return true; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLChTranscoder.hpp b/project/jni/xerces/src/xercesc/util/XMLChTranscoder.hpp new file mode 100644 index 000000000..9b1c4fff3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLChTranscoder.hpp @@ -0,0 +1,90 @@ +/* + * 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: XMLChTranscoder.hpp 635560 2008-03-10 14:10:09Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLCHTRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLCHTRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple XMLCh transcoder. This is used for internal entities, which +// are already in the native XMLCh format. +// +class XMLUTIL_EXPORT XMLChTranscoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLChTranscoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLChTranscoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLChTranscoder(const XMLChTranscoder&); + XMLChTranscoder& operator=(const XMLChTranscoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLChar.cpp b/project/jni/xerces/src/xercesc/util/XMLChar.cpp new file mode 100644 index 000000000..5b3556292 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLChar.cpp @@ -0,0 +1,9104 @@ +/* + * 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: XMLChar.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLChar1_0: static data initialization +// --------------------------------------------------------------------------- +bool XMLChar1_0::enableNEL = false; + +// --------------------------------------------------------------------------- +// XMLChar1_0: Public, static methods +// --------------------------------------------------------------------------- +// Checks whether all of the chars in the passed buffer are whitespace or +// not. Breaks out on the first non-whitespace. +// +bool XMLChar1_0::isAllSpaces(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + while (curCh < endPtr) + { + if (!(fgCharCharsTable1_0[*curCh++] & gWhitespaceCharMask)) + return false; + } + return true; +} + + +// +// Checks whether at least one of the chars in the passed buffer are whitespace or +// not. +// +bool XMLChar1_0::containsWhiteSpace(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + while (curCh < endPtr) + { + if (fgCharCharsTable1_0[*curCh++] & gWhitespaceCharMask) + return true; + } + return false; +} + +bool XMLChar1_0::isValidNCName(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + if (*curCh== chColon || !(fgCharCharsTable1_0[*curCh++] & gFirstNameCharMask)) + return false; + + while (curCh < endPtr) + { + if (!(fgCharCharsTable1_0[*curCh++] & gNCNameCharMask)) + return false; + } + return true; +} + +bool XMLChar1_0::isValidNmtoken(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + + while (curCh < endPtr) + { + if (!(fgCharCharsTable1_0[*curCh++] & gNameCharMask)) + return false; + } + return true; +} + +bool XMLChar1_0::isValidName(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + if (!(fgCharCharsTable1_0[*curCh++] & gFirstNameCharMask)) + return false; + + while (curCh < endPtr) + { + if (!(fgCharCharsTable1_0[*curCh++] & gNameCharMask)) + return false; + } + return true; +} + +bool XMLChar1_0::isValidName(const XMLCh* const toCheck) +{ + const XMLCh* curCh = toCheck; + + if ((fgCharCharsTable1_0[*curCh++] & gFirstNameCharMask)) + { + while ((fgCharCharsTable1_0[*curCh] & gNameCharMask)) + { + curCh++; + } + + if (*curCh == 0) + { + return true; + } + } + return false; +} + +/** + * isValidQName + * + * [6] QName ::= (Prefix ':')? LocalPart + * [7] Prefix ::= NCName + * [8] LocalPart ::= NCName + * + */ +bool XMLChar1_0::isValidQName(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + XMLSize_t colonPos=0; + // don't use XMLString::indexOf, we must stop after 'count' chars + while(colonPos= 0xD800) && (nextCh <= 0xDB7F)) { + nextCh = *curCh++; + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + return false; + } + else if (nextCh== chColon || !(fgCharCharsTable1_1[nextCh] & gFirstNameCharMask)) + return false; + + bool gotLeadingSurrogate = false; + while (curCh < endPtr) + { + nextCh = *curCh++; + + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // It's a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (nextCh > 0xDB7F || gotLeadingSurrogate) + { + return false; + } + else + gotLeadingSurrogate = true; + } + else + { + // If it's a trailing surrogate, make sure that we are + // prepared for that. Else, it's just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // It's trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + return false; + } + else + { + // It's just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) { + return false; + } + // It's got to at least be a valid XML character + else if (!(fgCharCharsTable1_1[nextCh] & gNCNameCharMask)) + { + return false; + } + } + gotLeadingSurrogate = false; + } + } + return true; +} + +bool XMLChar1_1::isValidNmtoken(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + XMLCh nextCh; + + bool gotLeadingSurrogate = false; + while (curCh < endPtr) + { + nextCh = *curCh++; + + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // It's a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (nextCh > 0xDB7F || gotLeadingSurrogate) + { + return false; + } + else + gotLeadingSurrogate = true; + } + else + { + // If it's a trailing surrogate, make sure that we are + // prepared for that. Else, it's just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // It's trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + return false; + } + else + { + // It's just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) { + return false; + } + // It's got to at least be a valid XML character + else if (!(fgCharCharsTable1_1[nextCh] & gNameCharMask)) + { + return false; + } + } + gotLeadingSurrogate = false; + } + } + return true; +} + +bool XMLChar1_1::isValidName(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + const XMLCh* curCh = toCheck; + const XMLCh* endPtr = toCheck + count; + + XMLCh nextCh = *curCh++; + if ((nextCh >= 0xD800) && (nextCh <= 0xDB7F)) { + nextCh = *curCh++; + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + return false; + } + else if (!(fgCharCharsTable1_1[nextCh] & gFirstNameCharMask)) + return false; + + bool gotLeadingSurrogate = false; + while (curCh < endPtr) + { + nextCh = *curCh++; + + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // It's a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (nextCh > 0xDB7F || gotLeadingSurrogate) + { + return false; + } + else + gotLeadingSurrogate = true; + } + else + { + // If it's a trailing surrogate, make sure that we are + // prepared for that. Else, it's just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // It's trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + return false; + } + else + { + // It's just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) { + return false; + } + // It's got to at least be a valid XML character + else if (!(fgCharCharsTable1_1[nextCh] & gNameCharMask)) + { + return false; + } + } + gotLeadingSurrogate = false; + } + } + return true; +} + +bool XMLChar1_1::isValidName(const XMLCh* const toCheck) +{ + const XMLCh* curCh = toCheck; + + XMLCh nextCh = *curCh++; + if ((nextCh >= 0xD800) && (nextCh <= 0xDB7F)) + { + nextCh = *curCh++; + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + { + return false; + } + } + else if (!(fgCharCharsTable1_1[nextCh] & gFirstNameCharMask)) + { + return false; + } + + bool gotLeadingSurrogate = false; + + while (*curCh != 0) + { + nextCh = *curCh++; + + // Deal with surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // It's a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (nextCh > 0xDB7F || gotLeadingSurrogate) + { + return false; + } + else + { + gotLeadingSurrogate = true; + } + } + else + { + // If it's a trailing surrogate, make sure that we are + // prepared for that. Else, it's just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // It's trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + return false; + } + else + { + // It's just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + { + return false; + } + // It's got to at least be a valid XML character + else if (!(fgCharCharsTable1_1[nextCh] & gNameCharMask)) + { + return false; + } + } + gotLeadingSurrogate = false; + } + } + return true; +} + +/** + * isValidQName + * + * [6] QName ::= (Prefix ':')? LocalPart + * [7] Prefix ::= NCName + * [8] LocalPart ::= NCName + * + */ +bool XMLChar1_1::isValidQName(const XMLCh* const toCheck + , const XMLSize_t count) +{ + if (count == 0) + return false; + + XMLSize_t length = count; + int colonPos = XMLString::indexOf(toCheck, chColon); + if ((colonPos == 0) || // ":abcd" + (colonPos == ((int)length)-1)) // "abcd:" + return false; + + // + // prefix + // + if (colonPos != -1) + { + if (isValidNCName(toCheck, colonPos) == false) + return false; + } + + // + // LocalPart + // + return isValidNCName(toCheck+colonPos+1, length-colonPos-1); +} + + +// +// This one is not called terribly often, so it's done manually in order +// give up more bits in the character characteristics table for more often +// used characteristics. +// +bool XMLChar1_1::isPublicIdChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) { + const XMLCh* curTable = gPublicIdChars; + + // Check the ranges + while (*curTable) + { + // + // If the test char is less than the low range, then it's never + // going to match any other range, so break out. But we have to + // run up to the range terminator first. + // + if (toCheck < *curTable++) + { + while (*curTable++) + { + // Purposefully empty, we are just running up the pointer + } + break; + } + + // If it's less than or equal to the top of the range, then a match + if (toCheck <= *curTable++) + return true; + } + + // And now test against singles + while (*curTable) + { + if (toCheck == *curTable++) + return true; + } + return false; + } + return false; +} + + + + +XMLByte XMLChar1_1::fgCharCharsTable1_1[0x10000] = +{ 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xF8, 0xF0, 0x20, 0x20, 0xF0, 0x20, 0x20 + , 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + , 0xD8, 0x48, 0x58, 0x48, 0x48, 0x48, 0x40, 0x58, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4D, 0x4D, 0x58 + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4E, 0x48, 0x50, 0x48, 0x58, 0x48 + , 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x48, 0x40, 0x48, 0x4F + , 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x48, 0x48, 0x48, 0x20 + , 0x20, 0x20, 0x20, 0x20, 0x20, 0xF0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + , 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4D, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4F, 0x4F, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0xD0, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4D + , 0x4D, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48 + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F + , 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x00, 0x00 +}; + + + +// --------------------------------------------------------------------------- +// Conditional methods for building the table +// --------------------------------------------------------------------------- + +// +// This code will set up the character flags table. It's defined out since +// this table is now written out and hard coded (at the bottom of this +// file) into the code itself. This code is retained in case there is +// any need to recreate it later. +// + +#if defined(NEED_TO_GEN_TABLE) + +#include + +static XMLCh gTmpCharTable[0xFFFF]; + +static void initOneTable(const XMLCh* const theTable + , const XMLByte theMask) +{ + const XMLCh* pchCur = theTable; + + // Do the ranges first + while (*pchCur) + { + XMLCh chIndex; + + const XMLCh chLow = *pchCur++; + const XMLCh chHigh = *pchCur++; + + for (chIndex = chLow; chIndex <= chHigh; chIndex++) + gTmpCharTable[chIndex] |= theMask; + } + + // Skip the range terminator + pchCur++; + + // And then the singles until we hit its terminator + while (*pchCur) + gTmpCharTable[*pchCur++] |= theMask; +} + + + +static void initCharFlagTable() +{ + memset(gTmpCharTable, 0, sizeof(gTmpCharTable)); + + // Do the init for each table. Do the non-special case ones first + initOneTable(gXMLChars, gXMLCharMask); + initOneTable(gWhitespaceChars, gWhitespaceCharMask); + + // + // Name characters are special. A name is made up of a number of + // different tables and some special case characters. + // + initOneTable(gBaseChars, gNameCharMask); + initOneTable(gCombiningChars, gNameCharMask); + initOneTable(gExtenderChars, gNameCharMask); + initOneTable(gIdeographicChars, gNameCharMask); + initOneTable(gDigitChars, gNameCharMask); + gTmpCharTable[chDash] |= gNameCharMask; + gTmpCharTable[chPeriod] |= gNameCharMask; + gTmpCharTable[chColon] |= gNameCharMask; + gTmpCharTable[chUnderscore] |= gNameCharMask; + + // + // NCName characters are special. A name is made up of a number of + // different tables and some special case characters. + // + initOneTable(gBaseChars, gNCNameCharMask); + initOneTable(gCombiningChars, gNCNameCharMask); + initOneTable(gExtenderChars, gNCNameCharMask); + initOneTable(gIdeographicChars, gNCNameCharMask); + initOneTable(gDigitChars, gNCNameCharMask); + gTmpCharTable[chDash] |= gNCNameCharMask; + gTmpCharTable[chPeriod] |= gNCNameCharMask; + gTmpCharTable[chUnderscore] |= gNCNameCharMask; + + // + // Then do the first name char + // + initOneTable(gBaseChars, gFirstNameCharMask); + initOneTable(gIdeographicChars, gFirstNameCharMask); + gTmpCharTable[chColon] |= gFirstNameCharMask; + gTmpCharTable[chUnderscore] |= gFirstNameCharMask; + + // + // And now do the very special case ones. These are bits that are + // designed to sense special case characters in the most important + // processing loops of the parser. They allow us to do a quick + // check for a special case and get to the common case with minimal + // overhead when it's not. Since the special case chars are a tiny + // fraction of the chars, this is a good optimization. + // + // We do the special chars for the start tag processing, which + // needs to look for things that indicate the end of the tag, quote + // chars, etc... + // + gTmpCharTable[chNull] |= gSpecialStartTagCharMask; + gTmpCharTable[chForwardSlash] |= gSpecialStartTagCharMask; + gTmpCharTable[chCloseAngle] |= gSpecialStartTagCharMask; + gTmpCharTable[chOpenAngle] |= gSpecialStartTagCharMask; + gTmpCharTable[chSingleQuote] |= gSpecialStartTagCharMask; + gTmpCharTable[chDoubleQuote] |= gSpecialStartTagCharMask; + initOneTable(gWhitespaceChars, gSpecialStartTagCharMask); + + // + // And finally do the plain content characters. + // These are all content characters that require NO special + // handling. Exclude CR, LF, <, & and ], all of which either + // are markup or require some sort of special case handling. + // + initOneTable(gXMLChars, gPlainContentCharMask); + gTmpCharTable[chCR] &= ~gPlainContentCharMask; + gTmpCharTable[chLF] &= ~gPlainContentCharMask; + gTmpCharTable[chOpenAngle] &= ~gPlainContentCharMask; + gTmpCharTable[chAmpersand] &= ~gPlainContentCharMask; + gTmpCharTable[chCloseSquare] &= ~gPlainContentCharMask; + + + // + // Write it out to a temp file to be read back into this source later. + // + FILE* outFl = fopen("table.out", "wt+"); + fprintf(outFl, "XMLByte XMLChar1_0::fgCharCharsTable1_0[0x10000] =\n{"); + for (unsigned int index = 0; index <= 0xFFFF; index += 16) + { + fprintf(outFl + , " , 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n" + , (unsigned int)gTmpCharTable[index] + , (unsigned int)gTmpCharTable[index+1] + , (unsigned int)gTmpCharTable[index+2] + , (unsigned int)gTmpCharTable[index+3] + , (unsigned int)gTmpCharTable[index+4] + , (unsigned int)gTmpCharTable[index+5] + , (unsigned int)gTmpCharTable[index+6] + , (unsigned int)gTmpCharTable[index+7] + , (unsigned int)gTmpCharTable[index+8] + , (unsigned int)gTmpCharTable[index+9] + , (unsigned int)gTmpCharTable[index+10] + , (unsigned int)gTmpCharTable[index+11] + , (unsigned int)gTmpCharTable[index+12] + , (unsigned int)gTmpCharTable[index+13] + , (unsigned int)gTmpCharTable[index+14] + , (unsigned int)gTmpCharTable[index+15]); + } + fprintf(outFl, "};\n"); + + fclose(outFl); +} + + +static void initCharFlagTable1_1() +{ + memset(gTmpCharTable, 0, sizeof(gTmpCharTable)); + + // Do the init for each table. Do the non-special case ones first + initOneTable(gXMLChars1_1, gXMLCharMask); + initOneTable(gWhitespaceChars1_1, gWhitespaceCharMask); + + // + // Name characters are special. A name is made up of a number of + // different tables and some special case characters. + // + initOneTable(gNameChars1_1, gNameCharMask); + + // + // Name characters are special. A name is made up of a number of + // different tables and some special case characters. + // + initOneTable(gNameChars1_1, gNCNameCharMask); + gTmpCharTable[chColon] &= ~gNCNameCharMask; + + // + // Then do the first name char + // + initOneTable(gFirstNameChars1_1, gFirstNameCharMask); + + // + // Control characters is treated differently in XML 1.1 + // + initOneTable(gControl_Chars1_1, gControlCharMask); + + // + // And now do the very special case ones. These are bits that are + // designed to sense special case characters in the most important + // processing loops of the parser. They allow us to do a quick + // check for a special case and get to the common case with minimal + // overhead when it's not. Since the special case chars are a tiny + // fraction of the chars, this is a good optimization. + // + // We do the special chars for the start tag processing, which + // needs to look for things that indicate the end of the tag, quote + // chars, etc... + // + gTmpCharTable[chNull] |= gSpecialStartTagCharMask; + gTmpCharTable[chForwardSlash] |= gSpecialStartTagCharMask; + gTmpCharTable[chCloseAngle] |= gSpecialStartTagCharMask; + gTmpCharTable[chOpenAngle] |= gSpecialStartTagCharMask; + gTmpCharTable[chSingleQuote] |= gSpecialStartTagCharMask; + gTmpCharTable[chDoubleQuote] |= gSpecialStartTagCharMask; + initOneTable(gWhitespaceChars1_1, gSpecialStartTagCharMask); + + // + // And finally do the plain content characters. + // These are all content characters that require NO special + // handling. Exclude CR, LF, <, & and ], all of which either + // are markup or require some sort of special case handling. + // + initOneTable(gXMLChars1_1, gPlainContentCharMask); + gTmpCharTable[chCR] &= ~gPlainContentCharMask; + gTmpCharTable[chLF] &= ~gPlainContentCharMask; + gTmpCharTable[chOpenAngle] &= ~gPlainContentCharMask; + gTmpCharTable[chAmpersand] &= ~gPlainContentCharMask; + gTmpCharTable[chCloseSquare] &= ~gPlainContentCharMask; + gTmpCharTable[chLineSeparator] &= ~gPlainContentCharMask; + gTmpCharTable[chNEL] &= ~gPlainContentCharMask; + + + // + // Write it out to a temp file to be read back into this source later. + // + FILE* outFl = fopen("table1_1.out", "wt+"); + fprintf(outFl, "XMLByte XMLChar1_1::fgCharCharsTable1_1[0x10000] =\n{"); + for (unsigned int index = 0; index <= 0xFFFF; index += 16) + { + fprintf(outFl + , " , 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n" + , (unsigned int)gTmpCharTable[index] + , (unsigned int)gTmpCharTable[index+1] + , (unsigned int)gTmpCharTable[index+2] + , (unsigned int)gTmpCharTable[index+3] + , (unsigned int)gTmpCharTable[index+4] + , (unsigned int)gTmpCharTable[index+5] + , (unsigned int)gTmpCharTable[index+6] + , (unsigned int)gTmpCharTable[index+7] + , (unsigned int)gTmpCharTable[index+8] + , (unsigned int)gTmpCharTable[index+9] + , (unsigned int)gTmpCharTable[index+10] + , (unsigned int)gTmpCharTable[index+11] + , (unsigned int)gTmpCharTable[index+12] + , (unsigned int)gTmpCharTable[index+13] + , (unsigned int)gTmpCharTable[index+14] + , (unsigned int)gTmpCharTable[index+15]); + } + fprintf(outFl, "};\n"); + + fclose(outFl); +} + +class CharFlagKicker +{ +public : + CharFlagKicker() + { + initCharFlagTable(); + initCharFlagTable1_1(); + } +private: + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + CharFlagKicker(const CharFlagKicker&); + CharFlagKicker& operator=(const CharFlagKicker&); +}; + +static CharFlagKicker gKicker; + +#endif + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLChar.hpp b/project/jni/xerces/src/xercesc/util/XMLChar.hpp new file mode 100644 index 000000000..a0395a37c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLChar.hpp @@ -0,0 +1,442 @@ +/* + * 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: XMLChar.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLCHAR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLCHAR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// This file defines Char and utility that conforms to XML 1.0 and XML 1.1 +// --------------------------------------------------------------------------- +// Masks for the fgCharCharsTable1_0 array +const XMLByte gNCNameCharMask = 0x1; +const XMLByte gFirstNameCharMask = 0x2; +const XMLByte gNameCharMask = 0x4; +const XMLByte gPlainContentCharMask = 0x8; +const XMLByte gSpecialStartTagCharMask = 0x10; +const XMLByte gControlCharMask = 0x20; +const XMLByte gXMLCharMask = 0x40; +const XMLByte gWhitespaceCharMask = 0x80; + +// --------------------------------------------------------------------------- +// This class is for XML 1.0 +// --------------------------------------------------------------------------- +class XMLUTIL_EXPORT XMLChar1_0 +{ +public: + // ----------------------------------------------------------------------- + // Public, static methods, check the string + // ----------------------------------------------------------------------- + static bool isAllSpaces + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool containsWhiteSpace + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidNmtoken + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidName + ( + const XMLCh* const toCheck + ); + + static bool isValidNCName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidQName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + // ----------------------------------------------------------------------- + // Public, static methods, check the XMLCh + // surrogate pair is assumed if second parameter is not null + // ----------------------------------------------------------------------- + static bool isXMLLetter(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isFirstNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isPlainContentChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isSpecialStartTagChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isXMLChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isWhitespace(const XMLCh toCheck); + static bool isWhitespace(const XMLCh toCheck, const XMLCh toCheck2); + static bool isControlChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + + static bool isPublicIdChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isFirstNCNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isNCNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + + // ----------------------------------------------------------------------- + // Special Non-conformant Public, static methods + // ----------------------------------------------------------------------- + /** + * Return true if NEL (0x85) and LSEP (0x2028) to be treated as white space char. + */ + static bool isNELRecognized(); + + /** + * Method to enable NEL (0x85) and LSEP (0x2028) to be treated as white space char. + */ + static void enableNELWS(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLChar1_0(); + + // ----------------------------------------------------------------------- + // Static data members + // + // fgCharCharsTable1_0 + // The character characteristics table. Bits in each byte, represent + // the characteristics of each character. It is generated via some + // code and then hard coded into the cpp file for speed. + // + // fNEL + // Flag to represents whether NEL and LSEP newline recognition is enabled + // or disabled + // ----------------------------------------------------------------------- + static XMLByte fgCharCharsTable1_0[0x10000]; + static bool enableNEL; + + friend class XMLReader; +}; + + +// --------------------------------------------------------------------------- +// XMLReader: Public, static methods +// --------------------------------------------------------------------------- +inline bool XMLChar1_0::isXMLLetter(const XMLCh toCheck, const XMLCh toCheck2) +{ + // An XML letter is a FirstNameChar minus ':' and '_'. + if (!toCheck2) { + return (((fgCharCharsTable1_0[toCheck] & gFirstNameCharMask) != 0) + && (toCheck != chColon) && (toCheck != chUnderscore)); + } + return false; +} + +inline bool XMLChar1_0::isFirstNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gFirstNameCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isFirstNCNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) { + return (((fgCharCharsTable1_0[toCheck] & gFirstNameCharMask) != 0) && (toCheck != chColon)); + } + + return false; +} + +inline bool XMLChar1_0::isNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gNameCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isNCNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gNCNameCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isPlainContentChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gPlainContentCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDBFF)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + + +inline bool XMLChar1_0::isSpecialStartTagChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gSpecialStartTagCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isXMLChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gXMLCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDBFF)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_0::isWhitespace(const XMLCh toCheck) +{ + return ((fgCharCharsTable1_0[toCheck] & gWhitespaceCharMask) != 0); +} + +inline bool XMLChar1_0::isWhitespace(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gWhitespaceCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isControlChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_0[toCheck] & gControlCharMask) != 0); + return false; +} + +inline bool XMLChar1_0::isNELRecognized() { + + return enableNEL; +} + + +// --------------------------------------------------------------------------- +// This class is for XML 1.1 +// --------------------------------------------------------------------------- +class XMLUTIL_EXPORT XMLChar1_1 +{ +public: + // ----------------------------------------------------------------------- + // Public, static methods, check the string + // ----------------------------------------------------------------------- + static bool isAllSpaces + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool containsWhiteSpace + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidNmtoken + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidName + ( + const XMLCh* const toCheck + ); + + static bool isValidNCName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + static bool isValidQName + ( + const XMLCh* const toCheck + , const XMLSize_t count + ); + + // ----------------------------------------------------------------------- + // Public, static methods, check the XMLCh + // ----------------------------------------------------------------------- + static bool isXMLLetter(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isFirstNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isPlainContentChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isSpecialStartTagChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isXMLChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isWhitespace(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isControlChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + + static bool isPublicIdChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isFirstNCNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + static bool isNCNameChar(const XMLCh toCheck, const XMLCh toCheck2 = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLChar1_1(); + + // ----------------------------------------------------------------------- + // Static data members + // + // fgCharCharsTable1_1 + // The character characteristics table. Bits in each byte, represent + // the characteristics of each character. It is generated via some + // code and then hard coded into the cpp file for speed. + // + // ----------------------------------------------------------------------- + static XMLByte fgCharCharsTable1_1[0x10000]; + + friend class XMLReader; +}; + + +// --------------------------------------------------------------------------- +// XMLReader: Public, static methods +// --------------------------------------------------------------------------- +inline bool XMLChar1_1::isXMLLetter(const XMLCh toCheck, const XMLCh toCheck2) +{ + /** XML 1.1 does not define a letter, so we use the 1.0 definition */ + return XMLChar1_0::isXMLLetter(toCheck, toCheck2); +} + +inline bool XMLChar1_1::isFirstNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gFirstNameCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDB7F)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_1::isFirstNCNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) { + return (((fgCharCharsTable1_1[toCheck] & gFirstNameCharMask) != 0) && (toCheck != chColon)); + } + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDB7F)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_1::isNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gNameCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDB7F)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_1::isNCNameChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gNCNameCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDB7F)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_1::isPlainContentChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gPlainContentCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDBFF)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + + +inline bool XMLChar1_1::isSpecialStartTagChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gSpecialStartTagCharMask) != 0); + return false; +} + +inline bool XMLChar1_1::isXMLChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gXMLCharMask) != 0); + else { + if ((toCheck >= 0xD800) && (toCheck <= 0xDBFF)) + if ((toCheck2 >= 0xDC00) && (toCheck2 <= 0xDFFF)) + return true; + } + return false; +} + +inline bool XMLChar1_1::isWhitespace(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gWhitespaceCharMask) != 0); + return false; +} + +inline bool XMLChar1_1::isControlChar(const XMLCh toCheck, const XMLCh toCheck2) +{ + if (!toCheck2) + return ((fgCharCharsTable1_1[toCheck] & gControlCharMask) != 0); + return false; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLDOMMsg.hpp b/project/jni/xerces/src/xercesc/util/XMLDOMMsg.hpp new file mode 100644 index 000000000..3ca44003a --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLDOMMsg.hpp @@ -0,0 +1,104 @@ +// This file is generated, don't edit it!! + +#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLDOMMsg) +#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLDOMMsg + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLDOMMsg +{ +public : + enum Codes + { + NoError = 0 + , F_LowBounds = 1 + , DOMEXCEPTION_ERRX = 2 + , INDEX_SIZE_ERR = 3 + , DOMSTRING_SIZE_ERR = 4 + , HIERARCHY_REQUEST_ERR = 5 + , WRONG_DOCUMENT_ERR = 6 + , INVALID_CHARACTER_ERR = 7 + , NO_DATA_ALLOWED_ERR = 8 + , NO_MODIFICATION_ALLOWED_ERR = 9 + , NOT_FOUND_ERR = 10 + , NOT_SUPPORTED_ERR = 11 + , INUSE_ATTRIBUTE_ERR = 12 + , INVALID_STATE_ERR = 13 + , SYNTAX_ERR = 14 + , INVALID_MODIFICATION_ERR = 15 + , NAMESPACE_ERR = 16 + , INVALID_ACCESS_ERR = 17 + , VALIDATION_ERR = 18 + , TYPE_MISMATCH_ERR = 19 + , DOMRANGEEXCEPTION_ERRX = 20 + , BAD_BOUNDARYPOINTS_ERR = 21 + , INVALID_NODE_TYPE_ERR = 22 + , DOMLSEXCEPTION_ERRX = 23 + , PARSE_ERR = 24 + , SERIALIZE_ERR = 25 + , DOMXPATHEXCEPTION_ERRX = 26 + , INVALID_EXPRESSION_ERR = 27 + , TYPE_ERR = 28 + , NO_RESULT_ERR = 29 + , Writer_NestedCDATA = 30 + , Writer_NotRepresentChar = 31 + , Writer_NotRecognizedType = 32 + , LSParser_ParseInProgress = 33 + , LSParser_ParsingAborted = 34 + , LSParser_ParsingFailed = 35 + , F_HighBounds = 36 + , W_LowBounds = 37 + , W_HighBounds = 38 + , E_LowBounds = 39 + , E_HighBounds = 40 + }; + + static bool isFatal(const XMLDOMMsg::Codes toCheck) + { + return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)); + } + + static bool isWarning(const XMLDOMMsg::Codes toCheck) + { + return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)); + } + + static bool isError(const XMLDOMMsg::Codes toCheck) + { + return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)); + } + + static XMLErrorReporter::ErrTypes errorType(const XMLDOMMsg::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return XMLErrorReporter::ErrType_Warning; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return XMLErrorReporter::ErrType_Fatal; + else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds)) + return XMLErrorReporter::ErrType_Error; + return XMLErrorReporter::ErrTypes_Unknown; + } + static DOMError::ErrorSeverity DOMErrorType(const XMLDOMMsg::Codes toCheck) + { + if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds)) + return DOMError::DOM_SEVERITY_WARNING; + else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds)) + return DOMError::DOM_SEVERITY_FATAL_ERROR; + else return DOMError::DOM_SEVERITY_ERROR; + } + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLDOMMsg(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/XMLDateTime.cpp b/project/jni/xerces/src/xercesc/util/XMLDateTime.cpp new file mode 100644 index 000000000..d40b341f5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLDateTime.cpp @@ -0,0 +1,1901 @@ +/* + * 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: XMLDateTime.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// constants used to process raw data (fBuffer) +// +// [-]{CCYY-MM-DD}'T'{HH:MM:SS.MS}['Z'] +// [{+|-}hh:mm'] +// + +static const XMLCh DURATION_STARTER = chLatin_P; // 'P' +static const XMLCh DURATION_Y = chLatin_Y; // 'Y' +static const XMLCh DURATION_M = chLatin_M; // 'M' +static const XMLCh DURATION_D = chLatin_D; // 'D' +static const XMLCh DURATION_H = chLatin_H; // 'H' +static const XMLCh DURATION_S = chLatin_S; // 'S' + +static const XMLCh DATE_SEPARATOR = chDash; // '-' +static const XMLCh TIME_SEPARATOR = chColon; // ':' +static const XMLCh TIMEZONE_SEPARATOR = chColon; // ':' +static const XMLCh DATETIME_SEPARATOR = chLatin_T; // 'T' +static const XMLCh MILISECOND_SEPARATOR = chPeriod; // '.' + +static const XMLCh UTC_STD_CHAR = chLatin_Z; // 'Z' +static const XMLCh UTC_POS_CHAR = chPlus; // '+' +static const XMLCh UTC_NEG_CHAR = chDash; // '-' + +static const XMLCh UTC_SET[] = {UTC_STD_CHAR //"Z+-" + , UTC_POS_CHAR + , UTC_NEG_CHAR + , chNull}; + +static const XMLSize_t YMD_MIN_SIZE = 10; // CCYY-MM-DD +static const XMLSize_t YMONTH_MIN_SIZE = 7; // CCYY_MM +static const XMLSize_t TIME_MIN_SIZE = 8; // hh:mm:ss +static const XMLSize_t TIMEZONE_SIZE = 5; // hh:mm +static const XMLSize_t DAY_SIZE = 5; // ---DD +//static const XMLSize_t MONTH_SIZE = 6; // --MM-- +static const XMLSize_t MONTHDAY_SIZE = 7; // --MM-DD +static const int NOT_FOUND = -1; + +//define constants to be used in assigning default values for +//all date/time excluding duration +static const int YEAR_DEFAULT = 2000; +static const int MONTH_DEFAULT = 01; +static const int DAY_DEFAULT = 15; + +// order-relation on duration is a partial order. The dates below are used to +// for comparison of 2 durations, based on the fact that +// duration x and y is x<=y iff s+x<=s+y +// see 3.2.6 duration W3C schema datatype specs +// +// the dates are in format: {CCYY,MM,DD, H, S, M, MS, timezone} +static const int DATETIMES[][XMLDateTime::TOTAL_SIZE] = +{ + {1696, 9, 1, 0, 0, 0, 0, XMLDateTime::UTC_STD}, + {1697, 2, 1, 0, 0, 0, 0, XMLDateTime::UTC_STD}, + {1903, 3, 1, 0, 0, 0, 0, XMLDateTime::UTC_STD}, + {1903, 7, 1, 0, 0, 0, 0, XMLDateTime::UTC_STD} +}; + +// --------------------------------------------------------------------------- +// local methods +// --------------------------------------------------------------------------- +static inline int fQuotient(int a, int b) +{ + div_t div_result = div(a, b); + return div_result.quot; +} + +static inline int fQuotient(int temp, int low, int high) +{ + return fQuotient(temp - low, high - low); +} + +static inline int mod(int a, int b, int quotient) +{ + return (a - quotient*b) ; +} + +static inline int modulo (int temp, int low, int high) +{ + //modulo(a - low, high - low) + low + int a = temp - low; + int b = high - low; + return (mod (a, b, fQuotient(a, b)) + low) ; +} + +static inline bool isLeapYear(int year) +{ + return((year%4 == 0) && ((year%100 != 0) || (year%400 == 0))); +} + +static int maxDayInMonthFor(int year, int month) +{ + + if ( month == 4 || month == 6 || month == 9 || month == 11 ) + { + return 30; + } + else if ( month==2 ) + { + if ( isLeapYear(year) ) + return 29; + else + return 28; + } + else + { + return 31; + } + +} + +// --------------------------------------------------------------------------- +// static methods : for duration +// --------------------------------------------------------------------------- +/** + * Compares 2 given durations. (refer to W3C Schema Datatypes "3.2.6 duration") + * + * 3.2.6.2 Order relation on duration + * + * In general, the order-relation on duration is a partial order since there is no + * determinate relationship between certain durations such as one month (P1M) and 30 days (P30D). + * The order-relation of two duration values x and y is x < y iff s+x < s+y for each qualified + * dateTime s in the list below. + * + * These values for s cause the greatest deviations in the addition of dateTimes and durations + * + **/ +int XMLDateTime::compare(const XMLDateTime* const pDate1 + , const XMLDateTime* const pDate2 + , bool strict) +{ + //REVISIT: this is unoptimazed vs of comparing 2 durations + // Algorithm is described in 3.2.6.2 W3C Schema Datatype specs + // + + int resultA, resultB = INDETERMINATE; + + //try and see if the objects are equal + if ( (resultA = compareOrder(pDate1, pDate2)) == EQUAL) + return EQUAL; + + //long comparison algorithm is required + XMLDateTime tempA(XMLPlatformUtils::fgMemoryManager), *pTempA = &tempA; + XMLDateTime tempB(XMLPlatformUtils::fgMemoryManager), *pTempB = &tempB; + + addDuration(pTempA, pDate1, 0); + addDuration(pTempB, pDate2, 0); + resultA = compareOrder(pTempA, pTempB); + if ( resultA == INDETERMINATE ) + return INDETERMINATE; + + addDuration(pTempA, pDate1, 1); + addDuration(pTempB, pDate2, 1); + resultB = compareOrder(pTempA, pTempB); + resultA = compareResult(resultA, resultB, strict); + if ( resultA == INDETERMINATE ) + return INDETERMINATE; + + addDuration(pTempA, pDate1, 2); + addDuration(pTempB, pDate2, 2); + resultB = compareOrder(pTempA, pTempB); + resultA = compareResult(resultA, resultB, strict); + if ( resultA == INDETERMINATE ) + return INDETERMINATE; + + addDuration(pTempA, pDate1, 3); + addDuration(pTempB, pDate2, 3); + resultB = compareOrder(pTempA, pTempB); + resultA = compareResult(resultA, resultB, strict); + + return resultA; + +} + +// +// Form a new XMLDateTime with duration and baseDate array +// Note: C++ Java +// fNewDate duration +// fDuration date +// + +void XMLDateTime::addDuration(XMLDateTime* fNewDate + , const XMLDateTime* const fDuration + , int index) + +{ + + //REVISIT: some code could be shared between normalize() and this method, + // however is it worth moving it? The structures are different... + // + + fNewDate->reset(); + //add months (may be modified additionaly below) + int temp = DATETIMES[index][Month] + fDuration->fValue[Month]; + fNewDate->fValue[Month] = modulo(temp, 1, 13); + int carry = fQuotient(temp, 1, 13); + if (fNewDate->fValue[Month] <= 0) { + fNewDate->fValue[Month]+= 12; + carry--; + } + + //add years (may be modified additionaly below) + fNewDate->fValue[CentYear] = DATETIMES[index][CentYear] + fDuration->fValue[CentYear] + carry; + + //add seconds + temp = DATETIMES[index][Second] + fDuration->fValue[Second]; + carry = fQuotient (temp, 60); + fNewDate->fValue[Second] = mod(temp, 60, carry); + if (fNewDate->fValue[Second] < 0) { + fNewDate->fValue[Second]+= 60; + carry--; + } + + //add minutes + temp = DATETIMES[index][Minute] + fDuration->fValue[Minute] + carry; + carry = fQuotient(temp, 60); + fNewDate->fValue[Minute] = mod(temp, 60, carry); + if (fNewDate->fValue[Minute] < 0) { + fNewDate->fValue[Minute]+= 60; + carry--; + } + + //add hours + temp = DATETIMES[index][Hour] + fDuration->fValue[Hour] + carry; + carry = fQuotient(temp, 24); + fNewDate->fValue[Hour] = mod(temp, 24, carry); + if (fNewDate->fValue[Hour] < 0) { + fNewDate->fValue[Hour]+= 24; + carry--; + } + + fNewDate->fValue[Day] = DATETIMES[index][Day] + fDuration->fValue[Day] + carry; + + while ( true ) + { + temp = maxDayInMonthFor(fNewDate->fValue[CentYear], fNewDate->fValue[Month]); + if ( fNewDate->fValue[Day] < 1 ) + { //original fNewDate was negative + fNewDate->fValue[Day] += maxDayInMonthFor(fNewDate->fValue[CentYear], fNewDate->fValue[Month]-1); + carry = -1; + } + else if ( fNewDate->fValue[Day] > temp ) + { + fNewDate->fValue[Day] -= temp; + carry = 1; + } + else + { + break; + } + + temp = fNewDate->fValue[Month] + carry; + fNewDate->fValue[Month] = modulo(temp, 1, 13); + if (fNewDate->fValue[Month] <= 0) { + fNewDate->fValue[Month]+= 12; + fNewDate->fValue[CentYear]--; + } + fNewDate->fValue[CentYear] += fQuotient(temp, 1, 13); + } + + //fNewDate->fValue[utc] = UTC_STD_CHAR; + fNewDate->fValue[utc] = UTC_STD; +} + +int XMLDateTime::compareResult(int resultA + , int resultB + , bool strict) +{ + + if ( resultB == INDETERMINATE ) + { + return INDETERMINATE; + } + else if ( (resultA != resultB) && + strict ) + { + return INDETERMINATE; + } + else if ( (resultA != resultB) && + !strict ) + { + if ( (resultA != EQUAL) && + (resultB != EQUAL) ) + { + return INDETERMINATE; + } + else + { + return (resultA != EQUAL)? resultA : resultB; + } + } + + return resultA; + +} + +// --------------------------------------------------------------------------- +// static methods : for others +// --------------------------------------------------------------------------- +int XMLDateTime::compare(const XMLDateTime* const pDate1 + , const XMLDateTime* const pDate2) +{ + + if (pDate1->fValue[utc] == pDate2->fValue[utc]) + { + return XMLDateTime::compareOrder(pDate1, pDate2); + } + + int c1, c2; + + if ( pDate1->isNormalized()) + { + c1 = compareResult(pDate1, pDate2, false, UTC_POS); + c2 = compareResult(pDate1, pDate2, false, UTC_NEG); + return getRetVal(c1, c2); + } + else if ( pDate2->isNormalized()) + { + c1 = compareResult(pDate1, pDate2, true, UTC_POS); + c2 = compareResult(pDate1, pDate2, true, UTC_NEG); + return getRetVal(c1, c2); + } + + return INDETERMINATE; +} + +int XMLDateTime::compareResult(const XMLDateTime* const pDate1 + , const XMLDateTime* const pDate2 + , bool set2Left + , int utc_type) +{ + XMLDateTime tmpDate = (set2Left ? *pDate1 : *pDate2); + + tmpDate.fTimeZone[hh] = 14; + tmpDate.fTimeZone[mm] = 0; + tmpDate.fValue[utc] = utc_type; + tmpDate.normalize(); + + return (set2Left? XMLDateTime::compareOrder(&tmpDate, pDate2) : + XMLDateTime::compareOrder(pDate1, &tmpDate)); +} + +int XMLDateTime::compareOrder(const XMLDateTime* const lValue + , const XMLDateTime* const rValue) + //, MemoryManager* const memMgr) +{ + // + // If any of the them is not normalized() yet, + // we need to do something here. + // + XMLDateTime lTemp = *lValue; + XMLDateTime rTemp = *rValue; + + lTemp.normalize(); + rTemp.normalize(); + + for ( int i = 0 ; i < TOTAL_SIZE; i++ ) + { + if ( lTemp.fValue[i] < rTemp.fValue[i] ) + { + return LESS_THAN; + } + else if ( lTemp.fValue[i] > rTemp.fValue[i] ) + { + return GREATER_THAN; + } + } + + if ( lTemp.fHasTime) + { + if ( lTemp.fMilliSecond < rTemp.fMilliSecond ) + { + return LESS_THAN; + } + else if ( lTemp.fMilliSecond > rTemp.fMilliSecond ) + { + return GREATER_THAN; + } + } + + return EQUAL; +} + +// --------------------------------------------------------------------------- +// ctor and dtor +// --------------------------------------------------------------------------- +XMLDateTime::~XMLDateTime() +{ + if (fBuffer) + fMemoryManager->deallocate(fBuffer);//delete[] fBuffer; +} + +XMLDateTime::XMLDateTime(MemoryManager* const manager) +: fStart(0) +, fEnd(0) +, fBufferMaxLen(0) +, fMilliSecond(0) +, fHasTime(false) +, fBuffer(0) +, fMemoryManager(manager) +{ + reset(); +} + +XMLDateTime::XMLDateTime(const XMLCh* const aString, + MemoryManager* const manager) +: fStart(0) +, fEnd(0) +, fBufferMaxLen(0) +, fMilliSecond(0) +, fHasTime(false) +, fBuffer(0) +, fMemoryManager(manager) +{ + setBuffer(aString); +} + +// ----------------------------------------------------------------------- +// Copy ctor and Assignment operators +// ----------------------------------------------------------------------- + +XMLDateTime::XMLDateTime(const XMLDateTime &toCopy) +: XMLNumber(toCopy) +, fBufferMaxLen(0) +, fBuffer(0) +, fMemoryManager(toCopy.fMemoryManager) +{ + copy(toCopy); +} + +XMLDateTime& XMLDateTime::operator=(const XMLDateTime& rhs) +{ + if (this == &rhs) + return *this; + + copy(rhs); + return *this; +} + +// ----------------------------------------------------------------------- +// Implementation of Abstract Interface +// ----------------------------------------------------------------------- + +// +// We may simply return the handle to fBuffer +// +XMLCh* XMLDateTime::getRawData() const +{ + return fBuffer; +} + +const XMLCh* XMLDateTime::getFormattedString() const +{ + return getRawData(); +} + +int XMLDateTime::getSign() const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// Parsers +// --------------------------------------------------------------------------- + +// +// [-]{CCYY-MM-DD}'T'{HH:MM:SS.MS}[TimeZone] +// +void XMLDateTime::parseDateTime() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dt_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + getDate(); + + //fStart is supposed to point to 'T' + if (fBuffer[fStart++] != DATETIME_SEPARATOR) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dt_missingT + , fBuffer + , fMemoryManager); + + getTime(); + validateDateTime(); + normalize(); + fHasTime = true; +} + +// +// [-]{CCYY-MM-DD}[TimeZone] +// +void XMLDateTime::parseDate() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_date_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + getDate(); + parseTimeZone(); + validateDateTime(); + normalize(); +} + +void XMLDateTime::parseTime() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_time_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + // time initialize to default values + fValue[CentYear]= YEAR_DEFAULT; + fValue[Month] = MONTH_DEFAULT; + fValue[Day] = DAY_DEFAULT; + + getTime(); + + validateDateTime(); + normalize(); + fHasTime = true; +} + +// +// {---DD}[TimeZone] +// 01234 +// +void XMLDateTime::parseDay() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gDay_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + if (fBuffer[0] != DATE_SEPARATOR || + fBuffer[1] != DATE_SEPARATOR || + fBuffer[2] != DATE_SEPARATOR ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gDay_invalid + , fBuffer + , fMemoryManager); + } + + //initialize values + fValue[CentYear] = YEAR_DEFAULT; + fValue[Month] = MONTH_DEFAULT; + fValue[Day] = parseInt(fStart+3, fStart+5); + + if ( DAY_SIZE < fEnd ) + { + int pos = XMLString::indexOf(UTC_SET, fBuffer[DAY_SIZE]); + if (pos == -1 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gDay_invalid + , fBuffer + , fMemoryManager); + } + else + { + fValue[utc] = pos+1; + getTimeZone(DAY_SIZE); + } + } + + validateDateTime(); + normalize(); +} + +// +// {--MM--}[TimeZone] +// {--MM}[TimeZone] +// 012345 +// +void XMLDateTime::parseMonth() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMth_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + if (fBuffer[0] != DATE_SEPARATOR || + fBuffer[1] != DATE_SEPARATOR ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMth_invalid + , fBuffer + , fMemoryManager); + } + + //set constants + fValue[CentYear] = YEAR_DEFAULT; + fValue[Day] = DAY_DEFAULT; + fValue[Month] = parseInt(2, 4); + + // REVISIT: allow both --MM and --MM-- now. + // need to remove the following lines to disallow --MM-- + // when the errata is officially in the rec. + fStart = 4; + if ( fEnd >= fStart+2 && fBuffer[fStart] == DATE_SEPARATOR && fBuffer[fStart+1] == DATE_SEPARATOR ) + { + fStart += 2; + } + + // + // parse TimeZone if any + // + if ( fStart < fEnd ) + { + int pos = XMLString::indexOf(UTC_SET, fBuffer[fStart]); + if ( pos == NOT_FOUND ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMth_invalid + , fBuffer + , fMemoryManager); + } + else + { + fValue[utc] = pos+1; + getTimeZone(fStart); + } + } + + validateDateTime(); + normalize(); +} + +// +//[-]{CCYY}[TimeZone] +// 0 1234 +// +void XMLDateTime::parseYear() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_year_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + // skip the first '-' and search for timezone + // + int sign = findUTCSign((fBuffer[0] == chDash) ? 1 : 0); + + if (sign == NOT_FOUND) + { + fValue[CentYear] = parseIntYear(fEnd); + } + else + { + fValue[CentYear] = parseIntYear(sign); + getTimeZone(sign); + } + + //initialize values + fValue[Month] = MONTH_DEFAULT; + fValue[Day] = DAY_DEFAULT; //java is 1 + + validateDateTime(); + normalize(); +} + +// +//{--MM-DD}[TimeZone] +// 0123456 +// +void XMLDateTime::parseMonthDay() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMthDay_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + if (fBuffer[0] != DATE_SEPARATOR || + fBuffer[1] != DATE_SEPARATOR || + fBuffer[4] != DATE_SEPARATOR ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMthDay_invalid + , fBuffer + , fMemoryManager); + } + + + //initialize + fValue[CentYear] = YEAR_DEFAULT; + fValue[Month] = parseInt(2, 4); + fValue[Day] = parseInt(5, 7); + + if ( MONTHDAY_SIZE < fEnd ) + { + int pos = XMLString::indexOf(UTC_SET, fBuffer[MONTHDAY_SIZE]); + if ( pos == NOT_FOUND ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_gMthDay_invalid + , fBuffer + , fMemoryManager); + } + else + { + fValue[utc] = pos+1; + getTimeZone(MONTHDAY_SIZE); + } + } + + validateDateTime(); + normalize(); +} + +void XMLDateTime::parseYearMonth() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_ym_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + // get date + getYearMonth(); + fValue[Day] = DAY_DEFAULT; + parseTimeZone(); + + validateDateTime(); + normalize(); +} + +// +//PnYn MnDTnH nMnS: -P1Y2M3DT10H30M +// +// [-]{'P'{[n'Y'][n'M'][n'D']['T'][n'H'][n'M'][n'S']}} +// +// Note: the n above shall be >= 0 +// if no time element found, 'T' shall be absent +// +void XMLDateTime::parseDuration() +{ + if (!initParser()) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_invalid + , fBuffer ? fBuffer : XMLUni::fgZeroLenString + , fMemoryManager); + + // must start with '-' or 'P' + // + XMLCh c = fBuffer[fStart++]; + if ( (c != DURATION_STARTER) && + (c != chDash) ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_Start_dashP + , fBuffer + , fMemoryManager); + } + + // 'P' must ALWAYS be present in either case + if ( (c == chDash) && + (fBuffer[fStart++]!= DURATION_STARTER )) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_noP + , fBuffer + , fMemoryManager); + } + + // java code + //date[utc]=(c=='-')?'-':0; + //fValue[utc] = UTC_STD; + fValue[utc] = (fBuffer[0] == chDash? UTC_NEG : UTC_STD); + + int negate = ( fBuffer[0] == chDash ? -1 : 1); + + // + // No negative value is allowed after 'P' + // + // eg P-1234, invalid + // + if (indexOf(fStart, fEnd, chDash) != NOT_FOUND) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_DashNotFirst + , fBuffer + , fMemoryManager); + } + + //at least one number and designator must be seen after P + bool designator = false; + + int endDate = indexOf(fStart, fEnd, DATETIME_SEPARATOR); + if ( endDate == NOT_FOUND ) + { + endDate = (int)fEnd; // 'T' absent + } + + //find 'Y' + int end = indexOf(fStart, endDate, DURATION_Y); + if ( end != NOT_FOUND ) + { + //scan year + fValue[CentYear] = negate * parseInt(fStart, end); + fStart = end+1; + designator = true; + } + + end = indexOf(fStart, endDate, DURATION_M); + if ( end != NOT_FOUND ) + { + //scan month + fValue[Month] = negate * parseInt(fStart, end); + fStart = end+1; + designator = true; + } + + end = indexOf(fStart, endDate, DURATION_D); + if ( end != NOT_FOUND ) + { + //scan day + fValue[Day] = negate * parseInt(fStart,end); + fStart = end+1; + designator = true; + } + + if ( (fEnd == XMLSize_t (endDate)) && // 'T' absent + (fStart != fEnd) ) // something after Day + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_inv_b4T + , fBuffer + , fMemoryManager); + } + + if ( fEnd != XMLSize_t (endDate) ) // 'T' present + { + //scan hours, minutes, seconds + // + + // skip 'T' first + end = indexOf(++fStart, fEnd, DURATION_H); + if ( end != NOT_FOUND ) + { + //scan hours + fValue[Hour] = negate * parseInt(fStart, end); + fStart = end+1; + designator = true; + } + + end = indexOf(fStart, fEnd, DURATION_M); + if ( end != NOT_FOUND ) + { + //scan min + fValue[Minute] = negate * parseInt(fStart, end); + fStart = end+1; + designator = true; + } + + end = indexOf(fStart, fEnd, DURATION_S); + if ( end != NOT_FOUND ) + { + //scan seconds + int mlsec = indexOf (fStart, end, MILISECOND_SEPARATOR); + + /*** + * Schema Errata: E2-23 + * at least one digit must follow the decimal point if it appears. + * That is, the value of the seconds component must conform + * to the following pattern: [0-9]+(.[0-9]+)? + */ + if ( mlsec != NOT_FOUND ) + { + /*** + * make usure there is something after the '.' and before the end. + */ + if ( mlsec+1 == end ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_inv_seconds + , fBuffer + , fMemoryManager); + } + + fValue[Second] = negate * parseInt(fStart, mlsec); + fMilliSecond = negate * parseMiliSecond(mlsec+1, end); + } + else + { + fValue[Second] = negate * parseInt(fStart,end); + } + + fStart = end+1; + designator = true; + } + + // no additional data should appear after last item + // P1Y1M1DT is illigal value as well + if ( (fStart != fEnd) || + fBuffer[--fStart] == DATETIME_SEPARATOR ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_NoTimeAfterT + , fBuffer + , fMemoryManager); + } + } + + if ( !designator ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_dur_NoElementAtAll + , fBuffer + , fMemoryManager); + } + +} + +// --------------------------------------------------------------------------- +// Scanners +// --------------------------------------------------------------------------- + +// +// [-]{CCYY-MM-DD} +// +// Note: CCYY could be more than 4 digits +// Assuming fStart point to the beginning of the Date Section +// fStart updated to point to the position right AFTER the second 'D' +// Since the lenght of CCYY might be variable, we can't check format upfront +// +void XMLDateTime::getDate() +{ + + // Ensure enough chars in buffer + if ( (fStart+YMD_MIN_SIZE) > fEnd) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_date_incomplete + , fBuffer + , fMemoryManager); + + getYearMonth(); // Scan YearMonth and + // fStart point to the next '-' + + if (fBuffer[fStart++] != DATE_SEPARATOR) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_date_invalid + , fBuffer + , fMemoryManager); + //("CCYY-MM must be followed by '-' sign"); + } + + fValue[Day] = parseInt(fStart, fStart+2); + fStart += 2 ; //fStart points right after the Day + + return; +} + +// +// hh:mm:ss[.msssss]['Z'] +// hh:mm:ss[.msssss][['+'|'-']hh:mm] +// 012345678 +// +// Note: Assuming fStart point to the beginning of the Time Section +// fStart updated to point to the position right AFTER the second 's' +// or ms if any +// +void XMLDateTime::getTime() +{ + + // Ensure enough chars in buffer + if ( (fStart+TIME_MIN_SIZE) > fEnd) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_time_incomplete + , fBuffer + , fMemoryManager); + //"Imcomplete Time Format" + + // check (fixed) format first + if ((fBuffer[fStart + 2] != TIME_SEPARATOR) || + (fBuffer[fStart + 5] != TIME_SEPARATOR) ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_time_invalid + , fBuffer + , fMemoryManager); + //("Error in parsing time" ); + } + + // + // get hours, minute and second + // + fValue[Hour] = parseInt(fStart + 0, fStart + 2); + fValue[Minute] = parseInt(fStart + 3, fStart + 5); + fValue[Second] = parseInt(fStart + 6, fStart + 8); + fStart += 8; + + // to see if any ms and/or utc part after that + if (fStart >= fEnd) + return; + + //find UTC sign if any + int sign = findUTCSign(fStart); + + //parse miliseconds + int milisec = (fBuffer[fStart] == MILISECOND_SEPARATOR)? (int)fStart : NOT_FOUND; + if ( milisec != NOT_FOUND ) + { + fStart++; // skip the '.' + // make sure we have some thing between the '.' and fEnd + if (fStart >= fEnd) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_ms_noDigit + , fBuffer + , fMemoryManager); + //("ms shall be present once '.' is present" ); + } + + if ( sign == NOT_FOUND ) + { + fMilliSecond = parseMiliSecond(fStart, fEnd); //get ms between '.' and fEnd + fStart = fEnd; + } + else + { + fMilliSecond = parseMiliSecond(fStart, sign); //get ms between UTC sign and fEnd + } + } + else if(sign == 0 || XMLSize_t (sign) != fStart) + { + // seconds has more than 2 digits + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_min_invalid + , fBuffer + , fMemoryManager); + } + + //parse UTC time zone (hh:mm) + if ( sign > 0 ) { + getTimeZone(sign); + } + +} + +// +// [-]{CCYY-MM} +// +// Note: CCYY could be more than 4 digits +// fStart updated to point AFTER the second 'M' (probably meet the fEnd) +// +void XMLDateTime::getYearMonth() +{ + + // Ensure enough chars in buffer + if ( (fStart+YMONTH_MIN_SIZE) > fEnd) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_ym_incomplete + , fBuffer + , fMemoryManager); + //"Imcomplete YearMonth Format"; + + // skip the first leading '-' + XMLSize_t start = ( fBuffer[0] == chDash ) ? fStart + 1 : fStart; + + // + // search for year separator '-' + // + int yearSeparator = indexOf(start, fEnd, DATE_SEPARATOR); + if ( yearSeparator == NOT_FOUND) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_ym_invalid + , fBuffer + , fMemoryManager); + //("Year separator is missing or misplaced"); + + fValue[CentYear] = parseIntYear(yearSeparator); + fStart = yearSeparator + 1; //skip the '-' and point to the first M + + // + //gonna check we have enough byte for month + // + if ((fStart + 2) > fEnd ) + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_ym_noMonth + , fBuffer + , fMemoryManager); + //"no month in buffer" + + fValue[Month] = parseInt(fStart, yearSeparator + 3); + fStart += 2; //fStart points right after the MONTH + + return; +} + +void XMLDateTime::parseTimeZone() +{ + //fStart points right after the date + if ( fStart < fEnd ) { + int pos = XMLString::indexOf(UTC_SET, fBuffer[fStart]); + if (pos == NOT_FOUND) { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_tz_noUTCsign + , fBuffer + , fMemoryManager); + } + else { + fValue[utc] = pos+1; + getTimeZone(fStart); + } + } + + return; +} + +// +// 'Z' +// ['+'|'-']hh:mm +// +// Note: Assuming fStart points to the beginning of TimeZone section +// fStart updated to meet fEnd +// +void XMLDateTime::getTimeZone(const XMLSize_t sign) +{ + + if ( fBuffer[sign] == UTC_STD_CHAR ) + { + if ((sign + 1) != fEnd ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_tz_stuffAfterZ + , fBuffer + , fMemoryManager); + //"Error in parsing time zone"); + } + + return; + } + + // + // otherwise, it has to be this format + // '[+|-]'hh:mm + // 1 23456 7 + // sign fEnd + // + if ( ( ( sign + TIMEZONE_SIZE + 1) != fEnd ) || + ( fBuffer[sign + 3] != TIMEZONE_SEPARATOR ) ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_tz_invalid + , fBuffer + , fMemoryManager); + //("Error in parsing time zone"); + } + + fTimeZone[hh] = parseInt(sign+1, sign+3); + fTimeZone[mm] = parseInt(sign+4, fEnd); + + return; +} + +// --------------------------------------------------------------------------- +// Validator and normalizer +// --------------------------------------------------------------------------- + +/** + * If timezone present - normalize dateTime [E Adding durations to dateTimes] + * + * @param date CCYY-MM-DDThh:mm:ss+03 + * @return CCYY-MM-DDThh:mm:ssZ + */ +void XMLDateTime::normalize() +{ + + if ((fValue[utc] == UTC_UNKNOWN) || + (fValue[utc] == UTC_STD) ) + return; + + int negate = (fValue[utc] == UTC_POS)? -1: 1; + int temp; + int carry; + + + // we normalize a duration so could have 200M... + //update months (may be modified additionaly below) + temp = fValue[Month]; + fValue[Month] = modulo(temp, 1, 13); + carry = fQuotient(temp, 1, 13); + if (fValue[Month] <= 0) { + fValue[Month]+= 12; + carry--; + } + + //add years (may be modified additionaly below) + fValue[CentYear] += carry; + + // add mins + temp = fValue[Minute] + negate * fTimeZone[mm]; + carry = fQuotient(temp, 60); + fValue[Minute] = mod(temp, 60, carry); + if (fValue[Minute] < 0) { + fValue[Minute] += 60; + carry--; + } + + //add hours + temp = fValue[Hour] + negate * fTimeZone[hh] + carry; + carry = fQuotient(temp, 24); + fValue[Hour] = mod(temp, 24, carry); + if (fValue[Hour] < 0) { + fValue[Hour] += 24; + carry--; + } + + fValue[Day] += carry; + + while (1) + { + temp = maxDayInMonthFor(fValue[CentYear], fValue[Month]); + if (fValue[Day] < 1) + { + fValue[Day] += maxDayInMonthFor(fValue[CentYear], fValue[Month] - 1); + carry = -1; + } + else if ( fValue[Day] > temp ) + { + fValue[Day] -= temp; + carry = 1; + } + else + { + break; + } + + temp = fValue[Month] + carry; + fValue[Month] = modulo(temp, 1, 13); + if (fValue[Month] <=0) { + fValue[Month]+= 12; + fValue[CentYear]--; + } + fValue[CentYear] += fQuotient(temp, 1, 13); + } + + // set to normalized + fValue[utc] = UTC_STD; + + return; +} + +void XMLDateTime::validateDateTime() const +{ + + //REVISIT: should we throw an exception for not valid dates + // or reporting an error message should be sufficient? + if ( fValue[CentYear] == 0 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_year_zero + , fBuffer + , fMemoryManager); + //"The year \"0000\" is an illegal year value"); + } + + if ( fValue[Month] < 1 || + fValue[Month] > 12 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_mth_invalid + , fBuffer + , fMemoryManager); + //"The month must have values 1 to 12"); + } + + //validate days + if ( fValue[Day] > maxDayInMonthFor( fValue[CentYear], fValue[Month]) || + fValue[Day] == 0 ) + { + XMLCh szMaxDay[3]; + XMLString::binToText(maxDayInMonthFor( fValue[CentYear], fValue[Month]), szMaxDay, 3, 10, fMemoryManager); + ThrowXMLwithMemMgr2(SchemaDateTimeException + , XMLExcepts::DateTime_day_invalid + , fBuffer + , szMaxDay + , fMemoryManager); + //"The day must have values 1 to 31"); + } + + //validate hours + if ((fValue[Hour] < 0) || + (fValue[Hour] > 24) || + ((fValue[Hour] == 24) && ((fValue[Minute] !=0) || + (fValue[Second] !=0) || + (fMilliSecond !=0)))) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_hour_invalid + , fBuffer + , fMemoryManager); + //("Hour must have values 0-23"); + } + + //validate minutes + if ( fValue[Minute] < 0 || + fValue[Minute] > 59 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_min_invalid + , fBuffer + , fMemoryManager); + //"Minute must have values 0-59"); + } + + //validate seconds + if ( fValue[Second] < 0 || + fValue[Second] > 60 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_second_invalid + , fBuffer + , fMemoryManager); + //"Second must have values 0-60"); + } + + //validate time-zone hours + if ( (abs(fTimeZone[hh]) > 14) || + ((abs(fTimeZone[hh]) == 14) && (fTimeZone[mm] != 0)) ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_tz_hh_invalid + , fBuffer + , fMemoryManager); + //"Time zone should have range -14..+14"); + } + + //validate time-zone minutes + if ( abs(fTimeZone[mm]) > 59 ) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_min_invalid + , fBuffer + , fMemoryManager); + //("Minute must have values 0-59"); + } + + return; +} + +// ----------------------------------------------------------------------- +// locator and converter +// ----------------------------------------------------------------------- +int XMLDateTime::indexOf(const XMLSize_t start, const XMLSize_t end, const XMLCh ch) const +{ + for ( XMLSize_t i = start; i < end; i++ ) + if ( fBuffer[i] == ch ) + return (int)i; + + return NOT_FOUND; +} + +int XMLDateTime::findUTCSign (const XMLSize_t start) +{ + int pos; + for ( XMLSize_t index = start; index < fEnd; index++ ) + { + pos = XMLString::indexOf(UTC_SET, fBuffer[index]); + if ( pos != NOT_FOUND) + { + fValue[utc] = pos+1; // refer to utcType, there is 1 diff + return (int)index; + } + } + + return NOT_FOUND; +} + +// +// Note: +// start: starting point in fBuffer +// end: ending point in fBuffer (exclusive) +// fStart NOT updated +// +int XMLDateTime::parseInt(const XMLSize_t start, const XMLSize_t end) const +{ + unsigned int retVal = 0; + for (XMLSize_t i=start; i < end; i++) { + + if (fBuffer[i] < chDigit_0 || fBuffer[i] > chDigit_9) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, fMemoryManager); + + retVal = (retVal * 10) + (unsigned int) (fBuffer[i] - chDigit_0); + } + + return (int) retVal; +} + +// +// Note: +// start: pointing to the first digit after the '.' +// end: pointing to one position after the last digit +// fStart NOT updated +// +double XMLDateTime::parseMiliSecond(const XMLSize_t start, const XMLSize_t end) const +{ + double div = 10; + double retval = 0; + + for (XMLSize_t i=start; i < end; i++) { + + if (fBuffer[i] < chDigit_0 || fBuffer[i] > chDigit_9) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, fMemoryManager); + + retval += (fBuffer[i] == chDigit_0) ? 0 : ((double) (fBuffer[i] - chDigit_0)/div); + div *= 10; + } + + // we don't check underflow occurs since + // nothing we can do about it. + return retval; +} + +// +// [-]CCYY +// +// Note: start from fStart +// end (exclusive) +// fStart NOT updated +// +int XMLDateTime::parseIntYear(const XMLSize_t end) const +{ + // skip the first leading '-' + XMLSize_t start = ( fBuffer[0] == chDash ) ? fStart + 1 : fStart; + + XMLSize_t length = end - start; + if (length < 4) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_year_tooShort + , fBuffer + , fMemoryManager); + //"Year must have 'CCYY' format"); + } + else if (length > 4 && + fBuffer[start] == chDigit_0) + { + ThrowXMLwithMemMgr1(SchemaDateTimeException + , XMLExcepts::DateTime_year_leadingZero + , fBuffer + , fMemoryManager); + //"Leading zeros are required if the year value would otherwise have fewer than four digits; + // otherwise they are forbidden"); + } + + bool negative = (fBuffer[0] == chDash); + int yearVal = parseInt((negative ? 1 : 0), end); + return ( negative ? (-1) * yearVal : yearVal ); +} + +/*** + * E2-41 + * + * 3.2.7.2 Canonical representation + * + * Except for trailing fractional zero digits in the seconds representation, + * '24:00:00' time representations, and timezone (for timezoned values), + * the mapping from literals to values is one-to-one. Where there is more + * than one possible representation, the canonical representation is as follows: + * redundant trailing zero digits in fractional-second literals are prohibited. + * An hour representation of '24' is prohibited. Timezoned values are canonically + * represented by appending 'Z' to the nontimezoned representation. (All + * timezoned dateTime values are UTC.) + * + * .'24:00:00' -> '00:00:00' + * .milisecond: trailing zeros removed + * .'Z' + * + ***/ +XMLCh* XMLDateTime::getDateTimeCanonicalRepresentation(MemoryManager* const memMgr) const +{ + XMLCh *miliStartPtr, *miliEndPtr; + searchMiliSeconds(miliStartPtr, miliEndPtr); + XMLSize_t miliSecondsLen = miliEndPtr - miliStartPtr; + int utcSize = (fValue[utc] == UTC_UNKNOWN) ? 0 : 1; + + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + XMLCh* retBuf = (XMLCh*) toUse->allocate( (21 + miliSecondsLen + utcSize + 1) * sizeof(XMLCh)); + XMLCh* retPtr = retBuf; + + // (-?) cc+yy-mm-dd'T'hh:mm:ss'Z' ('.'s+)? + // 2+ 8 1 8 1 + // + int additionalLen = fillYearString(retPtr, fValue[CentYear]); + if(additionalLen != 0) + { + // very bad luck; have to resize the buffer... + XMLCh *tmpBuf = (XMLCh*) toUse->allocate( (additionalLen+21+miliSecondsLen +2) * sizeof(XMLCh)); + XMLString::moveChars(tmpBuf, retBuf, 4+additionalLen); + retPtr = tmpBuf+(retPtr-retBuf); + toUse->deallocate(retBuf); + retBuf = tmpBuf; + } + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, fValue[Month], 2); + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, fValue[Day], 2); + *retPtr++ = DATETIME_SEPARATOR; + + fillString(retPtr, fValue[Hour], 2); + if (fValue[Hour] == 24) + { + *(retPtr - 2) = chDigit_0; + *(retPtr - 1) = chDigit_0; + } + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, fValue[Minute], 2); + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, fValue[Second], 2); + + if (miliSecondsLen) + { + *retPtr++ = chPeriod; + XMLString::copyNString(retPtr, miliStartPtr, miliSecondsLen); + retPtr += miliSecondsLen; + } + + if (utcSize) + *retPtr++ = UTC_STD_CHAR; + *retPtr = chNull; + + return retBuf; +} + +/*** + * E2-41 + * + * 3.2.9.2 Canonical representation + * + * Given a member of the date value space, the date + * portion of the canonical representation (the entire + * representation for nontimezoned values, and all but + * the timezone representation for timezoned values) + * is always the date portion of the dateTime canonical + * representation of the interval midpoint (the + * dateTime representation, truncated on the right + * to eliminate 'T' and all following characters). + * For timezoned values, append the canonical + * representation of the recoverable timezone. + * + ***/ +XMLCh* XMLDateTime::getDateCanonicalRepresentation(MemoryManager* const memMgr) const +{ + /* + * Case Date Actual Value Canonical Value + * 1 yyyy-mm-dd yyyy-mm-dd yyyy-mm-dd + * 2 yyyy-mm-ddZ yyyy-mm-ddT00:00Z yyyy-mm-ddZ + * 3 yyyy-mm-dd+00:00 yyyy-mm-ddT00:00Z yyyy-mm-ddZ + * 4 yyyy-mm-dd+00:01 YYYY-MM-DCT23:59Z yyyy-mm-dd+00:01 + * 5 yyyy-mm-dd+12:00 YYYY-MM-DCT12:00Z yyyy-mm-dd+12:00 + * 6 yyyy-mm-dd+12:01 YYYY-MM-DCT11:59Z YYYY-MM-DC-11:59 + * 7 yyyy-mm-dd+14:00 YYYY-MM-DCT10:00Z YYYY-MM-DC-10:00 + * 8 yyyy-mm-dd-00:00 yyyy-mm-ddT00:00Z yyyy-mm-ddZ + * 9 yyyy-mm-dd-00:01 yyyy-mm-ddT00:01Z yyyy-mm-dd-00:01 + * 11 yyyy-mm-dd-11:59 yyyy-mm-ddT11:59Z YYYY-MM-DD-11:59 + * 10 yyyy-mm-dd-12:00 yyyy-mm-ddT12:00Z YYYY-MM-DD+12:00 + * 12 yyyy-mm-dd-14:00 yyyy-mm-ddT14:00Z YYYY-MM-DD+10:00 + */ + int utcSize = (fValue[utc] == UTC_UNKNOWN) ? 0 : 1; + // YYYY-MM-DD + chNull + // 1234567890 + 1 + int memLength = 10 + 1 + utcSize; + + if (fTimeZone[hh] != 0 || fTimeZone[mm] != 0) { + // YYYY-MM-DD+HH:MM (utcSize will be 1 so drop that) + // 1234567890123456 + memLength += 5; // 6 - 1 for utcSize + } + + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + XMLCh* retBuf = (XMLCh*) toUse->allocate( (memLength) * sizeof(XMLCh)); + XMLCh* retPtr = retBuf; + + if (fValue[Hour] < 12) { + + int additionalLen = fillYearString(retPtr, fValue[CentYear]); + if (additionalLen != 0) { + // very bad luck; have to resize the buffer... + XMLCh *tmpBuf = (XMLCh*) toUse->allocate( (additionalLen + memLength ) * sizeof(XMLCh)); + XMLString::moveChars(tmpBuf, retBuf, 4+additionalLen); + retPtr = tmpBuf+(retPtr-retBuf); + toUse->deallocate(retBuf); + retBuf = tmpBuf; + } + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, fValue[Month], 2); + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, fValue[Day], 2); + + if (utcSize) { + if (fTimeZone[hh] != 0 || fTimeZone[mm] != 0) { + *retPtr++ = UTC_NEG_CHAR; + fillString(retPtr, fValue[Hour], 2); + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, fValue[Minute], 2); + } + else { + *retPtr++ = UTC_STD_CHAR; + } + } + *retPtr = chNull; + } + else { + /* + * Need to reconvert things to get a recoverable time zone between + * +12:00 and -11:59 + */ + int carry; + int minute; + int hour; + int day; + int month; + int year; + if (fValue[Minute] == 0) { + minute = 0; + carry = 0; + } + else { + minute = 60 - fValue[Minute]; + carry = 1; + } + hour = 24 - fValue[Hour] - carry; + day = fValue[Day] + 1; + month = fValue[Month]; + year = fValue[CentYear]; + + while (1) { + int temp = maxDayInMonthFor(year, month); + if (day < 1) { + day += maxDayInMonthFor(year, month - 1); + carry = -1; + } + else if (day > temp) { + day -= temp; + carry = 1; + } + else { + break; + } + + temp = month + carry; + month = modulo(temp, 1, 13); + if (month <= 0) { + month+= 12; + year--; + } + year += fQuotient(temp, 1, 13); + } + + int additionalLen = fillYearString(retPtr, year); + if (additionalLen != 0) { + // very bad luck; have to resize the buffer... + XMLCh *tmpBuf = (XMLCh*) toUse->allocate( (additionalLen + memLength ) * sizeof(XMLCh)); + XMLString::moveChars(tmpBuf, retBuf, 4+additionalLen); + retPtr = tmpBuf+(retPtr-retBuf); + toUse->deallocate(retBuf); + retBuf = tmpBuf; + } + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, month, 2); + *retPtr++ = DATE_SEPARATOR; + fillString(retPtr, day, 2); + + *retPtr++ = UTC_POS_CHAR; + fillString(retPtr, hour, 2); + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, minute, 2); + *retPtr = chNull; + } + return retBuf; +} + + +/*** + * 3.2.8 time + * + * . either the time zone must be omitted or, + * if present, the time zone must be Coordinated Universal Time (UTC) indicated by a "Z". + * + * . Additionally, the canonical representation for midnight is 00:00:00. + * +***/ +XMLCh* XMLDateTime::getTimeCanonicalRepresentation(MemoryManager* const memMgr) const +{ + XMLCh *miliStartPtr, *miliEndPtr; + searchMiliSeconds(miliStartPtr, miliEndPtr); + XMLSize_t miliSecondsLen = miliEndPtr - miliStartPtr; + int utcSize = (fValue[utc] == UTC_UNKNOWN) ? 0 : 1; + + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + XMLCh* retBuf = (XMLCh*) toUse->allocate( (10 + miliSecondsLen + utcSize + 1) * sizeof(XMLCh)); + XMLCh* retPtr = retBuf; + + // 'hh:mm:ss'Z' ('.'s+)? + // 8 1 + // + + fillString(retPtr, fValue[Hour], 2); + if (fValue[Hour] == 24) + { + *(retPtr - 2) = chDigit_0; + *(retPtr - 1) = chDigit_0; + } + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, fValue[Minute], 2); + *retPtr++ = TIME_SEPARATOR; + fillString(retPtr, fValue[Second], 2); + + if (miliSecondsLen) + { + *retPtr++ = chPeriod; + XMLString::copyNString(retPtr, miliStartPtr, miliSecondsLen); + retPtr += miliSecondsLen; + } + + if (utcSize) + *retPtr++ = UTC_STD_CHAR; + *retPtr = chNull; + + return retBuf; +} + +void XMLDateTime::fillString(XMLCh*& ptr, int value, XMLSize_t expLen) const +{ + XMLCh strBuffer[16]; + assert(expLen < 16); + XMLString::binToText(value, strBuffer, expLen, 10, fMemoryManager); + XMLSize_t actualLen = XMLString::stringLen(strBuffer); + XMLSize_t i; + //append leading zeros + for (i = 0; i < expLen - actualLen; i++) + { + *ptr++ = chDigit_0; + } + + for (i = 0; i < actualLen; i++) + { + *ptr++ = strBuffer[i]; + } + +} + +int XMLDateTime::fillYearString(XMLCh*& ptr, int value) const +{ + XMLCh strBuffer[16]; + // let's hope we get no years of 15 digits... + XMLString::binToText(value, strBuffer, 15, 10, fMemoryManager); + XMLSize_t actualLen = XMLString::stringLen(strBuffer); + // don't forget that years can be negative... + XMLSize_t negativeYear = 0; + if(strBuffer[0] == chDash) + { + *ptr++ = strBuffer[0]; + negativeYear = 1; + } + XMLSize_t i; + //append leading zeros + if(actualLen+negativeYear < 4) + for (i = 0; i < 4 - actualLen+negativeYear; i++) + *ptr++ = chDigit_0; + + for (i = negativeYear; i < actualLen; i++) + *ptr++ = strBuffer[i]; + + if(actualLen > 4) + return (int)actualLen-4; + return 0; +} + +/*** + * + * .check if the rawData has the mili second component + * .capture the substring + * + ***/ +void XMLDateTime::searchMiliSeconds(XMLCh*& miliStartPtr, XMLCh*& miliEndPtr) const +{ + miliStartPtr = miliEndPtr = 0; + + int milisec = XMLString::indexOf(fBuffer, MILISECOND_SEPARATOR); + if (milisec == -1) + return; + + miliStartPtr = fBuffer + milisec + 1; + miliEndPtr = miliStartPtr; + while (*miliEndPtr) + { + if ((*miliEndPtr < chDigit_0) || (*miliEndPtr > chDigit_9)) + break; + + miliEndPtr++; + } + + //remove trailing zeros + while( *(miliEndPtr - 1) == chDigit_0) + miliEndPtr--; + + return; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLDateTime) + +void XMLDateTime::serialize(XSerializeEngine& serEng) +{ + //REVISIT: may not need to call base since it does nothing + XMLNumber::serialize(serEng); + + int i = 0; + + if (serEng.isStoring()) + { + for (i = 0; i < TOTAL_SIZE; i++) + { + serEng<>fValue[i]; + } + + for (i = 0; i < TIMEZONE_ARRAYSIZE; i++) + { + serEng>>fTimeZone[i]; + } + + serEng>>(unsigned long&)fStart; + serEng>>(unsigned long&)fEnd; + + XMLSize_t dataLen = 0; + serEng.readString(fBuffer, fBufferMaxLen, dataLen ,XSerializeEngine::toReadBufferLen); + + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLDateTime.hpp b/project/jni/xerces/src/xercesc/util/XMLDateTime.hpp new file mode 100644 index 000000000..9355155d2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLDateTime.hpp @@ -0,0 +1,366 @@ +/* + * 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: XMLDateTime.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_DATETIME_HPP) +#define XERCESC_INCLUDE_GUARD_XML_DATETIME_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XSValue; + +class XMLUTIL_EXPORT XMLDateTime : public XMLNumber +{ +public: + + enum valueIndex + { + CentYear = 0, + Month , + Day , + Hour , + Minute , + Second , + MiliSecond , //not to be used directly + utc , + TOTAL_SIZE + }; + + enum utcType + { + UTC_UNKNOWN = 0, + UTC_STD , // set in parse() or normalize() + UTC_POS , // set in parse() + UTC_NEG // set in parse() + }; + + // ----------------------------------------------------------------------- + // ctors and dtor + // ----------------------------------------------------------------------- + + XMLDateTime(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XMLDateTime(const XMLCh* const, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~XMLDateTime(); + + inline void setBuffer(const XMLCh* const); + + // ----------------------------------------------------------------------- + // Copy ctor and Assignment operators + // ----------------------------------------------------------------------- + + XMLDateTime(const XMLDateTime&); + + XMLDateTime& operator=(const XMLDateTime&); + + // ----------------------------------------------------------------------- + // Implementation of Abstract Interface + // ----------------------------------------------------------------------- + + virtual XMLCh* getRawData() const; + + virtual const XMLCh* getFormattedString() const; + + virtual int getSign() const; + + // ----------------------------------------------------------------------- + // Canonical Representation + // ----------------------------------------------------------------------- + + XMLCh* getDateTimeCanonicalRepresentation(MemoryManager* const memMgr) const; + + XMLCh* getTimeCanonicalRepresentation(MemoryManager* const memMgr) const; + + XMLCh* getDateCanonicalRepresentation(MemoryManager* const memMgr) const; + + // ----------------------------------------------------------------------- + // parsers + // ----------------------------------------------------------------------- + + void parseDateTime(); //DateTime + + void parseDate(); //Date + + void parseTime(); //Time + + void parseDay(); //gDay + + void parseMonth(); //gMonth + + void parseYear(); //gYear + + void parseMonthDay(); //gMonthDay + + void parseYearMonth(); //gYearMonth + + void parseDuration(); //duration + + // ----------------------------------------------------------------------- + // Comparison + // ----------------------------------------------------------------------- + static int compare(const XMLDateTime* const + , const XMLDateTime* const); + + static int compare(const XMLDateTime* const + , const XMLDateTime* const + , bool ); + + static int compareOrder(const XMLDateTime* const + , const XMLDateTime* const); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLDateTime) + +private: + + // ----------------------------------------------------------------------- + // Constant data + // ----------------------------------------------------------------------- + // + + enum timezoneIndex + { + hh = 0, + mm , + TIMEZONE_ARRAYSIZE + }; + + // ----------------------------------------------------------------------- + // Comparison + // ----------------------------------------------------------------------- + static int compareResult(int + , int + , bool); + + static void addDuration(XMLDateTime* pDuration + , const XMLDateTime* const pBaseDate + , int index); + + + static int compareResult(const XMLDateTime* const + , const XMLDateTime* const + , bool + , int); + + static inline int getRetVal(int, int); + + // ----------------------------------------------------------------------- + // helper + // ----------------------------------------------------------------------- + + inline void reset(); + + inline void assertBuffer() const; + + inline void copy(const XMLDateTime&); + + // allow multiple parsing + inline bool initParser(); + + inline bool isNormalized() const; + + // ----------------------------------------------------------------------- + // scaners + // ----------------------------------------------------------------------- + + void getDate(); + + void getTime(); + + void getYearMonth(); + + void getTimeZone(const XMLSize_t); + + void parseTimeZone(); + + // ----------------------------------------------------------------------- + // locator and converter + // ----------------------------------------------------------------------- + + int findUTCSign(const XMLSize_t start); + + int indexOf(const XMLSize_t start + , const XMLSize_t end + , const XMLCh ch) const; + + int parseInt(const XMLSize_t start + , const XMLSize_t end) const; + + int parseIntYear(const XMLSize_t end) const; + + double parseMiliSecond(const XMLSize_t start + , const XMLSize_t end) const; + + // ----------------------------------------------------------------------- + // validator and normalizer + // ----------------------------------------------------------------------- + + void validateDateTime() const; + + void normalize(); + + void fillString(XMLCh*& ptr, int value, XMLSize_t expLen) const; + + int fillYearString(XMLCh*& ptr, int value) const; + + void searchMiliSeconds(XMLCh*& miliStartPtr, XMLCh*& miliEndPtr) const; + + // ----------------------------------------------------------------------- + // Unimplemented operator == + // ----------------------------------------------------------------------- + bool operator==(const XMLDateTime& toCompare) const; + + + // ----------------------------------------------------------------------- + // Private data members + // + // fValue[] + // object representation of date time. + // + // fTimeZone[] + // temporary storage for normalization + // + // fStart, fEnd + // pointers to the portion of fBuffer being parsed + // + // fBuffer + // raw data to be parsed, own it. + // + // ----------------------------------------------------------------------- + + int fValue[TOTAL_SIZE]; + int fTimeZone[TIMEZONE_ARRAYSIZE]; + XMLSize_t fStart; + XMLSize_t fEnd; + XMLSize_t fBufferMaxLen; + + double fMilliSecond; + bool fHasTime; + + XMLCh* fBuffer; + MemoryManager* fMemoryManager; + + friend class XSValue; +}; + +inline void XMLDateTime::setBuffer(const XMLCh* const aString) +{ + reset(); + + fEnd = XMLString::stringLen(aString); + + for (; fEnd > 0; fEnd--) + { + if (!XMLChar1_0::isWhitespace(aString[fEnd - 1])) + break; + } + + if (fEnd > 0) { + + if (fEnd > fBufferMaxLen) + { + fMemoryManager->deallocate(fBuffer); + fBufferMaxLen = fEnd + 8; + fBuffer = (XMLCh*) fMemoryManager->allocate((fBufferMaxLen+1) * sizeof(XMLCh)); + } + + memcpy(fBuffer, aString, (fEnd) * sizeof(XMLCh)); + fBuffer[fEnd] = '\0'; + } +} + +inline void XMLDateTime::reset() +{ + for ( int i=0; i < TOTAL_SIZE; i++ ) + fValue[i] = 0; + + fMilliSecond = 0; + fHasTime = false; + fTimeZone[hh] = fTimeZone[mm] = 0; + fStart = fEnd = 0; + + if (fBuffer) + *fBuffer = 0; +} + +inline void XMLDateTime::copy(const XMLDateTime& rhs) +{ + for ( int i = 0; i < TOTAL_SIZE; i++ ) + fValue[i] = rhs.fValue[i]; + + fMilliSecond = rhs.fMilliSecond; + fHasTime = rhs.fHasTime; + fTimeZone[hh] = rhs.fTimeZone[hh]; + fTimeZone[mm] = rhs.fTimeZone[mm]; + fStart = rhs.fStart; + fEnd = rhs.fEnd; + + if (fEnd > 0) + { + if (fEnd > fBufferMaxLen) + { + fMemoryManager->deallocate(fBuffer);//delete[] fBuffer; + fBufferMaxLen = rhs.fBufferMaxLen; + fBuffer = (XMLCh*) fMemoryManager->allocate((fBufferMaxLen+1) * sizeof(XMLCh)); + } + + memcpy(fBuffer, rhs.fBuffer, (fEnd+1) * sizeof(XMLCh)); + } +} + +inline bool XMLDateTime::initParser() +{ + if (!fBuffer || fBuffer[0] == chNull) + return false; + + fStart = 0; // to ensure scan from the very first beginning + // in case the pointer is updated accidentally by + // someone else. + return true; +} + +inline bool XMLDateTime::isNormalized() const +{ + return ( fValue[utc] == UTC_STD ? true : false ); +} + +inline int XMLDateTime::getRetVal(int c1, int c2) +{ + if ((c1 == LESS_THAN && c2 == GREATER_THAN) || + (c1 == GREATER_THAN && c2 == LESS_THAN) ) + { + return INDETERMINATE; + } + + return ( c1 != INDETERMINATE ) ? c1 : c2; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLDouble.cpp b/project/jni/xerces/src/xercesc/util/XMLDouble.cpp new file mode 100644 index 000000000..d480f71c4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLDouble.cpp @@ -0,0 +1,70 @@ +/* + * 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: XMLDouble.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ctor/dtor +// --------------------------------------------------------------------------- +XMLDouble::XMLDouble(const XMLCh* const strValue, + MemoryManager* const manager) +:XMLAbstractDoubleFloat(manager) +{ + init(strValue); +} + +XMLDouble::~XMLDouble() +{ +} + +void XMLDouble::checkBoundary(char* const strValue) +{ + convert(strValue); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLDouble) + +XMLDouble::XMLDouble(MemoryManager* const manager) +:XMLAbstractDoubleFloat(manager) +{ +} + +void XMLDouble::serialize(XSerializeEngine& serEng) +{ + XMLAbstractDoubleFloat::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLDouble.hpp b/project/jni/xerces/src/xercesc/util/XMLDouble.hpp new file mode 100644 index 000000000..48c32f1ee --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLDouble.hpp @@ -0,0 +1,99 @@ +/* + * 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: XMLDouble.hpp 673155 2008-07-01 17:55:39Z dbertoni $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_DOUBLE_HPP) +#define XERCESC_INCLUDE_GUARD_XML_DOUBLE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLDouble : public XMLAbstractDoubleFloat +{ +public: + + /** + * Constructs a newly allocated XMLDouble object that + * represents the value represented by the string. + * + * @param strValue the String to be converted to an + * XMLDouble. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @exception NumberFormatException if the String does not + * contain a parsable XMLDouble. + */ + + XMLDouble(const XMLCh* const strValue, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~XMLDouble(); + + /** + * Compares this object to the specified object. + * The result is true if and only if the argument is not + * null and is an XMLDouble object that contains + * the same int value as this object. + * + * @param lValue the object to compare with. + * @param rValue the object to compare against. + * @return true if the objects are the same; + * false otherwise. + */ + + inline static int compareValues(const XMLDouble* const lValue + , const XMLDouble* const rValue); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLDouble) + + XMLDouble(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +protected: + + virtual void checkBoundary(char* const strValue); + +private: + // + // Unimplemented + // + // copy ctor + // assignment ctor + // + XMLDouble(const XMLDouble& toCopy); + XMLDouble& operator=(const XMLDouble& toAssign); + +}; + +inline int XMLDouble::compareValues(const XMLDouble* const lValue + , const XMLDouble* const rValue) +{ + return XMLAbstractDoubleFloat::compareValues((const XMLAbstractDoubleFloat*) lValue, + (const XMLAbstractDoubleFloat*) rValue + , ((XMLAbstractDoubleFloat*)lValue)->getMemoryManager()); +} + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.cpp b/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.cpp new file mode 100644 index 000000000..d2e7b269c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.cpp @@ -0,0 +1,205 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// +// gFromTable +// This is the translation table for IBM037 EBCDIC to Unicode. This +// table contains 255 entries. The entry for EBCDIC byte x is the +// Unicode translation of that byte. +// +// gToTable +// gToTableSz +// This is the translation table for Unicode to IBM037 EBCDIC. This one +// contains a list of records, sorted by the Unicode code point. We do +// a binary search to find the Unicode point, and that record's other +// field is the IBM037 code point to translate to. +// --------------------------------------------------------------------------- +static const XMLCh gFromTable[256] = +{ + 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F + , 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F + , 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087 + , 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F + , 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B + , 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007 + , 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004 + , 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A + , 0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5 + , 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C + , 0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF + , 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC + , 0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5 + , 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F + , 0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF + , 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022 + , 0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067 + , 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1 + , 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070 + , 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4 + , 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078 + , 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE + , 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC + , 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7 + , 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047 + , 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5 + , 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050 + , 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF + , 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058 + , 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5 + , 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037 + , 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F +}; + +static const XMLTransService::TransRec gToTable[] = +{ + { 0x0000, 0x00 }, { 0x0001, 0x01 }, { 0x0002, 0x02 }, { 0x0003, 0x03 } + , { 0x0004, 0x37 }, { 0x0005, 0x2D }, { 0x0006, 0x2E }, { 0x0007, 0x2F } + , { 0x0008, 0x16 }, { 0x0009, 0x05 }, { 0x000A, 0x25 }, { 0x000B, 0x0B } + , { 0x000C, 0x0C }, { 0x000D, 0x0D }, { 0x000E, 0x0E }, { 0x000F, 0x0F } + , { 0x0010, 0x10 }, { 0x0011, 0x11 }, { 0x0012, 0x12 }, { 0x0013, 0x13 } + , { 0x0014, 0x3C }, { 0x0015, 0x3D }, { 0x0016, 0x32 }, { 0x0017, 0x26 } + , { 0x0018, 0x18 }, { 0x0019, 0x19 }, { 0x001A, 0x3F }, { 0x001B, 0x27 } + , { 0x001C, 0x1C }, { 0x001D, 0x1D }, { 0x001E, 0x1E }, { 0x001F, 0x1F } + , { 0x0020, 0x40 }, { 0x0021, 0x5A }, { 0x0022, 0x7F }, { 0x0023, 0x7B } + , { 0x0024, 0x5B }, { 0x0025, 0x6C }, { 0x0026, 0x50 }, { 0x0027, 0x7D } + , { 0x0028, 0x4D }, { 0x0029, 0x5D }, { 0x002A, 0x5C }, { 0x002B, 0x4E } + , { 0x002C, 0x6B }, { 0x002D, 0x60 }, { 0x002E, 0x4B }, { 0x002F, 0x61 } + , { 0x0030, 0xF0 }, { 0x0031, 0xF1 }, { 0x0032, 0xF2 }, { 0x0033, 0xF3 } + , { 0x0034, 0xF4 }, { 0x0035, 0xF5 }, { 0x0036, 0xF6 }, { 0x0037, 0xF7 } + , { 0x0038, 0xF8 }, { 0x0039, 0xF9 }, { 0x003A, 0x7A }, { 0x003B, 0x5E } + , { 0x003C, 0x4C }, { 0x003D, 0x7E }, { 0x003E, 0x6E }, { 0x003F, 0x6F } + , { 0x0040, 0x7C }, { 0x0041, 0xC1 }, { 0x0042, 0xC2 }, { 0x0043, 0xC3 } + , { 0x0044, 0xC4 }, { 0x0045, 0xC5 }, { 0x0046, 0xC6 }, { 0x0047, 0xC7 } + , { 0x0048, 0xC8 }, { 0x0049, 0xC9 }, { 0x004A, 0xD1 }, { 0x004B, 0xD2 } + , { 0x004C, 0xD3 }, { 0x004D, 0xD4 }, { 0x004E, 0xD5 }, { 0x004F, 0xD6 } + , { 0x0050, 0xD7 }, { 0x0051, 0xD8 }, { 0x0052, 0xD9 }, { 0x0053, 0xE2 } + , { 0x0054, 0xE3 }, { 0x0055, 0xE4 }, { 0x0056, 0xE5 }, { 0x0057, 0xE6 } + , { 0x0058, 0xE7 }, { 0x0059, 0xE8 }, { 0x005A, 0xE9 }, { 0x005B, 0xBA } + , { 0x005C, 0xE0 }, { 0x005D, 0xBB }, { 0x005E, 0xB0 }, { 0x005F, 0x6D } + , { 0x0060, 0x79 }, { 0x0061, 0x81 }, { 0x0062, 0x82 }, { 0x0063, 0x83 } + , { 0x0064, 0x84 }, { 0x0065, 0x85 }, { 0x0066, 0x86 }, { 0x0067, 0x87 } + , { 0x0068, 0x88 }, { 0x0069, 0x89 }, { 0x006A, 0x91 }, { 0x006B, 0x92 } + , { 0x006C, 0x93 }, { 0x006D, 0x94 }, { 0x006E, 0x95 }, { 0x006F, 0x96 } + , { 0x0070, 0x97 }, { 0x0071, 0x98 }, { 0x0072, 0x99 }, { 0x0073, 0xA2 } + , { 0x0074, 0xA3 }, { 0x0075, 0xA4 }, { 0x0076, 0xA5 }, { 0x0077, 0xA6 } + , { 0x0078, 0xA7 }, { 0x0079, 0xA8 }, { 0x007A, 0xA9 }, { 0x007B, 0xC0 } + , { 0x007C, 0x4F }, { 0x007D, 0xD0 }, { 0x007E, 0xA1 }, { 0x007F, 0x07 } + , { 0x0080, 0x20 }, { 0x0081, 0x21 }, { 0x0082, 0x22 }, { 0x0083, 0x23 } + , { 0x0084, 0x24 }, { 0x0085, 0x15 }, { 0x0086, 0x06 }, { 0x0087, 0x17 } + , { 0x0088, 0x28 }, { 0x0089, 0x29 }, { 0x008A, 0x2A }, { 0x008B, 0x2B } + , { 0x008C, 0x2C }, { 0x008D, 0x09 }, { 0x008E, 0x0A }, { 0x008F, 0x1B } + , { 0x0090, 0x30 }, { 0x0091, 0x31 }, { 0x0092, 0x1A }, { 0x0093, 0x33 } + , { 0x0094, 0x34 }, { 0x0095, 0x35 }, { 0x0096, 0x36 }, { 0x0097, 0x08 } + , { 0x0098, 0x38 }, { 0x0099, 0x39 }, { 0x009A, 0x3A }, { 0x009B, 0x3B } + , { 0x009C, 0x04 }, { 0x009D, 0x14 }, { 0x009E, 0x3E }, { 0x009F, 0xFF } + , { 0x00A0, 0x41 }, { 0x00A1, 0xAA }, { 0x00A2, 0x4A }, { 0x00A3, 0xB1 } + , { 0x00A4, 0x9F }, { 0x00A5, 0xB2 }, { 0x00A6, 0x6A }, { 0x00A7, 0xB5 } + , { 0x00A8, 0xBD }, { 0x00A9, 0xB4 }, { 0x00AA, 0x9A }, { 0x00AB, 0x8A } + , { 0x00AC, 0x5F }, { 0x00AD, 0xCA }, { 0x00AE, 0xAF }, { 0x00AF, 0xBC } + , { 0x00B0, 0x90 }, { 0x00B1, 0x8F }, { 0x00B2, 0xEA }, { 0x00B3, 0xFA } + , { 0x00B4, 0xBE }, { 0x00B5, 0xA0 }, { 0x00B6, 0xB6 }, { 0x00B7, 0xB3 } + , { 0x00B8, 0x9D }, { 0x00B9, 0xDA }, { 0x00BA, 0x9B }, { 0x00BB, 0x8B } + , { 0x00BC, 0xB7 }, { 0x00BD, 0xB8 }, { 0x00BE, 0xB9 }, { 0x00BF, 0xAB } + , { 0x00C0, 0x64 }, { 0x00C1, 0x65 }, { 0x00C2, 0x62 }, { 0x00C3, 0x66 } + , { 0x00C4, 0x63 }, { 0x00C5, 0x67 }, { 0x00C6, 0x9E }, { 0x00C7, 0x68 } + , { 0x00C8, 0x74 }, { 0x00C9, 0x71 }, { 0x00CA, 0x72 }, { 0x00CB, 0x73 } + , { 0x00CC, 0x78 }, { 0x00CD, 0x75 }, { 0x00CE, 0x76 }, { 0x00CF, 0x77 } + , { 0x00D0, 0xAC }, { 0x00D1, 0x69 }, { 0x00D2, 0xED }, { 0x00D3, 0xEE } + , { 0x00D4, 0xEB }, { 0x00D5, 0xEF }, { 0x00D6, 0xEC }, { 0x00D7, 0xBF } + , { 0x00D8, 0x80 }, { 0x00D9, 0xFD }, { 0x00DA, 0xFE }, { 0x00DB, 0xFB } + , { 0x00DC, 0xFC }, { 0x00DD, 0xAD }, { 0x00DE, 0xAE }, { 0x00DF, 0x59 } + , { 0x00E0, 0x44 }, { 0x00E1, 0x45 }, { 0x00E2, 0x42 }, { 0x00E3, 0x46 } + , { 0x00E4, 0x43 }, { 0x00E5, 0x47 }, { 0x00E6, 0x9C }, { 0x00E7, 0x48 } + , { 0x00E8, 0x54 }, { 0x00E9, 0x51 }, { 0x00EA, 0x52 }, { 0x00EB, 0x53 } + , { 0x00EC, 0x58 }, { 0x00ED, 0x55 }, { 0x00EE, 0x56 }, { 0x00EF, 0x57 } + , { 0x00F0, 0x8C }, { 0x00F1, 0x49 }, { 0x00F2, 0xCD }, { 0x00F3, 0xCE } + , { 0x00F4, 0xCB }, { 0x00F5, 0xCF }, { 0x00F6, 0xCC }, { 0x00F7, 0xE1 } + , { 0x00F8, 0x70 }, { 0x00F9, 0xDD }, { 0x00FA, 0xDE }, { 0x00FB, 0xDB } + , { 0x00FC, 0xDC }, { 0x00FD, 0x8D }, { 0x00FE, 0x8E }, { 0x00FF, 0xDF } + , { 0x0110, 0xAC }, { 0x203E, 0xBC }, { 0xFF01, 0x5A }, { 0xFF02, 0x7F } + , { 0xFF03, 0x7B }, { 0xFF04, 0x5B }, { 0xFF05, 0x6C }, { 0xFF06, 0x50 } + , { 0xFF07, 0x7D }, { 0xFF08, 0x4D }, { 0xFF09, 0x5D }, { 0xFF0A, 0x5C } + , { 0xFF0B, 0x4E }, { 0xFF0C, 0x6B }, { 0xFF0D, 0x60 }, { 0xFF0E, 0x4B } + , { 0xFF0F, 0x61 }, { 0xFF10, 0xF0 }, { 0xFF11, 0xF1 }, { 0xFF12, 0xF2 } + , { 0xFF13, 0xF3 }, { 0xFF14, 0xF4 }, { 0xFF15, 0xF5 }, { 0xFF16, 0xF6 } + , { 0xFF17, 0xF7 }, { 0xFF18, 0xF8 }, { 0xFF19, 0xF9 }, { 0xFF1A, 0x7A } + , { 0xFF1B, 0x5E }, { 0xFF1C, 0x4C }, { 0xFF1D, 0x7E }, { 0xFF1E, 0x6E } + , { 0xFF1F, 0x6F }, { 0xFF20, 0x7C }, { 0xFF21, 0xC1 }, { 0xFF22, 0xC2 } + , { 0xFF23, 0xC3 }, { 0xFF24, 0xC4 }, { 0xFF25, 0xC5 }, { 0xFF26, 0xC6 } + , { 0xFF27, 0xC7 }, { 0xFF28, 0xC8 }, { 0xFF29, 0xC9 }, { 0xFF2A, 0xD1 } + , { 0xFF2B, 0xD2 }, { 0xFF2C, 0xD3 }, { 0xFF2D, 0xD4 }, { 0xFF2E, 0xD5 } + , { 0xFF2F, 0xD6 }, { 0xFF30, 0xD7 }, { 0xFF31, 0xD8 }, { 0xFF32, 0xD9 } + , { 0xFF33, 0xE2 }, { 0xFF34, 0xE3 }, { 0xFF35, 0xE4 }, { 0xFF36, 0xE5 } + , { 0xFF37, 0xE6 }, { 0xFF38, 0xE7 }, { 0xFF39, 0xE8 }, { 0xFF3A, 0xE9 } + , { 0xFF3B, 0xBA }, { 0xFF3C, 0xE0 }, { 0xFF3D, 0xBB }, { 0xFF3E, 0xB0 } + , { 0xFF3F, 0x6D }, { 0xFF40, 0x79 }, { 0xFF41, 0x81 }, { 0xFF42, 0x82 } + , { 0xFF43, 0x83 }, { 0xFF44, 0x84 }, { 0xFF45, 0x85 }, { 0xFF46, 0x86 } + , { 0xFF47, 0x87 }, { 0xFF48, 0x88 }, { 0xFF49, 0x89 }, { 0xFF4A, 0x91 } + , { 0xFF4B, 0x92 }, { 0xFF4C, 0x93 }, { 0xFF4D, 0x94 }, { 0xFF4E, 0x95 } + , { 0xFF4F, 0x96 }, { 0xFF50, 0x97 }, { 0xFF51, 0x98 }, { 0xFF52, 0x99 } + , { 0xFF53, 0xA2 }, { 0xFF54, 0xA3 }, { 0xFF55, 0xA4 }, { 0xFF56, 0xA5 } + , { 0xFF57, 0xA6 }, { 0xFF58, 0xA7 }, { 0xFF59, 0xA8 }, { 0xFF5A, 0xA9 } + , { 0xFF5B, 0xC0 }, { 0xFF5C, 0x4F }, { 0xFF5D, 0xD0 }, { 0xFF5E, 0xA1 } +}; +static const XMLSize_t gToTableSz = sizeof(gToTable)/sizeof(gToTable[0]); + + + +// --------------------------------------------------------------------------- +// XMLEBCDICTranscoder: Public, static methods +// --------------------------------------------------------------------------- +XMLCh XMLEBCDICTranscoder::xlatThisOne(const XMLByte toXlat) +{ + return gFromTable[toXlat]; +} + + +// --------------------------------------------------------------------------- +// XMLEBCDICTranscoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLEBCDICTranscoder::XMLEBCDICTranscoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + + XML256TableTranscoder + ( + encodingName + , blockSize + , gFromTable + , gToTable + , gToTableSz + , manager + ) +{ +} + + +XMLEBCDICTranscoder::~XMLEBCDICTranscoder() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.hpp b/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.hpp new file mode 100644 index 000000000..6715bdf2b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLEBCDICTranscoder.hpp @@ -0,0 +1,73 @@ +/* + * 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: XMLEBCDICTranscoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLEBCDICTRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLEBCDICTRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple EBCDIC-US transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +// EBCDIC-US is the same as IBM037, CP37, EBCDIC-CP-US, etc... +// +class XMLUTIL_EXPORT XMLEBCDICTranscoder : public XML256TableTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public, static methods + // ----------------------------------------------------------------------- + static XMLCh xlatThisOne(const XMLByte toXlat); + + + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLEBCDICTranscoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLEBCDICTranscoder(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLEBCDICTranscoder(); + XMLEBCDICTranscoder(const XMLEBCDICTranscoder&); + XMLEBCDICTranscoder& operator=(const XMLEBCDICTranscoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLEntityResolver.hpp b/project/jni/xerces/src/xercesc/util/XMLEntityResolver.hpp new file mode 100644 index 000000000..9c472c2c3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLEntityResolver.hpp @@ -0,0 +1,178 @@ +/* + * 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: XMLEntityResolver.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYRESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLENTITYRESOLVER_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class InputSource; + +/** + * Revised interface for resolving entities. + * + *

If an application needs to implement customized handling + * for external entities, it can implement this interface and + * register an instance with the parser using the parser's + * setXMLEntityResolver method or it can use the basic SAX interface + * (EntityResolver). The difference between the two interfaces is + * the arguments to the resolveEntity() method. With the SAX + * EntityResolve the arguments are systemId and publicId. With this + * interface the argument is a XMLResourceIdentifier object. Only + * one EntityResolver can be set using setEntityResolver() or + * setXMLEntityResolver, if both are set the last one set is + * used.

+ * + *

The parser will then allow the application to intercept any + * external entities (including the external DTD subset and external + * parameter entities, if any) before including them.

+ * + *

Many applications will not need to implement this interface, + * but it will be especially useful for applications that build + * XML documents from databases or other specialised input sources, + * or for applications that use URI types other than URLs.

+ * + *

The following resolver would provide the application + * with a special character stream for the entity with the system + * identifier "http://www.myhost.com/today":

+ * + * + * \#include
+ * \#include
+ *
+ * class MyResolver : public XMLEntityResolver {
+ *  public:
+ *   InputSource resolveEntity (XMLResourceIdentifier* xmlri);
+ *   ...
+ *  };
+ *
+ * MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {
+ *  switch(xmlri->getResourceIdentifierType()) {
+ *   case XMLResourceIdentifier::SystemId:
+ *    if (XMLString::compareString(xmlri->getSystemId(), "http://www.myhost.com/today")) {
+ *     MyReader* reader = new MyReader();
+ *     return new InputSource(reader);
+ *    } else {
+ *     return null;
+ *    }
+ *    break;
+ *   default:
+ *    return null;
+ *  }
+ * }
+ * + *

The application can also use this interface to redirect system + * identifiers to local URIs or to look up replacements in a catalog + * (possibly by using the public identifier).

+ * + *

The HandlerBase class implements the default behaviour for + * this interface, which is simply always to return null (to request + * that the parser use the default system identifier).

+ * + * @see XMLResourceIdentifier + * @see Parser#setXMLEntityResolver + * @see InputSource#InputSource + * @see HandlerBase#HandlerBase + */ +class XMLUTIL_EXPORT XMLEntityResolver +{ +public: + /** @name Constructors and Destructor */ + //@{ + + + /** Destructor */ + virtual ~XMLEntityResolver() + { + } + + //@} + + /** @name The XMLEntityResolver interface */ + //@{ + + /** + * Allow the application to resolve external entities. + * + *

The Parser will call this method before opening any external + * entity except the top-level document entity (including the + * external DTD subset, external entities referenced within the + * DTD, and external entities referenced within the document + * element): the application may request that the parser resolve + * the entity itself, that it use an alternative URI, or that it + * use an entirely different input source.

+ * + *

Application writers can use this method to redirect external + * system identifiers to secure and/or local URIs, to look up + * public identifiers in a catalogue, or to read an entity from a + * database or other input source (including, for example, a dialog + * box).

+ * + *

If the system identifier is a URL, the SAX parser must + * resolve it fully before reporting it to the application.

+ * + * @param resourceIdentifier An object containing the type of + * resource to be resolved and the associated data members + * corresponding to this type. + * @return An InputSource object describing the new input source, + * or null to request that the parser open a regular + * URI connection to the system identifier. + * The returned InputSource is owned by the parser which is + * responsible to clean up the memory. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception, + * possibly the result of creating a new InputStream + * or Reader for the InputSource. + * + * @see InputSource#InputSource + * @see XMLResourceIdentifier + */ + virtual InputSource* resolveEntity + ( + XMLResourceIdentifier* resourceIdentifier + ) = 0; + + //@} +protected: + /** Default Constructor */ + XMLEntityResolver() + { + } + +private : + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + XMLEntityResolver(const XMLEntityResolver&); + + /* Assignment operator */ + XMLEntityResolver& operator=(const XMLEntityResolver&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLEnumerator.hpp b/project/jni/xerces/src/xercesc/util/XMLEnumerator.hpp new file mode 100644 index 000000000..9bb6623b8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLEnumerator.hpp @@ -0,0 +1,56 @@ +/* + * 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: XMLEnumerator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLENUMERATOR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLENUMERATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +template class XMLEnumerator +{ +public : + // ----------------------------------------------------------------------- + // Destructor + // ----------------------------------------------------------------------- + virtual ~XMLEnumerator() {}; + + // ----------------------------------------------------------------------- + // XMLEnumerator interface + // ----------------------------------------------------------------------- + virtual bool hasMoreElements() const = 0; + virtual TElem& nextElement() = 0; + virtual void Reset() = 0; + + XMLEnumerator() {} + XMLEnumerator(const XMLEnumerator&) {} + +private: + // ----------------------------------------------------------------------- + // Unimplemented operators + // ----------------------------------------------------------------------- + XMLEnumerator& operator=(const XMLEnumerator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLExceptMsgs.hpp b/project/jni/xerces/src/xercesc/util/XMLExceptMsgs.hpp new file mode 100644 index 000000000..fcefba7be --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLExceptMsgs.hpp @@ -0,0 +1,398 @@ +// This file is generated, don't edit it!! + +#if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLExcepts) +#define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLExcepts + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLExcepts +{ +public : + enum Codes + { + NoError = 0 + , W_LowBounds = 1 + , Scan_CouldNotOpenSource_Warning = 2 + , W_HighBounds = 3 + , F_LowBounds = 4 + , Array_BadIndex = 5 + , Array_BadNewSize = 6 + , AttrList_BadIndex = 7 + , AttDef_BadAttType = 8 + , AttDef_BadDefAttType = 9 + , Bitset_BadIndex = 10 + , Bitset_NotEqualSize = 11 + , BufMgr_NoMoreBuffers = 12 + , BufMgr_BufferNotInPool = 13 + , CPtr_PointerIsZero = 14 + , CM_BinOpHadUnaryType = 15 + , CM_MustBeMixedOrChildren = 16 + , CM_NoPCDATAHere = 17 + , CM_UnaryOpHadBinType = 18 + , CM_UnknownCMType = 19 + , CM_UnknownCMSpecType = 20 + , CM_NoParentCSN = 21 + , CM_NotValidSpecTypeForNode = 22 + , DTD_UnknownCreateReason = 23 + , ElemStack_EmptyStack = 24 + , ElemStack_StackUnderflow = 25 + , ElemStack_NoParentPushed = 26 + , Enum_NoMoreElements = 27 + , File_CouldNotOpenFile = 28 + , File_CouldNotGetCurPos = 29 + , File_CouldNotCloseFile = 30 + , File_CouldNotSeekToEnd = 31 + , File_CouldNotSeekToPos = 32 + , File_CouldNotDupHandle = 33 + , File_CouldNotReadFromFile = 34 + , File_CouldNotWriteToFile = 35 + , File_CouldNotResetFile = 36 + , File_CouldNotGetSize = 37 + , File_CouldNotGetBasePathName = 38 + , Gen_ParseInProgress = 39 + , Gen_NoDTDValidator = 40 + , Gen_CouldNotOpenDTD = 41 + , Gen_CouldNotOpenExtEntity = 42 + , Gen_UnexpectedEOF = 43 + , HshTbl_ZeroModulus = 44 + , HshTbl_BadHashFromKey = 45 + , HshTbl_NoSuchKeyExists = 46 + , Mutex_CouldNotDestroy = 47 + , NetAcc_InternalError = 48 + , NetAcc_LengthError = 49 + , NetAcc_InitFailed = 50 + , NetAcc_TargetResolution = 51 + , NetAcc_CreateSocket = 52 + , NetAcc_ConnSocket = 53 + , NetAcc_WriteSocket = 54 + , NetAcc_ReadSocket = 55 + , NetAcc_UnsupportedMethod = 56 + , Pool_ElemAlreadyExists = 57 + , Pool_InvalidId = 58 + , Pool_ZeroModulus = 59 + , RdrMgr_ReaderIdNotFound = 60 + , Reader_BadAutoEncoding = 61 + , Reader_CouldNotDecodeFirstLine = 62 + , Reader_NelLsepinDecl = 63 + , Reader_SrcOfsNotSupported = 64 + , Reader_EncodingStrRequired = 65 + , Scan_CouldNotOpenSource = 66 + , Scan_UnbalancedStartEnd = 67 + , Scan_BadPScanToken = 68 + , Stack_BadIndex = 69 + , Stack_EmptyStack = 70 + , Str_ZeroSizedTargetBuf = 71 + , Str_UnknownRadix = 72 + , Str_TargetBufTooSmall = 73 + , Str_StartIndexPastEnd = 74 + , Str_ConvertOverflow = 75 + , StrPool_IllegalId = 76 + , Trans_Unrepresentable = 77 + , Trans_BadSrcSeq = 78 + , Trans_BadSrcCP = 79 + , Trans_BadTrailingSurrogate = 80 + , Trans_CantCreateCvtrFor = 81 + , URL_MalformedURL = 82 + , URL_UnsupportedProto = 83 + , URL_UnsupportedProto1 = 84 + , URL_NoProtocolPresent = 85 + , URL_ExpectingTwoSlashes = 86 + , URL_RelativeBaseURL = 87 + , URL_BadPortField = 88 + , UTF8_FormatError = 89 + , UTF8_Invalid_3BytesSeq = 90 + , UTF8_Irregular_3BytesSeq = 91 + , UTF8_Invalid_4BytesSeq = 92 + , UTF8_Exceeds_BytesLimit = 93 + , Vector_BadIndex = 94 + , Val_InvalidElemId = 95 + , Val_CantHaveIntSS = 96 + , XMLRec_UnknownEncoding = 97 + , Parser_Parse1 = 98 + , Parser_Parse2 = 99 + , Parser_Next1 = 100 + , Parser_Next2 = 101 + , Parser_Next3 = 102 + , Parser_Next4 = 103 + , Parser_Factor1 = 104 + , Parser_Factor2 = 105 + , Parser_Factor3 = 106 + , Parser_Factor4 = 107 + , Parser_Factor5 = 108 + , Parser_Factor6 = 109 + , Parser_Atom1 = 110 + , Parser_Atom2 = 111 + , Parser_Atom3 = 112 + , Parser_Atom4 = 113 + , Parser_Atom5 = 114 + , Parser_CC1 = 115 + , Parser_CC2 = 116 + , Parser_CC3 = 117 + , Parser_CC5 = 118 + , Parser_CC6 = 119 + , Parser_Ope1 = 120 + , Parser_Ope2 = 121 + , Parser_Ope3 = 122 + , Parser_Descape1 = 123 + , Parser_Descape3 = 124 + , Parser_Descape4 = 125 + , Parser_Descape5 = 126 + , Parser_Process2 = 127 + , Parser_Quantifier1 = 128 + , Parser_Quantifier2 = 129 + , Parser_Quantifier3 = 130 + , Parser_Quantifier4 = 131 + , Parser_Quantifier5 = 132 + , Gen_NoSchemaValidator = 133 + , SubGrpComparator_NGR = 134 + , FACET_Invalid_Len = 135 + , FACET_Invalid_maxLen = 136 + , FACET_Invalid_minLen = 137 + , FACET_NonNeg_Len = 138 + , FACET_NonNeg_maxLen = 139 + , FACET_NonNeg_minLen = 140 + , FACET_Len_maxLen = 141 + , FACET_Len_minLen = 142 + , FACET_maxLen_minLen = 143 + , FACET_Invalid_Tag = 144 + , FACET_Len_baseLen = 145 + , FACET_minLen_baseminLen = 146 + , FACET_minLen_basemaxLen = 147 + , FACET_maxLen_basemaxLen = 148 + , FACET_maxLen_baseminLen = 149 + , FACET_Len_baseMinLen = 150 + , FACET_Len_baseMaxLen = 151 + , FACET_minLen_baseLen = 152 + , FACET_maxLen_baseLen = 153 + , FACET_enum_base = 154 + , FACET_Invalid_WS = 155 + , FACET_WS_collapse = 156 + , FACET_WS_replace = 157 + , FACET_Invalid_MaxIncl = 158 + , FACET_Invalid_MaxExcl = 159 + , FACET_Invalid_MinIncl = 160 + , FACET_Invalid_MinExcl = 161 + , FACET_Invalid_TotalDigit = 162 + , FACET_Invalid_FractDigit = 163 + , FACET_PosInt_TotalDigit = 164 + , FACET_NonNeg_FractDigit = 165 + , FACET_max_Incl_Excl = 166 + , FACET_min_Incl_Excl = 167 + , FACET_maxExcl_minExcl = 168 + , FACET_maxExcl_minIncl = 169 + , FACET_maxIncl_minExcl = 170 + , FACET_maxIncl_minIncl = 171 + , FACET_TotDigit_FractDigit = 172 + , FACET_maxIncl_base_maxExcl = 173 + , FACET_maxIncl_base_maxIncl = 174 + , FACET_maxIncl_base_minIncl = 175 + , FACET_maxIncl_base_minExcl = 176 + , FACET_maxExcl_base_maxExcl = 177 + , FACET_maxExcl_base_maxIncl = 178 + , FACET_maxExcl_base_minIncl = 179 + , FACET_maxExcl_base_minExcl = 180 + , FACET_minExcl_base_maxExcl = 181 + , FACET_minExcl_base_maxIncl = 182 + , FACET_minExcl_base_minIncl = 183 + , FACET_minExcl_base_minExcl = 184 + , FACET_minIncl_base_maxExcl = 185 + , FACET_minIncl_base_maxIncl = 186 + , FACET_minIncl_base_minIncl = 187 + , FACET_minIncl_base_minExcl = 188 + , FACET_maxIncl_notFromBase = 189 + , FACET_maxExcl_notFromBase = 190 + , FACET_minIncl_notFromBase = 191 + , FACET_minExcl_notFromBase = 192 + , FACET_totalDigit_base_totalDigit = 193 + , FACET_fractDigit_base_totalDigit = 194 + , FACET_fractDigit_base_fractDigit = 195 + , FACET_maxIncl_base_fixed = 196 + , FACET_maxExcl_base_fixed = 197 + , FACET_minIncl_base_fixed = 198 + , FACET_minExcl_base_fixed = 199 + , FACET_totalDigit_base_fixed = 200 + , FACET_fractDigit_base_fixed = 201 + , FACET_maxLen_base_fixed = 202 + , FACET_minLen_base_fixed = 203 + , FACET_whitespace_base_fixed = 204 + , FACET_internalError_fixed = 205 + , FACET_List_Null_baseValidator = 206 + , FACET_Union_Null_memberTypeValidators = 207 + , FACET_Union_Null_baseValidator = 208 + , FACET_Union_invalid_baseValidatorType = 209 + , VALUE_NotMatch_Pattern = 210 + , VALUE_Not_Base64 = 211 + , VALUE_Not_HexBin = 212 + , VALUE_GT_maxLen = 213 + , VALUE_LT_minLen = 214 + , VALUE_NE_Len = 215 + , VALUE_NotIn_Enumeration = 216 + , VALUE_exceed_totalDigit = 217 + , VALUE_exceed_fractDigit = 218 + , VALUE_exceed_maxIncl = 219 + , VALUE_exceed_maxExcl = 220 + , VALUE_exceed_minIncl = 221 + , VALUE_exceed_minExcl = 222 + , VALUE_WS_replaced = 223 + , VALUE_WS_collapsed = 224 + , VALUE_Invalid_NCName = 225 + , VALUE_Invalid_Name = 226 + , VALUE_ID_Not_Unique = 227 + , VALUE_ENTITY_Invalid = 228 + , VALUE_QName_Invalid = 229 + , VALUE_NOTATION_Invalid = 230 + , VALUE_no_match_memberType = 231 + , VALUE_URI_Malformed = 232 + , XMLNUM_emptyString = 233 + , XMLNUM_WSString = 234 + , XMLNUM_2ManyDecPoint = 235 + , XMLNUM_Inv_chars = 236 + , XMLNUM_null_ptr = 237 + , XMLNUM_URI_Component_Empty = 238 + , XMLNUM_URI_Component_for_GenURI_Only = 239 + , XMLNUM_URI_Component_Invalid_EscapeSequence = 240 + , XMLNUM_URI_Component_Invalid_Char = 241 + , XMLNUM_URI_Component_Set_Null = 242 + , XMLNUM_URI_Component_Not_Conformant = 243 + , XMLNUM_URI_No_Scheme = 244 + , XMLNUM_URI_NullHost = 245 + , XMLNUM_URI_NullPath = 246 + , XMLNUM_URI_PortNo_Invalid = 247 + , XMLNUM_DBL_FLT_InvalidType = 248 + , Regex_Result_Not_Set = 249 + , Regex_CompactRangesError = 250 + , Regex_MergeRangesTypeMismatch = 251 + , Regex_SubtractRangesError = 252 + , Regex_IntersectRangesError = 253 + , Regex_ComplementRangesInvalidArg = 254 + , Regex_InvalidCategoryName = 255 + , Regex_KeywordNotFound = 256 + , Regex_BadRefNo = 257 + , Regex_UnknownOption = 258 + , Regex_UnknownTokenType = 259 + , Regex_RangeTokenGetError = 260 + , Regex_NotSupported = 261 + , Regex_InvalidChildIndex = 262 + , Regex_RepPatMatchesZeroString = 263 + , Regex_InvalidRepPattern = 264 + , NEL_RepeatedCalls = 265 + , Out_Of_Memory = 266 + , DV_InvalidOperation = 267 + , XPath_NoAttrSelector = 268 + , XPath_NoUnionAtStart = 269 + , XPath_NoMultipleUnion = 270 + , XPath_MissingAttr = 271 + , XPath_ExpectedToken1 = 272 + , XPath_PrefixNoURI = 273 + , XPath_NoDoubleColon = 274 + , XPath_ExpectedStep1 = 275 + , XPath_ExpectedStep2 = 276 + , XPath_ExpectedStep3 = 277 + , XPath_NoForwardSlash = 278 + , XPath_NoDoubleForwardSlash = 279 + , XPath_NoForwardSlashAtStart = 280 + , XPath_NoSelectionOfRoot = 281 + , XPath_EmptyExpr = 282 + , XPath_NoUnionAtEnd = 283 + , XPath_InvalidChar = 284 + , XPath_TokenNotSupported = 285 + , XPath_FindSolution = 286 + , DateTime_dt_invalid = 287 + , DateTime_dt_missingT = 288 + , DateTime_gDay_invalid = 289 + , DateTime_gMth_invalid = 290 + , DateTime_gMthDay_invalid = 291 + , DateTime_dur_invalid = 292 + , DateTime_dur_Start_dashP = 293 + , DateTime_dur_noP = 294 + , DateTime_dur_DashNotFirst = 295 + , DateTime_dur_inv_b4T = 296 + , DateTime_dur_NoTimeAfterT = 297 + , DateTime_dur_NoElementAtAll = 298 + , DateTime_dur_inv_seconds = 299 + , DateTime_date_incomplete = 300 + , DateTime_date_invalid = 301 + , DateTime_time_incomplete = 302 + , DateTime_time_invalid = 303 + , DateTime_ms_noDigit = 304 + , DateTime_ym_incomplete = 305 + , DateTime_ym_invalid = 306 + , DateTime_year_invalid = 307 + , DateTime_year_tooShort = 308 + , DateTime_year_leadingZero = 309 + , DateTime_ym_noMonth = 310 + , DateTime_tz_noUTCsign = 311 + , DateTime_tz_stuffAfterZ = 312 + , DateTime_tz_invalid = 313 + , DateTime_year_zero = 314 + , DateTime_mth_invalid = 315 + , DateTime_day_invalid = 316 + , DateTime_hour_invalid = 317 + , DateTime_min_invalid = 318 + , DateTime_second_invalid = 319 + , DateTime_tz_hh_invalid = 320 + , PD_EmptyBase = 321 + , PD_NSCompat1 = 322 + , PD_OccurRangeE = 323 + , PD_NameTypeOK1 = 324 + , PD_NameTypeOK2 = 325 + , PD_NameTypeOK3 = 326 + , PD_NameTypeOK4 = 327 + , PD_NameTypeOK5 = 328 + , PD_NameTypeOK6 = 329 + , PD_NameTypeOK7 = 330 + , PD_Recurse1 = 331 + , PD_Recurse2 = 332 + , PD_ForbiddenRes1 = 333 + , PD_ForbiddenRes2 = 334 + , PD_ForbiddenRes3 = 335 + , PD_ForbiddenRes4 = 336 + , PD_NSSubset1 = 337 + , PD_NSSubset2 = 338 + , PD_NSRecurseCheckCardinality1 = 339 + , PD_RecurseUnordered = 340 + , PD_MapAndSum = 341 + , PD_InvalidContentType = 342 + , NodeIDMap_GrowErr = 343 + , XSer_ProtoType_Null_ClassName = 344 + , XSer_ProtoType_NameLen_Dif = 345 + , XSer_ProtoType_Name_Dif = 346 + , XSer_InStream_Read_LT_Req = 347 + , XSer_InStream_Read_OverFlow = 348 + , XSer_Storing_Violation = 349 + , XSer_StoreBuffer_Violation = 350 + , XSer_LoadPool_UppBnd_Exceed = 351 + , XSer_LoadPool_NoTally_ObjCnt = 352 + , XSer_Loading_Violation = 353 + , XSer_LoadBuffer_Violation = 354 + , XSer_Inv_ClassIndex = 355 + , XSer_Inv_checkFillBuffer_Size = 356 + , XSer_Inv_checkFlushBuffer_Size = 357 + , XSer_Inv_Null_Pointer = 358 + , XSer_CreateObject_Fail = 359 + , XSer_ObjCount_UppBnd_Exceed = 360 + , XSer_GrammarPool_Empty = 361 + , XSer_GrammarPool_NotEmpty = 362 + , XSer_StringPool_NotEmpty = 363 + , XSer_Storer_Loader_Mismatch = 364 + , VALUE_QName_Invalid2 = 365 + , F_HighBounds = 366 + , E_LowBounds = 367 + , E_HighBounds = 368 + }; + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLExcepts(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/XMLException.cpp b/project/jni/xerces/src/xercesc/util/XMLException.cpp new file mode 100644 index 000000000..7038e2d65 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLException.cpp @@ -0,0 +1,255 @@ +/* + * 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: XMLException.cpp 673960 2008-07-04 08:50:12Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +static XMLMsgLoader* sMsgLoader = 0; + +void XMLInitializer::initializeXMLException() +{ + sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgExceptDomain); + + if (!sMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); +} + +void XMLInitializer::terminateXMLException() +{ + delete sMsgLoader; + sMsgLoader = 0; +} + +// +// +static XMLMsgLoader& gGetMsgLoader() +{ + return *sMsgLoader; +} + +// --------------------------------------------------------------------------- +// XMLException: Virtual destructor +// --------------------------------------------------------------------------- +XMLException::~XMLException() +{ + fMemoryManager->deallocate(fMsg); + fMemoryManager->deallocate(fSrcFile); +} + + +// --------------------------------------------------------------------------- +// XMLException: Setter methods +// --------------------------------------------------------------------------- +void XMLException::setPosition(const char* const file, const XMLFileLoc line) +{ + fSrcLine = line; + fMemoryManager->deallocate(fSrcFile); + fSrcFile = XMLString::replicate(file, fMemoryManager); +} + + +// --------------------------------------------------------------------------- +// XMLException: Hidden constructors and operators +// --------------------------------------------------------------------------- +XMLException::XMLException() : + + fCode(XMLExcepts::NoError) + , fSrcFile(0) + , fSrcLine(0) + , fMsg(0) + , fMemoryManager( + XMLPlatformUtils::fgMemoryManager->getExceptionMemoryManager()) +{ +} + + +XMLException::XMLException( const char* const srcFile + , const XMLFileLoc srcLine + , MemoryManager* const memoryManager) : + + fCode(XMLExcepts::NoError) + , fSrcFile(0) + , fSrcLine(srcLine) + , fMsg(0) + , fMemoryManager(0) +{ + if (!memoryManager) + fMemoryManager = + XMLPlatformUtils::fgMemoryManager->getExceptionMemoryManager(); + else + fMemoryManager = memoryManager->getExceptionMemoryManager(); + + fSrcFile = XMLString::replicate(srcFile, fMemoryManager); +} + + +XMLException::XMLException(const XMLException& toCopy) : + XMemory(toCopy) + , fCode(toCopy.fCode) + , fSrcFile(0) + , fSrcLine(toCopy.fSrcLine) + , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager)) + , fMemoryManager(toCopy.fMemoryManager) +{ + if (toCopy.fSrcFile) { + fSrcFile = XMLString::replicate + ( + toCopy.fSrcFile + , fMemoryManager + ); + } +} + + +XMLException& XMLException::operator=(const XMLException& toAssign) +{ + if (this != &toAssign) + { + //use the original memory manager to deallocate + fMemoryManager->deallocate(fSrcFile); + fSrcFile = 0; + fMemoryManager->deallocate(fMsg); + fMsg = 0; + + fMemoryManager = toAssign.fMemoryManager; + fSrcLine = toAssign.fSrcLine; + fCode = toAssign.fCode; + + if (toAssign.fMsg) { + fMsg = XMLString::replicate + ( + toAssign.fMsg + , fMemoryManager + ); + } + + if (toAssign.fSrcFile) { + fSrcFile = XMLString::replicate + ( + toAssign.fSrcFile + , fMemoryManager + ); + } + } + return *this; +} + + + +// --------------------------------------------------------------------------- +// XMLException: Protected methods +// --------------------------------------------------------------------------- +void XMLException::loadExceptText(const XMLExcepts::Codes toLoad) +{ + // Store the error code + fCode = toLoad; + + // Load up the text into a local buffer + const XMLSize_t msgSize = 2047; + XMLCh errText[msgSize + 1]; + + // load the text + if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize)) + { + fMsg = XMLString::replicate + ( + XMLUni::fgDefErrMsg + , fMemoryManager + ); + return; + } + + // We got the text so replicate it into the message member + fMsg = XMLString::replicate(errText, fMemoryManager); +} + + +void +XMLException::loadExceptText(const XMLExcepts::Codes toLoad + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4) +{ + // Store the error code + fCode = toLoad; + + // Load up the text into a local buffer + const XMLSize_t msgSize = 4095; + XMLCh errText[msgSize + 1]; + + // load the text + if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4, fMemoryManager)) + { + fMsg = XMLString::replicate + ( + XMLUni::fgDefErrMsg + , fMemoryManager + ); + return; + } + + // We got the text so replicate it into the message member + fMsg = XMLString::replicate(errText, fMemoryManager); +} + + +void +XMLException::loadExceptText(const XMLExcepts::Codes toLoad + , const char* const text1 + , const char* const text2 + , const char* const text3 + , const char* const text4) +{ + // Store the error code + fCode = toLoad; + + // Load up the text into a local buffer + const XMLSize_t msgSize = 4095; + XMLCh errText[msgSize + 1]; + + // load the text + if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4, fMemoryManager)) + { + fMsg = XMLString::replicate + ( + XMLUni::fgDefErrMsg + , fMemoryManager + ); + return; + } + + // We got the text so replicate it into the message member + fMsg = XMLString::replicate(errText, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLException.hpp b/project/jni/xerces/src/xercesc/util/XMLException.hpp new file mode 100644 index 000000000..fc3d71c88 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLException.hpp @@ -0,0 +1,276 @@ +/* + * 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: XMLException.hpp 673960 2008-07-04 08:50:12Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XMLEXCEPTION_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// This is the base class from which all the XML parser exceptions are +// derived. The virtual interface is very simple and most of the functionality +// is in this class. +// +// Because all derivatives are EXACTLY the same except for the static +// string that is used to hold the name of the class, a macro is provided +// below via which they are all created. +// --------------------------------------------------------------------------- +class XMLUTIL_EXPORT XMLException : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Virtual Destructor + // ----------------------------------------------------------------------- + virtual ~XMLException(); + + + // ----------------------------------------------------------------------- + // The XML exception virtual interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getType() const = 0; + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLExcepts::Codes getCode() const; + const XMLCh* getMessage() const; + const char* getSrcFile() const; + XMLFileLoc getSrcLine() const; + XMLErrorReporter::ErrTypes getErrorType() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setPosition(const char* const file, const XMLFileLoc line); + + + // ----------------------------------------------------------------------- + // Hidden constructors and operators + // + // NOTE: Technically, these should be protected, since this is a + // base class that is never used directly. However, VC++ 6.0 will + // fail to catch via a reference to base class if the ctors are + // not public!! This seems to have been caused by the install + // of IE 5.0. + // ----------------------------------------------------------------------- + XMLException(); + XMLException(const char* const srcFile, const XMLFileLoc srcLine, MemoryManager* const memoryManager = 0); + XMLException(const XMLException& toCopy); + XMLException& operator=(const XMLException& toAssign); + +protected : + // ----------------------------------------------------------------------- + // Protected methods + // ----------------------------------------------------------------------- + void loadExceptText + ( + const XMLExcepts::Codes toLoad + ); + void loadExceptText + ( + const XMLExcepts::Codes toLoad + , const XMLCh* const text1 + , const XMLCh* const text2 = 0 + , const XMLCh* const text3 = 0 + , const XMLCh* const text4 = 0 + ); + void loadExceptText + ( + const XMLExcepts::Codes toLoad + , const char* const text1 + , const char* const text2 = 0 + , const char* const text3 = 0 + , const char* const text4 = 0 + ); + + +private : + // ----------------------------------------------------------------------- + // Data members + // + // fCode + // The error code that this exception represents. + // + // fSrcFile + // fSrcLine + // These are the file and line information from the source where the + // exception was thrown from. + // + // fMsg + // The loaded message text for this exception. + // ----------------------------------------------------------------------- + XMLExcepts::Codes fCode; + char* fSrcFile; + XMLFileLoc fSrcLine; + XMLCh* fMsg; + +protected: + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XMLException: Getter methods +// --------------------------------------------------------------------------- +inline XMLExcepts::Codes XMLException::getCode() const +{ + return fCode; +} + +inline const XMLCh* XMLException::getMessage() const +{ + return fMsg; +} + +inline const char* XMLException::getSrcFile() const +{ + if (!fSrcFile) + return ""; + return fSrcFile; +} + +inline XMLFileLoc XMLException::getSrcLine() const +{ + return fSrcLine; +} + +inline XMLErrorReporter::ErrTypes XMLException::getErrorType() const +{ + if ((fCode >= XMLExcepts::W_LowBounds) && (fCode <= XMLExcepts::W_HighBounds)) + return XMLErrorReporter::ErrType_Warning; + else if ((fCode >= XMLExcepts::F_LowBounds) && (fCode <= XMLExcepts::F_HighBounds)) + return XMLErrorReporter::ErrType_Fatal; + else if ((fCode >= XMLExcepts::E_LowBounds) && (fCode <= XMLExcepts::E_HighBounds)) + return XMLErrorReporter::ErrType_Error; + return XMLErrorReporter::ErrTypes_Unknown; +} + +// --------------------------------------------------------------------------- +// This macro is used to create derived classes. They are all identical +// except the name of the exception, so it crazy to type them in over and +// over. +// --------------------------------------------------------------------------- +#define MakeXMLException(theType, expKeyword) \ +class expKeyword theType : public XMLException \ +{ \ +public: \ + \ + theType(const char* const srcFile \ + , const XMLFileLoc srcLine \ + , const XMLExcepts::Codes toThrow \ + , MemoryManager* memoryManager = 0) : \ + XMLException(srcFile, srcLine, memoryManager) \ + { \ + loadExceptText(toThrow); \ + } \ + \ + theType(const theType& toCopy) : \ + \ + XMLException(toCopy) \ + { \ + } \ + \ + theType(const char* const srcFile \ + , const XMLFileLoc srcLine \ + , const XMLExcepts::Codes toThrow \ + , const XMLCh* const text1 \ + , const XMLCh* const text2 = 0 \ + , const XMLCh* const text3 = 0 \ + , const XMLCh* const text4 = 0 \ + , MemoryManager* memoryManager = 0) : \ + XMLException(srcFile, srcLine, memoryManager) \ + { \ + loadExceptText(toThrow, text1, text2, text3, text4); \ + } \ + \ + theType(const char* const srcFile \ + , const XMLFileLoc srcLine \ + , const XMLExcepts::Codes toThrow \ + , const char* const text1 \ + , const char* const text2 = 0 \ + , const char* const text3 = 0 \ + , const char* const text4 = 0 \ + , MemoryManager* memoryManager = 0) : \ + XMLException(srcFile, srcLine, memoryManager) \ + { \ + loadExceptText(toThrow, text1, text2, text3, text4); \ + } \ + \ + virtual ~theType() {} \ + \ + theType& operator=(const theType& toAssign) \ + { \ + XMLException::operator=(toAssign); \ + return *this; \ + } \ + \ + virtual XMLException* duplicate() const \ + { \ + return new (fMemoryManager) theType(*this); \ + } \ + \ + virtual const XMLCh* getType() const \ + { \ + return XMLUni::fg##theType##_Name; \ + } \ + \ +private : \ + theType(); \ +}; + + + +// --------------------------------------------------------------------------- +// This macros is used to actually throw an exception. It is used in order +// to make sure that source code line/col info is stored correctly, and to +// give flexibility for other stuff in the future. +// --------------------------------------------------------------------------- + +#define ThrowXML(type,code) throw type(__FILE__, __LINE__, code) + +#define ThrowXML1(type,code,p1) throw type(__FILE__, __LINE__, code, p1) + +#define ThrowXML2(type,code,p1,p2) throw type(__FILE__, __LINE__, code, p1, p2) + +#define ThrowXML3(type,code,p1,p2,p3) throw type(__FILE__, __LINE__, code, p1, p2, p3) + +#define ThrowXML4(type,code,p1,p2,p3,p4) throw type(__FILE__, __LINE__, code, p1, p2, p3, p4) + +#define ThrowXMLwithMemMgr(type,code,memMgr) throw type(__FILE__, __LINE__, code, memMgr) + +#define ThrowXMLwithMemMgr1(type,code,p1,memMgr) throw type(__FILE__, __LINE__, code, p1, 0, 0, 0, memMgr) + +#define ThrowXMLwithMemMgr2(type,code,p1,p2,memMgr) throw type(__FILE__, __LINE__, code, p1, p2, 0, 0, memMgr) + +#define ThrowXMLwithMemMgr3(type,code,p1,p2,p3,memMgr) throw type(__FILE__, __LINE__, code, p1, p2, p3, 0, memMgr) + +#define ThrowXMLwithMemMgr4(type,code,p1,p2,p3,p4,memMgr) throw type(__FILE__, __LINE__, code, p1, p2, p3, p4, memMgr) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLFileMgr.hpp b/project/jni/xerces/src/xercesc/util/XMLFileMgr.hpp new file mode 100644 index 000000000..900cf5909 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLFileMgr.hpp @@ -0,0 +1,63 @@ +/* + * 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: XMLFileMgr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLFILEMGR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLFILEMGR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef void* FileHandle; +#define XERCES_Invalid_File_Handle 0 + +// Abstract class for files. This is be used to allow multiple file handling implementations. +class XMLFileMgr : public XMemory +{ + public: + XMLFileMgr() {} + virtual ~XMLFileMgr() {} + + // File access + virtual FileHandle fileOpen(const XMLCh* path, bool toWrite, MemoryManager* const manager) = 0; + virtual FileHandle fileOpen(const char* path, bool toWrite, MemoryManager* const manager) = 0; + virtual FileHandle openStdIn(MemoryManager* const manager) = 0; + + virtual void fileClose(FileHandle f, MemoryManager* const manager) = 0; + virtual void fileReset(FileHandle f, MemoryManager* const manager) = 0; + + virtual XMLFilePos curPos(FileHandle f, MemoryManager* const manager) = 0; + virtual XMLFilePos fileSize(FileHandle f, MemoryManager* const manager) = 0; + + virtual XMLSize_t fileRead(FileHandle f, XMLSize_t byteCount, XMLByte* buffer, MemoryManager* const manager) = 0; + virtual void fileWrite(FileHandle f, XMLSize_t byteCount, const XMLByte* buffer, MemoryManager* const manager) = 0; + + // Ancillary path handling routines + virtual XMLCh* getFullPath(const XMLCh* const srcPath, MemoryManager* const manager) = 0; + virtual XMLCh* getCurrentDirectory(MemoryManager* const manager) = 0; + virtual bool isRelative(const XMLCh* const toCheck, MemoryManager* const manager) = 0; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/XMLFloat.cpp b/project/jni/xerces/src/xercesc/util/XMLFloat.cpp new file mode 100644 index 000000000..23fe64690 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLFloat.cpp @@ -0,0 +1,100 @@ +/* + * 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: XMLFloat.cpp 803857 2009-08-13 12:16:44Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ctor/dtor +// --------------------------------------------------------------------------- +XMLFloat::XMLFloat(const XMLCh* const strValue, + MemoryManager* const manager) +:XMLAbstractDoubleFloat(manager) +{ + init(strValue); +} + +XMLFloat::~XMLFloat() +{ +} + +void XMLFloat::checkBoundary(char* const strValue) +{ + convert(strValue); + + if (fDataConverted == false) + { + /** + * float related checking + */ + + // 3.2.4 The basic value space of float consists of the values m × 2^e, where + // m is an integer whose absolute value is less than 2^24, + // and e is an integer between -149 and 104, inclusive + static const double fltMin = pow(2.0,-149); + static const double fltMax = pow(2.0,24) * pow(2.0,104); + if (fValue < (-1) * fltMax) + { + fType = NegINF; + fDataConverted = true; + fDataOverflowed = true; + } + else if (fValue > (-1)*fltMin && fValue < 0) + { + fDataConverted = true; + fValue = 0; + } + else if (fValue > 0 && fValue < fltMin ) + { + fDataConverted = true; + fValue = 0; + } + else if (fValue > fltMax) + { + fType = PosINF; + fDataConverted = true; + fDataOverflowed = true; + } + } +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLFloat) + +XMLFloat::XMLFloat(MemoryManager* const manager) +:XMLAbstractDoubleFloat(manager) +{ +} + +void XMLFloat::serialize(XSerializeEngine& serEng) +{ + XMLAbstractDoubleFloat::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLFloat.hpp b/project/jni/xerces/src/xercesc/util/XMLFloat.hpp new file mode 100644 index 000000000..94411dca1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLFloat.hpp @@ -0,0 +1,97 @@ +/* + * 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: XMLFloat.hpp 673155 2008-07-01 17:55:39Z dbertoni $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_FLOAT_HPP) +#define XERCESC_INCLUDE_GUARD_XML_FLOAT_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLFloat : public XMLAbstractDoubleFloat +{ +public: + + /** + * Constructs a newly allocated XMLFloat object that + * represents the value represented by the string. + * + * @param strValue the String to be converted to an + * XMLFloat. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * @exception NumberFormatException if the String does not + * contain a parsable XMLFloat. + */ + + XMLFloat(const XMLCh* const strValue, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + ~XMLFloat(); + + /** + * Compares the two specified XMLFloat objects. + * The result is true if and only if the argument is not + * null and that contains the same int value. + * + * @param lValue the object to compare with. + * @param rValue the object to compare against. + * @return true if the objects are the same; + * false otherwise. + */ + + inline static int compareValues(const XMLFloat* const lValue + , const XMLFloat* const rValue); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLFloat) + + XMLFloat(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +protected: + + virtual void checkBoundary(char* const strValue); + +private: + // + // Unimplemented + // + // copy ctor + // assignment ctor + // + XMLFloat(const XMLFloat& toCopy); + XMLFloat& operator=(const XMLFloat& toAssign); + +}; + +inline int XMLFloat::compareValues(const XMLFloat* const lValue + , const XMLFloat* const rValue) +{ + return XMLAbstractDoubleFloat::compareValues((const XMLAbstractDoubleFloat*) lValue, + (const XMLAbstractDoubleFloat*) rValue + , ((XMLAbstractDoubleFloat*)lValue)->getMemoryManager()); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.cpp new file mode 100644 index 000000000..dc5d6dd86 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.cpp @@ -0,0 +1,205 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// +// gFromTable +// This is the translation table for IBM1047 to Unicode. This +// table contains 255 entries. The entry for 1047 byte x is the +// Unicode translation of that byte. +// +// gToTable +// gToTableSz +// This is the translation table for Unicode to IBM1047. This one +// contains a list of records, sorted by the Unicode code point. We do +// a binary search to find the Unicode point, and that record's other +// field is the IBM1047 code point to translate to. +// --------------------------------------------------------------------------- +static const XMLCh gFromTable[256] = +{ + 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F + , 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F + , 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x000A, 0x0008, 0x0087 + , 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F + , 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B + , 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007 + , 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004 + , 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A + , 0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5 + , 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C + , 0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF + , 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x005E + , 0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5 + , 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F + , 0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF + , 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022 + , 0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067 + , 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1 + , 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070 + , 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4 + , 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078 + , 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x005B, 0x00DE, 0x00AE + , 0x00AC, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC + , 0x00BD, 0x00BE, 0x00DD, 0x00A8, 0x00AF, 0x005D, 0x00B4, 0x00D7 + , 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047 + , 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5 + , 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050 + , 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF + , 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058 + , 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5 + , 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037 + , 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F +}; + +static const XMLTransService::TransRec gToTable[] = +{ + { 0x0000, 0x00 }, { 0x0001, 0x01 }, { 0x0002, 0x02 }, { 0x0003, 0x03 } + , { 0x0004, 0x37 }, { 0x0005, 0x2D }, { 0x0006, 0x2E }, { 0x0007, 0x2F } + , { 0x0008, 0x16 }, { 0x0009, 0x05 }, { 0x000A, 0x25 }, { 0x000B, 0x0B } + , { 0x000C, 0x0C }, { 0x000D, 0x0D }, { 0x000E, 0x0E }, { 0x000F, 0x0F } + , { 0x0010, 0x10 }, { 0x0011, 0x11 }, { 0x0012, 0x12 }, { 0x0013, 0x13 } + , { 0x0014, 0x3C }, { 0x0015, 0x3D }, { 0x0016, 0x32 }, { 0x0017, 0x26 } + , { 0x0018, 0x18 }, { 0x0019, 0x19 }, { 0x001A, 0x3F }, { 0x001B, 0x27 } + , { 0x001C, 0x1C }, { 0x001D, 0x1D }, { 0x001E, 0x1E }, { 0x001F, 0x1F } + , { 0x0020, 0x40 }, { 0x0021, 0x5A }, { 0x0022, 0x7F }, { 0x0023, 0x7B } + , { 0x0024, 0x5B }, { 0x0025, 0x6C }, { 0x0026, 0x50 }, { 0x0027, 0x7D } + , { 0x0028, 0x4D }, { 0x0029, 0x5D }, { 0x002A, 0x5C }, { 0x002B, 0x4E } + , { 0x002C, 0x6B }, { 0x002D, 0x60 }, { 0x002E, 0x4B }, { 0x002F, 0x61 } + , { 0x0030, 0xF0 }, { 0x0031, 0xF1 }, { 0x0032, 0xF2 }, { 0x0033, 0xF3 } + , { 0x0034, 0xF4 }, { 0x0035, 0xF5 }, { 0x0036, 0xF6 }, { 0x0037, 0xF7 } + , { 0x0038, 0xF8 }, { 0x0039, 0xF9 }, { 0x003A, 0x7A }, { 0x003B, 0x5E } + , { 0x003C, 0x4C }, { 0x003D, 0x7E }, { 0x003E, 0x6E }, { 0x003F, 0x6F } + , { 0x0040, 0x7C }, { 0x0041, 0xC1 }, { 0x0042, 0xC2 }, { 0x0043, 0xC3 } + , { 0x0044, 0xC4 }, { 0x0045, 0xC5 }, { 0x0046, 0xC6 }, { 0x0047, 0xC7 } + , { 0x0048, 0xC8 }, { 0x0049, 0xC9 }, { 0x004A, 0xD1 }, { 0x004B, 0xD2 } + , { 0x004C, 0xD3 }, { 0x004D, 0xD4 }, { 0x004E, 0xD5 }, { 0x004F, 0xD6 } + , { 0x0050, 0xD7 }, { 0x0051, 0xD8 }, { 0x0052, 0xD9 }, { 0x0053, 0xE2 } + , { 0x0054, 0xE3 }, { 0x0055, 0xE4 }, { 0x0056, 0xE5 }, { 0x0057, 0xE6 } + , { 0x0058, 0xE7 }, { 0x0059, 0xE8 }, { 0x005A, 0xE9 }, { 0x005B, 0xAD } + , { 0x005C, 0xE0 }, { 0x005D, 0xBD }, { 0x005E, 0x5F }, { 0x005F, 0x6D } + , { 0x0060, 0x79 }, { 0x0061, 0x81 }, { 0x0062, 0x82 }, { 0x0063, 0x83 } + , { 0x0064, 0x84 }, { 0x0065, 0x85 }, { 0x0066, 0x86 }, { 0x0067, 0x87 } + , { 0x0068, 0x88 }, { 0x0069, 0x89 }, { 0x006A, 0x91 }, { 0x006B, 0x92 } + , { 0x006C, 0x93 }, { 0x006D, 0x94 }, { 0x006E, 0x95 }, { 0x006F, 0x96 } + , { 0x0070, 0x97 }, { 0x0071, 0x98 }, { 0x0072, 0x99 }, { 0x0073, 0xA2 } + , { 0x0074, 0xA3 }, { 0x0075, 0xA4 }, { 0x0076, 0xA5 }, { 0x0077, 0xA6 } + , { 0x0078, 0xA7 }, { 0x0079, 0xA8 }, { 0x007A, 0xA9 }, { 0x007B, 0xC0 } + , { 0x007C, 0x4F }, { 0x007D, 0xD0 }, { 0x007E, 0xA1 }, { 0x007F, 0x07 } + , { 0x0080, 0x20 }, { 0x0081, 0x21 }, { 0x0082, 0x22 }, { 0x0083, 0x23 } + , { 0x0084, 0x24 }, { 0x0085, 0x15 }, { 0x0086, 0x06 }, { 0x0087, 0x17 } + , { 0x0088, 0x28 }, { 0x0089, 0x29 }, { 0x008A, 0x2A }, { 0x008B, 0x2B } + , { 0x008C, 0x2C }, { 0x008D, 0x09 }, { 0x008E, 0x0A }, { 0x008F, 0x1B } + , { 0x0090, 0x30 }, { 0x0091, 0x31 }, { 0x0092, 0x1A }, { 0x0093, 0x33 } + , { 0x0094, 0x34 }, { 0x0095, 0x35 }, { 0x0096, 0x36 }, { 0x0097, 0x08 } + , { 0x0098, 0x38 }, { 0x0099, 0x39 }, { 0x009A, 0x3A }, { 0x009B, 0x3B } + , { 0x009C, 0x04 }, { 0x009D, 0x14 }, { 0x009E, 0x3E }, { 0x009F, 0xFF } + , { 0x00A0, 0x41 }, { 0x00A1, 0xAA }, { 0x00A2, 0x4A }, { 0x00A3, 0xB1 } + , { 0x00A4, 0x9F }, { 0x00A5, 0xB2 }, { 0x00A6, 0x6A }, { 0x00A7, 0xB5 } + , { 0x00A8, 0xBB }, { 0x00A9, 0xB4 }, { 0x00AA, 0x9A }, { 0x00AB, 0x8A } + , { 0x00AC, 0xB0 }, { 0x00AD, 0xCA }, { 0x00AE, 0xAF }, { 0x00AF, 0xBC } + , { 0x00B0, 0x90 }, { 0x00B1, 0x8F }, { 0x00B2, 0xEA }, { 0x00B3, 0xFA } + , { 0x00B4, 0xBE }, { 0x00B5, 0xA0 }, { 0x00B6, 0xB6 }, { 0x00B7, 0xB3 } + , { 0x00B8, 0x9D }, { 0x00B9, 0xDA }, { 0x00BA, 0x9B }, { 0x00BB, 0x8B } + , { 0x00BC, 0xB7 }, { 0x00BD, 0xB8 }, { 0x00BE, 0xB9 }, { 0x00BF, 0xAB } + , { 0x00C0, 0x64 }, { 0x00C1, 0x65 }, { 0x00C2, 0x62 }, { 0x00C3, 0x66 } + , { 0x00C4, 0x63 }, { 0x00C5, 0x67 }, { 0x00C6, 0x9E }, { 0x00C7, 0x68 } + , { 0x00C8, 0x74 }, { 0x00C9, 0x71 }, { 0x00CA, 0x72 }, { 0x00CB, 0x73 } + , { 0x00CC, 0x78 }, { 0x00CD, 0x75 }, { 0x00CE, 0x76 }, { 0x00CF, 0x77 } + , { 0x00D0, 0xAC }, { 0x00D1, 0x69 }, { 0x00D2, 0xED }, { 0x00D3, 0xEE } + , { 0x00D4, 0xEB }, { 0x00D5, 0xEF }, { 0x00D6, 0xEC }, { 0x00D7, 0xBF } + , { 0x00D8, 0x80 }, { 0x00D9, 0xFD }, { 0x00DA, 0xFE }, { 0x00DB, 0xFB } + , { 0x00DC, 0xFC }, { 0x00DD, 0xBA }, { 0x00DE, 0xAE }, { 0x00DF, 0x59 } + , { 0x00E0, 0x44 }, { 0x00E1, 0x45 }, { 0x00E2, 0x42 }, { 0x00E3, 0x46 } + , { 0x00E4, 0x43 }, { 0x00E5, 0x47 }, { 0x00E6, 0x9C }, { 0x00E7, 0x48 } + , { 0x00E8, 0x54 }, { 0x00E9, 0x51 }, { 0x00EA, 0x52 }, { 0x00EB, 0x53 } + , { 0x00EC, 0x58 }, { 0x00ED, 0x55 }, { 0x00EE, 0x56 }, { 0x00EF, 0x57 } + , { 0x00F0, 0x8C }, { 0x00F1, 0x49 }, { 0x00F2, 0xCD }, { 0x00F3, 0xCE } + , { 0x00F4, 0xCB }, { 0x00F5, 0xCF }, { 0x00F6, 0xCC }, { 0x00F7, 0xE1 } + , { 0x00F8, 0x70 }, { 0x00F9, 0xDD }, { 0x00FA, 0xDE }, { 0x00FB, 0xDB } + , { 0x00FC, 0xDC }, { 0x00FD, 0x8D }, { 0x00FE, 0x8E }, { 0x00FF, 0xDF } + , { 0x0110, 0xAC }, { 0x203E, 0xBC }, { 0xFF01, 0x5A }, { 0xFF02, 0x7F } + , { 0xFF03, 0x7B }, { 0xFF04, 0x5B }, { 0xFF05, 0x6C }, { 0xFF06, 0x50 } + , { 0xFF07, 0x7D }, { 0xFF08, 0x4D }, { 0xFF09, 0x5D }, { 0xFF0A, 0x5C } + , { 0xFF0B, 0x4E }, { 0xFF0C, 0x6B }, { 0xFF0D, 0x60 }, { 0xFF0E, 0x4B } + , { 0xFF0F, 0x61 }, { 0xFF10, 0xF0 }, { 0xFF11, 0xF1 }, { 0xFF12, 0xF2 } + , { 0xFF13, 0xF3 }, { 0xFF14, 0xF4 }, { 0xFF15, 0xF5 }, { 0xFF16, 0xF6 } + , { 0xFF17, 0xF7 }, { 0xFF18, 0xF8 }, { 0xFF19, 0xF9 }, { 0xFF1A, 0x7A } + , { 0xFF1B, 0x5E }, { 0xFF1C, 0x4C }, { 0xFF1D, 0x7E }, { 0xFF1E, 0x6E } + , { 0xFF1F, 0x6F }, { 0xFF20, 0x7C }, { 0xFF21, 0xC1 }, { 0xFF22, 0xC2 } + , { 0xFF23, 0xC3 }, { 0xFF24, 0xC4 }, { 0xFF25, 0xC5 }, { 0xFF26, 0xC6 } + , { 0xFF27, 0xC7 }, { 0xFF28, 0xC8 }, { 0xFF29, 0xC9 }, { 0xFF2A, 0xD1 } + , { 0xFF2B, 0xD2 }, { 0xFF2C, 0xD3 }, { 0xFF2D, 0xD4 }, { 0xFF2E, 0xD5 } + , { 0xFF2F, 0xD6 }, { 0xFF30, 0xD7 }, { 0xFF31, 0xD8 }, { 0xFF32, 0xD9 } + , { 0xFF33, 0xE2 }, { 0xFF34, 0xE3 }, { 0xFF35, 0xE4 }, { 0xFF36, 0xE5 } + , { 0xFF37, 0xE6 }, { 0xFF38, 0xE7 }, { 0xFF39, 0xE8 }, { 0xFF3A, 0xE9 } + , { 0xFF3B, 0xAD }, { 0xFF3C, 0xE0 }, { 0xFF3D, 0xBD }, { 0xFF3E, 0x5F } + , { 0xFF3F, 0x6D }, { 0xFF40, 0x79 }, { 0xFF41, 0x81 }, { 0xFF42, 0x82 } + , { 0xFF43, 0x83 }, { 0xFF44, 0x84 }, { 0xFF45, 0x85 }, { 0xFF46, 0x86 } + , { 0xFF47, 0x87 }, { 0xFF48, 0x88 }, { 0xFF49, 0x89 }, { 0xFF4A, 0x91 } + , { 0xFF4B, 0x92 }, { 0xFF4C, 0x93 }, { 0xFF4D, 0x94 }, { 0xFF4E, 0x95 } + , { 0xFF4F, 0x96 }, { 0xFF50, 0x97 }, { 0xFF51, 0x98 }, { 0xFF52, 0x99 } + , { 0xFF53, 0xA2 }, { 0xFF54, 0xA3 }, { 0xFF55, 0xA4 }, { 0xFF56, 0xA5 } + , { 0xFF57, 0xA6 }, { 0xFF58, 0xA7 }, { 0xFF59, 0xA8 }, { 0xFF5A, 0xA9 } + , { 0xFF5B, 0xC0 }, { 0xFF5C, 0x4F }, { 0xFF5D, 0xD0 }, { 0xFF5E, 0xA1 } +}; +static const XMLSize_t gToTableSz = sizeof(gToTable)/sizeof(gToTable[0]); + + + +// --------------------------------------------------------------------------- +// XMLIBM1047Transcoder: Public, static methods +// --------------------------------------------------------------------------- +XMLCh XMLIBM1047Transcoder::xlatThisOne(const XMLByte toXlat) +{ + return gFromTable[toXlat]; +} + + +// --------------------------------------------------------------------------- +// XMLIBM1047Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLIBM1047Transcoder::XMLIBM1047Transcoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + + XML256TableTranscoder + ( + encodingName + , blockSize + , gFromTable + , gToTable + , gToTableSz + , manager + ) +{ +} + + +XMLIBM1047Transcoder::~XMLIBM1047Transcoder() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.hpp new file mode 100644 index 000000000..0e98e171b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLIBM1047Transcoder.hpp @@ -0,0 +1,72 @@ +/* + * 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: XMLIBM1047Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLIBM1047TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLIBM1047TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple 1047-US transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +// +class XMLUTIL_EXPORT XMLIBM1047Transcoder : public XML256TableTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public, static methods + // ----------------------------------------------------------------------- + static XMLCh xlatThisOne(const XMLByte toXlat); + + + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLIBM1047Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLIBM1047Transcoder(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLIBM1047Transcoder(); + XMLIBM1047Transcoder(const XMLIBM1047Transcoder&); + void operator=(const XMLIBM1047Transcoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.cpp new file mode 100644 index 000000000..2fa2283ec --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.cpp @@ -0,0 +1,206 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// +// NOTE: These tables are generated from the ICU UCM files, using the +// +// gFromTable +// This is the translation table for IBM1140 EBCDIC to Unicode. This +// table contains 255 entries. The entry for EBCDIC byte x is the +// Unicode translation of that byte. +// +// gToTable +// gToTableSize +// This is the translation table for Unicode to IBM1140 EBCDIC. This one +// contains a list of records, sorted by the Unicode code point. We do +// a binary search to find the Unicode point, and that record's other +// field is the IBM1140 code point to translate to. +// --------------------------------------------------------------------------- +static const XMLCh gFromTable[256] = +{ + 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F + , 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F + , 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087 + , 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F + , 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B + , 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007 + , 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004 + , 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A + , 0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5 + , 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C + , 0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF + , 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC + , 0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5 + , 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F + , 0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF + , 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022 + , 0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067 + , 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1 + , 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070 + , 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x20AC + , 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078 + , 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE + , 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC + , 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7 + , 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047 + , 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5 + , 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050 + , 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF + , 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058 + , 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5 + , 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037 + , 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F +}; + +static const XMLTransService::TransRec gToTable[] = +{ + { 0x0000, 0x00 }, { 0x0001, 0x01 }, { 0x0002, 0x02 }, { 0x0003, 0x03 } + , { 0x0004, 0x37 }, { 0x0005, 0x2D }, { 0x0006, 0x2E }, { 0x0007, 0x2F } + , { 0x0008, 0x16 }, { 0x0009, 0x05 }, { 0x000A, 0x25 }, { 0x000B, 0x0B } + , { 0x000C, 0x0C }, { 0x000D, 0x0D }, { 0x000E, 0x0E }, { 0x000F, 0x0F } + , { 0x0010, 0x10 }, { 0x0011, 0x11 }, { 0x0012, 0x12 }, { 0x0013, 0x13 } + , { 0x0014, 0x3C }, { 0x0015, 0x3D }, { 0x0016, 0x32 }, { 0x0017, 0x26 } + , { 0x0018, 0x18 }, { 0x0019, 0x19 }, { 0x001A, 0x3F }, { 0x001B, 0x27 } + , { 0x001C, 0x1C }, { 0x001D, 0x1D }, { 0x001E, 0x1E }, { 0x001F, 0x1F } + , { 0x0020, 0x40 }, { 0x0021, 0x5A }, { 0x0022, 0x7F }, { 0x0023, 0x7B } + , { 0x0024, 0x5B }, { 0x0025, 0x6C }, { 0x0026, 0x50 }, { 0x0027, 0x7D } + , { 0x0028, 0x4D }, { 0x0029, 0x5D }, { 0x002A, 0x5C }, { 0x002B, 0x4E } + , { 0x002C, 0x6B }, { 0x002D, 0x60 }, { 0x002E, 0x4B }, { 0x002F, 0x61 } + , { 0x0030, 0xF0 }, { 0x0031, 0xF1 }, { 0x0032, 0xF2 }, { 0x0033, 0xF3 } + , { 0x0034, 0xF4 }, { 0x0035, 0xF5 }, { 0x0036, 0xF6 }, { 0x0037, 0xF7 } + , { 0x0038, 0xF8 }, { 0x0039, 0xF9 }, { 0x003A, 0x7A }, { 0x003B, 0x5E } + , { 0x003C, 0x4C }, { 0x003D, 0x7E }, { 0x003E, 0x6E }, { 0x003F, 0x6F } + , { 0x0040, 0x7C }, { 0x0041, 0xC1 }, { 0x0042, 0xC2 }, { 0x0043, 0xC3 } + , { 0x0044, 0xC4 }, { 0x0045, 0xC5 }, { 0x0046, 0xC6 }, { 0x0047, 0xC7 } + , { 0x0048, 0xC8 }, { 0x0049, 0xC9 }, { 0x004A, 0xD1 }, { 0x004B, 0xD2 } + , { 0x004C, 0xD3 }, { 0x004D, 0xD4 }, { 0x004E, 0xD5 }, { 0x004F, 0xD6 } + , { 0x0050, 0xD7 }, { 0x0051, 0xD8 }, { 0x0052, 0xD9 }, { 0x0053, 0xE2 } + , { 0x0054, 0xE3 }, { 0x0055, 0xE4 }, { 0x0056, 0xE5 }, { 0x0057, 0xE6 } + , { 0x0058, 0xE7 }, { 0x0059, 0xE8 }, { 0x005A, 0xE9 }, { 0x005B, 0xBA } + , { 0x005C, 0xE0 }, { 0x005D, 0xBB }, { 0x005E, 0xB0 }, { 0x005F, 0x6D } + , { 0x0060, 0x79 }, { 0x0061, 0x81 }, { 0x0062, 0x82 }, { 0x0063, 0x83 } + , { 0x0064, 0x84 }, { 0x0065, 0x85 }, { 0x0066, 0x86 }, { 0x0067, 0x87 } + , { 0x0068, 0x88 }, { 0x0069, 0x89 }, { 0x006A, 0x91 }, { 0x006B, 0x92 } + , { 0x006C, 0x93 }, { 0x006D, 0x94 }, { 0x006E, 0x95 }, { 0x006F, 0x96 } + , { 0x0070, 0x97 }, { 0x0071, 0x98 }, { 0x0072, 0x99 }, { 0x0073, 0xA2 } + , { 0x0074, 0xA3 }, { 0x0075, 0xA4 }, { 0x0076, 0xA5 }, { 0x0077, 0xA6 } + , { 0x0078, 0xA7 }, { 0x0079, 0xA8 }, { 0x007A, 0xA9 }, { 0x007B, 0xC0 } + , { 0x007C, 0x4F }, { 0x007D, 0xD0 }, { 0x007E, 0xA1 }, { 0x007F, 0x07 } + , { 0x0080, 0x20 }, { 0x0081, 0x21 }, { 0x0082, 0x22 }, { 0x0083, 0x23 } + , { 0x0084, 0x24 }, { 0x0085, 0x15 }, { 0x0086, 0x06 }, { 0x0087, 0x17 } + , { 0x0088, 0x28 }, { 0x0089, 0x29 }, { 0x008A, 0x2A }, { 0x008B, 0x2B } + , { 0x008C, 0x2C }, { 0x008D, 0x09 }, { 0x008E, 0x0A }, { 0x008F, 0x1B } + , { 0x0090, 0x30 }, { 0x0091, 0x31 }, { 0x0092, 0x1A }, { 0x0093, 0x33 } + , { 0x0094, 0x34 }, { 0x0095, 0x35 }, { 0x0096, 0x36 }, { 0x0097, 0x08 } + , { 0x0098, 0x38 }, { 0x0099, 0x39 }, { 0x009A, 0x3A }, { 0x009B, 0x3B } + , { 0x009C, 0x04 }, { 0x009D, 0x14 }, { 0x009E, 0x3E }, { 0x009F, 0xFF } + , { 0x00A0, 0x41 }, { 0x00A1, 0xAA }, { 0x00A2, 0x4A }, { 0x00A3, 0xB1 } + , { 0x00A5, 0xB2 }, { 0x00A6, 0x6A }, { 0x00A7, 0xB5 }, { 0x00A8, 0xBD } + , { 0x00A9, 0xB4 }, { 0x00AA, 0x9A }, { 0x00AB, 0x8A }, { 0x00AC, 0x5F } + , { 0x00AD, 0xCA }, { 0x00AE, 0xAF }, { 0x00AF, 0xBC }, { 0x00B0, 0x90 } + , { 0x00B1, 0x8F }, { 0x00B2, 0xEA }, { 0x00B3, 0xFA }, { 0x00B4, 0xBE } + , { 0x00B5, 0xA0 }, { 0x00B6, 0xB6 }, { 0x00B7, 0xB3 }, { 0x00B8, 0x9D } + , { 0x00B9, 0xDA }, { 0x00BA, 0x9B }, { 0x00BB, 0x8B }, { 0x00BC, 0xB7 } + , { 0x00BD, 0xB8 }, { 0x00BE, 0xB9 }, { 0x00BF, 0xAB }, { 0x00C0, 0x64 } + , { 0x00C1, 0x65 }, { 0x00C2, 0x62 }, { 0x00C3, 0x66 }, { 0x00C4, 0x63 } + , { 0x00C5, 0x67 }, { 0x00C6, 0x9E }, { 0x00C7, 0x68 }, { 0x00C8, 0x74 } + , { 0x00C9, 0x71 }, { 0x00CA, 0x72 }, { 0x00CB, 0x73 }, { 0x00CC, 0x78 } + , { 0x00CD, 0x75 }, { 0x00CE, 0x76 }, { 0x00CF, 0x77 }, { 0x00D0, 0xAC } + , { 0x00D1, 0x69 }, { 0x00D2, 0xED }, { 0x00D3, 0xEE }, { 0x00D4, 0xEB } + , { 0x00D5, 0xEF }, { 0x00D6, 0xEC }, { 0x00D7, 0xBF }, { 0x00D8, 0x80 } + , { 0x00D9, 0xFD }, { 0x00DA, 0xFE }, { 0x00DB, 0xFB }, { 0x00DC, 0xFC } + , { 0x00DD, 0xAD }, { 0x00DE, 0xAE }, { 0x00DF, 0x59 }, { 0x00E0, 0x44 } + , { 0x00E1, 0x45 }, { 0x00E2, 0x42 }, { 0x00E3, 0x46 }, { 0x00E4, 0x43 } + , { 0x00E5, 0x47 }, { 0x00E6, 0x9C }, { 0x00E7, 0x48 }, { 0x00E8, 0x54 } + , { 0x00E9, 0x51 }, { 0x00EA, 0x52 }, { 0x00EB, 0x53 }, { 0x00EC, 0x58 } + , { 0x00ED, 0x55 }, { 0x00EE, 0x56 }, { 0x00EF, 0x57 }, { 0x00F0, 0x8C } + , { 0x00F1, 0x49 }, { 0x00F2, 0xCD }, { 0x00F3, 0xCE }, { 0x00F4, 0xCB } + , { 0x00F5, 0xCF }, { 0x00F6, 0xCC }, { 0x00F7, 0xE1 }, { 0x00F8, 0x70 } + , { 0x00F9, 0xDD }, { 0x00FA, 0xDE }, { 0x00FB, 0xDB }, { 0x00FC, 0xDC } + , { 0x00FD, 0x8D }, { 0x00FE, 0x8E }, { 0x00FF, 0xDF }, { 0x203E, 0xBC } + , { 0x20AC, 0x9F }, { 0xFF01, 0x5A }, { 0xFF02, 0x7F }, { 0xFF03, 0x7B } + , { 0xFF04, 0x5B }, { 0xFF05, 0x6C }, { 0xFF06, 0x50 }, { 0xFF07, 0x7D } + , { 0xFF08, 0x4D }, { 0xFF09, 0x5D }, { 0xFF0A, 0x5C }, { 0xFF0B, 0x4E } + , { 0xFF0C, 0x6B }, { 0xFF0D, 0x60 }, { 0xFF0E, 0x4B }, { 0xFF0F, 0x61 } + , { 0xFF10, 0xF0 }, { 0xFF11, 0xF1 }, { 0xFF12, 0xF2 }, { 0xFF13, 0xF3 } + , { 0xFF14, 0xF4 }, { 0xFF15, 0xF5 }, { 0xFF16, 0xF6 }, { 0xFF17, 0xF7 } + , { 0xFF18, 0xF8 }, { 0xFF19, 0xF9 }, { 0xFF1A, 0x7A }, { 0xFF1B, 0x5E } + , { 0xFF1C, 0x4C }, { 0xFF1D, 0x7E }, { 0xFF1E, 0x6E }, { 0xFF1F, 0x6F } + , { 0xFF20, 0x7C }, { 0xFF21, 0xC1 }, { 0xFF22, 0xC2 }, { 0xFF23, 0xC3 } + , { 0xFF24, 0xC4 }, { 0xFF25, 0xC5 }, { 0xFF26, 0xC6 }, { 0xFF27, 0xC7 } + , { 0xFF28, 0xC8 }, { 0xFF29, 0xC9 }, { 0xFF2A, 0xD1 }, { 0xFF2B, 0xD2 } + , { 0xFF2C, 0xD3 }, { 0xFF2D, 0xD4 }, { 0xFF2E, 0xD5 }, { 0xFF2F, 0xD6 } + , { 0xFF30, 0xD7 }, { 0xFF31, 0xD8 }, { 0xFF32, 0xD9 }, { 0xFF33, 0xE2 } + , { 0xFF34, 0xE3 }, { 0xFF35, 0xE4 }, { 0xFF36, 0xE5 }, { 0xFF37, 0xE6 } + , { 0xFF38, 0xE7 }, { 0xFF39, 0xE8 }, { 0xFF3A, 0xE9 }, { 0xFF3B, 0xBA } + , { 0xFF3C, 0xE0 }, { 0xFF3D, 0xBB }, { 0xFF3E, 0xB0 }, { 0xFF3F, 0x6D } + , { 0xFF40, 0x79 }, { 0xFF41, 0x81 }, { 0xFF42, 0x82 }, { 0xFF43, 0x83 } + , { 0xFF44, 0x84 }, { 0xFF45, 0x85 }, { 0xFF46, 0x86 }, { 0xFF47, 0x87 } + , { 0xFF48, 0x88 }, { 0xFF49, 0x89 }, { 0xFF4A, 0x91 }, { 0xFF4B, 0x92 } + , { 0xFF4C, 0x93 }, { 0xFF4D, 0x94 }, { 0xFF4E, 0x95 }, { 0xFF4F, 0x96 } + , { 0xFF50, 0x97 }, { 0xFF51, 0x98 }, { 0xFF52, 0x99 }, { 0xFF53, 0xA2 } + , { 0xFF54, 0xA3 }, { 0xFF55, 0xA4 }, { 0xFF56, 0xA5 }, { 0xFF57, 0xA6 } + , { 0xFF58, 0xA7 }, { 0xFF59, 0xA8 }, { 0xFF5A, 0xA9 }, { 0xFF5B, 0xC0 } + , { 0xFF5C, 0x4F }, { 0xFF5D, 0xD0 }, { 0xFF5E, 0xA1 } +}; +static const XMLSize_t gToTableSz = 351; + + + +// --------------------------------------------------------------------------- +// XMLIBM1140Transcoder: Public, static methods +// --------------------------------------------------------------------------- +XMLCh XMLIBM1140Transcoder::xlatThisOne(const XMLByte toXlat) +{ + return gFromTable[toXlat]; +} + + +// --------------------------------------------------------------------------- +// XMLIBM1140Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLIBM1140Transcoder::XMLIBM1140Transcoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + XML256TableTranscoder + ( + encodingName + , blockSize + , gFromTable + , gToTable + , gToTableSz + , manager + ) +{ +} + + +XMLIBM1140Transcoder::~XMLIBM1140Transcoder() +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.hpp new file mode 100644 index 000000000..65de6fe45 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLIBM1140Transcoder.hpp @@ -0,0 +1,71 @@ +/* + * 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: XMLIBM1140Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLIBM1140TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLIBM1140TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple IBM-1140 transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XMLIBM1140Transcoder : public XML256TableTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public, static methods + // ----------------------------------------------------------------------- + static XMLCh xlatThisOne(const XMLByte toXlat); + + + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLIBM1140Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLIBM1140Transcoder(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLIBM1140Transcoder(); + XMLIBM1140Transcoder(const XMLIBM1140Transcoder&); + XMLIBM1140Transcoder& operator=(const XMLIBM1140Transcoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLInitializer.cpp b/project/jni/xerces/src/xercesc/util/XMLInitializer.cpp new file mode 100644 index 000000000..28d51b2f4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLInitializer.cpp @@ -0,0 +1,122 @@ +/* + * 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: XMLInitializer.cpp 635560 2008-03-10 14:10:09Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLInitializer: Initialization methods +// --------------------------------------------------------------------------- +void XMLInitializer::initializeStaticData() +{ + try + { + // Note that in some cases the order of initialization can be + // important. + // + + // Core + // + initializeEncodingValidator(); + initializeXMLException(); + initializeXMLScanner(); + initializeXMLValidator(); + + // Regex + // + initializeRangeTokenMap(); + initializeRegularExpression(); + + // DTD + // + initializeDTDGrammar(); + + // Schema + // + initializeXSDErrorReporter(); + initializeDatatypeValidatorFactory(); + initializeGeneralAttributeCheck(); + initializeXSValue(); + initializeComplexTypeInfo(); + + // DOM + // + initializeDOMImplementationRegistry(); + initializeDOMImplementationImpl(); + initializeDOMDocumentTypeImpl(); + initializeDOMNodeListImpl(); + initializeDOMNormalizer(); + } + catch(...) { + XMLPlatformUtils::panic(PanicHandler::Panic_AllStaticInitErr); + } +} + + +void XMLInitializer::terminateStaticData() +{ + // Terminate in the reverse order of initialization. There shouldn't + // be any exceptions and if there are, we can't do anything about them + // since we are no longer initialized (think of it as throwing from + // a destructor). + // + + // DOM + // + terminateDOMNormalizer(); + terminateDOMNodeListImpl(); + terminateDOMDocumentTypeImpl(); + terminateDOMImplementationImpl(); + terminateDOMImplementationRegistry(); + + // Schema + // + terminateComplexTypeInfo(); + terminateXSValue(); + terminateGeneralAttributeCheck(); + terminateDatatypeValidatorFactory(); + terminateXSDErrorReporter(); + + // DTD + // + terminateDTDGrammar(); + + // Regex + // + terminateRegularExpression(); + terminateRangeTokenMap(); + + // Core + // + terminateXMLValidator(); + terminateXMLScanner(); + terminateXMLException(); + terminateEncodingValidator(); +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLInitializer.hpp b/project/jni/xerces/src/xercesc/util/XMLInitializer.hpp new file mode 100644 index 000000000..67d69c913 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLInitializer.hpp @@ -0,0 +1,157 @@ +/* + * 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: XMLInitializer.hpp 695427 2008-09-15 11:05:36Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLINITIALIZER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLINITIALIZER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Utilities that must be implemented in a class-specific way. + * + * This class contains methods that must be implemented by different + * classes that have static data (class or local) that they need + * to initialize when XMLPlatformUtils::Initialize is invoked. + */ +class XMLUTIL_EXPORT XMLInitializer +{ +protected : + /** @name Initialization methods */ + //@{ + + /** Perform per-class allocationa and initialization of static data + * + * These functions should be called from XMLPlatformUtils::Initialize. + */ + static void initializeTransService(); + static void initializeStaticData(); + + /** Perform per-class release of static data + * + * These functions should be called from XMLPlatformUtils::Terminate. + */ + static void terminateStaticData(); + static void terminateTransService(); + + //@} + + friend class XMLPlatformUtils; + +private : + XMLInitializer(); + XMLInitializer(const XMLInitializer& toCopy); + XMLInitializer& operator=(const XMLInitializer&); + +private: + // Note: The name of each function should be in the form + // initialize. + // + // Note: In some cases order of initialization is important. + // + + // + // Initialize + // + + // Core + // + static void initializeEncodingValidator(); + static void initializeXMLException(); + static void initializeXMLScanner(); + static void initializeXMLValidator(); + + // Regex + // + static void initializeRangeTokenMap(); + static void initializeRegularExpression(); + + // DTD + // + static void initializeDTDGrammar(); + + // Schema + // + static void initializeXSDErrorReporter(); + static void initializeDatatypeValidatorFactory(); + static void initializeGeneralAttributeCheck(); + static void initializeXSValue(); + static void initializeComplexTypeInfo(); + + // DOM + // + static void initializeDOMImplementationRegistry(); + static void initializeDOMImplementationImpl(); + static void initializeDOMDocumentTypeImpl(); + static void initializeDOMNodeListImpl(); + static void initializeDOMNormalizer(); + + + // + // Terminate + // + + // Core + // + static void terminateEncodingValidator(); + static void terminateXMLException(); + static void terminateXMLScanner(); + static void terminateXMLValidator(); + + // Regex + // + static void terminateRangeTokenMap(); + static void terminateRegularExpression(); + + // DTD + // + static void terminateDTDGrammar(); + + // Schema + // + static void terminateXSDErrorReporter(); + static void terminateDatatypeValidatorFactory(); + static void terminateGeneralAttributeCheck(); + static void terminateXSValue(); + static void terminateComplexTypeInfo(); + + // DOM + // + static void terminateDOMImplementationRegistry(); + static void terminateDOMImplementationImpl(); + static void terminateDOMDocumentTypeImpl(); + static void terminateDOMNodeListImpl(); + static void terminateDOMNormalizer(); + + // + // Extra initialization. + // + static void initializeDOMHeap (XMLSize_t initialHeapAllocSize, + XMLSize_t maxHeapAllocSize, + XMLSize_t maxSubAllocationSize); +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLInteger.hpp b/project/jni/xerces/src/xercesc/util/XMLInteger.hpp new file mode 100644 index 000000000..ca7f24e44 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLInteger.hpp @@ -0,0 +1,82 @@ +/* + * 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: XMLInteger.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XML_INTEGER_HPP) +#define XERCESC_INCLUDE_GUARD_XML_INTEGER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLInteger : public XMemory +{ +public: + + /** + * Constructs a newly allocated XMLInteger object + * + * @param intVal the integer + */ + + XMLInteger(const int intVal); + + ~XMLInteger(); + + /** + * Returns the built in integer value. + */ + int intValue() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLInteger(const XMLInteger&); + XMLInteger& operator=(const XMLInteger&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fData + // the value + // + // ----------------------------------------------------------------------- + int fData; + +}; + +inline XMLInteger::XMLInteger(const int intVal) +:fData(intVal) +{ +} + +inline XMLInteger::~XMLInteger() +{ +} + +inline int XMLInteger::intValue() const +{ + return fData; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLMsgLoader.cpp b/project/jni/xerces/src/xercesc/util/XMLMsgLoader.cpp new file mode 100644 index 000000000..1f337d70c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLMsgLoader.cpp @@ -0,0 +1,104 @@ +/* + * 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: XMLMsgLoader.cpp 482395 2006-12-04 22:44:40Z dbertoni $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * The PlatformUtils::initialize() would set fLocale + * to either a user-provided string or 0 + * + ***/ +char* XMLMsgLoader::fLocale = 0; + +char* XMLMsgLoader::fPath = 0; + +/*** + * if localeToAdopt is 0, that is to release memory for + * the user defined locale string + * + ***/ +void XMLMsgLoader::setLocale(const char* const localeToAdopt) +{ + /*** + * Release the current setting's memory, if any + ***/ + if (fLocale) + { + XMLPlatformUtils::fgMemoryManager->deallocate(fLocale);//delete [] fLocale; + fLocale = 0; + } + + /*** + * + * REVISIT: later we may do locale format checking + * + * refer to phttp://oss.software.ibm.com/icu/userguide/locale.html + * for details. + */ + if (localeToAdopt && (strlen(localeToAdopt) == 2 || (strlen(localeToAdopt) > 3 && localeToAdopt[2]=='_'))) + { + fLocale = XMLString::replicate(localeToAdopt, XMLPlatformUtils::fgMemoryManager); + } + +} + +const char* XMLMsgLoader::getLocale() +{ + return fLocale; +} + +/*** + * if nlsHomeToAdopt is 0, that is to release memory for + * the user defined NLSHome string + * + ***/ +void XMLMsgLoader::setNLSHome(const char* const nlsHomeToAdopt) +{ + /*** + * Release the current setting's memory, if any + ***/ + if (fPath) + { + XMLPlatformUtils::fgMemoryManager->deallocate(fPath);//delete [] fPath; + fPath = 0; + } + + if (nlsHomeToAdopt) + { + fPath = XMLString::replicate(nlsHomeToAdopt, XMLPlatformUtils::fgMemoryManager); + } + +} + +const char* XMLMsgLoader::getNLSHome() +{ + return fPath; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLMsgLoader.hpp b/project/jni/xerces/src/xercesc/util/XMLMsgLoader.hpp new file mode 100644 index 000000000..9654857e1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLMsgLoader.hpp @@ -0,0 +1,182 @@ +/* + * 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: XMLMsgLoader.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This header defines an abstract message loading API. This is the API via +// which the parser system loads translatable text, and there can be multiple +// actual implementations of this mechanism. The API is very simple because +// there can be many kinds of underlying systems on which implementations are +// based and we don't want to get into portability trouble by being overly +// smart. +// +// Each instance of the message loader loads a file of messages, which are +// accessed by key and which are associated with a particular language. The +// actual source information may be in many forms, but by the time it is +// extracted for use it will be in Unicode format. The language is always +// the default language for the local machine. +// +// Msg loader derivatives are not required to be thread safe. The parser will +// never use a single instance in more than one thread. +// +class XMLUTIL_EXPORT XMLMsgLoader : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // + // XMLMsgId + // A simple typedef to give us flexibility about the representation + // of a message id. + // ----------------------------------------------------------------------- + typedef unsigned int XMLMsgId; + + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + virtual ~XMLMsgLoader(); + + + // ----------------------------------------------------------------------- + // The virtual message loader API + // ----------------------------------------------------------------------- + virtual bool loadMsg + ( + const XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + ) = 0; + + virtual bool loadMsg + ( + const XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const XMLCh* const repText1 + , const XMLCh* const repText2 = 0 + , const XMLCh* const repText3 = 0 + , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + virtual bool loadMsg + ( + const XMLMsgId msgToLoad + , XMLCh* const toFill + , const XMLSize_t maxChars + , const char* const repText1 + , const char* const repText2 = 0 + , const char* const repText3 = 0 + , const char* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + /** @name Locale Handling */ + //@{ + /** + * This function enables set the locale information which + * all concrete message loaders shall refer to during instantiation. + * + * Note: for detailed discussion, refer to PlatformUtils::initialize() + */ + static void setLocale(const char* const localeToAdopt); + + /** + * For the derived to retrieve locale info during construction + */ + static const char* getLocale(); + + //@} + + /** @name NLSHome Handling */ + //@{ + /** + * This function enables set the NLSHome information which + * all concrete message loaders shall refer to during instantiation. + * + * Note: for detailed discussion, refer to PlatformUtils::initialize() + */ + static void setNLSHome(const char* const nlsHomeToAdopt); + + /** + * For the derived to retrieve NLSHome info during construction + */ + static const char* getNLSHome(); + + //@} + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + XMLMsgLoader(); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLMsgLoader(const XMLMsgLoader&); + XMLMsgLoader& operator=(const XMLMsgLoader&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fLocale + // Locale info set through PlatformUtils::init(). + // The derived class may refer to this for locale information. + // + // fPath + // NLSHome info set through PlatformUtils::init(). + // The derived class may refer to this for NLSHome information. + // + // ----------------------------------------------------------------------- + static char* fLocale; + static char* fPath; +}; + + +// --------------------------------------------------------------------------- +// XMLMsgLoader: Public Constructors and Destructor +// --------------------------------------------------------------------------- +inline XMLMsgLoader::~XMLMsgLoader() +{ +} + + +// --------------------------------------------------------------------------- +// XMLMsgLoader: Hidden Constructors +// --------------------------------------------------------------------------- +inline XMLMsgLoader::XMLMsgLoader() +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLMutexMgr.hpp b/project/jni/xerces/src/xercesc/util/XMLMutexMgr.hpp new file mode 100644 index 000000000..e20632146 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLMutexMgr.hpp @@ -0,0 +1,50 @@ +/* + * 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: XMLMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLMUTEXMGR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLMUTEXMGR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef void* XMLMutexHandle; + +// Abstract class for mutex implementation. +// This is be used to allow multiple mutex handling implementations. +class XMLMutexMgr : public XMemory +{ + public: + XMLMutexMgr() {} + virtual ~XMLMutexMgr() {} + + // Mutex operations + virtual XMLMutexHandle create(MemoryManager* const manager) = 0; + virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager) = 0; + virtual void lock(XMLMutexHandle mtx) = 0; + virtual void unlock(XMLMutexHandle mtx) = 0; +}; + +XERCES_CPP_NAMESPACE_END + + +#endif + diff --git a/project/jni/xerces/src/xercesc/util/XMLNetAccessor.hpp b/project/jni/xerces/src/xercesc/util/XMLNetAccessor.hpp new file mode 100644 index 000000000..83200f1d3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLNetAccessor.hpp @@ -0,0 +1,139 @@ +/* + * 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: XMLNetAccessor.hpp 673960 2008-07-04 08:50:12Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP) +#define XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + +// This class holds advanced informations about the HTTP connection +class XMLUTIL_EXPORT XMLNetHTTPInfo +{ +public: + XMLNetHTTPInfo(); + + typedef enum { + GET, + PUT, + POST + } HTTPMethod; + + // ----------------------------------------------------------------------- + // Data members + // + // fHTTPMethod + // The type of the HTTP request + // + // fHeaders + // The extra headers that will be sent as part of the request; the format is + // Header1: Value\r\nHeader2: Value\r\n + // + // fHeadersLen + // The length of the string pointed by fHeaders, in bytes + // + // fPayload + // The extra data that will be sent after the headers; in the case of a PUT + // operation, this is the content of the resource being posted. It can be binary data + // + // fPayloadLen + // The length of the binary buffer pointed by fPayload, in bytes + // + HTTPMethod fHTTPMethod; + const char* fHeaders; + XMLSize_t fHeadersLen; + const char* fPayload; + XMLSize_t fPayloadLen; +}; + +inline XMLNetHTTPInfo::XMLNetHTTPInfo() +:fHTTPMethod(XMLNetHTTPInfo::GET), + fHeaders(0), + fHeadersLen(0), + fPayload(0), + fPayloadLen(0) +{ +} + + +// +// This class is an abstract interface via which the URL class accesses +// net access services. When any source URL is not in effect a local file +// path, then the URL class is used to look at it. Then the URL class can +// be asked to make a binary input stream via which the referenced resource +// can be read in. +// +// The URL class will use an object derived from this class to create a +// binary stream for the URL to return. The object it uses is provided by +// the platform utils, and is actually provided by the per-platform init +// code so each platform can decide what actual implementation it wants to +// use. +// +class XMLUTIL_EXPORT XMLNetAccessor : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Virtual destructor + // ----------------------------------------------------------------------- + virtual ~XMLNetAccessor() + { + } + + + // ----------------------------------------------------------------------- + // The virtual net accessor interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getId() const = 0; + + virtual BinInputStream* makeNew + ( + const XMLURL& urlSrc, + const XMLNetHTTPInfo* httpInfo=0 + ) = 0; + + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + XMLNetAccessor() + { + } + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLNetAccessor(const XMLNetAccessor&); + XMLNetAccessor& operator=(const XMLNetAccessor&); +}; + +MakeXMLException(NetAccessorException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLNumber.cpp b/project/jni/xerces/src/xercesc/util/XMLNumber.cpp new file mode 100644 index 000000000..94ea4f568 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLNumber.cpp @@ -0,0 +1,93 @@ +/* + * 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: XMLNumber.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +//since we need to dynamically created each and every derivatives +//during deserialization by XSerializeEngine>>Derivative, we got +//to include all hpp +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLNumber::XMLNumber() +{} + +XMLNumber::XMLNumber(const XMLNumber& toCopy) +: XSerializable(toCopy) +, XMemory(toCopy) +{} + +XMLNumber::~XMLNumber() +{} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(XMLNumber) + +void XMLNumber::serialize(XSerializeEngine&) +{ + // this class has no data to serialize/de-serilize +} + +XMLNumber* XMLNumber::loadNumber(XMLNumber::NumberType numType + , XSerializeEngine& serEng) +{ + + switch((XMLNumber::NumberType) numType) + { + case XMLNumber::Float: + XMLFloat* floatNum; + serEng>>floatNum; + return floatNum; + break; + case XMLNumber::Double: + XMLDouble* doubleNum; + serEng>>doubleNum; + return doubleNum; + break; + case XMLNumber::BigDecimal: + XMLBigDecimal* bigdecimalNum; + serEng>>bigdecimalNum; + return bigdecimalNum; + break; + case XMLNumber::DateTime: + XMLDateTime* datetimeNum; + serEng>>datetimeNum; + return datetimeNum; + break; + case XMLNumber::UnKnown: + return 0; + break; + } + //we treat this same as UnKnown + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLNumber.hpp b/project/jni/xerces/src/xercesc/util/XMLNumber.hpp new file mode 100644 index 000000000..6f735e9dd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLNumber.hpp @@ -0,0 +1,102 @@ +/* + * 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: XMLNumber.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLNUMBER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLNUMBER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLNumber : public XSerializable, public XMemory +{ +public: + + enum + { + LESS_THAN = -1, + EQUAL = 0, + GREATER_THAN = 1, + INDETERMINATE = 2 + }; + + enum NumberType { + Float, + Double, + BigDecimal, + DateTime, + UnKnown + }; + + virtual ~XMLNumber(); + + /** + * Return string representation of the decimal value. + * A decimal point will be included as necessary. + * Similar to toString above, but the internal buffer is + * returned directly, user is not required to delete + * the returned buffer + */ + virtual XMLCh* getRawData() const = 0; + + /** + * Return the original and converted value of the original data. + * (applicable to double/float) + * + * The internal buffer is returned directly, user is not required + * to delete the returned buffer + */ + virtual const XMLCh* getFormattedString() const = 0; + + /** + * Returns the sign of this number + * + * -1 negative + * 0 zero + * 1 positive + * + */ + virtual int getSign() const = 0; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLNumber) + + static XMLNumber* loadNumber(XMLNumber::NumberType numType + , XSerializeEngine& serEng); + +protected: + + XMLNumber(); + XMLNumber(const XMLNumber&); + +private: + // ----------------------------------------------------------------------- + // Unimplemented operators + // ----------------------------------------------------------------------- + XMLNumber& operator=(const XMLNumber&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLResourceIdentifier.hpp b/project/jni/xerces/src/xercesc/util/XMLResourceIdentifier.hpp new file mode 100644 index 000000000..c93244c6e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLResourceIdentifier.hpp @@ -0,0 +1,214 @@ +/* + * 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: XMLResourceIdentifier.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLRESOURCEIDENTIFIER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLRESOURCEIDENTIFIER_HPP + +XERCES_CPP_NAMESPACE_BEGIN + +class Locator; + +/** + *

This class is used along with XMLEntityResolver to resolve entities. + * Instead of passing publicId and systemId on the resolveEntity call, + * as is done with the SAX entity resolver, an object of type XMLResourceIdentifier + * is passed. By calling the getResourceIdentifierType() method the user can + * determine which data members are available for inspection:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
ResourceIdentifierTypeAvailable Data Members
SchemaGrammarschemaLocation, nameSpace & baseURI (current document)
SchemaImportschemaLocation, nameSpace & baseURI (current document)
SchemaIncludeschemaLocation & baseURI (current document)
SchemaRedefineschemaLocation & baseURI (current document)
ExternalEntitysystemId, publicId & baseURI (some items may be NULL)
+ * + *

The following resolver would provide the application + * with a special character stream for the entity with the system + * identifier "http://www.myhost.com/today":

+ * + * + * \#include
+ * \#include
+ *
+ * class MyResolver : public XMLEntityResolver {
+ *  public:
+ *   InputSource resolveEntity (XMLResourceIdentifier* xmlri);
+ *   ...
+ *  };
+ *
+ *  MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {
+ *   switch(xmlri->getResourceIdentifierType()) {
+ *    case XMLResourceIdentifier::SystemId:
+ *     if (XMLString::compareString(xmlri->getSystemId(), "http://www.myhost.com/today")) {
+ *      MyReader* reader = new MyReader();
+ *      return new InputSource(reader);
+ *     } else {
+ *      return null;
+ *     }
+ *     break;
+ *    default:
+ *     return null;
+ *   }
+ *  }
+ * + * @see SAXParser#setXMLEntityResolver + * @see InputSource#InputSource + */ +class XMLUTIL_EXPORT XMLResourceIdentifier +{ +public: + + /** @name Public Constants */ + //@{ + enum ResourceIdentifierType { + SchemaGrammar = 0, + SchemaImport, + SchemaInclude, + SchemaRedefine , + ExternalEntity, + UnKnown = 255 + }; + //@} + + /** @name Constructors and Destructor */ + //@{ + /** Constructor */ + + XMLResourceIdentifier(const ResourceIdentifierType resourceIdentitiferType + , const XMLCh* const systemId + , const XMLCh* const nameSpace = 0 + , const XMLCh* const publicId = 0 + , const XMLCh* const baseURI = 0 + , const Locator* locator = 0); + + /** Destructor */ + ~XMLResourceIdentifier() + { + } + + //@} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Public Methods */ + //@{ + ResourceIdentifierType getResourceIdentifierType() const; + const XMLCh* getPublicId() const; + const XMLCh* getSystemId() const; + const XMLCh* getSchemaLocation() const; + const XMLCh* getBaseURI() const; + const XMLCh* getNameSpace() const; + const Locator* getLocator() const; + //@} + +private : + + const ResourceIdentifierType fResourceIdentifierType; + const XMLCh* fPublicId; + const XMLCh* fSystemId; + const XMLCh* fBaseURI; + const XMLCh* fNameSpace; + const Locator* fLocator; + + /* Unimplemented constructors and operators */ + + /* Copy constructor */ + XMLResourceIdentifier(const XMLResourceIdentifier&); + + /* Assignment operator */ + XMLResourceIdentifier& operator=(const XMLResourceIdentifier&); + +}; + +inline XMLResourceIdentifier::ResourceIdentifierType XMLResourceIdentifier::getResourceIdentifierType() const +{ + return fResourceIdentifierType; +} + +inline const XMLCh* XMLResourceIdentifier::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* XMLResourceIdentifier::getSystemId() const +{ + return fSystemId; +} + +inline const XMLCh* XMLResourceIdentifier::getSchemaLocation() const +{ + return fSystemId; +} + +inline const XMLCh* XMLResourceIdentifier::getBaseURI() const +{ + return fBaseURI; +} + +inline const XMLCh* XMLResourceIdentifier::getNameSpace() const +{ + return fNameSpace; +} + +inline const Locator* XMLResourceIdentifier::getLocator() const +{ + return fLocator; +} + +inline XMLResourceIdentifier::XMLResourceIdentifier(const ResourceIdentifierType resourceIdentifierType + , const XMLCh* const systemId + , const XMLCh* const nameSpace + , const XMLCh* const publicId + , const XMLCh* const baseURI + , const Locator* locator ) + : fResourceIdentifierType(resourceIdentifierType) + , fPublicId(publicId) + , fSystemId(systemId) + , fBaseURI(baseURI) + , fNameSpace(nameSpace) + , fLocator(locator) +{ +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLString.cpp b/project/jni/xerces/src/xercesc/util/XMLString.cpp new file mode 100644 index 000000000..b5e8095e6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLString.cpp @@ -0,0 +1,1992 @@ +/* + * 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: XMLString.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if HAVE_CONFIG_H +# include +#endif + +#if !HAVE_STRICMP +# include +#endif +#if !HAVE_STRNICMP +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static data +// +// gConverter +// This is initialized when the user calls the platform init method, +// which calls our init method. This is the converter used for default +// conversion to/from the local code page. +// --------------------------------------------------------------------------- +static XMLLCPTranscoder* gTranscoder = 0; +static XMLCh gNullStr[] = +{ + chOpenCurly, chLatin_n, chLatin_u, chLatin_l, chLatin_l, chCloseCurly, chNull +}; + +MemoryManager* XMLString::fgMemoryManager = 0; + + +// --------------------------------------------------------------------------- +// XMLString: Public static methods +// --------------------------------------------------------------------------- + +void XMLString::sizeToText( const XMLSize_t toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + static const char digitList[16] = + { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' + , 'A', 'B', 'C', 'D', 'E', 'F' + }; + + if (!maxChars) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + // Handle special case + if (!toFormat) + { + toFill[0] = '0'; + toFill[1] = 0; + return; + } + + // This is used to fill the temp buffer + XMLSize_t tmpIndex = 0; + + // A copy of the conversion value that we can modify + XMLSize_t tmpVal = toFormat; + + // + // Convert into a temp buffer that we know is large enough. This avoids + // having to check for overflow in the inner loops, and we have to flip + // the resulting XMLString anyway. + // + char tmpBuf[128]; + + // + // For each radix, do the optimal thing. For bin and hex, we can special + // case them and do shift and mask oriented stuff. For oct and decimal + // there isn't much to do but bull through it with divides. + // + if (radix == 2) + { + while (tmpVal) + { + if (tmpVal & 0x1UL) + tmpBuf[tmpIndex++] = '1'; + else + tmpBuf[tmpIndex++] = '0'; + tmpVal >>= 1; + } + } + else if (radix == 16) + { + while (tmpVal) + { + const XMLSize_t charInd = (tmpVal & 0xFUL); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal >>= 4; + } + } + else if ((radix == 8) || (radix == 10)) + { + while (tmpVal) + { + const XMLSize_t charInd = (tmpVal % radix); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal /= radix; + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager); + } + + // See if have enough room in the caller's buffer + if (tmpIndex > maxChars) + { + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager); + } + + // Reverse the tmp buffer into the caller's buffer + XMLSize_t outIndex = 0; + for (; tmpIndex > 0; tmpIndex--) + toFill[outIndex++] = tmpBuf[tmpIndex-1]; + + // And cap off the caller's buffer + toFill[outIndex] = char(0); +} + +void XMLString::binToText( const unsigned long toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + static const char digitList[16] = + { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' + , 'A', 'B', 'C', 'D', 'E', 'F' + }; + + if (!maxChars) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + // Handle special case + if (!toFormat) + { + toFill[0] = '0'; + toFill[1] = 0; + return; + } + + // This is used to fill the temp buffer + XMLSize_t tmpIndex = 0; + + // A copy of the conversion value that we can modify + unsigned long tmpVal = toFormat; + + // + // Convert into a temp buffer that we know is large enough. This avoids + // having to check for overflow in the inner loops, and we have to flip + // the resulting XMLString anyway. + // + char tmpBuf[128]; + + // + // For each radix, do the optimal thing. For bin and hex, we can special + // case them and do shift and mask oriented stuff. For oct and decimal + // there isn't much to do but bull through it with divides. + // + if (radix == 2) + { + while (tmpVal) + { + if (tmpVal & 0x1UL) + tmpBuf[tmpIndex++] = '1'; + else + tmpBuf[tmpIndex++] = '0'; + tmpVal >>= 1; + } + } + else if (radix == 16) + { + while (tmpVal) + { + const unsigned long charInd = (tmpVal & 0xFUL); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal >>= 4; + } + } + else if ((radix == 8) || (radix == 10)) + { + while (tmpVal) + { + const unsigned long charInd = (tmpVal % radix); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal /= radix; + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager); + } + + // See if have enough room in the caller's buffer + if (tmpIndex > maxChars) + { + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager); + } + + // Reverse the tmp buffer into the caller's buffer + XMLSize_t outIndex = 0; + for (; tmpIndex > 0; tmpIndex--) + toFill[outIndex++] = tmpBuf[tmpIndex-1]; + + // And cap off the caller's buffer + toFill[outIndex] = char(0); +} + +void XMLString::binToText( const unsigned int toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // Just call the unsigned long version + binToText((unsigned long)toFormat, toFill, maxChars, radix, manager); +} + +void XMLString::binToText( const long toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // + // If its negative, then put a negative sign into the output and flip + // the sign of the local temp value. + // + XMLSize_t startInd = 0; + unsigned long actualVal; + if (toFormat < 0) + { + toFill[0] = '-'; + startInd++; + // Signed integers can represent one extra negative value + // compared to the positive values. If we simply do (v * -1) + // we will overflow on that extra value. + // + long v = toFormat; + v++; + actualVal = (unsigned long)(v * -1); + actualVal++; + } + else + { + actualVal = (unsigned long)(toFormat); + } + + // And now call the unsigned long version + binToText(actualVal, &toFill[startInd], maxChars, radix, manager); +} + +void XMLString::binToText( const int toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // Just call the long version + binToText((long)toFormat, toFill, maxChars, radix, manager); +} + + +void XMLString::catString(char* const target, const char* const src) +{ + strcat(target, src); +} + + +int XMLString::compareIString(const char* const str1, const char* const str2) +{ + return stricmp(str1, str2); +} + + +int XMLString::compareNString( const char* const str1 + , const char* const str2 + , const XMLSize_t count) +{ + // Watch for pathological secenario + if (!count) + return 0; + + return strncmp(str1, str2, count); +} + + +int XMLString::compareNIString( const char* const str1 + , const char* const str2 + , const XMLSize_t count) +{ + if (!count) + return 0; + + return strnicmp(str1, str2, count); +} + + +int XMLString::compareString( const char* const str1 + , const char* const str2) +{ + return strcmp(str1, str2); +} + + +void XMLString::copyString( char* const target + , const char* const src) +{ + strcpy(target, src); +} + + +void XMLString::cut( XMLCh* const toCutFrom + , const XMLSize_t count) +{ + #if defined(XML_DEBUG) + if (count > stringLen(toCutFrom)) + { + // This is bad of course + } + #endif + + // If count is zero, then nothing to do + if (!count) + return; + + XMLCh* targetPtr = toCutFrom; + XMLCh* srcPtr = toCutFrom + count; + while (*srcPtr) + *targetPtr++ = *srcPtr++; + + // Cap it off at the new end + *targetPtr = 0; +} + + +XMLSize_t XMLString::hash( const char* const tohash + , const XMLSize_t hashModulus) +{ + XMLSize_t hashVal = 0; + if (tohash) { + const char* curCh = tohash; + while (*curCh) + { + XMLSize_t top = hashVal >> 24; + hashVal += (hashVal * 37) + top + (XMLSize_t)(*curCh); + curCh++; + } + } + + // Divide by modulus + return hashVal % hashModulus; +} + + +int XMLString::indexOf(const char* const toSearch, const char ch) +{ + const XMLSize_t len = strlen(toSearch); + for (XMLSize_t i = 0; i < len; i++) + { + if (toSearch[i] == ch) + return (int)i; + } + return -1; +} + + +int XMLString::indexOf( const char* const toSearch + , const char ch + , const XMLSize_t fromIndex + , MemoryManager* const manager) +{ + const XMLSize_t len = strlen(toSearch); + + // Make sure the start index is within the XMLString bounds + if ((int)fromIndex > ((int)len)-1) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + for (XMLSize_t i = fromIndex; i < len; i++) + { + if (toSearch[i] == ch) + return (int)i; + } + return -1; +} + +int XMLString::lastIndexOf(const char* const toSearch, const char ch) +{ + const int len = (int)strlen(toSearch); + for (int i = len-1; i >= 0; i--) + { + if (toSearch[i] == ch) + return i; + } + return -1; +} + +int XMLString::lastIndexOf( const char* const toSearch + , const char ch + , const XMLSize_t fromIndex + , MemoryManager* const manager) +{ + const XMLSize_t len = strlen(toSearch); + + // Make sure the start index is within the XMLString bounds + if ((int)fromIndex > ((int)len)-1) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + for (int i = (int)fromIndex; i >= 0; i--) + { + if (toSearch[i] == ch) + return i; + } + return -1; +} + + +XMLSize_t XMLString::replaceTokens( XMLCh* const errText + , const XMLSize_t maxChars + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4 + , MemoryManager* const manager) +{ + // + // We have to build the string back into the source string, so allocate + // a temp string and copy the orignal text to it. We'll then treat the + // incoming buffer as a target buffer. Put a janitor on it to make sure + // it gets cleaned up. + // + XMLCh* orgText = replicate(errText, manager); + ArrayJanitor janText(orgText, manager); + + XMLCh* pszSrc = orgText; + XMLSize_t curOutInd = 0; + + while (*pszSrc && (curOutInd < maxChars)) + { + // + // Loop until we see a { character. Until we do, just copy chars + // from src to target, being sure not to overrun the output buffer. + // + while ((*pszSrc != chOpenCurly) && (curOutInd < maxChars)) + { + if (!*pszSrc) + break; + errText[curOutInd++] = *pszSrc++; + } + + // If we did not find a curly, then we are done + if (*pszSrc != chOpenCurly) + break; + + // + // Probe this one to see if it matches our pattern of {x}. If not + // then copy over those chars and go back to the first loop. + // + if ((*(pszSrc+1) >= chDigit_0) + && (*(pszSrc+1) <= chDigit_3) + && (*(pszSrc+2) == chCloseCurly)) + { + // + // Its one of our guys, so move the source pointer up past the + // token we are replacing. First though get out the token number + // character. + // + XMLCh tokCh = *(pszSrc+1); + pszSrc += 3; + + // Now copy over the replacement text + const XMLCh* repText = 0; + if (tokCh == chDigit_0) + repText = text1; + else if (tokCh == chDigit_1) + repText = text2; + else if (tokCh == chDigit_2) + repText = text3; + else if (tokCh == chDigit_3) + repText = text4; + + // If this one is null, copy over a null string + if (!repText) + repText = gNullStr; + + while (*repText && (curOutInd < maxChars)) + errText[curOutInd++] = *repText++; + } + else + { + // Escape the curly brace character and continue + errText[curOutInd++] = *pszSrc++; + } + } + + // Copy over a null terminator + errText[curOutInd] = 0; + + // And return the count of chars we output + return curOutInd; +} + + +char* XMLString::replicate( const char* const toRep + , MemoryManager* const manager) +{ + // If a null string, return a null string + if (!toRep) + return 0; + + // + // Get the len of the source and allocate a new buffer. Make sure to + // account for the nul terminator. + // + const XMLSize_t srcLen = strlen(toRep); + char* ret = (char*) manager->allocate((srcLen+1) * sizeof(char)); //new char[srcLen+1]; + + // Copy over the text, adjusting for the size of a char + memcpy(ret, toRep, (srcLen+1) * sizeof(char)); + return ret; +} + + +bool XMLString::startsWith(const char* const toTest, const char* const prefix) +{ + return (strncmp(toTest, prefix, strlen(prefix)) == 0); +} + + +bool XMLString::startsWithI(const char* const toTest + , const char* const prefix) +{ + return (strnicmp(toTest, prefix, strlen(prefix)) == 0); +} + + +XMLSize_t XMLString::stringLen(const char* const src) +{ + return strlen(src); +} + +char* XMLString::transcode(const XMLCh* const toTranscode, + MemoryManager* const manager) +{ + return gTranscoder->transcode(toTranscode, manager); +} + + +bool XMLString::transcode( const XMLCh* const toTranscode + , char* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager) +{ + return gTranscoder->transcode(toTranscode, toFill, maxChars, manager); +} + +XMLCh* XMLString::transcode(const char* const toTranscode, + MemoryManager* const manager) +{ + return gTranscoder->transcode(toTranscode, manager); +} + +bool XMLString::transcode( const char* const toTranscode + , XMLCh* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager) +{ + return gTranscoder->transcode(toTranscode, toFill, maxChars, manager); +} + + +void XMLString::trim(char* const toTrim) +{ + const XMLSize_t len = strlen(toTrim); + + XMLSize_t skip, scrape; + for (skip = 0; skip < len; skip++) + { + if (! isspace(toTrim[skip])) + break; + } + + for (scrape = len; scrape > skip; scrape--) + { + if (! isspace(toTrim[scrape - 1] )) + break; + } + + // Cap off at the scrap point + if (scrape != len) + toTrim[scrape] = 0; + + if (skip) + { + // Copy the chars down + XMLSize_t index = 0; + while (toTrim[skip]) + toTrim[index++] = toTrim[skip++]; + + toTrim[index] = 0; + } +} + + +void XMLString::subString(char* const targetStr, const char* const srcStr + , const XMLSize_t startIndex, const XMLSize_t endIndex + , MemoryManager* const manager) +{ + if (targetStr == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + const XMLSize_t srcLen = strlen(srcStr); + + // Make sure the start index is within the XMLString bounds + if (startIndex > endIndex || endIndex > srcLen) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + const XMLSize_t copySize = endIndex - startIndex; + + for (XMLSize_t i= startIndex; i < endIndex; i++) { + targetStr[i-startIndex] = srcStr[i]; + } + + targetStr[copySize] = 0; +} + +bool XMLString::isValidNOTATION(const XMLCh* const name + , MemoryManager* const manager ) +{ + // + // NOTATATION: : + // where URI is optional + // ':' and localPart must be present + // + XMLSize_t nameLen = XMLString::stringLen(name); + int colPos = XMLString::lastIndexOf(name, chColon); + + if ((colPos == 0) || // no ':' + (colPos == ((int)nameLen) - 1) ) // ':' + return false; + + + // Examine localpart + if (!XMLChar1_0::isValidNCName(&name[colPos+1], nameLen - colPos -1)) + { + return false; + } + else if (colPos == -1) + { + return true; + } + else + { + // Examine URI + XMLCh* const temp = + (XMLCh*) manager->allocate((colPos + 1) * sizeof(XMLCh)); + const ArrayJanitor jan(temp, manager); + + copyNString(temp, name, colPos); + temp[colPos] = 0; + + try + { + XMLUri newURI(temp, manager); // no relative uri support here + } + catch (const MalformedURLException&) + { + return false; + } + + return true; + } +} + +/** + * isValidEncName + * + * [80] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* + * + */ +bool XMLString::isValidEncName(const XMLCh* const name) +{ + if (name == 0 || *name == 0) + return false; + + const XMLCh* tempName = name; + XMLCh firstChar = *tempName++; + + if (!isAlpha(firstChar)) + return false; + + while(*tempName) + { + if (( !isAlpha(*tempName)) && + ( !isDigit(*tempName)) && + ( *tempName != chPeriod) && + ( *tempName != chUnderscore) && + ( *tempName != chDash) ) + return false; + + tempName++; + } + + return true; +} + +bool XMLString::isAlpha(XMLCh const theChar) +{ + if ((( theChar >= chLatin_a ) && ( theChar <= chLatin_z )) || + (( theChar >= chLatin_A ) && ( theChar <= chLatin_Z )) ) + return true; + + return false; +} + +bool XMLString::isDigit(XMLCh const theChar) +{ + if (( theChar >= chDigit_0 ) && ( theChar <= chDigit_9 )) + return true; + + return false; +} + +bool XMLString::isAlphaNum(XMLCh const theChar) +{ + return (isAlpha(theChar) || isDigit(theChar)); +} + +bool XMLString::isHex(XMLCh const theChar) +{ + return (isDigit(theChar) || + (theChar >= chLatin_a && theChar <= chLatin_f) || + (theChar >= chLatin_A && theChar <= chLatin_F)); +} + +// --------------------------------------------------------------------------- +// Wide char versions of most of the string methods +// --------------------------------------------------------------------------- + +void XMLString::sizeToText( const XMLSize_t toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + static const XMLCh digitList[16] = + { + chDigit_0, chDigit_1, chDigit_2, chDigit_3, chDigit_4, chDigit_5 + , chDigit_6, chDigit_7, chDigit_8, chDigit_9, chLatin_A, chLatin_B + , chLatin_C, chLatin_D, chLatin_e, chLatin_F + }; + + if (!maxChars) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + // Handle special case + if (!toFormat) + { + toFill[0] = chDigit_0; + toFill[1] = chNull; + return; + } + + // This is used to fill the temp buffer + XMLSize_t tmpIndex = 0; + + // A copy of the conversion value that we can modify + XMLSize_t tmpVal = toFormat; + + // + // Convert into a temp buffer that we know is large enough. This avoids + // having to check for overflow in the inner loops, and we have to flip + // the resulting sring anyway. + // + XMLCh tmpBuf[128]; + + // + // For each radix, do the optimal thing. For bin and hex, we can special + // case them and do shift and mask oriented stuff. For oct and decimal + // there isn't much to do but bull through it with divides. + // + if (radix == 2) + { + while (tmpVal) + { + if (tmpVal & 0x1UL) + tmpBuf[tmpIndex++] = chDigit_1; + else + tmpBuf[tmpIndex++] = chDigit_0; + tmpVal >>= 1; + } + } + else if (radix == 16) + { + while (tmpVal) + { + const XMLSize_t charInd = (tmpVal & 0xFUL); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal >>= 4; + } + } + else if ((radix == 8) || (radix == 10)) + { + while (tmpVal) + { + const XMLSize_t charInd = (tmpVal % radix); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal /= radix; + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager); + } + + // See if have enough room in the caller's buffer + if (tmpIndex > maxChars) + { + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager); + } + + // Reverse the tmp buffer into the caller's buffer + XMLSize_t outIndex = 0; + for (; tmpIndex > 0; tmpIndex--) + toFill[outIndex++] = tmpBuf[tmpIndex-1]; + + // And cap off the caller's buffer + toFill[outIndex] = chNull; +} + +void XMLString::binToText( const unsigned long toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + static const XMLCh digitList[16] = + { + chDigit_0, chDigit_1, chDigit_2, chDigit_3, chDigit_4, chDigit_5 + , chDigit_6, chDigit_7, chDigit_8, chDigit_9, chLatin_A, chLatin_B + , chLatin_C, chLatin_D, chLatin_e, chLatin_F + }; + + if (!maxChars) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + // Handle special case + if (!toFormat) + { + toFill[0] = chDigit_0; + toFill[1] = chNull; + return; + } + + // This is used to fill the temp buffer + XMLSize_t tmpIndex = 0; + + // A copy of the conversion value that we can modify + unsigned long tmpVal = toFormat; + + // + // Convert into a temp buffer that we know is large enough. This avoids + // having to check for overflow in the inner loops, and we have to flip + // the resulting sring anyway. + // + XMLCh tmpBuf[128]; + + // + // For each radix, do the optimal thing. For bin and hex, we can special + // case them and do shift and mask oriented stuff. For oct and decimal + // there isn't much to do but bull through it with divides. + // + if (radix == 2) + { + while (tmpVal) + { + if (tmpVal & 0x1UL) + tmpBuf[tmpIndex++] = chDigit_1; + else + tmpBuf[tmpIndex++] = chDigit_0; + tmpVal >>= 1; + } + } + else if (radix == 16) + { + while (tmpVal) + { + const unsigned long charInd = (tmpVal & 0xFUL); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal >>= 4; + } + } + else if ((radix == 8) || (radix == 10)) + { + while (tmpVal) + { + const unsigned long charInd = (tmpVal % radix); + tmpBuf[tmpIndex++] = digitList[charInd]; + tmpVal /= radix; + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager); + } + + // See if have enough room in the caller's buffer + if (tmpIndex > maxChars) + { + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager); + } + + // Reverse the tmp buffer into the caller's buffer + XMLSize_t outIndex = 0; + for (; tmpIndex > 0; tmpIndex--) + toFill[outIndex++] = tmpBuf[tmpIndex-1]; + + // And cap off the caller's buffer + toFill[outIndex] = chNull; +} + +void XMLString::binToText( const unsigned int toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // Just call the unsigned long version + binToText((unsigned long)toFormat, toFill, maxChars, radix, manager); +} + +void XMLString::binToText( const long toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // + // If its negative, then put a negative sign into the output and flip + // the sign of the local temp value. + // + XMLSize_t startInd = 0; + unsigned long actualVal; + if (toFormat < 0) + { + toFill[0] = chDash; + startInd++; + // Signed integers can represent one extra negative value + // compared to the positive values. If we simply do (v * -1) + // we will overflow on that extra value. + // + long v = toFormat; + v++; + actualVal = (unsigned long)(v * -1); + actualVal++; + } + else + { + actualVal = (unsigned long)(toFormat); + } + + // And now call the unsigned long version + binToText(actualVal, &toFill[startInd], maxChars, radix, manager); +} + +void XMLString::binToText( const int toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager) +{ + // Just call the long version + binToText((long)toFormat, toFill, maxChars, radix, manager); +} + +void XMLString::catString(XMLCh* const target, const XMLCh* const src) +{ + // Get the starting point for the cat on the target XMLString + XMLSize_t index = stringLen(target); + + // While the source is not zero, add them to target and bump + const XMLCh* pszTmp = src; + while (*pszTmp) + target[index++] = *pszTmp++; + + // Cap off the target where we ended + target[index] = chNull; +} + + +int XMLString::compareIString( const XMLCh* const str1 + , const XMLCh* const str2) +{ + // Refer this one to the transcoding service + return XMLPlatformUtils::fgTransService->compareIString(str1, str2); +} + +int XMLString::compareIStringASCII( const XMLCh* const str1 + , const XMLCh* const str2) +{ + const XMLCh* psz1 = str1; + const XMLCh* psz2 = str2; + + if (psz1 == 0 || psz2 == 0) { + + if (psz1 == 0) { + return 0 - (int)XMLString::stringLen(psz2); + } + else if (psz2 == 0) { + return (int)XMLString::stringLen(psz1); + } + } + + XMLCh ch1; + XMLCh ch2; + + for (;;) { + if (*psz1 >= chLatin_A && *psz1 <= chLatin_Z) + ch1 = *psz1 - chLatin_A + chLatin_a; + else + ch1 = *psz1; + if (*psz2 >= chLatin_A && *psz2 <= chLatin_Z) + ch2 = *psz2 - chLatin_A + chLatin_a; + else + ch2 = *psz2; + + // If an inequality, then return difference + if (ch1 != ch2) + return int(ch1) - int(ch2); + + // If either ended, then both ended, so equal + if (!ch1) + break; + + // Move upwards to next chars + psz1++; + psz2++; + } + return 0; +} + +int XMLString::compareNString( const XMLCh* const str1 + , const XMLCh* const str2 + , const XMLSize_t maxChars) +{ + const XMLCh* psz1 = str1; + const XMLCh* psz2 = str2; + + XMLSize_t curCount = 0; + while (curCount < maxChars) + { + // If an inequality, then return difference + if (*psz1 != *psz2) + return int(*psz1) - int(*psz2); + + // If either ended, then both ended, so equal + if (!*psz1) + break; + + // Move upwards to next chars + psz1++; + psz2++; + + // + // Bump the count of chars done. + // + curCount++; + } + // If we inspected all the maxChars, then we are equal. + return 0; +} + + +int XMLString::compareNIString( const XMLCh* const str1 + , const XMLCh* const str2 + , const XMLSize_t maxChars) +{ + // Refer this oneto the transcoding service + return XMLPlatformUtils::fgTransService->compareNIString(str1, str2, maxChars); +} + + +int XMLString::compareString( const XMLCh* const str1 + , const XMLCh* const str2) +{ + const XMLCh* psz1 = str1; + const XMLCh* psz2 = str2; + + if (psz1 == 0 || psz2 == 0) { + + if (psz1 == 0) { + return 0 - (int)XMLString::stringLen(psz2); + } + else if (psz2 == 0) { + return (int)XMLString::stringLen(psz1); + } + } + + for (;;) + { + // If an inequality, then return the difference + if (*psz1 != *psz2) + return int(*psz1) - int(*psz2); + + // If either has ended, then they both ended, so equal + if (!*psz1) + break; + + // Move upwards for the next round + psz1++; + psz2++; + } + return 0; +} + + +bool XMLString::regionMatches(const XMLCh* const str1 + , const int offset1 + , const XMLCh* const str2 + , const int offset2 + , const XMLSize_t charCount) +{ + if (!validateRegion(str1, offset1,str2, offset2, charCount)) + return false; + + if (compareNString(str1+offset1, str2+offset2, charCount) != 0) + return false; + + return true; +} + +bool XMLString::regionIMatches(const XMLCh* const str1 + , const int offset1 + , const XMLCh* const str2 + , const int offset2 + , const XMLSize_t charCount) +{ + if (!validateRegion(str1, offset1,str2, offset2, charCount)) + return false; + + if (compareNIString(str1+offset1, str2+offset2, charCount) != 0) + return false; + + return true; +} + +void XMLString::copyString(XMLCh* const target, const XMLCh* const src) +{ + if (!src) + { + *target = 0; + return; + } + + XMLCh* pszOut = target; + const XMLCh* pszIn = src; + while (*pszIn) + *pszOut++ = *pszIn++; + + // Cap off the target where we ended + *pszOut = 0; +} + + +bool XMLString::copyNString( XMLCh* const target + , const XMLCh* const src + , const XMLSize_t maxChars) +{ + // Return whether we copied it all or hit the max + XMLSize_t len = stringLen(src); + if(len > maxChars) + { + XMLString::moveChars(target, src, maxChars); + target[maxChars] = 0; + return false; + } + XMLString::moveChars(target, src, len+1); + return true; +} + +const XMLCh* XMLString::findAny(const XMLCh* const toSearch + , const XMLCh* const searchList) +{ + const XMLCh* srcPtr = toSearch; + while (*srcPtr) + { + const XMLCh* listPtr = searchList; + const XMLCh curCh = *srcPtr; + + while (*listPtr) + { + if (curCh == *listPtr++) + return srcPtr; + } + srcPtr++; + } + return 0; +} + +XMLCh* XMLString::findAny( XMLCh* const toSearch + , const XMLCh* const searchList) +{ + XMLCh* srcPtr = toSearch; + while (*srcPtr) + { + const XMLCh* listPtr = searchList; + const XMLCh curCh = *srcPtr; + + while (*listPtr) + { + if (curCh == *listPtr++) + return srcPtr; + } + srcPtr++; + } + return 0; +} + +int XMLString::patternMatch( const XMLCh* const toSearch + , const XMLCh* const pattern) +{ + if (!toSearch || !*toSearch ) + return -1; + + const XMLSize_t patnLen = XMLString::stringLen(pattern); + if ( !patnLen ) + return -1; + + const XMLCh* srcPtr = toSearch; + const XMLCh* patnStart = toSearch; + XMLSize_t patnIndex = 0; + + while (*srcPtr) + { + if ( !(*srcPtr++ == pattern[patnIndex])) + { + patnIndex = 0; + srcPtr = ++patnStart; + } + else + { + if (++patnIndex == patnLen) + // full pattern match found + return (int)(srcPtr - patnLen - toSearch); + + } + } + + return -1; +} + + +int XMLString::indexOf(const XMLCh* const toSearch, const XMLCh ch) +{ + if (!toSearch || !*toSearch) return -1; + + const XMLCh* srcPtr = toSearch; + while (*srcPtr) + if (ch == *srcPtr++) + return (int)(srcPtr - toSearch - 1); + return -1; +} + + +int XMLString::indexOf( const XMLCh* const toSearch + , const XMLCh ch + , const XMLSize_t fromIndex + , MemoryManager* const manager) +{ + const XMLSize_t len = stringLen(toSearch); + + // Make sure the start index is within the XMLString bounds + if (fromIndex >= len) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + const XMLCh* srcPtr = toSearch+fromIndex; + while (*srcPtr) + if (ch == *srcPtr++) + return (int)(srcPtr - toSearch - 1); + return -1; +} + +int XMLString::lastIndexOf(const XMLCh ch, + const XMLCh* const toSearch, + const XMLSize_t toSearchLen) +{ + const XMLCh* srcPtr = toSearch+toSearchLen; + while (srcPtr >= toSearch) + if (ch == *srcPtr--) + return (int)(srcPtr + 1 - toSearch); + return -1; +} + +int XMLString::lastIndexOf( const XMLCh* const toSearch + , const XMLCh ch + , const XMLSize_t fromIndex + , MemoryManager* const manager) +{ + const XMLSize_t len = stringLen(toSearch); + if (fromIndex >= len) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + const XMLCh* srcPtr = toSearch+fromIndex; + while (srcPtr >= toSearch) + if (ch == *srcPtr--) + return (int)(srcPtr + 1 - toSearch); + return -1; +} + + +XMLCh* +XMLString::makeUName(const XMLCh* const pszURI, const XMLCh* const pszName) +{ + // + // If there is a URI, then format out the full name in the {uri}name + // form. Otherwise, just set it to the same thing as the base name. + // + XMLCh* pszRet = 0; + const XMLSize_t uriLen = stringLen(pszURI); + if (uriLen) + { + pszRet = new XMLCh[uriLen + stringLen(pszName) + 3]; + + XMLCh szTmp[2]; + szTmp[1] = 0; + + szTmp[0] = chOpenCurly; + copyString(pszRet, szTmp); + catString(pszRet, pszURI); + szTmp[0] = chCloseCurly; + catString(pszRet, szTmp); + catString(pszRet, pszName); + } + else + { + pszRet = replicate(pszName); + } + return pszRet; +} + + +bool XMLString::textToBin(const XMLCh* const toConvert, unsigned int& toFill + , MemoryManager* const manager) +{ + toFill = 0; + + // If no string, then its a failure + if ((!toConvert) || (!*toConvert)) + return false; + + XMLCh* trimmedStr = XMLString::replicate(toConvert, manager); + ArrayJanitor jan1(trimmedStr, manager); + XMLString::trim(trimmedStr); + XMLSize_t trimmedStrLen = XMLString::stringLen(trimmedStr); + + if ( !trimmedStrLen ) + return false; + + // we don't allow '-' sign + if (XMLString::indexOf(trimmedStr, chDash, 0, manager) != -1) + return false; + + //the errno set by previous run is NOT automatically cleared + errno = 0; + + char *nptr = XMLString::transcode(trimmedStr, manager); + ArrayJanitor jan2(nptr, manager); + + char *endptr; + // + // REVISIT: conversion of (unsigned long) to (unsigned int) + // may truncate value on IA64 + toFill = (unsigned int) strtoul(nptr, &endptr, 10); + + // check if all chars are valid char + // check if overflow/underflow occurs + if ( ( (endptr - nptr) != (int) trimmedStrLen) || + (errno == ERANGE) ) + return false; + + return true; +} + +int XMLString::parseInt(const XMLCh* const toConvert + , MemoryManager* const manager) +{ + // If no string, or empty string, then it is a failure + if ((!toConvert) || (!*toConvert)) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager); + + XMLCh* trimmedStr = XMLString::replicate(toConvert, manager); + ArrayJanitor jan1(trimmedStr, manager); + XMLString::trim(trimmedStr); + XMLSize_t trimmedStrLen = XMLString::stringLen(trimmedStr); + + if ( !trimmedStrLen ) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager); + + //the errno set by previous run is NOT automatically cleared + errno = 0; + + char *nptr = XMLString::transcode(trimmedStr, manager); + ArrayJanitor jan2(nptr, manager); + + char *endptr; + long retVal = strtol(nptr, &endptr, 10); + + // check if all chars are valid char + if ( (endptr - nptr) != (int) trimmedStrLen) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager); + + // check if overflow/underflow occurs + if (errno == ERANGE) + ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::Str_ConvertOverflow, manager); + + // + // REVISIT: conversion of (long) to (int) + // may truncate value on IA64 + return (int) retVal; +} + + +void XMLString::trim(XMLCh* const toTrim) +{ + const XMLSize_t len = stringLen(toTrim); + + XMLSize_t skip, scrape; + for (skip = 0; skip < len; skip++) + { + if (!XMLChar1_0::isWhitespace(toTrim[skip])) + break; + } + + for (scrape = len; scrape > skip; scrape--) + { + if (!XMLChar1_0::isWhitespace(toTrim[scrape - 1])) + break; + } + + // Cap off at the scrap point + if (scrape != len) + toTrim[scrape] = 0; + + if (skip) + { + // Copy the chars down + XMLSize_t index = 0; + while (toTrim[skip]) + toTrim[index++] = toTrim[skip++]; + + toTrim[index] = 0; + } +} + + +void XMLString::upperCase(XMLCh* const toUpperCase) +{ + // Refer this one to the transcoding service + XMLPlatformUtils::fgTransService->upperCase(toUpperCase); +} + +void XMLString::upperCaseASCII(XMLCh* const toUpperCase) +{ + XMLCh* psz1 = toUpperCase; + + if (!psz1) + return; + + while (*psz1) { + if (*psz1 >= chLatin_a && *psz1 <= chLatin_z) + *psz1 = *psz1 - chLatin_a + chLatin_A; + + psz1++; + } +} + + +void XMLString::lowerCase(XMLCh* const toLowerCase) +{ + // Refer this one to the transcoding service + XMLPlatformUtils::fgTransService->lowerCase(toLowerCase); +} + +void XMLString::lowerCaseASCII(XMLCh* const toLowerCase) +{ + XMLCh* psz1 = toLowerCase; + + if (!psz1) + return; + + while (*psz1) { + if (*psz1 >= chLatin_A && *psz1 <= chLatin_Z) + *psz1 = *psz1 - chLatin_A + chLatin_a; + + psz1++; + } +} + +void XMLString::subString(XMLCh* const targetStr, const XMLCh* const srcStr + , const XMLSize_t startIndex, const XMLSize_t endIndex + , MemoryManager* const manager) +{ + subString(targetStr, srcStr, startIndex, endIndex, stringLen(srcStr), manager); +} + +void XMLString::subString(XMLCh* const targetStr, const XMLCh* const srcStr + , const XMLSize_t startIndex, const XMLSize_t endIndex + , const XMLSize_t srcStrLength + , MemoryManager* const manager) +{ + //if (startIndex < 0 || endIndex < 0) + // ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_NegativeIndex); + + if (targetStr == 0) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); + + // Make sure the start index is within the XMLString bounds + if (startIndex > endIndex || endIndex > srcStrLength) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); + + const XMLSize_t copySize = endIndex - startIndex; + + for (XMLSize_t i= startIndex; i < endIndex; i++) { + targetStr[i-startIndex] = srcStr[i]; + } + + targetStr[copySize] = 0; +} + +BaseRefVectorOf* XMLString::tokenizeString(const XMLCh* const tokenizeSrc + , MemoryManager* const manager) +{ + XMLCh* orgText = replicate(tokenizeSrc, manager); + ArrayJanitor janText(orgText, manager); + XMLCh* tokenizeStr = orgText; + + RefArrayVectorOf* tokenStack = new (manager) RefArrayVectorOf(16, true, manager); + + XMLSize_t len = stringLen(tokenizeStr); + XMLSize_t skip; + XMLSize_t index = 0; + + while (index != len) { + // find the first non-space character + for (skip = index; skip < len; skip++) + { + if (!XMLChar1_0::isWhitespace(tokenizeStr[skip])) + break; + } + index = skip; + + // find the delimiter (space character) + for (; skip < len; skip++) + { + if (XMLChar1_0::isWhitespace(tokenizeStr[skip])) + break; + } + + // we reached the end of the string + if (skip == index) + break; + + // these tokens are adopted in the RefVector and will be deleted + // when the vector is deleted by the caller + XMLCh* token = (XMLCh*) manager->allocate + ( + (skip+1-index) * sizeof(XMLCh) + );//new XMLCh[skip+1-index]; + + XMLString::subString(token, tokenizeStr, index, skip, len, manager); + tokenStack->addElement(token); + index = skip; + } + return tokenStack; +} + +// +// This method is called when we get a notation or enumeration type attribute +// to validate. We have to confirm that the passed value to find is one of +// the values in the passed list. The list is a space separated string of +// values to match against. +// +bool XMLString::isInList(const XMLCh* const toFind, const XMLCh* const enumList) +{ + // + // We loop through the values in the list via this outer loop. We end + // when we hit the end of the enum list or get a match. + // + const XMLCh* listPtr = enumList; + const XMLSize_t findLen = XMLString::stringLen(toFind); + while (*listPtr) + { + XMLSize_t testInd; + for (testInd = 0; testInd < findLen; testInd++) + { + // + // If they don't match, then reset and try again. Note that + // hitting the end of the current item will cause a mismatch + // because there can be no spaces in the toFind string. + // + if (listPtr[testInd] != toFind[testInd]) + break; + } + + // + // If we went the distance, see if we matched. If we did, the current + // list character has to be null or space. + // + if (testInd == findLen) + { + if ((listPtr[testInd] == chSpace) || !listPtr[testInd]) + return true; + } + + // Run the list pointer up to the next substring + while ((*listPtr != chSpace) && *listPtr) + listPtr++; + + // If we hit the end, then we failed + if (!*listPtr) + return false; + + // Else move past the space and try again + listPtr++; + } + + // We never found it + return false; +} + +// +// a string is whitespace:replaced, is having no +// #xD Carriage Return +// #xA Line Feed +// #x9 TAB +// +bool XMLString::isWSReplaced(const XMLCh* const toCheck) +{ + // If no string, then its a OK + if (( !toCheck ) || ( !*toCheck )) + return true; + + const XMLCh* startPtr = toCheck; + while ( *startPtr ) + { + if ( ( *startPtr == chCR) || + ( *startPtr == chLF) || + ( *startPtr == chHTab)) + return false; + + startPtr++; + } + + return true; +} + +// +// to replace characters listed below to #x20 +// #xD Carriage Return +// #xA Line Feed +// #x9 TAB +// +void XMLString::replaceWS(XMLCh* toConvert, MemoryManager* const) +{ + // If no string, then its a OK + if (( !toConvert ) || ( !*toConvert )) + return; + + XMLCh* cursorPtr = toConvert; + while ( *cursorPtr ) + { + if ( ( *cursorPtr == chCR) || + ( *cursorPtr == chLF) || + ( *cursorPtr == chHTab)) + *cursorPtr = chSpace; + + cursorPtr++; + } +} + +// +// a string is whitespace:collapsed, is whitespace::replaced +// and no +// leading space (#x20) +// trailing space +// no contiguous sequences of spaces +// +bool XMLString::isWSCollapsed(const XMLCh* const toCheck) +{ + if (( !toCheck ) || ( !*toCheck )) + return true; + + // shall be whitespace::replaced first + if ( !isWSReplaced(toCheck) ) + return false; + + // no leading or trailing space + if ((*toCheck == chSpace) || + (toCheck[XMLString::stringLen(toCheck)-1] == chSpace)) + return false; + + const XMLCh* startPtr = toCheck; + XMLCh theChar; + bool inSpace = false; + while ( (theChar = *startPtr) != 0 ) + { + if ( theChar == chSpace) + { + if (inSpace) + return false; + else + inSpace = true; + } + else + inSpace = false; + + startPtr++; + + } + + return true; +} + +// +// no leading and/or trailing spaces +// no continuous sequences of spaces +// +void XMLString::collapseWS(XMLCh* toConvert + , MemoryManager* const manager) +{ + // If no string, then its a failure + if (( !toConvert ) || ( !*toConvert )) + return; + + // replace whitespace first + if(!isWSReplaced(toConvert)) + replaceWS(toConvert, manager); + + // remove leading spaces + XMLCh* startPtr = toConvert; + while ( *startPtr == chSpace ) + startPtr++; + + if (!*startPtr) + { + *toConvert = chNull; + return; + } + + // remove trailing spaces + XMLCh* endPtr = toConvert + stringLen(toConvert); + while (*(endPtr - 1) == chSpace) + endPtr--; + *endPtr = chNull; + + // move data to beginning only if there were spaces in front + if(startPtr != toConvert) + XMLString::moveChars(toConvert, startPtr, endPtr - startPtr + 1); + + if(!isWSCollapsed(toConvert)) + { + // + // Work through what remains and chop continuous spaces + // + XMLCh* retPtr = toConvert; + startPtr = toConvert; + bool inSpace = false; + while (*startPtr) + { + if ( *startPtr == chSpace) + { + // copy a single space, then ignore subsequent + if (!inSpace) + { + inSpace = true; + *retPtr++ = chSpace; + } + } + else + { + inSpace = false; + *retPtr++ = *startPtr; + } + + startPtr++; + } + + *retPtr = chNull; + } +} + +// +// remove whitespace +// +void XMLString::removeWS(XMLCh* toConvert, MemoryManager* const) +{ + // If no string, then its a failure + if (( !toConvert ) || ( !*toConvert )) + return; + + XMLCh* retPtr = toConvert; + XMLCh* startPtr = toConvert; + + while (*startPtr) + { + if ( ( *startPtr != chCR) && + ( *startPtr != chLF) && + ( *startPtr != chHTab) && + ( *startPtr != chSpace) ) + { + *retPtr++ = *startPtr; + } + + startPtr++; + } + + *retPtr = chNull; +} + +void XMLString::removeChar(const XMLCh* const srcString + , const XMLCh& toRemove + , XMLBuffer& dstBuffer) +{ + if(!srcString) return; + const XMLCh* pszSrc = srcString; + XMLCh c; + + dstBuffer.reset(); + + while ((c=*pszSrc++)!=0) + { + if (c != toRemove) + dstBuffer.append(c); + } +} + +/** + * Fixes a platform dependent absolute path filename to standard URI form. + * 1. Windows: fix 'x:' to 'file:///x:' and convert any backslash to forward slash + * 2. UNIX: fix '/blah/blahblah' to 'file:///blah/blahblah' + */ +void XMLString::fixURI(const XMLCh* const str, XMLCh* const target) +{ + if (!str || !*str) + return; + + int colonIdx = XMLString::indexOf(str, chColon); + + // If starts with a '/' we assume + // this is an absolute (UNIX) file path and prefix it with file:// + if (colonIdx == -1 && XMLString::indexOf(str, chForwardSlash) == 0) { + unsigned index = 0; + target[index++] = chLatin_f; + target[index++] = chLatin_i; + target[index++] = chLatin_l; + target[index++] = chLatin_e; + target[index++] = chColon; + target[index++] = chForwardSlash; + target[index++] = chForwardSlash; + + // copy the string + const XMLCh* inPtr = str; + while (*inPtr) + target[index++] = *inPtr++; + + target[index] = chNull; + } + else if (colonIdx == 1 && XMLString::isAlpha(*str)) { + // If starts with a driver letter 'x:' we assume + // this is an absolute (Windows) file path and prefix it with file:/// + unsigned index = 0; + target[index++] = chLatin_f; + target[index++] = chLatin_i; + target[index++] = chLatin_l; + target[index++] = chLatin_e; + target[index++] = chColon; + target[index++] = chForwardSlash; + target[index++] = chForwardSlash; + target[index++] = chForwardSlash; + + // copy the string and fix any backward slash + const XMLCh* inPtr = str; + while (*inPtr) { + if (*inPtr == chYenSign || + *inPtr == chWonSign || + *inPtr == chBackSlash) + target[index++] = chForwardSlash; + else + target[index++] = *inPtr; + inPtr++; + } + + // cap it with null + target[index] = chNull; + } + else { + // not specific case, so just copy the string over + copyString(target, str); + } +} + +void XMLString::release(char** buf, MemoryManager* const manager) +{ + manager->deallocate(*buf); + *buf = 0; +} + +void XMLString::release(XMLCh** buf, MemoryManager* const manager) +{ + manager->deallocate(*buf); + *buf = 0; +} + +// --------------------------------------------------------------------------- +// XMLString: Private static methods +// --------------------------------------------------------------------------- +void XMLString::initString(XMLLCPTranscoder* const defToUse, + MemoryManager* const manager) +{ + // Store away the default transcoder that we are to use + gTranscoder = defToUse; + + // Store memory manager + fgMemoryManager = manager; +} + +void XMLString::termString() +{ + // Just clean up our local code page transcoder + delete gTranscoder; + gTranscoder = 0; + + // reset memory manager + fgMemoryManager = 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLString.hpp b/project/jni/xerces/src/xercesc/util/XMLString.hpp new file mode 100644 index 000000000..43d38cb4c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLString.hpp @@ -0,0 +1,1620 @@ +/* + * 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: XMLString.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRING_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSTRING_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLLCPTranscoder; +/** + * Class for representing native character strings and handling common string + * operations + * + * This class is Unicode compliant. This class is designed primarily + * for internal use, but due to popular demand, it is being made + * publicly available. Users of this class must understand that this + * is not an officially supported class. All public methods of this + * class are static functions. + * + */ +class XMLUTIL_EXPORT XMLString +{ +public: + /* Static methods for native character mode string manipulation */ + + + /** @name String concatenation functions */ + //@{ + /** Concatenates two strings. + * + * catString appends src to target and + * terminates the resulting string with a null character. The initial character + * of src overwrites the terminating character of target + * . + * + * No overflow checking is performed when strings are copied or appended. + * The behavior of catString is undefined if source and + * destination strings overlap. + * + * @param target Null-terminated destination string + * @param src Null-terminated source string + */ + static void catString + ( + char* const target + , const char* const src + ); + + /** Concatenates two strings. + * + * catString appends src to target and + * terminates the resulting string with a null character. The initial character of + * src overwrites the terminating character of target. + * No overflow checking is performed when strings are copied or appended. + * The behavior of catString is undefined if source and destination + * strings overlap. + * + * @param target Null-terminated destination string + * @param src Null-terminated source string + */ + static void catString + ( + XMLCh* const target + , const XMLCh* const src + ); + //@} + + /** @name String comparison functions */ + //@{ + /** Lexicographically compares lowercase versions of str1 and + * str2 and returns a value indicating their relationship. + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareIString + ( + const char* const str1 + , const char* const str2 + ); + + /** Lexicographically compares lowercase versions of str1 and + * str2 and returns a value indicating their relationship. + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareIString + ( + const XMLCh* const str1 + , const XMLCh* const str2 + ); + + /** Lexicographically compares lowercase versions of str1 and + * str2 and returns a value indicating their relationship. + * The routine only lowercases A to Z. + * @param str1 Null-terminated ASCII string to compare + * @param str2 Null-terminated ASCII string to compare + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareIStringASCII + ( + const XMLCh* const str1 + , const XMLCh* const str2 + ); + + + + /** Lexicographically compares, at most, the first count characters in + * str1 and str2 and returns a value indicating the + * relationship between the substrings. + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @param count The number of characters to compare + * + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareNString + ( + const char* const str1 + , const char* const str2 + , const XMLSize_t count + ); + + /** Lexicographically compares, at most, the first count characters in + * str1 and str2 and returns a value indicating + * the relationship between the substrings. + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @param count The number of characters to compare + * + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareNString + ( + const XMLCh* const str1 + , const XMLCh* const str2 + , const XMLSize_t count + ); + + + /** Lexicographically compares, at most, the first count characters in + * str1 and str2 without regard to case and + * returns a value indicating the relationship between the substrings. + * + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @param count The number of characters to compare + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareNIString + ( + const char* const str1 + , const char* const str2 + , const XMLSize_t count + ); + + /** Lexicographically compares, at most, the first count characters in + * str1 and str2 without regard to case and + * returns a value indicating the relationship between the substrings. + * + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @param count The number of characters to compare + * + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareNIString + ( + const XMLCh* const str1 + , const XMLCh* const str2 + , const XMLSize_t count + ); + + /** Lexicographically compares str1 and str2 and + * returns a value indicating their relationship. + * + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareString + ( + const char* const str1 + , const char* const str2 + ); + + /** Lexicographically compares str1 and str2 and + * returns a value indicating their relationship. + * + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @return The return value indicates the relation of str1 to + * str2 as follows + * Less than 0 means str1 is less than str2 + * Equal to 0 means str1 is identical to str2 + * Greater than 0 means str1 is more than str2 + */ + static int compareString + ( + const XMLCh* const str1 + , const XMLCh* const str2 + ); + + /** compares str1 and str2 + * + * @param str1 Null-terminated string to compare + * @param str2 Null-terminated string to compare + * @return true if two strings are equal, false if not + * If one string is null, while the other is zero-length string, + * it is considered as equal. + */ + static bool equals + ( + const XMLCh* str1 + , const XMLCh* str2 + ); + + /** compares str1 and str2 + * + * @param str1 string to compare + * @param str2 string to compare + * @param n number of characters to compare + * @return true if two strings are equal, false if not + * If one string is null, while the other is zero-length string, + * it is considered as equal. + */ + static bool equalsN + ( + const XMLCh* str1 + , const XMLCh* str2 + , XMLSize_t n + ); + + static bool equals + ( + const char* str1 + , const char* str2 + ); + + /** compares str1 and str2 + * + * @param str1 string to compare + * @param str2 string to compare + * @param n number of characters to compare + * @return true if two strings are equal, false if not + * If one string is null, while the other is zero-length string, + * it is considered as equal. + */ + static bool equalsN + ( + const char* str1 + , const char* str2 + , XMLSize_t n + ); + + /** Lexicographically compares str1 and str2 + * regions and returns true if they are equal, otherwise false. + * + * A substring of str1 is compared to a substring of + * str2. The result is true if these substrings represent + * identical character sequences. The substring of str1 + * to be compared begins at offset1 and has length charCount. The + * substring of str2 to be compared begins at offset2 and + * has length charCount. The result is false if and only if at least + * one of the following is true: + * offset1 is negative. + * offset2 is negative. + * offset1+charCount is greater than the length of str1. + * offset2+charCount is greater than the length of str2. + * There is some nonnegative integer k less than charCount such that: + * str1.charAt(offset1+k) != str2.charAt(offset2+k) + * + * @param str1 Null-terminated string to compare + * @param offset1 Starting offset of str1 + * @param str2 Null-terminated string to compare + * @param offset2 Starting offset of str2 + * @param charCount The number of characters to compare + * @return true if the specified subregion of str1 exactly + * matches the specified subregion of str2>; false + * otherwise. + */ + static bool regionMatches + ( + const XMLCh* const str1 + , const int offset1 + , const XMLCh* const str2 + , const int offset2 + , const XMLSize_t charCount + ); + + /** Lexicographically compares str1 and str2 + * regions without regard to case and returns true if they are equal, + * otherwise false. + * + * A substring of str1 is compared to a substring of + * str2. The result is true if these substrings represent + * identical character sequences. The substring of str1 + * to be compared begins at offset1 and has length charCount. The + * substring of str2 to be compared begins at offset2 and + * has length charCount. The result is false if and only if at least + * one of the following is true: + * offset1 is negative. + * offset2 is negative. + * offset1+charCount is greater than the length of str1. + * offset2+charCount is greater than the length of str2. + * There is some nonnegative integer k less than charCount such that: + * str1.charAt(offset1+k) != str2.charAt(offset2+k) + * + * @param str1 Null-terminated string to compare + * @param offset1 Starting offset of str1 + * @param str2 Null-terminated string to compare + * @param offset2 Starting offset of str2 + * @param charCount The number of characters to compare + * @return true if the specified subregion of str1 exactly + * matches the specified subregion of str2>; false + * otherwise. + */ + static bool regionIMatches + ( + const XMLCh* const str1 + , const int offset1 + , const XMLCh* const str2 + , const int offset2 + , const XMLSize_t charCount + ); + //@} + + /** @name String copy functions */ + //@{ + /** Copies src, including the terminating null character, to the + * location specified by target. + * + * No overflow checking is performed when strings are copied or appended. + * The behavior of strcpy is undefined if the source and destination strings + * overlap. + * + * @param target Destination string + * @param src Null-terminated source string + */ + static void copyString + ( + char* const target + , const char* const src + ); + + /** Copies src, including the terminating null character, to + * the location specified by target. + * + * No overflow checking is performed when strings are copied or appended. + * The behavior of copyString is undefined if the source and + * destination strings overlap. + * + * @param target Destination string + * @param src Null-terminated source string + */ + static void copyString + ( + XMLCh* const target + , const XMLCh* const src + ); + + /** Copies src, upto a fixed number of characters, to the + * location specified by target. + * + * No overflow checking is performed when strings are copied or appended. + * The behavior of copyNString is undefined if the source and + * destination strings overlap. + * + * @param target Destination string. The size of the buffer should + * atleast be 'maxChars + 1'. + * @param src Null-terminated source string + * @param maxChars The maximum number of characters to copy + */ + static bool copyNString + ( + XMLCh* const target + , const XMLCh* const src + , const XMLSize_t maxChars + ); + //@} + + /** @name Hash functions */ + //@{ + /** Hashes a string given a modulus + * + * @param toHash The string to hash + * @param hashModulus The divisor to be used for hashing + * @return Returns the hash value + */ + static XMLSize_t hash + ( + const char* const toHash + , const XMLSize_t hashModulus + ); + + /** Hashes a string given a modulus + * + * @param toHash The string to hash + * @param hashModulus The divisor to be used for hashing + * @return Returns the hash value + */ + static XMLSize_t hash + ( + const XMLCh* const toHash + , const XMLSize_t hashModulus + ); + + /** Hashes a string given a modulus taking a maximum number of characters + * as the limit + * + * @param toHash The string to hash + * @param numChars The maximum number of characters to consider for hashing + * @param hashModulus The divisor to be used for hashing + * @return Returns the hash value + */ + static XMLSize_t hashN + ( + const XMLCh* const toHash + , const XMLSize_t numChars + , const XMLSize_t hashModulus + ); + + //@} + + /** @name Search functions */ + //@{ + /** + * Provides the index of the first occurrence of a character within a string + * + * @param toSearch The string to search + * @param ch The character to search within the string + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int indexOf(const char* const toSearch, const char ch); + + /** + * Provides the index of the first occurrence of a character within a string + * + * @param toSearch The string to search + * @param ch The character to search within the string + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int indexOf(const XMLCh* const toSearch, const XMLCh ch); + + /** + * Provides the index of the first occurrence of a character within a string + * starting from a given index + * + * @param toSearch The string to search + * @param chToFind The character to search within the string + * @param fromIndex The index to start searching from + * @param manager The MemoryManager to use to allocate objects + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int indexOf + ( + const char* const toSearch + , const char chToFind + , const XMLSize_t fromIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Provides the index of the first occurrence of a character within a string + * starting from a given index + * + * @param toSearch The string to search + * @param chToFind The character to search within the string + * @param fromIndex The index to start searching from + * @param manager The MemoryManager to use to allocate objects + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int indexOf + ( + const XMLCh* const toSearch + , const XMLCh chToFind + , const XMLSize_t fromIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Provides the index of the last occurrence of a character within a string + * + * @param toSearch The string to search + * @param ch The character to search within the string + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int lastIndexOf(const char* const toSearch, const char ch); + + /** + * Provides the index of the last occurrence of a character within a string + * + * @param toSearch The string to search + * @param ch The character to search within the string + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int lastIndexOf(const XMLCh* const toSearch, const XMLCh ch); + + /** + * Provides the index of the last occurrence of a character within a string + * + * @param ch The character to search within the string + * @param toSearch The string to search + * @param toSearchLen The length of the string to search + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int lastIndexOf + ( + const XMLCh ch + , const XMLCh* const toSearch + , const XMLSize_t toSearchLen + ); + + /** + * Provides the index of the last occurrence of a character within a string + * starting backward from a given index + * + * @param toSearch The string to search + * @param chToFind The character to search within the string + * @param fromIndex The index to start backward search from + * @param manager The MemoryManager to use to allocate objects + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int lastIndexOf + ( + const char* const toSearch + , const char chToFind + , const XMLSize_t fromIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Provides the index of the last occurrence of a character within a string + * starting backward from a given index + * + * @param toSearch The string to search + * @param ch The character to search within the string + * @param fromIndex The index to start backward search from + * @param manager The MemoryManager to use to allocate objects + * @return If found, returns the index of the character within the string, + * else returns -1. + */ + static int lastIndexOf + ( + const XMLCh* const toSearch + , const XMLCh ch + , const XMLSize_t fromIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + /** @name Fixed size string movement */ + //@{ + /** Moves X number of chars + * @param targetStr The string to copy the chars to + * @param srcStr The string to copy the chars from + * @param count The number of chars to move + */ + static void moveChars + ( + XMLCh* const targetStr + , const XMLCh* const srcStr + , const XMLSize_t count + ); + + //@} + + /** @name Substring function */ + //@{ + /** Create a substring of a given string. The substring begins at the + * specified beginIndex and extends to the character at index + * endIndex - 1. + * @param targetStr The string to copy the chars to + * @param srcStr The string to copy the chars from + * @param startIndex beginning index, inclusive. + * @param endIndex the ending index, exclusive. + * @param manager The MemoryManager to use to allocate objects + */ + static void subString + ( + char* const targetStr + , const char* const srcStr + , const XMLSize_t startIndex + , const XMLSize_t endIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Create a substring of a given string. The substring begins at the + * specified beginIndex and extends to the character at index + * endIndex - 1. + * @param targetStr The string to copy the chars to + * @param srcStr The string to copy the chars from + * @param startIndex beginning index, inclusive. + * @param endIndex the ending index, exclusive. + * @param manager The MemoryManager to use to allocate objects + */ + static void subString + ( + XMLCh* const targetStr + , const XMLCh* const srcStr + , const XMLSize_t startIndex + , const XMLSize_t endIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Create a substring of a given string. The substring begins at the + * specified beginIndex and extends to the character at index + * endIndex - 1. + * @param targetStr The string to copy the chars to + * @param srcStr The string to copy the chars from + * @param startIndex beginning index, inclusive. + * @param endIndex the ending index, exclusive. + * @param srcStrLength the length of srcStr + * @param manager The MemoryManager to use to allocate objects + */ + static void subString + ( + XMLCh* const targetStr + , const XMLCh* const srcStr + , const XMLSize_t startIndex + , const XMLSize_t endIndex + , const XMLSize_t srcStrLength + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** @name Replication function */ + //@{ + /** Replicates a string + * NOTE: The returned buffer is allocated with the MemoryManager. It is the + * responsibility of the caller to delete it when not longer needed. + * You can call XMLString::release to release this returned buffer. + * + * @param toRep The string to replicate + * @param manager The MemoryManager to use to allocate the string + * @return Returns a pointer to the replicated string + * @see XMLString::release(char**, MemoryManager*) + */ + static char* replicate(const char* const toRep, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Replicates a string + * NOTE: The returned buffer is allocated with the MemoryManager. It is the + * responsibility of the caller to delete it when not longer needed. + * You can call XMLString::release to release this returned buffer. + * + * @param toRep The string to replicate + * @param manager The MemoryManager to use to allocate the string + * @return Returns a pointer to the replicated string + * @see XMLString::release(XMLCh**, MemoryManager*) + */ + static XMLCh* replicate(const XMLCh* const toRep, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + /** @name String query function */ + //@{ + /** Tells if the sub-string appears within a string at the beginning + * @param toTest The string to test + * @param prefix The sub-string that needs to be checked + * @return Returns true if the sub-string was found at the beginning of + * toTest, else false + */ + static bool startsWith + ( + const char* const toTest + , const char* const prefix + ); + + /** Tells if the sub-string appears within a string at the beginning + * @param toTest The string to test + * @param prefix The sub-string that needs to be checked + * @return Returns true if the sub-string was found at the beginning of + * toTest, else false + */ + static bool startsWith + ( + const XMLCh* const toTest + , const XMLCh* const prefix + ); + + /** Tells if the sub-string appears within a string at the beginning + * without regard to case + * + * @param toTest The string to test + * @param prefix The sub-string that needs to be checked + * @return Returns true if the sub-string was found at the beginning of + * toTest, else false + */ + static bool startsWithI + ( + const char* const toTest + , const char* const prefix + ); + + /** Tells if the sub-string appears within a string at the beginning + * without regard to case + * + * @param toTest The string to test + * @param prefix The sub-string that needs to be checked + * + * @return Returns true if the sub-string was found at the beginning + * of toTest, else false + */ + static bool startsWithI + ( + const XMLCh* const toTest + , const XMLCh* const prefix + ); + + /** Tells if the sub-string appears within a string at the end. + * @param toTest The string to test + * @param suffix The sub-string that needs to be checked + * @return Returns true if the sub-string was found at the end of + * toTest, else false + */ + static bool endsWith + ( + const XMLCh* const toTest + , const XMLCh* const suffix + ); + + + /** Tells if a string has any occurrence of any character of another + * string within itself + * @param toSearch The string to be searched + * @param searchList The string from which characters to be searched for are drawn + * @return Returns the pointer to the location where the first occurrence of any + * character from searchList is found, + * else returns 0 + */ + static const XMLCh* findAny + ( + const XMLCh* const toSearch + , const XMLCh* const searchList + ); + + /** Tells if a string has any occurrence of any character of another + * string within itself + * @param toSearch The string to be searched + * @param searchList The string from which characters to be searched for are drawn + * @return Returns the pointer to the location where the first occurrence of any + * character from searchList is found, + * else returns 0 + */ + static XMLCh* findAny + ( + XMLCh* const toSearch + , const XMLCh* const searchList + ); + + /** Tells if a string has pattern within itself + * @param toSearch The string to be searched + * @param pattern The pattern to be located within the string + * @return Returns index to the location where the pattern was + * found, else returns -1 + */ + static int patternMatch + ( + const XMLCh* const toSearch + , const XMLCh* const pattern + ); + + /** Get the length of the string + * @param src The string whose length is to be determined + * @return Returns the length of the string + */ + static XMLSize_t stringLen(const char* const src); + + /** Get the length of the string + * @param src The string whose length is to be determined + * @return Returns the length of the string + */ + static XMLSize_t stringLen(const XMLCh* const src); + + /** + * + * Checks whether an name is a valid NOTATION according to XML 1.0 + * @param name The string to check its NOTATION validity + * @param manager The memory manager + * @return Returns true if name is NOTATION valid, otherwise false + */ + static bool isValidNOTATION(const XMLCh* const name + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Checks whether an name is a valid EncName. + * @param name The string to check its EncName validity + * @return Returns true if name is EncName valid, otherwise false + */ + static bool isValidEncName(const XMLCh* const name); + + /** + * Checks whether a character is within [a-zA-Z]. + * @param theChar the character to check + * @return Returns true if within the range, otherwise false + */ + + static bool isAlpha(XMLCh const theChar); + + /** + * Checks whether a character is within [0-9]. + * @param theChar the character to check + * @return Returns true if within the range, otherwise false + */ + static bool isDigit(XMLCh const theChar); + + /** + * Checks whether a character is within [0-9a-zA-Z]. + * @param theChar the character to check + * @return Returns true if within the range, otherwise false + */ + static bool isAlphaNum(XMLCh const theChar); + + /** + * Checks whether a character is within [0-9a-fA-F]. + * @param theChar the character to check + * @return Returns true if within the range, otherwise false + */ + static bool isHex(XMLCh const theChar); + + /** Find is the string appears in the enum list + * @param toFind the string to be found + * @param enumList the list + * return true if found + */ + static bool isInList(const XMLCh* const toFind, const XMLCh* const enumList); + + //@} + + /** @name Conversion functions */ + //@{ + + /** Converts size to a text string based a given radix + * + * @param toFormat The size to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void sizeToText + ( + const XMLSize_t toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts size to a text string based a given radix + * + * @param toFormat The size to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void sizeToText + ( + const XMLSize_t toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const unsigned int toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const unsigned int toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const unsigned long toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const unsigned long toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const int toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const int toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const long toFormat + , char* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts binary data to a text string based a given radix + * + * @param toFormat The number to convert + * @param toFill The buffer that will hold the output on return. The + * size of this buffer should at least be 'maxChars + 1'. + * @param maxChars The maximum number of output characters that can be + * accepted. If the result will not fit, it is an error. + * @param radix The radix of the input data, based on which the conversion + * @param manager The MemoryManager to use to allocate objects + * will be done + */ + static void binToText + ( + const long toFormat + , XMLCh* const toFill + , const XMLSize_t maxChars + , const unsigned int radix + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Converts a string of decimal chars to a binary value + * + * Note that leading and trailing whitespace is legal and will be ignored + * but the remainder must be all decimal digits. + * + * @param toConvert The string of digits to convert + * @param toFill The unsigned int value to fill with the converted + * value. + * @param manager The MemoryManager to use to allocate objects + */ + static bool textToBin + ( + const XMLCh* const toConvert + , unsigned int& toFill + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Converts a string of decimal chars to a binary value + * + * Note that leading and trailing whitespace is legal and will be ignored, + * + * Only one and either of (+,-) after the leading whitespace, before + * any other characters are allowed. + * + * but the remainder must be all decimal digits. + * + * @param toConvert The string of digits to convert + * @param manager The MemoryManager to use to allocate objects + */ + static int parseInt + ( + const XMLCh* const toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Cut leading chars from a string + * + * @param toCutFrom The string to cut chars from + * @param count The count of leading chars to cut + */ + static void cut + ( + XMLCh* const toCutFrom + , const XMLSize_t count + ); + + /** Transcodes a string to native code-page + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * You can call XMLString::release to release this returned buffer. + * + * @param toTranscode The string to be transcoded + * @param manager The MemoryManager to use to allocate objects + * @return Returns the transcoded string + * @see XMLString::release(XMLCh**, MemoryManager*) + */ + static char* transcode + ( + const XMLCh* const toTranscode + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Transcodes a string to native code-page (DEPRECATED) + * + * Be aware that when transcoding to an external encoding, that each + * Unicode char can create multiple output bytes. So you cannot assume + * a one to one correspondence of input chars to output bytes. + * + * @param toTranscode The string tobe transcoded + * @param toFill The buffer that is filled with the transcoded value. + * The size of this buffer should atleast be 'maxChars + 1'. + * @param maxChars The maximum number of bytes that the output + * buffer can hold (not including the null, which is why + * toFill should be at least maxChars+1.). + * @param manager The MemoryManager to use to allocate objects + * @return Returns true if successful, false if there was an error + */ + static bool transcode + ( + const XMLCh* const toTranscode + , char* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Transcodes a string to native code-page + * + * NOTE: The returned buffer is dynamically allocated and is the + * responsibility of the caller to delete it when not longer needed. + * You can call XMLString::release to release this returned buffer. + * + * @param toTranscode The string to be transcoded + * @param manager The MemoryManager to use to allocate objects + * @return Returns the transcoded string + * @see XMLString::release(char**, MemoryManager*) + */ + static XMLCh* transcode + ( + const char* const toTranscode + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Transcodes a string to native code-page (DEPRECATED) + * @param toTranscode The string tobe transcoded + * @param toFill The buffer that is filled with the transcoded value. + * The size of this buffer should atleast be 'maxChars + 1'. + * @param maxChars The maximum number of characters that the output + * buffer can hold (not including the null, which is why + * toFill should be at least maxChars+1.). + * @param manager The MemoryManager to use to allocate objects + * @return Returns true if successful, false if there was an error + */ + static bool transcode + ( + const char* const toTranscode + , XMLCh* const toFill + , const XMLSize_t maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Trims off extra space characters from the start and end of the string, + * moving the non-space string content back to the start. + * @param toTrim The string to be trimmed. On return this contains the + * trimmed string + */ + static void trim(char* const toTrim); + + /** Trims off extra space characters from the start and end of the string, + * moving the non-space string content back to the start. + * @param toTrim The string to be trimmed. On return this contains + * the trimmed string + */ + static void trim(XMLCh* const toTrim); + + /** Break a string into tokens with space as delimiter, and + * stored in a string vector. The caller owns the string vector + * that is returned, and is responsible for deleting it. + * @param tokenizeSrc String to be tokenized + * @param manager The MemoryManager to use to allocate objects + * @return a vector of all the tokenized string + */ + static BaseRefVectorOf* tokenizeString(const XMLCh* const tokenizeSrc + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + /** @name Formatting functions */ + //@{ + /** Creates a UName from a URI and base name. It is in the form + * {url}name, and is commonly used internally to represent fully + * qualified names when namespaces are enabled. + * + * @param pszURI The URI part of the name + * @param pszName The base part of the name + * @return Returns the complete formatted UName + */ + static XMLCh* makeUName + ( + const XMLCh* const pszURI + , const XMLCh* const pszName + ); + + /** + * Internal function to perform token replacement for strings. + * + * @param errText The text (NULL terminated) where the replacement + * is to be done. The size of this buffer should be + * 'maxChars + 1' to account for the final NULL. + * @param maxChars The size of the output buffer, i.e. the maximum + * number of characters that it will hold. If the result is + * larger, it will be truncated. + * @param text1 Replacement text-one + * @param text2 Replacement text-two + * @param text3 Replacement text-three + * @param text4 Replacement text-four + * @param manager The MemoryManager to use to allocate objects + * @return Returns the count of characters that are outputted + */ + static XMLSize_t replaceTokens + ( + XMLCh* const errText + , const XMLSize_t maxChars + , const XMLCh* const text1 + , const XMLCh* const text2 + , const XMLCh* const text3 + , const XMLCh* const text4 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Converts a string to uppercase + * @param toUpperCase The string which needs to be converted to uppercase. + * On return, this buffer also holds the converted uppercase string + */ + static void upperCase(XMLCh* const toUpperCase); + + /** Converts a string to uppercase + * The routine only uppercases A to Z (other characters not changed). + * @param toUpperCase The string which needs to be converted to uppercase. + * On return, this buffer also holds the converted uppercase string + */ + static void upperCaseASCII(XMLCh* const toUpperCase); + + /** Converts a string to lowercase + * @param toLowerCase The string which needs to be converted to lowercase. + * On return, this buffer also holds the converted lowercase string + */ + static void lowerCase(XMLCh* const toLowerCase); + + /** Converts a string to lowercase + * The routine only lowercases a to z (other characters not changed). + * @param toLowerCase The string which needs to be converted to lowercase. + * On return, this buffer also holds the converted lowercase string + */ + static void lowerCaseASCII(XMLCh* const toLowerCase); + + /** Check if string is WhiteSpace:replace + * @param toCheck The string which needs to be checked. + */ + static bool isWSReplaced(const XMLCh* const toCheck); + + /** Check if string is WhiteSpace:collapse + * @param toCheck The string which needs to be checked. + */ + static bool isWSCollapsed(const XMLCh* const toCheck); + + /** Replace whitespace + * @param toConvert The string which needs to be whitespace replaced. + * On return , this buffer also holds the converted string + * @param manager The MemoryManager to use to allocate objects + */ + static void replaceWS(XMLCh* toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Collapse whitespace + * @param toConvert The string which needs to be whitespace collapsed. + * On return , this buffer also holds the converted string + * @param manager The MemoryManager to use to allocate objects + */ + static void collapseWS(XMLCh* toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** Remove whitespace + * @param toConvert The string which needs to be whitespace removed. + * On return , this buffer also holds the converted string + * @param manager The MemoryManager to use to allocate objects + */ + static void removeWS(XMLCh* toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + + /** Remove character + * @param srcString The string + * @param toRemove The character needs to be removed from the string + * @param dstBuffer The buffer containing the result + */ + static void removeChar(const XMLCh* const srcString + , const XMLCh& toRemove + , XMLBuffer& dstBuffer); + + /** + * Fixes a platform dependent absolute path filename to standard URI form. + * 1. Windows: fix 'x:' to 'file:///x:' and convert any backslash to forward slash + * 2. UNIX: fix '/blah/blahblah' to 'file:///blah/blahblah' + * @param str The string that has the absolute path filename + * @param target The target string pre-allocated to store the fixed uri + */ + static void fixURI(const XMLCh* const str, XMLCh* const target); + + //@} + /** @name String Memory Management functions */ + //@{ + /** + * Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate. + * The implementation will call MemoryManager::deallocate and then turn the string to a null pointer. + * + * @param buf The string to be deleted and become a null pointer. + * @param manager The MemoryManager used to allocate the string + */ + static void release + ( + char** buf + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate. + * The implementation will call MemoryManager::deallocate and then turn the string to a null pointer. + * + * @param buf The string to be deleted and become a null pointer. + * @param manager The MemoryManager used to allocate the string + */ + static void release + ( + XMLCh** buf + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + //@} + + +private : + + /** @name Constructors and Destructor */ + //@{ + /** Unimplemented default constructor */ + XMLString(); + /** Unimplemented destructor */ + ~XMLString(); + //@} + + + /** @name Initialization */ + //@{ + /** Init/Term methods called from XMLPlatformUtils class */ + static void initString(XMLLCPTranscoder* const defToUse, + MemoryManager* const manager); + static void termString(); + //@} + + /** + * Called by regionMatches/regionIMatches to validate that we + * have a valid input + */ + static bool validateRegion(const XMLCh* const str1, const int offset1, + const XMLCh* const str2, const int offset2, + const XMLSize_t charCount); + + static MemoryManager* fgMemoryManager; + + friend class XMLPlatformUtils; +}; + + +// --------------------------------------------------------------------------- +// Inline some methods that are either just passthroughs to other string +// methods, or which are key for performance. +// --------------------------------------------------------------------------- +inline void XMLString::moveChars( XMLCh* const targetStr + , const XMLCh* const srcStr + , const XMLSize_t count) +{ + memcpy(targetStr, srcStr, count * sizeof(XMLCh)); +} + +inline XMLSize_t XMLString::stringLen(const XMLCh* const src) +{ + if (src == 0) + return 0; + + const XMLCh* pszTmp = src; + + while (*pszTmp++) ; + + return (pszTmp - src - 1); +} + +inline XMLCh* XMLString::replicate(const XMLCh* const toRep, + MemoryManager* const manager) +{ + // If a null string, return a null string! + XMLCh* ret = 0; + if (toRep) + { + const XMLSize_t len = stringLen(toRep); + ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1]; + memcpy(ret, toRep, (len + 1) * sizeof(XMLCh)); + } + return ret; +} + +inline bool XMLString::startsWith( const XMLCh* const toTest + , const XMLCh* const prefix) +{ + return (compareNString(toTest, prefix, stringLen(prefix)) == 0); +} + +inline bool XMLString::startsWithI( const XMLCh* const toTest + , const XMLCh* const prefix) +{ + return (compareNIString(toTest, prefix, stringLen(prefix)) == 0); +} + +inline bool XMLString::endsWith(const XMLCh* const toTest, + const XMLCh* const suffix) +{ + + XMLSize_t suffixLen = XMLString::stringLen(suffix); + + return regionMatches(toTest, (int)(XMLString::stringLen(toTest) - suffixLen), + suffix, 0, suffixLen); +} + +inline bool XMLString::validateRegion(const XMLCh* const str1, + const int offset1, + const XMLCh* const str2, + const int offset2, + const XMLSize_t charCount) +{ + + if (offset1 < 0 || offset2 < 0 || + (offset1 + charCount) > XMLString::stringLen(str1) || + (offset2 + charCount) > XMLString::stringLen(str2) ) + return false; + + return true; +} + +inline bool XMLString::equals( const XMLCh* str1 + , const XMLCh* str2) +{ + if (str1 == str2) + return true; + + if (str1 == 0 || str2 == 0) + return ((!str1 || !*str1) && (!str2 || !*str2)); + + while (*str1) + if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL) + return false; + + // either both ended (and *str2 is 0 too), or str2 is longer + return (*str2==0); +} + +inline bool XMLString::equalsN(const XMLCh* str1, + const XMLCh* str2, + XMLSize_t n) +{ + if (str1 == str2 || n == 0) + return true; + + if (str1 == 0 || str2 == 0) + return ((!str1 || !*str1) && (!str2 || !*str2)); + + for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2) + if(*str1 != *str2) + break; + + return n == 0 || *str1 == *str2; // either equal or both ended premat. +} + +inline bool XMLString::equals( const char* str1 + , const char* str2) +{ + if (str1 == str2) + return true; + + if (str1 == 0 || str2 == 0) + return ((!str1 || !*str1) && (!str2 || !*str2)); + + while (*str1) + if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL) + return false; + + // either both ended (and *str2 is 0 too), or str2 is longer + return (*str2==0); +} + +inline bool XMLString::equalsN(const char* str1, + const char* str2, + XMLSize_t n) +{ + if (str1 == str2 || n == 0) + return true; + + if (str1 == 0 || str2 == 0) + return ((!str1 || !*str1) && (!str2 || !*str2)); + + for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2) + if(*str1 != *str2) + break; + + return n == 0 || *str1 == *str2; // either equal or both ended premat. +} + +inline int XMLString::lastIndexOf(const XMLCh* const toSearch, const XMLCh ch) +{ + return XMLString::lastIndexOf(ch, toSearch, stringLen(toSearch)); +} + +inline XMLSize_t XMLString::hash(const XMLCh* const tohash + , const XMLSize_t hashModulus) +{ + if (tohash == 0 || *tohash == 0) + return 0; + + const XMLCh* curCh = tohash; + XMLSize_t hashVal = (XMLSize_t)(*curCh++); + + while (*curCh) + hashVal = (hashVal * 38) + (hashVal >> 24) + (XMLSize_t)(*curCh++); + + // Divide by modulus + return hashVal % hashModulus; +} + +inline XMLSize_t XMLString::hashN(const XMLCh* const tohash + , const XMLSize_t n + , const XMLSize_t hashModulus) +{ + if (tohash == 0 || n == 0) + return 0; + + const XMLCh* curCh = tohash; + XMLSize_t hashVal = (XMLSize_t)(*curCh++); + + for(XMLSize_t i=0;i> 24) + (XMLSize_t)(*curCh++); + + // Divide by modulus + return hashVal % hashModulus; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.cpp b/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.cpp new file mode 100644 index 000000000..9b92bc2d7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.cpp @@ -0,0 +1,177 @@ +/* + * 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: XMLStringTokenizer.cpp 555320 2007-07-11 16:05:13Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: Local const data +// --------------------------------------------------------------------------- +const XMLCh fgDelimeters[] = +{ + chSpace, chHTab, chCR, chLF, chNull +}; + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: Constructors and Destructor +// --------------------------------------------------------------------------- + +typedef JanitorMemFunCall CleanupType; + +XMLStringTokenizer::XMLStringTokenizer( const XMLCh* const srcStr + , MemoryManager* const manager) + : fOffset(0) + , fStringLen(XMLString::stringLen(srcStr)) + , fString(XMLString::replicate(srcStr, manager)) + , fDelimeters(fgDelimeters) + , fTokens(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLStringTokenizer::cleanUp); + + try { + if (fStringLen > 0) { + fTokens = new (fMemoryManager) RefArrayVectorOf(4, true, fMemoryManager); + } + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLStringTokenizer::XMLStringTokenizer(const XMLCh* const srcStr, + const XMLCh* const delim, + MemoryManager* const manager) + : fOffset(0) + , fStringLen(XMLString::stringLen(srcStr)) + , fString(XMLString::replicate(srcStr, manager)) + , fDelimeters(XMLString::replicate(delim, manager)) + , fTokens(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLStringTokenizer::cleanUp); + + try { + if (fStringLen > 0) { + fTokens = new (fMemoryManager) RefArrayVectorOf(4, true, fMemoryManager); + } + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLStringTokenizer::~XMLStringTokenizer() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: CleanUp methods +// --------------------------------------------------------------------------- +void XMLStringTokenizer::cleanUp() { + + fMemoryManager->deallocate(fString);//delete [] fString; + if (fDelimeters != fgDelimeters) { + fMemoryManager->deallocate((void*)fDelimeters);//delete [] fDelimeters; + } + delete fTokens; +} + + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: Management methods +// --------------------------------------------------------------------------- +XMLCh* XMLStringTokenizer::nextToken() { + + if (fOffset >= fStringLen) { + return 0; + } + + bool tokFound = false; + XMLSize_t startIndex = fOffset; + XMLSize_t endIndex = fOffset; + + for (; endIndex < fStringLen; endIndex++) { + + if (isDelimeter(fString[endIndex])) { + + if (tokFound) { + break; + } + + startIndex++; + continue; + } + + tokFound = true; + } + + fOffset = endIndex; + + if (tokFound) { + + XMLCh* tokStr = (XMLCh*) fMemoryManager->allocate + ( + (endIndex - startIndex + 1) * sizeof(XMLCh) + );//new XMLCh[(endIndex - startIndex) + 1]; + + XMLString::subString(tokStr, fString, startIndex, endIndex, fMemoryManager); + fTokens->addElement(tokStr); + + return tokStr; + } + + return 0; +} + + +bool XMLStringTokenizer::hasMoreTokens() { + + if (countTokens() > 0) + return true; + + return false; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XMLStringTokenizer.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.hpp b/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.hpp new file mode 100644 index 000000000..25b7d123d --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLStringTokenizer.hpp @@ -0,0 +1,218 @@ +/* + * 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: XMLStringTokenizer.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRINGTOKENIZER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSTRINGTOKENIZER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * The string tokenizer class breaks a string into tokens. + * + * The XMLStringTokenizer methods do not distinguish among identifiers, + * numbers, and quoted strings, nor do they recognize and skip comments + * + * A XMLStringTokenizer object internally maintains a current position within + * the string to be tokenized. Some operations advance this current position + * past the characters processed. + */ + + + class XMLUTIL_EXPORT XMLStringTokenizer :public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * Constructs a string tokenizer for the specified string. The tokenizer + * uses the default delimiter set, which is "\t\n\r\f": the space + * character, the tab character, the newline character, the + * carriage-return character, and the form-feed character. Delimiter + * characters themselves will not be treated as tokens. + * + * @param srcStr The string to be parsed. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + */ + XMLStringTokenizer(const XMLCh* const srcStr, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Constructs a string tokenizer for the specified string. The characters + * in the delim argument are the delimiters for separating tokens. + * Delimiter characters themselves will not be treated as tokens. + * + * @param srcStr The string to be parsed. + * @param delim The set of delimiters. + * @param manager Pointer to the memory manager to be used to + * allocate objects. + */ + XMLStringTokenizer(const XMLCh* const srcStr + , const XMLCh* const delim + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + // ----------------------------------------------------------------------- + // Public Destructor + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + + ~XMLStringTokenizer(); + + //@} + + // ----------------------------------------------------------------------- + // Management methods + // ----------------------------------------------------------------------- + /** @name Management Function */ + //@{ + + /** + * Tests if there are more tokens available from this tokenizer's string. + * + * Returns true if and only if there is at least one token in the string + * after the current position; false otherwise. + */ + bool hasMoreTokens(); + + /** + * Calculates the number of times that this tokenizer's nextToken method + * can be called to return a valid token. The current position is not + * advanced. + * + * Returns the number of tokens remaining in the string using the current + * delimiter set. + */ + unsigned int countTokens(); + + /** + * Returns the next token from this string tokenizer. + * + * Function allocated, function managed (fafm). The calling function + * does not need to worry about deleting the returned pointer. + */ + XMLCh* nextToken(); + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLStringTokenizer(const XMLStringTokenizer&); + XMLStringTokenizer& operator=(const XMLStringTokenizer&); + + // ----------------------------------------------------------------------- + // CleanUp methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + bool isDelimeter(const XMLCh ch); + + // ----------------------------------------------------------------------- + // Private data members + // + // fOffset + // The current position in the parsed string. + // + // fStringLen + // The length of the string parsed (for convenience). + // + // fString + // The string to be parsed + // + // fDelimeters + // A set of delimiter characters + // + // fTokens + // A vector of the token strings + // ----------------------------------------------------------------------- + XMLSize_t fOffset; + XMLSize_t fStringLen; + XMLCh* fString; + const XMLCh* fDelimeters; + RefArrayVectorOf* fTokens; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: Helper methods +// --------------------------------------------------------------------------- +inline bool XMLStringTokenizer::isDelimeter(const XMLCh ch) { + + return XMLString::indexOf(fDelimeters, ch) == -1 ? false : true; +} + + +// --------------------------------------------------------------------------- +// XMLStringTokenizer: Management methods +// --------------------------------------------------------------------------- +inline unsigned int XMLStringTokenizer::countTokens() { + + if (fStringLen == 0) + return 0; + + unsigned int tokCount = 0; + bool inToken = false; + + for (XMLSize_t i= fOffset; i< fStringLen; i++) { + + if (isDelimeter(fString[i])) { + + if (inToken) { + inToken = false; + } + + continue; + } + + if (!inToken) { + + tokCount++; + inToken = true; + } + + } // end for + + return tokCount; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XMLStringTokenizer.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.cpp new file mode 100644 index 000000000..57a988995 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.cpp @@ -0,0 +1,240 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLUCS4Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLUCS4Transcoder::XMLUCS4Transcoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , const bool swapped + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) + , fSwapped(swapped) +{ +} + + +XMLUCS4Transcoder::~XMLUCS4Transcoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLUCS4Transcoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XMLUCS4Transcoder::transcodeFrom(const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Get pointers to the start and end of the source buffer in terms of + // UCS-4 characters. + // + const UCS4Ch* srcPtr = (const UCS4Ch*)srcData; + const UCS4Ch* srcEnd = srcPtr + (srcCount / sizeof(UCS4Ch)); + + // + // Get pointers to the start and end of the target buffer, which is + // in terms of the XMLCh chars we output. + // + XMLCh* outPtr = toFill; + XMLCh* outEnd = toFill + maxChars; + + // + // And get a pointer into the char sizes buffer. We will run this + // up as we put chars into the output buffer. + // + unsigned char* sizePtr = charSizes; + + // + // Now process chars until we either use up all our source or all of + // our output space. + // + while ((outPtr < outEnd) && (srcPtr < srcEnd)) + { + // + // Get the next UCS char out of the buffer. Don't bump the ptr + // yet since we might not have enough storage for it in the target + // (if its causes a surrogate pair to be created. + // + UCS4Ch nextVal = *srcPtr; + + // If it needs to be swapped, then do it + if (fSwapped) + nextVal = BitOps::swapBytes(nextVal); + + // Handle a surrogate pair if needed + if (nextVal & 0xFFFF0000) + { + // + // If we don't have room for both of the chars, then we + // bail out now. + // + if (outPtr + 1 == outEnd) + break; + + const XMLInt32 LEAD_OFFSET = 0xD800 - (0x10000 >> 10); + const XMLCh ch1 = XMLCh(LEAD_OFFSET + (nextVal >> 10)); + const XMLCh ch2 = XMLCh(0xDC00 + (nextVal & 0x3FF)); + + // + // We have room so store them both. But note that the + // second one took up no source bytes! + // + *sizePtr++ = sizeof(UCS4Ch); + *outPtr++ = ch1; + *sizePtr++ = 0; + *outPtr++ = ch2; + } + else + { + // + // No surrogate, so just store it and bump the count of chars + // read. Update the char sizes buffer for this char's entry. + // + *sizePtr++ = sizeof(UCS4Ch); + *outPtr++ = XMLCh(nextVal); + } + + // Indicate that we ate another UCS char's worth of bytes + srcPtr++; + } + + // Set the bytes eaten parameter + bytesEaten = ((const XMLByte*)srcPtr) - srcData; + + // And return the chars written into the output buffer + return outPtr - toFill; +} + + +XMLSize_t +XMLUCS4Transcoder::transcodeTo( const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts) +{ + // + // Get pointers to the start and end of the source buffer, which + // is in terms of XMLCh chars. + // + const XMLCh* srcPtr = srcData; + const XMLCh* srcEnd = srcData + srcCount; + + // + // Get pointers to the start and end of the target buffer, in terms + // of UCS-4 chars. + // + UCS4Ch* outPtr = (UCS4Ch*)toFill; + UCS4Ch* outEnd = outPtr + (maxBytes / sizeof(UCS4Ch)); + + // + // Now loop until we either run out of source characters or we + // fill up our output buffer. + // + XMLCh trailCh; + while ((outPtr < outEnd) && (srcPtr < srcEnd)) + { + // + // Get out an XMLCh char from the source. Don't bump up the + // pointer yet, since it might be a leading for which we don't + // have the trailing. + // + const XMLCh curCh = *srcPtr; + + // + // If its a leading char of a surrogate pair handle it one way, + // else just cast it over into the target. + // + if ((curCh >= 0xD800) && (curCh <= 0xDBFF)) + { + // + // Ok, we have to have another source char available or we + // just give up without eating the leading char. + // + if (srcPtr + 1 == srcEnd) + break; + + // + // We have the trailing char, so eat the first char and the + // trailing char from the source. + // + srcPtr++; + trailCh = *srcPtr++; + + // + // Then make sure its a legal trailing char. If not, throw + // an exception. + // + if ( !( (trailCh >= 0xDC00) && (trailCh <= 0xDFFF) ) ) + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadTrailingSurrogate, getMemoryManager()); + + // And now combine the two into a single output char + const XMLInt32 SURROGATE_OFFSET = 0x10000 - (0xD800 << 10) - 0xDC00; + *outPtr++ = (curCh << 10) + trailCh + SURROGATE_OFFSET; + } + else + { + // + // Its just a char, so we can take it as is. If we need to + // swap it, then swap it. Because of flakey compilers, use + // a temp first. + // + const UCS4Ch tmpCh = UCS4Ch(curCh); + if (fSwapped) + *outPtr++ = BitOps::swapBytes(tmpCh); + else + *outPtr++ = tmpCh; + + // Bump the source pointer + srcPtr++; + } + } + + // Set the chars we ate from the source + charsEaten = srcPtr - srcData; + + // Return the bytes we wrote to the output + return ((XMLByte*)outPtr) - toFill; +} + + +bool XMLUCS4Transcoder::canTranscodeTo(const unsigned int) +{ + // We can handle anything + return true; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.hpp new file mode 100644 index 000000000..c3537270f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUCS4Transcoder.hpp @@ -0,0 +1,104 @@ +/* + * 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: XMLUCS4Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLUCS4TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLUCS4TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple UCS4 transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XMLUCS4Transcoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLUCS4Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , const bool swapped + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLUCS4Transcoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLUCS4Transcoder(const XMLUCS4Transcoder&); + XMLUCS4Transcoder& operator=(const XMLUCS4Transcoder&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fSwapped + // This tells us if our input is going to be in the same endianness + // as the local host or swapped. + // ----------------------------------------------------------------------- + bool fSwapped; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLURL.cpp b/project/jni/xerces/src/xercesc/util/XMLURL.cpp new file mode 100644 index 000000000..21ebb4d32 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLURL.cpp @@ -0,0 +1,1490 @@ +/* + * 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: XMLURL.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + + +// --------------------------------------------------------------------------- +// Local types +// +// TypeEntry +// This structure defines a single entry in the list of URL types. Each +// entry indicates the prefix for that type of URL, and the SourceTypes +// value it maps to. +// --------------------------------------------------------------------------- +struct ProtoEntry +{ + XMLURL::Protocols protocol; + const XMLCh* prefix; + unsigned int defPort; +}; + + +// --------------------------------------------------------------------------- +// Local data +// +// gXXXString +// These are the strings for our prefix types. They all have to be +// Unicode strings all the time, so we can't just do regular strings. +// +// gProtoList +// The list of URL types that we support and some info related to each +// one. +// +// gMaxProtoLen +// The length of the longest protocol string +// +// NOTE:!!! Be sure to keep this up to date if new protocols are added! +// --------------------------------------------------------------------------- +static const XMLCh gFileString[] = +{ + chLatin_f, chLatin_i, chLatin_l, chLatin_e, chNull +}; + +static const XMLCh gFTPString[] = +{ + chLatin_f, chLatin_t, chLatin_p, chNull +}; + +static const XMLCh gHTTPString[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chNull +}; + +static const XMLCh gHTTPSString[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chLatin_s, chNull +}; + +static ProtoEntry gProtoList[XMLURL::Protocols_Count] = +{ + { XMLURL::File , gFileString , 0 } + , { XMLURL::HTTP , gHTTPString , 80 } + , { XMLURL::FTP , gFTPString , 21 } + , { XMLURL::HTTPS , gHTTPSString , 443 } +}; + +// !!! Keep these up to date with list above! +static const unsigned int gMaxProtoLen = 5; + +static const XMLCh gListOne[] = { chColon, chForwardSlash, chNull }; +static const XMLCh gListTwo[] = { chAt, chNull }; +static const XMLCh gListThree[] = { chColon, chNull }; +static const XMLCh gListFour[] = { chForwardSlash, chNull }; +static const XMLCh gListFive[] = { chPound, chQuestion, chNull }; +static const XMLCh gListSix[] = { chPound, chNull }; + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- +static bool isHexDigit(const XMLCh toCheck) +{ + if (((toCheck >= chDigit_0) && (toCheck <= chDigit_9)) + || ((toCheck >= chLatin_A) && (toCheck <= chLatin_Z)) + || ((toCheck >= chLatin_a) && (toCheck <= chLatin_z))) + { + return true; + } + return false; +} + +static unsigned int xlatHexDigit(const XMLCh toXlat) +{ + if ((toXlat >= chDigit_0) && (toXlat <= chDigit_9)) + return (unsigned int)(toXlat - chDigit_0); + + if ((toXlat >= chLatin_A) && (toXlat <= chLatin_Z)) + return (unsigned int)(toXlat - chLatin_A) + 10; + + return (unsigned int)(toXlat - chLatin_a) + 10; +} + + + +// --------------------------------------------------------------------------- +// XMLURL: Public, static methods +// --------------------------------------------------------------------------- +XMLURL::Protocols XMLURL::lookupByName(const XMLCh* const protoName) +{ + for (unsigned int index = 0; index < XMLURL::Protocols_Count; index++) + { + if (!XMLString::compareIStringASCII(protoName, gProtoList[index].prefix)) + return gProtoList[index].protocol; + } + return XMLURL::Unknown; +} + + + +// --------------------------------------------------------------------------- +// XMLURL: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLURL::XMLURL(MemoryManager* const manager) : + + fMemoryManager(manager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ +} + +typedef JanitorMemFunCall CleanupType; + +XMLURL::XMLURL(const XMLCh* const baseURL + , const XMLCh* const relativeURL + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + try + { + setURL(baseURL, relativeURL); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const XMLCh* const baseURL + , const char* const relativeURL + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + XMLCh* tmpRel = XMLString::transcode(relativeURL, fMemoryManager); + ArrayJanitor janRel(tmpRel, fMemoryManager); + try + { + setURL(baseURL, tmpRel); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const XMLURL& baseURL + , const XMLCh* const relativeURL) : + + fMemoryManager(baseURL.fMemoryManager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + try + { + setURL(baseURL, relativeURL); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const XMLURL& baseURL + , const char* const relativeURL) : + + fMemoryManager(baseURL.fMemoryManager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + XMLCh* tmpRel = XMLString::transcode(relativeURL, fMemoryManager); + ArrayJanitor janRel(tmpRel, fMemoryManager); + try + { + setURL(baseURL, tmpRel); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const XMLCh* const urlText, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + try + { + setURL(urlText); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const char* const urlText, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(0) + , fProtocol(XMLURL::Unknown) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(false) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + XMLCh* tmpText = XMLString::transcode(urlText, fMemoryManager); + ArrayJanitor janRel(tmpText, fMemoryManager); + try + { + setURL(tmpText); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::XMLURL(const XMLURL& toCopy) : + XMemory(toCopy) + , fMemoryManager(toCopy.fMemoryManager) + , fFragment(0) + , fHost(0) + , fPassword(0) + , fPath(0) + , fPortNum(toCopy.fPortNum) + , fProtocol(toCopy.fProtocol) + , fQuery(0) + , fUser(0) + , fURLText(0) + , fHasInvalidChar(toCopy.fHasInvalidChar) +{ + CleanupType cleanup(this, &XMLURL::cleanUp); + + try + { + fFragment = XMLString::replicate(toCopy.fFragment, fMemoryManager); + fHost = XMLString::replicate(toCopy.fHost, fMemoryManager); + fPassword = XMLString::replicate(toCopy.fPassword, fMemoryManager); + fPath = XMLString::replicate(toCopy.fPath, fMemoryManager); + fQuery = XMLString::replicate(toCopy.fQuery, fMemoryManager); + fUser = XMLString::replicate(toCopy.fUser, fMemoryManager); + fURLText = XMLString::replicate(toCopy.fURLText, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLURL::~XMLURL() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// XMLURL: Public operators +// --------------------------------------------------------------------------- +XMLURL& XMLURL::operator=(const XMLURL& toAssign) +{ + if (this == &toAssign) + return *this; + + // Clean up our stuff + cleanUp(); + + // And copy his stuff + fMemoryManager = toAssign.fMemoryManager; + fFragment = XMLString::replicate(toAssign.fFragment, fMemoryManager); + fHost = XMLString::replicate(toAssign.fHost, fMemoryManager); + fPassword = XMLString::replicate(toAssign.fPassword, fMemoryManager); + fPath = XMLString::replicate(toAssign.fPath, fMemoryManager); + fPortNum = toAssign.fPortNum; + fProtocol = toAssign.fProtocol; + fQuery = XMLString::replicate(toAssign.fQuery, fMemoryManager); + fUser = XMLString::replicate(toAssign.fUser, fMemoryManager); + fURLText = XMLString::replicate(toAssign.fURLText, fMemoryManager); + fHasInvalidChar = toAssign.fHasInvalidChar; + + return *this; +} + +bool XMLURL::operator==(const XMLURL& toCompare) const +{ + // + // Compare the two complete URLs (which have been processed the same + // way so they should now be the same even if they came in via different + // relative parts. + // + if (!XMLString::equals(getURLText(), toCompare.getURLText())) + return false; + + return true; +} + + + +// --------------------------------------------------------------------------- +// XMLURL: Getter methods +// --------------------------------------------------------------------------- +unsigned int XMLURL::getPortNum() const +{ + // + // If it was not provided explicitly, then lets return the default one + // for the protocol. + // + if (!fPortNum) + { + if (fProtocol == Unknown) + return 0; + return gProtoList[fProtocol].defPort; + } + return fPortNum; +} + + +const XMLCh* XMLURL::getProtocolName() const +{ + // Check to see if its ever been set + if (fProtocol == Unknown) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + + return gProtoList[fProtocol].prefix; +} + + +// --------------------------------------------------------------------------- +// XMLURL: Setter methods +// --------------------------------------------------------------------------- +void XMLURL::setURL(const XMLCh* const urlText) +{ + // + // Try to parse the URL. + // + cleanUp(); + parse(urlText); +} + +void XMLURL::setURL(const XMLCh* const baseURL + , const XMLCh* const relativeURL) +{ + cleanUp(); + + // Parse our URL string + parse(relativeURL); + + // + // If its relative and the base is non-null and non-empty, then + // parse the base URL string and conglomerate them. + // + if (isRelative() && baseURL) + { + if (*baseURL) + { + XMLURL basePart(baseURL, fMemoryManager); + if (!conglomerateWithBase(basePart, false)) + { + cleanUp(); + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_RelativeBaseURL, fMemoryManager); + } + } + } +} + +// this version of setURL doesn't throw a malformedurl exception +// instead it returns false when it failed (or when it would of +// thrown a malformedurl exception) +bool XMLURL::setURL(const XMLCh* const baseURL + , const XMLCh* const relativeURL + , XMLURL& xmlURL) +{ + cleanUp(); + + // Parse our URL string + if (parse(relativeURL, xmlURL)) + { + // If its relative and the base is non-null and non-empty, then + // parse the base URL string and conglomerate them. + // + if (isRelative() && baseURL && *baseURL) + { + XMLURL basePart(fMemoryManager); + if (parse(baseURL, basePart) && conglomerateWithBase(basePart, false)) + { + return true; + } + } + else + return true; + } + return false; +} + +void XMLURL::setURL(const XMLURL& baseURL + , const XMLCh* const relativeURL) +{ + cleanUp(); + + // Parse our URL string + parse(relativeURL); + + // If its relative, then conglomerate with the base URL + if (isRelative()) + conglomerateWithBase(baseURL); +} + + +// --------------------------------------------------------------------------- +// XMLURL: Miscellaneous methods +// --------------------------------------------------------------------------- +bool XMLURL::isRelative() const +{ + // If no protocol then relative + if (fProtocol == Unknown) + return true; + + // If no path, or the path is not absolute, then relative + if (!fPath) + return true; + + if (*fPath != chForwardSlash) + return true; + + return false; +} + + +bool XMLURL::hasInvalidChar() const { + return fHasInvalidChar; +} + + +BinInputStream* XMLURL::makeNewStream() const +{ + // + // If its a local host, then we short circuit it and use our own file + // stream support. Otherwise, we just let it fall through and let the + // installed network access object provide a stream. + // + if (fProtocol == XMLURL::File) + { + if (!fHost || !XMLString::compareIStringASCII(fHost, XMLUni::fgLocalHostString)) + { + + XMLCh* realPath = XMLString::replicate(fPath, fMemoryManager); + ArrayJanitor basePathName(realPath, fMemoryManager); + + // + // Need to manually replace any character reference %xx first + // HTTP protocol will be done automatically by the netaccessor + // + XMLSize_t end = XMLString::stringLen(realPath); + int percentIndex = XMLString::indexOf(realPath, chPercent, 0, fMemoryManager); + + while (percentIndex != -1) { + + if (percentIndex+2 >= (int)end || + !isHexDigit(realPath[percentIndex+1]) || + !isHexDigit(realPath[percentIndex+2])) + { + XMLCh value1[4]; + XMLString::moveChars(value1, &(realPath[percentIndex]), 3); + value1[3] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , realPath + , value1 + , fMemoryManager); + } + + unsigned int value = (xlatHexDigit(realPath[percentIndex+1]) * 16) + xlatHexDigit(realPath[percentIndex+2]); + + realPath[percentIndex] = XMLCh(value); + + XMLSize_t i =0; + for (i = percentIndex + 1; i < end - 2 ; i++) + realPath[i] = realPath[i+2]; + realPath[i] = chNull; + end = i; + + if (((XMLSize_t)(percentIndex + 1)) < end) + percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex + 1, fMemoryManager); + else + percentIndex = -1; + } + + + BinFileInputStream* retStrm = new (fMemoryManager) BinFileInputStream(realPath, fMemoryManager); + if (!retStrm->getIsOpen()) + { + delete retStrm; + return 0; + } + return retStrm; + } + } + + // + // If we don't have have an installed net accessor object, then we + // have to just throw here. + // + if (!XMLPlatformUtils::fgNetAccessor) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_UnsupportedProto, fMemoryManager); + + // Else ask the net accessor to create the stream + return XMLPlatformUtils::fgNetAccessor->makeNew(*this); +} + +void XMLURL::makeRelativeTo(const XMLCh* const baseURLText) +{ + // If this one is not relative, don't bother + if (!isRelative()) + return; + + XMLURL baseURL(baseURLText, fMemoryManager); + conglomerateWithBase(baseURL); +} + +void XMLURL::makeRelativeTo(const XMLURL& baseURL) +{ + // If this one is not relative, don't bother + if (!isRelative()) + return; + conglomerateWithBase(baseURL); +} + + + + +// --------------------------------------------------------------------------- +// XMLURL: Private helper methods +// --------------------------------------------------------------------------- + +// +// This method will take the broken out parts of the URL and build up the +// full text. We don't do this unless someone asks us to, since its often +// never required. +// +void XMLURL::buildFullText() +{ + // Calculate the worst case size of the buffer required + XMLSize_t bufSize = gMaxProtoLen + 1 + + XMLString::stringLen(fFragment) + 1 + + XMLString::stringLen(fHost) + 2 + + XMLString::stringLen(fPassword) + 1 + + XMLString::stringLen(fPath) + + XMLString::stringLen(fQuery) + 1 + + XMLString::stringLen(fUser) + 1 + + 32; + + // Clean up the existing buffer and allocate another + fMemoryManager->deallocate(fURLText);//delete [] fURLText; + fURLText = (XMLCh*) fMemoryManager->allocate((bufSize) * sizeof(XMLCh));//new XMLCh[bufSize]; + *fURLText = 0; + + XMLCh* outPtr = fURLText; + if (fProtocol != Unknown) + { + XMLString::catString(fURLText, getProtocolName()); + outPtr += XMLString::stringLen(fURLText); + *outPtr++ = chColon; + *outPtr++ = chForwardSlash; + *outPtr++ = chForwardSlash; + } + + if (fUser) + { + XMLString::copyString(outPtr, fUser); + outPtr += XMLString::stringLen(fUser); + + if (fPassword) + { + *outPtr++ = chColon; + XMLString::copyString(outPtr, fPassword); + outPtr += XMLString::stringLen(fPassword); + } + + *outPtr++ = chAt; + } + + if (fHost) + { + XMLString::copyString(outPtr, fHost); + outPtr += XMLString::stringLen(fHost); + + // + // If the port is zero, then we don't put it in. Else we need + // to because it was explicitly provided. + // + if (fPortNum) + { + *outPtr++ = chColon; + + XMLCh tmpBuf[17]; + XMLString::binToText(fPortNum, tmpBuf, 16, 10, fMemoryManager); + XMLString::copyString(outPtr, tmpBuf); + outPtr += XMLString::stringLen(tmpBuf); + } + } + + if (fPath) + { + XMLString::copyString(outPtr, fPath); + outPtr += XMLString::stringLen(fPath); + } + + if (fQuery) + { + *outPtr++ = chQuestion; + XMLString::copyString(outPtr, fQuery); + outPtr += XMLString::stringLen(fQuery); + } + + if (fFragment) + { + *outPtr++ = chPound; + XMLString::copyString(outPtr, fFragment); + outPtr += XMLString::stringLen(fFragment); + } + + // Cap it off in case the last op was not a string copy + *outPtr = 0; +} + + +// +// Just a central place to handle cleanup, since its done from a number +// of different spots. +// +void XMLURL::cleanUp() +{ + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + fMemoryManager->deallocate(fHost);//delete [] fHost; + fMemoryManager->deallocate(fPassword);//delete [] fPassword; + fMemoryManager->deallocate(fPath);//delete [] fPath; + fMemoryManager->deallocate(fQuery);//delete [] fQuery; + fMemoryManager->deallocate(fUser);//delete [] fUser; + fMemoryManager->deallocate(fURLText);//delete [] fURLText; + + fFragment = 0; + fHost = 0; + fPassword = 0; + fPath = 0; + fQuery = 0; + fUser = 0; + fURLText = 0; + + fProtocol = Unknown; + fPortNum = 0; + fHasInvalidChar = false; +} + + +//This function has been modified to take a bool parameter and the +//functionality inside looks irrational but is only to make +//solaris 2.7 CC 5.0 optimized build happy. + +bool XMLURL::conglomerateWithBase(const XMLURL& baseURL, bool useExceptions) +{ + // The base URL cannot be relative + if (baseURL.isRelative()) + { + if (useExceptions) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_RelativeBaseURL, fMemoryManager); + else + return false; + } + + // + // Check a special case. If all we have is a fragment, then we want + // to just take the base host and path, plus our fragment. + // + if ((fProtocol == Unknown) + && !fHost + && !fPath + && fFragment) + { + // Just in case, make sure we don't leak the user or password values + fMemoryManager->deallocate(fUser);//delete [] fUser; + fUser = 0; + fMemoryManager->deallocate(fPassword);//delete [] fPassword; + fPassword = 0; + + // Copy over the protocol and port number as is + fProtocol = baseURL.fProtocol; + fPortNum = baseURL.fPortNum; + + // Replicate the base fields that are provided + fHost = XMLString::replicate(baseURL.fHost, fMemoryManager); + fUser = XMLString::replicate(baseURL.fUser, fMemoryManager); + fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager); + fPath = XMLString::replicate(baseURL.fPath, fMemoryManager); + return true; + } + + // + // All we have to do is run up through our fields and, for each one + // that we don't have, use the based URL's. Once we hit one field + // that we have, we stop. + // + if (fProtocol != Unknown) + return true; + fProtocol = baseURL.fProtocol; + + // + // If the protocol is not file, and we either already have our own + // host, or the base does not have one, then we are done. + // + if (fProtocol != File) + { + if (fHost || !baseURL.fHost) + return true; + } + + // Replicate all of the hosty stuff if the base has one + if (baseURL.fHost) + { + // Just in case, make sure we don't leak a user or password field + fMemoryManager->deallocate(fUser);//delete [] fUser; + fUser = 0; + fMemoryManager->deallocate(fPassword);//delete [] fPassword; + fPassword = 0; + fMemoryManager->deallocate(fHost);//delete [] fHost; + fHost = 0; + + fHost = XMLString::replicate(baseURL.fHost, fMemoryManager); + fUser = XMLString::replicate(baseURL.fUser, fMemoryManager); + fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager); + + fPortNum = baseURL.fPortNum; + } + + // If we have a path and its absolute, then we are done + const bool hadPath = (fPath != 0); + if (hadPath) + { + if (*fPath == chForwardSlash) + return true; + } + + // Its a relative path, so weave them together. + if (baseURL.fPath) { + XMLCh* temp = XMLPlatformUtils::weavePaths(baseURL.fPath, fPath ,fMemoryManager); + fMemoryManager->deallocate(fPath);//delete [] fPath; + fPath = temp; + } + + // If we had any original path, then we are done + if (hadPath) + return true; + + // We had no original path, so go on to deal with the query/fragment parts + if (fQuery || !baseURL.fQuery) + return true; + fQuery = XMLString::replicate(baseURL.fQuery, fMemoryManager); + + if (fFragment || !baseURL.fFragment) + return true; + fFragment = XMLString::replicate(baseURL.fFragment, fMemoryManager); + return true; +} + + +void XMLURL::parse(const XMLCh* const urlText) +{ + // Simplify things by checking for the psycho scenarios first + if (!*urlText) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + + // Before we start, check if this urlText contains valid uri characters + if (!XMLUri::isURIString(urlText)) + fHasInvalidChar = true; + else + fHasInvalidChar = false; + + // + // The first thing we will do is to check for a file name, so that + // we don't waste time thinking its a URL. If its in the form x:\ or x:/ + // and x is an ASCII letter, then assume that's the deal. + // + if (((*urlText >= chLatin_A) && (*urlText <= chLatin_Z)) + || ((*urlText >= chLatin_a) && (*urlText <= chLatin_z))) + { + if (*(urlText + 1) == chColon) + { + if ((*(urlText + 2) == chForwardSlash) + || (*(urlText + 2) == chBackSlash)) + { + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + } + } + } + + // Get a copy of the URL that we can modify + XMLCh* srcCpy = XMLString::replicate(urlText, fMemoryManager); + ArrayJanitor janSrcCopy(srcCpy, fMemoryManager); + + // + // Get a pointer now that we can run up thrown the source as we parse + // bits and pieces out of it. + // + XMLCh* srcPtr = srcCpy; + + // Run up past any spaces + while (*srcPtr) + { + if (!XMLChar1_0::isWhitespace(*srcPtr)) + break; + srcPtr++; + } + + // Make sure it wasn't all space + if (!*srcPtr) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_NoProtocolPresent, fMemoryManager); + + // + // Ok, the next thing we have to do is to find either a / or : character. + // If the : is first, we assume we have a protocol. If the / is first, + // then we skip to the host processing. + // + XMLCh* ptr1 = XMLString::findAny(srcPtr, gListOne); + XMLCh* ptr2; + + // If we found a protocol, then deal with it + if (ptr1) + { + if (*ptr1 == chColon) + { + // Cap the string at the colon + *ptr1 = 0; + + // And try to find it in our list of protocols + fProtocol = lookupByName(srcPtr); + + if (fProtocol == Unknown) + { + ThrowXMLwithMemMgr1 + ( + MalformedURLException + , XMLExcepts::URL_UnsupportedProto1 + , srcPtr + , fMemoryManager + ); + } + + // And move our source pointer up past what we've processed + srcPtr = (ptr1 + 1); + } + } + + // + // Ok, next we need to see if we have any host part. If the next + // two characters are //, then we need to check, else move on. + // + if ((*srcPtr == chForwardSlash) && (*(srcPtr + 1) == chForwardSlash)) + { + // Move up past the slashes + srcPtr += 2; + + // + // If we aren't at the end of the string, then there has to be a + // host part at this point. we will just look for the next / char + // or end of string and make all of that the host for now. + // + if (*srcPtr) + { + // Search from here for a / character + ptr1 = XMLString::findAny(srcPtr, gListFour); + + // + // If we found something, then the host is between where + // we are and what we found. Else the host is the rest of + // the content and we are done. If its empty, leave it null. + // + if (ptr1) + { + if (ptr1 != srcPtr) + { + fMemoryManager->deallocate(fHost);//delete [] fHost; + fHost = (XMLCh*) fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = fHost; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + } + else + { + fMemoryManager->deallocate(fHost);//delete [] fHost; + fHost = XMLString::replicate(srcPtr, fMemoryManager); + + // Update source pointer to the end + srcPtr += XMLString::stringLen(fHost); + } + } + } + else + { + // + // http protocol requires two forward slashes + // we didn't get them, so throw an exception + // + if (fProtocol == HTTP) { + ThrowXMLwithMemMgr + ( + MalformedURLException + , XMLExcepts::URL_ExpectingTwoSlashes + , fMemoryManager + ); + } + } + + // + // If there was a host part, then we have to grovel through it for + // all the bits and pieces it can hold. + // + if (fHost) + { + // + // Look for a '@' character, which indicates a user name. If we + // find one, then everything between the start of the host data + // and the character is the user name. + // + ptr1 = XMLString::findAny(fHost, gListTwo); + if (ptr1) + { + // Get this info out as the user name + *ptr1 = 0; + fMemoryManager->deallocate(fUser);//delete [] fUser; + fUser = XMLString::replicate(fHost, fMemoryManager); + ptr1++; + + // And now cut these chars from the host string + XMLString::cut(fHost, ptr1 - fHost); + + // Is there a password inside the user string? + ptr2 = XMLString::findAny(fUser, gListThree); + if (ptr2) + { + // Remove it from the user name string + *ptr2 = 0; + + // And copy out the remainder to the password field + ptr2++; + fMemoryManager->deallocate(fPassword);//delete [] fPassword; + fPassword = XMLString::replicate(ptr2, fMemoryManager); + } + } + + // + // Ok, so now we are at the actual host name, if any. If we are + // not at the end of the host data, then lets see if we have a + // port trailing the + // + ptr1 = XMLString::findAny(fHost, gListThree); + if (ptr1) + { + // Remove it from the host name + *ptr1 = 0; + + // Try to convert it to a numeric port value and store it + ptr1++; + if (!XMLString::textToBin(ptr1, fPortNum, fMemoryManager)) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_BadPortField, fMemoryManager); + } + + // If the host ended up empty, then toss is + if (!*fHost) + { + fMemoryManager->deallocate(fHost);//delete[] fHost; + fHost = 0; + } + } + + // If we are at the end, then we are done now + if (!*srcPtr) { + if(fHost) { + static const XMLCh slash[] = { chForwardSlash, chNull }; + fPath = XMLString::replicate(slash, fMemoryManager); + } + return; + } + + // + // Next is the path part. It can be absolute, i.e. starting with a + // forward slash character, or relative. Its basically everything up + // to the end of the string or to any trailing query or fragment. + // + ptr1 = XMLString::findAny(srcPtr, gListFive); + if (!ptr1) + { + fMemoryManager->deallocate(fPath);//delete [] fPath; + fPath = XMLString::replicate(srcPtr, fMemoryManager); + return; + } + + // Everything from where we are to what we found is the path + if (ptr1 > srcPtr) + { + fMemoryManager->deallocate(fPath);//delete [] fPath; + fPath = (XMLCh*) fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = fPath; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + + // + // If we found a fragment, then it is the rest of the string and we + // are done. + // + if (*srcPtr == chPound) + { + srcPtr++; + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + fFragment = XMLString::replicate(srcPtr, fMemoryManager); + return; + } + + // + // The query is either the rest of the string, or up to the fragment + // separator. + // + srcPtr++; + ptr1 = XMLString::findAny(srcPtr, gListSix); + fMemoryManager->deallocate(fQuery);//delete [] fQuery; + if (!ptr1) + { + fQuery = XMLString::replicate(srcPtr, fMemoryManager); + return; + } + else + { + fQuery = (XMLCh*) fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = fQuery; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + + // If we are not at the end now, then everything else is the fragment + if (*srcPtr == chPound) + { + srcPtr++; + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + fFragment = XMLString::replicate(srcPtr, fMemoryManager); + } +} + +bool XMLURL::parse(const XMLCh* const urlText, XMLURL& xmlURL) +{ + // Simplify things by checking for the psycho scenarios first + if (!*urlText) + return false; + + // Before we start, check if this urlText contains valid uri characters + if (!XMLUri::isURIString(urlText)) + xmlURL.fHasInvalidChar = true; + else + xmlURL.fHasInvalidChar = false; + + // + // The first thing we will do is to check for a file name, so that + // we don't waste time thinking its a URL. If its in the form x:\ or x:/ + // and x is an ASCII letter, then assume that's the deal. + // + if (((*urlText >= chLatin_A) && (*urlText <= chLatin_Z)) + || ((*urlText >= chLatin_a) && (*urlText <= chLatin_z))) + { + if (*(urlText + 1) == chColon) + { + if ((*(urlText + 2) == chForwardSlash) + || (*(urlText + 2) == chBackSlash)) + { + return false; + } + } + } + + // Get a copy of the URL that we can modify + XMLCh* srcCpy = XMLString::replicate(urlText, xmlURL.fMemoryManager); + ArrayJanitor janSrcCopy(srcCpy, xmlURL.fMemoryManager); + + // + // Get a pointer now that we can run up thrown the source as we parse + // bits and pieces out of it. + // + XMLCh* srcPtr = srcCpy; + + // Run up past any spaces + while (*srcPtr) + { + if (!XMLChar1_0::isWhitespace(*srcPtr)) + break; + srcPtr++; + } + + // Make sure it wasn't all space + if (!*srcPtr) + return false; + + // + // Ok, the next thing we have to do is to find either a / or : character. + // If the : is first, we assume we have a protocol. If the / is first, + // then we skip to the host processing. + // + XMLCh* ptr1 = XMLString::findAny(srcPtr, gListOne); + XMLCh* ptr2; + + // If we found a protocol, then deal with it + if (ptr1) + { + if (*ptr1 == chColon) + { + // Cap the string at the colon + *ptr1 = 0; + + // And try to find it in our list of protocols + xmlURL.fProtocol = lookupByName(srcPtr); + + if (xmlURL.fProtocol == Unknown) + return false; + + // And move our source pointer up past what we've processed + srcPtr = (ptr1 + 1); + } + } + + // + // Ok, next we need to see if we have any host part. If the next + // two characters are //, then we need to check, else move on. + // + if ((*srcPtr == chForwardSlash) && (*(srcPtr + 1) == chForwardSlash)) + { + // Move up past the slashes + srcPtr += 2; + + // + // If we aren't at the end of the string, then there has to be a + // host part at this point. we will just look for the next / char + // or end of string and make all of that the host for now. + // + if (*srcPtr) + { + // Search from here for a / character + ptr1 = XMLString::findAny(srcPtr, gListFour); + + // + // If we found something, then the host is between where + // we are and what we found. Else the host is the rest of + // the content and we are done. If its empty, leave it null. + // + if (ptr1) + { + if (ptr1 != srcPtr) + { + xmlURL.fHost = (XMLCh*) xmlURL.fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = xmlURL.fHost; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + } + else + { + xmlURL.fHost = XMLString::replicate(srcPtr, xmlURL.fMemoryManager); + + // Update source pointer to the end + srcPtr += XMLString::stringLen(xmlURL.fHost); + } + } + } + else + { + // + // http protocol requires two forward slashes + // we didn't get them, so throw an exception + // + if (xmlURL.fProtocol == HTTP) + return false; + } + + // + // If there was a host part, then we have to grovel through it for + // all the bits and pieces it can hold. + // + if (xmlURL.fHost) + { + // + // Look for a '@' character, which indicates a user name. If we + // find one, then everything between the start of the host data + // and the character is the user name. + // + ptr1 = XMLString::findAny(xmlURL.fHost, gListTwo); + if (ptr1) + { + // Get this info out as the user name + *ptr1 = 0; + xmlURL.fUser = XMLString::replicate(xmlURL.fHost, xmlURL.fMemoryManager); + ptr1++; + + // And now cut these chars from the host string + XMLString::cut(xmlURL.fHost, ptr1 - xmlURL.fHost); + + // Is there a password inside the user string? + ptr2 = XMLString::findAny(xmlURL.fUser, gListThree); + if (ptr2) + { + // Remove it from the user name string + *ptr2 = 0; + + // And copy out the remainder to the password field + ptr2++; + xmlURL.fPassword = XMLString::replicate(ptr2, xmlURL.fMemoryManager); + } + } + + // + // Ok, so now we are at the actual host name, if any. If we are + // not at the end of the host data, then lets see if we have a + // port trailing the + // + ptr1 = XMLString::findAny(xmlURL.fHost, gListThree); + if (ptr1) + { + // Remove it from the host name + *ptr1 = 0; + + // Try to convert it to a numeric port value and store it + ptr1++; + if (!XMLString::textToBin(ptr1, xmlURL.fPortNum, xmlURL.fMemoryManager)) + return false; + } + + // If the host ended up empty, then toss is + if (!*(xmlURL.fHost)) + { + xmlURL.fMemoryManager->deallocate(xmlURL.fHost);//delete[] fHost; + xmlURL.fHost = 0; + } + } + + // If we are at the end, then we are done now + if (!*srcPtr) { + if(xmlURL.fHost) { + static const XMLCh slash[] = { chForwardSlash, chNull }; + xmlURL.fPath = XMLString::replicate(slash, xmlURL.fMemoryManager); + } + return true; + } + + // + // Next is the path part. It can be absolute, i.e. starting with a + // forward slash character, or relative. Its basically everything up + // to the end of the string or to any trailing query or fragment. + // + ptr1 = XMLString::findAny(srcPtr, gListFive); + if (!ptr1) + { + xmlURL.fPath = XMLString::replicate(srcPtr, xmlURL.fMemoryManager); + return true; + } + + // Everything from where we are to what we found is the path + if (ptr1 > srcPtr) + { + xmlURL.fPath = (XMLCh*) xmlURL.fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = xmlURL.fPath; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + + // + // If we found a fragment, then it is the rest of the string and we + // are done. + // + if (*srcPtr == chPound) + { + srcPtr++; + xmlURL.fFragment = XMLString::replicate(srcPtr, xmlURL.fMemoryManager); + return true; + } + + // + // The query is either the rest of the string, or up to the fragment + // separator. + // + srcPtr++; + ptr1 = XMLString::findAny(srcPtr, gListSix); + if (!ptr1) + { + xmlURL.fQuery = XMLString::replicate(srcPtr, xmlURL.fMemoryManager); + return true; + } + else + { + xmlURL.fQuery = (XMLCh*) xmlURL.fMemoryManager->allocate + ( + ((ptr1 - srcPtr) + 1) * sizeof(XMLCh) + );//new XMLCh[(ptr1 - srcPtr) + 1]; + ptr2 = xmlURL.fQuery; + while (srcPtr < ptr1) + *ptr2++ = *srcPtr++; + *ptr2 = 0; + } + + // If we are not at the end now, then everything else is the fragment + if (*srcPtr == chPound) + { + srcPtr++; + xmlURL.fFragment = XMLString::replicate(srcPtr, xmlURL.fMemoryManager); + } + + return true; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLURL.hpp b/project/jni/xerces/src/xercesc/util/XMLURL.hpp new file mode 100644 index 000000000..3cf76969f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLURL.hpp @@ -0,0 +1,292 @@ +/* + * 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: XMLURL.hpp 536133 2007-05-08 09:05:14Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLURL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLURL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class BinInputStream; + +// +// This class supports file, http, and ftp style URLs. All others are +// rejected +// +class XMLUTIL_EXPORT XMLURL : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Class types + // + // And they must remain in this order because they are indexes into an + // array internally! + // ----------------------------------------------------------------------- + enum Protocols + { + File + , HTTP + , FTP + , HTTPS + + , Protocols_Count + , Unknown + }; + + + // ----------------------------------------------------------------------- + // Public static methods + // ----------------------------------------------------------------------- + static Protocols lookupByName(const XMLCh* const protoName); + static bool parse(const XMLCh* const urlText, XMLURL& xmlURL); + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + XMLURL(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XMLURL + ( + const XMLCh* const baseURL + , const XMLCh* const relativeURL + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLURL + ( + const XMLCh* const baseURL + , const char* const relativeURL + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLURL + ( + const XMLURL& baseURL + , const XMLCh* const relativeURL + ); + XMLURL + ( + const XMLURL& baseURL + , const char* const relativeURL + ); + XMLURL + ( + const XMLCh* const urlText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLURL + ( + const char* const urlText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + XMLURL(const XMLURL& toCopy); + virtual ~XMLURL(); + + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + XMLURL& operator=(const XMLURL& toAssign); + bool operator==(const XMLURL& toCompare) const; + bool operator!=(const XMLURL& toCompare) const; + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const XMLCh* getFragment() const; + const XMLCh* getHost() const; + const XMLCh* getPassword() const; + const XMLCh* getPath() const; + unsigned int getPortNum() const; + Protocols getProtocol() const; + const XMLCh* getProtocolName() const; + const XMLCh* getQuery() const; + const XMLCh* getURLText() const; + const XMLCh* getUser() const; + MemoryManager* getMemoryManager() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setURL(const XMLCh* const urlText); + void setURL + ( + const XMLCh* const baseURL + , const XMLCh* const relativeURL + ); + void setURL + ( + const XMLURL& baseURL + , const XMLCh* const relativeURL + ); + // a version of setURL that doesn't throw malformed url exceptions + bool setURL( + const XMLCh* const baseURL + , const XMLCh* const relativeURL + , XMLURL& xmlURL); + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + bool isRelative() const; + bool hasInvalidChar() const; + BinInputStream* makeNewStream() const; + void makeRelativeTo(const XMLCh* const baseURLText); + void makeRelativeTo(const XMLURL& baseURL); + + +private: + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void buildFullText(); + void cleanUp(); + bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true); + void parse + ( + const XMLCh* const urlText + ); + + + // ----------------------------------------------------------------------- + // Data members + // + // fFragment + // The fragment part of the URL, if any. If none, its a null. + // + // fHost + // The host part of the URL that was parsed out. This one will often + // be null (or "localhost", which also means the current machine.) + // + // fPassword + // The password found, if any. If none then its a null. + // + // fPath + // The path part of the URL that was parsed out, if any. If none, + // then its a null. + // + // fPortNum + // The port that was indicated in the URL. If no port was provided + // explicitly, then its left zero. + // + // fProtocol + // Indicates the type of the URL's source. The text of the prefix + // can be gotten from this. + // + // fQuery + // The query part of the URL, if any. If none, then its a null. + // + // fUser + // The username found, if any. If none, then its a null. + // + // fURLText + // This is a copy of the URL text, after it has been taken apart, + // made relative if needed, canonicalized, and then put back + // together. Its only created upon demand. + // + // fHasInvalidChar + // This indicates if the URL Text contains invalid characters as per + // RFC 2396 standard. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + XMLCh* fFragment; + XMLCh* fHost; + XMLCh* fPassword; + XMLCh* fPath; + unsigned int fPortNum; + Protocols fProtocol; + XMLCh* fQuery; + XMLCh* fUser; + XMLCh* fURLText; + bool fHasInvalidChar; +}; + + +// --------------------------------------------------------------------------- +// XMLURL: Public operators +// --------------------------------------------------------------------------- +inline bool XMLURL::operator!=(const XMLURL& toCompare) const +{ + return !operator==(toCompare); +} + + +// --------------------------------------------------------------------------- +// XMLURL: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* XMLURL::getFragment() const +{ + return fFragment; +} + +inline const XMLCh* XMLURL::getHost() const +{ + return fHost; +} + +inline const XMLCh* XMLURL::getPassword() const +{ + return fPassword; +} + +inline const XMLCh* XMLURL::getPath() const +{ + return fPath; +} + +inline XMLURL::Protocols XMLURL::getProtocol() const +{ + return fProtocol; +} + +inline const XMLCh* XMLURL::getQuery() const +{ + return fQuery; +} + +inline const XMLCh* XMLURL::getUser() const +{ + return fUser; +} + +inline const XMLCh* XMLURL::getURLText() const +{ + // + // Fault it in if not already. Since this is a const method and we + // can't use mutable members due the compilers we have to support, + // we have to cast off the constness. + // + if (!fURLText) + ((XMLURL*)this)->buildFullText(); + + return fURLText; +} + +inline MemoryManager* XMLURL::getMemoryManager() const +{ + return fMemoryManager; +} + +MakeXMLException(MalformedURLException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.cpp new file mode 100644 index 000000000..b8823d518 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.cpp @@ -0,0 +1,197 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + + +// --------------------------------------------------------------------------- +// XMLUTF16Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLUTF16Transcoder::XMLUTF16Transcoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , const bool swapped + , MemoryManager* const manager) : + + XMLTranscoder(encodingName, blockSize, manager) + , fSwapped(swapped) +{ +} + + +XMLUTF16Transcoder::~XMLUTF16Transcoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLUTF16Transcoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XMLUTF16Transcoder::transcodeFrom( const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // max output chars and the number of chars in the source. + // + const XMLSize_t srcChars = srcCount / sizeof(UTF16Ch); + const XMLSize_t countToDo = srcChars < maxChars ? srcChars : maxChars; + + // Look at the source data as UTF16 chars + const UTF16Ch* asUTF16 = (const UTF16Ch*)srcData; + + // And get a mutable pointer to the output + XMLCh* outPtr = toFill; + + // + // If its swapped, we have to do a char by char swap and cast. Else + // we have to check whether our XMLCh and UTF16Ch types are the same + // size or not. If so, we can optimize by just doing a buffer copy. + // + if (fSwapped) + { + // + // And then do the swapping loop for the count we precalculated. Note + // that this also handles size conversion as well if XMLCh is not the + // same size as UTF16Ch. + // + for (XMLSize_t index = 0; index < countToDo; index++) + *outPtr++ = BitOps::swapBytes(*asUTF16++); + } + else + { + // + // If the XMLCh type is the same size as a UTF16 value on this + // platform, then we can do just a buffer copy straight to the target + // buffer since our source chars are UTF-16 chars. If its not, then + // we still have to do a loop and assign each one, in order to + // implicitly convert. + // + if (sizeof(XMLCh) == sizeof(UTF16Ch)) + { + // Notice we convert char count to byte count here!!! + memcpy(toFill, srcData, countToDo * sizeof(UTF16Ch)); + } + else + { + for (XMLSize_t index = 0; index < countToDo; index++) + *outPtr++ = XMLCh(*asUTF16++); + } + } + + // Set the bytes eaten + bytesEaten = countToDo * sizeof(UTF16Ch); + + // Set the character sizes to the fixed size + memset(charSizes, sizeof(UTF16Ch), countToDo); + + // Return the chars we transcoded + return countToDo; +} + + +XMLSize_t +XMLUTF16Transcoder::transcodeTo(const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts) +{ + // + // Calculate the max chars we can do here. Its the lesser of the + // chars that we can fit into the output buffer, and the source + // chars available. + // + const XMLSize_t maxOutChars = maxBytes / sizeof(UTF16Ch); + const XMLSize_t countToDo = srcCount < maxOutChars ? srcCount : maxOutChars; + + // + // Get a pointer tot he output buffer in the UTF-16 character format + // that we need to work with. And get a mutable pointer to the source + // character buffer. + // + UTF16Ch* outPtr = (UTF16Ch*)toFill; + const XMLCh* srcPtr = srcData; + + // + // If the target format is swapped from our native format, then handle + // it one way, else handle it another. + // + if (fSwapped) + { + // + // And then do the swapping loop for the count we precalculated. Note + // that this also handles size conversion as well if XMLCh is not the + // same size as UTF16Ch. + // + for (XMLSize_t index = 0; index < countToDo; index++) + { + // To avoid flakey compilers, use a temp + const UTF16Ch tmpCh = UTF16Ch(*srcPtr++); + *outPtr++ = BitOps::swapBytes(tmpCh); + } + } + else + { + // + // If XMLCh and UTF16Ch are the same size, we can just do a fast + // memory copy. Otherwise, we have to do a loop and downcast each + // character into its new 16 bit storage. + // + if (sizeof(XMLCh) == sizeof(UTF16Ch)) + { + // Notice we convert char count to byte count here!!! + memcpy(toFill, srcData, countToDo * sizeof(UTF16Ch)); + } + else + { + for (XMLSize_t index = 0; index < countToDo; index++) + *outPtr++ = UTF16Ch(*srcPtr++); + } + } + + // Set the chars eaten to the calculated number we ate + charsEaten = countToDo; + + //Return the bytes we ate. Note we convert to a byte count here! + return countToDo * sizeof(UTF16Ch); +} + + +bool XMLUTF16Transcoder::canTranscodeTo(const unsigned int) +{ + // We can handle anything + return true; +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.hpp new file mode 100644 index 000000000..6a1fc9bde --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUTF16Transcoder.hpp @@ -0,0 +1,105 @@ +/* + * 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: XMLUTF16Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLUTF16TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLUTF16TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple UTF16 transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XMLUTF16Transcoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLUTF16Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , const bool swapped + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLUTF16Transcoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLUTF16Transcoder(const XMLUTF16Transcoder&); + XMLUTF16Transcoder& operator=(const XMLUTF16Transcoder&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fSwapped + // Indicates whether the encoding is of the opposite endianness from + // the local host. + // ----------------------------------------------------------------------- + bool fSwapped; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.cpp new file mode 100644 index 000000000..45ce5a80f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.cpp @@ -0,0 +1,556 @@ +/* + * 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: XMLUTF8Transcoder.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static data +// +// gUTFBytes +// A list of counts of trailing bytes for each initial byte in the input. +// +// gUTFByteIndicator +// For a UTF8 sequence of n bytes, n>=2, the first byte of the +// sequence must contain n 1's followed by precisely 1 0 with the +// rest of the byte containing arbitrary bits. This array stores +// the required bit pattern for validity checking. +// gUTFByteIndicatorTest +// When bitwise and'd with the observed value, if the observed +// value is correct then a result matching gUTFByteIndicator will +// be produced. +// +// gUTFOffsets +// A list of values to offset each result char type, according to how +// many source bytes when into making it. +// +// gFirstByteMark +// A list of values to mask onto the first byte of an encoded sequence, +// indexed by the number of bytes used to create the sequence. +// --------------------------------------------------------------------------- +static const XMLByte gUTFBytes[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + , 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 + , 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 +}; + +static const XMLByte gUTFByteIndicator[6] = +{ + 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC +}; +static const XMLByte gUTFByteIndicatorTest[6] = +{ + 0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE +}; + +static const XMLUInt32 gUTFOffsets[6] = +{ + 0, 0x3080, 0xE2080, 0x3C82080, 0xFA082080, 0x82082080 +}; + +static const XMLByte gFirstByteMark[7] = +{ + 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC +}; + + + +// --------------------------------------------------------------------------- +// XMLUTF8Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLUTF8Transcoder::XMLUTF8Transcoder(const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) +:XMLTranscoder(encodingName, blockSize, manager) +{ +} + +XMLUTF8Transcoder::~XMLUTF8Transcoder() +{ +} + + +// --------------------------------------------------------------------------- +// XMLUTF8Transcoder: Implementation of the transcoder API +// --------------------------------------------------------------------------- +XMLSize_t +XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes) +{ + // Watch for pathological scenario. Shouldn't happen, but... + if (!srcCount || !maxChars) + return 0; + + // + // Get pointers to our start and end points of the input and output + // buffers. + // + const XMLByte* srcPtr = srcData; + const XMLByte* srcEnd = srcPtr + srcCount; + XMLCh* outPtr = toFill; + XMLCh* outEnd = outPtr + maxChars; + unsigned char* sizePtr = charSizes; + + + + // + // We now loop until we either run out of input data, or room to store + // output chars. + // + while ((srcPtr < srcEnd) && (outPtr < outEnd)) + { + // Special-case ASCII, which is a leading byte value of <= 127 + if (*srcPtr <= 127) + { + // Handle ASCII in groups instead of single character at a time. + const XMLByte* srcPtr_save = srcPtr; + const XMLSize_t chunkSize = (srcEnd-srcPtr)<(outEnd-outPtr)?(srcEnd-srcPtr):(outEnd-outPtr); + for(XMLSize_t i=0;i= here because we are implicitly + // counting the 1 byte we get no matter what. + // + // If we break out here, then there is nothing to undo since we + // haven't updated any pointers yet. + // + if (srcPtr + trailingBytes >= srcEnd) + break; + + // Looks ok, so lets build up the value + // or at least let's try to do so--remembering that + // we cannot assume the encoding to be valid: + + // first, test first byte + if((gUTFByteIndicatorTest[trailingBytes] & *srcPtr) != gUTFByteIndicator[trailingBytes]) { + char pos[2] = {(char)0x31, 0}; + char len[2] = {(char)(trailingBytes+0x31), 0}; + char byte[2] = {*srcPtr,0}; + ThrowXMLwithMemMgr3(UTFDataFormatException, XMLExcepts::UTF8_FormatError, pos, byte, len, getMemoryManager()); + } + + /*** + * http://www.unicode.org/reports/tr27/ + * + * Table 3.1B. lists all of the byte sequences that are legal in UTF-8. + * A range of byte values such as A0..BF indicates that any byte from A0 to BF (inclusive) + * is legal in that position. + * Any byte value outside of the ranges listed is illegal. + * For example, + * the byte sequence is illegal since C0 is not legal in the 1st Byte column. + * The byte sequence is illegal since in the row + * where E0 is legal as a first byte, + * 9F is not legal as a second byte. + * The byte sequence is legal, since every byte in that sequence matches + * a byte range in a row of the table (the last row). + * + * + * Table 3.1B. Legal UTF-8 Byte Sequences + * Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte + * ========================================================================= + * U+0000..U+007F 00..7F + * ------------------------------------------------------------------------- + * U+0080..U+07FF C2..DF 80..BF + * + * ------------------------------------------------------------------------- + * U+0800..U+0FFF E0 A0..BF 80..BF + * -- + * + * U+1000..U+FFFF E1..EF 80..BF 80..BF + * + * -------------------------------------------------------------------------- + * U+10000..U+3FFFF F0 90..BF 80..BF 80..BF + * -- + * U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF + * U+100000..U+10FFFF F4 80..8F 80..BF 80..BF + * -- + * ========================================================================== + * + * Cases where a trailing byte range is not 80..BF are underlined in the table to + * draw attention to them. These occur only in the second byte of a sequence. + * + ***/ + + XMLUInt32 tmpVal = 0; + + switch(trailingBytes) + { + case 1 : + // UTF-8: [110y yyyy] [10xx xxxx] + // Unicode: [0000 0yyy] [yyxx xxxx] + // + // 0xC0, 0xC1 has been filtered out + checkTrailingBytes(*(srcPtr+1), 1, 1); + + tmpVal = *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + + break; + case 2 : + // UTF-8: [1110 zzzz] [10yy yyyy] [10xx xxxx] + // Unicode: [zzzz yyyy] [yyxx xxxx] + // + if (( *srcPtr == 0xE0) && ( *(srcPtr+1) < 0xA0)) + { + char byte0[2] = {*srcPtr ,0}; + char byte1[2] = {*(srcPtr+1),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Invalid_3BytesSeq + , byte0 + , byte1 + , getMemoryManager()); + } + + checkTrailingBytes(*(srcPtr+1), 2, 1); + checkTrailingBytes(*(srcPtr+2), 2, 2); + + // + // D36 (a) UTF-8 is the Unicode Transformation Format that serializes + // a Unicode code point as a sequence of one to four bytes, + // as specified in Table 3.1, UTF-8 Bit Distribution. + // (b) An illegal UTF-8 code unit sequence is any byte sequence that + // does not match the patterns listed in Table 3.1B, Legal UTF-8 + // Byte Sequences. + // (c) An irregular UTF-8 code unit sequence is a six-byte sequence + // where the first three bytes correspond to a high surrogate, + // and the next three bytes correspond to a low surrogate. + // As a consequence of C12, these irregular UTF-8 sequences shall + // not be generated by a conformant process. + // + //irregular three bytes sequence + // that is zzzzyy matches leading surrogate tag 110110 or + // trailing surrogate tag 110111 + // *srcPtr=1110 1101 + // *(srcPtr+1)=1010 yyyy or + // *(srcPtr+1)=1011 yyyy + // + // 0xED 1110 1101 + // 0xA0 1010 0000 + + if ((*srcPtr == 0xED) && (*(srcPtr+1) >= 0xA0)) + { + char byte0[2] = {*srcPtr, 0}; + char byte1[2] = {*(srcPtr+1),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Irregular_3BytesSeq + , byte0 + , byte1 + , getMemoryManager()); + } + + tmpVal = *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + + break; + case 3 : + // UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* + // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) + // [1101 11yy] [yyxx xxxx] (low surrogate) + // * uuuuu = wwww + 1 + // + if (((*srcPtr == 0xF0) && (*(srcPtr+1) < 0x90)) || + ((*srcPtr == 0xF4) && (*(srcPtr+1) > 0x8F)) ) + { + char byte0[2] = {*srcPtr ,0}; + char byte1[2] = {*(srcPtr+1),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Invalid_4BytesSeq + , byte0 + , byte1 + , getMemoryManager()); + } + + checkTrailingBytes(*(srcPtr+1), 3, 1); + checkTrailingBytes(*(srcPtr+2), 3, 2); + checkTrailingBytes(*(srcPtr+3), 3, 3); + + tmpVal = *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + tmpVal <<= 6; + tmpVal += *srcPtr++; + + break; + default: // trailingBytes > 3 + + /*** + * The definition of UTF-8 in Annex D of ISO/IEC 10646-1:2000 also allows + * for the use of five- and six-byte sequences to encode characters that + * are outside the range of the Unicode character set; those five- and + * six-byte sequences are illegal for the use of UTF-8 as a transformation + * of Unicode characters. ISO/IEC 10646 does not allow mapping of unpaired + * surrogates, nor U+FFFE and U+FFFF (but it does allow other noncharacters). + ***/ + char len[2] = {(char)(trailingBytes+0x31), 0}; + char byte[2] = {*srcPtr,0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Exceeds_BytesLimit + , byte + , len + , getMemoryManager()); + + break; + } + + + // since trailingBytes comes from an array, this logic is redundant + // default : + // ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + //} + tmpVal -= gUTFOffsets[trailingBytes]; + + // + // If it will fit into a single char, then put it in. Otherwise + // encode it as a surrogate pair. If its not valid, use the + // replacement char. + // + if (!(tmpVal & 0xFFFF0000)) + { + *sizePtr++ = trailingBytes + 1; + *outPtr++ = XMLCh(tmpVal); + } + else if (tmpVal > 0x10FFFF) + { + // + // If we've gotten more than 32 chars so far, then just break + // out for now and lets process those. When we come back in + // here again, we'll get no chars and throw an exception. This + // way, the error will have a line and col number closer to + // the real problem area. + // + if ((outPtr - toFill) > 32) + break; + + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); + } + else + { + // + // If we have enough room to store the leading and trailing + // chars, then lets do it. Else, pretend this one never + // happened, and leave it for the next time. Since we don't + // update the bytes read until the bottom of the loop, by + // breaking out here its like it never happened. + // + if (outPtr + 1 >= outEnd) + break; + + // Store the leading surrogate char + tmpVal -= 0x10000; + *sizePtr++ = trailingBytes + 1; + *outPtr++ = XMLCh((tmpVal >> 10) + 0xD800); + + // + // And then the trailing char. This one accounts for no + // bytes eaten from the source, so set the char size for this + // one to be zero. + // + *sizePtr++ = 0; + *outPtr++ = XMLCh((tmpVal & 0x3FF) + 0xDC00); + } + } + + // Update the bytes eaten + bytesEaten = srcPtr - srcData; + + // Return the characters read + return outPtr - toFill; +} + + +XMLSize_t +XMLUTF8Transcoder::transcodeTo( const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options) +{ + // Watch for pathological scenario. Shouldn't happen, but... + if (!srcCount || !maxBytes) + return 0; + + // + // Get pointers to our start and end points of the input and output + // buffers. + // + const XMLCh* srcPtr = srcData; + const XMLCh* srcEnd = srcPtr + srcCount; + XMLByte* outPtr = toFill; + XMLByte* outEnd = toFill + maxBytes; + + while (srcPtr < srcEnd) + { + // + // Tentatively get the next char out. We have to get it into a + // 32 bit value, because it could be a surrogate pair. + // + XMLUInt32 curVal = *srcPtr; + + // + // If its a leading surrogate, then lets see if we have the trailing + // available. If not, then give up now and leave it for next time. + // + unsigned int srcUsed = 1; + if ((curVal >= 0xD800) && (curVal <= 0xDBFF)) + { + if (srcPtr + 1 >= srcEnd) + break; + + // Create the composite surrogate pair + curVal = ((curVal - 0xD800) << 10) + + ((*(srcPtr + 1) - 0xDC00) + 0x10000); + + // And indicate that we ate another one + srcUsed++; + } + + // Figure out how many bytes we need + unsigned int encodedBytes; + if (curVal < 0x80) + encodedBytes = 1; + else if (curVal < 0x800) + encodedBytes = 2; + else if (curVal < 0x10000) + encodedBytes = 3; + else if (curVal < 0x110000) + encodedBytes = 4; + else + { + // If the options say to throw, then throw + if (options == UnRep_Throw) + { + XMLCh tmpBuf[17]; + XMLString::binToText(curVal, tmpBuf, 16, 16, getMemoryManager()); + ThrowXMLwithMemMgr2 + ( + TranscodingException + , XMLExcepts::Trans_Unrepresentable + , tmpBuf + , getEncodingName() + , getMemoryManager() + ); + } + + // Else, use the replacement character + *outPtr++ = chSpace; + srcPtr += srcUsed; + continue; + } + + // + // If we cannot fully get this char into the output buffer, + // then leave it for the next time. + // + if (outPtr + encodedBytes > outEnd) + break; + + // We can do it, so update the source index + srcPtr += srcUsed; + + // + // And spit out the bytes. We spit them out in reverse order + // here, so bump up the output pointer and work down as we go. + // + outPtr += encodedBytes; + switch(encodedBytes) + { + case 6 : *--outPtr = XMLByte((curVal | 0x80UL) & 0xBFUL); + curVal >>= 6; + case 5 : *--outPtr = XMLByte((curVal | 0x80UL) & 0xBFUL); + curVal >>= 6; + case 4 : *--outPtr = XMLByte((curVal | 0x80UL) & 0xBFUL); + curVal >>= 6; + case 3 : *--outPtr = XMLByte((curVal | 0x80UL) & 0xBFUL); + curVal >>= 6; + case 2 : *--outPtr = XMLByte((curVal | 0x80UL) & 0xBFUL); + curVal >>= 6; + case 1 : *--outPtr = XMLByte + ( + curVal | gFirstByteMark[encodedBytes] + ); + } + + // Add the encoded bytes back in again to indicate we've eaten them + outPtr += encodedBytes; + } + + // Fill in the chars we ate + charsEaten = (srcPtr - srcData); + + // And return the bytes we filled in + return (outPtr - toFill); +} + + +bool XMLUTF8Transcoder::canTranscodeTo(const unsigned int toCheck) +{ + // We can represent anything in the Unicode (with surrogates) range + return (toCheck <= 0x10FFFF); +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.hpp new file mode 100644 index 000000000..5f35ece22 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUTF8Transcoder.hpp @@ -0,0 +1,118 @@ +/* + * 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: XMLUTF8Transcoder.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLUTF8TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLUTF8TRANSCODER_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class provides an implementation of the XMLTranscoder interface +// for a simple UTF8 transcoder. The parser does some encodings +// intrinsically without depending upon external transcoding services. +// To make everything more orthogonal, we implement these internal +// transcoders using the same transcoder abstraction as the pluggable +// transcoding services do. +// +class XMLUTIL_EXPORT XMLUTF8Transcoder : public XMLTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLUTF8Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLUTF8Transcoder(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLTranscoder interface + // ----------------------------------------------------------------------- + virtual XMLSize_t transcodeFrom + ( + const XMLByte* const srcData + , const XMLSize_t srcCount + , XMLCh* const toFill + , const XMLSize_t maxChars + , XMLSize_t& bytesEaten + , unsigned char* const charSizes + ); + + virtual XMLSize_t transcodeTo + ( + const XMLCh* const srcData + , const XMLSize_t srcCount + , XMLByte* const toFill + , const XMLSize_t maxBytes + , XMLSize_t& charsEaten + , const UnRepOpts options + ); + + virtual bool canTranscodeTo + ( + const unsigned int toCheck + ); + + +private : + + inline void checkTrailingBytes( + const XMLByte toCheck + , const unsigned int trailingBytes + , const unsigned int position + ) const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLUTF8Transcoder(const XMLUTF8Transcoder&); + XMLUTF8Transcoder& operator=(const XMLUTF8Transcoder&); +}; + +inline +void XMLUTF8Transcoder::checkTrailingBytes(const XMLByte toCheck + , const unsigned int trailingBytes + , const unsigned int position) const +{ + + if((toCheck & 0xC0) != 0x80) + { + char len[2] = {(char)(trailingBytes+0x31), 0}; + char pos[2] = {(char)(position+0x31), 0}; + char byte[2] = {toCheck,0}; + ThrowXMLwithMemMgr3(UTFDataFormatException, XMLExcepts::UTF8_FormatError, pos, byte, len, getMemoryManager()); + } + +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLUni.cpp b/project/jni/xerces/src/xercesc/util/XMLUni.cpp new file mode 100644 index 000000000..3a4c48d52 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUni.cpp @@ -0,0 +1,1875 @@ +/* + * 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: XMLUni.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLUni: Static data +// --------------------------------------------------------------------------- + +const XMLCh XMLUni::fgAnyString[] = +{ + chLatin_A, chLatin_N, chLatin_Y, chNull +}; + +const XMLCh XMLUni::fgAttListString[] = +{ + chLatin_A, chLatin_T, chLatin_T, chLatin_L, chLatin_I, chLatin_S, chLatin_T, chNull +}; + +const XMLCh XMLUni::fgCommentString[] = +{ + chOpenAngle, chBang, chDash, chDash, chNull +}; + +const XMLCh XMLUni::fgCDATAString[] = +{ + chLatin_C, chLatin_D, chLatin_A, chLatin_T, chLatin_A, chNull +}; + +const XMLCh XMLUni::fgDefaultString[] = +{ + chPound, chLatin_D, chLatin_E, chLatin_F, chLatin_A, chLatin_U, chLatin_L, chLatin_T, chNull +}; + +const XMLCh XMLUni::fgDocTypeString[] = +{ + chOpenAngle, chBang, chLatin_D, chLatin_O, chLatin_C, chLatin_T, chLatin_Y, chLatin_P, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgEBCDICEncodingString[] = +{ + // Just plain 'EBCDIC' + chLatin_E, chLatin_B, chLatin_C, chLatin_D, chLatin_I, chLatin_C, chNull +}; + +const XMLCh XMLUni::fgElemString[] = +{ + chLatin_E, chLatin_L, chLatin_E, chLatin_M, chLatin_E, chLatin_N, chLatin_T, chNull +}; + +const XMLCh XMLUni::fgEmptyString[] = +{ + chLatin_E, chLatin_M, chLatin_P, chLatin_T, chLatin_Y, chNull +}; + +const XMLCh XMLUni::fgEncodingString[] = +{ + chLatin_e, chLatin_n, chLatin_c, chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chNull +}; + +const XMLCh XMLUni::fgEntitString[] = +{ + chLatin_E, chLatin_N, chLatin_T, chLatin_I, chLatin_T, chNull +}; + +const XMLCh XMLUni::fgEntityString[] = +{ + chLatin_E, chLatin_N, chLatin_T, chLatin_I, chLatin_T, chLatin_Y, chNull +}; + +const XMLCh XMLUni::fgEntitiesString[] = +{ + chLatin_E, chLatin_N, chLatin_T, chLatin_I, chLatin_T, chLatin_I, chLatin_E, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgEnumerationString[] = +{ + chLatin_E, chLatin_N, chLatin_U, chLatin_M, chLatin_E, chLatin_R, chLatin_A, chLatin_T, chLatin_I, chLatin_O, chLatin_N, chNull +}; + +const XMLCh XMLUni::fgExceptDomain[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c + , chLatin_h, chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g + , chForwardSlash, chLatin_x, chLatin_m, chLatin_l, chForwardSlash + , chLatin_m, chLatin_e, chLatin_s, chLatin_s, chLatin_a, chLatin_g + , chLatin_e, chLatin_s, chForwardSlash, chLatin_X, chLatin_M, chLatin_L + , chDigit_4, chLatin_C, chLatin_E, chLatin_r, chLatin_r, chLatin_o + , chLatin_r, chLatin_s, chNull +}; + +const XMLCh XMLUni::fgFixedString[] = +{ + chPound, chLatin_F, chLatin_I, chLatin_X, chLatin_E, chLatin_D, chNull +}; + +const XMLCh XMLUni::fgIBM037EncodingString[] = +{ + chLatin_E, chLatin_B, chLatin_C, chLatin_D, chLatin_I, chLatin_C, chDash, chLatin_C, chLatin_P, chDash, chLatin_U, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgIBM037EncodingString2[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_0, chDigit_3, chDigit_7, chNull +}; + +//hhe +const XMLCh XMLUni::fgIBM1047EncodingString[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_1, chDigit_0, chDigit_4, chDigit_7, chNull +}; + +const XMLCh XMLUni::fgIBM1047EncodingString2[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDash, chDigit_1, chDigit_0, chDigit_4, chDigit_7, chNull +}; + +const XMLCh XMLUni::fgIBM1140EncodingString[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_1, chDigit_1, chDigit_4, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgIBM1140EncodingString2[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_0, chDigit_1, chDigit_1, chDigit_4, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgIBM1140EncodingString3[] = +{ + chLatin_C, chLatin_C, chLatin_S, chLatin_I, chLatin_D, chDigit_0, chDigit_1, chDigit_1, chDigit_4, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgIBM1140EncodingString4[] = +{ + chLatin_C, chLatin_P, chDigit_0, chDigit_1, chDigit_1, chDigit_4, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgIESString[] = +{ + chLatin_I, chLatin_E, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgIDString[] = +{ + chLatin_I, chLatin_D, chNull +}; + +const XMLCh XMLUni::fgIDRefString[] = +{ + chLatin_I, chLatin_D, chLatin_R, chLatin_E, chLatin_F, chNull +}; + +const XMLCh XMLUni::fgIDRefsString[] = +{ + chLatin_I, chLatin_D, chLatin_R, chLatin_E, chLatin_F, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgImpliedString[] = +{ + chPound, chLatin_I, chLatin_M, chLatin_P, chLatin_L, chLatin_I, chLatin_E, chLatin_D, chNull +}; + +const XMLCh XMLUni::fgIgnoreString[] = +{ + chLatin_I, chLatin_G, chLatin_N, chLatin_O, chLatin_R, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgIncludeString[] = +{ + chLatin_I, chLatin_N, chLatin_C, chLatin_L, chLatin_U, chLatin_D, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString[] = +{ + chLatin_I, chLatin_S, chLatin_O, chDigit_8, chDigit_8, chDigit_5, chDigit_9, chDash, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString2[] = +{ + chLatin_I, chLatin_S, chLatin_O, chDash, chDigit_8, chDigit_8, chDigit_5, chDigit_9, chDash, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString3[] = +{ + chLatin_I, chLatin_S, chLatin_O, chUnderscore, chDigit_8, chDigit_8, chDigit_5, chDigit_9, chDash, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString4[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDash, chDigit_8, chDigit_1, chDigit_9, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString5[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_8, chDigit_1, chDigit_9, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString6[] = +{ + chLatin_L, chLatin_A, chLatin_T, chLatin_I, chLatin_N, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString7[] = +{ + chLatin_L, chLatin_A, chLatin_T, chLatin_I, chLatin_N, chDash, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString8[] = +{ + chLatin_L, chLatin_A, chLatin_T, chLatin_I, chLatin_N, chUnderscore, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString9[] = +{ + chLatin_C, chLatin_P, chDigit_8, chDigit_1, chDigit_9, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString10[] = +{ + chLatin_C, chLatin_S, chLatin_I, chLatin_S, chLatin_O, chLatin_L, chLatin_A, chLatin_T, chLatin_I, chLatin_N, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString11[] = +{ + chLatin_I, chLatin_S, chLatin_O, chDash, chLatin_I, chLatin_R, chDash, chDigit_1, chDigit_0, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgISO88591EncodingString12[] = +{ + chLatin_L, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgLocalHostString[] = +{ + chLatin_l, chLatin_o, chLatin_c, chLatin_a, chLatin_l, chLatin_h, chLatin_o, chLatin_s, chLatin_t, chNull +}; + +const XMLCh XMLUni::fgNoString[] = +{ + chLatin_n, chLatin_o, chNull +}; + +const XMLCh XMLUni::fgNotationString[] = +{ + chLatin_N, chLatin_O, chLatin_T, chLatin_A, chLatin_T, chLatin_I, chLatin_O, chLatin_N, chNull +}; + +const XMLCh XMLUni::fgNDATAString[] = +{ + chLatin_N, chLatin_D, chLatin_A, chLatin_T, chLatin_A, chNull +}; + +const XMLCh XMLUni::fgNmTokenString[] = +{ + chLatin_N, chLatin_M, chLatin_T, chLatin_O, chLatin_K, chLatin_E, chLatin_N, chNull +}; + +const XMLCh XMLUni::fgNmTokensString[] = +{ + chLatin_N, chLatin_M, chLatin_T, chLatin_O, chLatin_K, chLatin_E, chLatin_N, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgPCDATAString[] = +{ + chPound, chLatin_P, chLatin_C, chLatin_D, chLatin_A, chLatin_T, chLatin_A, chNull +}; + +const XMLCh XMLUni::fgPIString[] = +{ + chOpenAngle, chQuestion, chNull +}; + +const XMLCh XMLUni::fgPubIDString[] = +{ + chLatin_P, chLatin_U, chLatin_B, chLatin_L, chLatin_I, chLatin_C, chNull +}; + +const XMLCh XMLUni::fgRefString[] = +{ + chLatin_R, chLatin_E, chLatin_F, chNull +}; + +const XMLCh XMLUni::fgRequiredString[] = +{ + chPound, chLatin_R, chLatin_E, chLatin_Q, chLatin_U, chLatin_I, chLatin_R, chLatin_E, chLatin_D, chNull +}; + +const XMLCh XMLUni::fgStandaloneString[] = +{ + chLatin_s, chLatin_t, chLatin_a, chLatin_n, chLatin_d, chLatin_a, chLatin_l, chLatin_o, chLatin_n, chLatin_e, chNull +}; + +const XMLCh XMLUni::fgVersion1_0[] = +{ + chDigit_1, chPeriod, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgVersion1_1[] = +{ + chDigit_1, chPeriod, chDigit_1, chNull +}; + +const XMLCh XMLUni::fgSysIDString[] = +{ + chLatin_S, chLatin_Y, chLatin_S, chLatin_T, chLatin_E, chLatin_M, chNull +}; + +const XMLCh XMLUni::fgUnknownURIName[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c + , chLatin_h, chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g + , chForwardSlash, chLatin_x, chLatin_m, chLatin_l, chForwardSlash + , chLatin_U, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n + , chLatin_N, chLatin_S, chNull +}; + +const XMLCh XMLUni::fgUCS4EncodingString[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDigit_4, chNull +}; + +const XMLCh XMLUni::fgUCS4EncodingString2[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chNull +}; + +const XMLCh XMLUni::fgUCS4EncodingString3[] = +{ + chLatin_U, chLatin_C, chLatin_S, chUnderscore, chDigit_4, chNull +}; + +const XMLCh XMLUni::fgUCS4EncodingString4[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_3, chDigit_2, chNull +}; + +const XMLCh XMLUni::fgUCS4EncodingString5[] = +{ + chLatin_I, chLatin_S, chLatin_O, chDash, chDigit_1, chDigit_0, chDigit_6, chDigit_4, chDigit_6, + chDash, chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chNull +}; + +const XMLCh XMLUni::fgUCS4BEncodingString[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chSpace, chOpenParen, chLatin_B, chLatin_E, chCloseParen, chNull +}; + +const XMLCh XMLUni::fgUCS4BEncodingString2[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chLatin_B, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgUCS4LEncodingString[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chSpace, chOpenParen, chLatin_L, chLatin_E, chCloseParen, chNull +}; + +const XMLCh XMLUni::fgUCS4LEncodingString2[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_4, chLatin_L, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgUSASCIIEncodingString[] = +{ + chLatin_U, chLatin_S, chDash, chLatin_A, chLatin_S, chLatin_C, chLatin_I, chLatin_I, chNull +}; + +const XMLCh XMLUni::fgUSASCIIEncodingString2[] = +{ + chLatin_U, chLatin_S, chLatin_A, chLatin_S, chLatin_C, chLatin_I, chLatin_I, chNull +}; + +const XMLCh XMLUni::fgUSASCIIEncodingString3[] = +{ + chLatin_A, chLatin_S, chLatin_C, chLatin_I, chLatin_I, chNull +}; + +const XMLCh XMLUni::fgUSASCIIEncodingString4[] = +{ + chLatin_U, chLatin_S, chUnderscore, chLatin_A, chLatin_S, chLatin_C, chLatin_I, chLatin_I, chNull +}; + +const XMLCh XMLUni::fgUTF8EncodingString[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_8, chNull +}; + +const XMLCh XMLUni::fgUTF8EncodingString2[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDigit_8, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_1, chDigit_6, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString2[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDigit_2, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString3[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDigit_1, chDigit_2, chDigit_0, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString4[] = +{ + chLatin_I, chLatin_B, chLatin_M, chDash, chDigit_1, chDigit_2, chDigit_0, chDigit_0, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString5[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDigit_1, chDigit_6, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString6[] = +{ + chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_2, chNull +}; + +const XMLCh XMLUni::fgUTF16EncodingString7[] = +{ + chLatin_I, chLatin_S, chLatin_O, chDash, chDigit_1, chDigit_0, chDigit_6, chDigit_4 + , chDigit_6, chDash, chLatin_U, chLatin_C, chLatin_S, chDash, chDigit_2, chNull +}; + +const XMLCh XMLUni::fgUTF16BEncodingString[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_1, chDigit_6, chSpace, chOpenParen, chLatin_B, chLatin_E, chCloseParen, chNull +}; + +const XMLCh XMLUni::fgUTF16BEncodingString2[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_1, chDigit_6, chLatin_B, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgUTF16LEncodingString[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_1, chDigit_6, chSpace, chOpenParen, chLatin_L, chLatin_E, chCloseParen, chNull +}; + +const XMLCh XMLUni::fgUTF16LEncodingString2[] = +{ + chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_1, chDigit_6, chLatin_L, chLatin_E, chNull +}; + +const XMLCh XMLUni::fgVersionString[] = +{ + chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh XMLUni::fgValidityDomain[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h + , chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash + , chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chLatin_m, chLatin_e + , chLatin_s, chLatin_s, chLatin_a, chLatin_g, chLatin_e, chLatin_s + , chForwardSlash, chLatin_X, chLatin_M, chLatin_L, chLatin_V, chLatin_a + , chLatin_l, chLatin_i, chLatin_d, chLatin_i, chLatin_t, chLatin_y, chNull +}; + +const XMLCh XMLUni::fgWin1252EncodingString[] = +{ + chLatin_W, chLatin_I, chLatin_N, chLatin_D, chLatin_O, chLatin_W + , chLatin_S, chDash, chDigit_1, chDigit_2, chDigit_5, chDigit_2, chNull +}; + +const XMLCh XMLUni::fgXMLChEncodingString[] = +{ + chLatin_X, chLatin_E, chLatin_R, chLatin_C, chLatin_E, chLatin_S + , chDash, chLatin_X, chLatin_M, chLatin_L, chLatin_C, chLatin_H, chNull +}; + +const XMLCh XMLUni::fgXMLString[] = +{ + chLatin_x, chLatin_m, chLatin_l, chNull +}; + +//xml{S} +const XMLCh XMLUni::fgXMLStringSpace[] = +{ + chLatin_x, chLatin_m, chLatin_l, chSpace, chNull +}; + +const XMLCh XMLUni::fgXMLStringHTab[] = +{ + chLatin_x, chLatin_m, chLatin_l, chHTab, chNull +}; + +const XMLCh XMLUni::fgXMLStringCR[] = +{ + chLatin_x, chLatin_m, chLatin_l, chCR, chNull +}; + +const XMLCh XMLUni::fgXMLStringLF[] = +{ + chLatin_x, chLatin_m, chLatin_l, chLF, chNull +}; + +//XML{S} +const XMLCh XMLUni::fgXMLStringSpaceU[] = +{ + chLatin_X, chLatin_M, chLatin_L, chSpace, chNull +}; + +const XMLCh XMLUni::fgXMLStringHTabU[] = +{ + chLatin_X, chLatin_M, chLatin_L, chHTab, chNull +}; + +const XMLCh XMLUni::fgXMLStringCRU[] = +{ + chLatin_X, chLatin_M, chLatin_L, chCR, chNull +}; + +const XMLCh XMLUni::fgXMLStringLFU[] = +{ + chLatin_X, chLatin_M, chLatin_L, chLF, chNull +}; + +// + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLUni +{ +public : + // ----------------------------------------------------------------------- + // These are constant strings that are common in XML data. Because + // of the limitation of the compilers we have to work with, these are + // done as arrays of XMLCh characters, not as constant strings. + // ----------------------------------------------------------------------- + static const XMLCh fgAnyString[]; + static const XMLCh fgAttListString[]; + static const XMLCh fgCommentString[]; + static const XMLCh fgCDATAString[]; + static const XMLCh fgDefaultString[]; + static const XMLCh fgDocTypeString[]; + static const XMLCh fgEBCDICEncodingString[]; + static const XMLCh fgElemString[]; + static const XMLCh fgEmptyString[]; + static const XMLCh fgEncodingString[]; + static const XMLCh fgEntitString[]; + static const XMLCh fgEntityString[]; + static const XMLCh fgEntitiesString[]; + static const XMLCh fgEnumerationString[]; + static const XMLCh fgExceptDomain[]; + static const XMLCh fgFixedString[]; + static const XMLCh fgIBM037EncodingString[]; + static const XMLCh fgIBM037EncodingString2[]; + static const XMLCh fgIBM1047EncodingString[]; + static const XMLCh fgIBM1047EncodingString2[]; + static const XMLCh fgIBM1140EncodingString[]; + static const XMLCh fgIBM1140EncodingString2[]; + static const XMLCh fgIBM1140EncodingString3[]; + static const XMLCh fgIBM1140EncodingString4[]; + static const XMLCh fgIESString[]; + static const XMLCh fgIDString[]; + static const XMLCh fgIDRefString[]; + static const XMLCh fgIDRefsString[]; + static const XMLCh fgImpliedString[]; + static const XMLCh fgIgnoreString[]; + static const XMLCh fgIncludeString[]; + static const XMLCh fgISO88591EncodingString[]; + static const XMLCh fgISO88591EncodingString2[]; + static const XMLCh fgISO88591EncodingString3[]; + static const XMLCh fgISO88591EncodingString4[]; + static const XMLCh fgISO88591EncodingString5[]; + static const XMLCh fgISO88591EncodingString6[]; + static const XMLCh fgISO88591EncodingString7[]; + static const XMLCh fgISO88591EncodingString8[]; + static const XMLCh fgISO88591EncodingString9[]; + static const XMLCh fgISO88591EncodingString10[]; + static const XMLCh fgISO88591EncodingString11[]; + static const XMLCh fgISO88591EncodingString12[]; + static const XMLCh fgLocalHostString[]; + static const XMLCh fgNoString[]; + static const XMLCh fgNotationString[]; + static const XMLCh fgNDATAString[]; + static const XMLCh fgNmTokenString[]; + static const XMLCh fgNmTokensString[]; + static const XMLCh fgPCDATAString[]; + static const XMLCh fgPIString[]; + static const XMLCh fgPubIDString[]; + static const XMLCh fgRefString[]; + static const XMLCh fgRequiredString[]; + static const XMLCh fgStandaloneString[]; + static const XMLCh fgVersion1_0[]; + static const XMLCh fgVersion1_1[]; + static const XMLCh fgSysIDString[]; + static const XMLCh fgUnknownURIName[]; + static const XMLCh fgUCS4EncodingString[]; + static const XMLCh fgUCS4EncodingString2[]; + static const XMLCh fgUCS4EncodingString3[]; + static const XMLCh fgUCS4EncodingString4[]; + static const XMLCh fgUCS4EncodingString5[]; + static const XMLCh fgUCS4BEncodingString[]; + static const XMLCh fgUCS4BEncodingString2[]; + static const XMLCh fgUCS4LEncodingString[]; + static const XMLCh fgUCS4LEncodingString2[]; + static const XMLCh fgUSASCIIEncodingString[]; + static const XMLCh fgUSASCIIEncodingString2[]; + static const XMLCh fgUSASCIIEncodingString3[]; + static const XMLCh fgUSASCIIEncodingString4[]; + static const XMLCh fgUTF8EncodingString[]; + static const XMLCh fgUTF8EncodingString2[]; + static const XMLCh fgUTF16EncodingString[]; + static const XMLCh fgUTF16EncodingString2[]; + static const XMLCh fgUTF16EncodingString3[]; + static const XMLCh fgUTF16EncodingString4[]; + static const XMLCh fgUTF16EncodingString5[]; + static const XMLCh fgUTF16EncodingString6[]; + static const XMLCh fgUTF16EncodingString7[]; + static const XMLCh fgUTF16BEncodingString[]; + static const XMLCh fgUTF16BEncodingString2[]; + static const XMLCh fgUTF16LEncodingString[]; + static const XMLCh fgUTF16LEncodingString2[]; + static const XMLCh fgVersionString[]; + static const XMLCh fgValidityDomain[]; + static const XMLCh fgWin1252EncodingString[]; + static const XMLCh fgXMLChEncodingString[]; + static const XMLCh fgXMLDOMMsgDomain[]; + static const XMLCh fgXMLString[]; + static const XMLCh fgXMLStringSpace[]; + static const XMLCh fgXMLStringHTab[]; + static const XMLCh fgXMLStringCR[]; + static const XMLCh fgXMLStringLF[]; + static const XMLCh fgXMLStringSpaceU[]; + static const XMLCh fgXMLStringHTabU[]; + static const XMLCh fgXMLStringCRU[]; + static const XMLCh fgXMLStringLFU[]; + static const XMLCh fgXMLDeclString[]; + static const XMLCh fgXMLDeclStringSpace[]; + static const XMLCh fgXMLDeclStringHTab[]; + static const XMLCh fgXMLDeclStringLF[]; + static const XMLCh fgXMLDeclStringCR[]; + static const XMLCh fgXMLDeclStringSpaceU[]; + static const XMLCh fgXMLDeclStringHTabU[]; + static const XMLCh fgXMLDeclStringLFU[]; + static const XMLCh fgXMLDeclStringCRU[]; + static const XMLCh fgXMLNSString[]; + static const XMLCh fgXMLNSColonString[]; + static const XMLCh fgXMLNSURIName[]; + static const XMLCh fgXMLErrDomain[]; + static const XMLCh fgXMLURIName[]; + static const XMLCh fgInfosetURIName[]; + static const XMLCh fgYesString[]; + static const XMLCh fgZeroLenString[]; + static const XMLCh fgDTDEntityString[]; + static const XMLCh fgAmp[]; + static const XMLCh fgLT[]; + static const XMLCh fgGT[]; + static const XMLCh fgQuot[]; + static const XMLCh fgApos[]; + static const XMLCh fgWFXMLScanner[]; + static const XMLCh fgIGXMLScanner[]; + static const XMLCh fgSGXMLScanner[]; + static const XMLCh fgDGXMLScanner[]; + static const XMLCh fgXSAXMLScanner[]; + static const XMLCh fgCDataStart[]; + static const XMLCh fgCDataEnd[]; + + // Exception Name + static const XMLCh fgArrayIndexOutOfBoundsException_Name[]; + static const XMLCh fgEmptyStackException_Name[]; + static const XMLCh fgIllegalArgumentException_Name[]; + static const XMLCh fgInvalidCastException_Name[]; + static const XMLCh fgIOException_Name[]; + static const XMLCh fgNoSuchElementException_Name[]; + static const XMLCh fgNullPointerException_Name[]; + static const XMLCh fgXMLPlatformUtilsException_Name[]; + static const XMLCh fgRuntimeException_Name[]; + static const XMLCh fgTranscodingException_Name[]; + static const XMLCh fgUnexpectedEOFException_Name[]; + static const XMLCh fgUnsupportedEncodingException_Name[]; + static const XMLCh fgUTFDataFormatException_Name[]; + static const XMLCh fgNetAccessorException_Name[]; + static const XMLCh fgMalformedURLException_Name[]; + static const XMLCh fgNumberFormatException_Name[]; + static const XMLCh fgParseException_Name[]; + static const XMLCh fgInvalidDatatypeFacetException_Name[]; + static const XMLCh fgInvalidDatatypeValueException_Name[]; + static const XMLCh fgSchemaDateTimeException_Name[]; + static const XMLCh fgXPathException_Name[]; + static const XMLCh fgXSerializationException_Name[]; + static const XMLCh fgXMLXIncludeException_Name[]; + + // Numerical String + static const XMLCh fgNegINFString[]; + static const XMLCh fgNegZeroString[]; + static const XMLCh fgPosZeroString[]; + static const XMLCh fgPosINFString[]; + static const XMLCh fgNaNString[]; + static const XMLCh fgEString[]; + static const XMLCh fgZeroString[]; + static const XMLCh fgNullString[]; + + // Xerces features/properties names + static const XMLCh fgXercesDynamic[]; + static const XMLCh fgXercesSchema[]; + static const XMLCh fgXercesSchemaFullChecking[]; + static const XMLCh fgXercesLoadSchema[]; + static const XMLCh fgXercesIdentityConstraintChecking[]; + static const XMLCh fgXercesSchemaExternalSchemaLocation[]; + static const XMLCh fgXercesSchemaExternalNoNameSpaceSchemaLocation[]; + static const XMLCh fgXercesSecurityManager[]; + static const XMLCh fgXercesLoadExternalDTD[]; + static const XMLCh fgXercesContinueAfterFatalError[]; + static const XMLCh fgXercesValidationErrorAsFatal[]; + static const XMLCh fgXercesUserAdoptsDOMDocument[]; + static const XMLCh fgXercesCacheGrammarFromParse[]; + static const XMLCh fgXercesUseCachedGrammarInParse[]; + static const XMLCh fgXercesScannerName[]; + static const XMLCh fgXercesParserUseDocumentFromImplementation[]; + static const XMLCh fgXercesCalculateSrcOfs[]; + static const XMLCh fgXercesStandardUriConformant[]; + static const XMLCh fgXercesDOMHasPSVIInfo[]; + static const XMLCh fgXercesGenerateSyntheticAnnotations[]; + static const XMLCh fgXercesValidateAnnotations[]; + static const XMLCh fgXercesIgnoreCachedDTD[]; + static const XMLCh fgXercesIgnoreAnnotations[]; + static const XMLCh fgXercesDisableDefaultEntityResolution[]; + static const XMLCh fgXercesSkipDTDValidation[]; + static const XMLCh fgXercesEntityResolver[]; + static const XMLCh fgXercesHandleMultipleImports[]; + static const XMLCh fgXercesDoXInclude[]; + static const XMLCh fgXercesLowWaterMark[]; + + // SAX2 features/properties names + static const XMLCh fgSAX2CoreValidation[]; + static const XMLCh fgSAX2CoreNameSpaces[]; + static const XMLCh fgSAX2CoreNameSpacePrefixes[]; + + // Introduced in DOM Level 3 + // DOMLSParser features + static const XMLCh fgDOMCanonicalForm[]; + static const XMLCh fgDOMCDATASections[]; + static const XMLCh fgDOMComments[]; + static const XMLCh fgDOMCharsetOverridesXMLEncoding[]; + static const XMLCh fgDOMCheckCharacterNormalization[]; + static const XMLCh fgDOMDatatypeNormalization[]; + static const XMLCh fgDOMDisallowDoctype[]; + static const XMLCh fgDOMElementContentWhitespace[]; + static const XMLCh fgDOMErrorHandler[]; + static const XMLCh fgDOMEntities[]; + static const XMLCh fgDOMIgnoreUnknownCharacterDenormalization[]; + static const XMLCh fgDOMInfoset[]; + static const XMLCh fgDOMNamespaces[]; + static const XMLCh fgDOMNamespaceDeclarations[]; + static const XMLCh fgDOMNormalizeCharacters[]; + static const XMLCh fgDOMResourceResolver[]; + static const XMLCh fgDOMSchemaLocation[]; + static const XMLCh fgDOMSchemaType[]; + static const XMLCh fgDOMSplitCDATASections[]; + static const XMLCh fgDOMSupportedMediatypesOnly[]; + static const XMLCh fgDOMValidate[]; + static const XMLCh fgDOMValidateIfSchema[]; + static const XMLCh fgDOMWellFormed[]; + + static const XMLCh fgDOMXMLSchemaType[]; + static const XMLCh fgDOMDTDType[]; + + // Introduced in DOM Level 3 + // DOMLSSerializer feature + static const XMLCh fgDOMWRTCanonicalForm[]; + static const XMLCh fgDOMWRTDiscardDefaultContent[]; + static const XMLCh fgDOMWRTEntities[]; + static const XMLCh fgDOMWRTFormatPrettyPrint[]; + static const XMLCh fgDOMWRTNormalizeCharacters[]; + static const XMLCh fgDOMWRTSplitCdataSections[]; + static const XMLCh fgDOMWRTValidation[]; + static const XMLCh fgDOMWRTWhitespaceInElementContent[]; + static const XMLCh fgDOMWRTBOM[]; + static const XMLCh fgDOMXMLDeclaration[]; + static const XMLCh fgDOMWRTXercesPrettyPrint[]; + + // Private interface names + static const XMLCh fgXercescInterfacePSVITypeInfo[]; + static const XMLCh fgXercescInterfaceDOMDocumentTypeImpl[]; + static const XMLCh fgXercescInterfaceDOMDocumentImpl[]; + static const XMLCh fgXercescInterfaceDOMMemoryManager[]; + + // Locale + static const char fgXercescDefaultLocale[]; + + // Default Exception String + static const XMLCh fgDefErrMsg[]; + + // Datatype + static const XMLCh fgValueZero[]; + static const XMLCh fgNegOne[]; + static const XMLCh fgValueOne[]; + static const XMLCh fgLongMaxInc[]; + static const XMLCh fgLongMinInc[]; + static const XMLCh fgIntMaxInc[]; + static const XMLCh fgIntMinInc[]; + static const XMLCh fgShortMaxInc[]; + static const XMLCh fgShortMinInc[]; + static const XMLCh fgByteMaxInc[]; + static const XMLCh fgByteMinInc[]; + static const XMLCh fgULongMaxInc[]; + static const XMLCh fgUIntMaxInc[]; + static const XMLCh fgUShortMaxInc[]; + static const XMLCh fgUByteMaxInc[]; + static const XMLCh fgLangPattern[]; + + static const XMLCh fgBooleanValueSpace[][8]; + static const XMLSize_t fgBooleanValueSpaceArraySize; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLUni(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLUniDefs.hpp b/project/jni/xerces/src/xercesc/util/XMLUniDefs.hpp new file mode 100644 index 000000000..aaaaca6a6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUniDefs.hpp @@ -0,0 +1,154 @@ +/* + * 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: XMLUniDefs.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLUNIDEFS_HPP) +#define XERCESC_INCLUDE_GUARD_XMLUNIDEFS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constants for the Unicode characters of interest to us in an XML parser +// We don't put these inside the class because then they could not be const +// inline values, which would have significant performance ramifications. +// +// We cannot use a namespace because of the requirement to support old +// compilers. +// --------------------------------------------------------------------------- +const XMLCh chNull = 0x00; +const XMLCh chHTab = 0x09; +const XMLCh chLF = 0x0A; +const XMLCh chVTab = 0x0B; +const XMLCh chFF = 0x0C; +const XMLCh chCR = 0x0D; +const XMLCh chAmpersand = 0x26; +const XMLCh chAsterisk = 0x2A; +const XMLCh chAt = 0x40; +const XMLCh chBackSlash = 0x5C; +const XMLCh chBang = 0x21; +const XMLCh chCaret = 0x5E; +const XMLCh chCloseAngle = 0x3E; +const XMLCh chCloseCurly = 0x7D; +const XMLCh chCloseParen = 0x29; +const XMLCh chCloseSquare = 0x5D; +const XMLCh chColon = 0x3A; +const XMLCh chComma = 0x2C; +const XMLCh chDash = 0x2D; +const XMLCh chDollarSign = 0x24; +const XMLCh chDoubleQuote = 0x22; +const XMLCh chEqual = 0x3D; +const XMLCh chForwardSlash = 0x2F; +const XMLCh chGrave = 0x60; +const XMLCh chNEL = 0x85; +const XMLCh chOpenAngle = 0x3C; +const XMLCh chOpenCurly = 0x7B; +const XMLCh chOpenParen = 0x28; +const XMLCh chOpenSquare = 0x5B; +const XMLCh chPercent = 0x25; +const XMLCh chPeriod = 0x2E; +const XMLCh chPipe = 0x7C; +const XMLCh chPlus = 0x2B; +const XMLCh chPound = 0x23; +const XMLCh chQuestion = 0x3F; +const XMLCh chSingleQuote = 0x27; +const XMLCh chSpace = 0x20; +const XMLCh chSemiColon = 0x3B; +const XMLCh chTilde = 0x7E; +const XMLCh chUnderscore = 0x5F; + +const XMLCh chSwappedUnicodeMarker = XMLCh(0xFFFE); +const XMLCh chUnicodeMarker = XMLCh(0xFEFF); + +const XMLCh chDigit_0 = 0x30; +const XMLCh chDigit_1 = 0x31; +const XMLCh chDigit_2 = 0x32; +const XMLCh chDigit_3 = 0x33; +const XMLCh chDigit_4 = 0x34; +const XMLCh chDigit_5 = 0x35; +const XMLCh chDigit_6 = 0x36; +const XMLCh chDigit_7 = 0x37; +const XMLCh chDigit_8 = 0x38; +const XMLCh chDigit_9 = 0x39; + +const XMLCh chLatin_A = 0x41; +const XMLCh chLatin_B = 0x42; +const XMLCh chLatin_C = 0x43; +const XMLCh chLatin_D = 0x44; +const XMLCh chLatin_E = 0x45; +const XMLCh chLatin_F = 0x46; +const XMLCh chLatin_G = 0x47; +const XMLCh chLatin_H = 0x48; +const XMLCh chLatin_I = 0x49; +const XMLCh chLatin_J = 0x4A; +const XMLCh chLatin_K = 0x4B; +const XMLCh chLatin_L = 0x4C; +const XMLCh chLatin_M = 0x4D; +const XMLCh chLatin_N = 0x4E; +const XMLCh chLatin_O = 0x4F; +const XMLCh chLatin_P = 0x50; +const XMLCh chLatin_Q = 0x51; +const XMLCh chLatin_R = 0x52; +const XMLCh chLatin_S = 0x53; +const XMLCh chLatin_T = 0x54; +const XMLCh chLatin_U = 0x55; +const XMLCh chLatin_V = 0x56; +const XMLCh chLatin_W = 0x57; +const XMLCh chLatin_X = 0x58; +const XMLCh chLatin_Y = 0x59; +const XMLCh chLatin_Z = 0x5A; + +const XMLCh chLatin_a = 0x61; +const XMLCh chLatin_b = 0x62; +const XMLCh chLatin_c = 0x63; +const XMLCh chLatin_d = 0x64; +const XMLCh chLatin_e = 0x65; +const XMLCh chLatin_f = 0x66; +const XMLCh chLatin_g = 0x67; +const XMLCh chLatin_h = 0x68; +const XMLCh chLatin_i = 0x69; +const XMLCh chLatin_j = 0x6A; +const XMLCh chLatin_k = 0x6B; +const XMLCh chLatin_l = 0x6C; +const XMLCh chLatin_m = 0x6D; +const XMLCh chLatin_n = 0x6E; +const XMLCh chLatin_o = 0x6F; +const XMLCh chLatin_p = 0x70; +const XMLCh chLatin_q = 0x71; +const XMLCh chLatin_r = 0x72; +const XMLCh chLatin_s = 0x73; +const XMLCh chLatin_t = 0x74; +const XMLCh chLatin_u = 0x75; +const XMLCh chLatin_v = 0x76; +const XMLCh chLatin_w = 0x77; +const XMLCh chLatin_x = 0x78; +const XMLCh chLatin_y = 0x79; +const XMLCh chLatin_z = 0x7A; + +const XMLCh chYenSign = 0xA5; +const XMLCh chWonSign = 0x20A9; + +const XMLCh chLineSeparator = 0x2028; +const XMLCh chParagraphSeparator = 0x2029; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLUri.cpp b/project/jni/xerces/src/xercesc/util/XMLUri.cpp new file mode 100644 index 000000000..ff82db8e0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUri.cpp @@ -0,0 +1,2589 @@ +/* + * 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: XMLUri.cpp 881714 2009-11-18 10:39:06Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLUri: static data +// --------------------------------------------------------------------------- + +// Amended by RFC2732 +// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | +// "$" | "," | "[" | "]" +// +const XMLCh XMLUri::RESERVED_CHARACTERS[] = +{ + chSemiColon, chForwardSlash, chQuestion, chColon, chAt, + chAmpersand, chEqual, chPlus, chDollarSign, chComma, chOpenSquare, + chCloseSquare, chNull +}; + +// +// mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | +// "(" | ")" +// +const XMLCh XMLUri::MARK_CHARACTERS[] = +{ + chDash, chUnderscore, chPeriod, chBang, chTilde, + chAsterisk, chSingleQuote, chOpenParen, chCloseParen, chNull +}; + +// combination of MARK and RESERVED +const XMLCh XMLUri::MARK_OR_RESERVED_CHARACTERS[] = +{ + chDash, chUnderscore, chPeriod, chBang, chTilde, + chAsterisk, chSingleQuote, chOpenParen, chCloseParen, + chSemiColon, chForwardSlash, chQuestion, chColon, chAt, + chAmpersand, chEqual, chPlus, chDollarSign, chComma, chOpenSquare, + chCloseSquare, chNull +}; + +// +// scheme = alpha *( alpha | digit | "+" | "-" | "." ) +// +const XMLCh XMLUri::SCHEME_CHARACTERS[] = +{ + chPlus, chDash, chPeriod, chNull +}; + +// +// userinfo = *( unreserved | escaped | +// ";" | ":" | "&" | "=" | "+" | "$" | "," ) +// +const XMLCh XMLUri::USERINFO_CHARACTERS[] = +{ + chSemiColon, chColon, chAmpersand, chEqual, chPlus, + chDollarSign, chPeriod, chNull +}; + +// +// reg_name = 1*( unreserved | escaped | "$" | "," | +// ";" | ":" | "@" | "&" | "=" | "+" ) +// +const XMLCh XMLUri::REG_NAME_CHARACTERS[] = +{ + chDollarSign, chComma, chSemiColon, chColon, chAt, + chAmpersand, chEqual, chPlus, chNull +}; + +// pchar plus ';' and '/'. +// pchar = unreserved | escaped | +// ":" | "@" | "&" | "=" | "+" | "$" | "," +const XMLCh XMLUri::PATH_CHARACTERS[] = +{ + chSemiColon, chForwardSlash, chColon, chAt, chAmpersand, + chEqual, chPlus, chDollarSign, chComma, chNull +}; + + +// --------------------------------------------------------------------------- +// Local methods and data +// --------------------------------------------------------------------------- +static const int BUF_LEN = 64; + +// +// "Scheme" +// "SchemeSpecificPart" +// "Parameters" +// "UserInfo" +// "Host" +// "Port" +// "RegName" +// "Path" +// "Query" +// "Fragment" +// +static const XMLCh errMsg_SCHEME[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, + chLatin_m, chLatin_e, chNull +}; + +static const XMLCh errMsg_SCHEMESPART[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_e, + chLatin_S, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, + chLatin_i, chLatin_c, chLatin_P, chLatin_a, chLatin_r, chLatin_t, + chNull +}; + +static const XMLCh errMsg_PARAMS[] = +{ + chLatin_p, chLatin_a, chLatin_r, chLatin_a, chLatin_m, + chLatin_e, chLatin_t, chLatin_e, chLatin_r, chLatin_s, chNull +}; + +static const XMLCh errMsg_USERINFO[] = +{ + chLatin_u, chLatin_s, chLatin_e, chLatin_r, + chLatin_i, chLatin_n, chLatin_f, chLatin_o, chNull +}; + +static const XMLCh errMsg_HOST[] = +{ + chLatin_h, chLatin_o, chLatin_s, chLatin_t, chNull +}; + +static const XMLCh errMsg_PORT[] = +{ + chLatin_p, chLatin_o, chLatin_r, chLatin_t, chNull +}; + +static const XMLCh errMsg_REGNAME[] = +{ + chLatin_R, chLatin_e, chLatin_g, + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +static const XMLCh errMsg_PATH[] = +{ + chLatin_p, chLatin_a, chLatin_t, chLatin_h, chNull +}; + +static const XMLCh errMsg_QUERY[] = +{ + chLatin_q, chLatin_u, chLatin_e, chLatin_r, chLatin_y, chNull +}; + +static const XMLCh errMsg_FRAGMENT[] = +{ + chLatin_f, chLatin_r, chLatin_a, chLatin_g, + chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +// +// "//" +// "/" +// "./" +// "/." +// "/../" +// "/.." +// +static const XMLCh DOUBLE_SLASH[] = +{ + chForwardSlash, chForwardSlash, chNull +}; + +static const XMLCh SINGLE_SLASH[] = +{ + chForwardSlash, chNull +}; + +static const XMLCh SLASH_DOT_SLASH[] = +{ + chForwardSlash, chPeriod, chForwardSlash, chNull +}; + +static const XMLCh SLASH_DOT[] = +{ + chForwardSlash, chPeriod, chNull +}; + +static const XMLCh SLASH_DOTDOT_SLASH[] = +{ + chForwardSlash, chPeriod, chPeriod, chForwardSlash, chNull +}; + +static const XMLCh SLASH_DOTDOT[] = +{ + chForwardSlash, chPeriod, chPeriod, chNull +}; + +// +// ":/?#" +// +// REVISIT: why? +static const XMLCh SCHEME_SEPARATORS[] = +{ + chColon, chForwardSlash, chQuestion, chPound, chNull +}; + +// +// "?#" +// +static const XMLCh PATH_SEPARATORS[] = +{ + chQuestion, chPound, chNull +}; + +// --------------------------------------------------------------------------- +// XMLUri: Constructors and Helper methods +// --------------------------------------------------------------------------- +// ctor# 2 + +typedef JanitorMemFunCall CleanupType; + +XMLUri::XMLUri(const XMLCh* const uriSpec, + MemoryManager* const manager) +: fPort(-1) +, fScheme(0) +, fUserInfo(0) +, fHost(0) +, fRegAuth(0) +, fPath(0) +, fQueryString(0) +, fFragment(0) +, fURIText(0) +, fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLUri::cleanUp); + + try { + initialize((XMLUri *)0, uriSpec); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +// ctor# 7 relative ctor +XMLUri::XMLUri(const XMLUri* const baseURI + , const XMLCh* const uriSpec + , MemoryManager* const manager) +: fPort(-1) +, fScheme(0) +, fUserInfo(0) +, fHost(0) +, fRegAuth(0) +, fPath(0) +, fQueryString(0) +, fFragment(0) +, fURIText(0) +, fMemoryManager(manager) +{ + CleanupType cleanup(this, &XMLUri::cleanUp); + + try { + initialize(baseURI, uriSpec); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +//Copy constructor +XMLUri::XMLUri(const XMLUri& toCopy) +: XSerializable(toCopy) +, XMemory(toCopy) +, fPort(-1) +, fScheme(0) +, fUserInfo(0) +, fHost(0) +, fRegAuth(0) +, fPath(0) +, fQueryString(0) +, fFragment(0) +, fURIText(0) +, fMemoryManager(toCopy.fMemoryManager) +{ + CleanupType cleanup(this, &XMLUri::cleanUp); + + try { + initialize(toCopy); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XMLUri& XMLUri::operator=(const XMLUri& toAssign) +{ + cleanUp(); + + CleanupType cleanup(this, &XMLUri::cleanUp); + + try { + initialize(toAssign); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); + + return *this; +} + +XMLUri::~XMLUri() +{ + cleanUp(); +} + +void XMLUri::cleanUp() +{ + if (fScheme) + XMLString::release(&fScheme, fMemoryManager);//delete[] fScheme; + + if (fUserInfo) + XMLString::release(&fUserInfo, fMemoryManager);//delete[] fUserInfo; + + if (fHost) + XMLString::release(&fHost, fMemoryManager);//delete[] fHost; + + if (fRegAuth) + XMLString::release(&fRegAuth, fMemoryManager);//delete[] fRegAuth; + + if (fPath) + XMLString::release(&fPath, fMemoryManager);//delete[] fPath; + + if (fQueryString) + XMLString::release(&fQueryString, fMemoryManager);//delete[] fQueryString; + + if (fFragment) + XMLString::release(&fFragment, fMemoryManager);//delete[] fFragment; + + XMLString::release(&fURIText, fMemoryManager);//delete[] fURIText; +} + +void XMLUri::initialize(const XMLUri& toCopy) +{ + // + // assuming that all fields from the toCopy are valid, + // therefore need NOT to go through various setXXX() methods + // + fMemoryManager = toCopy.fMemoryManager; + fScheme = XMLString::replicate(toCopy.fScheme, fMemoryManager); + fUserInfo = XMLString::replicate(toCopy.fUserInfo, fMemoryManager); + fHost = XMLString::replicate(toCopy.fHost, fMemoryManager); + fPort = toCopy.fPort; + fRegAuth = XMLString::replicate(toCopy.fRegAuth, fMemoryManager); + fPath = XMLString::replicate(toCopy.fPath, fMemoryManager); + fQueryString = XMLString::replicate(toCopy.fQueryString, fMemoryManager); + fFragment = XMLString::replicate(toCopy.fFragment, fMemoryManager); +} + +void XMLUri::initialize(const XMLUri* const baseURI + , const XMLCh* const uriSpec) +{ + + // get a trimmed version of uriSpec + // uriSpec will NO LONGER be used in this function. + // + XMLCh* trimmedUriSpec = XMLString::replicate(uriSpec, fMemoryManager); + XMLString::trim(trimmedUriSpec); + ArrayJanitor janName(trimmedUriSpec, fMemoryManager); + XMLSize_t trimmedUriSpecLen = XMLString::stringLen(trimmedUriSpec); + + if ( !baseURI && + (!trimmedUriSpec || trimmedUriSpecLen == 0)) + { + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Empty + , errMsg_PARAMS + , fMemoryManager); + } + + // just make a copy of the base if spec is empty + if (!trimmedUriSpec || trimmedUriSpecLen == 0) + { + initialize(*baseURI); + return; + } + + XMLSize_t index = 0; + bool foundScheme = false; + + // Check for scheme, which must be before `/', '?' or '#'. + int colonIdx = XMLString::indexOf(trimmedUriSpec, chColon); + int slashIdx = XMLString::indexOf(trimmedUriSpec, chForwardSlash); + int queryIdx = XMLString::indexOf(trimmedUriSpec, chQuestion); + int fragmentIdx = XMLString::indexOf(trimmedUriSpec, chPound); + + if ((colonIdx <= 0) || + (colonIdx > slashIdx && slashIdx != -1) || + (colonIdx > queryIdx && queryIdx != -1) || + (colonIdx > fragmentIdx && fragmentIdx != -1)) + { + // A standalone base is a valid URI according to spec + if ( colonIdx == 0 || (!baseURI && fragmentIdx != 0) ) + { + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::XMLNUM_URI_No_Scheme, fMemoryManager); + } + } + else + { + foundScheme = true; + initializeScheme(trimmedUriSpec); + index = XMLString::stringLen(fScheme)+1; + } + + // It's an error if we stop here + if (index == trimmedUriSpecLen || (foundScheme && (trimmedUriSpec[index] == chPound))) + { + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Empty + , errMsg_PATH + , fMemoryManager); + } + + // two slashes means generic URI syntax, so we get the authority + XMLCh* authUriSpec = (XMLCh*) fMemoryManager->allocate + ( + (trimmedUriSpecLen+1) * sizeof(XMLCh) + );//new XMLCh[trimmedUriSpecLen+1]; + ArrayJanitor authName(authUriSpec, fMemoryManager); + XMLString::subString(authUriSpec, trimmedUriSpec, index, trimmedUriSpecLen, fMemoryManager); + + if (((index+1) < trimmedUriSpecLen) && + XMLString::startsWith(authUriSpec, DOUBLE_SLASH)) + { + index += 2; + XMLSize_t startPos = index; + + // get authority - everything up to path, query or fragment + XMLCh testChar; + while (index < trimmedUriSpecLen) + { + testChar = trimmedUriSpec[index]; + if (testChar == chForwardSlash || + testChar == chQuestion || + testChar == chPound ) + { + break; + } + + index++; + } + + // if we found authority, parse it out, otherwise we set the + // host to empty string + if (index > startPos) + { + XMLString::subString(authUriSpec, trimmedUriSpec, startPos, index, fMemoryManager); + initializeAuthority(authUriSpec); + } + else + { + //fHost = 0; + setHost(XMLUni::fgZeroLenString); + } + } + + // we need to check if index has exceed the lenght or not + if (index >= trimmedUriSpecLen) + return; + + XMLCh* pathUriSpec = (XMLCh*) fMemoryManager->allocate + ( + (trimmedUriSpecLen+1) * sizeof(XMLCh) + );//new XMLCh[trimmedUriSpecLen+1]; + ArrayJanitor pathUriSpecName(pathUriSpec, fMemoryManager); + XMLString::subString(pathUriSpec, trimmedUriSpec, index, trimmedUriSpecLen, fMemoryManager); + + initializePath(pathUriSpec); + + // Resolve relative URI to base URI - see RFC 2396 Section 5.2 + // In some cases, it might make more sense to throw an exception + // (when scheme is specified is the string spec and the base URI + // is also specified, for example), but we're just following the + // RFC specifications + if ( baseURI ) + { + // check to see if this is the current doc - RFC 2396 5.2 #2 + // note that this is slightly different from the RFC spec in that + // we don't include the check for query string being null + // - this handles cases where the urispec is just a query + // string or a fragment (e.g. "?y" or "#s") - + // see which + // identified this as a bug in the RFC + if ((!fPath || !*fPath) && + fScheme == 0 && + fHost == 0 && fRegAuth == 0) + { + fScheme = XMLString::replicate(baseURI->getScheme(), fMemoryManager); + fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo; + fUserInfo = XMLString::replicate(baseURI->getUserInfo(), fMemoryManager); + fHost = XMLString::replicate(baseURI->getHost(), fMemoryManager); + fPort = baseURI->getPort(); + fRegAuth = XMLString::replicate(baseURI->getRegBasedAuthority(), fMemoryManager); + fMemoryManager->deallocate(fPath);//delete [] fPath; + fPath = XMLString::replicate(baseURI->getPath(), fMemoryManager); + + if ( !fQueryString ) + { + fQueryString = XMLString::replicate(baseURI->getQueryString(), fMemoryManager); + } + return; + } + + // check for scheme - RFC 2396 5.2 #3 + // if we found a scheme, it means absolute URI, so we're done + if (fScheme == 0) + { + fScheme = XMLString::replicate(baseURI->getScheme(), fMemoryManager); + } + else + { + return; + } + + // check for authority - RFC 2396 5.2 #4 + // if we found a host, then we've got a network path, so we're done + if (fHost == 0 && fRegAuth == 0) + { + fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo; + fUserInfo = XMLString::replicate(baseURI->getUserInfo(), fMemoryManager); + fHost = XMLString::replicate(baseURI->getHost(), fMemoryManager); + fPort = baseURI->getPort(); + fRegAuth = XMLString::replicate(baseURI->getRegBasedAuthority(), fMemoryManager); + } + else + { + return; + } + + // check for absolute path - RFC 2396 5.2 #5 + if ((fPath && *fPath) && + XMLString::startsWith(fPath, SINGLE_SLASH)) + { + return; + } + + // if we get to this point, we need to resolve relative path + // RFC 2396 5.2 #6 + + XMLCh* basePath = XMLString::replicate(baseURI->getPath(), fMemoryManager); + ArrayJanitor basePathName(basePath, fMemoryManager); + + XMLSize_t bufLen = trimmedUriSpecLen+XMLString::stringLen(fPath)+XMLString::stringLen(basePath)+1; + XMLCh* path = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen]; + ArrayJanitor pathName(path, fMemoryManager); + path[0] = 0; + + XMLCh* tmp1 = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen]; + ArrayJanitor tmp1Name(tmp1, fMemoryManager); + XMLCh* tmp2 = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen]; + ArrayJanitor tmp2Name(tmp2, fMemoryManager); + + // 6a - get all but the last segment of the base URI path + if (basePath) + { + int lastSlash = XMLString::lastIndexOf(basePath, chForwardSlash); + if (lastSlash != -1) + { + XMLString::subString(path, basePath, 0, lastSlash+1, fMemoryManager); + } + } + + // 6b - append the relative URI path + XMLString::catString(path, fPath); + + // 6c - remove all "./" where "." is a complete path segment + int iIndex = -1; + while ((iIndex = XMLString::patternMatch(path, SLASH_DOT_SLASH)) != -1) + { + XMLString::subString(tmp1, path, 0, iIndex, fMemoryManager); + XMLString::subString(tmp2, path, iIndex+2, XMLString::stringLen(path), fMemoryManager); + + path[0] = 0; + XMLString::catString(path, tmp1); + XMLString::catString(path, tmp2); + } + + // 6d - remove "." if path ends with "." as a complete path segment + if (XMLString::endsWith(path, SLASH_DOT)) + { + path[XMLString::stringLen(path) - 1] = chNull; + } + + // 6e - remove all "/../" where "" is a complete + // path segment not equal to ".." + iIndex = -1; + int segIndex = -1; + int offset = 1; + + while ((iIndex = XMLString::patternMatch(&(path[offset]), SLASH_DOTDOT_SLASH)) != -1) + { + // Undo offset + iIndex += offset; + + // Find start of within substring ending at found point. + XMLString::subString(tmp1, path, 0, iIndex-1, fMemoryManager); + segIndex = XMLString::lastIndexOf(tmp1, chForwardSlash); + + // Ensure exists and != ".." + if (segIndex != -1 && + (path[segIndex+1] != chPeriod || + path[segIndex+2] != chPeriod || + segIndex + 3 != iIndex)) + { + + XMLString::subString(tmp1, path, 0, segIndex, fMemoryManager); + XMLString::subString(tmp2, path, iIndex+3, XMLString::stringLen(path), fMemoryManager); + + path[0] = 0; + XMLString::catString(path, tmp1); + XMLString::catString(path, tmp2); + + offset = (segIndex == 0 ? 1 : segIndex); + } + else + { + offset += 4; + } + }// while + + // 6f - remove ending "/.." where "" is a + // complete path segment + if (XMLString::endsWith(path, SLASH_DOTDOT)) + { + // Find start of within substring ending at found point. + index = XMLString::stringLen(path) - 3; + XMLString::subString(tmp1, path, 0, index-1, fMemoryManager); + segIndex = XMLString::lastIndexOf(tmp1, chForwardSlash); + + if (segIndex != -1 && + (path[segIndex+1] != chPeriod || + path[segIndex+2] != chPeriod || + segIndex + 3 != (int)index)) + { + path[segIndex+1] = chNull; + } + } + + if (getPath()) + fMemoryManager->deallocate(fPath);//delete [] fPath; + + fPath = XMLString::replicate(path, fMemoryManager); + + } +} + +// --------------------------------------------------------------------------- +// Components initialization +// --------------------------------------------------------------------------- + +// +// authority = server | reg_name +// server = [ [ userinfo "@" ] hostport ] +// hostport = host [ ":" port ] +// +// reg_name = 1*( unreserved | escaped | "$" | "," | +// ";" | ":" | "@" | "&" | "=" | "+" ) +// +// userinfo = *( unreserved | escaped | +// ";" | ":" | "&" | "=" | "+" | "$" | "," ) +// + +void XMLUri::initializeAuthority(const XMLCh* const uriSpec) +{ + + int index = 0; + XMLSize_t start = 0; + const XMLSize_t end = XMLString::stringLen(uriSpec); + + // + // server = [ [ userinfo "@" ] hostport ] + // userinfo is everything up @, + // + XMLCh* userinfo = (XMLCh*) fMemoryManager->allocate + ( + (end+1) * sizeof(XMLCh) + );//new XMLCh[end+1]; + ArrayJanitor userName(userinfo, fMemoryManager); + index = XMLString::indexOf(&(uriSpec[start]), chAt); + + if ( index != -1) + { + XMLString::subString(userinfo, &(uriSpec[start]), 0, index, fMemoryManager); + index++; // skip the @ + start += index; + } + else + { + userinfo = 0; + } + + // + // hostport = host [ ":" port ] + // host is everything up to ':', or up to + // and including ']' if followed by ':'. + // + XMLCh* host = (XMLCh*) fMemoryManager->allocate + ( + (end+1) * sizeof(XMLCh) + );//new XMLCh[end+1]; + ArrayJanitor hostName(host, fMemoryManager); + + // Search for port boundary. + if (start < end && uriSpec[start] == chOpenSquare) + { + index = XMLString::indexOf(&(uriSpec[start]), chCloseSquare); + if (index != -1) + { + // skip the ']' + index = ((start + index + 1) < end + && uriSpec[start + index + 1] == chColon) ? index+1 : -1; + } + } + else + { + index = XMLString::indexOf(&(uriSpec[start]), chColon); + } + + if ( index != -1 ) + { + XMLString::subString(host, &(uriSpec[start]), 0, index, fMemoryManager); + index++; // skip the : + start +=index; + } + else + { + XMLString::subString(host, &(uriSpec[start]), 0, end-start, fMemoryManager); + start = end; + } + + // port is everything after ":" + + XMLCh* portStr = (XMLCh*) fMemoryManager->allocate + ( + (end+1) * sizeof(XMLCh) + );//new XMLCh[end+1]; + ArrayJanitor portName(portStr, fMemoryManager); + int port = -1; + + if ((host && *host) && // non empty host + (index != -1) && // ":" found + (start < end) ) // ":" is not the last + { + XMLString::subString(portStr, &(uriSpec[start]), 0, end-start, fMemoryManager); + + if (portStr && *portStr) + { + port = XMLString::parseInt(portStr, fMemoryManager); + } + } // if > 0 + + // Check if we have server based authority. + if (isValidServerBasedAuthority(host, port, userinfo, fMemoryManager)) + { + if (fHost) + fMemoryManager->deallocate(fHost);//delete [] fHost; + + if (fUserInfo) + fMemoryManager->deallocate(fUserInfo);//delete[] fUserInfo; + + fHost = XMLString::replicate(host, fMemoryManager); + fPort = port; + fUserInfo = XMLString::replicate(userinfo, fMemoryManager); + + return; + } + // This must be registry based authority or the URI is malformed. + setRegBasedAuthority(uriSpec); +} + +// scheme = alpha *( alpha | digit | "+" | "-" | "." ) +void XMLUri::initializeScheme(const XMLCh* const uriSpec) +{ + const XMLCh* tmpPtr = XMLString::findAny(uriSpec, SCHEME_SEPARATORS); + + if ( !tmpPtr ) + { + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::XMLNUM_URI_No_Scheme, fMemoryManager); + } + else + { + XMLCh* scheme = (XMLCh*) fMemoryManager->allocate + ( + (XMLString::stringLen(uriSpec) + 1) * sizeof(XMLCh) + );//new XMLCh[XMLString::stringLen(uriSpec)+1]; + ArrayJanitor tmpName(scheme, fMemoryManager); + XMLString::subString(scheme, uriSpec, 0, (tmpPtr - uriSpec), fMemoryManager); + setScheme(scheme); + } + +} + +void XMLUri::initializePath(const XMLCh* const uriSpec) +{ + if ( !uriSpec ) + { + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Empty + , errMsg_PATH + , fMemoryManager); + } + + XMLSize_t index = 0; + XMLSize_t start = 0; + XMLSize_t end = XMLString::stringLen(uriSpec); + XMLCh testChar = 0; + + // path - everything up to query string or fragment + if (start < end) + { + // RFC 2732 only allows '[' and ']' to appear in the opaque part. + if (!getScheme() || uriSpec[start] == chForwardSlash) + { + // Scan path. + // abs_path = "/" path_segments + // rel_path = rel_segment [ abs_path ] + while (index < end) + { + testChar = uriSpec[index]; + if (testChar == chQuestion || testChar == chPound) + { + break; + } + + // check for valid escape sequence + if (testChar == chPercent) + { + if (index+2 >= end || + !XMLString::isHex(uriSpec[index+1]) || + !XMLString::isHex(uriSpec[index+2])) + { + XMLCh value1[BUF_LEN+1]; + XMLString::moveChars(value1, &(uriSpec[index]), 3); + value1[3] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , errMsg_PATH + , value1 + , fMemoryManager); + } + } + else if (!isUnreservedCharacter(testChar) && + !isPathCharacter(testChar)) + { + XMLCh value1[BUF_LEN+1]; + value1[0] = testChar; + value1[1] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_PATH + , value1 + , fMemoryManager); + } + + index++; + }//while (index < end) + } + else + { + // Scan opaque part. + // opaque_part = uric_no_slash *uric + while (index < end) + { + testChar = uriSpec[index]; + if (testChar == chQuestion || testChar == chPound) + { + break; + } + + // check for valid escape sequence + if (testChar == chPercent) + { + if (index+2 >= end || + !XMLString::isHex(uriSpec[index+1]) || + !XMLString::isHex(uriSpec[index+2])) + { + XMLCh value1[BUF_LEN+1]; + XMLString::moveChars(value1, &(uriSpec[index]), 3); + value1[3] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , errMsg_PATH + , value1 + , fMemoryManager); + } + } + // If the scheme specific part is opaque, it can contain '[' + // and ']'. uric_no_slash wasn't modified by RFC 2732, which + // I've interpreted as an error in the spec, since the + // production should be equivalent to (uric - '/'), and uric + // contains '[' and ']'. + else if (!isReservedOrUnreservedCharacter(testChar)) + { + XMLCh value1[BUF_LEN+1]; + value1[0] = testChar; + value1[1] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_PATH + , value1 + , fMemoryManager); + } + + index++; + }//while (index < end) + } + } //if (start < end) + + if (getPath()) + { + fMemoryManager->deallocate(fPath);//delete [] fPath; + } + + fPath = (XMLCh*) fMemoryManager->allocate((index+1) * sizeof(XMLCh));//new XMLCh[index+1]; + XMLString::subString(fPath, uriSpec, start, index, fMemoryManager); + + // query - starts with ? and up to fragment or end + if (testChar == chQuestion) + { + index++; + start = index; + while (index < end) + { + testChar = uriSpec[index]; + if (testChar == chPound) + { + break; + } + + if (testChar == chPercent) + { + if (index+2 >= end || + !XMLString::isHex(uriSpec[index+1]) || + !XMLString::isHex(uriSpec[index+2])) + { + XMLCh value1[BUF_LEN+1]; + XMLString::moveChars(value1, &(uriSpec[index]), 3); + value1[3] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , errMsg_QUERY + , value1 + , fMemoryManager); + } + } + else if (!isReservedOrUnreservedCharacter(testChar)) + { + XMLCh value1[BUF_LEN+1]; + value1[0] = testChar; + value1[1] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_QUERY + , value1 + , fMemoryManager); + } + index++; + } + + if (getQueryString()) + { + fMemoryManager->deallocate(fQueryString);//delete [] fQueryString; + } + + fQueryString = (XMLCh*) fMemoryManager->allocate + ( + (index - start + 1) * sizeof(XMLCh) + );//new XMLCh[index - start + 1]; + XMLString::subString(fQueryString, uriSpec, start, index, fMemoryManager); + } + + // fragment - starts with # + if (testChar == chPound) + { + index++; + start = index; + while (index < end) + { + testChar = uriSpec[index]; + + if (testChar == chPercent) + { + if (index+2 >= end || + !XMLString::isHex(uriSpec[index+1]) || + !XMLString::isHex(uriSpec[index+2])) + { + XMLCh value1[BUF_LEN+1]; + XMLString::moveChars(value1, &(uriSpec[index]), 3); + value1[3] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , errMsg_FRAGMENT + , value1 + , fMemoryManager); + } + } + else if (!isReservedOrUnreservedCharacter(testChar)) + { + XMLCh value1[BUF_LEN+1]; + value1[0] = testChar; + value1[1] = chNull; + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_FRAGMENT + , value1 + , fMemoryManager); + } + + index++; + + } + + if (getFragment()) + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + + //make sure that there is something following the '#' + if (index > start) + { + fFragment = (XMLCh*) fMemoryManager->allocate + ( + (index - start + 1) * sizeof(XMLCh) + );//new XMLCh[index - start + 1]; + XMLString::subString(fFragment, uriSpec, start, index, fMemoryManager); + } + else + { + // RFC 2396, 4.0. URI Reference + // URI-reference = [absoulteURI | relativeURI] [# fragment] + // + // RFC 2396, 4.1. Fragment Identifier + // fragment = *uric + // + // empty fragment is valid + fFragment = 0; + } + } + +} + +// --------------------------------------------------------------------------- +// Setter +// --------------------------------------------------------------------------- +void XMLUri::setScheme(const XMLCh* const newScheme) +{ + if ( !newScheme ) + { + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Set_Null + , errMsg_SCHEME + , fMemoryManager); + } + + if (!isConformantSchemeName(newScheme)) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Not_Conformant + , errMsg_SCHEME + , newScheme + , fMemoryManager); + } + + if (getScheme()) + { + fMemoryManager->deallocate(fScheme);//delete [] fScheme; + } + + fScheme = XMLString::replicate(newScheme, fMemoryManager); + XMLString::lowerCase(fScheme); +} + +// +// server = [ [ userinfo "@" ] hostport ] +// hostport = host [":" port] +// +// setUserInfo(), setHost() and setPort() are closely related +// three methods, in a word, userinfo and port has dependency +// on host. +// +// if host is not present, userinfo must be null and port = -1 +// +void XMLUri::setUserInfo(const XMLCh* const newUserInfo) +{ + if ( newUserInfo && + !getHost() ) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_NullHost + , errMsg_USERINFO + , newUserInfo + , fMemoryManager); + } + + isConformantUserInfo(newUserInfo, fMemoryManager); + + if (getUserInfo()) + { + fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo; + } + + //sometimes we get passed a empty string rather than a null. + //Other procedures rely on it being null + if(newUserInfo && *newUserInfo) { + fUserInfo = XMLString::replicate(newUserInfo, fMemoryManager); + } + else + fUserInfo = 0; + +} + +void XMLUri::setHost(const XMLCh* const newHost) +{ + if ( !newHost ) + { + if (getHost()) + fMemoryManager->deallocate(fHost);//delete [] fHost; + + fHost = 0; + setUserInfo(0); + setPort(-1); + + return; + } + + if ( *newHost && !isWellFormedAddress(newHost, fMemoryManager)) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Not_Conformant + , errMsg_HOST + , newHost + , fMemoryManager); + } + + if (getHost()) + { + fMemoryManager->deallocate(fHost);//delete [] fHost; + } + + fHost = XMLString::replicate(newHost, fMemoryManager); + setRegBasedAuthority(0); +} + +void XMLUri::setPort(int newPort) +{ + if (newPort >= 0 && newPort <= 65535) + { + if (!getHost()) + { + XMLCh value1[BUF_LEN+1]; + XMLString::binToText(newPort, value1, BUF_LEN, 10, fMemoryManager); + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_NullHost + , errMsg_PORT + , value1 + , fMemoryManager); + } + } + else if (newPort != -1) + { + XMLCh value1[BUF_LEN+1]; + XMLString::binToText(newPort, value1, BUF_LEN, 10, fMemoryManager); + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_PortNo_Invalid + , value1 + , fMemoryManager); + } + + fPort = newPort; +} + +void XMLUri::setRegBasedAuthority(const XMLCh* const newRegAuth) +{ + if ( !newRegAuth ) + { + if (getRegBasedAuthority()) + fMemoryManager->deallocate(fRegAuth);//delete [] fRegAuth; + + fRegAuth = 0; + return; + } + // reg_name = 1*( unreserved | escaped | "$" | "," | + // ";" | ":" | "@" | "&" | "=" | "+" ) + else if ( !*newRegAuth || !isValidRegistryBasedAuthority(newRegAuth) ) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Not_Conformant + , errMsg_REGNAME + , newRegAuth + , fMemoryManager); + } + + if (getRegBasedAuthority()) + fMemoryManager->deallocate(fRegAuth);//delete [] fRegAuth; + + fRegAuth = XMLString::replicate(newRegAuth, fMemoryManager); + setHost(0); +} + +// +// setPath(), setQueryString() and setFragment() are closely +// related three methods as well. +// +void XMLUri::setPath(const XMLCh* const newPath) +{ + if (!newPath) + { + if (getPath()) + fMemoryManager->deallocate(fPath);//delete [] fPath; + + fPath = 0; + setQueryString(0); + setFragment(0); + } + else + { + initializePath(newPath); + } +} + +// +// fragment = *uric +// +void XMLUri::setFragment(const XMLCh* const newFragment) +{ + if ( !newFragment ) + { + if (getFragment()) + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + + fFragment = 0; + } + else if (!isGenericURI()) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_for_GenURI_Only + , errMsg_FRAGMENT + , newFragment + , fMemoryManager); + } + else if ( !getPath() ) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_NullPath + , errMsg_FRAGMENT + , newFragment + , fMemoryManager); + } + else if (!isURIString(newFragment)) + { + ThrowXMLwithMemMgr1(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_FRAGMENT + , fMemoryManager); + } + else + { + if (getFragment()) + { + fMemoryManager->deallocate(fFragment);//delete [] fFragment; + } + + fFragment = XMLString::replicate(newFragment, fMemoryManager); + } +} + +// +// query = *uric +// +void XMLUri::setQueryString(const XMLCh* const newQueryString) +{ + if ( !newQueryString ) + { + if (getQueryString()) + fMemoryManager->deallocate(fQueryString);//delete [] fQueryString; + + fQueryString = 0; + } + else if (!isGenericURI()) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_for_GenURI_Only + , errMsg_QUERY + , newQueryString + , fMemoryManager); + } + else if ( !getPath() ) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_NullPath + , errMsg_QUERY + , newQueryString + , fMemoryManager); + } + else if (!isURIString(newQueryString)) + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_QUERY + , newQueryString + , fMemoryManager); + } + else + { + if (getQueryString()) + { + fMemoryManager->deallocate(fQueryString);//delete [] fQueryString; + } + + fQueryString = XMLString::replicate(newQueryString, fMemoryManager); + } +} + +// --------------------------------------------------------------------------- +// XMLUri: Public, static methods +// --------------------------------------------------------------------------- + +// +// scheme = alpha *( alpha | digit | "+" | "-" | "." ) +// alphanum = alpha | digit +// +bool XMLUri::isConformantSchemeName(const XMLCh* const scheme) +{ + if ( !scheme ) + return false; + + const XMLCh* tmpStr = scheme; + if (!XMLString::isAlpha(*tmpStr)) // first: alpha + return false; + + // second onwards: ( alpha | digit | "+" | "-" | "." ) + tmpStr++; + while (*tmpStr) + { + if ( !XMLString::isAlphaNum(*tmpStr) && + (XMLString::indexOf(SCHEME_CHARACTERS, *tmpStr) == -1)) + return false; + + tmpStr++; + } + + return true; +} + +// +// userinfo = *( unreserved | escaped | +// ";" | ":" | "&" | "=" | "+" | "$" | "," ) +// +void XMLUri::isConformantUserInfo(const XMLCh* const userInfo + , MemoryManager* const manager) +{ + if ( !userInfo ) + return; + + const XMLCh* tmpStr = userInfo; + while (*tmpStr) + { + if ( isUnreservedCharacter(*tmpStr) || + (XMLString::indexOf(USERINFO_CHARACTERS, *tmpStr) != -1)) + { + tmpStr++; + } + else if (*tmpStr == chPercent) // '%' + { + if (XMLString::isHex(*(tmpStr+1)) && // 1st hex + XMLString::isHex(*(tmpStr+2)) ) // 2nd hex + { + tmpStr+=3; + } + else + { + XMLCh value1[BUF_LEN+1]; + value1[0] = chPercent; + value1[1] = *(tmpStr+1); + value1[2] = *(tmpStr+2); + value1[3] = chNull; + + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , errMsg_USERINFO + , value1 + , manager); + } + } + else + { + ThrowXMLwithMemMgr2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_Char + , errMsg_USERINFO + , userInfo + , manager); + } + } //while + + return; +} + +bool XMLUri::isValidServerBasedAuthority(const XMLCh* const host, + const XMLSize_t hostLen, + const int port, + const XMLCh* const userinfo, + const XMLSize_t userLen) +{ + // The order is important, do not change + if (!isWellFormedAddress(host, hostLen)) + return false; + + // check port number + if ((port > 65535) || (port < 0 && port != -1)) + return false; + + // check userinfo + XMLSize_t index = 0; + while (index < userLen) + { + if (isUnreservedCharacter(userinfo[index]) || + (XMLString::indexOf(USERINFO_CHARACTERS, userinfo[index]) != -1)) + { + index++; + } + else if (userinfo[index] == chPercent) // '%' + { + if (XMLString::isHex(userinfo[index+1]) && // 1st hex + XMLString::isHex(userinfo[index+2]) ) // 2nd hex + index +=3; + else + return false; + } + else + return false; + } //while + + return true; +} + +bool XMLUri::isValidServerBasedAuthority(const XMLCh* const host + , const int port + , const XMLCh* const userinfo + , MemoryManager* const manager) +{ + // The order is important, do not change + if (!isWellFormedAddress(host, manager)) + return false; + + // check port number + if ((port > 65535) || (port < 0 && port != -1)) + return false; + + // check userinfo + if (!userinfo) + return true; + + const XMLCh* tmpStr = userinfo; + while (*tmpStr) + { + if ( isUnreservedCharacter(*tmpStr) || + (XMLString::indexOf(USERINFO_CHARACTERS, *tmpStr) != -1)) + { + tmpStr++; + } + else if (*tmpStr == chPercent) // '%' + { + if (XMLString::isHex(*(tmpStr+1)) && // 1st hex + XMLString::isHex(*(tmpStr+2)) ) // 2nd hex + { + tmpStr+=3; + } + else + return false; + } + else + return false; + } //while + + return true; +} + +bool XMLUri::isValidRegistryBasedAuthority(const XMLCh* const authority, + const XMLSize_t authLen) +{ + // check authority + XMLSize_t index = 0; + while (index < authLen) + { + if (isUnreservedCharacter(authority[index]) || + (XMLString::indexOf(REG_NAME_CHARACTERS, authority[index]) != -1)) + { + index++; + } + else if (authority[index] == chPercent) // '%' + { + if (XMLString::isHex(authority[index+1]) && // 1st hex + XMLString::isHex(authority[index+2]) ) // 2nd hex + index +=3; + else + return false; + } + else + return false; + } //while + + return true; +} + +bool XMLUri::isValidRegistryBasedAuthority(const XMLCh* const authority) +{ + // check authority + if (!authority) + return false; + + const XMLCh* tmpStr = authority; + while (*tmpStr) + { + if (isUnreservedCharacter(*tmpStr) || + (XMLString::indexOf(REG_NAME_CHARACTERS, *tmpStr) != -1)) + { + tmpStr++; + } + else if (*tmpStr == chPercent) // '%' + { + if (XMLString::isHex(*(tmpStr+1)) && // 1st hex + XMLString::isHex(*(tmpStr+2)) ) // 2nd hex + { + tmpStr+=3; + } + else + return false; + } + else + return false; + } //while + + return true; +} + +// +// uric = reserved | unreserved | escaped +// escaped = "%" hex hex +// hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | +// "a" | "b" | "c" | "d" | "e" | "f" +// +bool XMLUri::isURIString(const XMLCh* const uricString) +{ + if (!uricString || !*uricString) + return false; + + const XMLCh* tmpStr = uricString; + + while (*tmpStr) + { + if (isReservedOrUnreservedCharacter(*tmpStr)) + { + tmpStr++; + } + else if (*tmpStr == chPercent) // '%' + { + if (XMLString::isHex(*(tmpStr+1)) && // 1st hex + XMLString::isHex(*(tmpStr+2)) ) // 2nd hex + { + tmpStr+=3; + } + else + { + return false; + } + } + else + { + return false; + } + } + + return true; +} + +// +// host = hostname | IPv4address +// +// hostname = *( domainlabel "." ) toplabel [ "." ] +// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum +// toplabel = alpha | alpha *( alphanum | "-" ) alphanum +// +// IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT +// +bool XMLUri::isWellFormedAddress(const XMLCh* const addrString + , MemoryManager* const manager) +{ + // Check that we have a non-zero length string. + if (!addrString || !*addrString) + return false; + + // Get address length. + XMLSize_t addrStrLen = XMLString::stringLen(addrString); + + // Check if the host is a valid IPv6reference. + if (*addrString == chOpenSquare) + { + return isWellFormedIPv6Reference(addrString, addrStrLen); + } + + // + // Cannot start with a '.', '-', or end with a '-'. + // + if (*addrString == chPeriod || + *addrString == chDash || + addrString[addrStrLen-1] == chDash) + return false; + + // rightmost domain label starting with digit indicates IP address + // since top level domain label can only start with an alpha + // see RFC 2396 Section 3.2.2 + + int lastPeriodPos = XMLString::lastIndexOf(addrString, chPeriod); + + // if the string ends with "." + // get the second last "." + if (XMLSize_t(lastPeriodPos + 1) == addrStrLen) + { + XMLCh* tmp2 = (XMLCh*) manager->allocate + ( + addrStrLen * sizeof(XMLCh) + );//new XMLCh[addrStrLen]; + XMLString::subString(tmp2, addrString, 0, lastPeriodPos, manager); + lastPeriodPos = XMLString::lastIndexOf(tmp2, chPeriod); + manager->deallocate(tmp2);//delete [] tmp2; + + if ( XMLString::isDigit(addrString[lastPeriodPos + 1])) + return false; + } + + if (XMLString::isDigit(addrString[lastPeriodPos + 1])) + { + return isWellFormedIPv4Address(addrString, addrStrLen); + } // end of IPv4address + else + { + // + // hostname = *( domainlabel "." ) toplabel [ "." ] + // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum + // toplabel = alpha | alpha *( alphanum | "-" ) alphanum + + // RFC 2396 states that hostnames take the form described in + // RFC 1034 (Section 3) and RFC 1123 (Section 2.1). According + // to RFC 1034, hostnames are limited to 255 characters. + if (addrStrLen > 255) { + return false; + } + + unsigned int labelCharCount = 0; + + // domain labels can contain alphanumerics and '-" + // but must start and end with an alphanumeric + for (XMLSize_t i = 0; i < addrStrLen; i++) + { + if (addrString[i] == chPeriod) + { + if (((i > 0) && + (!XMLString::isAlphaNum(addrString[i-1]))) || + ((i + 1 < addrStrLen) && + (!XMLString::isAlphaNum(addrString[i+1]))) ) + { + return false; + } + labelCharCount = 0; + } + else if (!XMLString::isAlphaNum(addrString[i]) && + addrString[i] != chDash) + { + return false; + } + // RFC 1034: Labels must be 63 characters or less. + else if (++labelCharCount > 63) { + return false; + } + } //for + } + + return true; +} + +// +// RFC 2732 amended RFC 2396 by replacing the definition +// of IPv4address with the one defined by RFC 2373. +// +// IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT +// +bool XMLUri::isWellFormedIPv4Address(const XMLCh* const addr, const XMLSize_t length) +{ + int numDots = 0; + int numDigits = 0; + + // IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT + // + // make sure that + // 1) we see only digits and dot separators, + // 2) that any dot separator is preceded and followed by a digit + // 3) that we find 3 dots + // 4) that each segment contains 1 to 3 digits. + // 5) that each segment is not greater than 255. + for (XMLSize_t i = 0; i < length; ++i) + { + if (addr[i] == chPeriod) + { + if ((i == 0) || + (i+1 == length) || + !XMLString::isDigit(addr[i+1])) + { + return false; + } + numDigits = 0; + if (++numDots > 3) + return false; + } + else if (!XMLString::isDigit(addr[i])) + { + return false; + } + // Check that that there are no more than three digits + // in this segment. + else if (++numDigits > 3) + { + return false; + } + // Check that this segment is not greater than 255. + else if (numDigits == 3) + { + XMLCh first = addr[i-2]; + XMLCh second = addr[i-1]; + XMLCh last = addr[i]; + if (!(first < chDigit_2 || + (first == chDigit_2 && + (second < chDigit_5 || + (second == chDigit_5 && last <= chDigit_5))))) + { + return false; + } + } + } //for + return (numDots == 3); +} + +// +// IPv6reference = "[" IPv6address "]" +// +bool XMLUri::isWellFormedIPv6Reference(const XMLCh* const addr, const XMLSize_t length) +{ + XMLSize_t end = length-1; + + // Check if string is a potential match for IPv6reference. + if (!(length > 2 && addr[0] == chOpenSquare && addr[end] == chCloseSquare)) + { + return false; + } + + // Counter for the number of 16-bit sections read in the address. + int counter = 0; + + // Scan hex sequence before possible '::' or IPv4 address. + int iIndex = scanHexSequence(addr, 1, end, counter); + if (iIndex == -1) + return false; + + XMLSize_t index=(XMLSize_t)iIndex; + // Address must contain 128-bits of information. + if (index == end) + { + return (counter == 8); + } + + if (index+1 < end && addr[index] == chColon) + { + if (addr[index+1] == chColon) + { + // '::' represents at least one 16-bit group of zeros. + if (++counter > 8) + { + return false; + } + index += 2; + // Trailing zeros will fill out the rest of the address. + if (index == end) + { + return true; + } + } + // If the second character wasn't ':', in order to be valid, + // the remainder of the string must match IPv4Address, + // and we must have read exactly 6 16-bit groups. + else + { + if (counter == 6) + return isWellFormedIPv4Address(addr+index+1, end-index-1); + else + return false; + } + } + else + { + return false; + } + + // 3. Scan hex sequence after '::'. + int prevCount = counter; + iIndex = scanHexSequence(addr, index, end, counter); + if (iIndex == -1) + return false; + + index=(XMLSize_t)iIndex; + // If this is the end of the address then + // we've got 128-bits of information. + if (index == end) + { + return true; + } + + // The address ends in an IPv4 address, or it is invalid. + // scanHexSequence has already made sure that we have the right number of bits. + XMLSize_t shiftCount = (counter > prevCount) ? index+1 : index; + return isWellFormedIPv4Address(addr + shiftCount, end - shiftCount); +} + +// +// For use with isWellFormedIPv6Reference only. +// +int XMLUri::scanHexSequence (const XMLCh* const addr, XMLSize_t index, XMLSize_t end, int& counter) +{ + XMLCh testChar = chNull; + int numDigits = 0; + XMLSize_t start = index; + + // Trying to match the following productions: + // hexseq = hex4 *( ":" hex4) + // hex4 = 1*4HEXDIG + for (; index < end; ++index) + { + testChar = addr[index]; + if (testChar == chColon) + { + // IPv6 addresses are 128-bit, so there can be at most eight sections. + if (numDigits > 0 && ++counter > 8) + { + return -1; + } + // This could be '::'. + if (numDigits == 0 || ((index+1 < end) && addr[index+1] == chColon)) + { + return (int)index; + } + numDigits = 0; + } + // This might be invalid or an IPv4address. If it's potentially an IPv4address, + // backup to just after the last valid character that matches hexseq. + else if (!XMLString::isHex(testChar)) + { + if (testChar == chPeriod && numDigits < 4 && numDigits > 0 && counter <= 6) + { + int back = (int)index - numDigits - 1; + return (back >= (int)start) ? back : (int)start; + } + return -1; + } + // There can be at most 4 hex digits per group. + else if (++numDigits > 4) + { + return -1; + } + } + return (numDigits > 0 && ++counter <= 8) ? (int)end : -1; +} + +bool XMLUri::isGenericURI() +{ + return (getHost() != 0); +} + + +// +// This method will take the broken out parts of the URI and build up the +// full text. We don't do this unless someone asks us to, since its often +// never required. +// +void XMLUri::buildFullText() +{ + // Calculate the worst case size of the buffer required + XMLSize_t bufSize = XMLString::stringLen(fScheme) + 1 + + XMLString::stringLen(fFragment) + 1 + + XMLString::stringLen(fHost ? fHost : fRegAuth) + 2 + + XMLString::stringLen(fPath) + + XMLString::stringLen(fQueryString) + 1 + + XMLString::stringLen(fUserInfo) + 1 + + 32; + + // Clean up the existing buffer and allocate another + fMemoryManager->deallocate(fURIText);//delete [] fURIText; + fURIText = (XMLCh*) fMemoryManager->allocate(bufSize * sizeof(XMLCh));//new XMLCh[bufSize]; + *fURIText = 0; + + XMLCh* outPtr = fURIText; + if (fScheme != 0) + { + XMLString::catString(fURIText, getScheme()); + outPtr += XMLString::stringLen(fURIText); + *outPtr++ = chColon; + } + + // Authority + if (fHost || fRegAuth) + { + *outPtr++ = chForwardSlash; + *outPtr++ = chForwardSlash; + + // Server based authority. + if (fHost) + { + if (fUserInfo) + { + XMLString::copyString(outPtr, fUserInfo); + outPtr += XMLString::stringLen(fUserInfo); + *outPtr++ = chAt; + } + + XMLString::copyString(outPtr, fHost); + outPtr += XMLString::stringLen(fHost); + + // + // If the port is -1, then we don't put it in. Else we need + // to because it was explicitly provided. + // + if (fPort != -1) + { + *outPtr++ = chColon; + + XMLCh tmpBuf[17]; + XMLString::binToText(fPort, tmpBuf, 16, 10, fMemoryManager); + XMLString::copyString(outPtr, tmpBuf); + outPtr += XMLString::stringLen(tmpBuf); + } + } + // Registry based authority. + else { + XMLString::copyString(outPtr, fRegAuth); + outPtr += XMLString::stringLen(fRegAuth); + } + } + + if (fPath) + { + XMLString::copyString(outPtr, fPath); + outPtr += XMLString::stringLen(fPath); + } + + if (fQueryString) + { + *outPtr++ = chQuestion; + XMLString::copyString(outPtr, fQueryString); + outPtr += XMLString::stringLen(fQueryString); + } + + if (fFragment) + { + *outPtr++ = chPound; + XMLString::copyString(outPtr, fFragment); + outPtr += XMLString::stringLen(fFragment); + } + + // Cap it off in case the last op was not a string copy + *outPtr = 0; +} + +// NOTE: no check for NULL value of uriStr (caller responsiblilty) +bool XMLUri::isValidURI(const XMLUri* const baseURI + , const XMLCh* const uriStr + , bool bAllowSpaces/*=false*/) +{ + // get a trimmed version of uriStr + // uriStr will NO LONGER be used in this function. + const XMLCh* trimmedUriSpec = uriStr; + + while (XMLChar1_0::isWhitespace(*trimmedUriSpec)) + trimmedUriSpec++; + + XMLSize_t trimmedUriSpecLen = XMLString::stringLen(trimmedUriSpec); + + while (trimmedUriSpecLen) { + if (XMLChar1_0::isWhitespace(trimmedUriSpec[trimmedUriSpecLen-1])) + trimmedUriSpecLen--; + else + break; + } + + if (trimmedUriSpecLen == 0) + { + if (!baseURI) + return false; + else + return true; + } + + XMLSize_t index = 0; + bool foundScheme = false; + + // Check for scheme, which must be before `/', '?' or '#'. + int colonIdx = XMLString::indexOf(trimmedUriSpec, chColon); + int slashIdx = XMLString::indexOf(trimmedUriSpec, chForwardSlash); + int queryIdx = XMLString::indexOf(trimmedUriSpec, chQuestion); + int fragmentIdx = XMLString::indexOf(trimmedUriSpec, chPound); + + if ((colonIdx <= 0) || + (colonIdx > slashIdx && slashIdx != -1) || + (colonIdx > queryIdx && queryIdx != -1) || + (colonIdx > fragmentIdx && fragmentIdx != -1)) + { + // A standalone base is a valid URI according to spec + if (colonIdx == 0 || (!baseURI && fragmentIdx != 0)) + return false; + } + else + { + if (!processScheme(trimmedUriSpec, index)) + return false; + foundScheme = true; + ++index; + } + + // It's an error if we stop here + if (index == trimmedUriSpecLen || (foundScheme && (trimmedUriSpec[index] == chPound))) + return false; + + // two slashes means generic URI syntax, so we get the authority + const XMLCh* authUriSpec = trimmedUriSpec + index; + if (((index+1) < trimmedUriSpecLen) && + XMLString::startsWith(authUriSpec, DOUBLE_SLASH)) + { + index += 2; + XMLSize_t startPos = index; + + // get authority - everything up to path, query or fragment + XMLCh testChar; + while (index < trimmedUriSpecLen) + { + testChar = trimmedUriSpec[index]; + if (testChar == chForwardSlash || + testChar == chQuestion || + testChar == chPound ) + { + break; + } + + index++; + } + + // if we found authority, parse it out, otherwise we set the + // host to empty string + if (index > startPos) + { + if (!processAuthority(trimmedUriSpec + startPos, index - startPos)) + return false; + } + } + + // we need to check if index has exceed the lenght or not + if (index < trimmedUriSpecLen) + { + if (!processPath(trimmedUriSpec + index, trimmedUriSpecLen - index, foundScheme, bAllowSpaces)) + return false; + } + + return true; +} + +// NOTE: no check for NULL value of uriStr (caller responsiblilty) +// NOTE: this routine is the same as above, but it uses a flag to +// indicate the existance of a baseURI rather than an XMLuri. +bool XMLUri::isValidURI(bool haveBaseURI, const XMLCh* const uriStr, bool bAllowSpaces/*=false*/) +{ + // get a trimmed version of uriStr + // uriStr will NO LONGER be used in this function. + const XMLCh* trimmedUriSpec = uriStr; + + while (XMLChar1_0::isWhitespace(*trimmedUriSpec)) + trimmedUriSpec++; + + XMLSize_t trimmedUriSpecLen = XMLString::stringLen(trimmedUriSpec); + + while (trimmedUriSpecLen) { + if (XMLChar1_0::isWhitespace(trimmedUriSpec[trimmedUriSpecLen-1])) + trimmedUriSpecLen--; + else + break; + } + + if (trimmedUriSpecLen == 0) + { + if (!haveBaseURI) + return false; + return true; + } + + XMLSize_t index = 0; + bool foundScheme = false; + + // Check for scheme, which must be before `/', '?' or '#'. + int colonIdx = XMLString::indexOf(trimmedUriSpec, chColon); + int slashIdx = XMLString::indexOf(trimmedUriSpec, chForwardSlash); + int queryIdx = XMLString::indexOf(trimmedUriSpec, chQuestion); + int fragmentIdx = XMLString::indexOf(trimmedUriSpec, chPound); + + if ((colonIdx <= 0) || + (colonIdx > slashIdx && slashIdx != -1) || + (colonIdx > queryIdx && queryIdx != -1) || + (colonIdx > fragmentIdx && fragmentIdx != -1)) + { + // A standalone base is a valid URI according to spec + if (colonIdx == 0 || (!haveBaseURI && fragmentIdx != 0)) + return false; + } + else + { + if (!processScheme(trimmedUriSpec, index)) + return false; + foundScheme = true; + ++index; + } + + // It's an error if we stop here + if (index == trimmedUriSpecLen || (foundScheme && (trimmedUriSpec[index] == chPound))) + return false; + + // two slashes means generic URI syntax, so we get the authority + const XMLCh* authUriSpec = trimmedUriSpec + index; + if (((index+1) < trimmedUriSpecLen) && + XMLString::startsWith(authUriSpec, DOUBLE_SLASH)) + { + index += 2; + XMLSize_t startPos = index; + + // get authority - everything up to path, query or fragment + XMLCh testChar; + while (index < trimmedUriSpecLen) + { + testChar = trimmedUriSpec[index]; + if (testChar == chForwardSlash || + testChar == chQuestion || + testChar == chPound ) + { + break; + } + + index++; + } + + // if we found authority, parse it out, otherwise we set the + // host to empty string + if (index > startPos) + { + if (!processAuthority(trimmedUriSpec + startPos, index - startPos)) + return false; + } + } + + // we need to check if index has exceed the length or not + if (index < trimmedUriSpecLen) + { + if (!processPath(trimmedUriSpec + index, trimmedUriSpecLen - index, foundScheme, bAllowSpaces)) + return false; + } + + return true; +} + +bool XMLUri::isWellFormedAddress(const XMLCh* const addrString, + const XMLSize_t addrStrLen) +{ + // Check that we have a non-zero length string. + if (addrStrLen == 0) + return false; + + // Check if the host is a valid IPv6reference. + if (*addrString == chOpenSquare) + { + return isWellFormedIPv6Reference(addrString, addrStrLen); + } + + // + // Cannot start with a '.', '-', or end with a '-'. + // + if (*addrString == chPeriod || + *addrString == chDash || + addrString[addrStrLen-1] == chDash) + return false; + + // rightmost domain label starting with digit indicates IP address + // since top level domain label can only start with an alpha + // see RFC 2396 Section 3.2.2 + + int lastPeriodPos = XMLString::lastIndexOf(chPeriod, addrString, addrStrLen); + + // if the string ends with "." + // get the second last "." + if (XMLSize_t(lastPeriodPos + 1) == addrStrLen) + { + lastPeriodPos = XMLString::lastIndexOf(chPeriod, addrString, lastPeriodPos); + + if ( XMLString::isDigit(addrString[lastPeriodPos + 1])) + return false; + } + + if (XMLString::isDigit(addrString[lastPeriodPos + 1])) + { + return isWellFormedIPv4Address(addrString, addrStrLen); + } // end of IPv4address + else + { + // + // hostname = *( domainlabel "." ) toplabel [ "." ] + // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum + // toplabel = alpha | alpha *( alphanum | "-" ) alphanum + + // RFC 2396 states that hostnames take the form described in + // RFC 1034 (Section 3) and RFC 1123 (Section 2.1). According + // to RFC 1034, hostnames are limited to 255 characters. + if (addrStrLen > 255) { + return false; + } + + unsigned int labelCharCount = 0; + + // domain labels can contain alphanumerics and '-" + // but must start and end with an alphanumeric + for (XMLSize_t i = 0; i < addrStrLen; i++) + { + if (addrString[i] == chPeriod) + { + if (((i > 0) && + (!XMLString::isAlphaNum(addrString[i-1]))) || + ((i + 1 < addrStrLen) && + (!XMLString::isAlphaNum(addrString[i+1]))) ) + { + return false; + } + labelCharCount = 0; + } + else if (!XMLString::isAlphaNum(addrString[i]) && + addrString[i] != chDash) + { + return false; + } + // RFC 1034: Labels must be 63 characters or less. + else if (++labelCharCount > 63) { + return false; + } + } //for + } + + return true; +} + +bool XMLUri::processScheme(const XMLCh* const schemeStr, XMLSize_t& index) +{ + const XMLCh* tmpPtr = XMLString::findAny(schemeStr, SCHEME_SEPARATORS); + + if (tmpPtr) { + index = tmpPtr - schemeStr; + return isConformantSchemeName(schemeStr, index); + } + else { + return false; + } +} + + +bool XMLUri::isConformantSchemeName( const XMLCh* const scheme + , const XMLSize_t schemeLen) +{ + if (!XMLString::isAlpha(*scheme)) // first: alpha + return false; + + // second onwards: ( alpha | digit | "+" | "-" | "." ) + for (XMLSize_t i=1; i= authLen) + index = -1; + } + + host = &(authSpec[start]); + if (index != -1) + { + hostLen = index; + start += index + 1; // skip the : + } + else + { + hostLen = authLen - start; + start = authLen; + } + + // port is everything after ":" + int port = -1; + if ((hostLen) && // non empty host + (index != -1) && // ":" found + (start < authLen) ) // ":" is not the last + { + const XMLCh* portStr = &(authSpec[start]); + if (*portStr) + { + port = 0; + for (XMLSize_t i=0; i<(authLen - start); i++) + { + if (portStr[i] < chDigit_0 || portStr[i] > chDigit_9) + { + // Assume this is a registry-based authority. + // + port = -1; + hostLen = 0; + host = XMLUni::fgZeroLenString; + userInfoLen = 0; + userinfo = XMLUni::fgZeroLenString; + break; + } + + port = (port * 10) + (int) (portStr[i] - chDigit_0); + } + } + } + + return isValidServerBasedAuthority(host, hostLen, port, userinfo, userInfoLen) + || isValidRegistryBasedAuthority(authSpec, authLen); +} + +bool XMLUri::processPath(const XMLCh* const pathStr, + const XMLSize_t pathStrLen, + const bool isSchemePresent, + const bool bAllowSpaces/*=false*/) +{ + if (pathStrLen != 0) + { + XMLSize_t index = 0; + XMLCh testChar = chNull; + bool isOpaque = (!isSchemePresent || *pathStr == chForwardSlash); + + // path - everything up to query string or fragment + // + // RFC 2732 only allows '[' and ']' to appear in the opaque part. + while (index < pathStrLen) + { + testChar = pathStr[index]; + if (testChar == chQuestion || testChar == chPound) + break; + + if (testChar == chPercent) + { + if (index+2 >= pathStrLen || + !XMLString::isHex(pathStr[index+1]) || + !XMLString::isHex(pathStr[index+2])) + return false; + } + else if (testChar==chSpace) + { + if(!bAllowSpaces) + return false; + } + else if (!isUnreservedCharacter(testChar) && + ((isOpaque && !isPathCharacter(testChar)) || + (!isOpaque && !isReservedCharacter(testChar)))) + { + return false; + } + + index++; + } + + // query - starts with ? and up to fragment or end + // fragment - starts with # + bool isQuery = (testChar == chQuestion); + if (isQuery || testChar == chPound) + { + index++; + while (index < pathStrLen) + { + testChar = pathStr[index]; + if (testChar == chPound && isQuery) { + isQuery = false; + index++; + continue; + } + + if (testChar == chPercent) + { + if (index+2 >= pathStrLen || + !XMLString::isHex(pathStr[index+1]) || + !XMLString::isHex(pathStr[index+2])) + return false; + } + else if (testChar==chSpace) + { + if(!bAllowSpaces) + return false; + } + else if (!isReservedOrUnreservedCharacter(testChar)) + { + return false; + } + index++; + } + } + } //if (pathStrLen...) + + return true; +} + +/*** + * [Bug7698]: filenames with embedded spaces in schemaLocation strings not handled properly + * + * This method is called when Scanner/TraverseSchema knows that the URI reference is + * for local file. + * + ***/ +void XMLUri::normalizeURI(const XMLCh* const systemURI, + XMLBuffer& normalizedURI) +{ + const XMLCh* pszSrc = systemURI; + + normalizedURI.reset(); + + while (*pszSrc) { + + if ((*(pszSrc) == chPercent) + && (*(pszSrc+1) == chDigit_2) + && (*(pszSrc+2) == chDigit_0)) + { + pszSrc += 3; + normalizedURI.append(chSpace); + } + else + { + normalizedURI.append(*pszSrc); + pszSrc++; + } + } +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLUri) + +void XMLUri::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<>fPort; + serEng.readString(fScheme); + serEng.readString(fUserInfo); + serEng.readString(fHost); + serEng.readString(fRegAuth); + serEng.readString(fPath); + serEng.readString(fQueryString); + serEng.readString(fFragment); + serEng.readString(fURIText); + } + +} + +XMLUri::XMLUri(MemoryManager* const manager) +: fPort(-1) +, fScheme(0) +, fUserInfo(0) +, fHost(0) +, fRegAuth(0) +, fPath(0) +, fQueryString(0) +, fFragment(0) +, fURIText(0) +, fMemoryManager(manager) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/XMLUri.hpp b/project/jni/xerces/src/xercesc/util/XMLUri.hpp new file mode 100644 index 000000000..21b2e7126 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLUri.hpp @@ -0,0 +1,663 @@ +/* + * 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: XMLUri.hpp 557254 2007-07-18 13:28:54Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLURI_HPP) +#define XERCESC_INCLUDE_GUARD_XMLURI_HPP + +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + * This class is a direct port of Java's URI class, to distinguish + * itself from the XMLURL, we use the name XMLUri instead of + * XMLURI. + * + * TODO: how to relate XMLUri and XMLURL since URL is part of URI. + * + */ + +class XMLUTIL_EXPORT XMLUri : public XSerializable, public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** + * Construct a new URI from a URI specification string. + * + * If the specification follows the "generic URI" syntax, (two slashes + * following the first colon), the specification will be parsed + * accordingly - setting the + * scheme, + * userinfo, + * host, + * port, + * path, + * querystring and + * fragment + * fields as necessary. + * + * If the specification does not follow the "generic URI" syntax, + * the specification is parsed into a + * scheme and + * scheme-specific part (stored as the path) only. + * + * @param uriSpec the URI specification string (cannot be null or empty) + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + * ctor# 2 + * + */ + XMLUri(const XMLCh* const uriSpec, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Construct a new URI from a base URI and a URI specification string. + * The URI specification string may be a relative URI. + * + * @param baseURI the base URI (cannot be null if uriSpec is null or + * empty) + * + * @param uriSpec the URI specification string (cannot be null or + * empty if base is null) + * + * @param manager Pointer to the memory manager to be used to + * allocate objects. + * + * ctor# 7 relative ctor + * + */ + XMLUri(const XMLUri* const baseURI + , const XMLCh* const uriSpec + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor + */ + XMLUri(const XMLUri& toCopy); + XMLUri& operator=(const XMLUri& toAssign); + + virtual ~XMLUri(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** + * Get the URI as a string specification. See RFC 2396 Section 5.2. + * + * @return the URI string specification + */ + const XMLCh* getUriText() const; + + /** + * Get the scheme for this URI. + * + * @return the scheme for this URI + */ + const XMLCh* getScheme() const; + + /** + * Get the userinfo for this URI. + * + * @return the userinfo for this URI (null if not specified). + */ + const XMLCh* getUserInfo() const; + + + /** + * Get the host for this URI. + * + * @return the host for this URI (null if not specified). + */ + const XMLCh* getHost() const; + + /** + * Get the port for this URI. + * + * @return the port for this URI (-1 if not specified). + */ + int getPort() const; + + /** + * Get the registry based authority for this URI. + * + * @return the registry based authority (null if not specified). + */ + const XMLCh* getRegBasedAuthority() const; + + /** + * Get the path for this URI. Note that the value returned is the path + * only and does not include the query string or fragment. + * + * @return the path for this URI. + */ + const XMLCh* getPath() const; + + /** + * Get the query string for this URI. + * + * @return the query string for this URI. Null is returned if there + * was no "?" in the URI spec, empty string if there was a + * "?" but no query string following it. + */ + const XMLCh* getQueryString() const; + + /** + * Get the fragment for this URI. + * + * @return the fragment for this URI. Null is returned if there + * was no "#" in the URI spec, empty string if there was a + * "#" but no fragment following it. + */ + const XMLCh* getFragment() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + /** + * Set the scheme for this URI. The scheme is converted to lowercase + * before it is set. + * + * @param newScheme the scheme for this URI (cannot be null) + * + */ + void setScheme(const XMLCh* const newScheme); + + /** + * Set the userinfo for this URI. If a non-null value is passed in and + * the host value is null, then an exception is thrown. + * + * @param newUserInfo the userinfo for this URI + * + */ + void setUserInfo(const XMLCh* const newUserInfo); + + /** + * Set the host for this URI. If null is passed in, the userinfo + * field is also set to null and the port is set to -1. + * + * Note: This method overwrites registry based authority if it + * previously existed in this URI. + * + * @param newHost the host for this URI + * + */ + void setHost(const XMLCh* const newHost); + + /** + * Set the port for this URI. -1 is used to indicate that the port is + * not specified, otherwise valid port numbers are between 0 and 65535. + * If a valid port number is passed in and the host field is null, + * an exception is thrown. + * + * @param newPort the port number for this URI + * + */ + void setPort(int newPort); + + /** + * Sets the registry based authority for this URI. + * + * Note: This method overwrites server based authority + * if it previously existed in this URI. + * + * @param newRegAuth the registry based authority for this URI + */ + void setRegBasedAuthority(const XMLCh* const newRegAuth); + + /** + * Set the path for this URI. + * + * If the supplied path is null, then the + * query string and fragment are set to null as well. + * + * If the supplied path includes a query string and/or fragment, + * these fields will be parsed and set as well. + * + * Note: + * + * For URIs following the "generic URI" syntax, the path + * specified should start with a slash. + * + * For URIs that do not follow the generic URI syntax, this method + * sets the scheme-specific part. + * + * @param newPath the path for this URI (may be null) + * + */ + void setPath(const XMLCh* const newPath); + + /** + * Set the query string for this URI. A non-null value is valid only + * if this is an URI conforming to the generic URI syntax and + * the path value is not null. + * + * @param newQueryString the query string for this URI + * + */ + void setQueryString(const XMLCh* const newQueryString); + + /** + * Set the fragment for this URI. A non-null value is valid only + * if this is a URI conforming to the generic URI syntax and + * the path value is not null. + * + * @param newFragment the fragment for this URI + * + */ + void setFragment(const XMLCh* const newFragment); + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + + /** + * Determine whether a given string contains only URI characters (also + * called "uric" in RFC 2396). uric consist of all reserved + * characters, unreserved characters and escaped characters. + * + * @return true if the string is comprised of uric, false otherwise + */ + static bool isURIString(const XMLCh* const uric); + + /** + * Determine whether a given string is a valid URI + */ + static bool isValidURI( const XMLUri* const baseURI + , const XMLCh* const uriStr + , bool bAllowSpaces=false); + /** + * Determine whether a given string is a valid URI + */ + static bool isValidURI( bool haveBaseURI + , const XMLCh* const uriStr + , bool bAllowSpaces=false); + + + static void normalizeURI(const XMLCh* const systemURI, + XMLBuffer& normalizedURI); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLUri) + + XMLUri(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + + static const XMLCh MARK_OR_RESERVED_CHARACTERS[]; + static const XMLCh RESERVED_CHARACTERS[]; + static const XMLCh MARK_CHARACTERS[]; + static const XMLCh SCHEME_CHARACTERS[]; + static const XMLCh USERINFO_CHARACTERS[]; + static const XMLCh REG_NAME_CHARACTERS[]; + static const XMLCh PATH_CHARACTERS[]; + + //helper method for getUriText + void buildFullText(); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + + /** + * Determine whether a character is a reserved character: + * + * @return true if the string contains any reserved characters + */ + static bool isReservedCharacter(const XMLCh theChar); + + /** + * Determine whether a character is a path character: + * + * @return true if the character is path character + */ + static bool isPathCharacter(const XMLCh theChar); + + /** + * Determine whether a char is an unreserved character. + * + * @return true if the char is unreserved, false otherwise + */ + static bool isUnreservedCharacter(const XMLCh theChar); + + /** + * Determine whether a char is an reserved or unreserved character. + * + * @return true if the char is reserved or unreserved, false otherwise + */ + static bool isReservedOrUnreservedCharacter(const XMLCh theChar); + + /** + * Determine whether a scheme conforms to the rules for a scheme name. + * A scheme is conformant if it starts with an alphanumeric, and + * contains only alphanumerics, '+','-' and '.'. + * + * @return true if the scheme is conformant, false otherwise + */ + static bool isConformantSchemeName(const XMLCh* const scheme); + + /** + * Determine whether a userInfo conforms to the rules for a userinfo. + * + * @return true if the scheme is conformant, false otherwise + */ + static void isConformantUserInfo(const XMLCh* const userInfo + , MemoryManager* const manager); + + /** + * Determines whether the components host, port, and user info + * are valid as a server authority. + * + * @return true if the given host, port, and userinfo compose + * a valid server authority + */ + static bool isValidServerBasedAuthority(const XMLCh* const host + , const XMLSize_t hostLen + , const int port + , const XMLCh* const userinfo + , const XMLSize_t userLen); + + /** + * Determines whether the components host, port, and user info + * are valid as a server authority. + * + * @return true if the given host, port, and userinfo compose + * a valid server authority + */ + static bool isValidServerBasedAuthority(const XMLCh* const host + , const int port + , const XMLCh* const userinfo + , MemoryManager* const manager); + + /** + * Determines whether the given string is a registry based authority. + * + * @param authority the authority component of a URI + * + * @return true if the given string is a registry based authority + */ + static bool isValidRegistryBasedAuthority(const XMLCh* const authority + , const XMLSize_t authLen); + + /** + * Determines whether the given string is a registry based authority. + * + * @param authority the authority component of a URI + * + * @return true if the given string is a registry based authority + */ + static bool isValidRegistryBasedAuthority(const XMLCh* const authority); + + /** + * Determine whether a string is syntactically capable of representing + * a valid IPv4 address, IPv6 reference or the domain name of a network host. + * + * A valid IPv4 address consists of four decimal digit groups + * separated by a '.'. + * + * See RFC 2732 Section 3, and RFC 2373 Section 2.2, for the + * definition of IPv6 references. + * + * A hostname consists of domain labels (each of which must begin and + * end with an alphanumeric but may contain '-') separated by a '.'. + * See RFC 2396 Section 3.2.2. + * + * @return true if the string is a syntactically valid IPv4 address + * or hostname + */ + static bool isWellFormedAddress(const XMLCh* const addr + , MemoryManager* const manager); + + /** + * Determines whether a string is an IPv4 address as defined by + * RFC 2373, and under the further constraint that it must be a 32-bit + * address. Though not expressed in the grammar, in order to satisfy + * the 32-bit address constraint, each segment of the address cannot + * be greater than 255 (8 bits of information). + * + * @return true if the string is a syntactically valid IPv4 address + */ + static bool isWellFormedIPv4Address(const XMLCh* const addr, const XMLSize_t length); + + /** + * Determines whether a string is an IPv6 reference as defined + * by RFC 2732, where IPv6address is defined in RFC 2373. The + * IPv6 address is parsed according to Section 2.2 of RFC 2373, + * with the additional constraint that the address be composed of + * 128 bits of information. + * + * Note: The BNF expressed in RFC 2373 Appendix B does not + * accurately describe section 2.2, and was in fact removed from + * RFC 3513, the successor of RFC 2373. + * + * @return true if the string is a syntactically valid IPv6 reference + */ + static bool isWellFormedIPv6Reference(const XMLCh* const addr, const XMLSize_t length); + + /** + * Helper function for isWellFormedIPv6Reference which scans the + * hex sequences of an IPv6 address. It returns the index of the + * next character to scan in the address, or -1 if the string + * cannot match a valid IPv6 address. + * + * @param address the string to be scanned + * @param index the beginning index (inclusive) + * @param end the ending index (exclusive) + * @param counter a counter for the number of 16-bit sections read + * in the address + * + * @return the index of the next character to scan, or -1 if the + * string cannot match a valid IPv6 address + */ + static int scanHexSequence (const XMLCh* const addr, XMLSize_t index, XMLSize_t end, int& counter); + + /** + * Get the indicator as to whether this URI uses the "generic URI" + * syntax. + * + * @return true if this URI uses the "generic URI" syntax, false + * otherwise + */ + bool isGenericURI(); + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + + /** + * Initialize all fields of this URI from another URI. + * + * @param toCopy the URI to copy (cannot be null) + */ + void initialize(const XMLUri& toCopy); + + /** + * Initializes this URI from a base URI and a URI specification string. + * See RFC 2396 Section 4 and Appendix B for specifications on parsing + * the URI and Section 5 for specifications on resolving relative URIs + * and relative paths. + * + * @param baseURI the base URI (may be null if uriSpec is an absolute + * URI) + * + * @param uriSpec the URI spec string which may be an absolute or + * relative URI (can only be null/empty if base + * is not null) + * + */ + void initialize(const XMLUri* const baseURI + , const XMLCh* const uriSpec); + + /** + * Initialize the scheme for this URI from a URI string spec. + * + * @param uriSpec the URI specification (cannot be null) + * + */ + void initializeScheme(const XMLCh* const uriSpec); + + /** + * Initialize the authority (userinfo, host and port) for this + * URI from a URI string spec. + * + * @param uriSpec the URI specification (cannot be null) + * + */ + void initializeAuthority(const XMLCh* const uriSpec); + + /** + * Initialize the path for this URI from a URI string spec. + * + * @param uriSpec the URI specification (cannot be null) + * + */ + void initializePath(const XMLCh* const uriSpec); + + /** + * cleanup the data variables + * + */ + void cleanUp(); + + static bool isConformantSchemeName(const XMLCh* const scheme, + const XMLSize_t schemeLen); + static bool processScheme(const XMLCh* const uriStr, XMLSize_t& index); + static bool processAuthority(const XMLCh* const uriStr, const XMLSize_t authLen); + static bool isWellFormedAddress(const XMLCh* const addr, const XMLSize_t addrLen); + static bool processPath(const XMLCh* const pathStr, const XMLSize_t pathStrLen, + const bool isSchemePresent, const bool bAllowSpaces=false); + + // ----------------------------------------------------------------------- + // Data members + // + // for all the data member, we own it, + // responsible for the creation and/or deletion for + // the memory allocated. + // + // ----------------------------------------------------------------------- + int fPort; + XMLCh* fScheme; + XMLCh* fUserInfo; + XMLCh* fHost; + XMLCh* fRegAuth; + XMLCh* fPath; + XMLCh* fQueryString; + XMLCh* fFragment; + XMLCh* fURIText; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XMLUri: Getter methods +// --------------------------------------------------------------------------- +inline const XMLCh* XMLUri::getScheme() const +{ + return fScheme; +} + +inline const XMLCh* XMLUri::getUserInfo() const +{ + return fUserInfo; +} + +inline const XMLCh* XMLUri::getHost() const +{ + return fHost; +} + +inline int XMLUri::getPort() const +{ + return fPort; +} + +inline const XMLCh* XMLUri::getRegBasedAuthority() const +{ + return fRegAuth; +} + +inline const XMLCh* XMLUri::getPath() const +{ + return fPath; +} + +inline const XMLCh* XMLUri::getQueryString() const +{ + return fQueryString; +} + +inline const XMLCh* XMLUri::getFragment() const +{ + return fFragment; +} + +inline const XMLCh* XMLUri::getUriText() const +{ + // + // Fault it in if not already. Since this is a const method and we + // can't use mutable members due the compilers we have to support, + // we have to cast off the constness. + // + if (!fURIText) + ((XMLUri*)this)->buildFullText(); + + return fURIText; +} + +// --------------------------------------------------------------------------- +// XMLUri: Helper methods +// --------------------------------------------------------------------------- +inline bool XMLUri::isReservedOrUnreservedCharacter(const XMLCh theChar) +{ + return (XMLString::isAlphaNum(theChar) || + XMLString::indexOf(MARK_OR_RESERVED_CHARACTERS, theChar) != -1); +} + +inline bool XMLUri::isReservedCharacter(const XMLCh theChar) +{ + return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1); +} + +inline bool XMLUri::isPathCharacter(const XMLCh theChar) +{ + return (XMLString::indexOf(PATH_CHARACTERS, theChar) != -1); +} + +inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar) +{ + return (XMLString::isAlphaNum(theChar) || + XMLString::indexOf(MARK_CHARACTERS, theChar) != -1); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.cpp b/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.cpp new file mode 100644 index 000000000..64cf870bd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.cpp @@ -0,0 +1,197 @@ +/* + * 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. + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// Local const data +// +// gFromTable +// This is the translation table for Windows 1252 to Unicode. This +// table contains 255 entries. The entry for 1252 byte x is the +// Unicode translation of that byte. +// +// gToTable +// gToTableSz +// This is the translation table for Unicode to Windows 1252. This one +// contains a list of records, sorted by the Unicode code point. We do +// a binary search to find the Unicode point, and that record's other +// field is the 1252 code point to translate to. +// --------------------------------------------------------------------------- +static const XMLCh gFromTable[256] = +{ + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007 + , 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F + , 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017 + , 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F + , 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027 + , 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F + , 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037 + , 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F + , 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047 + , 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F + , 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057 + , 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F + , 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067 + , 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F + , 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077 + , 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F + , 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021 + , 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F + , 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014 + , 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178 + , 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7 + , 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF + , 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7 + , 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF + , 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7 + , 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF + , 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7 + , 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF + , 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7 + , 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF + , 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7 + , 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF +}; + +static const XMLTransService::TransRec gToTable[] = +{ + { 0x0000, 0x00 }, { 0x0001, 0x01 }, { 0x0002, 0x02 }, { 0x0003, 0x03 } + , { 0x0004, 0x04 }, { 0x0005, 0x05 }, { 0x0006, 0x06 }, { 0x0007, 0x07 } + , { 0x0008, 0x08 }, { 0x0009, 0x09 }, { 0x000A, 0x0A }, { 0x000B, 0x0B } + , { 0x000C, 0x0C }, { 0x000D, 0x0D }, { 0x000E, 0x0E }, { 0x000F, 0x0F } + , { 0x0010, 0x10 }, { 0x0011, 0x11 }, { 0x0012, 0x12 }, { 0x0013, 0x13 } + , { 0x0014, 0x14 }, { 0x0015, 0x15 }, { 0x0016, 0x16 }, { 0x0017, 0x17 } + , { 0x0018, 0x18 }, { 0x0019, 0x19 }, { 0x001A, 0x1A }, { 0x001B, 0x1B } + , { 0x001C, 0x1C }, { 0x001D, 0x1D }, { 0x001E, 0x1E }, { 0x001F, 0x1F } + , { 0x0020, 0x20 }, { 0x0021, 0x21 }, { 0x0022, 0x22 }, { 0x0023, 0x23 } + , { 0x0024, 0x24 }, { 0x0025, 0x25 }, { 0x0026, 0x26 }, { 0x0027, 0x27 } + , { 0x0028, 0x28 }, { 0x0029, 0x29 }, { 0x002A, 0x2A }, { 0x002B, 0x2B } + , { 0x002C, 0x2C }, { 0x002D, 0x2D }, { 0x002E, 0x2E }, { 0x002F, 0x2F } + , { 0x0030, 0x30 }, { 0x0031, 0x31 }, { 0x0032, 0x32 }, { 0x0033, 0x33 } + , { 0x0034, 0x34 }, { 0x0035, 0x35 }, { 0x0036, 0x36 }, { 0x0037, 0x37 } + , { 0x0038, 0x38 }, { 0x0039, 0x39 }, { 0x003A, 0x3A }, { 0x003B, 0x3B } + , { 0x003C, 0x3C }, { 0x003D, 0x3D }, { 0x003E, 0x3E }, { 0x003F, 0x3F } + , { 0x0040, 0x40 }, { 0x0041, 0x41 }, { 0x0042, 0x42 }, { 0x0043, 0x43 } + , { 0x0044, 0x44 }, { 0x0045, 0x45 }, { 0x0046, 0x46 }, { 0x0047, 0x47 } + , { 0x0048, 0x48 }, { 0x0049, 0x49 }, { 0x004A, 0x4A }, { 0x004B, 0x4B } + , { 0x004C, 0x4C }, { 0x004D, 0x4D }, { 0x004E, 0x4E }, { 0x004F, 0x4F } + , { 0x0050, 0x50 }, { 0x0051, 0x51 }, { 0x0052, 0x52 }, { 0x0053, 0x53 } + , { 0x0054, 0x54 }, { 0x0055, 0x55 }, { 0x0056, 0x56 }, { 0x0057, 0x57 } + , { 0x0058, 0x58 }, { 0x0059, 0x59 }, { 0x005A, 0x5A }, { 0x005B, 0x5B } + , { 0x005C, 0x5C }, { 0x005D, 0x5D }, { 0x005E, 0x5E }, { 0x005F, 0x5F } + , { 0x0060, 0x60 }, { 0x0061, 0x61 }, { 0x0062, 0x62 }, { 0x0063, 0x63 } + , { 0x0064, 0x64 }, { 0x0065, 0x65 }, { 0x0066, 0x66 }, { 0x0067, 0x67 } + , { 0x0068, 0x68 }, { 0x0069, 0x69 }, { 0x006A, 0x6A }, { 0x006B, 0x6B } + , { 0x006C, 0x6C }, { 0x006D, 0x6D }, { 0x006E, 0x6E }, { 0x006F, 0x6F } + , { 0x0070, 0x70 }, { 0x0071, 0x71 }, { 0x0072, 0x72 }, { 0x0073, 0x73 } + , { 0x0074, 0x74 }, { 0x0075, 0x75 }, { 0x0076, 0x76 }, { 0x0077, 0x77 } + , { 0x0078, 0x78 }, { 0x0079, 0x79 }, { 0x007A, 0x7A }, { 0x007B, 0x7B } + , { 0x007C, 0x7C }, { 0x007D, 0x7D }, { 0x007E, 0x7E }, { 0x007F, 0x7F } + , { 0x0081, 0x81 }, { 0x008D, 0x8D }, { 0x008F, 0x8F }, { 0x0090, 0x90 } + , { 0x009D, 0x9D }, { 0x00A0, 0xA0 }, { 0x00A1, 0xA1 }, { 0x00A2, 0xA2 } + , { 0x00A3, 0xA3 }, { 0x00A4, 0xA4 }, { 0x00A5, 0xA5 }, { 0x00A6, 0xA6 } + , { 0x00A7, 0xA7 }, { 0x00A8, 0xA8 }, { 0x00A9, 0xA9 }, { 0x00AA, 0xAA } + , { 0x00AB, 0xAB }, { 0x00AC, 0xAC }, { 0x00AD, 0xAD }, { 0x00AE, 0xAE } + , { 0x00AF, 0xAF }, { 0x00B0, 0xB0 }, { 0x00B1, 0xB1 }, { 0x00B2, 0xB2 } + , { 0x00B3, 0xB3 }, { 0x00B4, 0xB4 }, { 0x00B5, 0xB5 }, { 0x00B6, 0xB6 } + , { 0x00B7, 0xB7 }, { 0x00B8, 0xB8 }, { 0x00B9, 0xB9 }, { 0x00BA, 0xBA } + , { 0x00BB, 0xBB }, { 0x00BC, 0xBC }, { 0x00BD, 0xBD }, { 0x00BE, 0xBE } + , { 0x00BF, 0xBF }, { 0x00C0, 0xC0 }, { 0x00C1, 0xC1 }, { 0x00C2, 0xC2 } + , { 0x00C3, 0xC3 }, { 0x00C4, 0xC4 }, { 0x00C5, 0xC5 }, { 0x00C6, 0xC6 } + , { 0x00C7, 0xC7 }, { 0x00C8, 0xC8 }, { 0x00C9, 0xC9 }, { 0x00CA, 0xCA } + , { 0x00CB, 0xCB }, { 0x00CC, 0xCC }, { 0x00CD, 0xCD }, { 0x00CE, 0xCE } + , { 0x00CF, 0xCF }, { 0x00D0, 0xD0 }, { 0x00D1, 0xD1 }, { 0x00D2, 0xD2 } + , { 0x00D3, 0xD3 }, { 0x00D4, 0xD4 }, { 0x00D5, 0xD5 }, { 0x00D6, 0xD6 } + , { 0x00D7, 0xD7 }, { 0x00D8, 0xD8 }, { 0x00D9, 0xD9 }, { 0x00DA, 0xDA } + , { 0x00DB, 0xDB }, { 0x00DC, 0xDC }, { 0x00DD, 0xDD }, { 0x00DE, 0xDE } + , { 0x00DF, 0xDF }, { 0x00E0, 0xE0 }, { 0x00E1, 0xE1 }, { 0x00E2, 0xE2 } + , { 0x00E3, 0xE3 }, { 0x00E4, 0xE4 }, { 0x00E5, 0xE5 }, { 0x00E6, 0xE6 } + , { 0x00E7, 0xE7 }, { 0x00E8, 0xE8 }, { 0x00E9, 0xE9 }, { 0x00EA, 0xEA } + , { 0x00EB, 0xEB }, { 0x00EC, 0xEC }, { 0x00ED, 0xED }, { 0x00EE, 0xEE } + , { 0x00EF, 0xEF }, { 0x00F0, 0xF0 }, { 0x00F1, 0xF1 }, { 0x00F2, 0xF2 } + , { 0x00F3, 0xF3 }, { 0x00F4, 0xF4 }, { 0x00F5, 0xF5 }, { 0x00F6, 0xF6 } + , { 0x00F7, 0xF7 }, { 0x00F8, 0xF8 }, { 0x00F9, 0xF9 }, { 0x00FA, 0xFA } + , { 0x00FB, 0xFB }, { 0x00FC, 0xFC }, { 0x00FD, 0xFD }, { 0x00FE, 0xFE } + , { 0x00FF, 0xFF }, { 0x0152, 0x8C }, { 0x0153, 0x9C }, { 0x0160, 0x8A } + , { 0x0161, 0x9A }, { 0x0178, 0x9F }, { 0x017D, 0x8E }, { 0x017E, 0x9E } + , { 0x0192, 0x83 }, { 0x02C6, 0x88 }, { 0x02DC, 0x98 }, { 0x2013, 0x96 } + , { 0x2014, 0x97 }, { 0x2018, 0x91 }, { 0x2019, 0x92 }, { 0x201A, 0x82 } + , { 0x201C, 0x93 }, { 0x201D, 0x94 }, { 0x201E, 0x84 }, { 0x2020, 0x86 } + , { 0x2021, 0x87 }, { 0x2022, 0x95 }, { 0x2026, 0x85 }, { 0x2030, 0x89 } + , { 0x2039, 0x8B }, { 0x203A, 0x9B }, { 0x20AC, 0x80 }, { 0x2122, 0x99 } + , { 0xFF01, 0x21 }, { 0xFF02, 0x22 }, { 0xFF03, 0x23 }, { 0xFF04, 0x24 } + , { 0xFF05, 0x25 }, { 0xFF06, 0x26 }, { 0xFF07, 0x27 }, { 0xFF08, 0x28 } + , { 0xFF09, 0x29 }, { 0xFF0A, 0x2A }, { 0xFF0B, 0x2B }, { 0xFF0C, 0x2C } + , { 0xFF0D, 0x2D }, { 0xFF0E, 0x2E }, { 0xFF0F, 0x2F }, { 0xFF10, 0x30 } + , { 0xFF11, 0x31 }, { 0xFF12, 0x32 }, { 0xFF13, 0x33 }, { 0xFF14, 0x34 } + , { 0xFF15, 0x35 }, { 0xFF16, 0x36 }, { 0xFF17, 0x37 }, { 0xFF18, 0x38 } + , { 0xFF19, 0x39 }, { 0xFF1A, 0x3A }, { 0xFF1B, 0x3B }, { 0xFF1C, 0x3C } + , { 0xFF1D, 0x3D }, { 0xFF1E, 0x3E }, { 0xFF1F, 0x3F }, { 0xFF20, 0x40 } + , { 0xFF21, 0x41 }, { 0xFF22, 0x42 }, { 0xFF23, 0x43 }, { 0xFF24, 0x44 } + , { 0xFF25, 0x45 }, { 0xFF26, 0x46 }, { 0xFF27, 0x47 }, { 0xFF28, 0x48 } + , { 0xFF29, 0x49 }, { 0xFF2A, 0x4A }, { 0xFF2B, 0x4B }, { 0xFF2C, 0x4C } + , { 0xFF2D, 0x4D }, { 0xFF2E, 0x4E }, { 0xFF2F, 0x4F }, { 0xFF30, 0x50 } + , { 0xFF31, 0x51 }, { 0xFF32, 0x52 }, { 0xFF33, 0x53 }, { 0xFF34, 0x54 } + , { 0xFF35, 0x55 }, { 0xFF36, 0x56 }, { 0xFF37, 0x57 }, { 0xFF38, 0x58 } + , { 0xFF39, 0x59 }, { 0xFF3A, 0x5A }, { 0xFF3B, 0x5B }, { 0xFF3C, 0x5C } + , { 0xFF3D, 0x5D }, { 0xFF3E, 0x5E }, { 0xFF3F, 0x5F }, { 0xFF40, 0x60 } + , { 0xFF41, 0x61 }, { 0xFF42, 0x62 }, { 0xFF43, 0x63 }, { 0xFF44, 0x64 } + , { 0xFF45, 0x65 }, { 0xFF46, 0x66 }, { 0xFF47, 0x67 }, { 0xFF48, 0x68 } + , { 0xFF49, 0x69 }, { 0xFF4A, 0x6A }, { 0xFF4B, 0x6B }, { 0xFF4C, 0x6C } + , { 0xFF4D, 0x6D }, { 0xFF4E, 0x6E }, { 0xFF4F, 0x6F }, { 0xFF50, 0x70 } + , { 0xFF51, 0x71 }, { 0xFF52, 0x72 }, { 0xFF53, 0x73 }, { 0xFF54, 0x74 } + , { 0xFF55, 0x75 }, { 0xFF56, 0x76 }, { 0xFF57, 0x77 }, { 0xFF58, 0x78 } + , { 0xFF59, 0x79 }, { 0xFF5A, 0x7A }, { 0xFF5B, 0x7B }, { 0xFF5C, 0x7C } + , { 0xFF5D, 0x7D }, { 0xFF5E, 0x7E } +}; +static const XMLSize_t gToTableSz = 350; + + + +// --------------------------------------------------------------------------- +// XML1140Transcoder: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLWin1252Transcoder::XMLWin1252Transcoder( const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager) : + XML256TableTranscoder + ( + encodingName + , blockSize + , gFromTable + , gToTable + , gToTableSz + , manager + ) +{ +} + + +XMLWin1252Transcoder::~XMLWin1252Transcoder() +{ +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.hpp b/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.hpp new file mode 100644 index 000000000..7c1922dc9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMLWin1252Transcoder.hpp @@ -0,0 +1,63 @@ +/* + * 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: XMLWin1252Transcoder.hpp 570552 2007-08-28 19:57:36Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLWIN1252TRANSCODER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLWIN1252TRANSCODER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// +// This class provides an implementation of the XMLTranscoder interface +// for the Windows variant of Latin1, called Windows-1252. Its close to +// Latin1, but is somewhat different. +// +class XMLUTIL_EXPORT XMLWin1252Transcoder : public XML256TableTranscoder +{ +public : + // ----------------------------------------------------------------------- + // Public constructors and destructor + // ----------------------------------------------------------------------- + XMLWin1252Transcoder + ( + const XMLCh* const encodingName + , const XMLSize_t blockSize + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~XMLWin1252Transcoder(); + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLWin1252Transcoder(); + XMLWin1252Transcoder(const XMLWin1252Transcoder&); + XMLWin1252Transcoder& operator=(const XMLWin1252Transcoder&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XMemory.cpp b/project/jni/xerces/src/xercesc/util/XMemory.cpp new file mode 100644 index 000000000..77bd6d3a6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMemory.cpp @@ -0,0 +1,124 @@ +/* + * 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: XMemory.cpp 635226 2008-03-09 12:04:39Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +void* XMemory::operator new(size_t size) +{ + size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation( + sizeof(MemoryManager*)); + + void* const block = XMLPlatformUtils::fgMemoryManager->allocate + ( + headerSize + size + ); + *(MemoryManager**)block = XMLPlatformUtils::fgMemoryManager; + + return (char*)block + headerSize; +} + +#if defined(XERCES_MFC_SUPPORT) + +void* XMemory::operator new(size_t size, const char* /*file*/, int /*line*/) +{ + return operator new(size); +} + +void XMemory::operator delete(void* p, const char* /*file*/, int /*line*/) +{ + operator delete(p); +} + +#endif + +void* XMemory::operator new(size_t size, MemoryManager* manager) +{ + assert(manager != 0); + + size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation( + sizeof(MemoryManager*)); + + void* const block = manager->allocate(headerSize + size); + *(MemoryManager**)block = manager; + + return (char*)block + headerSize; +} + +void* XMemory::operator new(size_t /*size*/, void* ptr) +{ + return ptr; +} + +void XMemory::operator delete(void* p) +{ + if (p != 0) + { + size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation( + sizeof(MemoryManager*)); + void* const block = (char*)p - headerSize; + + MemoryManager* const manager = *(MemoryManager**)block; + assert(manager != 0); + manager->deallocate(block); + } +} + +//The Borland compiler is complaining about duplicate overloading of delete +#if !defined(XERCES_NO_MATCHING_DELETE_OPERATOR) + +void XMemory::operator delete(void* p, MemoryManager* manager) +{ + assert(manager != 0); + + if (p != 0) + { + size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(MemoryManager*)); + void* const block = (char*)p - headerSize; + + /*** + * assert(*(MemoryManager**)block == manager); + * + * NOTE: for compiler which can't properly trace the memory manager used in the + * placement new, we use the memory manager embedded in the memory rather + * than the one passed in + */ + MemoryManager* pM = *(MemoryManager**)block; + pM->deallocate(block); + } +} + +void XMemory::operator delete(void* /*p*/, void* /*ptr*/) +{ +} + +#endif + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/util/XMemory.hpp b/project/jni/xerces/src/xercesc/util/XMemory.hpp new file mode 100644 index 000000000..f173d55a3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XMemory.hpp @@ -0,0 +1,144 @@ +/* + * 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: XMemory.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMEMORY_HPP) +#define XERCESC_INCLUDE_GUARD_XMEMORY_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class MemoryManager; + +/** + * This class makes it possible to override the C++ memory management by + * adding new/delete operators to this base class. + * + * This class is used in conjunction with the pluggable memory manager. It + * allows applications to control Xerces memory management. + */ + +class XMLUTIL_EXPORT XMemory +{ +public : + // ----------------------------------------------------------------------- + // The C++ memory management + // ----------------------------------------------------------------------- + /** @name The C++ memory management */ + //@{ + + /** + * This method overrides operator new + * + * @param size The requested memory size + */ + void* operator new(size_t size); + +#if defined(XERCES_MFC_SUPPORT) + /** + * This method overrides the MFC debug version of the operator new + * + * @param size The requested memory size + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + void* operator new(size_t size, const char* file, int line); + /** + * This method provides a matching delete for the MFC debug new + * + * @param p The pointer to the allocated memory + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + void operator delete(void* p, const char* file, int line); +#endif + + /** + * This method defines a custom operator new, that will use the provided + * memory manager to perform the allocation + * + * @param size The requested memory size + * @param memMgr An application's memory manager + */ + void* operator new(size_t size, MemoryManager* memMgr); + + /** + * This method overrides placement operator new + * + * @param size The requested memory size + * @param ptr The memory location where the object should be allocated + */ + void* operator new(size_t size, void* ptr); + + /** + * This method overrides operator delete + * + * @param p The pointer to the allocated memory + */ + void operator delete(void* p); + + //The Borland compiler is complaining about duplicate overloading of delete +#if !defined(XERCES_NO_MATCHING_DELETE_OPERATOR) + /** + * This method provides a matching delete for the custom operator new + * + * @param p The pointer to the allocated memory + * @param memMgr An application's memory manager + */ + void operator delete(void* p, MemoryManager* memMgr); + + /** + * This method provides a matching delete for the placement new + * + * @param p The pointer to the allocated memory + * @param ptr The memory location where the object had to be allocated + */ + void operator delete(void* p, void* ptr); +#endif + + //@} + +protected : + // ----------------------------------------------------------------------- + // Hidden Constructors + // ----------------------------------------------------------------------- + /** @name Constructor */ + //@{ + + /** + * Protected default constructor + */ + XMemory() + { + } + //@} + +#if defined(XERCES_NEED_XMEMORY_VIRTUAL_DESTRUCTOR) + virtual ~XMemory() + { + } +#endif +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XercesDefs.hpp b/project/jni/xerces/src/xercesc/util/XercesDefs.hpp new file mode 100644 index 000000000..9ebd1c564 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XercesDefs.hpp @@ -0,0 +1,173 @@ +/* + * 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: XercesDefs.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESDEFS_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESDEFS_HPP + +// --------------------------------------------------------------------------- +// The file xerces_hdr_config defines critical configuration information +// used by the remainder of this file. +// +// There are two major configuration files: +// - xerces_autoconf_config.hpp-- Contains defines that are safe for +// access through public headers. +// +// - config.h -- Contains defines that may conflict +// with other packages; should only be +// included by Xerces implementation files. +// +// Both of these files are generated through the autoconf/configure process. +// --------------------------------------------------------------------------- + +// +// If this is an autoconf configured build, we include Xerces_autoconf_config.hpp +// Otherwise we include a preconfigured config appropriate for the particular +// platform that the specific makefile should copy over. +// +// If the next line generates an error then you haven't run ./configure +#include + +// --------------------------------------------------------------------------- +// Include the Xerces version information; this is kept in a separate file to +// make modification simple and obvious. Updates to the version header file +// --------------------------------------------------------------------------- +#include + + +// --------------------------------------------------------------------------- +// Some general typedefs that are defined for internal flexibility. +// +// Note that UTF16Ch is fixed at 16 bits, whereas XMLCh floats in size per +// platform, to whatever is the native wide char format there. UCS4Ch is +// fixed at 32 bits. The types we defined them in terms of are defined per +// compiler, using whatever types are the right ones for them to get these +// 16/32 bit sizes. +// +// --------------------------------------------------------------------------- +typedef unsigned char XMLByte; +typedef XMLUInt16 UTF16Ch; +typedef XMLUInt32 UCS4Ch; + + +// --------------------------------------------------------------------------- +// Handle boolean. If the platform can handle booleans itself, then we +// map our boolean type to the native type. Otherwise we create a default +// one as an int and define const values for true and false. +// +// This flag will be set in the per-development environment stuff above. +// --------------------------------------------------------------------------- +#if defined(XERCES_NO_NATIVE_BOOL) + #ifndef bool + typedef int bool; + #endif + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif +#endif + +// --------------------------------------------------------------------------- +// According to whether the compiler supports L"" type strings, we define +// the XMLStrL() macro one way or another. +// --------------------------------------------------------------------------- +#if defined(XERCES_LSTRSUPPORT) +#define XMLStrL(str) L##str +#else +#define XMLStrL(str) str +#endif + + +// --------------------------------------------------------------------------- +// Define namespace symbols if the compiler supports it. +// --------------------------------------------------------------------------- +#if defined(XERCES_HAS_CPP_NAMESPACE) + #define XERCES_CPP_NAMESPACE_BEGIN namespace XERCES_CPP_NAMESPACE { + #define XERCES_CPP_NAMESPACE_END } + #define XERCES_CPP_NAMESPACE_USE using namespace XERCES_CPP_NAMESPACE; + #define XERCES_CPP_NAMESPACE_QUALIFIER XERCES_CPP_NAMESPACE:: + + namespace XERCES_CPP_NAMESPACE { } + namespace xercesc = XERCES_CPP_NAMESPACE; +#else + #define XERCES_CPP_NAMESPACE_BEGIN + #define XERCES_CPP_NAMESPACE_END + #define XERCES_CPP_NAMESPACE_USE + #define XERCES_CPP_NAMESPACE_QUALIFIER +#endif + +#if defined(XERCES_STD_NAMESPACE) + #define XERCES_USING_STD(NAME) using std :: NAME; + #define XERCES_STD_QUALIFIER std :: +#else + #define XERCES_USING_STD(NAME) + #define XERCES_STD_QUALIFIER +#endif + + +// --------------------------------------------------------------------------- +// Set up the import/export keyword for our core projects. The +// PLATFORM_XXXX keywords are set in the per-development environment +// include above. +// --------------------------------------------------------------------------- + +// The DLL_EXPORT flag should be defined on the command line during the build of a DLL +// configure conspires to make this happen. + +#if defined(DLL_EXPORT) + #if defined(XERCES_BUILDING_LIBRARY) + #define XMLUTIL_EXPORT XERCES_PLATFORM_EXPORT + #define XMLPARSER_EXPORT XERCES_PLATFORM_EXPORT + #define SAX_EXPORT XERCES_PLATFORM_EXPORT + #define SAX2_EXPORT XERCES_PLATFORM_EXPORT + #define CDOM_EXPORT XERCES_PLATFORM_EXPORT + #define PARSERS_EXPORT XERCES_PLATFORM_EXPORT + #define VALIDATORS_EXPORT XERCES_PLATFORM_EXPORT + #define XINCLUDE_EXPORT XERCES_PLATFORM_EXPORT + #else + #define XMLUTIL_EXPORT XERCES_PLATFORM_IMPORT + #define XMLPARSER_EXPORT XERCES_PLATFORM_IMPORT + #define SAX_EXPORT XERCES_PLATFORM_IMPORT + #define SAX2_EXPORT XERCES_PLATFORM_IMPORT + #define CDOM_EXPORT XERCES_PLATFORM_IMPORT + #define PARSERS_EXPORT XERCES_PLATFORM_IMPORT + #define VALIDATORS_EXPORT XERCES_PLATFORM_IMPORT + #define XINCLUDE_EXPORT XERCES_PLATFORM_IMPORT + #endif + #if defined(XERCES_BUILDING_DEPRECATED_LIBRARY) + #define DEPRECATED_DOM_EXPORT XERCES_PLATFORM_EXPORT + #else + #define DEPRECATED_DOM_EXPORT XERCES_PLATFORM_IMPORT + #endif +#else + #define XMLUTIL_EXPORT + #define XMLPARSER_EXPORT + #define SAX_EXPORT + #define SAX2_EXPORT + #define CDOM_EXPORT + #define DEPRECATED_DOM_EXPORT + #define PARSERS_EXPORT + #define VALIDATORS_EXPORT + #define XINCLUDE_EXPORT +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/XercesVersion.hpp b/project/jni/xerces/src/xercesc/util/XercesVersion.hpp new file mode 100644 index 000000000..a2a84c3ea --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/XercesVersion.hpp @@ -0,0 +1,219 @@ +/* + * 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: XercesVersion.hpp 935350 2010-04-18 15:02:36Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESVERSION_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESVERSION_HPP + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N H E A D E R D O C U M E N T A T I O N + +/** + * User Documentation for Xerces Version Values: + * + * + * + * Xerces Notes: + * + * Xerces Committers Documentation: + * + * Xerces committers normally only need to modify one or two of the + * following macros: + * + * XERCES_VERSION_MAJOR + * XERCES_VERSION_MINOR + * XERCES_VERSION_REVISION + * + * The integer values of these macros define the Xerces version number. All + * other constants and preprocessor macros are automatically generated from + * these three definitions. + * + * The macro XERCES_GRAMMAR_SERIALIZATION_LEVEL has been added so that during + * development if users are using the latest code they can use the grammar + * serialization/deserialization features. Whenever a change is made to the + * serialization code this macro should be incremented. + * + * Xerces User Documentation: + * + * The following sections in the user documentation have examples based upon + * the following three version input values: + * + * #define XERCES_VERSION_MAJOR 19 + * #define XERCES_VERSION_MINOR 3 + * #define XERCES_VERSION_REVISION 74 + * + * The minor and revision (patch level) numbers have two digits of resolution + * which means that '3' becomes '03' in this example. This policy guarantees + * that when using preprocessor macros, version 19.3.74 will be greater than + * version 1.94.74 since the first will expand to 190374 and the second to + * 19474. + * + * Preprocessor Macros: + * + * _XERCES_VERSION defines the primary preprocessor macro that users will + * introduce into their code to perform conditional compilation where the + * version of Xerces is detected in order to enable or disable version + * specific capabilities. The value of _XERCES_VERSION for the above example + * will be 190374. To use it a user would perform an operation such as the + * following: + * + * #if _XERCES_VERSION >= 190374 + * // code specific to new version of Xerces... + * #else + * // old code here... + * #endif + * + * XERCES_FULLVERSIONSTR is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3_74". + * + * XERCES_FULLVERSIONDOT is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19.3.74". + * + * XERCES_VERSIONSTR is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3". This + * particular macro is very dangerous if it were to be used for comparing + * version numbers since ordering will not be guaranteed. + * + * Xerces_DLLVersionStr is a preprocessor macro that expands to a string + * constant whose value, for the above example, will be "19_3_74". This + * macro is provided for backwards compatibility to pre-1.7 versions of + * Xerces. + * + * String Constants: + * + * gXercesVersionStr is a global string constant whose value corresponds to + * the value "19_3" for the above example. + * + * gXercesFullVersionStr is a global string constant whose value corresponds + * to the value "19_3_74" for the above example. + * + * Numeric Constants: + * + * gXercesMajVersion is a global integer constant whose value corresponds to + * the major version number. For the above example its value will be 19. + * + * gXercesMinVersion is a global integer constant whose value corresponds to + * the minor version number. For the above example its value will be 3. + * + * gXercesRevision is a global integer constant whose value corresponds to + * the revision (patch) version number. For the above example its value will + * be 74. + * + */ + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N S P E C I F I C A T I O N + +/** + * MODIFY THESE NUMERIC VALUES TO COINCIDE WITH XERCES VERSION + * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE + */ + +#define XERCES_VERSION_MAJOR 3 +#define XERCES_VERSION_MINOR 1 +#define XERCES_VERSION_REVISION 1 + +/*** + * + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 4 SchemaAttDef, SchemaElementDecl serialize fPSVIScope + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 5 XercesStep serializes the axis as an int + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 6 added fIsExternal to XMLEntityDecl + * XERCES_GRAMMAR_SERIALIZATION_LEVEL = 7 size of line/column fields has changed + * + ***/ +#define XERCES_GRAMMAR_SERIALIZATION_LEVEL 7 + +/** DO NOT MODIFY BELOW THIS LINE */ + +/** + * MAGIC THAT AUTOMATICALLY GENERATES THE FOLLOWING: + * + * Xerces_DLLVersionStr, gXercesVersionStr, gXercesFullVersionStr, + * gXercesMajVersion, gXercesMinVersion, gXercesRevision + */ + +// --------------------------------------------------------------------------- +// T W O A R G U M E N T C O N C A T E N A T I O N M A C R O S + +// two argument concatenation routines +#define CAT2_SEP_UNDERSCORE(a, b) #a "_" #b +#define CAT2_SEP_PERIOD(a, b) #a "." #b +#define CAT2_SEP_NIL(a, b) #a #b +#define CAT2_RAW_NUMERIC(a, b) a ## b + +// two argument macro invokers +#define INVK_CAT2_SEP_UNDERSCORE(a,b) CAT2_SEP_UNDERSCORE(a,b) +#define INVK_CAT2_SEP_PERIOD(a,b) CAT2_SEP_PERIOD(a,b) +#define INVK_CAT2_STR_SEP_NIL(a,b) CAT2_SEP_NIL(a,b) +#define INVK_CAT2_RAW_NUMERIC(a,b) CAT2_RAW_NUMERIC(a,b) + +// --------------------------------------------------------------------------- +// T H R E E A R G U M E N T C O N C A T E N A T I O N M A C R O S + +// three argument concatenation routines +#define CAT3_SEP_UNDERSCORE(a, b, c) #a "_" #b "_" #c +#define CAT3_SEP_PERIOD(a, b, c) #a "." #b "." #c +#define CAT3_SEP_NIL(a, b, c) #a #b #c +#define CAT3_RAW_NUMERIC(a, b, c) a ## b ## c +#define CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a, b, c) a ## _ ## b ## _ ## c + +// three argument macro invokers +#define INVK_CAT3_SEP_UNDERSCORE(a,b,c) CAT3_SEP_UNDERSCORE(a,b,c) +#define INVK_CAT3_SEP_PERIOD(a,b,c) CAT3_SEP_PERIOD(a,b,c) +#define INVK_CAT3_SEP_NIL(a,b,c) CAT3_SEP_NIL(a,b,c) +#define INVK_CAT3_RAW_NUMERIC(a,b,c) CAT3_RAW_NUMERIC(a,b,c) +#define INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a,b,c) CAT3_RAW_NUMERIC_SEP_UNDERSCORE(a,b,c) + +// --------------------------------------------------------------------------- +// C A L C U L A T E V E R S I O N - E X P A N D E D F O R M + +#define MULTIPLY(factor,value) factor * value +#define CALC_EXPANDED_FORM(a,b,c) ( MULTIPLY(10000,a) + MULTIPLY(100,b) + MULTIPLY(1,c) ) + +// --------------------------------------------------------------------------- +// X E R C E S V E R S I O N I N F O R M A T I O N + +// Xerces version strings; these particular macros cannot be used for +// conditional compilation as they are not numeric constants + +#define XERCES_FULLVERSIONSTR INVK_CAT3_SEP_UNDERSCORE(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_FULLVERSIONDOT INVK_CAT3_SEP_PERIOD(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_FULLVERSIONNUM INVK_CAT3_SEP_NIL(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) +#define XERCES_VERSIONSTR INVK_CAT2_SEP_UNDERSCORE(XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR) + +// Xerces C++ Namespace string, concatenated with full version string +#define XERCES_PRODUCT xercesc +#define XERCES_CPP_NAMESPACE INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(XERCES_PRODUCT,XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR) + +// original from Xerces header +#define Xerces_DLLVersionStr XERCES_FULLVERSIONSTR + +const char* const gXercesVersionStr = XERCES_VERSIONSTR; +const char* const gXercesFullVersionStr = XERCES_FULLVERSIONSTR; +const unsigned int gXercesMajVersion = XERCES_VERSION_MAJOR; +const unsigned int gXercesMinVersion = XERCES_VERSION_MINOR; +const unsigned int gXercesRevision = XERCES_VERSION_REVISION; + +// Xerces version numeric constants that can be used for conditional +// compilation purposes. + +#define _XERCES_VERSION CALC_EXPANDED_FORM (XERCES_VERSION_MAJOR,XERCES_VERSION_MINOR,XERCES_VERSION_REVISION) + +#endif // XERCESVERSION_HPP diff --git a/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.borland.hpp b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.borland.hpp new file mode 100644 index 000000000..8952f00dd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.borland.hpp @@ -0,0 +1,125 @@ +/* + * 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: Xerces_autoconf_config.borland.hpp 834826 2009-11-11 10:03:53Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCES_AUTOCONFIG_CONFIG_HPP) +#define XERCESC_INCLUDE_GUARD_XERCES_AUTOCONFIG_CONFIG_HPP + +// +// There are two primary xerces configuration header files: +// +// Xerces_autoconf_config.hpp +// +// For configuration of items that must be accessable +// through public headers. This file has limited information +// and carefully works to avoid collision of macro names, etc. +// +// This file is included by XercesDefs.h. +// This version of the file is specific for Borland C++ +// family of compilers +// +// config.h +// +// This file is not used with Borland C++; the macros +// it would specify are instead hardcoded in the makefiles +// + +#include + +// --------------------------------------------------------------------------- +// These defines have been hardcoded for the Borland C++ compilers +// --------------------------------------------------------------------------- +#undef XERCES_AUTOCONF +#undef XERCES_HAVE_SYS_TYPES_H +#undef XERCES_HAVE_INTTYPES_H + +#define XERCES_S16BIT_INT signed short +#define XERCES_U16BIT_INT unsigned short +#define XERCES_S32BIT_INT INT32 +#define XERCES_U32BIT_INT UINT32 +#define XERCES_S64BIT_INT INT64 +#define XERCES_U64BIT_INT UINT64 + +#define XERCES_XMLCH_T wchar_t + +#define XERCES_SIZE_T SIZE_T +#define XERCES_SSIZE_T SSIZE_T + +#define XERCES_HAS_CPP_NAMESPACE 1 +#define XERCES_STD_NAMESPACE 1 +#define XERCES_NEW_IOSTREAMS 1 +#undef XERCES_NO_NATIVE_BOOL +#define XERCES_LSTRSUPPORT 1 + +#ifdef XERCES_STATIC_LIBRARY +#define XERCES_PLATFORM_EXPORT +#define XERCES_PLATFORM_IMPORT +#else +#define XERCES_PLATFORM_EXPORT __declspec(dllexport) +#define XERCES_PLATFORM_IMPORT __declspec(dllimport) +#define DLL_EXPORT +#endif + +#define XERCES_NO_MATCHING_DELETE_OPERATOR +#define XERCES_NEED_XMEMORY_VIRTUAL_DESTRUCTOR + +// --------------------------------------------------------------------------- +// XMLSize_t is the unsigned integral type. +// --------------------------------------------------------------------------- +typedef XERCES_SIZE_T XMLSize_t; +typedef XERCES_SSIZE_T XMLSSize_t; + +// --------------------------------------------------------------------------- +// Define our version of the XML character +// --------------------------------------------------------------------------- +typedef XERCES_XMLCH_T XMLCh; + +// --------------------------------------------------------------------------- +// Define unsigned 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_U16BIT_INT XMLUInt16; +typedef XERCES_U32BIT_INT XMLUInt32; +typedef XERCES_U64BIT_INT XMLUInt64; + +// --------------------------------------------------------------------------- +// Define signed 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_S16BIT_INT XMLInt16; +typedef XERCES_S32BIT_INT XMLInt32; +typedef XERCES_S64BIT_INT XMLInt64; + +// --------------------------------------------------------------------------- +// XMLFilePos is the type used to represent a file position. +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFilePos; + +// --------------------------------------------------------------------------- +// XMLFileLoc is the type used to represent a file location (line/column). +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFileLoc; + +// --------------------------------------------------------------------------- +// Force on the Xerces debug token if it is on in the build environment +// --------------------------------------------------------------------------- +#if defined(_DEBUG) +#define XERCES_DEBUG +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp new file mode 100644 index 000000000..3d340b686 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp @@ -0,0 +1,139 @@ +/* src/xercesc/util/Xerces_autoconf_config.hpp. Generated from Xerces_autoconf_config.hpp.in by configure. */ +/* + * 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: Xerces_autoconf_config.hpp.in 834826 2009-11-11 10:03:53Z borisk $ + */ + +// +// There are two primary xerces configuration header files: +// +// Xerces_autoconf_config.hpp +// +// For configuration of items that must be accessable +// through public headers. This file has limited information +// and carefully works to avoid collision of macro names, etc. +// +// This file is included by XercesDefs.h. In the event +// of a non-configured platform, a similar header specific +// to the platform will be included instead. +// +// config.h +// +// Generalized autoconf header file, with much more +// information, used to supply configuration information +// for use in implementation files. +// +// For autoconf based builds, this header is configured from by the configure +// script from the .in template file of the same name. + + +#ifndef XERCES_AUTOCONFIG_CONFIG_HPP +#define XERCES_AUTOCONFIG_CONFIG_HPP + +// --------------------------------------------------------------------------- +// These defines are set by configure as appropriate for the platform. +// --------------------------------------------------------------------------- +#define XERCES_AUTOCONF 1 +#define XERCES_HAVE_SYS_TYPES_H 1 +#define XERCES_HAVE_INTTYPES_H 1 +/* #undef XERCES_HAVE_INTRIN_H */ +/* #undef XERCES_HAVE_EMMINTRIN_H */ +/* #undef XERCES_INCLUDE_WCHAR_H */ + +#define XERCES_S16BIT_INT int16_t +#define XERCES_S32BIT_INT int32_t +#define XERCES_S64BIT_INT int64_t +#define XERCES_U16BIT_INT uint16_t +#define XERCES_U32BIT_INT uint32_t +#define XERCES_U64BIT_INT uint64_t +#define XERCES_XMLCH_T uint16_t +#define XERCES_SIZE_T size_t +#define XERCES_SSIZE_T ssize_t + +#define XERCES_HAS_CPP_NAMESPACE 1 +/* #undef XERCES_STD_NAMESPACE */ +/* #undef XERCES_NEW_IOSTREAMS */ +/* #undef XERCES_NO_NATIVE_BOOL */ +#define XERCES_LSTRSUPPORT 1 + +/* #undef XERCES_HAVE_CPUID_INTRINSIC */ +/* #undef XERCES_HAVE_SSE2_INTRINSIC */ +/* #undef XERCES_HAVE_GETCPUID */ + +#define XERCES_PLATFORM_EXPORT +#define XERCES_PLATFORM_IMPORT + +/* #undef XERCES_NO_MATCHING_DELETE_OPERATOR */ + +// --------------------------------------------------------------------------- +// Include standard headers, if available, that we may rely on below. +// --------------------------------------------------------------------------- +#if XERCES_HAVE_INTTYPES_H +# include +#endif +#if XERCES_HAVE_SYS_TYPES_H +# include +#endif +#if XERCES_INCLUDE_WCHAR_H +# include +#endif + +// --------------------------------------------------------------------------- +// XMLSize_t is the unsigned integral type. +// --------------------------------------------------------------------------- +typedef XERCES_SIZE_T XMLSize_t; +typedef XERCES_SSIZE_T XMLSSize_t; + +// --------------------------------------------------------------------------- +// Define our version of the XML character +// --------------------------------------------------------------------------- +typedef XERCES_XMLCH_T XMLCh; + +// --------------------------------------------------------------------------- +// Define unsigned 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_U16BIT_INT XMLUInt16; +typedef XERCES_U32BIT_INT XMLUInt32; +typedef XERCES_U64BIT_INT XMLUInt64; + +// --------------------------------------------------------------------------- +// Define signed 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_S16BIT_INT XMLInt16; +typedef XERCES_S32BIT_INT XMLInt32; +typedef XERCES_S64BIT_INT XMLInt64; + +// --------------------------------------------------------------------------- +// XMLFilePos is the type used to represent a file position. +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFilePos; + +// --------------------------------------------------------------------------- +// XMLFileLoc is the type used to represent a file location (line/column). +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFileLoc; + +// --------------------------------------------------------------------------- +// Force on the Xerces debug token if it is on in the build environment +// --------------------------------------------------------------------------- +#if defined(_DEBUG) +#define XERCES_DEBUG +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp.in b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp.in new file mode 100644 index 000000000..d00808d7c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.hpp.in @@ -0,0 +1,138 @@ +/* + * 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: Xerces_autoconf_config.hpp.in 834826 2009-11-11 10:03:53Z borisk $ + */ + +// +// There are two primary xerces configuration header files: +// +// Xerces_autoconf_config.hpp +// +// For configuration of items that must be accessable +// through public headers. This file has limited information +// and carefully works to avoid collision of macro names, etc. +// +// This file is included by XercesDefs.h. In the event +// of a non-configured platform, a similar header specific +// to the platform will be included instead. +// +// config.h +// +// Generalized autoconf header file, with much more +// information, used to supply configuration information +// for use in implementation files. +// +// For autoconf based builds, this header is configured from by the configure +// script from the .in template file of the same name. + + +#ifndef XERCES_AUTOCONFIG_CONFIG_HPP +#define XERCES_AUTOCONFIG_CONFIG_HPP + +// --------------------------------------------------------------------------- +// These defines are set by configure as appropriate for the platform. +// --------------------------------------------------------------------------- +#undef XERCES_AUTOCONF +#undef XERCES_HAVE_SYS_TYPES_H +#undef XERCES_HAVE_INTTYPES_H +#undef XERCES_HAVE_INTRIN_H +#undef XERCES_HAVE_EMMINTRIN_H +#undef XERCES_INCLUDE_WCHAR_H + +#undef XERCES_S16BIT_INT +#undef XERCES_S32BIT_INT +#undef XERCES_S64BIT_INT +#undef XERCES_U16BIT_INT +#undef XERCES_U32BIT_INT +#undef XERCES_U64BIT_INT +#undef XERCES_XMLCH_T +#undef XERCES_SIZE_T +#undef XERCES_SSIZE_T + +#undef XERCES_HAS_CPP_NAMESPACE +#undef XERCES_STD_NAMESPACE +#undef XERCES_NEW_IOSTREAMS +#undef XERCES_NO_NATIVE_BOOL +#undef XERCES_LSTRSUPPORT + +#undef XERCES_HAVE_CPUID_INTRINSIC +#undef XERCES_HAVE_SSE2_INTRINSIC +#undef XERCES_HAVE_GETCPUID + +#undef XERCES_PLATFORM_EXPORT +#undef XERCES_PLATFORM_IMPORT + +#undef XERCES_NO_MATCHING_DELETE_OPERATOR + +// --------------------------------------------------------------------------- +// Include standard headers, if available, that we may rely on below. +// --------------------------------------------------------------------------- +#if XERCES_HAVE_INTTYPES_H +# include +#endif +#if XERCES_HAVE_SYS_TYPES_H +# include +#endif +#if XERCES_INCLUDE_WCHAR_H +# include +#endif + +// --------------------------------------------------------------------------- +// XMLSize_t is the unsigned integral type. +// --------------------------------------------------------------------------- +typedef XERCES_SIZE_T XMLSize_t; +typedef XERCES_SSIZE_T XMLSSize_t; + +// --------------------------------------------------------------------------- +// Define our version of the XML character +// --------------------------------------------------------------------------- +typedef XERCES_XMLCH_T XMLCh; + +// --------------------------------------------------------------------------- +// Define unsigned 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_U16BIT_INT XMLUInt16; +typedef XERCES_U32BIT_INT XMLUInt32; +typedef XERCES_U64BIT_INT XMLUInt64; + +// --------------------------------------------------------------------------- +// Define signed 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_S16BIT_INT XMLInt16; +typedef XERCES_S32BIT_INT XMLInt32; +typedef XERCES_S64BIT_INT XMLInt64; + +// --------------------------------------------------------------------------- +// XMLFilePos is the type used to represent a file position. +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFilePos; + +// --------------------------------------------------------------------------- +// XMLFileLoc is the type used to represent a file location (line/column). +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFileLoc; + +// --------------------------------------------------------------------------- +// Force on the Xerces debug token if it is on in the build environment +// --------------------------------------------------------------------------- +#if defined(_DEBUG) +#define XERCES_DEBUG +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.msvc.hpp b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.msvc.hpp new file mode 100644 index 000000000..fe83e51ab --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/Xerces_autoconf_config.msvc.hpp @@ -0,0 +1,148 @@ +/* + * 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: Xerces_autoconf_config.msvc.hpp 883299 2009-11-23 10:34:54Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCES_AUTOCONFIG_CONFIG_HPP) +#define XERCESC_INCLUDE_GUARD_XERCES_AUTOCONFIG_CONFIG_HPP + +// +// There are two primary xerces configuration header files: +// +// Xerces_autoconf_config.hpp +// +// For configuration of items that must be accessable +// through public headers. This file has limited information +// and carefully works to avoid collision of macro names, etc. +// +// This file is included by XercesDefs.h. +// This version of the file is specific for Microsoft Visual C++ +// family of compilers +// +// config.h +// +// This file is not used with Microsoft Visual C++; the macros +// it would specify are instead hardcoded in the makefiles +// + +#include + +// silence the warning "while compiling class-template member function xxxx : identifier was truncated to '255' +// characters in the browser information" +#pragma warning( disable: 4786 ) + +// --------------------------------------------------------------------------- +// These defines have been hardcoded for the Microsoft Visual C++ compilers +// --------------------------------------------------------------------------- +#undef XERCES_AUTOCONF +#undef XERCES_HAVE_SYS_TYPES_H +#undef XERCES_HAVE_INTTYPES_H + +#define XERCES_S16BIT_INT signed short +#define XERCES_U16BIT_INT unsigned short +#define XERCES_S32BIT_INT INT32 +#define XERCES_U32BIT_INT UINT32 + +// While VC6 has 64-bit int, there is no support in the libraries +// (e.g., iostream). So we are going to stick to 32-bit ints. +// +#if (_MSC_VER >= 1300) +# define XERCES_S64BIT_INT INT64 +# define XERCES_U64BIT_INT UINT64 +#else +# define XERCES_S64BIT_INT INT32 +# define XERCES_U64BIT_INT UINT32 +#endif + +#ifdef _NATIVE_WCHAR_T_DEFINED +# define XERCES_XMLCH_T wchar_t +#else +# define XERCES_XMLCH_T unsigned short +#endif + +#define XERCES_SIZE_T SIZE_T +#define XERCES_SSIZE_T SSIZE_T + +#define XERCES_HAS_CPP_NAMESPACE 1 +#define XERCES_STD_NAMESPACE 1 +#define XERCES_NEW_IOSTREAMS 1 +#undef XERCES_NO_NATIVE_BOOL +#define XERCES_LSTRSUPPORT 1 + +#ifdef XERCES_STATIC_LIBRARY +# define XERCES_PLATFORM_EXPORT +# define XERCES_PLATFORM_IMPORT +#else +# define XERCES_PLATFORM_EXPORT __declspec(dllexport) +# define XERCES_PLATFORM_IMPORT __declspec(dllimport) +# define DLL_EXPORT +#endif + +#define XERCES_MFC_SUPPORT + +#if (_MSC_VER >= 1400) +# define XERCES_HAVE_INTRIN_H 1 +# define XERCES_HAVE_EMMINTRIN_H 1 +# define XERCES_HAVE_CPUID_INTRINSIC +# define XERCES_HAVE_SSE2_INTRINSIC +#endif + +// --------------------------------------------------------------------------- +// XMLSize_t is the unsigned integral type. +// --------------------------------------------------------------------------- +typedef XERCES_SIZE_T XMLSize_t; +typedef XERCES_SSIZE_T XMLSSize_t; + +// --------------------------------------------------------------------------- +// Define our version of the XML character +// --------------------------------------------------------------------------- +typedef XERCES_XMLCH_T XMLCh; + +// --------------------------------------------------------------------------- +// Define unsigned 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_U16BIT_INT XMLUInt16; +typedef XERCES_U32BIT_INT XMLUInt32; +typedef XERCES_U64BIT_INT XMLUInt64; + +// --------------------------------------------------------------------------- +// Define signed 16, 32, and 64 bit integers +// --------------------------------------------------------------------------- +typedef XERCES_S16BIT_INT XMLInt16; +typedef XERCES_S32BIT_INT XMLInt32; +typedef XERCES_S64BIT_INT XMLInt64; + +// --------------------------------------------------------------------------- +// XMLFilePos is the type used to represent a file position. +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFilePos; + +// --------------------------------------------------------------------------- +// XMLFileLoc is the type used to represent a file location (line/column). +// --------------------------------------------------------------------------- +typedef XMLUInt64 XMLFileLoc; + +// --------------------------------------------------------------------------- +// Force on the Xerces debug token if it is on in the build environment +// --------------------------------------------------------------------------- +#if defined(_DEBUG) +# define XERCES_DEBUG +#endif + +#endif diff --git a/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.cpp new file mode 100644 index 000000000..cdc57b172 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.cpp @@ -0,0 +1,160 @@ +/* + * 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: ASCIIRangeFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ASCIIRangeFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +ASCIIRangeFactory::ASCIIRangeFactory() +{ +} + +ASCIIRangeFactory::~ASCIIRangeFactory() { + +} + +// --------------------------------------------------------------------------- +// ASCIIRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void ASCIIRangeFactory::buildRanges(RangeTokenMap *rangeTokMap) { + + if (fRangesCreated) + return; + + if (!fKeywordsInitialized) { + initializeKeywordMap(rangeTokMap); + } + + TokenFactory* tokFactory = rangeTokMap->getTokenFactory(); + + // Create space ranges + RangeToken* tok = tokFactory->createRange(); + tok->addRange(chHTab, chHTab); + tok->addRange(chLF, chLF); + tok->addRange(chFF, chFF); + tok->addRange(chCR, chCR); + tok->addRange(chSpace, chSpace); + + // Build the internal map. + tok->createMap(); + + rangeTokMap->setRangeToken(fgASCIISpace, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + + // Build the internal map. + tok->createMap(); + + rangeTokMap->setRangeToken(fgASCIISpace, tok , true); + + // Create digits ranges + tok = tokFactory->createRange(); + tok->addRange(chDigit_0, chDigit_9); + + // Build the internal map. + tok->createMap(); + + rangeTokMap->setRangeToken(fgASCIIDigit, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + + // Build the internal map. + tok->createMap(); + + rangeTokMap->setRangeToken(fgASCIIDigit, tok , true); + + // Create word ranges + tok = tokFactory->createRange(); + tok->addRange(chDigit_0, chDigit_9); + tok->addRange(chLatin_A, chLatin_Z); + tok->addRange(chUnderscore, chUnderscore); + tok->addRange(chLatin_a, chLatin_z); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgASCIIWord, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgASCIIWord, tok , true); + + // Create xdigit ranges + tok = tokFactory->createRange(); + tok->addRange(chDigit_0, chDigit_9); + tok->addRange(chLatin_A, chLatin_F); + tok->addRange(chLatin_a, chLatin_a); + // Build the internal map. + tok->createMap(); + + rangeTokMap->setRangeToken(fgASCIIXDigit, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgASCIIXDigit, tok , true); + + // Create ascii ranges + tok = tokFactory->createRange(); + tok->addRange(0x00, 0x7F); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgASCII, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgASCII, tok , true); + + fRangesCreated = true; +} + +// --------------------------------------------------------------------------- +// ASCIIRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void ASCIIRangeFactory::initializeKeywordMap(RangeTokenMap *rangeTokMap) { + + if (fKeywordsInitialized) + return; + + rangeTokMap->addKeywordMap(fgASCIISpace, fgASCIICategory); + rangeTokMap->addKeywordMap(fgASCIIDigit, fgASCIICategory); + rangeTokMap->addKeywordMap(fgASCIIWord, fgASCIICategory); + rangeTokMap->addKeywordMap(fgASCIIXDigit, fgASCIICategory); + rangeTokMap->addKeywordMap(fgASCII, fgASCIICategory); + + fKeywordsInitialized = true; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ASCIIRangeFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.hpp new file mode 100644 index 000000000..2a579acb0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ASCIIRangeFactory.hpp @@ -0,0 +1,66 @@ +/* + * 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: ASCIIRangeFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ASCIIRANGEFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_ASCIIRANGEFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT ASCIIRangeFactory: public RangeFactory { + +public: + // ----------------------------------------------------------------------- + // Constructors and operators + // ----------------------------------------------------------------------- + ASCIIRangeFactory(); + ~ASCIIRangeFactory(); + + // ----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + void initializeKeywordMap(RangeTokenMap *rangeTokMap = 0); + +protected: + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + void buildRanges(RangeTokenMap *rangeTokMap = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ASCIIRangeFactory(const ASCIIRangeFactory&); + ASCIIRangeFactory& operator=(const ASCIIRangeFactory&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file ASCIIRangeFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/BMPattern.cpp b/project/jni/xerces/src/xercesc/util/regx/BMPattern.cpp new file mode 100644 index 000000000..57f4119bf --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/BMPattern.cpp @@ -0,0 +1,214 @@ +/* + * 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: BMPattern.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// BMPattern: Constructors +// --------------------------------------------------------------------------- + +typedef JanitorMemFunCall CleanupType; + +BMPattern::BMPattern( const XMLCh* const pattern + , bool ignoreCase + , MemoryManager* const manager) : + + fIgnoreCase(ignoreCase) + , fShiftTableLen(256) + , fShiftTable(0) + , fPattern(0) + , fUppercasePattern(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &BMPattern::cleanUp); + + try { + fPattern = XMLString::replicate(pattern, fMemoryManager); + initialize(); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +BMPattern::BMPattern( const XMLCh* const pattern + , int tableSize + , bool ignoreCase + , MemoryManager* const manager) : + + fIgnoreCase(ignoreCase) + , fShiftTableLen(tableSize) + , fShiftTable(0) + , fPattern(0) + , fUppercasePattern(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &BMPattern::cleanUp); + + try { + fPattern = XMLString::replicate(pattern, fMemoryManager); + initialize(); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +BMPattern::~BMPattern() { + + cleanUp(); +} + +// --------------------------------------------------------------------------- +// BMPattern: matches methods +// --------------------------------------------------------------------------- +int BMPattern::matches(const XMLCh* const content, XMLSize_t start, XMLSize_t limit) const { + + const XMLSize_t patternLen = XMLString::stringLen(fPattern); + // Uppercase Content + XMLCh* ucContent = 0; + + if (patternLen == 0) + return (int)start; + + if (fIgnoreCase) { + + ucContent = XMLString::replicate(content, fMemoryManager); + XMLString::upperCase(ucContent); + } + + ArrayJanitor janUCContent(ucContent, fMemoryManager); + + XMLSize_t index = start + patternLen; + + while (index <= limit) { + + XMLSize_t patternIndex = patternLen; + XMLSize_t nIndex = index + 1; + XMLCh ch = 0; + + while (patternIndex > 0) { + + ch = content[--index]; + + if (ch != fPattern[--patternIndex]) { + + // No match, so we will break. But first we have + // to check the ignore case flag. If it is set, then + // we try to match with the case ignored + if (!fIgnoreCase || + (fUppercasePattern[patternIndex] != ucContent[index])) + break; + } + + if (patternIndex == 0) + return (int)index; + } + + index += fShiftTable[ch % fShiftTableLen] + 1; + + if (index < nIndex) + index = nIndex; + } + + return -1; +} + +// --------------------------------------------------------------------------- +// BMPattern: private helpers methods +// --------------------------------------------------------------------------- +void BMPattern::initialize() { + + const XMLSize_t patternLen = XMLString::stringLen(fPattern); + XMLCh* lowercasePattern = 0; + + fShiftTable = (XMLSize_t*) fMemoryManager->allocate(fShiftTableLen*sizeof(XMLSize_t)); //new XMLSize_t[fShiftTableLen]; + + if (fIgnoreCase) { + + fUppercasePattern = XMLString::replicate(fPattern, fMemoryManager); + lowercasePattern = XMLString::replicate(fPattern, fMemoryManager); + XMLString::upperCase(fUppercasePattern); + XMLString::lowerCase(lowercasePattern); + } + + ArrayJanitor janLowercase(lowercasePattern, fMemoryManager); + + for (unsigned int i=0; i< fShiftTableLen; i++) + fShiftTable[i] = patternLen; + + for (unsigned int k=0; k< patternLen; k++) { + + XMLCh ch = fPattern[k]; + XMLSize_t diff = patternLen - k - 1; + int index = ch % fShiftTableLen; + + if (diff < fShiftTable[index]) + fShiftTable[index] = diff; + + if (fIgnoreCase) { + + for (int j=0; j< 2; j++) { + + ch = (j == 0) ? fUppercasePattern[k] : lowercasePattern[k]; + index = ch % fShiftTableLen; + + if (diff < fShiftTable[index]) + fShiftTable[index] = diff; + } + } + } +} + +// --------------------------------------------------------------------------- +// BMPattern: Cleanup +// --------------------------------------------------------------------------- +void BMPattern::cleanUp() { + + fMemoryManager->deallocate(fPattern);//delete [] fPattern; + fMemoryManager->deallocate(fUppercasePattern);//delete [] fUppercasePattern; + fMemoryManager->deallocate(fShiftTable); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file BMPattern.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/BMPattern.hpp b/project/jni/xerces/src/xercesc/util/regx/BMPattern.hpp new file mode 100644 index 000000000..00376e61b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/BMPattern.hpp @@ -0,0 +1,157 @@ +/* + * 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: BMPattern.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BMPATTERN_HPP) +#define XERCESC_INCLUDE_GUARD_BMPATTERN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BMPattern : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * This is the constructor which takes the pattern information. A default + * shift table size is used. + * + * @param pattern The pattern to match against. + * + * @param ignoreCase A flag to indicate whether to ignore case + * matching or not. + * + * @param manager The configurable memory manager + */ + BMPattern + ( + const XMLCh* const pattern + , bool ignoreCase + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * This is the constructor which takes all of the information + * required to construct a BM pattern object. + * + * @param pattern The pattern to match against. + * + * @param tableSize Indicates the size of the shift table. + * + * @param ignoreCase A flag to indicate whether to ignore case + * matching or not. + * + * @param manager The configurable memory manager + */ + BMPattern + ( + const XMLCh* const pattern + , int tableSize + , bool ignoreCase + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** @name Destructor. */ + //@{ + + /** + * Destructor of BMPattern + */ + ~BMPattern(); + + //@} + + // ----------------------------------------------------------------------- + // Matching functions + // ----------------------------------------------------------------------- + /** @name Matching Functions */ + //@{ + + /** + * This method will perform a match of the given content against a + * predefined pattern. + */ + int matches(const XMLCh* const content, XMLSize_t start, XMLSize_t limit) const; + + //@} + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BMPattern(); + BMPattern(const BMPattern&); + BMPattern& operator=(const BMPattern&); + + // ----------------------------------------------------------------------- + // This method will perform a case insensitive match + // ----------------------------------------------------------------------- + bool matchesIgnoreCase(const XMLCh ch1, const XMLCh ch2); + + // ----------------------------------------------------------------------- + // Initialize/Clean up methods + // ----------------------------------------------------------------------- + void initialize(); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fPattern + // fUppercasePattern + // This is the pattern to match against, and its upper case form. + // + // fIgnoreCase + // This is an indicator whether cases should be ignored during + // matching. + // + // fShiftTable + // fShiftTableLen + // This is a table of offsets for shifting purposes used by the BM + // search algorithm, and its length. + // ----------------------------------------------------------------------- + bool fIgnoreCase; + unsigned int fShiftTableLen; + XMLSize_t* fShiftTable; + XMLCh* fPattern; + XMLCh* fUppercasePattern; + MemoryManager* fMemoryManager; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/* + * End of file BMPattern.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.cpp new file mode 100644 index 000000000..3cadfd034 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.cpp @@ -0,0 +1,369 @@ +/* + * 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: BlockRangeFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static data +// --------------------------------------------------------------------------- +const int BLOCKNAMESIZE = 93; + +// Block Names IsX +// only define Specials as FEFF..FEFF, missing Specials as FFF0..FFFD, add manually +// only define private use as E000..F8FF, +// missing 2 private use (F0000..FFFFD and 100000..10FFFD), add manually +const XMLCh fgBlockNames[][50] = +{ + { chLatin_I, chLatin_s, chLatin_B, chLatin_a, chLatin_s, chLatin_i, chLatin_c, chLatin_L, chLatin_a, + chLatin_t, chLatin_i, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chDash, chDigit_1, + chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, + chLatin_n, chLatin_t, chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, + chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chDash, chLatin_A, + chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, + chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chDash, chLatin_B, + chNull }, + { chLatin_I, chLatin_s, chLatin_I, chLatin_P, chLatin_A, chLatin_E, chLatin_x, chLatin_t, chLatin_e, + chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_a, chLatin_c, chLatin_i, chLatin_n, chLatin_g, + chLatin_M, chLatin_o, chLatin_d, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_r, + chLatin_L, chLatin_e, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, + chLatin_g, chLatin_D, chLatin_i, chLatin_a, chLatin_c, chLatin_r, chLatin_i, + chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_M, chLatin_a, + chLatin_r, chLatin_k, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_r, chLatin_e, chLatin_e, chLatin_k, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_y, chLatin_r, chLatin_i, chLatin_l, chLatin_l, chLatin_i, chLatin_c, + chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_m, chLatin_e, chLatin_n, chLatin_i, chLatin_a, chLatin_n, + chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_e, chLatin_b, chLatin_r, chLatin_e, chLatin_w, chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_y, chLatin_r, chLatin_i, chLatin_a, chLatin_c, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_h, chLatin_a, chLatin_a, chLatin_n, chLatin_a, chNull }, + { chLatin_I, chLatin_s, chLatin_D, chLatin_e, chLatin_v, chLatin_a, chLatin_n, chLatin_a, chLatin_g, chLatin_a, + chLatin_r, chLatin_i, chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_e, chLatin_n, chLatin_g, chLatin_a, chLatin_l, chLatin_i, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_u, chLatin_r, chLatin_m, chLatin_u, chLatin_k, chLatin_h, chLatin_i, + chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_u, chLatin_j, chLatin_a, chLatin_r, chLatin_a, chLatin_t, chLatin_i, + chNull }, + { chLatin_I, chLatin_s, chLatin_O, chLatin_r, chLatin_i, chLatin_y, chLatin_a, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_a, chLatin_m, chLatin_i, chLatin_l, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_e, chLatin_l, chLatin_u, chLatin_g, chLatin_u, chNull }, + { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_n, chLatin_a, chLatin_d, chLatin_a, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_l, chLatin_a, chLatin_y, chLatin_a, chLatin_l, chLatin_a, + chLatin_m, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_i, chLatin_n, chLatin_h, chLatin_a, chLatin_l, chLatin_a, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_h, chLatin_a, chLatin_i, chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_o, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_i, chLatin_b, chLatin_e, chLatin_t, chLatin_a, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_y, chLatin_a, chLatin_n, chLatin_m, chLatin_a, chLatin_r, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_o, chLatin_r, chLatin_g, chLatin_i, chLatin_a, chLatin_n, + chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_J, + chLatin_a, chLatin_m, chLatin_o, chNull }, + { chLatin_I, chLatin_s, chLatin_E, chLatin_t, chLatin_h, chLatin_i, chLatin_o, chLatin_p, chLatin_i, chLatin_c, + chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_h, chLatin_e, chLatin_r, chLatin_o, chLatin_k, chLatin_e, chLatin_e, + chNull }, + { chLatin_I, chLatin_s, chLatin_U, chLatin_n, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, + chLatin_C, chLatin_a, chLatin_n, chLatin_a, chLatin_d, chLatin_i, chLatin_a, chLatin_n, + chLatin_A, chLatin_b, chLatin_o, chLatin_r, chLatin_i, chLatin_g, chLatin_i, chLatin_n, chLatin_a, chLatin_l, + chLatin_S, chLatin_y, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_O, chLatin_g, chLatin_h, chLatin_a, chLatin_m, chNull }, + { chLatin_I, chLatin_s, chLatin_R, chLatin_u, chLatin_n, chLatin_i, chLatin_c, chNull }, + { chLatin_I, chLatin_s, chLatin_K, chLatin_h, chLatin_m, chLatin_e, chLatin_r, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_o, chLatin_n, chLatin_g, chLatin_o, chLatin_l, chLatin_i, + chLatin_a, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_E, chLatin_x, + chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chLatin_A, + chLatin_d, chLatin_d, chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_a, + chLatin_l, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_r, chLatin_e, chLatin_e, chLatin_k, chLatin_E, chLatin_x, + chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_n, chLatin_e, chLatin_r, chLatin_a, chLatin_l, + chLatin_P, chLatin_u, chLatin_n, chLatin_c, chLatin_t, chLatin_u, chLatin_a, chLatin_t, + chLatin_i, chLatin_o, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_u, chLatin_p, chLatin_e, chLatin_r, chLatin_s, chLatin_c, chLatin_r, + chLatin_i, chLatin_p, chLatin_t, chLatin_s, chLatin_a, chLatin_n, chLatin_d, + chLatin_S, chLatin_u, chLatin_b, chLatin_s, chLatin_c, chLatin_r, chLatin_i, + chLatin_p, chLatin_t, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_u, chLatin_r, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_y, + chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, + chLatin_g, chLatin_M, chLatin_a, chLatin_r, chLatin_k, chLatin_s, + chLatin_f, chLatin_o, chLatin_r, chLatin_S, chLatin_y, chLatin_m, chLatin_b, + chLatin_o, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_L, chLatin_e, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_l, chLatin_i, + chLatin_k, chLatin_e, chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, + chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_N, chLatin_u, chLatin_m, chLatin_b, chLatin_e, chLatin_r, chLatin_F, + chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_r, chLatin_o, chLatin_w, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_t, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_t, + chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_O, chLatin_p, chLatin_e, + chLatin_r, chLatin_a, chLatin_t, chLatin_o, chLatin_r, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_i, chLatin_s, chLatin_c, chLatin_e, chLatin_l, chLatin_l, chLatin_a, + chLatin_n, chLatin_e, chLatin_o, chLatin_u, chLatin_s, chLatin_T, chLatin_e, + chLatin_c, chLatin_h, chLatin_n, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_r, chLatin_o, chLatin_l, + chLatin_P, chLatin_i, chLatin_c, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_O, chLatin_p, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, + chLatin_C, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_e, + chLatin_r, chLatin_R, chLatin_e, chLatin_c, chLatin_o, chLatin_g, chLatin_n, + chLatin_i, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_E, chLatin_n, chLatin_c, chLatin_l, chLatin_o, chLatin_s, chLatin_e, chLatin_d, + chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, chLatin_n, chLatin_u, + chLatin_m, chLatin_e, chLatin_r, chLatin_i, chLatin_c, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_x, chLatin_D, chLatin_r, chLatin_a, chLatin_w, + chLatin_i, chLatin_n, chLatin_g, chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_l, chLatin_o, chLatin_c, chLatin_k, chLatin_E, chLatin_l, + chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_e, chLatin_o, chLatin_m, chLatin_e, chLatin_t, chLatin_r, chLatin_i, + chLatin_c, chLatin_S, chLatin_h, chLatin_a, chLatin_p, chLatin_e, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_i, chLatin_s, chLatin_c, chLatin_e, chLatin_l, chLatin_l, chLatin_a, + chLatin_n, chLatin_e, chLatin_o, chLatin_u, chLatin_s, chLatin_S, chLatin_y, + chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_D, chLatin_i, chLatin_n, chLatin_g, chLatin_b, chLatin_a, chLatin_t, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_r, chLatin_a, chLatin_i, chLatin_l, chLatin_l, chLatin_e, + chLatin_P, chLatin_a, chLatin_t, chLatin_t, chLatin_e, chLatin_r, chLatin_n, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, + chLatin_a, chLatin_l, chLatin_s, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, + chLatin_e, chLatin_n, chLatin_t, chNull }, + { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_g, chLatin_x, chLatin_i, + chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, chLatin_a, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, + chLatin_h, chLatin_i, chLatin_c, chLatin_D, chLatin_e, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, + chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_C, chLatin_h, chLatin_a, chLatin_r, chLatin_a, chLatin_c, + chLatin_t, chLatin_e, chLatin_r, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_S, chLatin_y, chLatin_m, chLatin_b, + chLatin_o, chLatin_l, chLatin_s, chLatin_a, chLatin_n, chLatin_d, + chLatin_P, chLatin_u, chLatin_n, chLatin_c, chLatin_t, chLatin_u, chLatin_a, chLatin_t, + chLatin_i, chLatin_o, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_i, chLatin_r, chLatin_a, chLatin_g, chLatin_a, chLatin_n, chLatin_a, + chNull }, + { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_t, chLatin_a, chLatin_k, chLatin_a, chLatin_n, chLatin_a, + chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_p, chLatin_o, chLatin_m, chLatin_o, chLatin_f, chLatin_o, + chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_C, + chLatin_o, chLatin_m, chLatin_p, chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, + chLatin_l, chLatin_i, chLatin_t, chLatin_y, chLatin_J, chLatin_a, chLatin_m, + chLatin_o, chNull }, + { chLatin_I, chLatin_s, chLatin_K, chLatin_a, chLatin_n, chLatin_b, chLatin_u, chLatin_n, chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_o, chLatin_p, chLatin_o, chLatin_m, chLatin_o, chLatin_f, chLatin_o, + chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_d, chNull }, + { chLatin_I, chLatin_s, chLatin_E, chLatin_n, chLatin_c, chLatin_l, chLatin_o, chLatin_s, chLatin_e, chLatin_d, + chLatin_C, chLatin_J, chLatin_K, chLatin_L, chLatin_e, chLatin_t, + chLatin_t, chLatin_e, chLatin_r, chLatin_s, chLatin_a, chLatin_n, chLatin_d, + chLatin_M, chLatin_o, chLatin_n, chLatin_t, chLatin_h, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, + chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, + chLatin_y, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, + chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, + chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, + chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_A, + chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, + chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, + chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_Y, chLatin_i, chLatin_S, chLatin_y, chLatin_l, chLatin_l, chLatin_a, + chLatin_b, chLatin_l, chLatin_e, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_Y, chLatin_i, chLatin_R, chLatin_a, chLatin_d, chLatin_i, chLatin_c, + chLatin_a, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_l, chLatin_S, + chLatin_y, chLatin_l, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_P, chLatin_r, chLatin_i, chLatin_v, chLatin_a, chLatin_t, chLatin_e, + chLatin_U, chLatin_s, chLatin_e, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, + chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, + chLatin_y, chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, + chLatin_a, chLatin_p, chLatin_h, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, chLatin_b, chLatin_e, chLatin_t, + chLatin_i, chLatin_c, chLatin_P, chLatin_r, chLatin_e, chLatin_s, chLatin_e, + chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, + chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_P, + chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, + chLatin_i, chLatin_o, chLatin_n, chLatin_F, chLatin_o, chLatin_r, chLatin_m, + chLatin_s, chDash, chLatin_A, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_o, chLatin_m, chLatin_b, chLatin_i, chLatin_n, chLatin_i, chLatin_n, + chLatin_g, chLatin_H, chLatin_a, chLatin_l, chLatin_f, chLatin_M, + chLatin_a, chLatin_r, chLatin_k, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, + chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, + chLatin_y, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_m, chLatin_a, chLatin_l, chLatin_l, chLatin_F, chLatin_o, + chLatin_r, chLatin_m, chLatin_V, chLatin_a, chLatin_r, chLatin_i, chLatin_a, + chLatin_n, chLatin_t, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_A, chLatin_r, chLatin_a, chLatin_b, chLatin_i, chLatin_c, chLatin_P, + chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, + chLatin_i, chLatin_o, chLatin_n, chLatin_F, chLatin_o, chLatin_r, chLatin_m, + chLatin_s, chDash, chLatin_B, chNull }, + { chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_a, chLatin_l, chLatin_s, + chNull }, + { chLatin_I, chLatin_s, chLatin_H, chLatin_a, chLatin_l, chLatin_f, chLatin_w, chLatin_i, chLatin_d, chLatin_t, + chLatin_h, chLatin_a, chLatin_n, chLatin_d, chLatin_F, chLatin_u, + chLatin_l, chLatin_l, chLatin_w, chLatin_i, chLatin_d, chLatin_t, chLatin_h, + chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_O, chLatin_l, chLatin_d, chLatin_I, chLatin_t, chLatin_a, chLatin_l, chLatin_i, + chLatin_c, chNull }, + { chLatin_I, chLatin_s, chLatin_G, chLatin_o, chLatin_t, chLatin_h, chLatin_i, chLatin_c, chNull }, + { chLatin_I, chLatin_s, chLatin_D, chLatin_e, chLatin_s, chLatin_e, chLatin_r, chLatin_e, chLatin_t, chNull }, + { chLatin_I, chLatin_s, chLatin_B, chLatin_y, chLatin_z, chLatin_a, chLatin_n, chLatin_t, chLatin_i, chLatin_n, chLatin_e, + chLatin_M, chLatin_u, chLatin_s, chLatin_i, chLatin_c, chLatin_a, chLatin_l, + chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_u, chLatin_s, chLatin_i, chLatin_c, chLatin_a, chLatin_l, + chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_M, chLatin_a, chLatin_t, chLatin_h, chLatin_e, + chLatin_m, chLatin_a, chLatin_t, chLatin_i, chLatin_c, chLatin_a, chLatin_l, + chLatin_A, chLatin_l, chLatin_p, chLatin_h, chLatin_a, + chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, chLatin_i, chLatin_c, + chLatin_S, chLatin_y, chLatin_m, chLatin_b, chLatin_o, chLatin_l, chLatin_s, chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_U, chLatin_n, chLatin_i, chLatin_f, + chLatin_i, chLatin_e, chLatin_d, chLatin_I, chLatin_d, chLatin_e, chLatin_o, + chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, + chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_B, + chNull }, + { chLatin_I, chLatin_s, chLatin_C, chLatin_J, chLatin_K, chLatin_C, chLatin_o, chLatin_m, chLatin_p, + chLatin_a, chLatin_t, chLatin_i, chLatin_b, chLatin_i, chLatin_l, chLatin_i, chLatin_t, chLatin_y, + chLatin_I, chLatin_d, chLatin_e, chLatin_o, chLatin_g, chLatin_r, chLatin_a, chLatin_p, chLatin_h, chLatin_s, + chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull }, + { chLatin_I, chLatin_s, chLatin_T, chLatin_a, chLatin_g, chLatin_s, chNull }, +}; + +const XMLInt32 blockRanges[] = +{ + 0x0000,0x007F,0x0080,0x00FF,0x0100,0x017F,0x0180,0x024F,0x0250,0x02AF,0x02B0,0x02FF, + 0x0300,0x036F,0x0370,0x03FF,0x0400,0x04FF,0x0530,0x058F,0x0590,0x05FF,0x0600,0x06FF, + 0x0700,0x074F,0x0780,0x07BF,0x0900,0x097F,0x0980,0x09FF,0x0A00,0x0A7F,0x0A80,0x0AFF, + 0x0B00,0x0B7F,0x0B80,0x0BFF,0x0C00,0x0C7F,0x0C80,0x0CFF,0x0D00,0x0D7F,0x0D80,0x0DFF, + 0x0E00,0x0E7F,0x0E80,0x0EFF,0x0F00,0x0FFF,0x1000,0x109F,0x10A0,0x10FF,0x1100,0x11FF, + 0x1200,0x137F,0x13A0,0x13FF,0x1400,0x167F,0x1680,0x169F,0x16A0,0x16FF,0x1780,0x17FF, + 0x1800,0x18AF,0x1E00,0x1EFF,0x1F00,0x1FFF,0x2000,0x206F,0x2070,0x209F,0x20A0,0x20CF, + 0x20D0,0x20FF,0x2100,0x214F,0x2150,0x218F,0x2190,0x21FF,0x2200,0x22FF,0x2300,0x23FF, + 0x2400,0x243F,0x2440,0x245F,0x2460,0x24FF,0x2500,0x257F,0x2580,0x259F,0x25A0,0x25FF, + 0x2600,0x26FF,0x2700,0x27BF,0x2800,0x28FF,0x2E80,0x2EFF,0x2F00,0x2FDF,0x2FF0,0x2FFF, + 0x3000,0x303F,0x3040,0x309F,0x30A0,0x30FF,0x3100,0x312F,0x3130,0x318F,0x3190,0x319F, + 0x31A0,0x31BF,0x3200,0x32FF,0x3300,0x33FF,0x3400,0x4DB5,0x4E00,0x9FFF,0xA000,0xA48F, + 0xA490,0xA4CF,0xAC00,0xD7A3,0xE000,0xF8FF,0xF900,0xFAFF,0xFB00,0xFB4F,0xFB50,0xFDFF, + 0xFE20,0xFE2F,0xFE30,0xFE4F,0xFE50,0xFE6F,0xFE70,0xFEFE,0xFEFF,0xFEFF,0xFF00,0xFFEF, + 0x10300,0x1032F,0x10330,0x1034F,0x10400,0x1044F,0x1D000,0x1D0FF,0x1D100,0x1D1FF, + 0x1D400,0x1D7FF,0x20000,0x2A6D6,0x2F800,0x2FA1F,0xE0000,0xE007F, chNull +}; + +// --------------------------------------------------------------------------- +// BlockRangeFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +BlockRangeFactory::BlockRangeFactory() +{ + +} + +BlockRangeFactory::~BlockRangeFactory() { + +} + +// --------------------------------------------------------------------------- +// BlockRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void BlockRangeFactory::buildRanges(RangeTokenMap *rangeTokMap) { + + if (fRangesCreated) + return; + + if (!fKeywordsInitialized) { + initializeKeywordMap(rangeTokMap); + } + + TokenFactory* tokFactory = rangeTokMap->getTokenFactory(); + + //for performance, once the desired specials and private use are found + //don't need to compareString anymore + bool foundSpecial = false; + bool foundPrivate = false; + + for (int i=0; i < BLOCKNAMESIZE; i++) { + RangeToken* tok = tokFactory->createRange(); + tok->addRange(blockRanges[i*2], blockRanges[(i*2)+1]); + + if (!foundSpecial && XMLString::equals((XMLCh*)fgBlockNames[i] , (XMLCh*) fgBlockIsSpecials)) { + tok->addRange(0xFFF0, 0xFFFD); + foundSpecial = true; + } + if (!foundPrivate && XMLString::equals((XMLCh*)fgBlockNames[i] , (XMLCh*) fgBlockIsPrivateUse)) { + tok->addRange(0xF0000, 0xFFFFD); + tok->addRange(0x100000, 0x10FFFD); + foundPrivate = true; + } + + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgBlockNames[i], tok); + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgBlockNames[i], tok , true); + } + + fRangesCreated = true; +} + +// --------------------------------------------------------------------------- +// BlockRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void BlockRangeFactory::initializeKeywordMap(RangeTokenMap *rangeTokMap) { + + if (fKeywordsInitialized) + return; + + for (int i=0; i< BLOCKNAMESIZE; i++) { + rangeTokMap->addKeywordMap(fgBlockNames[i], fgBlockCategory); + } + + fKeywordsInitialized = true; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file BlockRangeFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.hpp new file mode 100644 index 000000000..3b4e7028e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/BlockRangeFactory.hpp @@ -0,0 +1,66 @@ +/* + * 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: BlockRangeFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BLOCKRANGEFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_BLOCKRANGEFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT BlockRangeFactory: public RangeFactory { + +public: + // ----------------------------------------------------------------------- + // Constructors and operators + // ----------------------------------------------------------------------- + BlockRangeFactory(); + ~BlockRangeFactory(); + + // ----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + void initializeKeywordMap(RangeTokenMap *rangeTokMap = 0); + +protected: + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + void buildRanges(RangeTokenMap *rangeTokMap = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + BlockRangeFactory(const BlockRangeFactory&); + BlockRangeFactory& operator=(const BlockRangeFactory&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file BlockRangeFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/CharToken.cpp b/project/jni/xerces/src/xercesc/util/regx/CharToken.cpp new file mode 100644 index 000000000..1d057988b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/CharToken.cpp @@ -0,0 +1,48 @@ +/* + * 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: CharToken.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Token: Constructors and Destructors +// --------------------------------------------------------------------------- +CharToken::CharToken(const Token::tokType tkType, const XMLInt32 ch, MemoryManager* const manager) + : Token(tkType, manager) + , fCharData(ch) +{ + +} + + +CharToken::~CharToken() { + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file CharToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/CharToken.hpp b/project/jni/xerces/src/xercesc/util/regx/CharToken.hpp new file mode 100644 index 000000000..07c55e5a3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/CharToken.hpp @@ -0,0 +1,88 @@ +/* + * 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: CharToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CHARTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_CHARTOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT CharToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + CharToken(const tokType tkType, const XMLInt32 ch + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~CharToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLInt32 getChar() const; + + // ----------------------------------------------------------------------- + // Match methods + // ----------------------------------------------------------------------- + bool match(const XMLInt32 ch); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CharToken(const CharToken&); + CharToken& operator=(const CharToken&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + XMLInt32 fCharData; +}; + + +// --------------------------------------------------------------------------- +// CharToken: getter methods +// --------------------------------------------------------------------------- +inline XMLInt32 CharToken::getChar() const { + + return fCharData; +} + + +// --------------------------------------------------------------------------- +// CharToken: getter methods +// --------------------------------------------------------------------------- +inline bool CharToken::match(const XMLInt32 ch){ + + return ch == fCharData; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file CharToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ClosureToken.cpp b/project/jni/xerces/src/xercesc/util/regx/ClosureToken.cpp new file mode 100644 index 000000000..cfb2fe2ad --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ClosureToken.cpp @@ -0,0 +1,50 @@ +/* + * 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: ClosureToken.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ClosureToken: Constructors and Destructors +// --------------------------------------------------------------------------- +ClosureToken::ClosureToken(const Token::tokType tkType, Token* const tok, MemoryManager* const manager) + : Token(tkType, manager) + , fMin(-1) + , fMax(-1) + , fChild(tok) +{ + +} + + +ClosureToken::~ClosureToken() { + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ClosureToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ClosureToken.hpp b/project/jni/xerces/src/xercesc/util/regx/ClosureToken.hpp new file mode 100644 index 000000000..e8df95e73 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ClosureToken.hpp @@ -0,0 +1,114 @@ +/* + * 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: ClosureToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CLOSURETOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_CLOSURETOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT ClosureToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ClosureToken(const tokType tkType, Token* const tok + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ClosureToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t size() const; + int getMin() const; + int getMax() const; + Token* getChild(const XMLSize_t index) const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setMin(const int minVal); + void setMax(const int maxVal); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ClosureToken(const ClosureToken&); + ClosureToken& operator=(const ClosureToken&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + int fMin; + int fMax; + Token* fChild; +}; + + +// --------------------------------------------------------------------------- +// ClosureToken: getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t ClosureToken::size() const { + + return 1; +} + + +inline int ClosureToken::getMax() const { + + return fMax; +} + +inline int ClosureToken::getMin() const { + + return fMin; +} + +inline Token* ClosureToken::getChild(const XMLSize_t) const { + + return fChild; +} + +// --------------------------------------------------------------------------- +// ClosureToken: setter methods +// --------------------------------------------------------------------------- +inline void ClosureToken::setMax(const int maxVal) { + + fMax = maxVal; +} + +inline void ClosureToken::setMin(const int minVal) { + + fMin = minVal; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ClosureToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ConcatToken.cpp b/project/jni/xerces/src/xercesc/util/regx/ConcatToken.cpp new file mode 100644 index 000000000..12402a4ea --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ConcatToken.cpp @@ -0,0 +1,49 @@ +/* + * 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: ConcatToken.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Token: Constructors and Destructors +// --------------------------------------------------------------------------- +ConcatToken::ConcatToken(Token* const tok1, Token* const tok2, MemoryManager* const manager) + : Token(Token::T_CONCAT, manager) + , fChild1(tok1) + , fChild2(tok2) +{ + +} + + +ConcatToken::~ConcatToken() { + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ConcatToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ConcatToken.hpp b/project/jni/xerces/src/xercesc/util/regx/ConcatToken.hpp new file mode 100644 index 000000000..d7a869695 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ConcatToken.hpp @@ -0,0 +1,81 @@ +/* + * 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: ConcatToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CONCATTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_CONCATTOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT ConcatToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ConcatToken(Token* const tok1, Token* const tok2 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ConcatToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + Token* getChild(const XMLSize_t index) const; + XMLSize_t size() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ConcatToken(const ConcatToken&); + ConcatToken& operator=(const ConcatToken&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + Token* fChild1; + Token* fChild2; +}; + + +// --------------------------------------------------------------------------- +// StringToken: getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t ConcatToken::size() const { + + return 2; +} + +inline Token* ConcatToken::getChild(const XMLSize_t index) const { + + return index == 0 ? fChild1 : fChild2; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ConcatToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/Match.cpp b/project/jni/xerces/src/xercesc/util/regx/Match.cpp new file mode 100644 index 000000000..e11c6057b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Match.cpp @@ -0,0 +1,120 @@ +/* + * 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: Match.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Match: Constructors and Destructors +// --------------------------------------------------------------------------- +Match::Match(MemoryManager* const manager) : + fNoGroups(0) + , fPositionsSize(0) + , fStartPositions(0) + , fEndPositions(0) + , fMemoryManager(manager) +{ + +} + +Match::Match(const Match& toCopy) : + XMemory(toCopy) + , fNoGroups(0) + , fPositionsSize(0) + , fStartPositions(0) + , fEndPositions(0) + , fMemoryManager(0) +{ + initialize(toCopy); +} + +Match& Match::operator=(const Match& toAssign) { + + initialize(toAssign); + return *this; +} + + +Match::~Match() { + + cleanUp(); +} + +// --------------------------------------------------------------------------- +// Match: Setter Methods +// --------------------------------------------------------------------------- +void Match::setNoGroups(const int n) { + + if (fNoGroups <= 0 || fPositionsSize < n) { + + cleanUp(); + fPositionsSize = n; + fStartPositions = (int*) fMemoryManager->allocate(n * sizeof(int));//new int[n]; + fEndPositions = (int*) fMemoryManager->allocate(n * sizeof(int));//new int[n]; + } + + fNoGroups = n; + + for (int i=0; i< fPositionsSize; i++) { + + fStartPositions[i] = -1; + fEndPositions[i] = -1; + } +} + +// --------------------------------------------------------------------------- +// Match: private helpers methods +// --------------------------------------------------------------------------- +void Match::initialize(const Match &toCopy){ + + //do not copy over value of fPositionSize as it is irrelevant to the + //state of the Match + + fMemoryManager = toCopy.fMemoryManager; + int toCopySize = toCopy.getNoGroups(); + setNoGroups(toCopySize); + + for (int i=0; ideallocate(fStartPositions);//delete [] fStartPositions; + fMemoryManager->deallocate(fEndPositions);//delete [] fEndPositions; + + fStartPositions = 0; + fEndPositions = 0; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file Match.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/Match.hpp b/project/jni/xerces/src/xercesc/util/regx/Match.hpp new file mode 100644 index 000000000..d60345af3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Match.hpp @@ -0,0 +1,163 @@ +/* + * 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: Match.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MATCH_HPP) +#define XERCESC_INCLUDE_GUARD_MATCH_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * An instance of this class has ranges captured in matching + */ + class XMLUTIL_EXPORT Match : public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + Match(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /** + * Copy constructor + */ + Match(const Match& toCopy); + Match& operator=(const Match& toAssign); + + virtual ~Match(); + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + int getNoGroups() const; + int getStartPos(int index) const; + int getEndPos(int index) const; + + // ----------------------------------------------------------------------- + // Setter functions + // ----------------------------------------------------------------------- + void setNoGroups(const int n); + void setStartPos(const int index, const int value); + void setEndPos(const int index, const int value); + +private: + // ----------------------------------------------------------------------- + // Initialize/Clean up methods + // ----------------------------------------------------------------------- + void initialize(const Match& toCopy); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fNoGroups + // Represents no of regular expression groups + // + // fStartPositions + // Array of start positions in the target text matched to specific + // regular expression group + // + // fEndPositions + // Array of end positions in the target text matched to specific + // regular expression group + // + // fPositionsSize + // Actual size of Start/EndPositions array. + // ----------------------------------------------------------------------- + int fNoGroups; + int fPositionsSize; + int* fStartPositions; + int* fEndPositions; + MemoryManager* fMemoryManager; +}; + +/** + * Inline Methods + */ + +// --------------------------------------------------------------------------- +// Match: getter methods +// --------------------------------------------------------------------------- +inline int Match::getNoGroups() const { + + if (fNoGroups < 0) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_Result_Not_Set, fMemoryManager); + + return fNoGroups; +} + +inline int Match::getStartPos(int index) const { + + if (!fStartPositions) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_Result_Not_Set, fMemoryManager); + + if (index < 0 || fNoGroups <= index) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + + return fStartPositions[index]; +} + +inline int Match::getEndPos(int index) const { + + if (!fEndPositions) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_Result_Not_Set, fMemoryManager); + + if (index < 0 || fNoGroups <= index) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + + return fEndPositions[index]; +} + +// --------------------------------------------------------------------------- +// Match: setter methods +// --------------------------------------------------------------------------- +inline void Match::setStartPos(const int index, const int value) { + + if (!fStartPositions) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_Result_Not_Set, fMemoryManager); + + if (index < 0 || fNoGroups <= index) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + + fStartPositions[index] = value; +} + +inline void Match::setEndPos(const int index, const int value) { + + if (!fEndPositions) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_Result_Not_Set, fMemoryManager); + + if (index < 0 || fNoGroups <= index) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + + fEndPositions[index] = value; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/util/regx/Op.cpp b/project/jni/xerces/src/xercesc/util/regx/Op.cpp new file mode 100644 index 000000000..9ec8db83b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Op.cpp @@ -0,0 +1,216 @@ +/* + * 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: Op.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Op: Constructors and Destructors +// --------------------------------------------------------------------------- +Op::Op(const Op::opType type, MemoryManager* const manager) + : fMemoryManager(manager) + , fOpType(type) + , fNextOp(0) +{ +} + +// --------------------------------------------------------------------------- +// Op: Getter methods +// --------------------------------------------------------------------------- +XMLSize_t Op::getSize() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +XMLInt32 Op::getData() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +XMLInt32 Op::getData2() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +const Op* Op::elementAt(XMLSize_t) const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +const Op* Op::getChild() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +const XMLCh* Op::getLiteral() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + +const Token* Op::getToken() const { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // for compilers that complain about no return value +} + + +// --------------------------------------------------------------------------- +// CharOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +CharOp::CharOp(const Op::opType type, const XMLInt32 charData + , MemoryManager* const manager) + : Op(type, manager) + , fCharData(charData) { +} + +// --------------------------------------------------------------------------- +// CharOp: Getter methods +// --------------------------------------------------------------------------- +XMLInt32 CharOp::getData() const { + + return fCharData; +} + +// --------------------------------------------------------------------------- +// UnionOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +UnionOp::UnionOp(const Op::opType type, const XMLSize_t size, MemoryManager* const manager) + : Op(type, manager) + , fBranches(new (manager) RefVectorOf (size, false, manager)) { + +} + +// --------------------------------------------------------------------------- +// UnionOp: Getter/Setter methods +// --------------------------------------------------------------------------- +XMLSize_t UnionOp::getSize() const { + + return fBranches->size(); +} + +const Op* UnionOp::elementAt(XMLSize_t index) const { + + return fBranches->elementAt(index); +} + +void UnionOp::addElement(Op* const op) { + + fBranches->addElement(op); +} + +// --------------------------------------------------------------------------- +// ChildOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +ChildOp::ChildOp(const Op::opType type, MemoryManager* const manager) + : Op(type, manager) + , fChild(0) { + +} + +// --------------------------------------------------------------------------- +// ChildOp: Getter/Setter methods +// --------------------------------------------------------------------------- +const Op* ChildOp::getChild() const { + + return fChild; +} + +void ChildOp::setChild(const Op* const child) { + + fChild = child; +} + +// --------------------------------------------------------------------------- +// ModifierOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +ModifierOp::ModifierOp(const Op::opType type, const XMLInt32 v1, const XMLInt32 v2 + , MemoryManager* const manager) + : ChildOp(type, manager) + , fVal1(v1) + , fVal2(v2) { + +} + +// --------------------------------------------------------------------------- +// ModifierOp: Getter methods +// --------------------------------------------------------------------------- +XMLInt32 ModifierOp::getData() const { + + return fVal1; +} + +XMLInt32 ModifierOp::getData2() const { + + return fVal2; +} + +// --------------------------------------------------------------------------- +// RangeOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +RangeOp::RangeOp(const Op::opType type, const Token* const token, MemoryManager* const manager) + : Op (type, manager) + , fToken(token) { + +} + +// --------------------------------------------------------------------------- +// RangeOp: Getter methods +// --------------------------------------------------------------------------- +const Token* RangeOp::getToken() const { + + return fToken; +} + + +// --------------------------------------------------------------------------- +// StringOp: Constructors and Destuctors +// --------------------------------------------------------------------------- +StringOp::StringOp(const Op::opType type, const XMLCh* const literal + , MemoryManager* const manager) + : Op (type, manager) + , fLiteral(XMLString::replicate(literal, manager)) { + +} + +// --------------------------------------------------------------------------- +// StringOp: Getter methods +// --------------------------------------------------------------------------- +const XMLCh* StringOp::getLiteral() const { + + return fLiteral; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End file Op.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/Op.hpp b/project/jni/xerces/src/xercesc/util/regx/Op.hpp new file mode 100644 index 000000000..1ecd28cce --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Op.hpp @@ -0,0 +1,306 @@ +/* + * 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: Op.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_OP_HPP) +#define XERCESC_INCLUDE_GUARD_OP_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class Token; + + +class XMLUTIL_EXPORT Op : public XMemory +{ +public: + + typedef enum { + O_DOT = 0, + O_CHAR = 1, + O_RANGE = 3, + O_NRANGE = 4, + O_ANCHOR = 5, + O_STRING = 6, + O_CLOSURE = 7, + O_NONGREEDYCLOSURE = 8, + O_FINITE_CLOSURE = 9, + O_FINITE_NONGREEDYCLOSURE = 10, + O_QUESTION = 11, + O_NONGREEDYQUESTION = 12, + O_UNION = 13, + O_CAPTURE = 15, + O_BACKREFERENCE = 16 + } opType; + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + virtual ~Op() { } + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + opType getOpType() const; + const Op* getNextOp() const; + virtual XMLInt32 getData() const; + virtual XMLInt32 getData2() const; + virtual XMLSize_t getSize() const; + virtual const Op* elementAt(XMLSize_t index) const; + virtual const Op* getChild() const; + virtual const Token* getToken() const; + virtual const XMLCh* getLiteral() const; + + // ----------------------------------------------------------------------- + // Setter functions + // ----------------------------------------------------------------------- + void setOpType(const opType type); + void setNextOp(const Op* const next); + +protected: + // ----------------------------------------------------------------------- + // Protected Constructors + // ----------------------------------------------------------------------- + Op(const opType type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + friend class OpFactory; + + MemoryManager* const fMemoryManager; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Op(const Op&); + Op& operator=(const Op&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fOpType + // Indicates the type of operation + // + // fNextOp + // Points to the next operation in the chain + // ----------------------------------------------------------------------- + opType fOpType; + const Op* fNextOp; +}; + + +class XMLUTIL_EXPORT CharOp: public Op { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + CharOp(const opType type, const XMLInt32 charData, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~CharOp() {} + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + XMLInt32 getData() const; + +private: + // Private data members + XMLInt32 fCharData; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CharOp(const CharOp&); + CharOp& operator=(const CharOp&); +}; + +class XMLUTIL_EXPORT UnionOp : public Op { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + UnionOp(const opType type, const XMLSize_t size, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~UnionOp() { delete fBranches; } + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + XMLSize_t getSize() const; + const Op* elementAt(XMLSize_t index) const; + + // ----------------------------------------------------------------------- + // Setter functions + // ----------------------------------------------------------------------- + void addElement(Op* const op); + +private: + // Private Data members + RefVectorOf* fBranches; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + UnionOp(const UnionOp&); + UnionOp& operator=(const UnionOp&); +}; + + +class XMLUTIL_EXPORT ChildOp: public Op { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ChildOp(const opType type, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ChildOp() {} + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + const Op* getChild() const; + + // ----------------------------------------------------------------------- + // Setter functions + // ----------------------------------------------------------------------- + void setChild(const Op* const child); + +private: + // Private data members + const Op* fChild; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ChildOp(const ChildOp&); + ChildOp& operator=(const ChildOp&); +}; + +class XMLUTIL_EXPORT ModifierOp: public ChildOp { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ModifierOp(const opType type, const XMLInt32 v1, const XMLInt32 v2, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ModifierOp() {} + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + XMLInt32 getData() const; + XMLInt32 getData2() const; + +private: + // Private data members + XMLInt32 fVal1; + XMLInt32 fVal2; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ModifierOp(const ModifierOp&); + ModifierOp& operator=(const ModifierOp&); +}; + +class XMLUTIL_EXPORT RangeOp: public Op { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + RangeOp(const opType type, const Token* const token, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~RangeOp() {} + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + const Token* getToken() const; + +private: + // Private data members + const Token* fToken; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RangeOp(const RangeOp&); + RangeOp& operator=(const RangeOp&); +}; + +class XMLUTIL_EXPORT StringOp: public Op { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + StringOp(const opType type, const XMLCh* const literal, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~StringOp() { fMemoryManager->deallocate(fLiteral);} + + // ----------------------------------------------------------------------- + // Getter functions + // ----------------------------------------------------------------------- + const XMLCh* getLiteral() const; + +private: + // Private data members + XMLCh* fLiteral; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + StringOp(const StringOp&); + StringOp& operator=(const StringOp&); +}; + +// --------------------------------------------------------------------------- +// Op: getter methods +// --------------------------------------------------------------------------- +inline Op::opType Op::getOpType() const { + + return fOpType; +} + +inline const Op* Op::getNextOp() const { + + return fNextOp; +} + +// --------------------------------------------------------------------------- +// Op: setter methods +// --------------------------------------------------------------------------- +inline void Op::setOpType(const Op::opType type) { + + fOpType = type; +} + +inline void Op::setNextOp(const Op* const nextOp) { + + fNextOp = nextOp; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file Op.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/OpFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/OpFactory.cpp new file mode 100644 index 000000000..a6e33adb3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/OpFactory.cpp @@ -0,0 +1,143 @@ +/* + * 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: OpFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// OpFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +OpFactory::OpFactory(MemoryManager* const manager) : + fOpVector(0) + , fMemoryManager(manager) +{ + fOpVector = new (fMemoryManager) RefVectorOf(16, true, fMemoryManager); +} + +OpFactory::~OpFactory() { + + delete fOpVector; + fOpVector = 0; +} + +// --------------------------------------------------------------------------- +// OpFactory - Factory methods +// --------------------------------------------------------------------------- +Op* OpFactory::createDotOp() { + + Op* tmpOp = new (fMemoryManager) Op(Op::O_DOT, fMemoryManager); + fOpVector->addElement(tmpOp); + return tmpOp; +} + +CharOp* OpFactory::createCharOp(XMLInt32 data) { + + CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_CHAR, data, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +CharOp* OpFactory::createAnchorOp(XMLInt32 data) { + + CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_ANCHOR, data, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +CharOp* OpFactory::createCaptureOp(int number, const Op* const next) { + + CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_CAPTURE, number, fMemoryManager); + + tmpOp->setNextOp(next); + fOpVector->addElement(tmpOp); + return tmpOp; +} + +UnionOp* OpFactory::createUnionOp(XMLSize_t size) { + + UnionOp* tmpOp = new (fMemoryManager) UnionOp(Op::O_UNION, size, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +ChildOp* OpFactory::createClosureOp(int id) { + + ModifierOp* tmpOp = new (fMemoryManager) ModifierOp(Op::O_CLOSURE, id, -1, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +ChildOp* OpFactory::createNonGreedyClosureOp() { + + ChildOp* tmpOp = new (fMemoryManager) ChildOp(Op::O_NONGREEDYCLOSURE, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +ChildOp* OpFactory::createQuestionOp(bool nonGreedy) { + + ChildOp* tmpOp = new (fMemoryManager) ChildOp(nonGreedy ? Op::O_NONGREEDYQUESTION : + Op::O_QUESTION, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +RangeOp* OpFactory::createRangeOp(const Token* const token) { + + RangeOp* tmpOp = new (fMemoryManager) RangeOp(Op::O_RANGE, token, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +CharOp* OpFactory::createBackReferenceOp(int refNo) { + + CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_BACKREFERENCE, refNo, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +StringOp* OpFactory::createStringOp(const XMLCh* const literal) { + + StringOp* tmpOp = new (fMemoryManager) StringOp(Op::O_STRING, literal, fMemoryManager); + + fOpVector->addElement(tmpOp); + return tmpOp; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file OpFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/OpFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/OpFactory.hpp new file mode 100644 index 000000000..e848e4267 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/OpFactory.hpp @@ -0,0 +1,116 @@ +/* + * 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: OpFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_OPFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_OPFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class Op; +class CharOp; +class UnionOp; +class ChildOp; +class RangeOp; +class StringOp; +class ModifierOp; +class Token; + +/* + * A Factory class used by 'RegularExpression' to create different types of + * operations (Op) objects. The class will keep track of all objects created + * for cleanup purposes. Each 'RegularExpression' object will have its own + * instance of OpFactory and when a 'RegularExpression' object is deleted + * all associated Op objects will be deleted. + */ + +class XMLUTIL_EXPORT OpFactory : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and destructors + // ----------------------------------------------------------------------- + OpFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~OpFactory(); + + // ----------------------------------------------------------------------- + // Factory methods + // ----------------------------------------------------------------------- + Op* createDotOp(); + CharOp* createCharOp(XMLInt32 data); + CharOp* createAnchorOp(XMLInt32 data); + CharOp* createCaptureOp(int number, const Op* const next); + UnionOp* createUnionOp(XMLSize_t size); + ChildOp* createClosureOp(int id); + ChildOp* createNonGreedyClosureOp(); + ChildOp* createQuestionOp(bool nonGreedy); + RangeOp* createRangeOp(const Token* const token); + CharOp* createBackReferenceOp(int refNo); + StringOp* createStringOp(const XMLCh* const literal); + + // ----------------------------------------------------------------------- + // Reset methods + // ----------------------------------------------------------------------- + /* + * Remove all created Op objects from Vector + */ + void reset(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + OpFactory(const OpFactory&); + OpFactory& operator=(const OpFactory&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fOpVector + // Contains Op objects. Used for memory cleanup. + // ----------------------------------------------------------------------- + RefVectorOf* fOpVector; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// OpFactory - Factory methods +// --------------------------------------------------------------------------- +inline void OpFactory::reset() { + + fOpVector->removeAllElements(); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file OpFactory + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ParenToken.cpp b/project/jni/xerces/src/xercesc/util/regx/ParenToken.cpp new file mode 100644 index 000000000..264817ded --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ParenToken.cpp @@ -0,0 +1,50 @@ +/* + * 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: ParenToken.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ParenToken: Constructors and Destructors +// --------------------------------------------------------------------------- +ParenToken::ParenToken(const Token::tokType tkType, + Token* const tok, const int noParen, MemoryManager* const manager) + : Token(tkType, manager) + , fNoParen(noParen) + , fChild(tok) +{ + +} + + +ParenToken::~ParenToken() { + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ParenToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ParenToken.hpp b/project/jni/xerces/src/xercesc/util/regx/ParenToken.hpp new file mode 100644 index 000000000..9a3a0b6cd --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ParenToken.hpp @@ -0,0 +1,87 @@ +/* + * 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: ParenToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PARENTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_PARENTOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT ParenToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ParenToken(const tokType tkType, Token* const tok, + const int noParen, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ParenToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t size() const; + int getNoParen() const; + Token* getChild(const XMLSize_t index) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ParenToken(const ParenToken&); + ParenToken& operator=(const ParenToken&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + int fNoParen; + Token* fChild; +}; + + +// --------------------------------------------------------------------------- +// ParenToken: getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t ParenToken::size() const { + + return 1; +} + +inline int ParenToken::getNoParen() const { + + return fNoParen; +} + +inline Token* ParenToken::getChild(const XMLSize_t) const { + + return fChild; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ParenToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.cpp b/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.cpp new file mode 100644 index 000000000..c1f0df9cb --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.cpp @@ -0,0 +1,171 @@ +/* + * 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: ParserForXMLSchema.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ParserForXMLSchema: Constructors and Destructors +// --------------------------------------------------------------------------- +ParserForXMLSchema::ParserForXMLSchema(MemoryManager* const manager) + : RegxParser(manager) +{ + +} + +ParserForXMLSchema::~ParserForXMLSchema() { + +} + +// --------------------------------------------------------------------------- +// ParserForXMLSchema: Parsing/Processing methods +// --------------------------------------------------------------------------- +Token* ParserForXMLSchema::processCaret() { + + // XML Schema treats "^" like any other char + processNext(); + return getTokenFactory()->createChar(chCaret); +} + +Token* ParserForXMLSchema::processDollar() { + + // XML Schema treats "$" like any other char + processNext(); + return getTokenFactory()->createChar(chDollarSign); +} + +Token* ParserForXMLSchema::processPlus(Token* const tok) { + + // XML Schema doesn't support reluctant quantifiers + processNext(); + return getTokenFactory()->createConcat(tok, + getTokenFactory()->createClosure(tok)); +} + +Token* ParserForXMLSchema::processStar(Token* const tok) { + + // XML Schema doesn't support reluctant quantifiers + processNext(); + return getTokenFactory()->createClosure(tok); +} + +Token* ParserForXMLSchema::processQuestion(Token* const tok) { + + // XML Schema doesn't support reluctant quantifiers + processNext(); + + TokenFactory* tokFactory = getTokenFactory(); + Token* retTok = tokFactory->createUnion(); + retTok->addChild(tok, tokFactory); + retTok->addChild(tokFactory->createToken(Token::T_EMPTY), tokFactory); + return retTok; +} + +Token* ParserForXMLSchema::processParen() { + + // XML Schema doesn't support back references + processNext(); + Token* retTok = getTokenFactory()->createParenthesis(parseRegx(true), 0); + + if (getState() != REGX_T_RPAREN) { + ThrowXMLwithMemMgr(ParseException, XMLExcepts::Parser_Factor1, getMemoryManager()); + } + + processNext(); + return retTok; +} + +Token* ParserForXMLSchema::processBackReference() { + + // XML Schema doesn't support back references + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager()); + return 0; // for compilers that complain about no return value +} + +// --------------------------------------------------------------------------- +// ParserForXMLSchema: Helper methods +// --------------------------------------------------------------------------- +bool ParserForXMLSchema::checkQuestion(const XMLSize_t ) { + + // XML Schema doesn't support reluctant quantifiers + return false; +} + + +XMLInt32 ParserForXMLSchema::decodeEscaped() { + + // XML Schema doesn't support an escaped "$" + if (getState() != REGX_T_BACKSOLIDUS) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Next1, getMemoryManager()); + + XMLInt32 ch = getCharData(); + + switch (ch) { + case chLatin_n: + ch = chLF; + break; + case chLatin_r: + ch = chCR; + break; + case chLatin_t: + ch = chHTab; + break; + case chBackSlash: + case chPipe: + case chPeriod: + case chCaret: + case chDash: + case chQuestion: + case chAsterisk: + case chPlus: + case chOpenCurly: + case chCloseCurly: + case chOpenParen: + case chCloseParen: + case chOpenSquare: + case chCloseSquare: + break; + default: + { + XMLCh chString[] = {chBackSlash, ch, chNull}; + ThrowXMLwithMemMgr1(ParseException,XMLExcepts::Parser_Process2, chString, getMemoryManager()); + } + } + + return ch; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ParserForXMLSchema.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.hpp b/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.hpp new file mode 100644 index 000000000..2fb3d5d3f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/ParserForXMLSchema.hpp @@ -0,0 +1,86 @@ +/* + * 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: ParserForXMLSchema.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PARSERFORXMLSCHEMA_HPP) +#define XERCESC_INCLUDE_GUARD_PARSERFORXMLSCHEMA_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class Token; +class RangeToken; + +class XMLUTIL_EXPORT ParserForXMLSchema : public RegxParser { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + ParserForXMLSchema(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ParserForXMLSchema(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + +protected: + // ----------------------------------------------------------------------- + // Parsing/Processing methods + // ----------------------------------------------------------------------- + Token* processCaret(); + Token* processDollar(); + Token* processStar(Token* const tok); + Token* processPlus(Token* const tok); + Token* processQuestion(Token* const tok); + Token* processParen(); + Token* processBackReference(); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + bool checkQuestion(const XMLSize_t off); + XMLInt32 decodeEscaped(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ParserForXMLSchema(const ParserForXMLSchema&); + ParserForXMLSchema& operator=(const ParserForXMLSchema&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ParserForXMLSchema.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/RangeFactory.cpp new file mode 100644 index 000000000..c1f815ea9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeFactory.cpp @@ -0,0 +1,47 @@ +/* + * 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: RangeFactory.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RangeFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +RangeFactory::RangeFactory() : + fRangesCreated(false) + , fKeywordsInitialized(false) +{ + +} + +RangeFactory::~RangeFactory() { + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file RangeFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/RangeFactory.hpp new file mode 100644 index 000000000..37fbc97a8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeFactory.hpp @@ -0,0 +1,89 @@ +/* + * 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: RangeFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_RANGEFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_RANGEFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class RangeTokenMap; + +class XMLUTIL_EXPORT RangeFactory : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors and destructors + // ----------------------------------------------------------------------- + virtual ~RangeFactory(); + + //----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + /** + * To maintain src code compatibility, we added a default parameter. + * The caller is expected to pass in a valid RangeTokenMap instance. + */ + virtual void initializeKeywordMap(RangeTokenMap *rangeTokMap = 0) = 0; + + /* + * Used by children to build commonly used ranges + * To maintain src code compatibility, we added a default parameter. + * The caller is expected to pass in a valid RangeTokenMap instance. + */ + virtual void buildRanges(RangeTokenMap *rangeTokMap = 0) = 0; + +protected: + // ----------------------------------------------------------------------- + // Constructor and destructors + // ----------------------------------------------------------------------- + RangeFactory(); + + //friend class RangeTokenMap; + + // ----------------------------------------------------------------------- + // Data + // ----------------------------------------------------------------------- + bool fRangesCreated; + bool fKeywordsInitialized; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RangeFactory(const RangeFactory&); + RangeFactory& operator=(const RangeFactory&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file RangeFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeToken.cpp b/project/jni/xerces/src/xercesc/util/regx/RangeToken.cpp new file mode 100644 index 000000000..8ca30c3c8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeToken.cpp @@ -0,0 +1,874 @@ +/* + * 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: RangeToken.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include +#include +#include + +#if XERCES_USE_TRANSCODER_ICU + #include + +#if (U_ICU_VERSION_MAJOR_NUM > 2) || (U_ICU_VERSION_MAJOR_NUM == 2 && U_ICU_VERSION_MINOR_NUM >=4) + #include + #include + #include +#endif +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Static member data initialization +// --------------------------------------------------------------------------- +const int RangeToken::MAPSIZE = 256; +const unsigned int RangeToken::INITIALSIZE = 16; + +// --------------------------------------------------------------------------- +// RangeToken: Constructors and Destructors +// --------------------------------------------------------------------------- +RangeToken::RangeToken(const Token::tokType tkType, + MemoryManager* const manager) + : Token(tkType, manager) + , fSorted(false) + , fCompacted(false) + , fNonMapIndex(0) + , fElemCount(0) + , fMaxCount(INITIALSIZE) + , fMap(0) + , fRanges(0) + , fCaseIToken(0) + , fMemoryManager(manager) +{ + +} + +RangeToken::~RangeToken() { + + // TODO(dbertoni) This is a temporary hack until we can change the ABI. + // See Jira issue XERCESC-1866 for more details. + if (fCaseIToken && fCaseIToken->fCaseIToken == this) + { + fCaseIToken->fCaseIToken = 0; + } + fMemoryManager->deallocate(fMap);//delete [] fMap; + fMemoryManager->deallocate(fRanges);//delete[] fRanges; +} + + +// This is a struct that defines a mapping for +// case-insensitive matching. The first character +// is the character we try to match in the range. +// The second is the character we add to the range, +// because it maps to the first when we're folding +// case. +struct ExceptionCharsStruct +{ + XMLInt32 baseChar; + + XMLInt32 matchingChar; +}; + + +// This is an array of character mappings that we will +// add to ranges for case-insensitive matching. +static const ExceptionCharsStruct s_exceptions[] = +{ + { 0x49, 0x130 }, + { 0x49, 0x131 }, + { 0x4b, 0x212a }, + { 0x53, 0x17f }, + { 0x69, 0x130 }, + { 0x69, 0x131 }, + { 0x6b, 0x212a }, + { 0x73, 0x17f }, + { 0xc5, 0x212b }, + { 0xe5, 0x212b }, + { 0x1c4, 0x1c5 }, + { 0x1c6, 0x1c5 }, + { 0x1c7, 0x1c8 }, + { 0x1c9, 0x1c8 }, + { 0x1ca, 0x1cb }, + { 0x1cc, 0x1cb }, + { 0x1f1, 0x1f2 }, + { 0x1f3, 0x1f2 }, + { 0x392, 0x3d0 }, + { 0x395, 0x3f5 }, + { 0x398, 0x3d1 }, + { 0x398, 0x3f4 }, + { 0x399, 0x345 }, + { 0x399, 0x1fbe }, + { 0x39a, 0x3f0 }, + { 0x39c, 0xb5 }, + { 0x3a0, 0x3d6 }, + { 0x3a1, 0x3f1 }, + { 0x3a3, 0x3c2 }, + { 0x3a6, 0x3d5 }, + { 0x3a9, 0x2126 }, + { 0x3b2, 0x3d0 }, + { 0x3b5, 0x3f5 }, + { 0x3b8, 0x3d1 }, + { 0x3b8, 0x3f4 }, + { 0x3b9, 0x345 }, + { 0x3b9, 0x1fbe }, + { 0x3ba, 0x3f0 }, + { 0x3bc, 0xb5 }, + { 0x3c0, 0x3d6 }, + { 0x3c1, 0x3f1 }, + { 0x3c3, 0x3c2 }, + { 0x3c6, 0x3d5 }, + { 0x3c9, 0x2126 }, + { 0x1e60, 0x1e9b }, + { 0x1e61, 0x1e9b } +}; + +// --------------------------------------------------------------------------- +// RangeToken: Getter methods +// --------------------------------------------------------------------------- +RangeToken* RangeToken::getCaseInsensitiveToken(TokenFactory* const tokFactory) { + + if (fCaseIToken == 0 && tokFactory && fRanges) { + + bool isNRange = (getTokenType() == T_NRANGE) ? true : false; + RangeToken* lwrToken = tokFactory->createRange(isNRange); + +#if XERCES_USE_TRANSCODER_ICU && ((U_ICU_VERSION_MAJOR_NUM > 2) || (U_ICU_VERSION_MAJOR_NUM == 2 && U_ICU_VERSION_MINOR_NUM >=4)) + UChar* rangeStr=(UChar*)fMemoryManager->allocate(40*fElemCount*sizeof(UChar)); + ArrayJanitor janRange(rangeStr, fMemoryManager); + int c=0; + rangeStr[c++] = chOpenSquare; + for (unsigned int i = 0; i < fElemCount - 1; i += 2) { + XMLCh buffer[10]; + XMLSize_t len, j; + + rangeStr[c++] = chBackSlash; + rangeStr[c++] = chLatin_U; + XMLString::binToText(fRanges[i], buffer, 10, 16, fMemoryManager); + len = XMLString::stringLen(buffer); + for(j=0;j<(8-len);j++) + rangeStr[c++] = chDigit_0; + XMLCh* p=buffer; + while(*p) + rangeStr[c++] = *p++; + if(fRanges[i+1]!=fRanges[i]) + { + rangeStr[c++] = chDash; + rangeStr[c++] = chBackSlash; + rangeStr[c++] = chLatin_U; + XMLString::binToText(fRanges[i+1], buffer, 10, 16, fMemoryManager); + len = XMLString::stringLen(buffer); + for(j=0;j<(8-len);j++) + rangeStr[c++] = chDigit_0; + p=buffer; + while(*p) + rangeStr[c++] = *p++; + } + } + rangeStr[c++] = chCloseSquare; + rangeStr[c++] = chNull; + UErrorCode ec=U_ZERO_ERROR; + USet* range=uset_openPatternOptions(rangeStr, -1, USET_CASE_INSENSITIVE, &ec); + if(range) + { + ec = U_ZERO_ERROR; + uint32_t cbCount=uset_serialize(range, NULL, 0, &ec); + uint16_t* buffer=(uint16_t*)fMemoryManager->allocate(cbCount*sizeof(uint16_t)); + ArrayJanitor janSet(buffer, fMemoryManager); + ec = U_ZERO_ERROR; + uset_serialize(range, buffer, cbCount, &ec); + USerializedSet serializedSet; + uset_getSerializedSet(&serializedSet, buffer, cbCount); + int32_t nSets=uset_getSerializedRangeCount(&serializedSet); + for(int32_t i=0; iaddRange(start, end); + } + // does this release the memory allocated by the set? + uset_setSerializedToOne(&serializedSet, 32); + uset_close(range); + } +#else + unsigned int exceptIndex = 0; + + for (unsigned int i = 0; i < fElemCount - 1; i += 2) { + for (XMLInt32 ch = fRanges[i]; ch <= fRanges[i + 1]; ++ch) { +#if XERCES_USE_TRANSCODER_ICU + const XMLInt32 upperCh = u_toupper(ch); + + if (upperCh != ch) + { + lwrToken->addRange(upperCh, upperCh); + } + + const XMLInt32 lowerCh = u_tolower(ch); + + if (lowerCh != ch) + { + lwrToken->addRange(lowerCh, lowerCh); + } + + const XMLInt32 titleCh = u_totitle(ch); + + if (titleCh != ch && titleCh != upperCh) + { + lwrToken->addRange(titleCh, titleCh); + } +#else + if (ch >= chLatin_A && ch <= chLatin_Z) + { + ch += chLatin_a - chLatin_A; + + lwrToken->addRange(ch, ch); + } + else if (ch >= chLatin_a && ch <= chLatin_z) + { + ch -= chLatin_a - chLatin_A; + + lwrToken->addRange(ch, ch); + } +#endif + + const unsigned int exceptionsSize = + sizeof(s_exceptions) / sizeof(s_exceptions[0]); + + // Add any exception chars. These are characters where the the + // case mapping is not symmetric. (Unicode case mappings are not isomorphic...) + while (exceptIndex < exceptionsSize) + { + if (s_exceptions[exceptIndex].baseChar < ch) + { + ++exceptIndex; + } + else if (s_exceptions[exceptIndex].baseChar == ch) + { + const XMLInt32 matchingChar = + s_exceptions[exceptIndex].matchingChar; + + lwrToken->addRange( + matchingChar, + matchingChar); + + ++exceptIndex; + } + else + { + break; + } + } + } + } + + lwrToken->mergeRanges(this); +#endif + lwrToken->compactRanges(); + lwrToken->createMap(); + + fCaseIToken = lwrToken; + // TODO(dbertoni) This is a temporary hack until we can change the ABI. + // See Jira issue XERCESC-1866 for more details. + // Overload the fCaseIToken data member to be the case-insensitive token + // that's caching the case-insensitive one. We need this because tokens + // have varying lifetimes. + fCaseIToken->setCaseInsensitiveToken(this); + } + + return fCaseIToken; +} + +// --------------------------------------------------------------------------- +// RangeToken: Setter methods +// --------------------------------------------------------------------------- +void RangeToken::setRangeValues(XMLInt32* const rangeValues, const unsigned int count) +{ + if (fRanges) { + + if (fMap) { + fMemoryManager->deallocate(fMap);//delete [] fMap; + fMap = 0; + } + + fElemCount = 0; + fMemoryManager->deallocate(fRanges);//delete [] fRanges; + fRanges = 0; + } + + fElemCount = fMaxCount = count; + fRanges = rangeValues; +} + +// --------------------------------------------------------------------------- +// RangeToken: Range manipulation methods +// --------------------------------------------------------------------------- +void RangeToken::addRange(const XMLInt32 start, const XMLInt32 end) { + + XMLInt32 val1, val2; + + fCaseIToken = 0; + + if (start <= end) { + + val1 = start; + val2 = end; + } + else { + + val1 = end; + val2 = start; + } + + if (fRanges == 0) { + + fRanges = (XMLInt32*) fMemoryManager->allocate + ( + fMaxCount * sizeof(XMLInt32) + );//new XMLInt32[fMaxCount]; + fRanges[0] = val1; + fRanges[1] = val2; + fElemCount = 2; + fSorted = true; + } + else { + + if (fRanges[fElemCount-1] + 1 == val1) { + + fRanges[fElemCount-1] = val2; + return; + } + + if (fElemCount + 2 >= fMaxCount) { + expand(2); + } + + if(fSorted && fRanges[fElemCount-1] >= val1) + { + for (int i = 0; i < (int)fElemCount; i +=2) + { + // check if this range is already part of this one + if (fRanges[i] <= val1 && fRanges[i+1] >= val2) + break; + // or if the new one extends the old one + else if(fRanges[i]==val1 && fRanges[i+1] < val2) + { + fRanges[i+1]=val2; + break; + } + else if (fRanges[i] > val1 || + (fRanges[i]==val1 && fRanges[i+1] > val2)) + { + for(int j=fElemCount-1;j>=i;j--) + fRanges[j+2]=fRanges[j]; + fRanges[i] = val1; + fRanges[i+1] = val2; + fElemCount += 2; + break; + } + } + } + else + { + if (fRanges[fElemCount-1] >= val1) + fSorted = false; + + fRanges[fElemCount++] = val1; + fRanges[fElemCount++] = val2; + + if (!fSorted) { + sortRanges(); + } + } + } +} + +void RangeToken::sortRanges() { + + if (fSorted || fRanges == 0) + return; + + for (int i = fElemCount - 4; i >= 0; i -= 2) { + + for (int j = 0; j <= i; j +=2) { + + if (fRanges[j] > fRanges[j + 2] + || (fRanges[j]==fRanges[j+2] && fRanges[j+1] > fRanges[j+3])) { + + XMLInt32 tmpVal = fRanges[j+2]; + fRanges[j+2] = fRanges[j]; + fRanges[j] = tmpVal; + tmpVal = fRanges[j+3]; + fRanges[j+3] = fRanges[j+1]; + fRanges[j+1] = tmpVal; + } + } + } + + fSorted = true; +} + +void RangeToken::compactRanges() { + + if (fCompacted || fRanges == 0 || fElemCount <= 2) + return; + + unsigned int base = 0; + unsigned int target = 0; + + while (target < fElemCount) { + + if (base != target) { + + fRanges[base] = fRanges[target++]; + fRanges[base+1] = fRanges[target++]; + } + else + target += 2; + + XMLInt32 baseEnd = fRanges[base + 1]; + + while (target < fElemCount) { + + XMLInt32 startRange = fRanges[target]; + + if (baseEnd + 1 < startRange) + break; + + XMLInt32 endRange = fRanges[target + 1]; + + if (baseEnd + 1 == startRange || baseEnd < endRange) { + + baseEnd = endRange; + fRanges[base+1] = baseEnd; + target += 2; + } + else if (baseEnd >= endRange) { + target += 2; + } + else { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_CompactRangesError, fMemoryManager); + } + } // inner while + + base += 2; + } + + fElemCount = base; + fCompacted = true; +} + +void RangeToken::mergeRanges(const Token *const tok) { + + + if (tok->getTokenType() != this->getTokenType()) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Regex_MergeRangesTypeMismatch, fMemoryManager); + + RangeToken* rangeTok = (RangeToken *) tok; + + if (rangeTok->fRanges == 0) + return; + + fCaseIToken = 0; + sortRanges(); + rangeTok->sortRanges(); + + if (fRanges == 0) { + + fMaxCount = rangeTok->fMaxCount; + fRanges = (XMLInt32*) fMemoryManager->allocate + ( + fMaxCount * sizeof(XMLInt32) + );//new XMLInt32[fMaxCount]; + for (unsigned int index = 0; index < rangeTok->fElemCount; index++) { + fRanges[index] = rangeTok->fRanges[index]; + } + + fElemCount = rangeTok->fElemCount; + fSorted = true; + return; + } + + unsigned int newMaxCount = (fElemCount + rangeTok->fElemCount >= fMaxCount) + ? fMaxCount + rangeTok->fMaxCount : fMaxCount; + XMLInt32* result = (XMLInt32*) fMemoryManager->allocate + ( + newMaxCount * sizeof(XMLInt32) + );//new XMLInt32[newMaxCount]; + + for (unsigned int i=0, j=0, k=0; i < fElemCount || j < rangeTok->fElemCount;) { + + if (i >= fElemCount) { + + for (int count = 0; count < 2; count++) { + result[k++] = rangeTok->fRanges[j++]; + } + } + else if (j >= rangeTok->fElemCount) { + + for (int count = 0; count < 2; count++) { + result[k++] = fRanges[i++]; + } + } + else if (rangeTok->fRanges[j] < fRanges[i] + || (rangeTok->fRanges[j] == fRanges[i] + && rangeTok->fRanges[j+1] < fRanges[i+1])) { + + for (int count = 0; count < 2; count++) { + result[k++] = rangeTok->fRanges[j++]; + } + } + else { + + for (int count = 0; count < 2; count++) { + + result[k++] = fRanges[i++]; + } + } + } + + fMemoryManager->deallocate(fRanges);//delete [] fRanges; + fElemCount += rangeTok->fElemCount; + fRanges = result; + fMaxCount = newMaxCount; +} + +void RangeToken::subtractRanges(RangeToken* const tok) { + + if (fRanges == 0 || tok->fRanges == 0) + return; + + if (tok->getTokenType() == T_NRANGE) { + + intersectRanges(tok); + return; + } + + fCaseIToken = 0; + sortRanges(); + compactRanges(); + tok->sortRanges(); + tok->compactRanges(); + + unsigned int newMax = (fElemCount + tok->fElemCount >= fMaxCount) + ? fMaxCount + tok->fMaxCount : fMaxCount; + XMLInt32* result = (XMLInt32*) fMemoryManager->allocate + ( + newMax * sizeof(XMLInt32) + );//new XMLInt32[newMax]; + unsigned int newElemCount = 0; + unsigned int srcCount = 0; + unsigned int subCount = 0; + + while (srcCount < fElemCount && subCount < tok->fElemCount) { + + XMLInt32 srcBegin = fRanges[srcCount]; + XMLInt32 srcEnd = fRanges[srcCount + 1]; + XMLInt32 subBegin = tok->fRanges[subCount]; + XMLInt32 subEnd = tok->fRanges[subCount + 1]; + + if (srcEnd < subBegin) { // no overlap + + result[newElemCount++] = fRanges[srcCount++]; + result[newElemCount++] = fRanges[srcCount++]; + } + else if (srcEnd >= subBegin && srcBegin <= subEnd) { + + if (subBegin <= srcBegin && srcEnd <= subEnd) { + srcCount += 2; + } + else if (subBegin <= srcBegin) { + + fRanges[srcCount] = subEnd + 1; + subCount += 2; + } + else if (srcEnd <= subEnd) { + + result[newElemCount++] = srcBegin; + result[newElemCount++] = subBegin - 1; + srcCount += 2; + } + else { + + result[newElemCount++] = srcBegin; + result[newElemCount++] = subBegin - 1; + fRanges[srcCount] = subEnd + 1; + subCount += 2; + } + } + else if (subEnd < srcBegin) { + subCount += 2; + } + else { + fMemoryManager->deallocate(result);//delete [] result; + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_SubtractRangesError, fMemoryManager); + } + } //end while + + while (srcCount < fElemCount) { + + result[newElemCount++] = fRanges[srcCount++]; + result[newElemCount++] = fRanges[srcCount++]; + } + + fMemoryManager->deallocate(fRanges);//delete [] fRanges; + fRanges = result; + fElemCount = newElemCount; + fMaxCount = newMax; +} + +/** + * Ignore whether 'tok' is NRANGE or not. + */ +void RangeToken::intersectRanges(RangeToken* const tok) { + + if (fRanges == 0 || tok->fRanges == 0) + return; + + fCaseIToken = 0; + sortRanges(); + compactRanges(); + tok->sortRanges(); + tok->compactRanges(); + + unsigned int newMax = (fElemCount + tok->fElemCount >= fMaxCount) + ? fMaxCount + tok->fMaxCount : fMaxCount; + XMLInt32* result = (XMLInt32*) fMemoryManager->allocate + ( + newMax * sizeof(XMLInt32) + );//new XMLInt32[newMax]; + unsigned int newElemCount = 0; + unsigned int srcCount = 0; + unsigned int tokCount = 0; + + while (srcCount < fElemCount && tokCount < tok->fElemCount) { + + XMLInt32 srcBegin = fRanges[srcCount]; + XMLInt32 srcEnd = fRanges[srcCount + 1]; + XMLInt32 tokBegin = tok->fRanges[tokCount]; + XMLInt32 tokEnd = tok->fRanges[tokCount + 1]; + + if (srcEnd < tokBegin) { + srcCount += 2; + } + else if (srcEnd >= tokBegin && srcBegin <= tokEnd) { + + if (tokBegin <= srcBegin && srcEnd <= tokEnd) { + + result[newElemCount++] = srcBegin; + result[newElemCount++] = srcEnd; + srcCount += 2; + } + else if (tokBegin <= srcBegin) { + + result[newElemCount++] = srcBegin; + result[newElemCount++] = tokEnd; + tokCount += 2; + + if (tokCount < tok->fElemCount) + fRanges[srcCount] = tokEnd + 1; + else + srcCount += 2; + } + else if (srcEnd <= tokEnd) { + + result[newElemCount++] = tokBegin; + result[newElemCount++] = srcEnd; + srcCount += 2; + } + else { + + result[newElemCount++] = tokBegin; + result[newElemCount++] = tokEnd; + tokCount += 2; + + if (tokCount < tok->fElemCount) + fRanges[srcCount] = tokEnd + 1; + else + srcCount += 2; + } + } + else if (tokEnd < srcBegin) { + tokCount += 2; + + if (tokCount >= tok->fElemCount) + srcCount += 2; + } + else { + + fMemoryManager->deallocate(result);//delete [] result; + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_IntersectRangesError, fMemoryManager); + } + } //end while + + fMemoryManager->deallocate(fRanges);//delete [] fRanges; + fRanges = result; + fElemCount = newElemCount; + fMaxCount = newMax; +} + +/** + * for RANGE: Creates complement. + * for NRANGE: Creates the same meaning RANGE. + */ +RangeToken* RangeToken::complementRanges(RangeToken* const tok, + TokenFactory* const tokFactory, + MemoryManager* const manager) { + + if (tok->getTokenType() != T_RANGE && tok->getTokenType() != T_NRANGE) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Regex_ComplementRangesInvalidArg, manager); + + tok->sortRanges(); + tok->compactRanges(); + + XMLInt32 lastElem = tok->fRanges[tok->fElemCount - 1]; + RangeToken* rangeTok = tokFactory->createRange(); + + if (tok->fRanges[0] > 0) { + rangeTok->addRange(0, tok->fRanges[0] - 1); + } + + for (unsigned int i= 1; i< tok->fElemCount - 2; i += 2) { + rangeTok->addRange(tok->fRanges[i] + 1, tok->fRanges[i+1] - 1); + } + + if (lastElem != UTF16_MAX) { + rangeTok->addRange(lastElem + 1, UTF16_MAX); + } + + rangeTok->fCompacted = true; + + return rangeTok; +} + + +// --------------------------------------------------------------------------- +// RangeToken: Match methods +// --------------------------------------------------------------------------- +bool RangeToken::match(const XMLInt32 ch) { + + createMap(); + + bool ret; + + if (getTokenType() == T_RANGE) { + + if (ch < MAPSIZE) + return ((fMap[ch/32] & (1<<(ch&0x1f))) != 0); + + ret = false; + + for (unsigned int i= fNonMapIndex; i< fElemCount; i +=2) { + + if (fRanges[i] <= ch && ch <= fRanges[i+1]) + return true; + } + } + else { + + if (ch < MAPSIZE) + return ((fMap[ch/32] & (1<<(ch&0x1f))) == 0); + + ret = true; + + for (unsigned int i= fNonMapIndex; i< fElemCount; i += 2) { + + if (fRanges[i] <= ch && ch <= fRanges[i+1]) + return false; + } + } + + return ret; +} + +// --------------------------------------------------------------------------- +// RangeToken: Private helpers methods +// --------------------------------------------------------------------------- +void RangeToken::expand(const unsigned int length) { + + unsigned int newMax = fElemCount + length; + + // Avoid too many reallocations by expanding by a percentage + unsigned int minNewMax = (unsigned int)((double)fElemCount * 1.25); + if (newMax < minNewMax) + newMax = minNewMax; + + XMLInt32* newList = (XMLInt32*) fMemoryManager->allocate + ( + newMax * sizeof(XMLInt32) + );//new XMLInt32[newMax]; + for (unsigned int index = 0; index < fElemCount; index++) + newList[index] = fRanges[index]; + + fMemoryManager->deallocate(fRanges);//delete [] fRanges; + fRanges = newList; + fMaxCount = newMax; +} + +void RangeToken::doCreateMap() { + + assert(!fMap); + + int asize = MAPSIZE/32; + fMap = (int*) fMemoryManager->allocate(asize * sizeof(int));//new int[asize]; + fNonMapIndex = fElemCount; + + for (int i = 0; i < asize; i++) { + fMap[i] = 0; + } + + for (unsigned int j= 0; j < fElemCount; j += 2) { + + XMLInt32 begin = fRanges[j]; + XMLInt32 end = fRanges[j+1]; + + if (begin < MAPSIZE) { + + for (int k = begin; k <= end && k < MAPSIZE; k++) { + fMap[k/32] |= 1<<(k&0x1F); + } + } + else { + + fNonMapIndex = j; + break; + } + + if (end >= MAPSIZE) { + + fNonMapIndex = j; + break; + } + } +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file RangeToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeToken.hpp b/project/jni/xerces/src/xercesc/util/regx/RangeToken.hpp new file mode 100644 index 000000000..54e208e8d --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeToken.hpp @@ -0,0 +1,146 @@ +/* + * 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: RangeToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_RANGETOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_RANGETOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class TokenFactory; + + +class XMLUTIL_EXPORT RangeToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + RangeToken(const tokType tkType, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~RangeToken(); + + // ----------------------------------------------------------------------- + // Public Constants + // ----------------------------------------------------------------------- + static const int MAPSIZE; + static const unsigned int INITIALSIZE; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + RangeToken* getCaseInsensitiveToken(TokenFactory* const tokFactory); + + void setCaseInsensitiveToken(RangeToken* tok); + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setRangeValues(XMLInt32* const rangeValues, const unsigned int count); + + // ----------------------------------------------------------------------- + // Range manipulation methods + // ----------------------------------------------------------------------- + void addRange(const XMLInt32 start, const XMLInt32 end); + void mergeRanges(const Token *const tok); + void sortRanges(); + void compactRanges(); + void subtractRanges(RangeToken* const tok); + void intersectRanges(RangeToken* const tok); + static RangeToken* complementRanges(RangeToken* const tok, + TokenFactory* const tokFactory, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + bool empty() const; + + // ----------------------------------------------------------------------- + // Match methods + // ----------------------------------------------------------------------- + bool match(const XMLInt32 ch); + + // ----------------------------------------------------------------------- + // Creates the map. This will happen automatically, + // necessary. + // ----------------------------------------------------------------------- + void createMap(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RangeToken(const RangeToken&); + RangeToken& operator=(const RangeToken&); + + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + void expand(const unsigned int length); + + void doCreateMap(); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fSorted; + bool fCompacted; + int fNonMapIndex; + unsigned int fElemCount; + unsigned int fMaxCount; + int* fMap; + XMLInt32* fRanges; + RangeToken* fCaseIToken; + MemoryManager* fMemoryManager; +}; + + +inline void RangeToken::setCaseInsensitiveToken(RangeToken* tok) +{ + fCaseIToken = tok; +} + +inline void RangeToken::createMap() +{ + if (!fMap) + { + doCreateMap(); + } +} + +inline bool RangeToken::empty() const +{ + return fElemCount==0; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file RangeToken.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.cpp b/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.cpp new file mode 100644 index 000000000..bef33cea6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.cpp @@ -0,0 +1,289 @@ +/* + * 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: RangeTokenMap.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +RangeTokenMap* RangeTokenMap::fInstance = 0; + +void XMLInitializer::initializeRangeTokenMap() +{ + RangeTokenMap::fInstance = new RangeTokenMap( + XMLPlatformUtils::fgMemoryManager); + + if (RangeTokenMap::fInstance) + RangeTokenMap::fInstance->buildTokenRanges(); +} + +void XMLInitializer::terminateRangeTokenMap() +{ + delete RangeTokenMap::fInstance; + RangeTokenMap::fInstance = 0; +} + + +// --------------------------------------------------------------------------- +// RangeTokenElemMap: Constructors and Destructor +// --------------------------------------------------------------------------- +RangeTokenElemMap::RangeTokenElemMap(unsigned int categoryId) : + fCategoryId(categoryId) + , fRange(0) + , fNRange(0) +{ + +} + +RangeTokenElemMap::~RangeTokenElemMap() +{ + +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: Constructors and Destructor +// --------------------------------------------------------------------------- + +typedef JanitorMemFunCall CleanupType; + +RangeTokenMap::RangeTokenMap(MemoryManager* manager) : + fTokenRegistry(0) + , fRangeMap(0) + , fCategories(0) + , fTokenFactory(0) + , fMutex(manager) +{ + CleanupType cleanup(this, &RangeTokenMap::cleanUp); + + try { + fTokenRegistry = new (manager) RefHashTableOf(109, manager); + fRangeMap = new (manager) RefHashTableOf(29, manager); + fCategories = new (manager) XMLStringPool(109, manager); + fTokenFactory = new (manager) TokenFactory(manager); + initializeRegistry(); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +RangeTokenMap::~RangeTokenMap() { + + cleanUp(); +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: Getter methods +// --------------------------------------------------------------------------- +RangeToken* RangeTokenMap::getRange(const XMLCh* const keyword, + const bool complement) { + + if (!fTokenRegistry->containsKey(keyword)) + return 0; + + RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword); + RangeToken* rangeTok = elemMap->getRangeToken(complement); + + if (!rangeTok) + { + XMLMutexLock lockInit(&fMutex); + + // make sure that it was not created while we were locked + rangeTok = elemMap->getRangeToken(complement); + + if (!rangeTok) + { + unsigned int categId = elemMap->getCategoryId(); + const XMLCh* categName = fCategories->getValueForId(categId); + RangeFactory* rangeFactory = fRangeMap->get(categName); + + if (rangeFactory) + { + rangeFactory->buildRanges(this); + rangeTok = elemMap->getRangeToken(complement); + + // see if we are complementing an existing range + if (!rangeTok && complement) + { + rangeTok = elemMap->getRangeToken(); + if (rangeTok) + { + rangeTok = RangeToken::complementRanges(rangeTok, fTokenFactory, fTokenRegistry->getMemoryManager()); + elemMap->setRangeToken(rangeTok , complement); + } + } + } + } + } + + return rangeTok; +} + + +// --------------------------------------------------------------------------- +// RangeTokenMap: Putter methods +// --------------------------------------------------------------------------- +void RangeTokenMap::addCategory(const XMLCh* const categoryName) { + + fCategories->addOrFind(categoryName); +} + +void RangeTokenMap::addRangeMap(const XMLCh* const categoryName, + RangeFactory* const rangeFactory) { + + fRangeMap->put((void*)categoryName, rangeFactory); +} + +void RangeTokenMap::addKeywordMap(const XMLCh* const keyword, + const XMLCh* const categoryName) { + + unsigned int categId = fCategories->getId(categoryName); + + if (categId == 0) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_InvalidCategoryName, categoryName, fTokenRegistry->getMemoryManager()); + } + + if (fTokenRegistry->containsKey(keyword)) { + + RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword); + + if (elemMap->getCategoryId() != categId) + elemMap->setCategoryId(categId); + + return; + } + + fTokenRegistry->put((void*) keyword, new RangeTokenElemMap(categId)); +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: Setter methods +// --------------------------------------------------------------------------- +void RangeTokenMap::setRangeToken(const XMLCh* const keyword, + RangeToken* const tok,const bool complement) { + + if (fTokenRegistry->containsKey(keyword)) { + fTokenRegistry->get(keyword)->setRangeToken(tok, complement); + } + else { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_KeywordNotFound, keyword, fTokenRegistry->getMemoryManager()); + } +} + + +// --------------------------------------------------------------------------- +// RangeTokenMap: Initialization methods +// --------------------------------------------------------------------------- +void RangeTokenMap::initializeRegistry() { + + // Add categories + fCategories->addOrFind(fgXMLCategory); + fCategories->addOrFind(fgASCIICategory); + fCategories->addOrFind(fgUnicodeCategory); + fCategories->addOrFind(fgBlockCategory); + + // Add xml range factory + RangeFactory* rangeFact = new XMLRangeFactory(); + fRangeMap->put((void*)fgXMLCategory, rangeFact); + rangeFact->initializeKeywordMap(this); + + // Add ascii range factory + rangeFact = new ASCIIRangeFactory(); + fRangeMap->put((void*)fgASCIICategory, rangeFact); + rangeFact->initializeKeywordMap(this); + + // Add unicode range factory + rangeFact = new UnicodeRangeFactory(); + fRangeMap->put((void*)fgUnicodeCategory, rangeFact); + rangeFact->initializeKeywordMap(this); + + // Add block range factory + rangeFact = new BlockRangeFactory(); + fRangeMap->put((void*)fgBlockCategory, rangeFact); + rangeFact->initializeKeywordMap(this); +} + +void RangeTokenMap::buildTokenRanges() +{ + // Build ranges */ + RangeFactory* rangeFactory = fRangeMap->get(fgXMLCategory); + rangeFactory->buildRanges(this); + + rangeFactory = fRangeMap->get(fgASCIICategory); + rangeFactory->buildRanges(this); + + rangeFactory = fRangeMap->get(fgUnicodeCategory); + rangeFactory->buildRanges(this); + + rangeFactory = fRangeMap->get(fgBlockCategory); + rangeFactory->buildRanges(this); +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: Instance methods +// --------------------------------------------------------------------------- +RangeTokenMap* RangeTokenMap::instance() +{ + return fInstance; +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: helper methods +// --------------------------------------------------------------------------- +void RangeTokenMap::cleanUp() +{ + delete fTokenRegistry; + fTokenRegistry = 0; + + delete fRangeMap; + fRangeMap = 0; + + delete fCategories; + fCategories = 0; + + delete fTokenFactory; + fTokenFactory = 0; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file RangeTokenMap.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.hpp b/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.hpp new file mode 100644 index 000000000..4ee542dc5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RangeTokenMap.hpp @@ -0,0 +1,232 @@ +/* + * 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: RangeTokenMap.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_RANGETOKENMAP_HPP) +#define XERCESC_INCLUDE_GUARD_RANGETOKENMAP_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class RangeToken; +class RangeFactory; +class TokenFactory; +class XMLStringPool; + +class XMLUTIL_EXPORT RangeTokenElemMap : public XMemory +{ + +public: + RangeTokenElemMap(unsigned int categoryId); + ~RangeTokenElemMap(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + unsigned int getCategoryId() const; + RangeToken* getRangeToken(const bool complement = false) const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setRangeToken(RangeToken* const tok, const bool complement = false); + void setCategoryId(const unsigned int categId); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RangeTokenElemMap(const RangeTokenElemMap&); + RangeTokenElemMap& operator=(const RangeTokenElemMap&); + + // Data members + unsigned int fCategoryId; + RangeToken* fRange; + RangeToken* fNRange; +}; + + +class XMLUTIL_EXPORT RangeTokenMap : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Putter methods + // ----------------------------------------------------------------------- + void addCategory(const XMLCh* const categoryName); + void addRangeMap(const XMLCh* const categoryName, + RangeFactory* const rangeFactory); + void addKeywordMap(const XMLCh* const keyword, + const XMLCh* const categoryName); + + // ----------------------------------------------------------------------- + // Instance methods + // ----------------------------------------------------------------------- + static RangeTokenMap* instance(); + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setRangeToken(const XMLCh* const keyword, RangeToken* const tok, + const bool complement = false); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + TokenFactory* getTokenFactory() const; + +protected: + // ----------------------------------------------------------------------- + // Constructor and destructors + // ----------------------------------------------------------------------- + RangeTokenMap(MemoryManager* manager); + ~RangeTokenMap(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /* + * Gets a commonly used RangeToken from the token registry based on the + * range name - Called by TokenFactory. + */ + RangeToken* getRange(const XMLCh* const name, + const bool complement = false); + + RefHashTableOf* getTokenRegistry() const; + RefHashTableOf* getRangeMap() const; + XMLStringPool* getCategories() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RangeTokenMap(const RangeTokenMap&); + RangeTokenMap& operator=(const RangeTokenMap&); + + // ----------------------------------------------------------------------- + // Private Helpers methods + // ----------------------------------------------------------------------- + /* + * Initializes the registry with a set of commonly used RangeToken + * objects. + */ + void initializeRegistry(); + void buildTokenRanges(); + void cleanUp(); + friend class TokenFactory; + + // ----------------------------------------------------------------------- + // Private data members + // + // fTokenRegistry + // Contains a set of commonly used tokens + // + // fRangeMap + // Contains a map between a category name and a RangeFactory object. + // + // fCategories + // Contains range categories names + // + // fTokenFactory + // Token factory object + // + // fInstance + // A RangeTokenMap instance + // + // fMutex + // A mutex object for synchronization + // ----------------------------------------------------------------------- + RefHashTableOf* fTokenRegistry; + RefHashTableOf* fRangeMap; + XMLStringPool* fCategories; + TokenFactory* fTokenFactory; + XMLMutex fMutex; + static RangeTokenMap* fInstance; + + friend class XMLInitializer; +}; + +// --------------------------------------------------------------------------- +// RangeTokenElemMap: Getter methods +// --------------------------------------------------------------------------- +inline unsigned int RangeTokenElemMap::getCategoryId() const { + + return fCategoryId; +} + +inline RangeToken* RangeTokenElemMap::getRangeToken(const bool complement) const { + + return complement ? fNRange : fRange; +} + +// --------------------------------------------------------------------------- +// RangeTokenElemMap: Setter methods +// --------------------------------------------------------------------------- +inline void RangeTokenElemMap::setCategoryId(const unsigned int categId) { + + fCategoryId = categId; +} + +inline void RangeTokenElemMap::setRangeToken(RangeToken* const tok, + const bool complement) { + + if (complement) + fNRange = tok; + else + fRange = tok; +} + +// --------------------------------------------------------------------------- +// RangeTokenMap: Getter methods +// --------------------------------------------------------------------------- +inline RefHashTableOf* RangeTokenMap::getTokenRegistry() const { + + return fTokenRegistry; +} + +inline RefHashTableOf* RangeTokenMap::getRangeMap() const { + + return fRangeMap; +} + +inline XMLStringPool* RangeTokenMap::getCategories() const { + + return fCategories; +} + +inline TokenFactory* RangeTokenMap::getTokenFactory() const { + + return fTokenFactory; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file RangeToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RegularExpression.cpp b/project/jni/xerces/src/xercesc/util/regx/RegularExpression.cpp new file mode 100644 index 000000000..a27b3ee99 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegularExpression.cpp @@ -0,0 +1,1645 @@ +/* + * 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: RegularExpression.cpp 822158 2009-10-06 07:52:59Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Static member data initialization +// --------------------------------------------------------------------------- +const unsigned int RegularExpression::IGNORE_CASE = 2; +const unsigned int RegularExpression::SINGLE_LINE = 4; +const unsigned int RegularExpression::MULTIPLE_LINE = 8; +const unsigned int RegularExpression::EXTENDED_COMMENT = 16; +const unsigned int RegularExpression::PROHIBIT_HEAD_CHARACTER_OPTIMIZATION = 128; +const unsigned int RegularExpression::PROHIBIT_FIXED_STRING_OPTIMIZATION = 256; +const unsigned int RegularExpression::XMLSCHEMA_MODE = 512; +RangeToken* RegularExpression::fWordRange = 0; + +bool RegularExpression::matchIgnoreCase(const XMLInt32 ch1, + const XMLInt32 ch2) const +{ + if (ch1 >= 0x10000) + { + XMLCh string1[2]; + XMLCh string2[2]; + + RegxUtil::decomposeToSurrogates(ch1, string1[0], string1[1]); + + if (ch2 >= 0x10000) + { + RegxUtil::decomposeToSurrogates(ch2, string2[0], string2[1]); + } + else + { + // XMLString::compareNIString is broken, because it assume the + // two strings must be of the same length. Note that two strings + // of different length could compare as equal, because there is no + // guarantee that a Unicode code point that is encoded in UTF-16 as + // a surrogate pair does not have a case mapping to a code point + // that is not in the surrogate range. Just to be safe, we pad the + // shorter string with a space, which cannot hvae a case mapping. + string2[0] = (XMLCh)ch2; + string2[1] = chSpace; + } + + return (0==XMLString::compareNIString(string1, string2, 2)); + } + else if (ch2 >= 0x10000) + { + const XMLCh string1[2] = { (XMLCh)ch1, chSpace }; + XMLCh string2[2]; + + RegxUtil::decomposeToSurrogates(ch2, string2[0], string2[1]); + + return (0==XMLString::compareNIString(string1, string2, 2)); + } + else + { + const XMLCh char1 = (XMLCh)ch1; + const XMLCh char2 = (XMLCh)ch2; + + return (0==XMLString::compareNIString(&char1, &char2, 1)); + } +} + + + +// --------------------------------------------------------------------------- +// RegularExpression::Context: Constructors and Destructor +// --------------------------------------------------------------------------- +RegularExpression::Context::Context(MemoryManager* const manager) : + fAdoptMatch(false) + , fStart(0) + , fLimit(0) + , fLength(0) + , fSize(0) + , fStringMaxLen(0) + , fOffsets(0) + , fMatch(0) + , fString(0) + , fOptions(0) + , fMemoryManager(manager) +{ +} + +RegularExpression::Context::Context(Context* src) : + fAdoptMatch(false) + , fStart(src->fStart) + , fLimit(src->fLimit) + , fLength(src->fLength) + , fSize(src->fSize) + , fStringMaxLen(src->fStringMaxLen) + , fOffsets(0) + , fMatch(0) + , fString(src->fString) + , fOptions(src->fOptions) + , fMemoryManager(src->fMemoryManager) +{ + if(src->fOffsets) + { + fOffsets = (int*) fMemoryManager->allocate(fSize* sizeof(int)); + for (int i = 0; i< fSize; i++) + fOffsets[i] = src->fOffsets[i]; + } + if(src->fMatch) + { + fMatch=new (fMemoryManager) Match(*src->fMatch); + fAdoptMatch=true; + } +} + +RegularExpression::Context& RegularExpression::Context::operator=(const RegularExpression::Context& other) +{ + if (this != &other) + { + fStart=other.fStart; + fLimit=other.fLimit; + fLength=other.fLength; + fStringMaxLen=other.fStringMaxLen; + fString=other.fString; + fOptions=other.fOptions; + + // if offset and match are already allocated with the right size, reuse them + // (fMatch can be provided by the user to get the data back) + if(fMatch && other.fMatch && fMatch->getNoGroups()==other.fMatch->getNoGroups()) + *fMatch=*other.fMatch; + else + { + if (fAdoptMatch) + delete fMatch; + fMatch=0; + if(other.fMatch) + { + fMatch=new (other.fMemoryManager) Match(*other.fMatch); + fAdoptMatch=true; + } + } + + if (fOffsets && other.fOffsets && fSize==other.fSize) + { + for (int i = 0; i< fSize; i++) + fOffsets[i] = other.fOffsets[i]; + } + else + { + if(fOffsets) + fMemoryManager->deallocate(fOffsets);//delete [] fOffsets; + fOffsets=0; + fSize=other.fSize; + if(other.fOffsets) + { + fOffsets = (int*) other.fMemoryManager->allocate(fSize* sizeof(int)); + for (int i = 0; i< fSize; i++) + fOffsets[i] = other.fOffsets[i]; + } + } + + fMemoryManager=other.fMemoryManager; + } + + return *this; +} + +RegularExpression::Context::~Context() +{ + if (fOffsets) + fMemoryManager->deallocate(fOffsets);//delete [] fOffsets; + + if (fAdoptMatch) + delete fMatch; +} + +// --------------------------------------------------------------------------- +// RegularExpression::Context: Public methods +// --------------------------------------------------------------------------- +void RegularExpression::Context::reset(const XMLCh* const string + , const XMLSize_t stringLen + , const XMLSize_t start + , const XMLSize_t limit + , const int noClosures + , const unsigned int options) +{ + fString = string; + fStringMaxLen = stringLen; + fStart = start; + fLimit = limit; + fLength = fLimit - fStart; + if (fAdoptMatch) + delete fMatch; + fMatch = 0; + + if (fSize != noClosures) { + if (fOffsets) + fMemoryManager->deallocate(fOffsets);//delete [] fOffsets; + fOffsets = (int*) fMemoryManager->allocate(noClosures * sizeof(int));//new int[noClosures]; + } + + fSize = noClosures; + fOptions = options; + + for (int i = 0; i< fSize; i++) + fOffsets[i] = -1; +} + +bool RegularExpression::Context::nextCh(XMLInt32& ch, XMLSize_t& offset) +{ + ch = fString[offset]; + + if (RegxUtil::isHighSurrogate(ch)) { + if ((offset + 1 < fLimit) && RegxUtil::isLowSurrogate(fString[offset+1])) { + ch = RegxUtil::composeFromSurrogate(ch, fString[++offset]); + } + else return false; + } + else if (RegxUtil::isLowSurrogate(ch)) { + return false; + } + + return true; +} + +// --------------------------------------------------------------------------- +// RegularExpression: Constructors and Destructors +// --------------------------------------------------------------------------- + +typedef JanitorMemFunCall CleanupType; + +RegularExpression::RegularExpression(const char* const pattern, + MemoryManager* const manager) + :fHasBackReferences(false), + fFixedStringOnly(false), + fNoGroups(0), + fMinLength(0), + fNoClosures(0), + fOptions(0), + fBMPattern(0), + fPattern(0), + fFixedString(0), + fOperations(0), + fTokenTree(0), + fFirstChar(0), + fOpFactory(manager), + fTokenFactory(0), + fMemoryManager(manager) +{ + CleanupType cleanup(this, &RegularExpression::cleanUp); + + try { + + XMLCh* tmpBuf = XMLString::transcode(pattern, fMemoryManager); + ArrayJanitor janBuf(tmpBuf, fMemoryManager); + setPattern(tmpBuf); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +RegularExpression::RegularExpression(const char* const pattern, + const char* const options, + MemoryManager* const manager) + :fHasBackReferences(false), + fFixedStringOnly(false), + fNoGroups(0), + fMinLength(0), + fNoClosures(0), + fOptions(0), + fBMPattern(0), + fPattern(0), + fFixedString(0), + fOperations(0), + fTokenTree(0), + fFirstChar(0), + fOpFactory(manager), + fTokenFactory(0), + fMemoryManager(manager) +{ + CleanupType cleanup(this, &RegularExpression::cleanUp); + + try { + + XMLCh* tmpBuf = XMLString::transcode(pattern, fMemoryManager); + ArrayJanitor janBuf(tmpBuf, fMemoryManager); + XMLCh* tmpOptions = XMLString::transcode(options, fMemoryManager); + ArrayJanitor janOps(tmpOptions, fMemoryManager); + setPattern(tmpBuf, tmpOptions); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +RegularExpression::RegularExpression(const XMLCh* const pattern, + MemoryManager* const manager) + :fHasBackReferences(false), + fFixedStringOnly(false), + fNoGroups(0), + fMinLength(0), + fNoClosures(0), + fOptions(0), + fBMPattern(0), + fPattern(0), + fFixedString(0), + fOperations(0), + fTokenTree(0), + fFirstChar(0), + fOpFactory(manager), + fTokenFactory(0), + fMemoryManager(manager) +{ + CleanupType cleanup(this, &RegularExpression::cleanUp); + + try { + + setPattern(pattern); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +RegularExpression::RegularExpression(const XMLCh* const pattern, + const XMLCh* const options, + MemoryManager* const manager) + :fHasBackReferences(false), + fFixedStringOnly(false), + fNoGroups(0), + fMinLength(0), + fNoClosures(0), + fOptions(0), + fBMPattern(0), + fPattern(0), + fFixedString(0), + fOperations(0), + fTokenTree(0), + fFirstChar(0), + fOpFactory(manager), + fTokenFactory(0), + fMemoryManager(manager) +{ + CleanupType cleanup(this, &RegularExpression::cleanUp); + + try { + + setPattern(pattern, options); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +RegularExpression::~RegularExpression() { + + cleanUp(); +} + +// --------------------------------------------------------------------------- +// RegularExpression: Setter methods +// --------------------------------------------------------------------------- + +RegxParser* RegularExpression::getRegexParser(const int options, MemoryManager* const manager) +{ + // the following construct causes an error in an Intel 7.1 32 bit compiler for + // red hat linux 7.2 + // (when an exception is thrown the wrong object is deleted) + //RegxParser* regxParser = isSet(fOptions, XMLSCHEMA_MODE) + // ? new (fMemoryManager) ParserForXMLSchema(fMemoryManager) + // : new (fMemoryManager) RegxParser(fMemoryManager); + if (isSet(options, XMLSCHEMA_MODE)) + return new (manager) ParserForXMLSchema(manager); + + return new (manager) RegxParser(manager); +} + +void RegularExpression::setPattern(const XMLCh* const pattern, + const XMLCh* const options) +{ + + fTokenFactory = new (fMemoryManager) TokenFactory(fMemoryManager); + fOptions = parseOptions(options); + fPattern = XMLString::replicate(pattern, fMemoryManager); + + RegxParser* regxParser=getRegexParser(fOptions, fMemoryManager); + + if (regxParser) + regxParser->setTokenFactory(fTokenFactory); + + Janitor janRegxParser(regxParser); + fTokenTree = regxParser->parse(fPattern, fOptions); + fNoGroups = regxParser->getNoParen(); + fHasBackReferences = regxParser->hasBackReferences(); + + prepare(); +} + +// --------------------------------------------------------------------------- +// RegularExpression: Matching methods +// --------------------------------------------------------------------------- +bool RegularExpression::matches(const char* const expression + , MemoryManager* const manager) const +{ + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return matches(tmpBuf, 0, XMLString::stringLen(tmpBuf), 0, manager); +} + +bool RegularExpression::matches(const char* const expression + , const XMLSize_t start, const XMLSize_t end + , MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return matches(tmpBuf, start, end, 0, manager); +} + +bool RegularExpression::matches(const char* const expression + , Match* const match + , MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return matches(tmpBuf, 0, XMLString::stringLen(tmpBuf), match, manager); +} + +bool RegularExpression::matches(const char* const expression, const XMLSize_t start + , const XMLSize_t end, Match* const pMatch + , MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return matches(tmpBuf, start, end, pMatch, manager); +} + + +// --------------------------------------------------------------------------- +// RegularExpression: Matching methods - Wide char version +// --------------------------------------------------------------------------- +bool RegularExpression::matches(const XMLCh* const expression, MemoryManager* const manager) const +{ + return matches(expression, 0, XMLString::stringLen(expression), 0, manager); +} + +bool RegularExpression::matches(const XMLCh* const expression + , const XMLSize_t start, const XMLSize_t end + , MemoryManager* const manager) const +{ + return matches(expression, start, end, 0, manager); +} + +bool RegularExpression::matches(const XMLCh* const expression + , Match* const match + , MemoryManager* const manager) const +{ + return matches(expression, 0, XMLString::stringLen(expression), match, manager); +} + +bool RegularExpression::matches(const XMLCh* const expression, const XMLSize_t start + , const XMLSize_t end, Match* const pMatch + , MemoryManager* const manager) const +{ + + Context context(manager); + XMLSize_t strLength = XMLString::stringLen(expression); + + context.reset(expression, strLength, start, end, fNoClosures, fOptions); + + bool adoptMatch = false; + Match* lMatch = pMatch; + + if (lMatch != 0) { + lMatch->setNoGroups(fNoGroups); + } + else if (fHasBackReferences) { + lMatch = new (manager) Match(manager); + lMatch->setNoGroups(fNoGroups); + adoptMatch = true; + } + + if (context.fAdoptMatch) + delete context.fMatch; + context.fMatch = lMatch; + context.fAdoptMatch = adoptMatch; + + if (isSet(fOptions, XMLSCHEMA_MODE)) { + + int matchEnd = match(&context, fOperations, context.fStart); + + if (matchEnd == (int)context.fLimit) { + + if (context.fMatch != 0) { + + context.fMatch->setStartPos(0, (int)context.fStart); + context.fMatch->setEndPos(0, matchEnd); + } + return true; + } + + return false; + } + + /* + * If the pattern has only fixed string, use Boyer-Moore + */ + if (fFixedStringOnly) { + + int ret = fBMPattern->matches(expression, context.fStart, context.fLimit); + if (ret >= 0) { + + if (context.fMatch != 0) { + context.fMatch->setStartPos(0, ret); + context.fMatch->setEndPos(0, (int)(ret + XMLString::stringLen(fPattern))); + } + return true; + } + return false; + } + + /* + * If the pattern contains a fixed string, we check with Boyer-Moore + * whether the text contains the fixed string or not. If not found + * return false + */ + if (fFixedString != 0) { + + int ret = fBMPattern->matches(expression, context.fStart, context.fLimit); + + if (ret < 0) { // No match + return false; + } + } + + // if the length is less than the minimum length, we cannot possibly match + if(context.fLimitgetOpType() == Op::O_CLOSURE || fOperations->getOpType() == Op::O_FINITE_CLOSURE) + && fOperations->getChild()->getOpType() == Op::O_DOT) { + + if (isSet(fOptions, SINGLE_LINE)) { + matchStart = context.fStart; + matchEnd = match(&context, fOperations, matchStart); + } + else { + bool previousIsEOL = true; + + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { + + XMLCh ch = expression[matchStart]; + if (RegxUtil::isEOLChar(ch)) { + previousIsEOL = true; + } + else { + + if (previousIsEOL) { + if (0 <= (matchEnd = match(&context, fOperations, + matchStart))) + break; + } + + previousIsEOL = false; + } + } + } + } + else { + /* + * Optimization against the first char + */ + if (fFirstChar != 0) { + bool ignoreCase = isSet(fOptions, IGNORE_CASE); + RangeToken* range = fFirstChar; + + if (ignoreCase) + range = fFirstChar->getCaseInsensitiveToken(fTokenFactory); + + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { + + XMLInt32 ch; + + if (!context.nextCh(ch, matchStart)) + break; + + if (!range->match(ch)) + continue; + + if (0 <= (matchEnd = match(&context,fOperations,matchStart))) + break; + } + } + else { + + /* + * Straightforward matching + */ + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { + + if (0 <= (matchEnd = match(&context,fOperations,matchStart))) + break; + } + } + } + + if (matchEnd >= 0) { + + if (context.fMatch != 0) { + + context.fMatch->setStartPos(0, (int)matchStart); + context.fMatch->setEndPos(0, matchEnd); + } + return true; + } + return false; +} + +// --------------------------------------------------------------------------- +// RegularExpression: Tokenize methods +// --------------------------------------------------------------------------- +RefArrayVectorOf* RegularExpression::tokenize(const char* const expression, + MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return tokenize(tmpBuf, 0, XMLString::stringLen(tmpBuf), manager); +} + +RefArrayVectorOf* RegularExpression::tokenize(const char* const expression, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(expression, manager); + ArrayJanitor janBuf(tmpBuf, manager); + return tokenize(tmpBuf, start, end, manager); +} + + + +// --------------------------------------------------------------------------- +// RegularExpression: Tokenize methods - Wide char version +// --------------------------------------------------------------------------- +RefArrayVectorOf* RegularExpression::tokenize(const XMLCh* const expression, + MemoryManager* const manager) const +{ + return tokenize(expression, 0, XMLString::stringLen(expression), manager); +} + +RefArrayVectorOf* RegularExpression::tokenize(const XMLCh* const matchString, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager) const +{ + // check if matches zero length string - throw error if so + if(matches(XMLUni::fgZeroLenString, manager)){ + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_RepPatMatchesZeroString, manager); + } + + RefVectorOf *subEx = new (manager) RefVectorOf(10, true, manager); + Janitor > janSubEx(subEx); + + allMatches(matchString, start, end, subEx, manager); + + RefArrayVectorOf *tokens = new (manager) RefArrayVectorOf(16, true, manager); + XMLSize_t tokStart = start; + + XMLSize_t i = 0; + for(; i < subEx->size(); ++i) { + Match *match = subEx->elementAt(i); + XMLSize_t matchStart = match->getStartPos(0); + + XMLCh *token = (XMLCh*)manager->allocate((matchStart + 1 - tokStart) * sizeof(XMLCh)); + XMLString::subString(token, matchString, tokStart, matchStart, manager); + tokens->addElement(token); + + tokStart = match->getEndPos(0); + } + + XMLCh *token = (XMLCh*)manager->allocate((end + 1 - tokStart) * sizeof(XMLCh)); + XMLString::subString(token, matchString, tokStart, end, manager); + tokens->addElement(token); + + return tokens; +} + +void RegularExpression::allMatches(const XMLCh* const matchString, const XMLSize_t start, const XMLSize_t end, + RefVectorOf *subEx, MemoryManager* const manager) const +{ + Context context(manager); + context.reset(matchString, XMLString::stringLen(matchString), start, end, fNoClosures, fOptions); + + context.fMatch = new (manager) Match(manager); + context.fMatch->setNoGroups(fNoGroups); + context.fAdoptMatch = true; + + XMLSize_t matchStart = start; + while(matchStart <= end) { + XMLSize_t matchEnd = match(&context, fOperations, matchStart); + if(matchEnd != (XMLSize_t)-1) { + context.fMatch->setStartPos(0, (int)matchStart); + context.fMatch->setEndPos(0, (int)matchEnd); + + subEx->addElement(context.fMatch); + + context.fMatch = new (manager) Match(*(context.fMatch)); + context.fAdoptMatch = true; + + matchStart = matchEnd; + } else { + ++matchStart; + } + } +} + + +// ----------------------------------------------------------------------- +// RegularExpression: Replace methods +// ----------------------------------------------------------------------- +XMLCh* RegularExpression::replace(const char* const matchString, + const char* const replaceString, + MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(matchString, manager); + ArrayJanitor janBuf(tmpBuf, manager); + XMLCh* tmpBuf2 = XMLString::transcode(replaceString, manager); + ArrayJanitor janBuf2(tmpBuf2, manager); + + return replace(tmpBuf, tmpBuf2, 0, XMLString::stringLen(tmpBuf), manager); +} + +XMLCh* RegularExpression::replace(const char* const matchString, + const char* const replaceString, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager) const +{ + + XMLCh* tmpBuf = XMLString::transcode(matchString, manager); + ArrayJanitor janBuf(tmpBuf, manager); + XMLCh* tmpBuf2 = XMLString::transcode(replaceString, manager); + ArrayJanitor janBuf2(tmpBuf2, manager); + + return replace(tmpBuf, tmpBuf2, start, end, manager); +} + + +// --------------------------------------------------------------------------- +// RegularExpression: Replace methods - Wide char version +// --------------------------------------------------------------------------- +XMLCh* RegularExpression::replace(const XMLCh* const matchString, + const XMLCh* const replaceString, + MemoryManager* const manager) const +{ + + return replace(matchString, replaceString, 0, + XMLString::stringLen(matchString), manager); +} + +XMLCh* RegularExpression::replace(const XMLCh* const matchString, + const XMLCh* const replaceString, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager) const +{ + // check if matches zero length string - throw error if so + if(matches(XMLUni::fgZeroLenString, manager)){ + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_RepPatMatchesZeroString, manager); + } + + RefVectorOf *subEx = new (manager) RefVectorOf(10, true, manager); + Janitor > janSubEx(subEx); + + allMatches(matchString, start, end, subEx, manager); + + XMLBuffer result(1023, manager); + int tokStart = (int)start; + + XMLSize_t i = 0; + for(; i < subEx->size(); ++i) { + Match *match = subEx->elementAt(i); + int matchStart = match->getStartPos(0); + + if(matchStart > tokStart) + result.append(matchString + tokStart, matchStart - tokStart); + subInExp(replaceString, matchString, match, result, manager); + + tokStart = match->getEndPos(0); + } + + if(end > (XMLSize_t)tokStart) + result.append(matchString + tokStart, end - tokStart); + + return XMLString::replicate(result.getRawBuffer(), manager); +} + +/* + * Helper for Replace. This method prepares the replacement string by substituting + * in actual values for parenthesized sub expressions. + * + * An error will be thrown if: + * 1) there is chBackSlash not followed by a chDollarSign or chBackSlash + * 2) there is an unescaped chDollarSign which is not followed by a digit + * + */ +void RegularExpression::subInExp(const XMLCh* const repString, + const XMLCh* const origString, + const Match* subEx, + XMLBuffer &result, + MemoryManager* const manager) const +{ + int numSubExp = subEx->getNoGroups() - 1; + + for(const XMLCh *ptr = repString; *ptr != chNull; ++ptr) { + if(*ptr == chDollarSign) { + ++ptr; + + // check that after the $ is a digit + if(!XMLString::isDigit(*ptr)) { + // invalid replace string - $ must be followed by a digit + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_InvalidRepPattern, manager); + } + + int index = *ptr - chDigit_0; + + const XMLCh *dig = ptr + 1; + while(XMLString::isDigit(*dig)) { + int newIndex = index * 10 + (*dig - chDigit_0); + if(newIndex > numSubExp) break; + + index = newIndex; + ptr = dig; + ++dig; + } + + // now check that the index is legal + if(index <= numSubExp) { + int start = subEx->getStartPos(index); + int end = subEx->getEndPos(index); + + // now copy the substring into the new string + if(start < end) { + result.append(origString + start, end - start); + } + } + + } else { + if(*ptr == chBackSlash) { + ++ptr; + + // if you have a slash and then a character that's not a $ or /, + // then it's an invalid replace string + if(*ptr != chDollarSign && *ptr != chBackSlash) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_InvalidRepPattern, manager); + } + } + + result.append(*ptr); + } + } +} + + +// ----------------------------------------------------------------------- +// Static initialize and cleanup methods +// ----------------------------------------------------------------------- +void +XMLInitializer::initializeRegularExpression() +{ + RegularExpression::staticInitialize(XMLPlatformUtils::fgMemoryManager); +} + +void +XMLInitializer::terminateRegularExpression() +{ + RegularExpression::staticCleanup(); +} + +void +RegularExpression::staticInitialize(MemoryManager* memoryManager) +{ + fWordRange = TokenFactory::staticGetRange(fgUniIsWord, false); + + if (fWordRange == 0) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_RangeTokenGetError, fgUniIsWord, memoryManager); +} + +// --------------------------------------------------------------------------- +// RegularExpression: Helpers methods +// --------------------------------------------------------------------------- +int RegularExpression::getOptionValue(const XMLCh ch) { + + int ret = 0; + + switch (ch) { + + case chLatin_i: + ret = IGNORE_CASE; + break; + case chLatin_m: + ret = MULTIPLE_LINE; + break; + case chLatin_s: + ret = SINGLE_LINE; + break; + case chLatin_x: + ret = EXTENDED_COMMENT; + break; + case chLatin_F: + ret = PROHIBIT_FIXED_STRING_OPTIMIZATION; + break; + case chLatin_H: + ret = PROHIBIT_HEAD_CHARACTER_OPTIMIZATION; + break; + case chLatin_X: + ret = XMLSCHEMA_MODE; + break; + default: + break; + } + + return ret; +} + +struct RE_RuntimeContext { + const Op *op_; + XMLSize_t offs_; + + RE_RuntimeContext(const Op *op, XMLSize_t offs) : op_(op), offs_(offs) { } +}; + +int RegularExpression::match(Context* const context, const Op* const operations, + XMLSize_t offset) const +{ + ValueStackOf* opStack=NULL; + Janitor > janStack(NULL); + if(context->fLimit > 256) + { + opStack=new ValueStackOf(16, context->fMemoryManager); + janStack.reset(opStack); + } + const Op* tmpOp = operations; + bool ignoreCase = isSet(context->fOptions, IGNORE_CASE); + int doReturn; + + while (tmpOp != 0) { + // no one wants to return -5, only -1, 0, and greater + doReturn = -5; + + if (offset > context->fLimit || offset < context->fStart) + doReturn = -1; + else + { + switch(tmpOp->getOpType()) { + case Op::O_CHAR: + if (!matchChar(context, tmpOp->getData(), offset, ignoreCase)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_DOT: + if (!matchDot(context, offset)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_RANGE: + case Op::O_NRANGE: + if (!matchRange(context, tmpOp, offset, ignoreCase)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_ANCHOR: + if (!matchAnchor(context, tmpOp->getData(), offset)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_BACKREFERENCE: + if (!matchBackReference(context, tmpOp->getData(), offset, + ignoreCase)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_STRING: + if (!matchString(context, tmpOp->getLiteral(), offset, ignoreCase)) + doReturn = -1; + else + tmpOp = tmpOp->getNextOp(); + break; + case Op::O_FINITE_CLOSURE: + { + XMLInt32 id = tmpOp->getData(); + // if id is not -1, it's a closure with a child token having a minumum length, + // where id is the index of the fOffsets array where its status is stored + if (id >= 0) { + int prevOffset = context->fOffsets[id]; + if (prevOffset < 0 || prevOffset != (int)offset) { + context->fOffsets[id] = (int)offset; + } + else { + // the status didn't change, we haven't found other copies; move on to the next match + context->fOffsets[id] = -1; + tmpOp = tmpOp->getNextOp(); + break; + } + } + + // match the subitems until they do + int ret; + while((ret = match(context, tmpOp->getChild(), offset)) != -1) + { + if(offset == (XMLSize_t)ret) + break; + offset = ret; + } + + if (id >= 0) { + // loop has ended, reset the status for this closure + context->fOffsets[id] = -1; + } + tmpOp = tmpOp->getNextOp(); + } + break; + case Op::O_FINITE_NONGREEDYCLOSURE: + { + int ret = match(context,tmpOp->getNextOp(),offset); + if (ret >= 0) + doReturn = ret; + else + { + // match the subitems until they do + int ret; + while((ret = match(context, tmpOp->getChild(), offset)) != -1) + { + if(offset == (XMLSize_t)ret) + break; + offset = ret; + } + tmpOp = tmpOp->getNextOp(); + } + } + break; + case Op::O_CLOSURE: + { + XMLInt32 id = tmpOp->getData(); + // if id is not -1, it's a closure with a child token having a minumum length, + // where id is the index of the fOffsets array where its status is stored + if (id >= 0) { + int prevOffset = context->fOffsets[id]; + if (prevOffset < 0 || prevOffset != (int)offset) { + context->fOffsets[id] = (int)offset; + } + else { + // the status didn't change, we haven't found other copies; move on to the next match + context->fOffsets[id] = -1; + tmpOp = tmpOp->getNextOp(); + break; + } + } + + if(opStack!=NULL) + { + opStack->push(RE_RuntimeContext(tmpOp, offset)); + tmpOp = tmpOp->getChild(); + } + else + { + int ret = match(context, tmpOp->getChild(), offset); + if (id >= 0) { + context->fOffsets[id] = -1; + } + if (ret >= 0) + doReturn = ret; + else + tmpOp = tmpOp->getNextOp(); + } + } + break; + case Op::O_QUESTION: + { + if(opStack!=NULL) + { + opStack->push(RE_RuntimeContext(tmpOp, offset)); + tmpOp = tmpOp->getChild(); + } + else + { + int ret = match(context, tmpOp->getChild(), offset); + if (ret >= 0) + doReturn = ret; + else + tmpOp = tmpOp->getNextOp(); + } + } + break; + case Op::O_NONGREEDYCLOSURE: + case Op::O_NONGREEDYQUESTION: + { + int ret = match(context,tmpOp->getNextOp(),offset); + if (ret >= 0) + doReturn = ret; + else + tmpOp = tmpOp->getChild(); + } + break; + case Op::O_UNION: + doReturn = matchUnion(context, tmpOp, offset); + break; + case Op::O_CAPTURE: + if (context->fMatch != 0 && tmpOp->getData() != 0) + doReturn = matchCapture(context, tmpOp, offset); + else + tmpOp = tmpOp->getNextOp(); + break; + } + } + if (doReturn != -5) { + if (opStack==NULL || opStack->size() == 0) + return doReturn; + RE_RuntimeContext ctx = opStack->pop(); + tmpOp = ctx.op_; + offset = ctx.offs_; + if (tmpOp->getOpType() == Op::O_CLOSURE) { + XMLInt32 id = tmpOp->getData(); + if (id >= 0) { + // loop has ended, reset the status for this closure + context->fOffsets[id] = -1; + } + } + if (tmpOp->getOpType() == Op::O_CLOSURE || tmpOp->getOpType() == Op::O_QUESTION) { + if (doReturn >= 0) + return doReturn; + } + tmpOp = tmpOp->getNextOp(); + } + } + + return (int)offset; +} + +bool RegularExpression::matchChar(Context* const context, + const XMLInt32 ch, XMLSize_t& offset, + const bool ignoreCase) const +{ + if (offset >= context->fLimit) + return false; + + XMLInt32 strCh = 0; + + if (!context->nextCh(strCh, offset)) + return false; + + bool match = ignoreCase ? matchIgnoreCase(ch, strCh) + : (ch == strCh); + if (!match) + return false; + + ++offset; + + return true; +} + +bool RegularExpression::matchDot(Context* const context, XMLSize_t& offset) const +{ + if (offset >= context->fLimit) + return false; + + XMLInt32 strCh = 0; + + if (!context->nextCh(strCh, offset)) + return false; + + if (!isSet(context->fOptions, SINGLE_LINE)) { + + if (RegxUtil::isEOLChar(strCh)) + return false; + } + + ++offset; + return true; +} + +bool RegularExpression::matchRange(Context* const context, const Op* const op, + XMLSize_t& offset, const bool ignoreCase) const +{ + if (offset >= context->fLimit) + return false; + + XMLInt32 strCh = 0; + + if (!context->nextCh(strCh, offset)) + return false; + + RangeToken* tok = (RangeToken *) op->getToken(); + bool match = false; + + if (ignoreCase) { + tok = tok->getCaseInsensitiveToken(fTokenFactory); + } + + match = tok->match(strCh); + + if (!match) + return false; + + ++offset; + return true; +} + +bool RegularExpression::matchAnchor(Context* const context, const XMLInt32 ch, + const XMLSize_t offset) const +{ + switch ((XMLCh) ch) { + case chDollarSign: + if (isSet(context->fOptions, MULTIPLE_LINE)) { + if (!(offset == context->fLimit || (offset < context->fLimit + && RegxUtil::isEOLChar(context->fString[offset])))) + return false; + } + else { + + if (!(offset == context->fLimit + || (offset+1 == context->fLimit + && RegxUtil::isEOLChar(context->fString[offset])) + || (offset+2 == context->fLimit + && context->fString[offset] == chCR + && context->fString[offset+1] == chLF))) + return false; + } + break; + case chCaret: + if (!isSet(context->fOptions, MULTIPLE_LINE)) { + + if (offset != context->fStart) + return false; + } + else { + + if (!(offset == context->fStart || (offset > context->fStart + && RegxUtil::isEOLChar(context->fString[offset-1])))) + return false; + } + break; + } + + return true; +} + +bool RegularExpression::matchBackReference(Context* const context, + const XMLInt32 refNo, XMLSize_t& offset, + const bool ignoreCase) const +{ + if (refNo <=0 || refNo >= fNoGroups) + ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Regex_BadRefNo, context->fMemoryManager); + + // If the group we're matching against wasn't matched, + // the back reference matches the empty string + if (context->fMatch->getStartPos(refNo) < 0 || context->fMatch->getEndPos(refNo) < 0) + return true; + + int start = context->fMatch->getStartPos(refNo); + int length = context->fMatch->getEndPos(refNo) - start; + + if (int(context->fLimit - offset) < length) + return false; + + bool match = ignoreCase ? XMLString::regionIMatches(context->fString,(int)offset, + context->fString,start,length) + : XMLString::regionMatches(context->fString, (int)offset, + context->fString, start,length); + + if (match) offset += length; + return match; +} + +bool RegularExpression::matchString(Context* const context, + const XMLCh* const literal, XMLSize_t& offset, + const bool ignoreCase) const +{ + XMLSize_t length = XMLString::stringLen(literal); + + if (context->fLimit - offset < length) + return false; + + bool match = ignoreCase ? XMLString::regionIMatches(context->fString, (int)offset, + literal, 0, length) + : XMLString::regionMatches(context->fString, (int)offset, + literal, 0, length); + if (match) offset += length; + return match; +} + +int RegularExpression::matchCapture(Context* const context, const Op* const op, + XMLSize_t offset) const +{ + // No check is made for nullness of fMatch as the function is only called if + // fMatch is not null. + XMLInt32 index = op->getData(); + int save = (index > 0) ? context->fMatch->getStartPos(index) + : context->fMatch->getEndPos(-index); + + if (index > 0) { + context->fMatch->setStartPos(index, (int)offset); + int ret = match(context, op->getNextOp(), offset); + if (ret < 0) + context->fMatch->setStartPos(index, save); + return ret; + } + + context->fMatch->setEndPos(-index, (int)offset); + int ret = match(context, op->getNextOp(), offset); + if (ret < 0) + context->fMatch->setEndPos(-index, save); + return ret; +} + +int RegularExpression::matchUnion(Context* const context, + const Op* const op, XMLSize_t offset) const +{ + XMLSize_t opSize = op->getSize(); + + Context bestResultContext; + int bestResult=-1; + for(XMLSize_t i=0; i < opSize; i++) { + Context tmpContext(context); + int ret = match(&tmpContext, op->elementAt(i), offset); + if (ret >= 0 && (XMLSize_t)ret <= context->fLimit && ret>bestResult) + { + bestResult=ret; + bestResultContext=tmpContext; + // exit early, if we reached the end of the string + if((XMLSize_t)ret == context->fLimit) + break; + } + } + if(bestResult!=-1) + *context=bestResultContext; + return bestResult; +} + + +int RegularExpression::parseOptions(const XMLCh* const options) +{ + + if (options == 0) + return 0; + + int opts = 0; + XMLSize_t length = XMLString::stringLen(options); + + for (XMLSize_t i=0; i < length; i++) { + + int v = getOptionValue(options[i]); + + if (v == 0) + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Regex_UnknownOption, options, fMemoryManager); + + opts |= v; + } + + return opts; +} + +void RegularExpression::compile(const Token* const token) { + + if (fOperations != 0) + return; + + fNoClosures = 0; + fOperations = compile(token, 0, false); +} + +Op* RegularExpression::compile(const Token* const token, Op* const next, + const bool reverse) +{ + + Op* ret = 0; + + const Token::tokType tokenType = token->getTokenType(); + + switch(tokenType) { + case Token::T_DOT: + ret = fOpFactory.createDotOp(); + ret->setNextOp(next); + break; + case Token::T_CHAR: + ret = fOpFactory.createCharOp(token->getChar()); + ret->setNextOp(next); + break; + case Token::T_ANCHOR: + ret = fOpFactory.createAnchorOp(token->getChar()); + ret->setNextOp(next); + break; + case Token::T_RANGE: + case Token::T_NRANGE: + ret = fOpFactory.createRangeOp(token); + ret->setNextOp(next); + break; + case Token::T_STRING: + ret = fOpFactory.createStringOp(token->getString()); + ret->setNextOp(next); + break; + case Token::T_BACKREFERENCE: + ret = fOpFactory.createBackReferenceOp(token->getReferenceNo()); + ret->setNextOp(next); + break; + case Token::T_EMPTY: + ret = next; + break; + case Token::T_CONCAT: + ret = compileConcat(token, next, reverse); + break; + case Token::T_UNION: + ret = compileUnion(token, next, reverse); + break; + case Token::T_CLOSURE: + case Token::T_NONGREEDYCLOSURE: + ret = compileClosure(token, next, reverse, tokenType); + break; + case Token::T_PAREN: + ret = compileParenthesis(token, next, reverse); + break; + default: + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_UnknownTokenType, fMemoryManager); + break; // this line to be deleted + } + + return ret; +} + +/* + * Prepares for matching. This method is called during construction. + */ +void RegularExpression::prepare() { + + compile(fTokenTree); + + fMinLength = fTokenTree->getMinLength(); + fFirstChar = 0; + + if (!isSet(fOptions, PROHIBIT_HEAD_CHARACTER_OPTIMIZATION) && + !isSet(fOptions, XMLSCHEMA_MODE)) { + + RangeToken* rangeTok = fTokenFactory->createRange(); + Token::firstCharacterOptions result = fTokenTree->analyzeFirstCharacter(rangeTok, fOptions, fTokenFactory); + + if (result == Token::FC_TERMINAL) { + + rangeTok->compactRanges(); + fFirstChar = rangeTok; + } + + rangeTok->createMap(); + + if (isSet(fOptions, IGNORE_CASE)) + { + rangeTok->getCaseInsensitiveToken(fTokenFactory); + } + } + + if (fOperations != 0 && fOperations->getNextOp() == 0 && + (fOperations->getOpType() == Op::O_STRING || + fOperations->getOpType() == Op::O_CHAR) && + !isSet(fOptions, IGNORE_CASE) ) { + + fFixedStringOnly = true; + + if (fOperations->getOpType() == Op::O_STRING) { + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + fFixedString = XMLString::replicate(fOperations->getLiteral(), fMemoryManager); + } + else{ + + XMLInt32 ch = fOperations->getData(); + + if ( ch >= 0x10000) { // add as constant + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + fFixedString = RegxUtil::decomposeToSurrogates(ch, fMemoryManager); + } + else { + + XMLCh* dummyStr = (XMLCh*) fMemoryManager->allocate(2 * sizeof(XMLCh));//new XMLCh[2]; + dummyStr[0] = (XMLCh) fOperations->getData(); + dummyStr[1] = chNull; + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + fFixedString = dummyStr; + } + } + + fBMPattern = new (fMemoryManager) BMPattern(fFixedString, 256, + isSet(fOptions, IGNORE_CASE), fMemoryManager); + } + else if (!isSet(fOptions, XMLSCHEMA_MODE) && + !isSet(fOptions, PROHIBIT_FIXED_STRING_OPTIMIZATION) && + !isSet(fOptions, IGNORE_CASE)) { + + int fixedOpts = 0; + Token* tok = fTokenTree->findFixedString(fOptions, fixedOpts); + + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + + fFixedString = (tok == 0) ? 0 + : XMLString::replicate(tok->getString(), fMemoryManager); + + if (fFixedString != 0 && XMLString::stringLen(fFixedString) < 2) { + + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + fFixedString = 0; + } + + if (fFixedString != 0) { + + fBMPattern = new (fMemoryManager) BMPattern(fFixedString, 256, + isSet(fixedOpts, IGNORE_CASE), fMemoryManager); + } + } +} + +bool RegularExpression::doTokenOverlap(const Op* op, Token* token) +{ + if(op->getOpType()==Op::O_RANGE) + { + RangeToken* t1=(RangeToken*)op->getToken(); + switch(token->getTokenType()) + { + case Token::T_CHAR: + return t1->match(token->getChar()); + case Token::T_STRING: + return t1->match(*token->getString()); + case Token::T_RANGE: + { + try + { + RangeToken tempRange(Token::T_RANGE, fMemoryManager); + tempRange.mergeRanges(t1); + tempRange.intersectRanges((RangeToken*)token); + return !tempRange.empty(); + } + catch(RuntimeException&) + { + } + break; + } + default: + break; + } + return true; + } + + XMLInt32 ch=0; + if(op->getOpType()==Op::O_CHAR) + ch=op->getData(); + else if(op->getOpType()==Op::O_STRING) + ch=*op->getLiteral(); + + if(ch!=0) + { + switch(token->getTokenType()) + { + case Token::T_CHAR: + return token->getChar()==ch; + case Token::T_STRING: + return *token->getString()==ch; + case Token::T_RANGE: + case Token::T_NRANGE: + return ((RangeToken*)token)->match(ch); + default: + break; + } + } + // in any other case, there is the chance that they overlap + return true; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file RegularExpression.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RegularExpression.hpp b/project/jni/xerces/src/xercesc/util/regx/RegularExpression.hpp new file mode 100644 index 000000000..d829e9d97 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegularExpression.hpp @@ -0,0 +1,772 @@ +/* + * 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: RegularExpression.hpp 822158 2009-10-06 07:52:59Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REGULAREXPRESSION_HPP) +#define XERCESC_INCLUDE_GUARD_REGULAREXPRESSION_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class RangeToken; +class Match; +class RegxParser; + +/** + * The RegularExpression class represents a parsed executable regular expression. + * This class is thread safe. Two similar regular expression syntaxes are + * supported: + * + *
    + *
  1. The XPath 2.0 / XQuery regular expression syntax. + *
  2. The XML Schema regular expression syntax.
  3. + *
+ * + * XPath 2.0 regular expression syntax is used unless the "X" option is specified during construction. + * + * Options can be specified during construction to change the way that the regular expression is handled. + * Options are specified by a string consisting of any number of the following characters: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
CharacterMeaning
i + * Ignore case when matching the regular expression.
m + * Multi-line mode. The meta characters "^" and "$" will match the beginning and end of lines.
s + * Single-line mode. The meta character "." will match a newline character.
xAllow extended comments.
FProhibit the fixed string optimization.
HProhibit the head character optimization.
XParse the regular expression according to the + * XML Schema regular expression syntax.
+ */ +class XMLUTIL_EXPORT RegularExpression : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors and destructor */ + //@{ + + /** Parses the given regular expression. + * + * @param pattern the regular expression in the local code page + * @param manager the memory manager to use + */ + RegularExpression + ( + const char* const pattern + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Parses the given regular expression using the options specified. + * + * @param pattern the regular expression in the local code page + * @param options the options string in the local code page + * @param manager the memory manager to use + */ + RegularExpression + ( + const char* const pattern + , const char* const options + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Parses the given regular expression. + * + * @param pattern the regular expression + * @param manager the memory manager to use + */ + RegularExpression + ( + const XMLCh* const pattern + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Parses the given regular expression using the options specified. + * + * @param pattern the regular expression + * @param options the options string + * @param manager the memory manager to use + */ + RegularExpression + ( + const XMLCh* const pattern + , const XMLCh* const options + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~RegularExpression(); + + //@} + + // ----------------------------------------------------------------------- + // Public Constants + // ----------------------------------------------------------------------- + static const unsigned int IGNORE_CASE; + static const unsigned int SINGLE_LINE; + static const unsigned int MULTIPLE_LINE; + static const unsigned int EXTENDED_COMMENT; + static const unsigned int PROHIBIT_HEAD_CHARACTER_OPTIMIZATION; + static const unsigned int PROHIBIT_FIXED_STRING_OPTIMIZATION; + static const unsigned int XMLSCHEMA_MODE; + typedef enum + { + wordTypeIgnore = 0, + wordTypeLetter = 1, + wordTypeOther = 2 + } wordType; + + // ----------------------------------------------------------------------- + // Public Helper methods + // ----------------------------------------------------------------------- + + /** @name Public helper methods */ + //@{ + + static int getOptionValue(const XMLCh ch); + static bool isSet(const int options, const int flag); + + //@} + + // ----------------------------------------------------------------------- + // Matching methods + // ----------------------------------------------------------------------- + + /** @name Matching methods */ + //@{ + + /** Tries to match the given null terminated string against the regular expression, returning + * true if successful. + * + * @param matchString the string to match in the local code page + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const char* const matchString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given string between the specified start and end offsets + * against the regular expression, returning true if successful. + * + * @param matchString the string to match in the local code page + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const char* const matchString, const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given null terminated string against the regular expression, returning + * true if successful. + * + * @param matchString the string to match in the local code page + * @param pMatch a Match object, which will be populated with the offsets for the + * regular expression match and sub-matches. + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const char* const matchString, Match* const pMatch, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given string between the specified start and end offsets + * against the regular expression, returning true if successful. + * + * @param matchString the string to match in the local code page + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param pMatch a Match object, which will be populated with the offsets for the + * regular expression match and sub-matches. + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const char* const matchString, const XMLSize_t start, const XMLSize_t end, + Match* const pMatch, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given null terminated string against the regular expression, returning + * true if successful. + * + * @param matchString the string to match + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const XMLCh* const matchString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given string between the specified start and end offsets + * against the regular expression, returning true if successful. + * + * @param matchString the string to match + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const XMLCh* const matchString, const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given null terminated string against the regular expression, returning + * true if successful. + * + * @param matchString the string to match + * @param pMatch a Match object, which will be populated with the offsets for the + * regular expression match and sub-matches. + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const XMLCh* const matchString, Match* const pMatch, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given string between the specified start and end offsets + * against the regular expression, returning true if successful. + * + * @param matchString the string to match + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param pMatch a Match object, which will be populated with the offsets for the + * regular expression match and sub-matches. + * @param manager the memory manager to use + * + * @return Whether the string matched the regular expression or not. + */ + bool matches(const XMLCh* const matchString, const XMLSize_t start, const XMLSize_t end, + Match* const pMatch, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tries to match the given string between the specified start and end offsets + * against the regular expression. The subEx vector is populated with the details + * for every non-overlapping occurrence of a match in the string. + * + * @param matchString the string to match + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param subEx a RefVectorOf Match objects, populated with the offsets for the + * regular expression match and sub-matches. + * @param manager the memory manager to use + */ + void allMatches(const XMLCh* const matchString, const XMLSize_t start, const XMLSize_t end, + RefVectorOf *subEx, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + //@} + + // ----------------------------------------------------------------------- + // Tokenize methods + // ----------------------------------------------------------------------- + // Note: The caller owns the string vector that is returned, and is responsible + // for deleting it. + + /** @name Tokenize methods */ + //@{ + + /** Tokenizes the null terminated string according to the regular expression, returning + * the parts of the string that do not match the regular expression. + * + * @param matchString the string to match in the local code page + * @param manager the memory manager to use + * + * @return A RefArrayVectorOf sub-strings that do not match the regular expression allocated using the + * given MemoryManager. The caller owns the string vector that is returned, and is responsible for + * deleting it. + */ + RefArrayVectorOf *tokenize(const char* const matchString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tokenizes the string between the specified start and end offsets according to the regular + * expression, returning the parts of the string that do not match the regular expression. + * + * @param matchString the string to match in the local code page + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return A RefArrayVectorOf sub-strings that do not match the regular expression allocated using the + * given MemoryManager. The caller owns the string vector that is returned, and is responsible for + * deleting it. + */ + RefArrayVectorOf *tokenize(const char* const matchString, const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tokenizes the null terminated string according to the regular expression, returning + * the parts of the string that do not match the regular expression. + * + * @param matchString the string to match + * @param manager the memory manager to use + * + * @return A RefArrayVectorOf sub-strings that do not match the regular expression allocated using the + * given MemoryManager. The caller owns the string vector that is returned, and is responsible for + * deleting it. + */ + RefArrayVectorOf *tokenize(const XMLCh* const matchString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Tokenizes the string between the specified start and end offsets according to the regular + * expression, returning the parts of the string that do not match the regular expression. + * + * @param matchString the string to match + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return A RefArrayVectorOf sub-strings that do not match the regular expression allocated using the + * given MemoryManager. The caller owns the string vector that is returned, and is responsible for + * deleting it. + */ + RefArrayVectorOf *tokenize(const XMLCh* const matchString, const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + //@} + + // ----------------------------------------------------------------------- + // Replace methods + // ----------------------------------------------------------------------- + // Note: The caller owns the XMLCh* that is returned, and is responsible for + // deleting it. + + /** @name Replace methods */ + //@{ + + /** Performs a search and replace on the given null terminated string, replacing + * any substring that matches the regular expression with a string derived from + * the replacement string. + * + * @param matchString the string to match in the local code page + * @param replaceString the string to replace in the local code page + * @param manager the memory manager to use + * + * @return The resulting string allocated using the given MemoryManager. The caller owns the string + * that is returned, and is responsible for deleting it. + */ + XMLCh *replace(const char* const matchString, const char* const replaceString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Performs a search and replace on the given string between the specified start and end offsets, replacing + * any substring that matches the regular expression with a string derived from + * the replacement string. + * + * @param matchString the string to match in the local code page + * @param replaceString the string to replace in the local code page + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return The resulting string allocated using the given MemoryManager. The caller owns the string + * that is returned, and is responsible for deleting it. + */ + XMLCh *replace(const char* const matchString, const char* const replaceString, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Performs a search and replace on the given null terminated string, replacing + * any substring that matches the regular expression with a string derived from + * the replacement string. + * + * @param matchString the string to match + * @param replaceString the string to replace + * @param manager the memory manager to use + * + * @return The resulting string allocated using the given MemoryManager. The caller owns the string + * that is returned, and is responsible for deleting it. + */ + XMLCh *replace(const XMLCh* const matchString, const XMLCh* const replaceString, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + /** Performs a search and replace on the given string between the specified start and end offsets, replacing + * any substring that matches the regular expression with a string derived from + * the replacement string. + * + * @param matchString the string to match + * @param replaceString the string to replace + * @param start the offset of the start of the string + * @param end the offset of the end of the string + * @param manager the memory manager to use + * + * @return The resulting string allocated using the given MemoryManager. The caller owns the string + * that is returned, and is responsible for deleting it. + */ + XMLCh *replace(const XMLCh* const matchString, const XMLCh* const replaceString, + const XMLSize_t start, const XMLSize_t end, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const; + + //@} + + // ----------------------------------------------------------------------- + // Static initialize and cleanup methods + // ----------------------------------------------------------------------- + + /** @name Static initilize and cleanup methods */ + //@{ + + static void + staticInitialize(MemoryManager* memoryManager); + + static void + staticCleanup(); + + //@} + +protected: + virtual RegxParser* getRegexParser(const int options, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Cleanup methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setPattern(const XMLCh* const pattern, const XMLCh* const options=0); + + // ----------------------------------------------------------------------- + // Protected data types + // ----------------------------------------------------------------------- + class XMLUTIL_EXPORT Context : public XMemory + { + public : + Context(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + Context(Context* src); + ~Context(); + + Context& operator= (const Context& other); + inline const XMLCh* getString() const { return fString; } + void reset(const XMLCh* const string, const XMLSize_t stringLen, + const XMLSize_t start, const XMLSize_t limit, const int noClosures, + const unsigned int options); + bool nextCh(XMLInt32& ch, XMLSize_t& offset); + + bool fAdoptMatch; + XMLSize_t fStart; + XMLSize_t fLimit; + XMLSize_t fLength; // fLimit - fStart + int fSize; + XMLSize_t fStringMaxLen; + int* fOffsets; + Match* fMatch; + const XMLCh* fString; + unsigned int fOptions; + MemoryManager* fMemoryManager; + }; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RegularExpression(const RegularExpression&); + RegularExpression& operator=(const RegularExpression&); + + // ----------------------------------------------------------------------- + // Protected Helper methods + // ----------------------------------------------------------------------- + void prepare(); + int parseOptions(const XMLCh* const options); + + /** + * Matching helpers + */ + int match(Context* const context, const Op* const operations, XMLSize_t offset) const; + bool matchIgnoreCase(const XMLInt32 ch1, const XMLInt32 ch2) const; + + /** + * Helper methods used by match(Context* ...) + */ + bool matchChar(Context* const context, const XMLInt32 ch, XMLSize_t& offset, + const bool ignoreCase) const; + bool matchDot(Context* const context, XMLSize_t& offset) const; + bool matchRange(Context* const context, const Op* const op, + XMLSize_t& offset, const bool ignoreCase) const; + bool matchAnchor(Context* const context, const XMLInt32 ch, + const XMLSize_t offset) const; + bool matchBackReference(Context* const context, const XMLInt32 ch, + XMLSize_t& offset, const bool ignoreCase) const; + bool matchString(Context* const context, const XMLCh* const literal, + XMLSize_t& offset, const bool ignoreCase) const; + int matchUnion(Context* const context, const Op* const op, XMLSize_t offset) const; + int matchCapture(Context* const context, const Op* const op, XMLSize_t offset) const; + + /** + * Replace helpers + */ + void subInExp(const XMLCh* const repString, + const XMLCh* const origString, + const Match* subEx, + XMLBuffer &result, + MemoryManager* const manager) const; + /** + * Converts a token tree into an operation tree + */ + void compile(const Token* const token); + Op* compile(const Token* const token, Op* const next, + const bool reverse); + /** + * Helper methods used by compile + */ + Op* compileUnion(const Token* const token, Op* const next, + const bool reverse); + Op* compileParenthesis(const Token* const token, Op* const next, + const bool reverse); + Op* compileConcat(const Token* const token, Op* const next, + const bool reverse); + Op* compileClosure(const Token* const token, Op* const next, + const bool reverse, const Token::tokType tkType); + + bool doTokenOverlap(const Op* op, Token* token); + + // ----------------------------------------------------------------------- + // Protected data members + // ----------------------------------------------------------------------- + bool fHasBackReferences; + bool fFixedStringOnly; + int fNoGroups; + XMLSize_t fMinLength; + unsigned int fNoClosures; + unsigned int fOptions; + const BMPattern* fBMPattern; + XMLCh* fPattern; + XMLCh* fFixedString; + const Op* fOperations; + Token* fTokenTree; + RangeToken* fFirstChar; + static RangeToken* fWordRange; + OpFactory fOpFactory; + TokenFactory* fTokenFactory; + MemoryManager* fMemoryManager; +}; + + + + // ----------------------------------------------------------------------- + // RegularExpression: Static initialize and cleanup methods + // ----------------------------------------------------------------------- + inline void RegularExpression::staticCleanup() + { + fWordRange = 0; + } + + // --------------------------------------------------------------------------- + // RegularExpression: Cleanup methods + // --------------------------------------------------------------------------- + inline void RegularExpression::cleanUp() { + + fMemoryManager->deallocate(fPattern);//delete [] fPattern; + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; + delete fBMPattern; + delete fTokenFactory; + } + + // --------------------------------------------------------------------------- + // RegularExpression: Helper methods + // --------------------------------------------------------------------------- + inline bool RegularExpression::isSet(const int options, const int flag) { + + return (options & flag) == flag; + } + + + inline Op* RegularExpression::compileUnion(const Token* const token, + Op* const next, + const bool reverse) { + + XMLSize_t tokSize = token->size(); + UnionOp* uniOp = fOpFactory.createUnionOp(tokSize); + + for (XMLSize_t i=0; iaddElement(compile(token->getChild(i), next, reverse)); + } + + return uniOp; + } + + + inline Op* RegularExpression::compileParenthesis(const Token* const token, + Op* const next, + const bool reverse) { + + if (token->getNoParen() == 0) + return compile(token->getChild(0), next, reverse); + + Op* captureOp = 0; + + if (reverse) { + + captureOp = fOpFactory.createCaptureOp(token->getNoParen(), next); + captureOp = compile(token->getChild(0), captureOp, reverse); + + return fOpFactory.createCaptureOp(-token->getNoParen(), captureOp); + } + + captureOp = fOpFactory.createCaptureOp(-token->getNoParen(), next); + captureOp = compile(token->getChild(0), captureOp, reverse); + + return fOpFactory.createCaptureOp(token->getNoParen(), captureOp); + } + + inline Op* RegularExpression::compileConcat(const Token* const token, + Op* const next, + const bool reverse) { + + Op* ret = next; + XMLSize_t tokSize = token->size(); + + if (!reverse) { + + for (XMLSize_t i= tokSize; i>0; i--) { + ret = compile(token->getChild(i-1), ret, false); + } + } + else { + + for (XMLSize_t i= 0; i< tokSize; i++) { + ret = compile(token->getChild(i), ret, true); + } + } + + return ret; + } + + inline Op* RegularExpression::compileClosure(const Token* const token, + Op* const next, + const bool reverse, + const Token::tokType tkType) { + + Op* ret = 0; + Token* childTok = token->getChild(0); + int min = token->getMin(); + int max = token->getMax(); + + if (min >= 0 && min == max) { + + ret = next; + for (int i=0; i< min; i++) { + ret = compile(childTok, ret, reverse); + } + + return ret; + } + + if (min > 0 && max > 0) + max -= min; + + if (max > 0) { + + ret = next; + for (int i=0; isetNextOp(next); + childOp->setChild(compile(childTok, ret, reverse)); + ret = childOp; + } + } + else { + + ChildOp* childOp = 0; + + if (tkType == Token::T_NONGREEDYCLOSURE) { + childOp = fOpFactory.createNonGreedyClosureOp(); + } + else { + + if (childTok->getMinLength() == 0) + childOp = fOpFactory.createClosureOp(fNoClosures++); + else + childOp = fOpFactory.createClosureOp(-1); + } + + childOp->setNextOp(next); + if(next==NULL || !doTokenOverlap(next, childTok)) + { + childOp->setOpType(tkType == Token::T_NONGREEDYCLOSURE?Op::O_FINITE_NONGREEDYCLOSURE:Op::O_FINITE_CLOSURE); + childOp->setChild(compile(childTok, NULL, reverse)); + } + else + { + childOp->setChild(compile(childTok, childOp, reverse)); + } + ret = childOp; + } + + if (min > 0) { + + for (int i=0; i< min; i++) { + ret = compile(childTok, ret, reverse); + } + } + + return ret; + } + +XERCES_CPP_NAMESPACE_END + +#endif +/** + * End of file RegularExpression.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/RegxDefs.hpp b/project/jni/xerces/src/xercesc/util/regx/RegxDefs.hpp new file mode 100644 index 000000000..2a65f851e --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegxDefs.hpp @@ -0,0 +1,239 @@ +/* + * 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: RegxDefs.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REGXDEFS_HPP) +#define XERCESC_INCLUDE_GUARD_REGXDEFS_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const XMLCh fgXMLCategory[] = +{ + chLatin_X, chLatin_M, chLatin_L, chNull +}; + +static const XMLCh fgASCIICategory[] = +{ + chLatin_A, chLatin_S, chLatin_C, chLatin_I, chLatin_I, chNull +}; + +static const XMLCh fgUnicodeCategory[] = +{ + chLatin_U, chLatin_N, chLatin_I, chLatin_C, chLatin_O, chLatin_D, + chLatin_E, chNull +}; + +static const XMLCh fgBlockCategory[] = +{ + chLatin_B, chLatin_L, chLatin_O, chLatin_C, chLatin_K, chNull +}; + +static const XMLCh fgXMLSpace[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_i, chLatin_s, chLatin_S, + chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +static const XMLCh fgXMLDigit[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_i, chLatin_s, chLatin_D, + chLatin_i, chLatin_g, chLatin_i, chLatin_t, chNull +}; + +static const XMLCh fgXMLWord[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_i, chLatin_s, chLatin_W, + chLatin_o, chLatin_r, chLatin_d, chNull +}; + +static const XMLCh fgXMLNameChar[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_i, chLatin_s, chLatin_N, + chLatin_a, chLatin_m, chLatin_e, chLatin_C, chLatin_h, chLatin_a, + chLatin_r, chNull +}; + +static const XMLCh fgXMLInitialNameChar[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_i, chLatin_s, chLatin_I, + chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_a, chLatin_l, + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_C, chLatin_h, + chLatin_a, chLatin_r, chNull +}; + +static const XMLCh fgASCII[] = +{ + chLatin_a, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chColon, chLatin_i, + chLatin_s, chLatin_A, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chNull +}; + +static const XMLCh fgASCIIDigit[] = +{ + chLatin_a, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chColon, chLatin_i, + chLatin_s, chLatin_D, chLatin_i, chLatin_g, chLatin_i, chLatin_t, chNull +}; + +static const XMLCh fgASCIIWord[] = +{ + chLatin_a, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chColon, chLatin_i, + chLatin_s, chLatin_W, chLatin_o, chLatin_r, chLatin_d, chNull +}; + +static const XMLCh fgASCIISpace[] = +{ + chLatin_a, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chColon, chLatin_i, + chLatin_s, chLatin_S, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +static const XMLCh fgASCIIXDigit[] = +{ + chLatin_a, chLatin_s, chLatin_c, chLatin_i, chLatin_i, chColon, chLatin_i, + chLatin_s, chLatin_X, chLatin_D, chLatin_i, chLatin_g, chLatin_i, + chLatin_t, chNull +}; + + +static const XMLCh fgUniAll[] = +{ + chLatin_A, chLatin_L, chLatin_L, chNull +}; + +static const XMLCh fgUniIsAlpha[] = +{ + chLatin_I, chLatin_s, chLatin_A, chLatin_l, chLatin_p, chLatin_h, + chLatin_a, chNull +}; + +static const XMLCh fgUniIsAlnum[] = +{ + chLatin_I, chLatin_s, chLatin_A, chLatin_l, chLatin_n, chLatin_u, + chLatin_m, chNull +}; + +static const XMLCh fgUniIsWord[] = +{ + chLatin_I, chLatin_s, chLatin_W, chLatin_o, chLatin_r, chLatin_d, + chNull +}; + + +static const XMLCh fgUniIsDigit[] = +{ + chLatin_I, chLatin_s, chLatin_D, chLatin_i, chLatin_g, chLatin_i, + chLatin_t, chNull +}; + +static const XMLCh fgUniIsUpper[] = +{ + chLatin_I, chLatin_s, chLatin_U, chLatin_p, chLatin_p, chLatin_e, + chLatin_r, chNull +}; + +static const XMLCh fgUniIsLower[] = +{ + chLatin_I, chLatin_s, chLatin_L, chLatin_o, chLatin_w, chLatin_e, + chLatin_r, chNull +}; + +static const XMLCh fgUniIsPunct[] = +{ + chLatin_I, chLatin_s, chLatin_P, chLatin_u, chLatin_n, chLatin_c, + chLatin_t, chNull +}; + +static const XMLCh fgUniIsSpace[] = +{ + chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_a, chLatin_c, + chLatin_e, chNull +}; + +static const XMLCh fgUniAssigned[] = +{ + chLatin_A, chLatin_S, chLatin_S, chLatin_I, chLatin_G, chLatin_N, + chLatin_E, chLatin_D, chNull +}; + + +static const XMLCh fgUniDecimalDigit[] = +{ + chLatin_N, chLatin_d, chNull +}; + +static const XMLCh fgBlockIsSpecials[] = +{ + chLatin_I, chLatin_s, chLatin_S, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_a, + chLatin_l, chLatin_s, chNull +}; + +static const XMLCh fgBlockIsPrivateUse[] = +{ + chLatin_I, chLatin_s, chLatin_P, chLatin_r, chLatin_i, chLatin_v, chLatin_a, chLatin_t, chLatin_e, + chLatin_U, chLatin_s, chLatin_e, chNull +}; + +static const XMLCh fgUniLetter[] = +{ + chLatin_L, chNull +}; + +static const XMLCh fgUniNumber[] = +{ + chLatin_N, chNull +}; + +static const XMLCh fgUniMark[] = +{ + chLatin_M, chNull +}; + +static const XMLCh fgUniSeparator[] = +{ + chLatin_Z, chNull +}; + +static const XMLCh fgUniPunctuation[] = +{ + chLatin_P, chNull +}; + +static const XMLCh fgUniControl[] = +{ + chLatin_C, chNull +}; + +static const XMLCh fgUniSymbol[] = +{ + chLatin_S, chNull +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file RegxDefs.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/RegxParser.cpp b/project/jni/xerces/src/xercesc/util/regx/RegxParser.cpp new file mode 100644 index 000000000..89e9ec89a --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegxParser.cpp @@ -0,0 +1,868 @@ +/* + * 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: RegxParser.cpp 834826 2009-11-11 10:03:53Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// RegxParser::ReferencePostion: Constructors and Destructor +// --------------------------------------------------------------------------- +RegxParser::ReferencePosition::ReferencePosition(const int refNo, + const XMLSize_t position) + :fReferenceNo(refNo) + , fPosition(position) +{ + +} + +// --------------------------------------------------------------------------- +// RegxParser: Constructors and Destructors +// --------------------------------------------------------------------------- +RegxParser::RegxParser(MemoryManager* const manager) + :fMemoryManager(manager), + fHasBackReferences(false), + fOptions(0), + fOffset(0), + fNoGroups(1), + fParseContext(regexParserStateNormal), + fStringLen(0), + fState(REGX_T_EOF), + fCharData(0), + fString(0), + fReferences(0), + fTokenFactory(0) +{ +} + +RegxParser::~RegxParser() { + + fMemoryManager->deallocate(fString);//delete [] fString; + delete fReferences; +} + +// --------------------------------------------------------------------------- +// RegxParser: Parsing methods +// --------------------------------------------------------------------------- +Token* RegxParser::parse(const XMLCh* const regxStr, const int options) { + + // if TokenFactory is not set do nothing. + // REVISIT - should we throw an exception + if (fTokenFactory == 0) { + return 0; + } + + fOptions = options; + fOffset = 0; + fNoGroups = 1; + fHasBackReferences = false; + setParseContext(regexParserStateNormal); + if (fString) + fMemoryManager->deallocate(fString);//delete [] fString; + fString = XMLString::replicate(regxStr, fMemoryManager); + + if (isSet(RegularExpression::EXTENDED_COMMENT)) { + + if (fString) + fMemoryManager->deallocate(fString);//delete [] fString; + fString = RegxUtil::stripExtendedComment(regxStr, fMemoryManager); + } + + fStringLen = XMLString::stringLen(fString); + processNext(); + + Token* retTok = parseRegx(); + + if (fOffset != fStringLen) { + XMLCh value1[65]; + XMLString::sizeToText(fOffset, value1, 64, 10, fMemoryManager); + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_Parse1, value1, fString, fMemoryManager); + } + + if (fReferences != 0) { + + XMLSize_t refSize = fReferences->size(); + for (XMLSize_t i = 0; i < refSize; i++) { + + if (fNoGroups <= fReferences->elementAt(i)->fReferenceNo) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Parse2, fMemoryManager); + } + } + + fReferences->removeAllElements(); + } + + return retTok; +} + + +void RegxParser::processNext() { + + if (fOffset >= fStringLen) { + + fCharData = -1; + fState = REGX_T_EOF; + return; + } + + parserState nextState; + XMLCh ch = fString[fOffset++]; + fCharData = ch; + + if (fParseContext == regexParserStateInBrackets) { + + switch (ch) { + case chBackSlash: + nextState = REGX_T_BACKSOLIDUS; + + if (fOffset >= fStringLen) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Next1, fMemoryManager); + } + + fCharData = fString[fOffset++]; + break; + case chDash: + if (fOffset < fStringLen && fString[fOffset] == chOpenSquare) { + + fOffset++; + nextState = REGX_T_XMLSCHEMA_CC_SUBTRACTION; + } + else { + nextState = REGX_T_CHAR; + } + break; + default: + if (RegxUtil::isHighSurrogate(ch) && fOffset < fStringLen) { + + XMLCh lowCh = fString[fOffset]; + if (RegxUtil::isLowSurrogate(lowCh)) { + fCharData = RegxUtil::composeFromSurrogate(ch, lowCh); + fOffset++; + } + else { + throw XMLErrs::Expected2ndSurrogateChar; + } + } + + nextState = REGX_T_CHAR; + } + + fState = nextState; + return; + } + + switch (ch) { + + case chPipe: + nextState = REGX_T_OR; + break; + case chAsterisk: + nextState = REGX_T_STAR; + break; + case chPlus: + nextState = REGX_T_PLUS; + break; + case chQuestion: + nextState = REGX_T_QUESTION; + break; + case chCloseParen: + nextState = REGX_T_RPAREN; + break; + case chPeriod: + nextState = REGX_T_DOT; + break; + case chOpenSquare: + nextState = REGX_T_LBRACKET; + break; + case chCaret: + nextState = REGX_T_CARET; + break; + case chDollarSign: + nextState = REGX_T_DOLLAR; + break; + case chOpenParen: + nextState = REGX_T_LPAREN; + break; + case chBackSlash: + nextState = REGX_T_BACKSOLIDUS; + if (fOffset >= fStringLen) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Next1, fMemoryManager); + } + + fCharData = fString[fOffset++]; + break; + default: + nextState = REGX_T_CHAR; + if (RegxUtil::isHighSurrogate(ch) && fOffset < fStringLen) { + + XMLCh lowCh = fString[fOffset]; + if (RegxUtil::isLowSurrogate(lowCh)) { + fCharData = RegxUtil::composeFromSurrogate(ch, lowCh); + fOffset++; + } + else { + throw XMLErrs::Expected2ndSurrogateChar; + } + } + } + + fState = nextState; +} + + +Token* RegxParser::parseRegx(const bool matchingRParen) { + + Token* tok = parseTerm(matchingRParen); + Token* parentTok = 0; + + while (fState == REGX_T_OR) { + + processNext(); + if (parentTok == 0) { + + parentTok = fTokenFactory->createUnion(); + parentTok->addChild(tok, fTokenFactory); + tok = parentTok; + } + + tok->addChild(parseTerm(matchingRParen), fTokenFactory); + } + + return tok; +} + + +Token* RegxParser::parseTerm(const bool matchingRParen) { + + parserState state = fState; + + if (state == REGX_T_OR || state == REGX_T_EOF + || (state == REGX_T_RPAREN && matchingRParen)) { + return fTokenFactory->createToken(Token::T_EMPTY); + } + else { + + Token* tok = parseFactor(); + Token* concatTok = 0; + + while ((state = fState) != REGX_T_OR && state != REGX_T_EOF + && (state != REGX_T_RPAREN || !matchingRParen)) + { + if (concatTok == 0) { + + concatTok = fTokenFactory->createUnion(true); + concatTok->addChild(tok, fTokenFactory); + tok = concatTok; + } + concatTok->addChild(parseFactor(), fTokenFactory); + } + + return tok; + } +} + + +Token* RegxParser::processCaret() { + + processNext(); + return fTokenFactory->getLineBegin(); +} + + +Token* RegxParser::processDollar() { + + processNext(); + return fTokenFactory->getLineEnd(); +} + + +Token* RegxParser::processStar(Token* const tok) { + + processNext(); + + if (fState == REGX_T_QUESTION) { + processNext(); + return fTokenFactory->createClosure(tok, true); + } + + return fTokenFactory->createClosure(tok); +} + + +Token* RegxParser::processPlus(Token* const tok) { + + processNext(); + + if (fState == REGX_T_QUESTION) { + processNext(); + return fTokenFactory->createConcat(tok, + fTokenFactory->createClosure(tok,true)); + } + + return fTokenFactory->createConcat(tok, + fTokenFactory->createClosure(tok)); +} + + +Token* RegxParser::processQuestion(Token* const tok) { + + processNext(); + + Token* parentTok = fTokenFactory->createUnion(); + + if (fState == REGX_T_QUESTION) { + processNext(); + parentTok->addChild(fTokenFactory->createToken(Token::T_EMPTY), fTokenFactory); + parentTok->addChild(tok, fTokenFactory); + } + else { + parentTok->addChild(tok, fTokenFactory); + parentTok->addChild(fTokenFactory->createToken(Token::T_EMPTY), fTokenFactory); + } + + return parentTok; +} + + +Token* RegxParser::processParen() { + + processNext(); + int num = fNoGroups++; + Token* tok = fTokenFactory->createParenthesis(parseRegx(true),num); + + if (fState != REGX_T_RPAREN) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Factor1, fMemoryManager); + + processNext(); + return tok; +} + + +Token* RegxParser::processBackReference() { + + XMLSize_t position = fOffset - 2; + + // Handle multi digit back references + int refNo = fCharData - chDigit_0; + while(true) { + processNext(); + if(fState != REGX_T_CHAR || fCharData < chDigit_0 || fCharData > chDigit_9) + break; + + int nextRefNo = (refNo * 10) + fCharData - chDigit_0; + if(nextRefNo >= fNoGroups) + break; + + refNo = nextRefNo; + } + + Token* tok = fTokenFactory->createBackReference(refNo); + + fHasBackReferences = true; + if (fReferences == 0) { + fReferences = new (fMemoryManager) RefVectorOf(8, true, fMemoryManager); + } + + fReferences->addElement(new (fMemoryManager) ReferencePosition(refNo, position)); + return tok; +} + + +Token* RegxParser::parseFactor() { + + Token* tok = parseAtom(); + + switch(fState) { + + case REGX_T_STAR: + return processStar(tok); + case REGX_T_PLUS: + return processPlus(tok); + case REGX_T_QUESTION: + return processQuestion(tok); + case REGX_T_CHAR: + if (fCharData == chOpenCurly && fOffset < fStringLen) { + + int min = 0; + int max = -1; + XMLInt32 ch = fString[fOffset++]; + + if (ch >= chDigit_0 && ch <= chDigit_9) { + + min = ch - chDigit_0; + while (fOffset < fStringLen + && (ch = fString[fOffset++]) >= chDigit_0 + && ch <= chDigit_9) { + + min = min*10 + ch - chDigit_0; + } + + if (min < 0) + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier5, fString, fMemoryManager); + } + else { + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier1, fString, fMemoryManager); + } + + max = min; + + if (ch == chComma) { + + if (fOffset >= fStringLen) { + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier3, fString, fMemoryManager); + } + else if ((ch = fString[fOffset++]) >= chDigit_0 && ch <= chDigit_9) { + + max = ch - chDigit_0; + while (fOffset < fStringLen + && (ch = fString[fOffset++]) >= chDigit_0 + && ch <= chDigit_9) { + + max = max*10 + ch - chDigit_0; + } + + if (max < 0) + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier5, fString, fMemoryManager); + else if (min > max) + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier4, fString, fMemoryManager); + } + else { + max = -1; + } + } + + if (ch != chCloseCurly) { + ThrowXMLwithMemMgr1(ParseException, XMLExcepts::Parser_Quantifier2, fString, fMemoryManager); + } + + if (checkQuestion(fOffset)) { + + tok = fTokenFactory->createClosure(tok, true); + fOffset++; + } + else { + tok = fTokenFactory->createClosure(tok); + } + + tok->setMin(min); + tok->setMax(max); + processNext(); + } + break; + default: + break; + } + + return tok; +} + + +Token* RegxParser::parseAtom() { + + Token* tok = 0; + + switch(fState) { + + case REGX_T_LPAREN: + return processParen(); + case REGX_T_DOT: + processNext(); + tok = fTokenFactory->getDot(); + break; + case REGX_T_CARET: + return processCaret(); + case REGX_T_DOLLAR: + return processDollar(); + case REGX_T_LBRACKET: + return parseCharacterClass(true); + case REGX_T_BACKSOLIDUS: + switch(fCharData) { + + case chLatin_d: + case chLatin_D: + case chLatin_w: + case chLatin_W: + case chLatin_s: + case chLatin_S: + case chLatin_c: + case chLatin_C: + case chLatin_i: + case chLatin_I: + tok = getTokenForShorthand(fCharData); + processNext(); + return tok; + case chDigit_0: + case chDigit_1: + case chDigit_2: + case chDigit_3: + case chDigit_4: + case chDigit_5: + case chDigit_6: + case chDigit_7: + case chDigit_8: + case chDigit_9: + return processBackReference(); + case chLatin_p: + case chLatin_P: + { + tok = processBacksolidus_pP(fCharData); + if (tok == 0) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom5, fMemoryManager); + } + } + break; + default: + { + XMLInt32 ch = decodeEscaped(); + if (ch < 0x10000) { + tok = fTokenFactory->createChar(ch); + } + else { + + XMLCh* surrogateStr = RegxUtil::decomposeToSurrogates(ch, fMemoryManager); + ArrayJanitor janSurrogate(surrogateStr, fMemoryManager); + tok = fTokenFactory->createString(surrogateStr); + } + } + break; + } // end switch + + processNext(); + break; + case REGX_T_CHAR: + if (fCharData == chOpenCurly + || fCharData == chCloseCurly + || fCharData == chCloseSquare) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom4, fMemoryManager); + + tok = fTokenFactory->createChar(fCharData); + processNext(); + break; + default: + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom4, fMemoryManager); + } //end switch + + return tok; +} + + +RangeToken* RegxParser::processBacksolidus_pP(const XMLInt32 ch) { + + processNext(); + + if (fState != REGX_T_CHAR || fCharData != chOpenCurly) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom2, fMemoryManager); + + XMLSize_t nameStart = fOffset; + int nameEnd = XMLString::indexOf(fString,chCloseCurly,nameStart, fMemoryManager); + + if (nameEnd < 0) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom3, fMemoryManager); + + fOffset = nameEnd + 1; + XMLCh* rangeName = (XMLCh*) fMemoryManager->allocate + ( + (nameEnd - nameStart + 1) * sizeof(XMLCh) + );//new XMLCh[(nameEnd - nameStart) + 1]; + ArrayJanitor janRangeName(rangeName, fMemoryManager); + XMLString::subString(rangeName, fString, nameStart, nameEnd, fMemoryManager); + + return fTokenFactory->getRange(rangeName, !(ch == chLatin_p)); +} + +RangeToken* RegxParser::parseCharacterClass(const bool useNRange) { + + setParseContext(regexParserStateInBrackets); + processNext(); + + RangeToken* tok = 0; + bool isNRange = false; + + if (getState() == REGX_T_CHAR && getCharData() == chCaret) { + isNRange = true; + processNext(); + } + tok = fTokenFactory->createRange(); + + parserState type; + bool firstLoop = true; + bool wasDecoded; + + while ( (type = getState()) != REGX_T_EOF) { + + wasDecoded = false; + + // single range | from-to-range | subtraction + if (type == REGX_T_CHAR && getCharData() == chCloseSquare && !firstLoop) + break; + + XMLInt32 ch = getCharData(); + bool end = false; + + if (type == REGX_T_BACKSOLIDUS) { + + switch(ch) { + case chLatin_d: + case chLatin_D: + case chLatin_w: + case chLatin_W: + case chLatin_s: + case chLatin_S: + case chLatin_i: + case chLatin_I: + case chLatin_c: + case chLatin_C: + { + tok->mergeRanges(getTokenForShorthand(ch)); + end = true; + } + break; + case chLatin_p: + case chLatin_P: + { + RangeToken* tok2 = processBacksolidus_pP(ch); + + if (tok2 == 0) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Atom5, getMemoryManager()); + } + + tok->mergeRanges(tok2); + end = true; + } + break; + case chDash: + wasDecoded = true; + // fall thru to default. + default: + ch = decodeEscaped(); + } + } // end if REGX_T_BACKSOLIDUS + else if (type == REGX_T_XMLSCHEMA_CC_SUBTRACTION && !firstLoop) { + + if (isNRange) + { + tok = RangeToken::complementRanges(tok, fTokenFactory, fMemoryManager); + isNRange=false; + } + RangeToken* rangeTok = parseCharacterClass(false); + tok->subtractRanges(rangeTok); + + if (getState() != REGX_T_CHAR || getCharData() != chCloseSquare) { + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC5, getMemoryManager()); + } + break; + } // end if REGX_T_XMLSCHEMA... + + processNext(); + + if (!end) { + + if (type == REGX_T_CHAR + && (ch == chOpenSquare + || ch == chCloseSquare + || (ch == chDash && getCharData() == chCloseSquare && firstLoop))) { + // if regex = [-] then invalid... + // '[', ']', '-' not allowed and should be escaped + XMLCh chStr[] = { ch, chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_CC6, chStr, chStr, getMemoryManager()); + } + if (ch == chDash && getCharData() == chDash && getState() != REGX_T_BACKSOLIDUS && !wasDecoded) { + XMLCh chStr[] = { ch, chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_CC6, chStr, chStr, getMemoryManager()); + } + + if (getState() != REGX_T_CHAR || getCharData() != chDash) { + tok->addRange(ch, ch); + } + else { + + processNext(); + if ((type = getState()) == REGX_T_EOF) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC2, getMemoryManager()); + + if (type == REGX_T_CHAR && getCharData() == chCloseSquare) { + tok->addRange(ch, ch); + tok->addRange(chDash, chDash); + } + else if (type == REGX_T_XMLSCHEMA_CC_SUBTRACTION) { + + static const XMLCh dashStr[] = { chDash, chNull}; + ThrowXMLwithMemMgr2(ParseException, XMLExcepts::Parser_CC6, dashStr, dashStr, getMemoryManager()); + } + else { + + XMLInt32 rangeEnd = getCharData(); + XMLCh rangeEndStr[] = { rangeEnd, chNull }; + + if (type == REGX_T_CHAR) { + + if (rangeEnd == chOpenSquare + || rangeEnd == chCloseSquare + || rangeEnd == chDash) + // '[', ']', '-' not allowed and should be escaped + ThrowXMLwithMemMgr2(ParseException, XMLExcepts::Parser_CC6, rangeEndStr, rangeEndStr, getMemoryManager()); + } + else if (type == REGX_T_BACKSOLIDUS) { + rangeEnd = decodeEscaped(); + } + + processNext(); + + if (ch > rangeEnd) { + XMLCh chStr[] = { ch, chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_Ope3, rangeEndStr, chStr, getMemoryManager()); + } + + tok->addRange(ch, rangeEnd); + } + } + } + firstLoop = false; + } + + if (getState() == REGX_T_EOF) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC2, getMemoryManager()); + + if (isNRange) + { + if(useNRange) + tok->setTokenType(Token::T_NRANGE); + else + tok = RangeToken::complementRanges(tok, fTokenFactory, fMemoryManager); + } + + tok->sortRanges(); + tok->compactRanges(); + + // If the case-insensitive option is enabled, we need to + // have the new RangeToken instance build its internal + // case-insensitive RangeToken. + if (RegularExpression::isSet(fOptions, RegularExpression::IGNORE_CASE)) + { + tok->getCaseInsensitiveToken(fTokenFactory); + } + + setParseContext(regexParserStateNormal); + processNext(); + + return tok; +} + + +RangeToken* RegxParser::getTokenForShorthand(const XMLInt32 ch) { + + switch(ch) { + case chLatin_d: + return fTokenFactory->getRange(fgUniDecimalDigit); + //return fTokenFactory->getRange(fgXMLDigit); + case chLatin_D: + return fTokenFactory->getRange(fgUniDecimalDigit, true); + //return fTokenFactory->getRange(fgXMLDigit, true); + case chLatin_w: + return fTokenFactory->getRange(fgXMLWord); + case chLatin_W: + return fTokenFactory->getRange(fgXMLWord, true); + case chLatin_s: + return fTokenFactory->getRange(fgXMLSpace); + case chLatin_S: + return fTokenFactory->getRange(fgXMLSpace, true); + case chLatin_c: + return fTokenFactory->getRange(fgXMLNameChar); + case chLatin_C: + return fTokenFactory->getRange(fgXMLNameChar, true); + case chLatin_i: + return fTokenFactory->getRange(fgXMLInitialNameChar); + case chLatin_I: + return fTokenFactory->getRange(fgXMLInitialNameChar, true); +// default: +// ThrowXMLwithMemMgr(RuntimeException, "Invalid shorthand {0}", chAsString) + } + + return 0; +} + + +XMLInt32 RegxParser::decodeEscaped() { + + if (fState != REGX_T_BACKSOLIDUS) + ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Next1, getMemoryManager()); + + XMLInt32 ch = fCharData; + + switch (ch) { + case chLatin_n: + ch = chLF; + break; + case chLatin_r: + ch = chCR; + break; + case chLatin_t: + ch = chHTab; + break; + case chBackSlash: + case chPipe: + case chPeriod: + case chCaret: + case chDash: + case chQuestion: + case chAsterisk: + case chPlus: + case chOpenCurly: + case chCloseCurly: + case chOpenParen: + case chCloseParen: + case chOpenSquare: + case chCloseSquare: + case chDollarSign: + break; + default: + { + XMLCh chString[] = {chBackSlash, ch, chNull}; + ThrowXMLwithMemMgr1(ParseException,XMLExcepts::Parser_Process2, chString, getMemoryManager()); + } + } + + return ch; +} + +// --------------------------------------------------------------------------- +// RegxParser: Helper Methods +// --------------------------------------------------------------------------- +bool RegxParser::checkQuestion(const XMLSize_t off) { + + return ((off < fStringLen) && fString[off] == chQuestion); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End file RegxParser.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RegxParser.hpp b/project/jni/xerces/src/xercesc/util/regx/RegxParser.hpp new file mode 100644 index 000000000..f0417c7f4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegxParser.hpp @@ -0,0 +1,284 @@ +/* + * 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: RegxParser.hpp 711369 2008-11-04 20:03:14Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REGXPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_REGXPARSER_HPP + +/* + * A regular expression parser + */ +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class Token; +class RangeToken; +class TokenFactory; + +class XMLUTIL_EXPORT RegxParser : public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Public constant data + // ----------------------------------------------------------------------- + // Parse tokens + typedef enum { + REGX_T_CHAR = 0, + REGX_T_EOF = 1, + REGX_T_OR = 2, + REGX_T_STAR = 3, + REGX_T_PLUS = 4, + REGX_T_QUESTION = 5, + REGX_T_LPAREN = 6, + REGX_T_RPAREN = 7, + REGX_T_DOT = 8, + REGX_T_LBRACKET = 9, + REGX_T_BACKSOLIDUS = 10, + REGX_T_CARET = 11, + REGX_T_DOLLAR = 12, + REGX_T_XMLSCHEMA_CC_SUBTRACTION = 13 + } parserState; + + typedef enum { + regexParserStateNormal = 0, + regexParserStateInBrackets = 1 + } parserStateContext; + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + RegxParser(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~RegxParser(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + parserStateContext getParseContext() const; + parserState getState() const; + XMLInt32 getCharData() const; + int getNoParen() const; + XMLSize_t getOffset() const; + bool hasBackReferences() const; + TokenFactory* getTokenFactory() const; + int getOptions() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setParseContext(const parserStateContext value); + void setTokenFactory(TokenFactory* const tokFactory); + void setOptions(const int options); + + // ----------------------------------------------------------------------- + // Public Parsing methods + // ----------------------------------------------------------------------- + Token* parse(const XMLCh* const regxStr, const int options); + +protected: + // ----------------------------------------------------------------------- + // Protected Helper methods + // ----------------------------------------------------------------------- + virtual bool checkQuestion(const XMLSize_t off); + virtual XMLInt32 decodeEscaped(); + MemoryManager* getMemoryManager() const; + // ----------------------------------------------------------------------- + // Protected Parsing/Processing methods + // ----------------------------------------------------------------------- + void processNext(); + + Token* parseRegx(const bool matchingRParen = false); + virtual Token* processCaret(); + virtual Token* processDollar(); + virtual Token* processBackReference(); + virtual Token* processStar(Token* const tok); + virtual Token* processPlus(Token* const tok); + virtual Token* processQuestion(Token* const tok); + virtual Token* processParen(); + + RangeToken* parseCharacterClass(const bool useNRange); + RangeToken* processBacksolidus_pP(const XMLInt32 ch); + + // ----------------------------------------------------------------------- + // Protected PreCreated RangeToken access methods + // ----------------------------------------------------------------------- + RangeToken* getTokenForShorthand(const XMLInt32 ch); + + bool isSet(const int flag); +private: + // ----------------------------------------------------------------------- + // Private parsing/processing methods + // ----------------------------------------------------------------------- + Token* parseTerm(const bool matchingRParen = false); + Token* parseFactor(); + Token* parseAtom(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RegxParser(const RegxParser&); + RegxParser& operator=(const RegxParser&); + + // ----------------------------------------------------------------------- + // Private data types + // ----------------------------------------------------------------------- + class ReferencePosition : public XMemory + { + public : + ReferencePosition(const int refNo, const XMLSize_t position); + + int fReferenceNo; + XMLSize_t fPosition; + }; + + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + int hexChar(const XMLInt32 ch); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + bool fHasBackReferences; + int fOptions; + XMLSize_t fOffset; + int fNoGroups; + parserStateContext fParseContext; + XMLSize_t fStringLen; + parserState fState; + XMLInt32 fCharData; + XMLCh* fString; + RefVectorOf* fReferences; + TokenFactory* fTokenFactory; +}; + + +// --------------------------------------------------------------------------- +// RegxParser: Getter Methods +// --------------------------------------------------------------------------- +inline RegxParser::parserStateContext RegxParser::getParseContext() const { + + return fParseContext; +} + +inline RegxParser::parserState RegxParser::getState() const { + + return fState; +} + +inline XMLInt32 RegxParser::getCharData() const { + + return fCharData; +} + +inline int RegxParser::getNoParen() const { + + return fNoGroups; +} + +inline XMLSize_t RegxParser::getOffset() const { + + return fOffset; +} + +inline bool RegxParser::hasBackReferences() const { + + return fHasBackReferences; +} + +inline TokenFactory* RegxParser::getTokenFactory() const { + + return fTokenFactory; +} + +inline MemoryManager* RegxParser::getMemoryManager() const { + return fMemoryManager; +} + +inline int RegxParser::getOptions() const { + + return fOptions; +} + +// --------------------------------------------------------------------------- +// RegxParser: Setter Methods +// --------------------------------------------------------------------------- +inline void RegxParser::setParseContext(const RegxParser::parserStateContext value) { + + fParseContext = value; +} + +inline void RegxParser::setTokenFactory(TokenFactory* const tokFactory) { + + fTokenFactory = tokFactory; +} + +inline void RegxParser::setOptions(const int options) { + + fOptions = options; +} + +// --------------------------------------------------------------------------- +// RegxParser: Helper Methods +// --------------------------------------------------------------------------- +inline bool RegxParser::isSet(const int flag) { + + return (fOptions & flag) == flag; +} + + +inline int RegxParser::hexChar(const XMLInt32 ch) { + + if (ch < chDigit_0 || ch > chLatin_f) + return -1; + + if (ch <= chDigit_9) + return ch - chDigit_0; + + if (ch < chLatin_A) + return -1; + + if (ch <= chLatin_F) + return ch - chLatin_A + 10; + + if (ch < chLatin_a) + return -1; + + return ch - chLatin_a + 10; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file RegxParser.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/RegxUtil.cpp b/project/jni/xerces/src/xercesc/util/regx/RegxUtil.cpp new file mode 100644 index 000000000..b3feec70c --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegxUtil.cpp @@ -0,0 +1,103 @@ +/* + * 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: RegxUtil.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLCh* RegxUtil::decomposeToSurrogates(XMLInt32 ch, + MemoryManager* const manager) { + + XMLCh* pszStr = (XMLCh*) manager->allocate(3 * sizeof(XMLCh));//new XMLCh[3]; + + decomposeToSurrogates(ch, pszStr[0], pszStr[1]); + + pszStr[2] = chNull; + + return pszStr; +} + + +XMLCh* RegxUtil::stripExtendedComment(const XMLCh* const expression, + MemoryManager* const manager) { + + XMLCh* buffer = (manager) ? XMLString::replicate(expression, manager) + : XMLString::replicate(expression); + + if (buffer) + { + const XMLCh* inPtr = expression; + XMLCh* outPtr = buffer; + + while (*inPtr) { + + XMLCh ch = *inPtr++; + + if (ch == chFF || ch == chCR || ch == chLF + || ch == chSpace || ch == chHTab) { + continue; + } + + // Skips chracters between '#' and a line end. + if (ch == chPound) { + + while (*inPtr) { + + ch = *inPtr++; + if (ch == chLF || ch == chCR) + break; + } + + continue; + } + + if (ch == chBackSlash && *inPtr) { + + if ((ch = *inPtr++) == chPound || ch == chHTab || ch == chLF + || ch == chFF || ch == chCR || ch == chSpace) { + *outPtr++ = ch; + } + else { // Other escaped character. + + *outPtr++ = chBackSlash; + *outPtr++ = ch; + } + } + else { // As is. + *outPtr++ = ch; + } + } + + *outPtr = chNull; // null terminate + } + + return buffer; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file RegxUtil.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/RegxUtil.hpp b/project/jni/xerces/src/xercesc/util/regx/RegxUtil.hpp new file mode 100644 index 000000000..6d411c943 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/RegxUtil.hpp @@ -0,0 +1,109 @@ +/* + * 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: RegxUtil.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_REGXUTIL_HPP) +#define XERCESC_INCLUDE_GUARD_REGXUTIL_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +class MemoryManager; + +class XMLUTIL_EXPORT RegxUtil { +public: + + // ----------------------------------------------------------------------- + // Constructors and destructors + // ----------------------------------------------------------------------- + ~RegxUtil() {} + + static XMLInt32 composeFromSurrogate(const XMLCh high, const XMLCh low); + static bool isEOLChar(const XMLCh); + static bool isWordChar(const XMLCh); + static bool isLowSurrogate(const XMLCh ch); + static bool isHighSurrogate(const XMLCh ch); + static void decomposeToSurrogates(XMLInt32 ch, XMLCh& high, XMLCh& low); + + static XMLCh* decomposeToSurrogates(XMLInt32 ch, + MemoryManager* const manager); + static XMLCh* stripExtendedComment(const XMLCh* const expression, + MemoryManager* const manager = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + RegxUtil(); +}; + + +inline bool RegxUtil::isEOLChar(const XMLCh ch) { + + return (ch == chLF || ch == chCR || ch == chLineSeparator + || ch == chParagraphSeparator); +} + +inline XMLInt32 RegxUtil::composeFromSurrogate(const XMLCh high, const XMLCh low) { + // see http://unicode.org/unicode/faq/utf_bom.html#35 + const XMLInt32 SURROGATE_OFFSET = 0x10000 - (0xD800 << 10) - 0xDC00; + return (high << 10) + low + SURROGATE_OFFSET; +} + +inline bool RegxUtil::isLowSurrogate(const XMLCh ch) { + + return (ch & 0xFC00) == 0xDC00; +} + +inline bool RegxUtil::isHighSurrogate(const XMLCh ch) { + + return (ch & 0xFC00) == 0xD800; +} + +inline void RegxUtil::decomposeToSurrogates(XMLInt32 ch, XMLCh& high, XMLCh& low) { + // see http://unicode.org/unicode/faq/utf_bom.html#35 + const XMLInt32 LEAD_OFFSET = 0xD800 - (0x10000 >> 10); + high = XMLCh(LEAD_OFFSET + (ch >> 10)); + low = XMLCh(0xDC00 + (ch & 0x3FF)); +} + +inline bool RegxUtil::isWordChar(const XMLCh ch) { + + if ((ch == chUnderscore) + || (ch >= chDigit_0 && ch <= chDigit_9) + || (ch >= chLatin_A && ch <= chLatin_Z) + || (ch >= chLatin_a && ch <= chLatin_z)) + return true; + + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file RegxUtil.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/StringToken.cpp b/project/jni/xerces/src/xercesc/util/regx/StringToken.cpp new file mode 100644 index 000000000..0b6417438 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/StringToken.cpp @@ -0,0 +1,54 @@ +/* + * 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: StringToken.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Token: Constructors and Destructors +// --------------------------------------------------------------------------- +StringToken::StringToken(const Token::tokType tkType, + const XMLCh* const literal, + const int refNo, + MemoryManager* const manager) + : Token(tkType, manager) + , fRefNo(refNo) + , fString(XMLString::replicate(literal, manager)) + , fMemoryManager(manager) +{ + +} + + +StringToken::~StringToken() { + + fMemoryManager->deallocate(fString);//delete [] fString; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file StringToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/StringToken.hpp b/project/jni/xerces/src/xercesc/util/regx/StringToken.hpp new file mode 100644 index 000000000..c16c42ec9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/StringToken.hpp @@ -0,0 +1,100 @@ +/* + * 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: StringToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_STRINGTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_STRINGTOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT StringToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + StringToken(const tokType tkType, + const XMLCh* const literal, + const int refNo, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~StringToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + int getReferenceNo() const; + const XMLCh* getString() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setString(const XMLCh* const literal); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + StringToken(const StringToken&); + StringToken& operator=(const StringToken&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + int fRefNo; + XMLCh* fString; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// StringToken: getter methods +// --------------------------------------------------------------------------- +inline int StringToken::getReferenceNo() const { + + return fRefNo; +} + +inline const XMLCh* StringToken::getString() const { + + return fString; +} + +// --------------------------------------------------------------------------- +// StringToken: Setter methods +// --------------------------------------------------------------------------- +inline void StringToken::setString(const XMLCh* const literal) { + + fMemoryManager->deallocate(fString);//delete [] fString; + fString = 0; + fString = XMLString::replicate(literal, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file StringToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/Token.cpp b/project/jni/xerces/src/xercesc/util/regx/Token.cpp new file mode 100644 index 000000000..3c5106c11 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Token.cpp @@ -0,0 +1,369 @@ +/* + * 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: Token.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Static member data initialization +// --------------------------------------------------------------------------- +const XMLInt32 Token::UTF16_MAX = 0x10FFFF; + +// --------------------------------------------------------------------------- +// Token: Constructors and Destructors +// --------------------------------------------------------------------------- +Token::Token(const Token::tokType tkType + , MemoryManager* const manager) + : fTokenType(tkType) + , fMemoryManager(manager) +{ + +} + + +Token::~Token() { + +} + +// --------------------------------------------------------------------------- +// Token: Getter mthods +// --------------------------------------------------------------------------- +XMLSize_t Token::getMinLength() const { + + switch (fTokenType) { + + case T_CONCAT: + { + XMLSize_t sum = 0; + XMLSize_t childSize = size(); + + for (XMLSize_t i=0; igetMinLength(); + } + return sum; + } + case T_UNION: + { + XMLSize_t childSize = size(); + + if (childSize == 0) { + return 0; + } + XMLSize_t ret = getChild(0)->getMinLength(); + + for (XMLSize_t i=1; i < childSize; i++) { + + XMLSize_t min = getChild(i)->getMinLength(); + if (min < ret) + ret = min; + } + return ret; + } + case T_CLOSURE: + case T_NONGREEDYCLOSURE: + if (getMin() >= 0) + return getMin() * getChild(0)->getMinLength(); + + return 0; + case T_EMPTY: + case T_ANCHOR: + return 0; + case T_DOT: + case T_CHAR: + case T_RANGE: + case T_NRANGE: + return 1; + case T_PAREN: + return getChild(0)->getMinLength(); + case T_BACKREFERENCE: + return 0; // ***** - REVISIT + case T_STRING: + return XMLString::stringLen(getString()); +// default: +// throw; + } + + // We should not get here, but we have it to make some compilers happy + return (XMLSize_t)-1; +} + + +int Token::getMaxLength() const { + + switch (fTokenType) { + + case T_CONCAT: + { + int sum = 0; + XMLSize_t childSize = size(); + + for (XMLSize_t i=0; igetMaxLength(); + + if (val < 0){ + return -1; + } + sum += val; + } + return sum; + } + case T_UNION: + { + XMLSize_t childSize = size(); + + if (childSize == 0) + return 0; + + int ret = getChild(0)->getMaxLength(); + + for (XMLSize_t i = 1; ret > 0 && i < childSize; i++) { + + int max = getChild(i)->getMaxLength(); + + if (max < 0) { + + ret = -1; + break; + } + + if (max > ret) + ret = max; + } + return ret; + } + case T_CLOSURE: + case T_NONGREEDYCLOSURE: + if (getMax() >= 0) { + return getMax() * getChild(0)->getMaxLength(); + } + return -1; + case T_EMPTY: + case T_ANCHOR: + return 0; + case T_CHAR: + return 1; + case T_DOT: + case T_RANGE: + case T_NRANGE: + return 2; + case T_PAREN: + return getChild(0)->getMaxLength(); + case T_BACKREFERENCE: + return -1; // REVISIT + case T_STRING: + return (int)XMLString::stringLen(getString()); +// default: +// throw; //ThrowXML(RuntimeException, ...) + } // end switch + + return -1; +} + +// --------------------------------------------------------------------------- +// Token: Helper mthods +// --------------------------------------------------------------------------- +Token::firstCharacterOptions Token::analyzeFirstCharacter(RangeToken* const rangeTok, + const int options, + TokenFactory* const tokFactory) +{ + switch(fTokenType) { + case T_CONCAT: + { + firstCharacterOptions ret = FC_CONTINUE; + for (XMLSize_t i=0; ianalyzeFirstCharacter(rangeTok, + options, tokFactory))!= FC_CONTINUE) + break; + } + return ret; + } + case T_UNION: + { + XMLSize_t childSize = size(); + if (childSize == 0) + return FC_CONTINUE; + + firstCharacterOptions ret = FC_CONTINUE; + bool hasEmpty = false; + + for (XMLSize_t i=0; i < childSize; i++) { + + ret = getChild(i)->analyzeFirstCharacter(rangeTok, options, tokFactory); + + if (ret == FC_ANY) + break; + else + hasEmpty = true; + } + return hasEmpty ? FC_CONTINUE : ret; + } + case T_CLOSURE: + case T_NONGREEDYCLOSURE: + { + Token* tok = getChild(0); + if (tok) + tok->analyzeFirstCharacter(rangeTok, options, tokFactory); + return FC_CONTINUE; + } + case T_DOT: + return FC_ANY; + case T_EMPTY: + case T_ANCHOR: + return FC_CONTINUE; + case T_CHAR: + { + XMLInt32 ch = getChar(); + rangeTok->addRange(ch, ch); + if (ch < 0x1000 && isSet(options,RegularExpression::IGNORE_CASE)) { + //REVISIT + } + } + return FC_TERMINAL; + case T_RANGE: + { + if (isSet(options, RegularExpression::IGNORE_CASE)) { + rangeTok->mergeRanges(((RangeToken*) + this)->getCaseInsensitiveToken(tokFactory)); + } + else { + rangeTok->mergeRanges(this); + } + return FC_TERMINAL; + } + case T_NRANGE: + { + if (isSet(options, RegularExpression::IGNORE_CASE)) { + + RangeToken* caseITok = (((RangeToken*) + this)->getCaseInsensitiveToken(tokFactory)); + rangeTok->mergeRanges(RangeToken::complementRanges(caseITok, tokFactory, fMemoryManager)); + } + else { + rangeTok->mergeRanges( + RangeToken::complementRanges((RangeToken*) this, tokFactory, fMemoryManager)); + } + } + case T_PAREN: + { + Token* tok = getChild(0); + if (tok) + return tok->analyzeFirstCharacter(rangeTok,options, tokFactory); + } + case T_BACKREFERENCE: + rangeTok->addRange(0, UTF16_MAX); + return FC_ANY; + case T_STRING: + { + const XMLCh* str = getString(); + XMLInt32 ch = str[0]; + + if (RegxUtil::isHighSurrogate((XMLCh) ch)) { + } + + rangeTok->addRange(ch, ch); + if (ch<0x10000 && isSet(options,RegularExpression::IGNORE_CASE)) { + //REVISIT + } + } + return FC_TERMINAL; +// default: +// throw; + } + + return FC_CONTINUE; +} + + +Token* Token::findFixedString(int options, int& outOptions) { + + switch(fTokenType) { + + case T_CHAR: + return 0; + case T_STRING: + outOptions = options; + return this; + case T_UNION: + case T_CLOSURE: + case T_NONGREEDYCLOSURE: + case T_EMPTY: + case T_ANCHOR: + case T_RANGE: + case T_NRANGE: + case T_DOT: + case T_BACKREFERENCE: + return 0; + case T_PAREN: + return getChild(0)->findFixedString(options, outOptions); + case T_CONCAT: + { + Token* prevTok = 0; + int prevOptions = 0; + + for (XMLSize_t i=0; ifindFixedString(options, outOptions); + + if (prevTok == 0 || prevTok->isShorterThan(tok)) { + + prevTok = tok; + prevOptions = outOptions; + } + } + + outOptions = prevOptions; + return prevTok; + } + } // end switch + + return 0; +} + + +bool Token::isShorterThan(Token* const tok) { + + if (tok == 0) + return false; + + if (getTokenType() != T_STRING && tok->getTokenType() != T_STRING) + return false; //Should we throw an exception? + + XMLSize_t length = XMLString::stringLen(getString()); + XMLSize_t tokLength = XMLString::stringLen(tok->getString()); + + return length < tokLength; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file Token.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/Token.hpp b/project/jni/xerces/src/xercesc/util/regx/Token.hpp new file mode 100644 index 000000000..5b40fb2a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/Token.hpp @@ -0,0 +1,262 @@ +/* + * 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: Token.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_TOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class RangeToken; +class TokenFactory; + + +class XMLUTIL_EXPORT Token : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constants + // ----------------------------------------------------------------------- + // Token types + typedef enum { + T_CHAR = 0, + T_CONCAT = 1, + T_UNION = 2, + T_CLOSURE = 3, + T_RANGE = 4, + T_NRANGE = 5, + T_PAREN = 6, + T_EMPTY = 7, + T_ANCHOR = 8, + T_NONGREEDYCLOSURE = 9, + T_STRING = 10, + T_DOT = 11, + T_BACKREFERENCE = 12 + } tokType; + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + Token(const tokType tkType + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~Token(); + + static const XMLInt32 UTF16_MAX; + + typedef enum { + FC_CONTINUE = 0, + FC_TERMINAL = 1, + FC_ANY = 2 + } firstCharacterOptions; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + tokType getTokenType() const; + XMLSize_t getMinLength() const; + int getMaxLength() const; + virtual Token* getChild(const XMLSize_t index) const; + virtual XMLSize_t size() const; + virtual int getMin() const; + virtual int getMax() const; + virtual int getNoParen() const; + virtual int getReferenceNo() const; + virtual const XMLCh* getString() const; + virtual XMLInt32 getChar() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setTokenType(const tokType tokType); + virtual void setMin(const int minVal); + virtual void setMax(const int maxVal); + + // ----------------------------------------------------------------------- + // Range manipulation methods + // ----------------------------------------------------------------------- + virtual void addRange(const XMLInt32 start, const XMLInt32 end); + virtual void mergeRanges(const Token *const tok); + virtual void sortRanges(); + virtual void compactRanges(); + virtual void subtractRanges(RangeToken* const tok); + virtual void intersectRanges(RangeToken* const tok); + + // ----------------------------------------------------------------------- + // Putter methods + // ----------------------------------------------------------------------- + virtual void addChild(Token* const child, TokenFactory* const tokFactory); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + firstCharacterOptions analyzeFirstCharacter(RangeToken* const rangeTok, const int options, + TokenFactory* const tokFactory); + Token* findFixedString(int options, int& outOptions); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Token(const Token&); + Token& operator=(const Token&); + + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + bool isSet(const int options, const unsigned int flag); + bool isShorterThan(Token* const tok); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + tokType fTokenType; +protected: + MemoryManager* const fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// Token: getter methods +// --------------------------------------------------------------------------- +inline Token::tokType Token::getTokenType() const { + + return fTokenType; +} + +inline XMLSize_t Token::size() const { + + return 0; +} + +inline Token* Token::getChild(const XMLSize_t) const { + + return 0; +} + +inline int Token::getMin() const { + + return -1; +} + +inline int Token::getMax() const { + + return -1; +} + +inline int Token::getReferenceNo() const { + + return 0; +} + +inline int Token::getNoParen() const { + + return 0; +} + +inline const XMLCh* Token::getString() const { + + return 0; +} + +inline XMLInt32 Token::getChar() const { + + return -1; +} + +// --------------------------------------------------------------------------- +// Token: setter methods +// --------------------------------------------------------------------------- +inline void Token::setTokenType(const Token::tokType tokType) { + + fTokenType = tokType; +} + +inline void Token::setMax(const int) { + // ClosureToken +} + +inline void Token::setMin(const int) { + // ClosureToken +} + +inline bool Token::isSet(const int options, const unsigned int flag) { + + return (options & flag) == flag; +} + +// --------------------------------------------------------------------------- +// Token: setter methods +// --------------------------------------------------------------------------- +inline void Token::addChild(Token* const, TokenFactory* const) { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +// --------------------------------------------------------------------------- +// Token: Range manipulation methods +// --------------------------------------------------------------------------- +inline void Token::addRange(const XMLInt32, const XMLInt32) { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +inline void Token::mergeRanges(const Token *const) { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +inline void Token::sortRanges() { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +inline void Token::compactRanges() { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +inline void Token::subtractRanges(RangeToken* const) { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +inline void Token::intersectRanges(RangeToken* const) { + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file Token.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/TokenFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/TokenFactory.cpp new file mode 100644 index 000000000..7ddf69ff5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/TokenFactory.cpp @@ -0,0 +1,234 @@ +/* + * 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: TokenFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// TokenFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +TokenFactory::TokenFactory(MemoryManager* const manager) : + fTokens(new (manager) RefVectorOf (16, true, manager)) + , fEmpty(0) + , fLineBegin(0) + , fLineEnd(0) + , fDot(0) + , fMemoryManager(manager) +{ + +} + +TokenFactory::~TokenFactory() { + + delete fTokens; + fTokens = 0; +} + +// --------------------------------------------------------------------------- +// TokenFactory - Factory methods +// --------------------------------------------------------------------------- +Token* TokenFactory::createToken(const Token::tokType tkType) { + + if (tkType == Token::T_EMPTY && fEmpty != 0) + return fEmpty; + + Token* tmpTok = new (fMemoryManager) Token(tkType, fMemoryManager); + + if (tkType == Token::T_EMPTY) { + fEmpty = tmpTok; + } + + fTokens->addElement(tmpTok); + + return tmpTok; +} + + +ParenToken* TokenFactory::createParenthesis(Token* const token, + const int noGroups) { + + ParenToken* tmpTok = new (fMemoryManager) ParenToken(Token::T_PAREN, token, noGroups, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +ClosureToken* TokenFactory::createClosure(Token* const token, + bool isNonGreedy) { + + ClosureToken* tmpTok = isNonGreedy ? new (fMemoryManager) ClosureToken(Token::T_NONGREEDYCLOSURE, token, fMemoryManager) + : new (fMemoryManager) ClosureToken(Token::T_CLOSURE, token, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +ConcatToken* TokenFactory::createConcat(Token* const token1, + Token* const token2) { + + ConcatToken* tmpTok = new (fMemoryManager) ConcatToken(token1, token2, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +UnionToken* TokenFactory::createUnion(const bool isConcat) { + + UnionToken* tmpTok = isConcat ? new (fMemoryManager) UnionToken(Token::T_CONCAT, fMemoryManager) + : new (fMemoryManager) UnionToken(Token::T_UNION, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +RangeToken* TokenFactory::createRange(const bool isNegRange){ + + + RangeToken* tmpTok = isNegRange ? new (fMemoryManager) RangeToken(Token::T_NRANGE, fMemoryManager) + : new (fMemoryManager) RangeToken(Token::T_RANGE, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +CharToken* TokenFactory::createChar(const XMLUInt32 ch, const bool isAnchor) { + + CharToken* tmpTok = isAnchor ? new (fMemoryManager) CharToken(Token::T_ANCHOR, ch, fMemoryManager) + : new (fMemoryManager) CharToken(Token::T_CHAR, ch, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +StringToken* TokenFactory::createBackReference(const int noRefs) { + + StringToken* tmpTok = new (fMemoryManager) StringToken(Token::T_BACKREFERENCE, 0, noRefs, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +StringToken* TokenFactory::createString(const XMLCh* const literal) { + + StringToken* tmpTok = new (fMemoryManager) StringToken(Token::T_STRING, literal, 0, fMemoryManager); + + fTokens->addElement(tmpTok); + return tmpTok; +} + +// --------------------------------------------------------------------------- +// TokenFactory - Getter methods +// --------------------------------------------------------------------------- +RangeToken* TokenFactory::staticGetRange(const XMLCh* const keyword, + const bool complement) { + + return RangeTokenMap::instance()->getRange(keyword, complement); +} + +Token* TokenFactory::getLineBegin() { + + if (fLineBegin == 0) + fLineBegin = createChar(chCaret, true); + + return fLineBegin; +} + +Token* TokenFactory::getLineEnd() { + + if (fLineEnd == 0) + fLineEnd = createChar(chDollarSign, true); + + return fLineEnd; +} + +Token* TokenFactory::getDot() { + + if (fDot == 0) + fDot = createToken(Token::T_DOT); + + return fDot; +} + +/* +#if HAVE_CONFIG_H +# include +#endif + +#if XERCES_USE_TRANSCODER_ICU + #include +#endif + +#include +void TokenFactory::printUnicode() { + +#if XERCES_USE_TRANSCODER_ICU + // + // Write it out to a temp file to be read back into this source later. + // + printf("Printing\n"); + //sprintf(msg, "Printing\n"); + FILE* outFl = fopen("table.out", "wt+"); + fprintf(outFl, "const XMLByte fgUniCharsTable[0x10000] =\n{ "); + for (unsigned int index = 0; index <= 0xFFFF; index += 16) + { + fprintf(outFl + , " , 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n" + , (unsigned int)u_charType(index) + , (unsigned int)u_charType(index+1) + , (unsigned int)u_charType(index+2) + , (unsigned int)u_charType(index+3) + , (unsigned int)u_charType(index+4) + , (unsigned int)u_charType(index+5) + , (unsigned int)u_charType(index+6) + , (unsigned int)u_charType(index+7) + , (unsigned int)u_charType(index+8) + , (unsigned int)u_charType(index+9) + , (unsigned int)u_charType(index+10) + , (unsigned int)u_charType(index+11) + , (unsigned int)u_charType(index+12) + , (unsigned int)u_charType(index+13) + , (unsigned int)u_charType(index+14) + , (unsigned int)u_charType(index+15)); + } + fprintf(outFl, "};\n"); + + fclose(outFl); +#endif +} +*/ + +XERCES_CPP_NAMESPACE_END + +/** + * End of file TokenFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/TokenFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/TokenFactory.hpp new file mode 100644 index 000000000..30e2bda6f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/TokenFactory.hpp @@ -0,0 +1,134 @@ +/* + * 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: TokenFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TOKENFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_TOKENFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class RangeToken; +class CharToken; +class ClosureToken; +class ConcatToken; +class ParenToken; +class StringToken; +class UnionToken; + +class XMLUTIL_EXPORT TokenFactory : public XMemory +{ + +public: + // ----------------------------------------------------------------------- + // Constructors and destructors + // ----------------------------------------------------------------------- + TokenFactory(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~TokenFactory(); + + // ----------------------------------------------------------------------- + // Factory methods + // ----------------------------------------------------------------------- + Token* createToken(const Token::tokType tkType); + + ParenToken* createParenthesis(Token* const token, const int noGroups); + ClosureToken* createClosure(Token* const token, bool isNonGreedy = false); + ConcatToken* createConcat(Token* const token1, Token* const token2); + UnionToken* createUnion(const bool isConcat = false); + RangeToken* createRange(const bool isNegRange = false); + CharToken* createChar(const XMLUInt32 ch, const bool isAnchor = false); + StringToken* createBackReference(const int refNo); + StringToken* createString(const XMLCh* const literal); + + + //static void printUnicode(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /* + * Gets a commonly used RangeToken from the token registry based on the + * range name. + */ + RangeToken* getRange(const XMLCh* const name,const bool complement=false); + Token* getLineBegin(); + Token* getLineEnd(); + Token* getDot(); + MemoryManager* getMemoryManager() const; + + static RangeToken* staticGetRange(const XMLCh* const name,const bool complement=false); + + // ----------------------------------------------------------------------- + // Notification that lazy data has been deleted + // ----------------------------------------------------------------------- + static void reinitTokenFactoryMutex(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + TokenFactory(const TokenFactory&); + TokenFactory& operator=(const TokenFactory&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fRangeInitialized + // Indicates whether we have initialized the RangeFactory instance or + // not + // + // fToken + // Contains user created Token objects. Used for memory cleanup. + // ----------------------------------------------------------------------- + RefVectorOf* fTokens; + Token* fEmpty; + Token* fLineBegin; + Token* fLineEnd; + Token* fDot; + MemoryManager* fMemoryManager; +}; + +inline RangeToken* TokenFactory::getRange(const XMLCh* const name,const bool complement) +{ + return staticGetRange(name, complement); +} + +inline MemoryManager* TokenFactory::getMemoryManager() const +{ + return fMemoryManager; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file TokenFactory + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/TokenInc.hpp b/project/jni/xerces/src/xercesc/util/regx/TokenInc.hpp new file mode 100644 index 000000000..e3cfe49e5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/TokenInc.hpp @@ -0,0 +1,43 @@ +/* + * 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: TokenInc.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TOKENINC_HPP) +#define XERCESC_INCLUDE_GUARD_TOKENINC_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file TokenInc.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/UniCharTable.hpp b/project/jni/xerces/src/xercesc/util/regx/UniCharTable.hpp new file mode 100644 index 000000000..a2c9a758f --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/UniCharTable.hpp @@ -0,0 +1,4131 @@ +/* + * 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. + */ + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// These are Unicode character type lookup table. The table is used by the +// XMLUniCharacter class to return the type of a given XMLCh char +// (i.e LowercaseLetter, TitlecaseLetter, DigitOther, etc...) in case +// ICU is not used. +// +// The table is generated by invoking the TokenFactory::printUnicode() +// method (which is commented out). +// --------------------------------------------------------------------------- +const XMLByte fgUniCharsTable[0x10000] = +{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F + , 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F + , 0x0C, 0x17, 0x17, 0x17, 0x19, 0x17, 0x17, 0x17, 0x14, 0x15, 0x17, 0x18, 0x17, 0x13, 0x17, 0x17 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x18, 0x18, 0x18, 0x17 + , 0x17, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x14, 0x17, 0x15, 0x1A, 0x16 + , 0x1A, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x14, 0x18, 0x15, 0x18, 0x0F + , 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F + , 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F + , 0x0C, 0x17, 0x19, 0x19, 0x19, 0x19, 0x1B, 0x1B, 0x1A, 0x1B, 0x02, 0x1C, 0x18, 0x10, 0x1B, 0x1A + , 0x1B, 0x18, 0x0B, 0x0B, 0x1A, 0x02, 0x1B, 0x17, 0x1A, 0x0B, 0x02, 0x1D, 0x0B, 0x0B, 0x0B, 0x17 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x18, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01 + , 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02 + , 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01 + , 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x01 + , 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x05, 0x01, 0x02, 0x02, 0x02 + , 0x05, 0x05, 0x05, 0x05, 0x01, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x01 + , 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x1A, 0x1A, 0x1A, 0x1A, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A + , 0x04, 0x04, 0x04, 0x04, 0x04, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x04, 0x1A + , 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x1A, 0x1A, 0x01, 0x17, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01 + , 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00 + , 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x18, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x1B, 0x06, 0x06, 0x06, 0x06, 0x00, 0x07, 0x07, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x04, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17 + , 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x17, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x17, 0x06 + , 0x17, 0x06, 0x06, 0x17, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x17, 0x1B, 0x1B + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x17 + , 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x05, 0x05 + , 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x17, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x10, 0x07, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x06, 0x06, 0x1B, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x05, 0x05, 0x05, 0x1B, 0x1B, 0x05 + , 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x00, 0x10 + , 0x05, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x05, 0x05, 0x05 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x06, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x05, 0x08, 0x08 + , 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x05, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x06, 0x06, 0x17, 0x17, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05 + , 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x05, 0x08, 0x08 + , 0x08, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x05 + , 0x05, 0x05, 0x06, 0x06, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x05, 0x05, 0x19, 0x19, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x06, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x05 + , 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x00, 0x00, 0x06, 0x00, 0x08, 0x08 + , 0x08, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x06, 0x06, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x06, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05 + , 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x05, 0x08, 0x08 + , 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x08, 0x00, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x06, 0x06, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05 + , 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x05, 0x08, 0x06 + , 0x08, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x05 + , 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x1B, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x06, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x05, 0x00, 0x05, 0x05 + , 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 + , 0x06, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x0B, 0x0B, 0x0B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x19, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x08, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06 + , 0x06, 0x08, 0x08, 0x08, 0x08, 0x00, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x05, 0x08, 0x06 + , 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x06, 0x08, 0x08, 0x00, 0x08, 0x08, 0x06, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00 + , 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 + , 0x08, 0x06, 0x06, 0x06, 0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x06, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x08, 0x08, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x08 + , 0x08, 0x08, 0x06, 0x06, 0x06, 0x00, 0x06, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x08, 0x08, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x06, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x19 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x17 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x05, 0x05, 0x00, 0x05, 0x00, 0x00, 0x05, 0x05, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x00, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05 + , 0x05, 0x06, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x04, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x1B, 0x1B, 0x1B, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17 + , 0x17, 0x17, 0x17, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x06, 0x06, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x06, 0x1B, 0x06, 0x1B, 0x06, 0x14, 0x15, 0x14, 0x15, 0x08, 0x08 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x17, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x06, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x1B + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x00, 0x08, 0x06, 0x06, 0x06 + , 0x06, 0x08, 0x06, 0x00, 0x00, 0x00, 0x06, 0x06, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x09, 0x09, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x17, 0x17, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x0C, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x14, 0x15, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x17, 0x17, 0x17, 0x0A, 0x0A + , 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05 + , 0x05, 0x05, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x06, 0x06, 0x06, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05 + , 0x05, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x10, 0x10, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08 + , 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x06, 0x06, 0x06, 0x06, 0x17, 0x17, 0x17, 0x04, 0x17, 0x17, 0x17, 0x19, 0x05, 0x06, 0x00, 0x00 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x13, 0x17, 0x17, 0x17, 0x17, 0x06, 0x06, 0x06, 0x0C, 0x00 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00 + , 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00 + , 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x00, 0x00, 0x00, 0x17, 0x17, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 + , 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 + , 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x1A, 0x02, 0x1A + , 0x1A, 0x1A, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x1A, 0x1A, 0x1A + , 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x00, 0x1A, 0x1A, 0x1A + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1A, 0x1A, 0x1A + , 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x1A, 0x1A, 0x00 + , 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x10 + , 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x17, 0x17, 0x1C, 0x1D, 0x14, 0x1C, 0x1C, 0x1D, 0x14, 0x1C + , 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x0D, 0x0E, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C + , 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x1C, 0x1D, 0x17, 0x17, 0x17, 0x17, 0x16 + , 0x16, 0x17, 0x17, 0x17, 0x18, 0x14, 0x15, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17 + , 0x17, 0x17, 0x18, 0x17, 0x16, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C + , 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 + , 0x0B, 0x02, 0x00, 0x00, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x18, 0x18, 0x18, 0x14, 0x15, 0x02 + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x18, 0x18, 0x18, 0x14, 0x15, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19 + , 0x19, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07 + , 0x07, 0x06, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x01, 0x1B, 0x1B, 0x1B, 0x1B, 0x01, 0x1B, 0x1B, 0x02, 0x01, 0x01, 0x01, 0x02, 0x02 + , 0x01, 0x01, 0x01, 0x02, 0x1B, 0x01, 0x1B, 0x1B, 0x1B, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x01, 0x1B, 0x01, 0x1B, 0x01, 0x1B, 0x01, 0x01, 0x01, 0x01, 0x1B, 0x02 + , 0x01, 0x01, 0x1B, 0x01, 0x02, 0x05, 0x05, 0x05, 0x05, 0x02, 0x1B, 0x1B, 0x00, 0x02, 0x01, 0x01 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x01, 0x02, 0x02, 0x02, 0x02, 0x1B, 0x18, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A + , 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A + , 0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18, 0x1B, 0x1B, 0x1B, 0x1B + , 0x18, 0x1B, 0x1B, 0x18, 0x1B, 0x1B, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18 + , 0x1B, 0x1B, 0x18, 0x1B, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x18, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x14, 0x15, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x14, 0x15, 0x17, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x18, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x18 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B, 0x00, 0x1B + , 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00 + , 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15 + , 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x00, 0x00, 0x00, 0x00 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14 + , 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x14, 0x15, 0x14, 0x15, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x14, 0x15, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00 + , 0x0C, 0x17, 0x17, 0x17, 0x1B, 0x04, 0x05, 0x0A, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15 + , 0x14, 0x15, 0x1B, 0x1B, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x13, 0x14, 0x15, 0x15 + , 0x1B, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x13, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1B, 0x1B, 0x0A, 0x0A, 0x0A, 0x04, 0x05, 0x17, 0x1B, 0x1B + , 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x06, 0x06, 0x1A, 0x1A, 0x04, 0x04, 0x05 + , 0x13, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x16, 0x04, 0x04, 0x04, 0x05 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00 + , 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x1B, 0x1B, 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00 + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x1B + , 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00 + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B + , 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x18, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00 + , 0x05, 0x05, 0x00, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x14, 0x15 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x19, 0x1B, 0x00, 0x00 + , 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + , 0x17, 0x13, 0x13, 0x16, 0x16, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x14 + , 0x15, 0x14, 0x15, 0x14, 0x15, 0x17, 0x17, 0x14, 0x15, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16 + , 0x17, 0x17, 0x17, 0x00, 0x17, 0x17, 0x17, 0x17, 0x13, 0x14, 0x15, 0x14, 0x15, 0x14, 0x15, 0x17 + , 0x17, 0x17, 0x18, 0x13, 0x18, 0x18, 0x18, 0x00, 0x17, 0x19, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x10 + , 0x00, 0x17, 0x17, 0x17, 0x19, 0x17, 0x17, 0x17, 0x14, 0x15, 0x17, 0x18, 0x17, 0x13, 0x17, 0x17 + , 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x17, 0x17, 0x18, 0x18, 0x18, 0x17 + , 0x17, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 + , 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x14, 0x17, 0x15, 0x1A, 0x16 + , 0x1A, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 + , 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x14, 0x18, 0x15, 0x18, 0x14 + , 0x15, 0x17, 0x14, 0x15, 0x17, 0x16, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00 + , 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 + , 0x00, 0x00, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00 + , 0x19, 0x19, 0x18, 0x1A, 0x1B, 0x19, 0x19, 0x00, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x1B, 0x1B, 0x00 + , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x1B, 0x1B, 0x00, 0x00 +}; + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.cpp new file mode 100644 index 000000000..5c8c17bb8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.cpp @@ -0,0 +1,278 @@ +/* + * 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: UnicodeRangeFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local data +// --------------------------------------------------------------------------- + +const XMLCh uniCategNames[][3] = +{ + {chLatin_C, chLatin_n, chNull}, // UNASSIGNED + {chLatin_L, chLatin_u, chNull}, // UPPERCASE_LETTER + {chLatin_L, chLatin_l, chNull}, // LOWERCASE_LETTER + {chLatin_L, chLatin_t, chNull}, // TITLECASE_LETTER + {chLatin_L, chLatin_m, chNull}, // MODIFIER_LETTER + {chLatin_L, chLatin_o, chNull}, // OTHER_LETTER + {chLatin_M, chLatin_n, chNull}, // NON_SPACING_MARK + {chLatin_M, chLatin_e, chNull}, // ENCLOSING_MARK + {chLatin_M, chLatin_c, chNull}, // COMBINING_SPACING_MARK + {chLatin_N, chLatin_d, chNull}, // DECIMAL_DIGIT_NUMBER + {chLatin_N, chLatin_l, chNull}, // LETTER_NUMBER + {chLatin_N, chLatin_o, chNull}, // OTHER_NUMBER + {chLatin_Z, chLatin_s, chNull}, // SPACE_SEPARATOR + {chLatin_Z, chLatin_l, chNull}, // LINE_SEPARATOR + {chLatin_Z, chLatin_p, chNull}, // PARAGRAPH_SEPARATOR + {chLatin_C, chLatin_c, chNull}, // CONTROL + {chLatin_C, chLatin_f, chNull}, // FORMAT + {chLatin_C, chLatin_o, chNull}, // PRIVATE_USE + {chLatin_C, chLatin_s, chNull}, // SURROGATE + {chLatin_P, chLatin_d, chNull}, // DASH_PUNCTUATION + {chLatin_P, chLatin_s, chNull}, // START_PUNCTUATION + {chLatin_P, chLatin_e, chNull}, // END_PUNCTUATION + {chLatin_P, chLatin_c, chNull}, // CONNECTOR_PUNCTUATION + {chLatin_P, chLatin_o, chNull}, // OTHER_PUNCTUATION + {chLatin_S, chLatin_m, chNull}, // MATH_SYMBOL + {chLatin_S, chLatin_c, chNull}, // CURRENCY_SYMBOL + {chLatin_S, chLatin_k, chNull}, // MODIFIER_SYMBOL + {chLatin_S, chLatin_o, chNull}, // OTHER_SYMBOL + {chLatin_P, chLatin_i, chNull}, // INITIAL_PUNCTUATION + {chLatin_P, chLatin_f, chNull}, // FINAL_PUNCTUATION + {chLatin_L, chNull}, // CHAR_LETTER + {chLatin_M, chNull}, // CHAR_MARK + {chLatin_N, chNull}, // CHAR_NUMBER + {chLatin_Z, chNull}, // CHAR_SEPARATOR + {chLatin_C, chNull}, // CHAR_OTHER + {chLatin_P, chNull}, // CHAR_PUNCTUATION + {chLatin_S, chNull}, // CHAR_SYMBOL +}; + +// --------------------------------------------------------------------------- +// UnicodeRangeFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +UnicodeRangeFactory::UnicodeRangeFactory() +{ +} + +UnicodeRangeFactory::~UnicodeRangeFactory() { + +} + +// --------------------------------------------------------------------------- +// UnicodeRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void UnicodeRangeFactory::buildRanges(RangeTokenMap *rangeTokMap) { + + if (fRangesCreated) + return; + + if (!fKeywordsInitialized) { + initializeKeywordMap(rangeTokMap); + } + + TokenFactory* tokFactory = rangeTokMap->getTokenFactory(); + RangeToken* ranges[UNICATEGSIZE]; + RangeToken* tok; + + for (int i=0; i < UNICATEGSIZE; i++) { + ranges[i] = tokFactory->createRange(); + } + + for (int j=0; j < 0x10000; j++) { + + unsigned short charType = XMLUniCharacter::getType(j); + + ranges[charType]->addRange(j, j); + charType = getUniCategory(charType); + ranges[charType]->addRange(j, j); + } + + ranges[XMLUniCharacter::UNASSIGNED]->addRange(0x10000, Token::UTF16_MAX); + + for (int k=0; k < UNICATEGSIZE; k++) { + tok = RangeToken::complementRanges(ranges[k], tokFactory); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(uniCategNames[k], ranges[k]); + rangeTokMap->setRangeToken(uniCategNames[k], tok , true); + } + + // Create all range + tok = tokFactory->createRange(); + tok->addRange(0, Token::UTF16_MAX); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniAll, tok); + + // Create alpha range + tok = tokFactory->createRange(); + tok->mergeRanges(ranges[XMLUniCharacter::UPPERCASE_LETTER]); + tok->mergeRanges(ranges[XMLUniCharacter::LOWERCASE_LETTER]); + tok->mergeRanges(ranges[XMLUniCharacter::OTHER_LETTER]); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniIsAlpha, tok); + + // Create alpha-num range + RangeToken* alnumTok = tokFactory->createRange(); + alnumTok->mergeRanges(tok); + alnumTok->mergeRanges(ranges[XMLUniCharacter::DECIMAL_DIGIT_NUMBER]); + // build the internal map. + alnumTok->createMap(); + rangeTokMap->setRangeToken(fgUniIsAlnum, alnumTok); + + // Create word range + tok = tokFactory->createRange(); + tok->mergeRanges(alnumTok); + tok->addRange(chUnderscore, chUnderscore); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniIsWord, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniIsWord, tok , true); + + // Create assigned range + tok = RangeToken::complementRanges( + ranges[XMLUniCharacter::UNASSIGNED], + tokFactory, + tokFactory->getMemoryManager()); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniAssigned,tok); + + // Create space range + tok = tokFactory->createRange(); + tok->mergeRanges(ranges[XMLUniCharacter::SPACE_SEPARATOR]); + tok->mergeRanges(ranges[XMLUniCharacter::LINE_SEPARATOR]); + //tok->mergeRanges(ranges[XMLUniCharacter::PARAGRAPH_SEPARATOR]); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniIsSpace, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgUniIsSpace, tok , true); + + RangeToken* const dummyToken = + tokFactory->createRange(); + + dummyToken->addRange(-1, -2); + dummyToken->createMap(); + + // build the internal maps. + for (int l=0; l < UNICATEGSIZE; l++) { + ranges[l]->createMap(); + ranges[l]->setCaseInsensitiveToken(dummyToken); + } + + fRangesCreated = true; +} + +// --------------------------------------------------------------------------- +// UnicodeRangeFactory: Initialization methods +// --------------------------------------------------------------------------- +void UnicodeRangeFactory::initializeKeywordMap(RangeTokenMap *rangeTokMap) { + + if (fKeywordsInitialized) + return; + + for (int k=0; k < UNICATEGSIZE; k++) { + rangeTokMap->addKeywordMap(uniCategNames[k], fgUnicodeCategory); + } + + rangeTokMap->addKeywordMap(fgUniAll, fgUnicodeCategory); + rangeTokMap->addKeywordMap(fgUniIsAlpha, fgUnicodeCategory); + rangeTokMap->addKeywordMap(fgUniIsAlnum, fgUnicodeCategory); + rangeTokMap->addKeywordMap(fgUniIsWord, fgUnicodeCategory); + rangeTokMap->addKeywordMap(fgUniAssigned, fgUnicodeCategory); + rangeTokMap->addKeywordMap(fgUniIsSpace, fgUnicodeCategory); + + fKeywordsInitialized = true; +} + +// --------------------------------------------------------------------------- +// UnicodeRangeFactory: Helper methods +// --------------------------------------------------------------------------- +unsigned short UnicodeRangeFactory::getUniCategory(const unsigned short type) +{ + switch(type) { + case XMLUniCharacter::UPPERCASE_LETTER: + case XMLUniCharacter::LOWERCASE_LETTER: + case XMLUniCharacter::TITLECASE_LETTER: + case XMLUniCharacter::MODIFIER_LETTER: + case XMLUniCharacter::OTHER_LETTER: + return CHAR_LETTER; + case XMLUniCharacter::NON_SPACING_MARK: + case XMLUniCharacter::COMBINING_SPACING_MARK: + case XMLUniCharacter::ENCLOSING_MARK: + return CHAR_MARK; + case XMLUniCharacter::DECIMAL_DIGIT_NUMBER: + case XMLUniCharacter::LETTER_NUMBER: + case XMLUniCharacter::OTHER_NUMBER: + return CHAR_NUMBER; + case XMLUniCharacter::SPACE_SEPARATOR: + case XMLUniCharacter::LINE_SEPARATOR: + case XMLUniCharacter::PARAGRAPH_SEPARATOR: + return CHAR_SEPARATOR; + case XMLUniCharacter::CONTROL: + case XMLUniCharacter::FORMAT: + case XMLUniCharacter::SURROGATE: + case XMLUniCharacter::PRIVATE_USE: + case XMLUniCharacter::UNASSIGNED: + return CHAR_OTHER; + case XMLUniCharacter::CONNECTOR_PUNCTUATION: + case XMLUniCharacter::DASH_PUNCTUATION: + case XMLUniCharacter::START_PUNCTUATION: + case XMLUniCharacter::END_PUNCTUATION: + case XMLUniCharacter::OTHER_PUNCTUATION: + case XMLUniCharacter::INITIAL_PUNCTUATION: + case XMLUniCharacter::FINAL_PUNCTUATION: + return CHAR_PUNCTUATION; + case XMLUniCharacter::MATH_SYMBOL: + case XMLUniCharacter::CURRENCY_SYMBOL: + case XMLUniCharacter::MODIFIER_SYMBOL: + case XMLUniCharacter::OTHER_SYMBOL: + return CHAR_SYMBOL; + } + + return 0; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file UnicodeRangeFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.hpp new file mode 100644 index 000000000..ceaf244e9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/UnicodeRangeFactory.hpp @@ -0,0 +1,88 @@ +/* + * 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: UnicodeRangeFactory.hpp 671870 2008-06-26 12:19:31Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UNICODERANGEFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_UNICODERANGEFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT UnicodeRangeFactory: public RangeFactory { + +public: + // ----------------------------------------------------------------------- + // Public Constants + // ----------------------------------------------------------------------- + // Unicode categories + enum { + CHAR_LETTER = XMLUniCharacter::FINAL_PUNCTUATION+1, + CHAR_MARK, + CHAR_NUMBER, + CHAR_SEPARATOR, + CHAR_OTHER, + CHAR_PUNCTUATION, + CHAR_SYMBOL, + UNICATEGSIZE + }; + + // ----------------------------------------------------------------------- + // Constructors and operators + // ----------------------------------------------------------------------- + UnicodeRangeFactory(); + ~UnicodeRangeFactory(); + + // ----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + void initializeKeywordMap(RangeTokenMap *rangeTokMap = 0); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + static unsigned short getUniCategory(const unsigned short type); + +protected: + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + void buildRanges(RangeTokenMap *rangeTokMap = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + UnicodeRangeFactory(const UnicodeRangeFactory&); + UnicodeRangeFactory& operator=(const UnicodeRangeFactory&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file UnicodeRangeFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/UnionToken.cpp b/project/jni/xerces/src/xercesc/util/regx/UnionToken.cpp new file mode 100644 index 000000000..2de435384 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/UnionToken.cpp @@ -0,0 +1,149 @@ +/* + * 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: UnionToken.cpp 678395 2008-07-21 11:40:41Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Static member data initialization +// --------------------------------------------------------------------------- +const unsigned short UnionToken::INITIALSIZE = 8; + +// --------------------------------------------------------------------------- +// UnionToken: Constructors and Destructors +// --------------------------------------------------------------------------- +UnionToken::UnionToken(const Token::tokType tkType, MemoryManager* const manager) + : Token(tkType, manager) + , fChildren(0) +{ + +} + +UnionToken::~UnionToken() { + + delete fChildren; +} + + +// --------------------------------------------------------------------------- +// UnionToken: Children manipulation methods +// --------------------------------------------------------------------------- +void UnionToken::addChild(Token* const child, TokenFactory* const tokFactory) { + + if (child == 0) + return; + + if (fChildren == 0) + fChildren = new (tokFactory->getMemoryManager()) RefVectorOf(INITIALSIZE, false, tokFactory->getMemoryManager()); + + if (getTokenType() == T_UNION) { + + fChildren->addElement(child); + return; + } + + Token::tokType childType = child->getTokenType(); + if (childType == T_CONCAT) { + + XMLSize_t childSize = child->size(); + for (XMLSize_t i = 0; i < childSize; i++) { + + addChild(child->getChild(i), tokFactory); + } + + return; + } + + XMLSize_t childrenSize = fChildren->size(); + if (childrenSize == 0) { + + fChildren->addElement(child); + return; + } + + Token* previousTok = fChildren->elementAt(childrenSize - 1); + Token::tokType previousType = previousTok->getTokenType(); + + if (!((previousType == T_CHAR || previousType == T_STRING) + && (childType == T_CHAR || childType == T_STRING))) { + + fChildren->addElement(child); + return; + } + + // Continue + XMLBuffer stringBuf(1023, tokFactory->getMemoryManager()); + + if (previousType == T_CHAR) { + + XMLInt32 ch = previousTok->getChar(); + + if (ch >= 0x10000) { + + XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); + stringBuf.append(chSurrogate); + tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; + } + else { + stringBuf.append((XMLCh) ch); + } + + previousTok = tokFactory->createString(0); + fChildren->setElementAt(previousTok, childrenSize - 1); + } + else { + stringBuf.append(previousTok->getString()); + } + + if (childType == T_CHAR) { + + XMLInt32 ch = child->getChar(); + + if (ch >= 0x10000) { + + XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); + stringBuf.append(chSurrogate); + tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; + } + else { + stringBuf.append((XMLCh) ch); + } + } + else { + stringBuf.append(child->getString()); + } + + ((StringToken*) previousTok)->setString(stringBuf.getRawBuffer()); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file UnionToken.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/UnionToken.hpp b/project/jni/xerces/src/xercesc/util/regx/UnionToken.hpp new file mode 100644 index 000000000..086421bd6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/UnionToken.hpp @@ -0,0 +1,91 @@ +/* + * 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: UnionToken.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UNIONTOKEN_HPP) +#define XERCESC_INCLUDE_GUARD_UNIONTOKEN_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT UnionToken : public Token { +public: + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + UnionToken(const tokType tkType + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~UnionToken(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t size() const; + Token* getChild(const XMLSize_t index) const; + + // ----------------------------------------------------------------------- + // Children manipulation methods + // ----------------------------------------------------------------------- + void addChild(Token* const child, TokenFactory* const tokFactory); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + UnionToken(const UnionToken&); + UnionToken& operator=(const UnionToken&); + + // ----------------------------------------------------------------------- + // Private Constants + // ----------------------------------------------------------------------- + static const unsigned short INITIALSIZE; + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + RefVectorOf* fChildren; +}; + + +// --------------------------------------------------------------------------- +// UnionToken: getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t UnionToken::size() const { + + return fChildren == 0 ? 0 : fChildren->size(); +} + +inline Token* UnionToken::getChild(const XMLSize_t index) const { + + return fChildren->elementAt(index); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file UnionToken.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.cpp b/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.cpp new file mode 100644 index 000000000..b9864a81b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.cpp @@ -0,0 +1,254 @@ +/* + * 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: XMLRangeFactory.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static functions +// --------------------------------------------------------------------------- +static void setupRange(XMLInt32* const rangeMap, + const XMLCh* const theTable, + unsigned int startingIndex) { + + const XMLCh* pchCur = theTable; + + // Do the ranges first + while (*pchCur) + { + rangeMap[startingIndex++] = *pchCur++; + } + + // Skip the range terminator + pchCur++; + + // And then the singles until we hit its terminator + while (*pchCur) { + + const XMLCh chSingle = *pchCur++; + rangeMap[startingIndex++] = chSingle; + rangeMap[startingIndex++] = chSingle; + } +} + +static unsigned int getTableLen(const XMLCh* const theTable) { + + XMLSize_t rangeLen = XMLString::stringLen(theTable); + + return (unsigned int)(rangeLen + 2*XMLString::stringLen(theTable + rangeLen + 1)); +} + +// --------------------------------------------------------------------------- +// XMLRangeFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +XMLRangeFactory::XMLRangeFactory() +{ + +} + +XMLRangeFactory::~XMLRangeFactory() { + +} + +// --------------------------------------------------------------------------- +// XMLRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void XMLRangeFactory::buildRanges(RangeTokenMap *rangeTokMap) { + + if (fRangesCreated) + return; + + if (!fKeywordsInitialized) { + initializeKeywordMap(rangeTokMap); + } + + TokenFactory* tokFactory = rangeTokMap->getTokenFactory(); + + // Create space ranges + unsigned int wsTblLen = getTableLen(gWhitespaceChars); + RangeToken* tok = tokFactory->createRange(); + XMLInt32* wsRange = (XMLInt32*) XMLPlatformUtils::fgMemoryManager->allocate + ( + wsTblLen * sizeof(XMLInt32) + );//new XMLInt32[wsTblLen]; + + tok->setRangeValues(wsRange, wsTblLen); + setupRange(wsRange, gWhitespaceChars, 0); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLSpace, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLSpace, tok , true); + + // Create digits ranges + tok = tokFactory->createRange(); + unsigned int digitTblLen = getTableLen(gDigitChars); + XMLInt32* digitRange = (XMLInt32*) XMLPlatformUtils::fgMemoryManager->allocate + ( + digitTblLen * sizeof(XMLInt32) + );//new XMLInt32[digitTblLen]; + + tok->setRangeValues(digitRange, digitTblLen); + setupRange(digitRange, gDigitChars, 0); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLDigit, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLDigit, tok , true); + + // Build word ranges + unsigned int baseTblLen = getTableLen(gBaseChars); + unsigned int ideoTblLen = getTableLen(gIdeographicChars); + unsigned int wordRangeLen = baseTblLen + ideoTblLen + digitTblLen; + XMLInt32* wordRange = (XMLInt32*) XMLPlatformUtils::fgMemoryManager->allocate + ( + wordRangeLen * sizeof(XMLInt32) + );//new XMLInt32[wordRangeLen]; + ArrayJanitor janWordRange(wordRange, XMLPlatformUtils::fgMemoryManager); + + setupRange(wordRange, gBaseChars, 0); + setupRange(wordRange, gIdeographicChars, baseTblLen); + memcpy(wordRange + baseTblLen + ideoTblLen, digitRange, digitTblLen * sizeof(XMLInt32)); + + // Create NameChar ranges + tok = tokFactory->createRange(); + unsigned int combTblLen = getTableLen(gCombiningChars); + unsigned int extTblLen = getTableLen(gExtenderChars); + unsigned int nameTblLen = wordRangeLen + combTblLen + extTblLen; + XMLInt32* nameRange = (XMLInt32*) XMLPlatformUtils::fgMemoryManager->allocate + ( + (nameTblLen + 8) * sizeof(XMLInt32) + );//new XMLInt32[nameTblLen + 8]; + + tok->setRangeValues(nameRange, nameTblLen + 8); + memcpy(nameRange, wordRange, wordRangeLen * sizeof(XMLInt32)); + setupRange(nameRange, gCombiningChars, wordRangeLen); + setupRange(nameRange, gExtenderChars, wordRangeLen + combTblLen); + nameRange[nameTblLen++] = chDash; + nameRange[nameTblLen++] = chDash; + nameRange[nameTblLen++] = chColon; + nameRange[nameTblLen++] = chColon; + nameRange[nameTblLen++] = chPeriod; + nameRange[nameTblLen++] = chPeriod; + nameRange[nameTblLen++] = chUnderscore; + nameRange[nameTblLen++] = chUnderscore; + tok->sortRanges(); + tok->compactRanges(); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLNameChar, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLNameChar, tok , true); + + // Create initialNameChar ranges + tok = tokFactory->createRange(); + unsigned int initialNameTblLen = baseTblLen + ideoTblLen; + XMLInt32* initialNameRange = (XMLInt32*) XMLPlatformUtils::fgMemoryManager->allocate + ( + (initialNameTblLen + 4) * sizeof(XMLInt32) + );//new XMLInt32[initialNameTblLen + 4]; + + tok->setRangeValues(initialNameRange, initialNameTblLen + 4); + memcpy(initialNameRange, wordRange, initialNameTblLen * sizeof(XMLInt32)); + initialNameRange[initialNameTblLen++] = chColon; + initialNameRange[initialNameTblLen++] = chColon; + initialNameRange[initialNameTblLen++] = chUnderscore; + initialNameRange[initialNameTblLen++] = chUnderscore; + tok->sortRanges(); + tok->compactRanges(); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLInitialNameChar, tok); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLInitialNameChar, tok , true); + + // Create word range + // \w = [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set of "punctuation", "separator" and "other" characters) + tok = tokFactory->createRange(); + for(int i=0; i<=0xFFFF; i++) + { + unsigned short chType=UnicodeRangeFactory::getUniCategory(XMLUniCharacter::getType(i)); + if(chType == UnicodeRangeFactory::CHAR_PUNCTUATION || + chType == UnicodeRangeFactory::CHAR_SEPARATOR || + chType == UnicodeRangeFactory::CHAR_OTHER) + tok->addRange(i, i); + } + tok->sortRanges(); + tok->compactRanges(); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLWord, tok , true); + + tok = RangeToken::complementRanges(tok, tokFactory); + // Build the internal map. + tok->createMap(); + rangeTokMap->setRangeToken(fgXMLWord, tok); + + + fRangesCreated = true; +} + +// --------------------------------------------------------------------------- +// XMLRangeFactory: Range creation methods +// --------------------------------------------------------------------------- +void XMLRangeFactory::initializeKeywordMap(RangeTokenMap *rangeTokMap) { + + if (fKeywordsInitialized) + return; + + rangeTokMap->addKeywordMap(fgXMLSpace, fgXMLCategory); + rangeTokMap->addKeywordMap(fgXMLDigit, fgXMLCategory); + rangeTokMap->addKeywordMap(fgXMLWord, fgXMLCategory); + rangeTokMap->addKeywordMap(fgXMLNameChar, fgXMLCategory); + rangeTokMap->addKeywordMap(fgXMLInitialNameChar, fgXMLCategory); + + fKeywordsInitialized = true; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XMLRangeFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.hpp b/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.hpp new file mode 100644 index 000000000..9b15a8a84 --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/XMLRangeFactory.hpp @@ -0,0 +1,66 @@ +/* + * 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: XMLRangeFactory.hpp 678879 2008-07-22 20:05:05Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLRANGEFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_XMLRANGEFACTORY_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLUTIL_EXPORT XMLRangeFactory: public RangeFactory { + +public: + // ----------------------------------------------------------------------- + // Constructors and operators + // ----------------------------------------------------------------------- + XMLRangeFactory(); + ~XMLRangeFactory(); + + // ----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + void initializeKeywordMap(RangeTokenMap *rangeTokMap = 0); + +protected: + // ----------------------------------------------------------------------- + // Protected Helper methods + // ----------------------------------------------------------------------- + void buildRanges(RangeTokenMap *rangeTokMap = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLRangeFactory(const XMLRangeFactory&); + XMLRangeFactory& operator=(const XMLRangeFactory&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End file XMLRangeFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.cpp b/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.cpp new file mode 100644 index 000000000..4fc45728b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.cpp @@ -0,0 +1,57 @@ +/* + * 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: XMLUniCharacter.cpp 678879 2008-07-22 20:05:05Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#if HAVE_CONFIG_H +# include +#endif + +#include + +#if XERCES_USE_TRANSCODER_ICU + #include +#else + #include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLUniCharacter: Public static methods +// --------------------------------------------------------------------------- +unsigned short XMLUniCharacter::getType(const XMLCh ch) { + +#if XERCES_USE_TRANSCODER_ICU + return (unsigned short) u_charType(ch); +#else + return (unsigned short) fgUniCharsTable[ch]; +#endif +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XMLUniCharacter.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.hpp b/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.hpp new file mode 100644 index 000000000..d3a463efa --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/regx/XMLUniCharacter.hpp @@ -0,0 +1,101 @@ +/* + * 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: XMLUniCharacter.hpp 671870 2008-06-26 12:19:31Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLUNICHARACTER_HPP) +#define XERCESC_INCLUDE_GUARD_XMLUNICHARACTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/** + * Class for representing unicode characters + */ +class XMLUTIL_EXPORT XMLUniCharacter +{ +public: + // ----------------------------------------------------------------------- + // Public Constants + // ----------------------------------------------------------------------- + // Unicode char types + enum { + UNASSIGNED = 0, + UPPERCASE_LETTER = 1, + LOWERCASE_LETTER = 2, + TITLECASE_LETTER = 3, + MODIFIER_LETTER = 4, + OTHER_LETTER = 5, + NON_SPACING_MARK = 6, + ENCLOSING_MARK = 7, + COMBINING_SPACING_MARK = 8, + DECIMAL_DIGIT_NUMBER = 9, + LETTER_NUMBER = 10, + OTHER_NUMBER = 11, + SPACE_SEPARATOR = 12, + LINE_SEPARATOR = 13, + PARAGRAPH_SEPARATOR = 14, + CONTROL = 15, + FORMAT = 16, + PRIVATE_USE = 17, + SURROGATE = 18, + DASH_PUNCTUATION = 19, + START_PUNCTUATION = 20, + END_PUNCTUATION = 21, + CONNECTOR_PUNCTUATION = 22, + OTHER_PUNCTUATION = 23, + MATH_SYMBOL = 24, + CURRENCY_SYMBOL = 25, + MODIFIER_SYMBOL = 26, + OTHER_SYMBOL = 27, + INITIAL_PUNCTUATION = 28, + FINAL_PUNCTUATION = 29 + }; + + /** destructor */ + ~XMLUniCharacter() {} + + /* Static methods for getting unicode character type */ + /** @name Getter functions */ + //@{ + + /** Gets the unicode type of a given character + * + * @param ch The character we want to get its unicode type + */ + static unsigned short getType(const XMLCh ch); + //@} + +private : + + /** @name Constructors and Destructor */ + //@{ + /** Unimplemented default constructor */ + XMLUniCharacter(); + //@} +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XMLUniCharacter.hpp + */ diff --git a/project/jni/xerces/src/xercesc/util/stamp-h2 b/project/jni/xerces/src/xercesc/util/stamp-h2 new file mode 100644 index 000000000..753a6d38b --- /dev/null +++ b/project/jni/xerces/src/xercesc/util/stamp-h2 @@ -0,0 +1 @@ +timestamp for src/xercesc/util/Xerces_autoconf_config.hpp diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.cpp new file mode 100644 index 000000000..ced90468c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.cpp @@ -0,0 +1,106 @@ +/* + * 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: DTDAttDef.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DTDAttDef: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDAttDef::DTDAttDef(MemoryManager* const manager) : + + XMLAttDef(XMLAttDef::CData, XMLAttDef::Implied, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fName(0) +{ +} + +DTDAttDef::DTDAttDef(const XMLCh* const attName + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , MemoryManager* const manager) : + XMLAttDef(type, defType, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fName(0) +{ + fName = XMLString::replicate(attName, getMemoryManager()); +} + +DTDAttDef::DTDAttDef( const XMLCh* const attName + , const XMLCh* const attValue + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , const XMLCh* const enumValues + , MemoryManager* const manager) : + + XMLAttDef(attValue, type, defType, enumValues, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fName(0) +{ + fName = XMLString::replicate(attName, getMemoryManager()); +} + +DTDAttDef::~DTDAttDef() +{ + getMemoryManager()->deallocate(fName); //delete [] fName; +} + + +// --------------------------------------------------------------------------- +// DTDAttDef: Setter methods +// --------------------------------------------------------------------------- +void DTDAttDef::setName(const XMLCh* const newName) +{ + getMemoryManager()->deallocate(fName); //delete [] fName; + fName = XMLString::replicate(newName, getMemoryManager()); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDAttDef) + +void DTDAttDef::serialize(XSerializeEngine& serEng) +{ + + XMLAttDef::serialize(serEng); + + if (serEng.isStoring()) + { + serEng.writeSize (fElemId); + serEng.writeString(fName); + } + else + { + serEng.readSize (fElemId); + serEng.readString(fName); + } +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.hpp new file mode 100644 index 000000000..500d8fa98 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDef.hpp @@ -0,0 +1,141 @@ +/* + * 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: DTDAttDef.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDATTDEF_HPP) +#define XERCESC_INCLUDE_GUARD_DTDATTDEF_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class is a derivative of the core XMLAttDef class. This class adds +// any DTD specific data members and provides DTD specific implementations +// of any underlying attribute def virtual methods. +// +// In the DTD we don't do namespaces, so the attribute names are just the +// QName literally from the DTD. This is what we return as the full name, +// which is what is used to key these in any name keyed collections. +// +class VALIDATORS_EXPORT DTDAttDef : public XMLAttDef +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructors + // ----------------------------------------------------------------------- + DTDAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + DTDAttDef + ( + const XMLCh* const attName + , const XMLAttDef::AttTypes type = CData + , const XMLAttDef::DefAttTypes defType = Implied + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DTDAttDef + ( + const XMLCh* const attName + , const XMLCh* const attValue + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , const XMLCh* const enumValues = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~DTDAttDef(); + + + // ----------------------------------------------------------------------- + // Implementation of the XMLAttDef interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getFullName() const; + + //does nothing currently + virtual void reset() {}; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t getElemId() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setElemId(const XMLSize_t newId); + void setName(const XMLCh* const newName); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDAttDef) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDAttDef(const DTDAttDef &); + DTDAttDef& operator = (const DTDAttDef&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fElemId + // This is the id of the element (the id is into the element decl + // pool) of the element this attribute def said it belonged to. + // This is used later to link back to the element, mostly for + // validation purposes. + // + // fName + // This is the name of the attribute. Since we don't do namespaces + // in the DTD, its just the fully qualified name. + // ----------------------------------------------------------------------- + XMLSize_t fElemId; + XMLCh* fName; +}; + + +// --------------------------------------------------------------------------- +// DTDAttDef: Implementation of the XMLAttDef interface +// --------------------------------------------------------------------------- +inline const XMLCh* DTDAttDef::getFullName() const +{ + return fName; +} + + +// --------------------------------------------------------------------------- +// DTDAttDef: Getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t DTDAttDef::getElemId() const +{ + return fElemId; +} + +// --------------------------------------------------------------------------- +// DTDAttDef: Setter methods +// --------------------------------------------------------------------------- +inline void DTDAttDef::setElemId(const XMLSize_t newId) +{ + fElemId = newId; +} + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.cpp new file mode 100644 index 000000000..6cd6254b5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.cpp @@ -0,0 +1,188 @@ +/* + * 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: DTDAttDefList.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DTDAttDefList: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDAttDefList::DTDAttDefList(RefHashTableOf* const listToUse, MemoryManager* const manager) +: XMLAttDefList(manager) +,fEnum(0) +,fList(listToUse) +,fArray(0) +,fSize(0) +,fCount(0) +{ + fEnum = new (getMemoryManager()) RefHashTableOfEnumerator(listToUse, false, manager); + fArray = (DTDAttDef **)(manager->allocate( sizeof(DTDAttDef*) << 1)); + fSize = 2; +} + +DTDAttDefList::~DTDAttDefList() +{ + delete fEnum; + (getMemoryManager())->deallocate(fArray); +} + + +// --------------------------------------------------------------------------- +// DTDAttDefList: Implementation of the virtual interface +// --------------------------------------------------------------------------- + +bool DTDAttDefList::isEmpty() const +{ + return fList->isEmpty(); +} + + +XMLAttDef* DTDAttDefList::findAttDef(const unsigned int + , const XMLCh* const attName) +{ + // We don't use the URI, so we just look up the name + return fList->get(attName); +} + + +const XMLAttDef* +DTDAttDefList::findAttDef( const unsigned int + , const XMLCh* const attName) const +{ + // We don't use the URI, so we just look up the name + return fList->get(attName); +} + + +XMLAttDef* DTDAttDefList::findAttDef( const XMLCh* const + , const XMLCh* const attName) +{ + // We don't use the URI, so we just look up the name + return fList->get(attName); +} + + +const XMLAttDef* +DTDAttDefList::findAttDef( const XMLCh* const + , const XMLCh* const attName) const +{ + // We don't use the URI, so we just look up the name + return fList->get(attName); +} + +/** + * return total number of attributes in this list + */ +XMLSize_t DTDAttDefList::getAttDefCount() const +{ + return fCount; +} + +/** + * return attribute at the index-th position in the list. + */ +XMLAttDef &DTDAttDefList::getAttDef(XMLSize_t index) +{ + if(index >= fCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttrList_BadIndex, getMemoryManager()); + return *(fArray[index]); +} + +/** + * return attribute at the index-th position in the list. + */ +const XMLAttDef &DTDAttDefList::getAttDef(XMLSize_t index) const +{ + if(index >= fCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttrList_BadIndex, getMemoryManager()); + return *(fArray[index]); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDAttDefList) + +void DTDAttDefList::serialize(XSerializeEngine& serEng) +{ + + XMLAttDefList::serialize(serEng); + + if (serEng.isStoring()) + { + /*** + * + * Serialize RefHashTableOf + * + ***/ + XTemplateSerializer::storeObject(fList, serEng); + serEng.writeSize (fCount); + + // do not serialize fEnum + } + else + { + /*** + * + * Deserialize RefHashTableOf + * + ***/ + XTemplateSerializer::loadObject(&fList, 29, true, serEng); + // assume empty so we can size fArray just right + serEng.readSize (fSize); + if (!fEnum && fList) + { + fEnum = new (getMemoryManager()) RefHashTableOfEnumerator(fList, false, getMemoryManager()); + } + if(fSize) + { + (getMemoryManager())->deallocate(fArray); + fArray = (DTDAttDef **)((getMemoryManager())->allocate( sizeof(DTDAttDef*) * fSize)); + fCount = 0; + while(fEnum->hasMoreElements()) + { + fArray[fCount++] = &fEnum->nextElement(); + } + } + } + +} + + +DTDAttDefList::DTDAttDefList(MemoryManager* const manager) +: XMLAttDefList(manager) +,fEnum(0) +,fList(0) +,fArray(0) +,fSize(0) +,fCount(0) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.hpp new file mode 100644 index 000000000..9fdaf713a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDAttDefList.hpp @@ -0,0 +1,161 @@ +/* + * 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: DTDAttDefList.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDATTDEFLIST_HPP) +#define XERCESC_INCLUDE_GUARD_DTDATTDEFLIST_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This is a derivative of the framework abstract class which defines the +// interface to a list of attribute defs that belong to a particular +// element. The scanner needs to be able to get a list of the attributes +// that an element supports, for use during the validation process and for +// fixed/default attribute processing. +// +// Since each validator can store attributes differently, this abstract +// interface allows each validator to provide an implementation of this +// data structure that works best for it. +// +// For us, we just wrap the RefHashTableOf collection that the DTDElementDecl +// class uses to store the attributes that belong to it. +// +// This clss does not adopt the hash table, it just references it. The +// hash table is owned by the element decl it is a member of. +// +class VALIDATORS_EXPORT DTDAttDefList : public XMLAttDefList +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDAttDefList + ( + RefHashTableOf* const listToUse, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~DTDAttDefList(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual interface + // ----------------------------------------------------------------------- + + virtual bool isEmpty() const; + virtual XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ); + virtual const XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ) const; + virtual XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ); + virtual const XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ) const; + + /** + * return total number of attributes in this list + */ + virtual XMLSize_t getAttDefCount() const ; + + /** + * return attribute at the index-th position in the list. + */ + virtual XMLAttDef &getAttDef(XMLSize_t index) ; + + /** + * return attribute at the index-th position in the list. + */ + virtual const XMLAttDef &getAttDef(XMLSize_t index) const ; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDAttDefList) + + DTDAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private : + + void addAttDef(DTDAttDef *toAdd); + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDAttDefList(const DTDAttDefList &); + DTDAttDefList& operator = (const DTDAttDefList&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEnum + // This is an enerator for the list that we use to do the enumerator + // type methods of this class. + // + // fList + // The list of DTDAttDef objects that represent the attributes that + // a particular element supports. + // fArray + // vector of pointers to the DTDAttDef objects contained in this list + // fSize + // size of fArray + // fCount + // number of DTDAttDef objects currently stored in this list + // ----------------------------------------------------------------------- + RefHashTableOfEnumerator* fEnum; + RefHashTableOf* fList; + DTDAttDef** fArray; + XMLSize_t fSize; + XMLSize_t fCount; + + friend class DTDElementDecl; +}; + +inline void DTDAttDefList::addAttDef(DTDAttDef *toAdd) +{ + if(fCount == fSize) + { + // need to grow fArray + fSize <<= 1; + DTDAttDef** newArray = (DTDAttDef **)((getMemoryManager())->allocate( sizeof(DTDAttDef*) * fSize )); + memcpy(newArray, fArray, fCount * sizeof(DTDAttDef *)); + (getMemoryManager())->deallocate(fArray); + fArray = newArray; + } + fArray[fCount++] = toAdd; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.cpp new file mode 100644 index 000000000..6613a068f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.cpp @@ -0,0 +1,437 @@ +/* + * 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: DTDElementDecl.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DTDElementDecl: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDElementDecl::DTDElementDecl(MemoryManager* const manager) : + + XMLElementDecl(manager) + , fModelType(Any) + , fAttDefs(0) + , fAttList(0) + , fContentSpec(0) + , fContentModel(0) + , fFormattedModel(0) +{ +} + +DTDElementDecl::DTDElementDecl( const XMLCh* const elemRawName + , const unsigned int uriId + , const DTDElementDecl::ModelTypes type + , MemoryManager* const manager) : + XMLElementDecl(manager) + , fModelType(type) + , fAttDefs(0) + , fAttList(0) + , fContentSpec(0) + , fContentModel(0) + , fFormattedModel(0) +{ + setElementName(elemRawName, uriId); +} + +DTDElementDecl::DTDElementDecl( QName* const elementName + , const DTDElementDecl::ModelTypes type + , MemoryManager* const manager) : + XMLElementDecl(manager) + , fModelType(type) + , fAttDefs(0) + , fAttList(0) + , fContentSpec(0) + , fContentModel(0) + , fFormattedModel(0) +{ + setElementName(elementName); +} + +DTDElementDecl::~DTDElementDecl() +{ + delete fAttDefs; + delete fAttList; + delete fContentSpec; + delete fContentModel; + getMemoryManager()->deallocate(fFormattedModel);//delete [] fFormattedModel; +} + + + +// --------------------------------------------------------------------------- +// The virtual element decl interface +// --------------------------------------------------------------------------- +XMLAttDefList& DTDElementDecl::getAttDefList() const +{ + if (!fAttList) + { + // If the att def list is not made yet, then fault it in too + if (!fAttDefs) + faultInAttDefList(); + + ((DTDElementDecl*)this)->fAttList = new (getMemoryManager()) DTDAttDefList(fAttDefs,getMemoryManager()); + } + + return *fAttList; +} + + +XMLElementDecl::CharDataOpts DTDElementDecl::getCharDataOpts() const +{ + XMLElementDecl::CharDataOpts retVal; + switch(fModelType) + { + case Children : + retVal = XMLElementDecl::SpacesOk; + break; + + case Empty : + retVal = XMLElementDecl::NoCharData; + break; + + default : + retVal = XMLElementDecl::AllCharData; + break; + } + return retVal; +} + + +bool DTDElementDecl::hasAttDefs() const +{ + // If the collection hasn't been faulted in, then no att defs + if (!fAttDefs) + return false; + + return !fAttDefs->isEmpty(); +} + +void +DTDElementDecl::setContentSpec(ContentSpecNode* toAdopt) +{ + delete fContentSpec; + fContentSpec = toAdopt; + + //reset Content Model + setContentModel(0); + +} + +const XMLCh* +DTDElementDecl::getFormattedContentModel() const +{ + // + // If its not already built, then call the protected virtual method + // to allow the derived class to build it (since only it knows.) + // Otherwise, just return the previously formatted methods. + // + // Since we are faulting this in, within a const getter, we have to + // cast off the const-ness. + // + if (!fFormattedModel) + ((DTDElementDecl*)this)->fFormattedModel = formatContentModel(); + + return fFormattedModel; +} + + +// --------------------------------------------------------------------------- +// DTDElementDecl: Getter methods +// --------------------------------------------------------------------------- +const DTDAttDef* DTDElementDecl::getAttDef(const XMLCh* const attName) const +{ + // If no list, then return a null + if (!fAttDefs) + return 0; + + return fAttDefs->get(attName); +} + + +DTDAttDef* DTDElementDecl::getAttDef(const XMLCh* const attName) +{ + // If no list, then return a null + if (!fAttDefs) + return 0; + + return fAttDefs->get(attName); +} + + +// --------------------------------------------------------------------------- +// DTDElementDecl: Implementation of the protected virtual interface +// --------------------------------------------------------------------------- +void DTDElementDecl::addAttDef(DTDAttDef* const toAdd) +{ + // Fault in the att list if required + if (!fAttDefs) + faultInAttDefList(); + + // Tell this guy the element id of its parent (us) + toAdd->setElemId(getId()); + + fAttDefs->put((void*)(toAdd->getFullName()), toAdd); + // update and/or create fAttList + if(!fAttList) + ((DTDElementDecl*)this)->fAttList = new (getMemoryManager()) DTDAttDefList(fAttDefs,getMemoryManager()); + fAttList->addAttDef(toAdd); +} + + +// --------------------------------------------------------------------------- +// DTDElementDecl: Private helper methods +// --------------------------------------------------------------------------- +XMLCh* DTDElementDecl::formatContentModel() const +{ + XMLCh* newValue = 0; + if (fModelType == Any) + { + newValue = XMLString::replicate(XMLUni::fgAnyString, getMemoryManager()); + } + else if (fModelType == Empty) + { + newValue = XMLString::replicate(XMLUni::fgEmptyString, getMemoryManager()); + } + else + { + // + // Use a temp XML buffer to format into. Content models could be + // pretty long, but very few will be longer than one K. The buffer + // will expand to handle the more pathological ones. + // + XMLBuffer bufFmt(1023, getMemoryManager()); + getContentSpec()->formatSpec(bufFmt); + newValue = XMLString::replicate(bufFmt.getRawBuffer(), getMemoryManager()); + } + return newValue; +} + +XMLContentModel* DTDElementDecl::makeContentModel() +{ + XMLContentModel* cmRet = 0; + if (fModelType == Mixed_Simple) + { + // + // Just create a mixel content model object. This type of + // content model is optimized for mixed content validation. + // + cmRet = new (getMemoryManager()) MixedContentModel(true, this->getContentSpec(), false, getMemoryManager()); + } + else if (fModelType == Children) + { + // + // This method will create an optimal model for the complexity + // of the element's defined model. If its simple, it will create + // a SimpleContentModel object. If its a simple list, it will + // create a SimpleListContentModel object. If its complex, it + // will create a DFAContentModel object. + // + cmRet = createChildModel(); + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_MustBeMixedOrChildren, getMemoryManager()); + } + return cmRet; +} + + +XMLContentModel* DTDElementDecl::createChildModel() +{ + // Get the content spec node of the element + ContentSpecNode* specNode = getContentSpec(); + + if(!specNode) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, getMemoryManager()); + + // + // Do a sanity check that the node does not have a PCDATA id. Since, + // if it was, it should have already gotten taken by the Mixed model. + // + if (specNode->getElement()) { + if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoPCDATAHere, getMemoryManager()); + } + + // + // According to the type of node, we will create the correct type of + // content model. + // + if (specNode->getType() == ContentSpecNode::Leaf) + { + // Create a simple content model + return new (getMemoryManager()) SimpleContentModel + ( + true + , specNode->getElement() + , 0 + , ContentSpecNode::Leaf + , getMemoryManager() + ); + } + else if ((specNode->getType() == ContentSpecNode::Choice) + || (specNode->getType() == ContentSpecNode::Sequence)) + { + // + // Lets see if both of the children are leafs. If so, then it has to + // be a simple content model + // + if ((specNode->getFirst()->getType() == ContentSpecNode::Leaf) + && (specNode->getSecond()->getType() == ContentSpecNode::Leaf)) + { + return new (getMemoryManager()) SimpleContentModel + ( + true + , specNode->getFirst()->getElement() + , specNode->getSecond()->getElement() + , specNode->getType() + , getMemoryManager() + ); + } + } + else if ((specNode->getType() == ContentSpecNode::OneOrMore) + || (specNode->getType() == ContentSpecNode::ZeroOrMore) + || (specNode->getType() == ContentSpecNode::ZeroOrOne)) + { + // + // Its a repetition, so see if its one child is a leaf. If so its a + // repetition of a single element, so we can do a simple content + // model for that. + // + if (specNode->getFirst()->getType() == ContentSpecNode::Leaf) + { + return new (getMemoryManager()) SimpleContentModel + ( + true + , specNode->getFirst()->getElement() + , 0 + , specNode->getType() + , getMemoryManager() + ); + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, getMemoryManager()); + } + + // Its not any simple type of content, so create a DFA based content model + return new (getMemoryManager()) DFAContentModel + ( + true + , this->getContentSpec() + , getMemoryManager() + ); +} + + +void DTDElementDecl::faultInAttDefList() const +{ + // Use a hash modulus of 29 and tell it owns its elements + ((DTDElementDecl*)this)->fAttDefs = new (getMemoryManager()) RefHashTableOf(29, true, getMemoryManager()); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDElementDecl) + +void DTDElementDecl::serialize(XSerializeEngine& serEng) +{ + + XMLElementDecl::serialize(serEng); + + if (serEng.isStoring()) + { + serEng<<(int) fModelType; + + /*** + * + * Serialize RefHashTableOf + * + ***/ + XTemplateSerializer::storeObject(fAttDefs, serEng); + + serEng<>i; + fModelType=(ModelTypes)i; + + /*** + * + * Deserialize RefHashTableOf + * + ***/ + XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng); + + serEng>>fAttList; + serEng>>fContentSpec; + + /*** + * don't deserialize + * + * XMLContentModel* fContentModel; + * XMLCh* fFormattedModel; + * + ***/ + fContentModel = 0; + fFormattedModel = 0; + } + +} + +XMLElementDecl::objectType DTDElementDecl::getObjectType() const +{ + return DTD; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.hpp new file mode 100644 index 000000000..b082af729 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDElementDecl.hpp @@ -0,0 +1,247 @@ +/* + * 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: DTDElementDecl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDELEMENTDECL_HPP) +#define XERCESC_INCLUDE_GUARD_DTDELEMENTDECL_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; +class DTDAttDefList; + + +// +// This class is a derivative of the basic element decl. This one implements +// the virtuals so that they work for a DTD. The big difference is that +// they don't live in any URL in the DTD. The names are just stored as full +// QNames, so they are not split out and element decls don't live within +// URL namespaces or anything like that. +// + +class VALIDATORS_EXPORT DTDElementDecl : public XMLElementDecl +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // + // ModelTypes + // Indicates the type of content model that an element has. This + // indicates how the content model is represented and validated. + // ----------------------------------------------------------------------- + enum ModelTypes + { + Empty + , Any + , Mixed_Simple + , Children + + , ModelTypes_Count + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + DTDElementDecl + ( + const XMLCh* const elemRawName + , const unsigned int uriId + , const ModelTypes modelType + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DTDElementDecl + ( + QName* const elementName + , const ModelTypes modelType = Any + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~DTDElementDecl(); + + + // ----------------------------------------------------------------------- + // The virtual element decl interface + // ----------------------------------------------------------------------- + virtual XMLAttDefList& getAttDefList() const; + virtual CharDataOpts getCharDataOpts() const; + virtual bool hasAttDefs() const; + virtual const ContentSpecNode* getContentSpec() const; + virtual ContentSpecNode* getContentSpec(); + virtual void setContentSpec(ContentSpecNode* toAdopt); + virtual XMLContentModel* getContentModel(); + virtual void setContentModel(XMLContentModel* const newModelToAdopt); + virtual const XMLCh* getFormattedContentModel () const; + + // ----------------------------------------------------------------------- + // Support keyed collections + // + // This method allows objects of this type be placed into one of the + // standard keyed collections. This method will return the full name of + // the element, which will vary depending upon the type of the grammar. + // ----------------------------------------------------------------------- + const XMLCh* getKey() const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const DTDAttDef* getAttDef(const XMLCh* const attName) const; + DTDAttDef* getAttDef(const XMLCh* const attName); + ModelTypes getModelType() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void addAttDef(DTDAttDef* const toAdd); + void setModelType(const DTDElementDecl::ModelTypes toSet); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDElementDecl) + + virtual XMLElementDecl::objectType getObjectType() const; + +private : + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void faultInAttDefList() const; + XMLContentModel* createChildModel() ; + XMLContentModel* makeContentModel() ; + XMLCh* formatContentModel () const ; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDElementDecl(const DTDElementDecl &); + DTDElementDecl& operator = (const DTDElementDecl&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fAttDefs + // The list of attributes that are defined for this element. Each + // element is its own little 'namespace' for attributes, so each + // element maintains its own list of owned attribute defs. It is + // faulted in when an attribute is actually added. + // + // fAttList + // We have to return a view of our att defs via the abstract view + // that the scanner understands. It may or may not ever be asked + // for so we fault it in as needed. + // + // fContentSpec + // This is the content spec for the node. It contains the original + // content spec that was read from the DTD, as a tree of nodes. This + // one is always set up, and is used to build the fContentModel + // version if we are validating. + // + // fModelType + // The content model type of this element. This tells us what kind + // of content model to create. + // + // fContentModel + // The content model object for this element. It is stored here via + // its abstract interface. + // + // fFormattedModel + // This is a faulted in member. When the outside world asks for + // our content model as a string, we format it and fault it into + // this field (to avoid doing the formatted over and over.) + // ----------------------------------------------------------------------- + ModelTypes fModelType; + + RefHashTableOf* fAttDefs; + DTDAttDefList* fAttList; + ContentSpecNode* fContentSpec; + XMLContentModel* fContentModel; + XMLCh* fFormattedModel; +}; + +// --------------------------------------------------------------------------- +// DTDElementDecl: XMLElementDecl virtual interface implementation +// --------------------------------------------------------------------------- +inline ContentSpecNode* DTDElementDecl::getContentSpec() +{ + return fContentSpec; +} + +inline const ContentSpecNode* DTDElementDecl::getContentSpec() const +{ + return fContentSpec; +} + +inline XMLContentModel* DTDElementDecl::getContentModel() +{ + if (!fContentModel) + fContentModel = makeContentModel(); + return fContentModel; +} + +inline void +DTDElementDecl::setContentModel(XMLContentModel* const newModelToAdopt) +{ + delete fContentModel; + fContentModel = newModelToAdopt; + + // reset formattedModel + if (fFormattedModel) + { + getMemoryManager()->deallocate(fFormattedModel); + fFormattedModel = 0; + } +} + +// --------------------------------------------------------------------------- +// DTDElementDecl: Miscellaneous methods +// --------------------------------------------------------------------------- +inline const XMLCh* DTDElementDecl::getKey() const +{ + return getFullName(); +} + +// --------------------------------------------------------------------------- +// DTDElementDecl: Getter methods +// --------------------------------------------------------------------------- +inline DTDElementDecl::ModelTypes DTDElementDecl::getModelType() const +{ + return fModelType; +} + +// --------------------------------------------------------------------------- +// DTDElementDecl: Setter methods +// --------------------------------------------------------------------------- +inline void +DTDElementDecl::setModelType(const DTDElementDecl::ModelTypes toSet) +{ + fModelType = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.cpp new file mode 100644 index 000000000..472cfc134 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.cpp @@ -0,0 +1,54 @@ +/* + * 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: DTDEntityDecl.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDEntityDecl) + +void DTDEntityDecl::serialize(XSerializeEngine& serEng) +{ + XMLEntityDecl::serialize(serEng); + + if (serEng.isStoring()) + { + serEng<>fDeclaredInIntSubset; + serEng>>fIsParameter; + serEng>>fIsSpecialChar; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.hpp new file mode 100644 index 000000000..868db1383 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDEntityDecl.hpp @@ -0,0 +1,204 @@ +/* + * 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: DTDEntityDecl.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDENTITYDECL_HPP) +#define XERCESC_INCLUDE_GUARD_DTDENTITYDECL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This is a derivative of the abstract version of an entity decl in the +// framework directory. We just need to provide implementation of a couple +// of methods. +// +class VALIDATORS_EXPORT DTDEntityDecl : public XMLEntityDecl +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + DTDEntityDecl + ( + const XMLCh* const entName + , const bool fromIntSubset = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DTDEntityDecl + ( + const XMLCh* const entName + , const XMLCh* const value + , const bool fromIntSubset = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DTDEntityDecl + ( + const XMLCh* const entName + , const XMLCh value + , const bool fromIntSubset = false + , const bool specialChar = false + ); + ~DTDEntityDecl(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual XMLEntityDecl interface + // ----------------------------------------------------------------------- + virtual bool getDeclaredInIntSubset() const; + virtual bool getIsParameter() const; + virtual bool getIsSpecialChar() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setDeclaredInIntSubset(const bool newValue); + void setIsParameter(const bool newValue); + void setIsSpecialChar(const bool newValue); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDEntityDecl) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDEntityDecl(const DTDEntityDecl&); + DTDEntityDecl& operator=(DTDEntityDecl&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fDeclaredInIntSubset + // Indicates whether the entity was declared in the internal subset + // or not. If not, it cannot be referred to from a standalone + // document. + // + // fIsParameter + // Indicates whether this is a parameter entity or a general entity. + // + // fIsSpecialChar + // This indicates that its one of the special character entities, + // e.g. lt or gt or amp. We need to know this because there are + // places where only a numeric char ref or special char ref is valid + // and all others are ignored or illegal. + // ----------------------------------------------------------------------- + bool fDeclaredInIntSubset; + bool fIsParameter; + bool fIsSpecialChar; +}; + + +// --------------------------------------------------------------------------- +// DTDEntityDecl: Constructors and Destructor +// --------------------------------------------------------------------------- +inline DTDEntityDecl::DTDEntityDecl(MemoryManager* const manager) : + + XMLEntityDecl(manager) + , fDeclaredInIntSubset(false) + , fIsParameter(false) + , fIsSpecialChar(false) +{ +} + +inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const entName + , const bool fromIntSubset + , MemoryManager* const manager) : + + XMLEntityDecl(entName, manager) + , fDeclaredInIntSubset(fromIntSubset) + , fIsParameter(false) + , fIsSpecialChar(false) +{ +} + +inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const entName + , const XMLCh* const value + , const bool fromIntSubset + , MemoryManager* const manager) : + XMLEntityDecl(entName, value, manager) + , fDeclaredInIntSubset(fromIntSubset) + , fIsParameter(false) + , fIsSpecialChar(false) +{ +} + +inline DTDEntityDecl::DTDEntityDecl(const XMLCh* const entName + , const XMLCh value + , const bool fromIntSubset + , const bool specialChar) : + XMLEntityDecl(entName, value, XMLPlatformUtils::fgMemoryManager) + , fDeclaredInIntSubset(fromIntSubset) + , fIsParameter(false) + , fIsSpecialChar(specialChar) +{ +} + +inline DTDEntityDecl::~DTDEntityDecl() +{ +} + + +// --------------------------------------------------------------------------- +// DTDEntityDecl: Getter methods +// --------------------------------------------------------------------------- +inline bool DTDEntityDecl::getDeclaredInIntSubset() const +{ + return fDeclaredInIntSubset; +} + +inline bool DTDEntityDecl::getIsParameter() const +{ + return fIsParameter; +} + +inline bool DTDEntityDecl::getIsSpecialChar() const +{ + return fIsSpecialChar; +} + + +// --------------------------------------------------------------------------- +// DTDEntityDecl: Setter methods +// --------------------------------------------------------------------------- +inline void DTDEntityDecl::setDeclaredInIntSubset(const bool newValue) +{ + fDeclaredInIntSubset = newValue; +} + +inline void DTDEntityDecl::setIsParameter(const bool newValue) +{ + fIsParameter = newValue; +} + +inline void DTDEntityDecl::setIsSpecialChar(const bool newValue) +{ + fIsSpecialChar = newValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.cpp new file mode 100644 index 000000000..dffa464a1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.cpp @@ -0,0 +1,263 @@ +/* + * 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: DTDGrammar.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DTDGrammar: Static member data +// --------------------------------------------------------------------------- +NameIdPool* DTDGrammar::fDefaultEntities = 0; + +void XMLInitializer::initializeDTDGrammar() +{ + DTDGrammar::fDefaultEntities = new NameIdPool(11, 12); + + // Add the default entity entries for the character refs that must + // always be present. We indicate that they are from the internal + // subset. They aren't really, but they have to look that way so + // that they are still valid for use within a standalone document. + // + // We also mark them as special char entities, which allows them + // to be used in places whether other non-numeric general entities + // cannot. + // + if (DTDGrammar::fDefaultEntities) + { + DTDGrammar::fDefaultEntities->put(new DTDEntityDecl(XMLUni::fgAmp, chAmpersand, true, true)); + DTDGrammar::fDefaultEntities->put(new DTDEntityDecl(XMLUni::fgLT, chOpenAngle, true, true)); + DTDGrammar::fDefaultEntities->put(new DTDEntityDecl(XMLUni::fgGT, chCloseAngle, true, true)); + DTDGrammar::fDefaultEntities->put(new DTDEntityDecl(XMLUni::fgQuot, chDoubleQuote, true, true)); + DTDGrammar::fDefaultEntities->put(new DTDEntityDecl(XMLUni::fgApos, chSingleQuote, true, true)); + } +} + +void XMLInitializer::terminateDTDGrammar() +{ + delete DTDGrammar::fDefaultEntities; + DTDGrammar::fDefaultEntities = 0; +} + +//--------------------------------------------------------------------------- +// DTDGrammar: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDGrammar::DTDGrammar(MemoryManager* const manager) : + fMemoryManager(manager) + , fElemDeclPool(0) + , fElemNonDeclPool(0) + , fEntityDeclPool(0) + , fNotationDeclPool(0) + , fGramDesc(0) + , fValidated(false) +{ + // + // Init all the pool members. + // + // Investigate what the optimum values would be for the various + // pools. + // + fElemDeclPool = new (fMemoryManager) NameIdPool(109, 128, fMemoryManager); + // should not need this in the common situation where grammars + // are built once and then read - NG + //fElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + fEntityDeclPool = new (fMemoryManager) NameIdPool(109, 128, fMemoryManager); + fNotationDeclPool = new (fMemoryManager) NameIdPool(109, 128, fMemoryManager); + + //REVISIT: use grammarPool to create + fGramDesc = new (fMemoryManager) XMLDTDDescriptionImpl(XMLUni::fgDTDEntityString, fMemoryManager); +} + +DTDGrammar::~DTDGrammar() +{ + delete fElemDeclPool; + if(fElemNonDeclPool) + { + delete fElemNonDeclPool; + } + delete fEntityDeclPool; + delete fNotationDeclPool; + delete fGramDesc; +} + +// ----------------------------------------------------------------------- +// Virtual methods +// ----------------------------------------------------------------------- +XMLElementDecl* DTDGrammar::findOrAddElemDecl (const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const + , const XMLCh* const qName + , unsigned int scope + , bool& wasAdded ) +{ + // See it it exists + DTDElementDecl* retVal = (DTDElementDecl*) getElemDecl(uriId, baseName, qName, scope); + + // if not, then add this in + if (!retVal) + { + retVal = new (fMemoryManager) DTDElementDecl + ( + qName + , uriId + , DTDElementDecl::Any + , fMemoryManager + ); + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + const XMLSize_t elemId = fElemNonDeclPool->put(retVal); + retVal->setId(elemId); + wasAdded = true; + } + else + { + wasAdded = false; + } + return retVal; +} + +XMLElementDecl* DTDGrammar::putElemDecl (const unsigned int uriId + , const XMLCh* const + , const XMLCh* const + , const XMLCh* const qName + , unsigned int + , const bool notDeclared) +{ + DTDElementDecl* retVal = new (fMemoryManager) DTDElementDecl + ( + qName + , uriId + , DTDElementDecl::Any + , fMemoryManager + ); + if(notDeclared) + { + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + retVal->setId(fElemNonDeclPool->put(retVal)); + } else + { + retVal->setId(fElemDeclPool->put(retVal)); + } + return retVal; +} + +void DTDGrammar::reset() +{ + // + // We need to reset all of the pools. + // + fElemDeclPool->removeAll(); + // now that we have this, no point in deleting it... + if(fElemNonDeclPool) + fElemNonDeclPool->removeAll(); + fNotationDeclPool->removeAll(); + fEntityDeclPool->removeAll(); + fValidated = false; +} + +void DTDGrammar::setGrammarDescription( XMLGrammarDescription* gramDesc) +{ + if ((!gramDesc) || + (gramDesc->getGrammarType() != Grammar::DTDGrammarType)) + return; + + if (fGramDesc) + delete fGramDesc; + + //adopt the grammar Description + fGramDesc = (XMLDTDDescription*) gramDesc; +} + +XMLGrammarDescription* DTDGrammar::getGrammarDescription() const +{ + return fGramDesc; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DTDGrammar) + +void DTDGrammar::serialize(XSerializeEngine& serEng) +{ + + Grammar::serialize(serEng); + + //don't serialize fDefaultEntities + + if (serEng.isStoring()) + { + /*** + * + * Serialize NameIdPool* fElemDeclPool; + * Serialize NameIdPool* fEntityDeclPool; + * Serialize NameIdPool* fNotationDeclPool; + ***/ + XTemplateSerializer::storeObject(fElemDeclPool, serEng); + XTemplateSerializer::storeObject(fEntityDeclPool, serEng); + XTemplateSerializer::storeObject(fNotationDeclPool, serEng); + + /*** + * serialize() method shall be used to store object + * which has been created in ctor + ***/ + fGramDesc->serialize(serEng); + + serEng<* fElemDeclPool; + * Deserialize NameIdPool* fEntityDeclPool; + * Deerialize NameIdPool* fNotationDeclPool; + ***/ + XTemplateSerializer::loadObject(&fElemDeclPool, 109, 128, serEng); + fElemNonDeclPool = 0; + XTemplateSerializer::loadObject(&fEntityDeclPool, 109, 128, serEng); + XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); + + /*** + * serialize() method shall be used to load object + * which has been created in ctor + ***/ + fGramDesc->serialize(serEng); + + serEng>>fValidated; + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.hpp new file mode 100644 index 000000000..c1de421c5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDGrammar.hpp @@ -0,0 +1,391 @@ +/* + * 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: DTDGrammar.hpp 883368 2009-11-23 15:28:19Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDGRAMMAR_HPP) +#define XERCESC_INCLUDE_GUARD_DTDGRAMMAR_HPP + +#include +#include +#include +#include +#include +#include +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class stores the DTD information +// NOTE: DTDs are not namespace aware, so we just use regular NameIdPool +// data structures to store element and attribute decls. They are all set +// to be in the global namespace and the full QName is used as the base name +// of the decl. This means that all the URI parameters below are expected +// to be null pointers (and anything else will cause an exception.) +// + +class VALIDATORS_EXPORT DTDGrammar : public Grammar +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDGrammar(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~DTDGrammar(); + + // ----------------------------------------------------------------------- + // Implementation of Virtual Interface + // ----------------------------------------------------------------------- + virtual Grammar::GrammarType getGrammarType() const; + virtual const XMLCh* getTargetNamespace() const; + + // this method should only be used while the grammar is being + // constructed, not while it is being used + // in a validation episode! + virtual XMLElementDecl* findOrAddElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , bool& wasAdded + ) ; + + virtual XMLSize_t getElemId + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const ; + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const ; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ); + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ) const; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ); + + virtual const XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + ) const; + + virtual XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + ); + + virtual bool getValidated() const; + + virtual XMLElementDecl* putElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , const bool notDeclared = false + ); + + virtual XMLSize_t putElemDecl + ( + XMLElementDecl* const elemDecl + , const bool notDeclared = false + ) ; + + virtual XMLSize_t putNotationDecl + ( + XMLNotationDecl* const notationDecl + ) const; + + virtual void setValidated(const bool newState); + + virtual void reset(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + + const DTDEntityDecl* getEntityDecl(const XMLCh* const entName) const; + DTDEntityDecl* getEntityDecl(const XMLCh* const entName); + NameIdPool* getEntityDeclPool(); + const NameIdPool* getEntityDeclPool() const; + NameIdPoolEnumerator getElemEnumerator() const; + NameIdPoolEnumerator getEntityEnumerator() const; + NameIdPoolEnumerator getNotationEnumerator() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + virtual void setGrammarDescription( XMLGrammarDescription*); + virtual XMLGrammarDescription* getGrammarDescription() const; + + // ----------------------------------------------------------------------- + // Content management methods + // ----------------------------------------------------------------------- + XMLSize_t putEntityDecl(DTDEntityDecl* const entityDecl) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DTDGrammar) + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDGrammar(const DTDGrammar &); + DTDGrammar& operator = (const DTDGrammar&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fElemDeclPool + // This is the element decl pool. It contains all of the elements + // declared in the DTD (and their associated attributes.) + // + // fElemNonDeclPool + // This is the element decl pool that is is populated as new elements + // are seen in the XML document (not declared in the DTD), and they + // are given default characteristics. + // + // fEntityDeclPool + // This is a pool of EntityDecl objects, which contains all of the + // general entities that are declared in the DTD subsets, plus the + // default entities (such as > < ...) defined by the XML Standard. + // + // fNotationDeclPool + // This is a pool of NotationDecl objects, which contains all of the + // notations declared in the DTD subsets. + // + // fValidated + // Indicates if the content of the Grammar has been pre-validated + // or not. When using a cached grammar, no need for pre content + // validation. + // + // fGramDesc: adopted + // + // ----------------------------------------------------------------------- + static NameIdPool* fDefaultEntities; + MemoryManager* fMemoryManager; + NameIdPool* fElemDeclPool; + NameIdPool* fElemNonDeclPool; + NameIdPool* fEntityDeclPool; + NameIdPool* fNotationDeclPool; + XMLDTDDescription* fGramDesc; + + bool fValidated; + + friend class XMLInitializer; +}; + +// --------------------------------------------------------------------------- +// DTDGrammar: Getter methods +// --------------------------------------------------------------------------- +inline NameIdPoolEnumerator +DTDGrammar::getElemEnumerator() const +{ + return NameIdPoolEnumerator(fElemDeclPool, fMemoryManager); +} + +inline NameIdPoolEnumerator +DTDGrammar::getEntityEnumerator() const +{ + return NameIdPoolEnumerator(fEntityDeclPool, fMemoryManager); +} + +inline NameIdPoolEnumerator +DTDGrammar::getNotationEnumerator() const +{ + return NameIdPoolEnumerator(fNotationDeclPool, fMemoryManager); +} + +inline const DTDEntityDecl* +DTDGrammar::getEntityDecl(const XMLCh* const entName) const +{ + DTDEntityDecl* decl = fDefaultEntities->getByKey(entName); + + if (!decl) + return fEntityDeclPool->getByKey(entName); + + return decl; +} + +inline DTDEntityDecl* DTDGrammar::getEntityDecl(const XMLCh* const entName) +{ + DTDEntityDecl* decl = fDefaultEntities->getByKey(entName); + + if (!decl) + return fEntityDeclPool->getByKey(entName); + + return decl; +} + + +inline NameIdPool* DTDGrammar::getEntityDeclPool() +{ + return fEntityDeclPool; +} + +inline const NameIdPool* DTDGrammar::getEntityDeclPool() const +{ + return fEntityDeclPool; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +inline XMLSize_t DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl) const +{ + return fEntityDeclPool->put(entityDecl); +} + + +// --------------------------------------------------------------------------- +// DTDGrammar: Virtual methods +// --------------------------------------------------------------------------- +inline Grammar::GrammarType DTDGrammar::getGrammarType() const { + return Grammar::DTDGrammarType; +} + +inline const XMLCh* DTDGrammar::getTargetNamespace() const { + return XMLUni::fgZeroLenString; +} + +// Element Decl +inline XMLSize_t DTDGrammar::getElemId (const unsigned int + , const XMLCh* const + , const XMLCh* const qName + , unsigned int) const +{ + // + // In this case, we don't return zero to mean 'not found', so we have to + // map it to the official not found value if we don't find it. + // + const DTDElementDecl* decl = fElemDeclPool->getByKey(qName); + if (!decl) + return XMLElementDecl::fgInvalidElemId; + return decl->getId(); +} + +inline const XMLElementDecl* DTDGrammar::getElemDecl( const unsigned int + , const XMLCh* const + , const XMLCh* const qName + , unsigned int) const +{ + const XMLElementDecl* elemDecl = fElemDeclPool->getByKey(qName); + + if (!elemDecl && fElemNonDeclPool) + elemDecl = fElemNonDeclPool->getByKey(qName); + + return elemDecl; +} + +inline XMLElementDecl* DTDGrammar::getElemDecl (const unsigned int + , const XMLCh* const + , const XMLCh* const qName + , unsigned int) +{ + XMLElementDecl* elemDecl = fElemDeclPool->getByKey(qName); + + if (!elemDecl && fElemNonDeclPool) + elemDecl = fElemNonDeclPool->getByKey(qName); + + return elemDecl; +} + +inline const XMLElementDecl* DTDGrammar::getElemDecl(const unsigned int elemId) const +{ + // Look up this element decl by id + return fElemDeclPool->getById(elemId); +} + +inline XMLElementDecl* DTDGrammar::getElemDecl(const unsigned int elemId) +{ + // Look up this element decl by id + return fElemDeclPool->getById(elemId); +} + +inline XMLSize_t +DTDGrammar::putElemDecl(XMLElementDecl* const elemDecl, + const bool notDeclared) +{ + if (notDeclared) + { + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) NameIdPool(29, 128, fMemoryManager); + return fElemNonDeclPool->put((DTDElementDecl*) elemDecl); + } + + return fElemDeclPool->put((DTDElementDecl*) elemDecl); +} + +// Notation Decl +inline const XMLNotationDecl* DTDGrammar::getNotationDecl(const XMLCh* const notName) const +{ + return fNotationDeclPool->getByKey(notName); +} + +inline XMLNotationDecl* DTDGrammar::getNotationDecl(const XMLCh* const notName) +{ + return fNotationDeclPool->getByKey(notName); +} + +inline XMLSize_t DTDGrammar::putNotationDecl(XMLNotationDecl* const notationDecl) const +{ + return fNotationDeclPool->put(notationDecl); +} + +inline bool DTDGrammar::getValidated() const +{ + return fValidated; +} + +inline void DTDGrammar::setValidated(const bool newState) +{ + fValidated = newState; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.cpp new file mode 100644 index 000000000..f02fcba38 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.cpp @@ -0,0 +1,3886 @@ +/* + * 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: DTDScanner.cpp 833045 2009-11-05 13:21:27Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- +// +// This method automates the grunt work of looking at a char and see if its +// a repetition suffix. If so, it creates a new correct rep node and wraps +// the pass node in it. Otherwise, it returns the previous node. +// +static ContentSpecNode* makeRepNode(const XMLCh testCh, + ContentSpecNode* const prevNode, + MemoryManager* const manager) +{ + if (testCh == chQuestion) + { + return new (manager) ContentSpecNode + ( + ContentSpecNode::ZeroOrOne + , prevNode + , 0 + , true + , true + , manager + ); + } + else if (testCh == chPlus) + { + return new (manager) ContentSpecNode + ( + ContentSpecNode::OneOrMore + , prevNode + , 0 + , true + , true + , manager + ); + } + else if (testCh == chAsterisk) + { + return new (manager) ContentSpecNode + ( + ContentSpecNode::ZeroOrMore + , prevNode + , 0 + , true + , true + , manager + ); + } + + // Just return the incoming node + return prevNode; +} + +// --------------------------------------------------------------------------- +// DTDValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDScanner::DTDScanner( DTDGrammar* dtdGrammar + , DocTypeHandler* const docTypeHandler + , MemoryManager* const grammarPoolMemoryManager + , MemoryManager* const manager) : + fMemoryManager(manager) + , fGrammarPoolMemoryManager(grammarPoolMemoryManager) + , fDocTypeHandler(docTypeHandler) + , fDumAttDef(0) + , fDumElemDecl(0) + , fDumEntityDecl(0) + , fInternalSubset(false) + , fNextAttrId(1) + , fDTDGrammar(dtdGrammar) + , fBufMgr(0) + , fReaderMgr(0) + , fScanner(0) + , fPEntityDeclPool(0) + , fEmptyNamespaceId(0) + , fDocTypeReaderId(0) +{ + fPEntityDeclPool = new (fMemoryManager) NameIdPool(109, 128, fMemoryManager); +} + +DTDScanner::~DTDScanner() +{ + delete fDumAttDef; + delete fDumElemDecl; + delete fDumEntityDecl; + delete fPEntityDeclPool; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +void DTDScanner::setScannerInfo(XMLScanner* const owningScanner + , ReaderMgr* const readerMgr + , XMLBufferMgr* const bufMgr) +{ + // We don't own any of these, we just reference them + fScanner = owningScanner; + fReaderMgr = readerMgr; + fBufMgr = bufMgr; + + if (fScanner->getDoNamespaces()) + fEmptyNamespaceId = fScanner->getEmptyNamespaceId(); + else + fEmptyNamespaceId = 0; + + fDocTypeReaderId = fReaderMgr->getCurrentReaderNum(); +} + + +// --------------------------------------------------------------------------- +// DTDScanner: Private scanning methods +// --------------------------------------------------------------------------- +bool DTDScanner::checkForPERef( const bool inLiteral + , const bool inMarkup) +{ + bool gotSpace = false; + + // + // See if we have any spaces up front. If so, then skip them and set + // the gotSpaces flag. + // + if (fReaderMgr->skippedSpace()) + { + fReaderMgr->skipPastSpaces(); + gotSpace = true; + } + + // If the next char is a percent, then expand the PERef + if (!fReaderMgr->skippedChar(chPercent)) + return gotSpace; + + while (true) + { + if (!expandPERef(false, inLiteral, inMarkup, false)) + fScanner->emitError(XMLErrs::ExpectedEntityRefName); + // And skip any more spaces in the expanded value + if (fReaderMgr->skippedSpace()) + { + fReaderMgr->skipPastSpaces(); + gotSpace = true; + } + if (!fReaderMgr->skippedChar(chPercent)) + break; + } + return gotSpace; +} + + +bool DTDScanner::expandPERef( const bool scanExternal + , const bool inLiteral + , const bool inMarkup + , const bool throwEndOfExt) +{ + fScanner->setHasNoDTD(false); + XMLBufBid bbName(fBufMgr); + + // + // If we are in the internal subset and in markup, then this is + // an error but we go ahead and do it anyway. + // + if (fInternalSubset && inMarkup) + fScanner->emitError(XMLErrs::PERefInMarkupInIntSubset); + + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedPEName); + + // Skip the semicolon if that's what we ended up on + fReaderMgr->skippedChar(chSemiColon); + return false; + } + + // If no terminating semicolon, emit an error but try to keep going + if (!fReaderMgr->skippedChar(chSemiColon)) + fScanner->emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // + // Look it up in the PE decl pool and see if it exists. If not, just + // emit an error and continue. + // + XMLEntityDecl* decl = fPEntityDeclPool->getByKey(bbName.getRawBuffer()); + if (!decl) + { + // XML 1.0 Section 4.1 + if (fScanner->getStandalone()) { + // no need to check fScanner->fHasNoDTD which is for sure false + // since we are in expandPERef already + fScanner->emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + } + else { + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::VC_EntityNotFound, bbName.getRawBuffer()); + } + + return false; + } + + // + // XML 1.0 Section 2.9 + // If we are a standalone document, then it has to have been declared + // in the internal subset. Keep going though. + // + if (fScanner->getValidationScheme() == XMLScanner::Val_Always && fScanner->getStandalone() && !decl->getDeclaredInIntSubset()) + fScanner->getValidator()->emitError(XMLValid::VC_IllegalRefInStandalone, bbName.getRawBuffer()); + + // + // Okee dokee, we found it. So create either a memory stream with + // the entity value contents, or a file stream if its an external + // entity. + // + if (decl->isExternal()) + { + // And now create a reader to read this entity + InputSource* srcUsed; + XMLReader* reader = fReaderMgr->createReader + ( + decl->getBaseURI() + , decl->getSystemId() + , decl->getPublicId() + , false + , inLiteral ? XMLReader::RefFrom_Literal : XMLReader::RefFrom_NonLiteral + , XMLReader::Type_PE + , XMLReader::Source_External + , srcUsed + , fScanner->getCalculateSrcOfs() + , fScanner->getLowWaterMark() + , fScanner->getDisableDefaultEntityResolution() + ); + + // Put a janitor on the source so its cleaned up on exit + Janitor janSrc(srcUsed); + + // If the creation failed then throw an exception + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenExtEntity, srcUsed ? srcUsed->getSystemId() : decl->getSystemId(), fMemoryManager); + + // Set the 'throw at end' flag, to the one we were given + reader->setThrowAtEnd(throwEndOfExt); + + // + // Push the reader. If its a recursive expansion, then emit an error + // and return an failure. + // + if (!fReaderMgr->pushReader(reader, decl)) + { + fScanner->emitError(XMLErrs::RecursiveEntity, decl->getName()); + return false; + } + + // + // If the caller wants us to scan the external entity, then lets + // do that now. + // + if (scanExternal) + { + XMLEntityHandler* entHandler = fScanner->getEntityHandler(); + + // If we have an entity handler, tell it we are starting this entity + if (entHandler) + entHandler->startInputSource(*srcUsed); + + // + // Scan the external entity now. The parameter tells it that + // it is not in an include section. Get the current reader + // level so we can catch partial markup errors and be sure + // to get back to here if we get an exception out of the + // ext subset scan. + // + const XMLSize_t readerNum = fReaderMgr->getCurrentReaderNum(); + try + { + scanExtSubsetDecl(false, false); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) + { + // Pop the reader back to the original level + fReaderMgr->cleanStackBackTo(readerNum); + + // End the input source, even though its not happy + if (entHandler) + entHandler->endInputSource(*srcUsed); + throw; + } + + // If we have an entity handler, tell it we are ending this entity + if (entHandler) + entHandler->endInputSource(*srcUsed); + } + else { + // If it starts with the XML string, then parse a text decl + if (fScanner->checkXMLDecl(true)) + scanTextDecl(); + } + } + else + { + // Create a reader over a memory stream over the entity value + XMLReader* valueReader = fReaderMgr->createIntEntReader + ( + decl->getName() + , inLiteral ? XMLReader::RefFrom_Literal : XMLReader::RefFrom_NonLiteral + , XMLReader::Type_PE + , decl->getValue() + , decl->getValueLen() + , false + ); + + // + // Trt to push the entity reader onto the reader manager stack, + // where it will become the subsequent input. If it fails, that + // means the entity is recursive, so issue an error. The reader + // will have just been discarded, but we just keep going. + // + if (!fReaderMgr->pushReader(valueReader, decl)) + fScanner->emitError(XMLErrs::RecursiveEntity, decl->getName()); + } + + return true; +} + + +bool DTDScanner::getQuotedString(XMLBuffer& toFill) +{ + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr->skipIfQuote(quoteCh)) + return false; + + XMLCh nextCh; + // Get another char and see if it matches the starting quote char + while ((nextCh=fReaderMgr->getNextChar())!=quoteCh) + { + // + // We should never get either an end of file null char here. If we + // do, just fail. It will be handled more gracefully in the higher + // level code that called us. + // + if (!nextCh) + return false; + + // Else add it to the buffer + toFill.append(nextCh); + } + return true; +} + + +XMLAttDef* +DTDScanner::scanAttDef(DTDElementDecl& parentElem, XMLBuffer& bufToUse) +{ + // Check for PE ref or optional whitespace + checkForPERef(false, true); + + // Get the name of the attribute + if (!fReaderMgr->getName(bufToUse)) + { + fScanner->emitError(XMLErrs::ExpectedAttrName); + return 0; + } + + // + // Look up this attribute in the parent element's attribute list. If + // it already exists, then use the dummy. + // + DTDAttDef* decl = parentElem.getAttDef(bufToUse.getRawBuffer()); + if (decl) + { + // It already exists, so put out a warning + fScanner->emitError + ( + XMLErrs::AttListAlreadyExists + , bufToUse.getRawBuffer() + , parentElem.getFullName() + ); + + // Use the dummy decl to parse into and set its name to the name we got + if (!fDumAttDef) + { + fDumAttDef = new (fMemoryManager) DTDAttDef(fMemoryManager); + fDumAttDef->setId(fNextAttrId++); + } + fDumAttDef->setName(bufToUse.getRawBuffer()); + decl = fDumAttDef; + } + else + { + // + // It does not already exist so create a new one, give it the next + // available unique id, and add it + // + decl = new (fGrammarPoolMemoryManager) DTDAttDef + ( + bufToUse.getRawBuffer() + , XMLAttDef::CData + , XMLAttDef::Implied + , fGrammarPoolMemoryManager + ); + decl->setId(fNextAttrId++); + decl->setExternalAttDeclaration(isReadingExternalEntity()); + parentElem.addAttDef(decl); + } + + // Set a flag to indicate whether we are doing a dummy parse + const bool isIgnored = (decl == fDumAttDef); + + // Space is required here, so check for PE ref, and require space + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // + // Next has to be one of the attribute type strings. This tells us what + // is to follow. + // + if (fReaderMgr->skippedString(XMLUni::fgCDATAString)) + { + decl->setType(XMLAttDef::CData); + } + else if (fReaderMgr->skippedString(XMLUni::fgIDString)) + { + if (!fReaderMgr->skippedString(XMLUni::fgRefString)) + decl->setType(XMLAttDef::ID); + else if (!fReaderMgr->skippedChar(chLatin_S)) + decl->setType(XMLAttDef::IDRef); + else + decl->setType(XMLAttDef::IDRefs); + } + else if (fReaderMgr->skippedString(XMLUni::fgEntitString)) + { + if (fReaderMgr->skippedChar(chLatin_Y)) + { + decl->setType(XMLAttDef::Entity); + } + else if (fReaderMgr->skippedString(XMLUni::fgIESString)) + { + decl->setType(XMLAttDef::Entities); + } + else + { + fScanner->emitError + ( + XMLErrs::ExpectedAttributeType + , decl->getFullName() + , parentElem.getFullName() + ); + return 0; + } + } + else if (fReaderMgr->skippedString(XMLUni::fgNmTokenString)) + { + if (fReaderMgr->skippedChar(chLatin_S)) + decl->setType(XMLAttDef::NmTokens); + else + decl->setType(XMLAttDef::NmToken); + } + else if (fReaderMgr->skippedString(XMLUni::fgNotationString)) + { + // Check for PE ref and require space + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + decl->setType(XMLAttDef::Notation); + if (!scanEnumeration(*decl, bufToUse, true)) + return 0; + + // Set the value as the enumeration for this decl + decl->setEnumeration(bufToUse.getRawBuffer()); + } + else if (fReaderMgr->skippedChar(chOpenParen)) + { + decl->setType(XMLAttDef::Enumeration); + if (!scanEnumeration(*decl, bufToUse, false)) + return 0; + + // Set the value as the enumeration for this decl + decl->setEnumeration(bufToUse.getRawBuffer()); + } + else + { + fScanner->emitError + ( + XMLErrs::ExpectedAttributeType + , decl->getFullName() + , parentElem.getFullName() + ); + return 0; + } + + // Space is required here, so check for PE ref, and require space + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // And then scan for the optional default value declaration + scanDefaultDecl(*decl); + + // If validating, then do a couple of validation constraints + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + { + if (decl->getType() == XMLAttDef::ID) + { + if ((decl->getDefaultType() != XMLAttDef::Implied) + && (decl->getDefaultType() != XMLAttDef::Required)) + { + fScanner->getValidator()->emitError(XMLValid::BadIDAttrDefType, decl->getFullName()); + } + } + + // if attdef is xml:space, check correct enumeration (default|preserve) + const XMLCh fgXMLSpace[] = { chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull }; + + if (XMLString::equals(decl->getFullName(),fgXMLSpace)) { + const XMLCh fgPreserve[] = { chLatin_p, chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_r, chLatin_v, chLatin_e, chNull }; + const XMLCh fgDefault[] = { chLatin_d, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull }; + bool ok = false; + if (decl->getType() == XMLAttDef::Enumeration) { + BaseRefVectorOf* enumVector = XMLString::tokenizeString(decl->getEnumeration(), fMemoryManager); + XMLSize_t size = enumVector->size(); + ok = (size == 1 && + (XMLString::equals(enumVector->elementAt(0), fgDefault) || + XMLString::equals(enumVector->elementAt(0), fgPreserve))) || + (size == 2 && + (XMLString::equals(enumVector->elementAt(0), fgDefault) && + XMLString::equals(enumVector->elementAt(1), fgPreserve))) || + (size == 2 && + (XMLString::equals(enumVector->elementAt(1), fgDefault) && + XMLString::equals(enumVector->elementAt(0), fgPreserve))); + delete enumVector; + } + if (!ok) + fScanner->getValidator()->emitError(XMLValid::IllegalXMLSpace); + } + } + + // If we have a doc type handler, tell it about this attdef. + if (fDocTypeHandler) + fDocTypeHandler->attDef(parentElem, *decl, isIgnored); + return decl; +} + + +void DTDScanner::scanAttListDecl() +{ + // Space is required here, so check for a PE ref + if (!checkForPERef(false, true)) + { + fScanner->emitError(XMLErrs::ExpectedWhitespace); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // + // Next should be the name of the element it belongs to, so get a buffer + // and get the name into it. + // + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedElementName); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // + // Find this element's declaration. If it has not been declared yet, + // we will force one into the list, but not mark it as declared. + // + DTDElementDecl* elemDecl = (DTDElementDecl*) fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bbName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE); + if (!elemDecl) + { + // + // Lets fault in a declaration and add it to the pool. We mark + // it having been created because of an attlist. Later, if its + // declared, this will be updated. + // + elemDecl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + bbName.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + elemDecl->setCreateReason(XMLElementDecl::AttList); + elemDecl->setExternalElemDeclaration(isReadingExternalEntity()); + fDTDGrammar->putElemDecl((XMLElementDecl*) elemDecl); + } + + // If we have a doc type handler, tell it the att list is starting + if (fDocTypeHandler) + fDocTypeHandler->startAttList(*elemDecl); + + // + // Now we loop until we are done with all of the attributes in this + // list. We need a buffer to use for local processing. + // + XMLBufBid bbTmp(fBufMgr); + XMLBuffer& tmpBuf = bbTmp.getBuffer(); + bool seenAnId = false; + while (true) + { + // Get the next char out and see what it tells us to do + const XMLCh nextCh = fReaderMgr->peekNextChar(); + + // Watch for EOF + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chCloseAngle) + { + // We are done with this attribute list + fReaderMgr->getNextChar(); + break; + } + else if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + { + // + // If advanced callbacks are enabled and we have a doc + // type handler, then gather up the white space and call + // back on the doctype handler. Otherwise, just skip + // whitespace. + // + if (fDocTypeHandler) + { + fReaderMgr->getSpaces(tmpBuf); + fDocTypeHandler->doctypeWhitespace + ( + tmpBuf.getRawBuffer() + , tmpBuf.getLen() + ); + } + else + { + fReaderMgr->skipPastSpaces(); + } + } + else if (nextCh == chPercent) + { + // Eat the percent and expand the ref + fReaderMgr->getNextChar(); + expandPERef(false, false, true); + } + else + { + // + // It must be an attribute name, so scan it. We let + // it use our local buffer for its name scanning. + // + XMLAttDef* attDef = scanAttDef(*elemDecl, tmpBuf); + + if (!attDef) + { + fReaderMgr->skipPastChar(chCloseAngle); + break; + } + + // + // If we are validating and its an ID type, then we have to + // make sure that we have not seen an id attribute yet. Set + // the flag to say that we've seen one now also. + // + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + { + if (attDef->getType() == XMLAttDef::ID) + { + if (seenAnId) + fScanner->getValidator()->emitError(XMLValid::MultipleIdAttrs, elemDecl->getFullName()); + seenAnId = true; + } + } + } + } + + // If we have a doc type handler, tell it the att list is ending + if (fDocTypeHandler) + fDocTypeHandler->endAttList(*elemDecl); +} + + +// +// This method is called to scan the value of an attribute in content. This +// involves some normalization and replacement of general entity and +// character references. +// +// End of entity's must be dealt with here. During DTD scan, they can come +// from external entities. During content, they can come from any entity. +// We just eat the end of entity and continue with our scan until we come +// to the closing quote. If an unterminated value causes us to go through +// subsequent entities, that will cause errors back in the calling code, +// but there's little we can do about it here. +// +bool DTDScanner::scanAttValue(const XMLCh* const attrName + , XMLBuffer& toFill + , const XMLAttDef::AttTypes type) +{ + enum States + { + InWhitespace + , InContent + }; + + // Reset the target buffer + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr->skipIfQuote(quoteCh)) + return false; + + // + // We have to get the current reader because we have to ignore closing + // quotes until we hit the same reader again. + // + const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum(); + + // + // Loop until we get the attribute value. Note that we use a double + // loop here to avoid the setup/teardown overhead of the exception + // handler on every round. + // + XMLCh nextCh; + XMLCh secondCh = 0; + States curState = InContent; + bool firstNonWS = false; + bool gotLeadingSurrogate = false; + bool escaped; + while (true) + { + try + { + while(true) + { + nextCh = fReaderMgr->getNextChar(); + + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Check for our ending quote in the same entity + if (nextCh == quoteCh) + { + if (curReader == fReaderMgr->getCurrentReaderNum()) + return true; + + // Watch for spillover into a previous entity + if (curReader > fReaderMgr->getCurrentReaderNum()) + { + fScanner->emitError(XMLErrs::PartialMarkupInEntity); + return false; + } + } + + // + // Check for an entity ref now, before we let it affect our + // whitespace normalization logic below. We ignore the empty flag + // in this one. + // + escaped = false; + if (nextCh == chAmpersand) + { + if (scanEntityRef(nextCh, secondCh, escaped) != EntityExp_Returned) + { + gotLeadingSurrogate = false; + continue; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Check for correct surrogate pairs + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError + ( + XMLErrs::InvalidCharacterInAttrValue + , attrName + , tmpBuf + ); + } + + gotLeadingSurrogate = false; + } + + // + // If its not escaped, then make sure its not a < character, which + // is not allowed in attribute values. + // + if (!escaped && (nextCh == chOpenAngle)) + fScanner->emitError(XMLErrs::BracketInAttrValue, attrName); + + // + // If the attribute is a CDATA type we do simple replacement of + // tabs and new lines with spaces, if the character is not escaped + // by way of a char ref. + // + // Otherwise, we do the standard non-CDATA normalization of + // compressing whitespace to single spaces and getting rid of + // leading and trailing whitespace. + // + if (type == XMLAttDef::CData) + { + if (!escaped) + { + if ((nextCh == 0x09) || (nextCh == 0x0A) || (nextCh == 0x0D)) + nextCh = chSpace; + } + } + else + { + if (curState == InWhitespace) + { + if (!fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + { + if (firstNonWS) + toFill.append(chSpace); + curState = InContent; + firstNonWS = true; + } + else + { + continue; + } + } + else if (curState == InContent) + { + if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + { + curState = InWhitespace; + continue; + } + firstNonWS = true; + } + } + + // Else add it to the buffer + toFill.append(nextCh); + + if (secondCh) + { + toFill.append(secondCh); + secondCh=0; + } + } + } + + catch(const EndOfEntityException&) + { + // Just eat it and continue. + gotLeadingSurrogate = false; + escaped = false; + } + } + return true; +} + + +bool DTDScanner::scanCharRef(XMLCh& first, XMLCh& second) +{ + bool gotOne = false; + unsigned int value = 0; + + // + // Set the radix. Its supposed to be a lower case x if hex. But, in + // order to recover well, we check for an upper and put out an error + // for that. + // + unsigned int radix = 10; + + if (fReaderMgr->skippedChar(chLatin_x)) + { + radix = 16; + } + else if (fReaderMgr->skippedChar(chLatin_X)) + { + fScanner->emitError(XMLErrs::HexRadixMustBeLowerCase); + radix = 16; + } + + while (true) + { + const XMLCh nextCh = fReaderMgr->peekNextChar(); + + // Watch for EOF + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + // Break out on the terminating semicolon + if (nextCh == chSemiColon) + { + fReaderMgr->getNextChar(); + break; + } + + // + // Convert this char to a binary value, or bail out if its not + // one. + // + unsigned int nextVal; + if ((nextCh >= chDigit_0) && (nextCh <= chDigit_9)) + nextVal = (unsigned int)(nextCh - chDigit_0); + else if ((nextCh >= chLatin_A) && (nextCh <= chLatin_F)) + nextVal= (unsigned int)(10 + (nextCh - chLatin_A)); + else if ((nextCh >= chLatin_a) && (nextCh <= chLatin_f)) + nextVal = (unsigned int)(10 + (nextCh - chLatin_a)); + else + { + // + // If we got at least a sigit, then do an unterminated ref + // error. Else, do an expected a numerical ref thing. + // + if (gotOne) + fScanner->emitError(XMLErrs::UnterminatedCharRef); + else + fScanner->emitError(XMLErrs::ExpectedNumericalCharRef); + + return false; + } + + // + // Make sure its valid for the radix. If not, then just eat the + // digit and go on after issueing an error. Else, update the + // running value with this new digit. + // + if (nextVal >= radix) + { + XMLCh tmpStr[2]; + tmpStr[0] = nextCh; + tmpStr[1] = chNull; + fScanner->emitError(XMLErrs::BadDigitForRadix, tmpStr); + } + else + { + value = (value * radix) + nextVal; + } + + // Indicate that we got at least one good digit + gotOne = true; + + // Eat the char we just processed + fReaderMgr->getNextChar(); + } + + // Return the char (or chars) + // And check if the character expanded is valid or not + if (value >= 0x10000 && value <= 0x10FFFF) + { + value -= 0x10000; + first = XMLCh((value >> 10) + 0xD800); + second = XMLCh((value & 0x3FF) + 0xDC00); + } + else if (value <= 0xFFFD) + { + first = XMLCh(value); + second = 0; + if (!fReaderMgr->getCurrentReader()->isXMLChar(first) && !fReaderMgr->getCurrentReader()->isControlChar(first)) { + // Character reference was not in the valid range + fScanner->emitError(XMLErrs::InvalidCharacterRef); + return false; + } + } + else { + // Character reference was not in the valid range + fScanner->emitError(XMLErrs::InvalidCharacterRef); + return false; + } + + return true; +} + + +ContentSpecNode* +DTDScanner::scanChildren(const DTDElementDecl& elemDecl, XMLBuffer& bufToUse) +{ + // Check for a PE ref here, but don't require spaces + checkForPERef(false, true); + + ValueStackOf* arrNestedDecl=NULL; + // + // We know that the caller just saw an opening parenthesis, so we need + // to parse until we hit the end of it; if we find several parenthesis, + // store them in an array to be processed later. + // + // We have to check for one up front, since it could be something like + // (((a)*)) etc... + // + ContentSpecNode* curNode = 0; + while(fReaderMgr->skippedChar(chOpenParen)) + { + // to check entity nesting + const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum(); + if(arrNestedDecl==NULL) + arrNestedDecl=new (fMemoryManager) ValueStackOf(5, fMemoryManager); + arrNestedDecl->push(curReader); + + // Check for a PE ref here, but don't require spaces + checkForPERef(false, true); + } + + // We must find a leaf node here, either standalone or nested in the parenthesis + if (!fReaderMgr->getName(bufToUse)) + { + fScanner->emitError(XMLErrs::ExpectedElementName); + return 0; + } + + // + // Create a leaf node for it. If we can find the element id for + // this element, then use it. Else, we have to fault in an element + // decl, marked as created because of being in a content model. + // + XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE); + if (!decl) + { + decl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + bufToUse.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + decl->setCreateReason(XMLElementDecl::InContentModel); + decl->setExternalElemDeclaration(isReadingExternalEntity()); + fDTDGrammar->putElemDecl(decl); + } + curNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + decl->getElementName() + , fGrammarPoolMemoryManager + ); + + // Check for a PE ref here, but don't require spaces + const bool gotSpaces = checkForPERef(false, true); + + // Check for a repetition character after the leaf + XMLCh repCh = fReaderMgr->peekNextChar(); + ContentSpecNode* tmpNode = makeRepNode(repCh, curNode, fGrammarPoolMemoryManager); + if (tmpNode != curNode) + { + if (gotSpaces) + { + if (fScanner->emitErrorWillThrowException(XMLErrs::UnexpectedWhitespace)) + { + delete tmpNode; + } + fScanner->emitError(XMLErrs::UnexpectedWhitespace); + } + fReaderMgr->getNextChar(); + curNode = tmpNode; + } + + while(arrNestedDecl==NULL || !arrNestedDecl->empty()) + { + // Check for a PE ref here, but don't require spaces + checkForPERef(false, true); + + // + // Ok, the next character tells us what kind of content this particular + // model this particular parentesized section is. Its either a choice if + // we see ',', a sequence if we see '|', or a single leaf node if we see + // a closing paren. + // + const XMLCh opCh = fReaderMgr->peekNextChar(); + + if ((opCh != chComma) + && (opCh != chPipe) + && (opCh != chCloseParen)) + { + // Not a legal char, so delete our node and return failure + delete curNode; + fScanner->emitError(XMLErrs::ExpectedSeqChoiceLeaf); + return 0; + } + + // + // Create the head node of the correct type. We need this to remember + // the top of the local tree. If it was a single subexpr, then just + // set the head node to the current node. For the others, we'll build + // the tree off the second child as we move across. + // + ContentSpecNode* headNode = 0; + ContentSpecNode::NodeTypes curType = ContentSpecNode::UnknownType; + if (opCh == chComma) + { + curType = ContentSpecNode::Sequence; + headNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + curType + , curNode + , 0 + , true + , true + , fGrammarPoolMemoryManager + ); + curNode = headNode; + } + else if (opCh == chPipe) + { + curType = ContentSpecNode::Choice; + headNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + curType + , curNode + , 0 + , true + , true + , fGrammarPoolMemoryManager + ); + curNode = headNode; + } + else + { + headNode = curNode; + fReaderMgr->getNextChar(); + } + + // + // If it was a sequence or choice, we just loop until we get to the + // end of our section, adding each new leaf or sub expression to the + // right child of the current node, and making that new node the current + // node. + // + if ((opCh == chComma) || (opCh == chPipe)) + { + ContentSpecNode* lastNode = 0; + while (true) + { + // + // The next thing must either be another | or , character followed + // by another leaf or subexpression, or a closing parenthesis, or a + // PE ref. + // + if (fReaderMgr->lookingAtChar(chPercent)) + { + checkForPERef(false, true); + } + else if (fReaderMgr->skippedSpace()) + { + // Just skip whitespace + fReaderMgr->skipPastSpaces(); + } + else if (fReaderMgr->skippedChar(chCloseParen)) + { + // + // We've hit the end of this section, so break out. But, we + // need to see if we left a partial sequence of choice node + // without a second node. If so, we have to undo that and + // put its left child into the right node of the previous + // node. + // + if ((curNode->getType() == ContentSpecNode::Choice) + || (curNode->getType() == ContentSpecNode::Sequence)) + { + if (!curNode->getSecond()) + { + ContentSpecNode* saveFirst = curNode->orphanFirst(); + lastNode->setSecond(saveFirst); + curNode = lastNode; + } + } + break; + } + else if (fReaderMgr->skippedChar(opCh)) + { + // Check for a PE ref here, but don't require spaces + checkForPERef(false, true); + + if (fReaderMgr->skippedChar(chOpenParen)) + { + const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum(); + + // Recurse to handle this new guy + ContentSpecNode* subNode; + try { + subNode = scanChildren(elemDecl, bufToUse); + } + catch (const XMLErrs::Codes) + { + delete headNode; + throw; + } + + // If it failed, we are done, clean up here and return failure + if (!subNode) + { + delete headNode; + return 0; + } + + if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + // Else patch it in and make it the new current + ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + curType + , subNode + , 0 + , true + , true + , fGrammarPoolMemoryManager + ); + curNode->setSecond(newCur); + lastNode = curNode; + curNode = newCur; + } + else + { + // + // Got to be a leaf node, so get a name. If we cannot get + // one, then clean up and get outa here. + // + if (!fReaderMgr->getName(bufToUse)) + { + delete headNode; + fScanner->emitError(XMLErrs::ExpectedElementName); + return 0; + } + + // + // Create a leaf node for it. If we can find the element + // id for this element, then use it. Else, we have to + // fault in an element decl, marked as created because + // of being in a content model. + // + XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bufToUse.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE); + if (!decl) + { + decl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + bufToUse.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + decl->setCreateReason(XMLElementDecl::InContentModel); + decl->setExternalElemDeclaration(isReadingExternalEntity()); + fDTDGrammar->putElemDecl(decl); + } + + ContentSpecNode* tmpLeaf = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + decl->getElementName() + , fGrammarPoolMemoryManager + ); + + // Check for a repetition character after the leaf + const XMLCh repCh = fReaderMgr->peekNextChar(); + ContentSpecNode* tmpLeaf2 = makeRepNode(repCh, tmpLeaf, fGrammarPoolMemoryManager); + if (tmpLeaf != tmpLeaf2) + fReaderMgr->getNextChar(); + + // + // Create a new sequence or choice node, with the leaf + // (or rep surrounding it) we just got as its first node. + // Make the new node the second node of the current node, + // and then make it the current node. + // + ContentSpecNode* newCur = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + curType + , tmpLeaf2 + , 0 + , true + , true + , fGrammarPoolMemoryManager + ); + curNode->setSecond(newCur); + lastNode = curNode; + curNode = newCur; + } + } + else + { + // Cannot be valid + delete headNode; // emitError may do a throw so need to clean-up first + if (opCh == chComma) + { + fScanner->emitError(XMLErrs::ExpectedChoiceOrCloseParen); + } + else + { + fScanner->emitError + ( + XMLErrs::ExpectedSeqOrCloseParen + , elemDecl.getFullName() + ); + } + return 0; + } + } + } + + // + // We saw the terminating parenthesis so lets check for any repetition + // character, and create a node for that, making the head node the child + // of it. + // + const XMLCh repCh = fReaderMgr->peekNextChar(); + curNode = makeRepNode(repCh, headNode, fGrammarPoolMemoryManager); + if (curNode != headNode) + fReaderMgr->getNextChar(); + + // prepare for recursion + if(arrNestedDecl==NULL) + break; + else + { + // If that failed, no need to go further, return failure + if (!curNode) + return 0; + + const XMLSize_t curReader = arrNestedDecl->pop(); + if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + if(arrNestedDecl->empty()) + { + delete arrNestedDecl; + arrNestedDecl=NULL; + } + } + } + + return curNode; +} + + +// +// We get here after the '' It will calls the appropriate handler with the comment +// text, if one is provided. A comment can be in either the document or +// the DTD, so the fInDocument flag is used to know which handler to send +// it to. +// +void DTDScanner::scanComment() +{ + enum States + { + InText + , OneDash + , TwoDashes + }; + + // Get a buffer for this + XMLBufBid bbComment(fBufMgr); + + // + // Get the comment text into a temp buffer. Be sure to use temp buffer + // two here, since its to be used for stuff that is potentially longer + // than just a name. + // + bool gotLeadingSurrogate = false; + States curState = InText; + while (true) + { + // Get the next character + const XMLCh nextCh = fReaderMgr->getNextChar(); + + // Watch for an end of file + if (!nextCh) + { + fScanner->emitError(XMLErrs::UnterminatedComment); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + // Check for correct surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) { + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + + gotLeadingSurrogate = false; + } + + if (curState == InText) + { + // If its a dash, go to OneDash state. Otherwise take as text + if (nextCh == chDash) + curState = OneDash; + else + bbComment.append(nextCh); + } + else if (curState == OneDash) + { + // + // If its another dash, then we change to the two dashes states. + // Otherwise, we have to put in the deficit dash and the new + // character and go back to InText. + // + if (nextCh == chDash) + { + curState = TwoDashes; + } + else + { + bbComment.append(chDash); + bbComment.append(nextCh); + curState = InText; + } + } + else if (curState == TwoDashes) + { + // The next character must be the closing bracket + if (nextCh != chCloseAngle) + { + fScanner->emitError(XMLErrs::IllegalSequenceInComment); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + break; + } + } + + // If there is a doc type handler, then pass on the comment stuff + if (fDocTypeHandler) + fDocTypeHandler->doctypeComment(bbComment.getRawBuffer()); +} + + +bool DTDScanner::scanContentSpec(DTDElementDecl& toFill) +{ + // + // Check for for a couple of the predefined content type strings. If + // its not one of these, its got to be a parenthesized reg ex type + // expression. + // + if (fReaderMgr->skippedString(XMLUni::fgEmptyString)) + { + toFill.setModelType(DTDElementDecl::Empty); + return true; + } + + if (fReaderMgr->skippedString(XMLUni::fgAnyString)) + { + toFill.setModelType(DTDElementDecl::Any); + return true; + } + + // Its got to be a parenthesized regular expression + if (!fReaderMgr->skippedChar(chOpenParen)) + { + fScanner->emitError + ( + XMLErrs::ExpectedContentSpecExpr + , toFill.getFullName() + ); + return false; + } + + // Get the current reader id, so we can test for partial markup + const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum(); + + // We could have a PE ref here, but don't require space + checkForPERef(false, true); + + // + // Now we look for a PCDATA string. If its PCDATA, then it must be a + // MIXED model. Otherwise, it must be a regular list of children in + // a regular expression perhaps. + // + bool status; + if (fReaderMgr->skippedString(XMLUni::fgPCDATAString)) + { + // Set the model to mixed + toFill.setModelType(DTDElementDecl::Mixed_Simple); + status = scanMixed(toFill); + + // + // If we are validating we have to check that there are no multiple + // uses of any child elements. + // + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + { + if (((const MixedContentModel*)toFill.getContentModel())->hasDups()) + fScanner->getValidator()->emitError(XMLValid::RepElemInMixed); + } + } + else + { + // + // We have to do a recursive scan of the content model. Create a + // buffer for it to use, for efficiency. It returns the top ofthe + // content spec node tree, which we set if successful. + // + toFill.setModelType(DTDElementDecl::Children); + XMLBufBid bbTmp(fBufMgr); + ContentSpecNode* resNode = scanChildren(toFill, bbTmp.getBuffer()); + status = (resNode != 0); + if (status) + toFill.setContentSpec(resNode); + } + + // Make sure we are on the same reader as where we started + if (curReader != fReaderMgr->getCurrentReaderNum() && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + return status; +} + + +void DTDScanner::scanDefaultDecl(DTDAttDef& toFill) +{ + if (fReaderMgr->skippedString(XMLUni::fgRequiredString)) + { + toFill.setDefaultType(XMLAttDef::Required); + return; + } + + if (fReaderMgr->skippedString(XMLUni::fgImpliedString)) + { + toFill.setDefaultType(XMLAttDef::Implied); + return; + } + + if (fReaderMgr->skippedString(XMLUni::fgFixedString)) + { + // + // There must be space before the fixed value. If there is not, then + // emit an error but keep going. + // + if (!fReaderMgr->skippedSpace()) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + else + fReaderMgr->skipPastSpaces(); + toFill.setDefaultType(XMLAttDef::Fixed); + } + else + { + toFill.setDefaultType(XMLAttDef::Default); + } + + // + // If we got here, its fixed or default, so we need to get a value. + // If we don't, then emit an error but just set the default value to + // an empty string and try to keep going. + // + // Check for PE ref or optional whitespace + checkForPERef(false, true); + + XMLBufBid bbValue(fBufMgr); + if (!scanAttValue(toFill.getFullName(), bbValue.getBuffer(), toFill.getType())) + fScanner->emitError(XMLErrs::ExpectedDefAttrDecl); + + toFill.setValue(bbValue.getRawBuffer()); +} + + +// +// This is called after seeing 'emitError(XMLErrs::ExpectedWhitespace); + + // Get a buffer for the element name and scan in the name + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedElementName); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // Look this guy up in the element decl pool + DTDElementDecl* decl = (DTDElementDecl*) fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, bbName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE); + + // + // If it does not exist, then we need to create it. If it does and + // its marked as declared, then that's an error, but we still need to + // scan over the content model so use the dummy declaration that the + // parsing code can fill in. + // + if (decl) + { + if (decl->isDeclared()) + { + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::ElementAlreadyExists, bbName.getRawBuffer()); + + if (!fDumElemDecl) + fDumElemDecl = new (fMemoryManager) DTDElementDecl + ( + bbName.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fMemoryManager + ); + else + fDumElemDecl->setElementName(bbName.getRawBuffer(),fEmptyNamespaceId); + } + } + else + { + // + // Create the new empty declaration to fill in and put it into + // the decl pool. + // + decl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + bbName.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + fDTDGrammar->putElemDecl(decl); + } + + // Set a flag for whether we will ignore this one + const bool isIgnored = (decl == fDumElemDecl); + + // Mark this one if being externally declared + decl->setExternalElemDeclaration(isReadingExternalEntity()); + + // Mark this one as being declared + decl->setCreateReason(XMLElementDecl::Declared); + + // Another check for a PE ref, with at least required whitespace + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // And now scan the content model for this guy. + if (!scanContentSpec(*decl)) + { + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // Another check for a PE ref, but we don't require whitespace here + checkForPERef(false, true); + + // And we should have the ending angle bracket + if (!fReaderMgr->skippedChar(chCloseAngle)) + { + fScanner->emitError(XMLErrs::UnterminatedElementDecl, bbName.getRawBuffer()); + fReaderMgr->skipPastChar(chCloseAngle); + } + + // + // If we have a DTD handler tell it about the new element decl. We + // tell it if its one that can be ignored, cause its an override of a + // previously existing decl. If it is being ignored, only call back + // if advanced callbacks are enabled. + // + if (fDocTypeHandler) + fDocTypeHandler->elementDecl(*decl, isIgnored); +} + + +// +// This method will process a general or parameter entity reference. The +// entity name and entity text will be stored in the entity pool. The value +// of the entity will be scanned for any other parameter entity or char +// references which will be expanded. So the stored value can only have +// general entity references when done. +// +void DTDScanner::scanEntityDecl() +{ + // + // Space is required here, but we cannot check for a PE Ref since + // there could be a legal (no-ref) percent sign here. Since any + // entity that ended here would be illegal, we just skip spaces + // and then check for a percent. + // + if (!fReaderMgr->lookingAtSpace()) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + else + fReaderMgr->skipPastSpaces(); + bool isPEDecl = fReaderMgr->skippedChar(chPercent); + + // + // If a PE decl, then check if it is followed by a space; if it is so, + // eat the percent and check for spaces or a PE ref on the other side of it. + // Otherwise, it has to be an entity reference for a general entity. + // + if (isPEDecl) + { + if(!fReaderMgr->getCurrentReader()->isWhitespace(fReaderMgr->peekNextChar())) + { + isPEDecl=false; + while (true) + { + if (!expandPERef(false, false, true, false)) + fScanner->emitError(XMLErrs::ExpectedEntityRefName); + // And skip any more spaces in the expanded value + if (fReaderMgr->skippedSpace()) + fReaderMgr->skipPastSpaces(); + if (!fReaderMgr->skippedChar(chPercent)) + break; + } + } + else if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + } + + // + // Now lets get a name, which should be the name of the entity. We + // have to get a buffer for this. + // + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedPEName); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // If namespaces are enabled, then no colons allowed + if (fScanner->getDoNamespaces()) + { + if (XMLString::indexOf(bbName.getRawBuffer(), chColon) != -1) + fScanner->emitError(XMLErrs::ColonNotLegalWithNS); + } + + // + // See if this entity already exists. If so, then the existing one + // takes precendence. So we use the local dummy decl to parse into + // and just ignore the results. + // + DTDEntityDecl* entityDecl; + if (isPEDecl) + entityDecl = fPEntityDeclPool->getByKey(bbName.getRawBuffer()); + else + entityDecl = fDTDGrammar->getEntityDecl(bbName.getRawBuffer()); + + if (entityDecl) + { + if (!fDumEntityDecl) + fDumEntityDecl = new (fMemoryManager) DTDEntityDecl(fMemoryManager); + fDumEntityDecl->setName(bbName.getRawBuffer()); + entityDecl = fDumEntityDecl; + } + else + { + // Its not in existence already, then create an entity decl for it + entityDecl = new (fGrammarPoolMemoryManager) DTDEntityDecl(bbName.getRawBuffer(), false, fGrammarPoolMemoryManager); + + // + // Set the declaration location. The parameter indicates whether its + // declared in the content/internal subset, so we know whether or not + // its in the external subset. + // + entityDecl->setDeclaredInIntSubset(fInternalSubset); + + // Add it to the appropriate entity decl pool + if (isPEDecl) + fPEntityDeclPool->put(entityDecl); + else + fDTDGrammar->putEntityDecl(entityDecl); + } + + // Set a flag that indicates whether we are ignoring this one + const bool isIgnored = (entityDecl == fDumEntityDecl); + + // Set the PE flag on it + entityDecl->setIsParameter(isPEDecl); + + // + // Space is legal (required actually) here so check for a PE ref. If + // we don't get our whitespace, then issue an error, but try to keep + // going. + // + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // save the hasNoDTD status for Entity Constraint Checking + bool hasNoDTD = fScanner->getHasNoDTD(); + if (hasNoDTD && isPEDecl) + fScanner->setHasNoDTD(false); + + // According to the type call the value scanning method + if (!scanEntityDef(*entityDecl, isPEDecl)) + { + fReaderMgr->skipPastChar(chCloseAngle); + fScanner->setHasNoDTD(true); + fScanner->emitError(XMLErrs::ExpectedEntityValue); + return; + } + if (hasNoDTD) + fScanner->setHasNoDTD(true); + + // Space is legal (but not required) here so check for a PE ref + checkForPERef(false, true); + + // And then we have to have the closing angle bracket + if (!fReaderMgr->skippedChar(chCloseAngle)) + { + fScanner->emitError(XMLErrs::UnterminatedEntityDecl, entityDecl->getName()); + fReaderMgr->skipPastChar(chCloseAngle); + } + + // + // If we have a doc type handler, then call it. But only call it for + // ignored elements if advanced callbacks are enabled. + // + if (fDocTypeHandler) + fDocTypeHandler->entityDecl(*entityDecl, isPEDecl, isIgnored); +} + + +// +// This method will scan a general/character entity ref. It will either +// expand a char ref and return the value directly, or it will expand +// a general entity and a reader for it onto the reader stack. +// +// The return value indicates whether the value was returned directly or +// pushed as a reader or it failed. +// +// The escaped flag tells the caller whether the returnd parameter resulted +// from a character reference, which escapes the character in some cases. It +// only makes any difference if the return indicates the value was returned +// directly. +// +// NOTE: This is only called when scanning attribute values, so we always +// expand general entities. +// +DTDScanner::EntityExpRes +DTDScanner::scanEntityRef(XMLCh& firstCh, XMLCh& secondCh, bool& escaped) +{ + // Assume no escape and no second char + escaped = false; + secondCh = 0; + + // We have to insure its all done in a single entity + const XMLSize_t curReader = fReaderMgr->getCurrentReaderNum(); + + // + // If the next char is a pound, then its a character reference and we + // need to expand it always. + // + if (fReaderMgr->skippedChar(chPound)) + { + // + // Its a character reference, so scan it and get back the numeric + // value it represents. If it fails, just return immediately. + // + if (!scanCharRef(firstCh, secondCh)) + return EntityExp_Failed; + + if (curReader != fReaderMgr->getCurrentReaderNum()) + fScanner->emitError(XMLErrs::PartialMarkupInEntity); + + // Its now escaped since it was a char ref + escaped = true; + return EntityExp_Returned; + } + + // Get the name of the general entity + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedEntityRefName); + return EntityExp_Failed; + } + + // + // Next char must be a semi-colon. But if its not, just emit + // an error and try to continue. + // + if (!fReaderMgr->skippedChar(chSemiColon)) + fScanner->emitError(XMLErrs::UnterminatedEntityRef, bbName.getRawBuffer()); + + // Make sure it was all in one entity reader + if (curReader != fReaderMgr->getCurrentReaderNum()) + fScanner->emitError(XMLErrs::PartialMarkupInEntity); + + // Look it up the name the general entity pool + XMLEntityDecl* decl = fDTDGrammar->getEntityDecl(bbName.getRawBuffer()); + + // If it does not exist, then obviously an error + if (!decl) + { + // XML 1.0 Section 4.1 + if (fScanner->getStandalone() || fScanner->getHasNoDTD()) { + fScanner->emitError(XMLErrs::EntityNotFound, bbName.getRawBuffer()); + } + else { + if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::VC_EntityNotFound, bbName.getRawBuffer()); + } + + return EntityExp_Failed; + } + + + // + // XML 1.0 Section 4.1 + // If we are a standalone document, then it has to have been declared + // in the internal subset. + // + if (fScanner->getStandalone() && !decl->getDeclaredInIntSubset()) + fScanner->emitError(XMLErrs::IllegalRefInStandalone, bbName.getRawBuffer()); + + // + // If its a special char reference, then its escaped and we can return + // it directly. + // + if (decl->getIsSpecialChar()) + { + firstCh = decl->getValue()[0]; + escaped = true; + return EntityExp_Returned; + } + + if (decl->isExternal()) + { + // If its unparsed, then its not valid here + // XML 1.0 Section 4.4.4 the appearance of a reference to an unparsed entity is forbidden. + if (decl->isUnparsed()) + { + fScanner->emitError(XMLErrs::NoUnparsedEntityRefs, bbName.getRawBuffer()); + return EntityExp_Failed; + } + + // We are in an attribute value, so not valid. + // XML 1.0 Section 4.4.4 a reference to an external entity in an attribute value is forbidden. + fScanner->emitError(XMLErrs::NoExtRefsInAttValue); + + // And now create a reader to read this entity + InputSource* srcUsed; + XMLReader* reader = fReaderMgr->createReader + ( + decl->getBaseURI() + , decl->getSystemId() + , decl->getPublicId() + , false + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , XMLReader::Source_External + , srcUsed + , fScanner->getCalculateSrcOfs() + , fScanner->getLowWaterMark() + , fScanner->getDisableDefaultEntityResolution() + ); + + // Put a janitor on the source so it gets cleaned up on exit + Janitor janSrc(srcUsed); + + // + // If the creation failed then throw an exception + // + if (!reader) + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Gen_CouldNotOpenExtEntity, srcUsed ? srcUsed->getSystemId() : decl->getSystemId(), fMemoryManager); + + // + // Push the reader. If its a recursive expansion, then emit an error + // and return an failure. + // + if (!fReaderMgr->pushReader(reader, decl)) + { + fScanner->emitError(XMLErrs::RecursiveEntity, decl->getName()); + return EntityExp_Failed; + } + + // If it starts with the XML string, then parse a text decl + if (fScanner->checkXMLDecl(true)) + scanTextDecl(); + } + else + { + // + // Create a reader over a memory stream over the entity value + // We force it to assume UTF-16 by passing in an encoding + // string. This way it won't both trying to predecode the + // first line, looking for an XML/TextDecl. + // + XMLReader* valueReader = fReaderMgr->createIntEntReader + ( + decl->getName() + , XMLReader::RefFrom_NonLiteral + , XMLReader::Type_General + , decl->getValue() + , decl->getValueLen() + , false + ); + + // + // Trt to push the entity reader onto the reader manager stack, + // where it will become the subsequent input. If it fails, that + // means the entity is recursive, so issue an error. The reader + // will have just been discarded, but we just keep going. + // + if (!fReaderMgr->pushReader(valueReader, decl)) + fScanner->emitError(XMLErrs::RecursiveEntity, decl->getName()); + } + + return EntityExp_Pushed; +} + + +// +// This method will scan a quoted literal of an entity value. It has to +// deal with replacement of PE references; however, since this is a DTD +// scanner, all such entity literals are in entity decls and therefore +// general entities are not expanded. +// +bool DTDScanner::scanEntityLiteral(XMLBuffer& toFill) +{ + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr->skipIfQuote(quoteCh)) + return false; + + // Get a buffer for pulling in entity names when we see GE refs + XMLBufBid bbName(fBufMgr); + XMLBuffer& nameBuf = bbName.getBuffer(); + + // Remember the current reader + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + + // + // Loop until we see the ending quote character, handling any references + // in the process. + // + XMLCh nextCh; + XMLCh secondCh = 0; + bool gotLeadingSurrogate = false; + while (true) + { + nextCh = fReaderMgr->getNextChar(); + + // + // Watch specifically for EOF and issue a more meaningful error + // if that occurs (since an unterminated quoted char can cause + // this easily.) + // + if (!nextCh) + { + fScanner->emitError(XMLErrs::UnterminatedEntityLiteral); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + // + // Break out on our terminating quote char when we are back in the + // same reader. Otherwise, we might trigger on a nested quote char + // in an expanded entity. + // + if ((nextCh == quoteCh) + && (fReaderMgr->getCurrentReaderNum() == orgReader)) + { + break; + } + + if (nextCh == chPercent) + { + // + // Put the PE's value on the reader stack and then jump back + // to the top to start processing it. The parameter indicates + // that it should not scan the reference's content as an external + // subset. + // + expandPERef(false, true, true); + continue; + } + + // + // Ok, now that all the other special stuff is checked, we can + // look for a general entity. In here, we cannot have a naked & + // and will only expand numerical char refs or the intrinsic char + // refs. Others will be left alone. + // + if (nextCh == chAmpersand) + { + // + // Here, we only expand numeric char refs, but not any general + // entities. However, the stupid XML spec requires that we check + // and make sure it does refer to a general entity if its not + // a char ref (i.e. no naked '&' chars.) + // + if (fReaderMgr->skippedChar(chPound)) + { + // If it failed, then just jump back to the top and try to pick up + if (!scanCharRef(nextCh, secondCh)) + { + gotLeadingSurrogate = false; + continue; + } + } + else + { + if (!fReaderMgr->getName(nameBuf)) + { + fScanner->emitError(XMLErrs::ExpectedEntityRefName); + } + else + { + // + // Since we are not expanding any of this, we have to + // put the amp and name into the target buffer as data. + // + toFill.append(chAmpersand); + toFill.append(nameBuf.getRawBuffer()); + + // Make sure we skipped a trailing semicolon + if (!fReaderMgr->skippedChar(chSemiColon)) + { + fScanner->emitError + ( + XMLErrs::UnterminatedEntityRef + , nameBuf.getRawBuffer() + ); + } + + // And make the new character the semicolon + nextCh = chSemiColon; + } + + // Either way here we reset the surrogate flag + gotLeadingSurrogate = false; + } + } + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + } + else if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidCharacter, tmpBuf); + fReaderMgr->skipPastChar(quoteCh); + return false; + } + gotLeadingSurrogate = false; + } + + // Looks ok, so add it to the literal + toFill.append(nextCh); + + if (secondCh) + { + toFill.append(secondCh); + secondCh=0; + } + } + + // + // If we got here and did not get back to the original reader level, + // then we propogated some entity out of the literal, so issue an + // error, but don't fail. + // + if (fReaderMgr->getCurrentReaderNum() != orgReader && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + return true; +} + + +// +// This method is called after the entity name has been scanned, and any +// PE referenced following the name is handled. The passed decl will be +// filled in with the info scanned. +// +bool DTDScanner::scanEntityDef(DTDEntityDecl& decl, const bool isPEDecl) +{ + // Its got to be an entity literal + if (fReaderMgr->lookingAtChar(chSingleQuote) + || fReaderMgr->lookingAtChar(chDoubleQuote)) + { + // Get a buffer for the literal + XMLBufBid bbValue(fBufMgr); + + if (!scanEntityLiteral(bbValue.getBuffer())) + return false; + + // Set it on the entity decl + decl.setValue(bbValue.getRawBuffer()); + return true; + } + + // + // Its got to be an external entity, so there must be an external id. + // Get buffers for them and scan an external id into them. + // + XMLBufBid bbPubId(fBufMgr); + XMLBufBid bbSysId(fBufMgr); + if (!scanId(bbPubId.getBuffer(), bbSysId.getBuffer(), IDType_External)) + return false; + + decl.setIsExternal(true); + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + // Fill in the id fields of the decl with the info we got + const XMLCh* publicId = bbPubId.getRawBuffer(); + const XMLCh* systemId = bbSysId.getRawBuffer(); + decl.setPublicId((publicId && *publicId) ? publicId : 0); + decl.setSystemId((systemId && *systemId) ? systemId : 0); + decl.setBaseURI((lastInfo.systemId && *lastInfo.systemId) ? lastInfo.systemId : 0); + + // If its a PE decl, we are done + bool gotSpaces = checkForPERef(false, true); + if (isPEDecl) + { + // + // Check for a common error here. NDATA is not allowed for PEs + // so check for the NDATA string. If found give a nice meaningful + // error and continue parsing to eat the NDATA text. + // + if (gotSpaces) + { + if (fReaderMgr->skippedString(XMLUni::fgNDATAString)) + fScanner->emitError(XMLErrs::NDATANotValidForPE); + } + else + { + return true; + } + } + + // If looking at close angle now, we are done + if (fReaderMgr->lookingAtChar(chCloseAngle)) + return true; + + // Else we had to have seem the whitespace + if (!gotSpaces) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // We now have to see a notation data string + if (!fReaderMgr->skippedString(XMLUni::fgNDATAString)) + fScanner->emitError(XMLErrs::ExpectedNDATA); + + // Space is required here, but try to go on if not + if (!checkForPERef(false, true)) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // Get a name + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedNotationName); + return false; + } + + // Set the decl's notation name + decl.setNotationName(bbName.getRawBuffer()); + + return true; +} + + +// +// This method is called after an attribute decl name or a notation decl has +// been scanned and then an opening parenthesis was see, indicating the list +// of values. It scans the enumeration values and creates a single string +// which has a single space between each value. +// +// The terminating close paren ends this scan. +// +bool DTDScanner::scanEnumeration( const DTDAttDef& attDef + , XMLBuffer& toFill + , const bool notation) +{ + // Reset the passed buffer + toFill.reset(); + + // Check for PE ref but don't require space + checkForPERef(false, true); + + // If this is a notation, we need an opening paren + if (notation) + { + if (!fReaderMgr->skippedChar(chOpenParen)) + fScanner->emitError(XMLErrs::ExpectedOpenParen); + } + + // We need a local buffer to use as well + XMLBufBid bbTmp(fBufMgr); + + while (true) + { + // Space is allowed here for either type so check for PE ref + checkForPERef(false, true); + + // And then get either a name or a name token + bool success; + if (notation) + success = fReaderMgr->getName(bbTmp.getBuffer()); + else + success = fReaderMgr->getNameToken(bbTmp.getBuffer()); + + if (!success) + { + fScanner->emitError + ( + XMLErrs::ExpectedEnumValue + , attDef.getFullName() + ); + return false; + } + + // Append this value to the target value + toFill.append(bbTmp.getRawBuffer(), bbTmp.getLen()); + + // Space is allowed here for either type so check for PE ref + checkForPERef(false, true); + + // Check for the terminating paren + if (fReaderMgr->skippedChar(chCloseParen)) + break; + + // And append a space separator + toFill.append(chSpace); + + // Check for the pipe character separator + if (!fReaderMgr->skippedChar(chPipe)) + { + fScanner->emitError(XMLErrs::ExpectedEnumSepOrParen); + return false; + } + } + return true; +} + + +bool DTDScanner::scanEq() +{ + fReaderMgr->skipPastSpaces(); + if (fReaderMgr->skippedChar(chEqual)) + { + fReaderMgr->skipPastSpaces(); + return true; + } + return false; +} + + +// +// This method is called when an external entity reference is seen in the +// DTD or an external DTD subset is encountered, and their contents pushed +// onto the reader stack. This method will scan that contents. +// +void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) +{ + // Indicate we are in the external subset now + FlagJanitor janContentFlag(&fInternalSubset, false); + + + bool bAcceptDecl = !inIncludeSect; + + // Get a buffer for whitespace + XMLBufBid bbSpace(fBufMgr); + + // + // If we have a doc type handler and we are not being called recursively + // to handle an include section, tell it the ext subset starts + // + if (fDocTypeHandler && isDTD && !inIncludeSect) + fDocTypeHandler->startExtSubset(); + + // + // We have to play a trick here if the current entity we are parsing + // is a PE. Because the spooling code will put out a whitespace before + // and after an expanded PE if its being scanned outside the context of + // a literal entity, this will confuse this external subset code. + // + // So, we see if that is what is happening and, if so, eat the single + // space, a check for the isScanningPERefOutOfLiteral()) + { + if (fReaderMgr->skippedSpace()) + { + if (fScanner->checkXMLDecl(true)) + { + scanTextDecl(); + bAcceptDecl = false; + + // Figure out how to do this + // fReaderMgr->unGet(chSpace); + } + } + } + + // Get the current reader number + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + + // + // Loop until we hit the end of the external subset entity. Note that + // we use a double loop here in order to avoid the overhead of doing + // the exception setup/teardown work on every loop. + // + bool inMarkup = false; + bool inCharData = false; + while (true) + { + bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' + try + { + while (true) + { + const XMLCh nextCh = fReaderMgr->peekNextChar(); + + if (!nextCh) + { + return; // nothing left + } + else if (nextCh == chOpenAngle) + { + // Get the reader we started this on + // XML 1.0 P28a Well-formedness constraint: PE Between Declarations + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + bool wasInPE = (fReaderMgr->getCurrentReader()->getType() == XMLReader::Type_PE); + + // + // Now scan the markup. Set the flag so that we will know that + // we were in markup if an end of entity exception occurs. + // + fReaderMgr->getNextChar(); + inMarkup = true; + scanMarkupDecl(bAcceptDecl); + inMarkup = false; + + // + // And see if we got back to the same level. If not, then its + // a partial markup error. + // + if (fReaderMgr->getCurrentReaderNum() != orgReader){ + if (wasInPE) + fScanner->emitError(XMLErrs::PEBetweenDecl); + else if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + } + + } + else if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + { + // + // If we have a doc type handler, and advanced callbacks are + // enabled, then gather up whitespace and call back. Otherwise + // just skip whitespaces. + // + if (fDocTypeHandler) + { + inCharData = true; + fReaderMgr->getSpaces(bbSpace.getBuffer()); + inCharData = false; + + fDocTypeHandler->doctypeWhitespace + ( + bbSpace.getRawBuffer() + , bbSpace.getLen() + ); + } + else + { + // + // If we hit an end of entity in the middle of white + // space, that's fine. We'll just come back in here + // again on the next round and skip some more. + // + fReaderMgr->skipPastSpaces(); + } + } + else if (nextCh == chPercent) + { + // + // Expand (and scan if external) the reference value. Tell + // it to throw an end of entity exception at the end of the + // entity. + // + fReaderMgr->getNextChar(); + expandPERef(true, false, false, true); + } + else if (inIncludeSect && (nextCh == chCloseSquare)) + { + // + // Its the end of a conditional include section. So scan it and + // decrement the include depth counter. + // + fReaderMgr->getNextChar(); + if (!fReaderMgr->skippedChar(chCloseSquare)) + { + fScanner->emitError(XMLErrs::ExpectedEndOfConditional); + fReaderMgr->skipPastChar(chCloseAngle); + } + else if (!fReaderMgr->skippedChar(chCloseAngle)) + { + fScanner->emitError(XMLErrs::ExpectedEndOfConditional); + fReaderMgr->skipPastChar(chCloseAngle); + } + return; + } + else + { + fReaderMgr->getNextChar(); + if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + else + { + fScanner->emitError(XMLErrs::InvalidDocumentStructure); + } + + // Try to get realigned + static const XMLCh toSkip[] = + { + chPercent, chCloseSquare, chOpenAngle, chNull + }; + fReaderMgr->skipUntilInOrWS(toSkip); + } + bAcceptDecl = false; + } + } + catch(const EndOfEntityException& toCatch) + { + // + // If the external entity ended while we were in markup, then that's + // a partial markup error. + // + if (inMarkup) + { + fScanner->emitError(XMLErrs::PartialMarkupInEntity); + inMarkup = false; + } + + // If we were in char data, then send what we got + if (inCharData) + { + // Send what we got, then rethrow + if (fDocTypeHandler) + { + fDocTypeHandler->doctypeWhitespace + ( + bbSpace.getRawBuffer() + , bbSpace.getLen() + ); + } + inCharData = false; + } + + // + // If the entity that just ended was the entity that we started + // on, then this is the end of the external subset. + // + if (orgReader == toCatch.getReaderNum()) + bDoBreak=true; + } + if(bDoBreak) + break; + } + + // If we have a doc type handler, tell it the ext subset ends + if (fDocTypeHandler && isDTD && !inIncludeSect) + fDocTypeHandler->endExtSubset(); +} + + +// +// This method will scan for an id, either public or external. +// +// +// [75] ExternalID ::= 'SYSTEM' S SystemLiteral +// | 'PUBLIC' S PubidLiteral S SystemLiteral +// [83] PublicID ::= 'PUBLIC' S PubidLiteral +// +bool DTDScanner::scanId( XMLBuffer& pubIdToFill + , XMLBuffer& sysIdToFill + , const IDTypes whatKind) +{ + // Clean out both return buffers + pubIdToFill.reset(); + sysIdToFill.reset(); + + // + // Check first for the system id first. If we find it, and system id + // is one of the legal values, then lets try to scan it. + // + // 'SYSTEM' S SystemLiteral + if (fReaderMgr->skippedString(XMLUni::fgSysIDString)) + { + // If they were looking for a public id, then we failed + if (whatKind == IDType_Public) + { + fScanner->emitError(XMLErrs::ExpectedPublicId); + return false; + } + + // We must skip spaces + bool skippedSomething; + fReaderMgr->skipPastSpaces(skippedSomething); + if (!skippedSomething) + { + fScanner->emitError(XMLErrs::ExpectedWhitespace); + return false; + } + + // Get the system literal value + return scanSystemLiteral(sysIdToFill); + } + + // Now scan for public id + // 'PUBLIC' S PubidLiteral S SystemLiteral + // or + // 'PUBLIC' S PubidLiteral + + // If we don't have any public id string => Error + if (!fReaderMgr->skippedString(XMLUni::fgPubIDString)) { + fScanner->emitError(XMLErrs::ExpectedSystemOrPublicId); + return false; + } + + // + // So following this we must have whitespace, a public literal, whitespace, + // and a system literal. + // + bool skippedSomething; + fReaderMgr->skipPastSpaces(skippedSomething); + if (!skippedSomething) + { + fScanner->emitError(XMLErrs::ExpectedWhitespace); + + // + // Just in case, if they just forgot the whitespace but the next char + // is a single or double quote, then keep going. + // + const XMLCh chPeek = fReaderMgr->peekNextChar(); + if ((chPeek != chDoubleQuote) && (chPeek != chSingleQuote)) + return false; + } + + if (!scanPublicLiteral(pubIdToFill)) + return false; + + // If they wanted a public id, then this is all + if (whatKind == IDType_Public) + return true; + + // check if there is any space follows + bool hasSpace; + fReaderMgr->skipPastSpaces(hasSpace); + + // + // In order to recover best here we need to see if + // the next thing is a quote or not + // + const XMLCh chPeek = fReaderMgr->peekNextChar(); + const bool bIsQuote = ((chPeek == chDoubleQuote) + || (chPeek == chSingleQuote)); + + if (!hasSpace) + { + if (whatKind == IDType_External) + { + // + // If its an external Id, then we need to see the system id. + // So, emit the error. But, if the next char is a quote, don't + // give up since its probably going to work. The user just + // missed the separating space. Otherwise, fail. + // + fScanner->emitError(XMLErrs::ExpectedWhitespace); + if (!bIsQuote) + return false; + } + else + { + // + // We can legally return here. But, if the next char is a quote, + // then that's probably not what was desired, since its probably + // just that space was forgotten and there really is a system + // id to follow. + // + // So treat it like missing whitespace if so and keep going. + // Else, just return success. + // + if (bIsQuote) + fScanner->emitError(XMLErrs::ExpectedWhitespace); + else + return true; + } + } + + if (bIsQuote) { + // there is a quote coming, scan the system literal + if (!scanSystemLiteral(sysIdToFill)) + return false; + } + else { + // no quote, if expecting exteral id, this is an error + if (whatKind == IDType_External) + fScanner->emitError(XMLErrs::ExpectedQuotedString); + } + + return true; +} + + +// +// This method will scan the contents of an ignored section. It assumes that +// we already are in the body, i.e. we've seen closing markup. +// +void DTDScanner::scanIgnoredSection() +{ + // + // Depth starts at one because we are already in one section and want + // to parse until we hit its end. + // + unsigned long depth = 1; + bool gotLeadingSurrogate = false; + while (true) + { + const XMLCh nextCh = fReaderMgr->getNextChar(); + + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == chOpenAngle) + { + if (fReaderMgr->skippedChar(chBang) + && fReaderMgr->skippedChar(chOpenSquare)) + { + depth++; + } + } + else if (nextCh == chCloseSquare) + { + if (fReaderMgr->skippedChar(chCloseSquare)) + { + while (fReaderMgr->skippedChar(chCloseSquare)) + { + // Do nothing, just skip them + } + + if (fReaderMgr->skippedChar(chCloseAngle)) + { + depth--; + if (!depth) + break; + } + } + } + // Deal with surrogate pairs + else if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + // Its a leading surrogate. If we already got one, then + // issue an error, else set leading flag to make sure that + // we look for a trailing next time. + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + // If its a trailing surrogate, make sure that we are + // prepared for that. Else, its just a regular char so make + // sure that we were not expected a trailing surrogate. + if ((nextCh >= 0xDC00) && (nextCh <= 0xDFFF)) + { + // Its trailing, so make sure we were expecting it + if (!gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Unexpected2ndSurrogateChar); + } + else + { + // Its just a char, so make sure we were not expecting a + // trailing surrogate. + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + + // Its got to at least be a valid XML character + else if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + } + gotLeadingSurrogate = false; + } + } +} + + +// +// This method scans the entire internal subset. All we can have here is +// decl markup, and PE references. The expanded PE references must contain +// whole markup, so we don't have to worry about their content at this +// level. We just scan them, expand them, push them, and parse their content +// right there, via the expandERef() method. +// +bool DTDScanner::scanInternalSubset() +{ + // Indicate we are in the internal subset now + FlagJanitor janContentFlag(&fInternalSubset, true); + + // If we have a doc type handler, tell it the internal subset starts + if (fDocTypeHandler) + fDocTypeHandler->startIntSubset(); + + // Get a buffer for whitespace + XMLBufBid bbSpace(fBufMgr); + + bool noErrors = true; + while (true) + { + const XMLCh nextCh = fReaderMgr->peekNextChar(); + + // + // If we get an end of file marker, just unget it and return a + // failure status. The caller will then see the end of file and + // faill out correctly. + // + if (!nextCh) + return false; + + // Watch for the end of internal subset marker + if (nextCh == chCloseSquare) + { + fReaderMgr->getNextChar(); + break; + } + + if (nextCh == chPercent) + { + // + // Expand (and scan if external) the reference value. Tell + // it to set the reader to cause an end of entity exception + // when this reader dies, which is what the scanExtSubset + // method wants (who is called to scan this.) + // + fReaderMgr->getNextChar(); + expandPERef(true, false, false, true); + } + else if (nextCh == chOpenAngle) + { + // Remember this reader before we start the scan, for checking + // XML 1.0 P28a Well-formedness constraint: PE Between Declarations + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + bool wasInPE = (fReaderMgr->getCurrentReader()->getType() == XMLReader::Type_PE); + + // And scan this markup + fReaderMgr->getNextChar(); + scanMarkupDecl(false); + + // If we did not get back to entry level, then partial markup + if (fReaderMgr->getCurrentReaderNum() != orgReader) { + if (wasInPE) + fScanner->emitError(XMLErrs::PEBetweenDecl); + else if (fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + } + } + else if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + { + // + // IF we are doing advanced callbacks and have a doc type + // handler, then get the whitespace and call the doc type + // handler with it. Otherwise, just skip whitespace. + // + if (fDocTypeHandler) + { + fReaderMgr->getSpaces(bbSpace.getBuffer()); + fDocTypeHandler->doctypeWhitespace + ( + bbSpace.getRawBuffer() + , bbSpace.getLen() + ); + } + else + { + fReaderMgr->skipPastSpaces(); + } + } + else + { + // Not valid, so emit an error + XMLCh tmpBuf[9]; + XMLString::binToText + ( + fReaderMgr->getNextChar() + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError + ( + XMLErrs::InvalidCharacterInIntSubset + , tmpBuf + ); + + // + // If an '>', then probably an abnormally terminated + // internal subset so just return. + // + if (nextCh == chCloseAngle) + { + noErrors = false; + break; + } + + // + // Otherwise, try to sync back up by scanning forward for + // a reasonable start character. + // + static const XMLCh toSkip[] = + { + chPercent, chCloseSquare, chOpenAngle, chNull + }; + fReaderMgr->skipUntilInOrWS(toSkip); + } + } + + // If we have a doc type handler, tell it the internal subset ends + if (fDocTypeHandler) + fDocTypeHandler->endIntSubset(); + + return noErrors; +} + + +// +// This method is called once we see a < in the input of an int/ext subset, +// which indicates the start of some sort of markup. +// +void DTDScanner::scanMarkupDecl(const bool parseTextDecl) +{ + // + // We only have two valid first characters here. One is a ! which opens + // some markup decl. The other is a ?, which could begin either a PI + // or a text decl. If parseTextDecl is false, we cannot accept a text + // decl. + // + const XMLCh nextCh = fReaderMgr->getNextChar(); + + if (nextCh == chBang) + { + if (fReaderMgr->skippedChar(chDash)) + { + if (fReaderMgr->skippedChar(chDash)) + { + scanComment(); + } + else + { + fScanner->emitError(XMLErrs::CommentsMustStartWith); + fReaderMgr->skipPastChar(chCloseAngle); + } + } + else if (fReaderMgr->skippedChar(chOpenSquare)) + { + // + // Its a conditional section. This is only valid in the external + // subset, so issue an error if we aren't there. + // + if (fInternalSubset) + { + fScanner->emitError(XMLErrs::ConditionalSectInIntSubset); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // A PE ref can happen here, but space is not required + checkForPERef(false, true); + + if (fReaderMgr->skippedString(XMLUni::fgIncludeString)) + { + checkForPERef(false, true); + + // Check for the following open square bracket + if (!fReaderMgr->skippedChar(chOpenSquare)) + fScanner->emitError(XMLErrs::ExpectedINCLUDEBracket); + + // Get the reader we started this on + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + + checkForPERef(false, true); + + // + // Recurse back to the ext subset call again, telling it its + // in an include section. + // + scanExtSubsetDecl(true, false); + + // + // And see if we got back to the same level. If not, then its + // a partial markup error. + // + if (fReaderMgr->getCurrentReaderNum() != orgReader && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + } + else if (fReaderMgr->skippedString(XMLUni::fgIgnoreString)) + { + checkForPERef(false, true); + + // Check for the following open square bracket + if (!fReaderMgr->skippedChar(chOpenSquare)) + fScanner->emitError(XMLErrs::ExpectedINCLUDEBracket); + + // Get the reader we started this on + const XMLSize_t orgReader = fReaderMgr->getCurrentReaderNum(); + + // And scan over the ignored part + scanIgnoredSection(); + + // + // And see if we got back to the same level. If not, then its + // a partial markup error. + // + if (fReaderMgr->getCurrentReaderNum() != orgReader && fScanner->getValidationScheme() == XMLScanner::Val_Always) + fScanner->getValidator()->emitError(XMLValid::PartialMarkupInPE); + + } + else + { + fScanner->emitError(XMLErrs::ExpectedIncOrIgn); + fReaderMgr->skipPastChar(chCloseAngle); + } + } + else if (fReaderMgr->skippedString(XMLUni::fgAttListString)) + { + scanAttListDecl(); + } + else if (fReaderMgr->skippedString(XMLUni::fgElemString)) + { + scanElementDecl(); + } + else if (fReaderMgr->skippedString(XMLUni::fgEntityString)) + { + scanEntityDecl(); + } + else if (fReaderMgr->skippedString(XMLUni::fgNotationString)) + { + scanNotationDecl(); + } + else + { + fScanner->emitError(XMLErrs::ExpectedMarkupDecl); + fReaderMgr->skipPastChar(chCloseAngle); + } + } + else if (nextCh == chQuestion) + { + // It could be a PI or the XML declaration. Check for Decl + if (fScanner->checkXMLDecl(false)) + { + // If we are not accepting text decls, its an error + if (parseTextDecl) + { + scanTextDecl(); + } + else + { + // Emit the error and skip past this markup + fScanner->emitError(XMLErrs::TextDeclNotLegalHere); + fReaderMgr->skipPastChar(chCloseAngle); + } + } + else + { + // It has to be a PI + scanPI(); + } + } + else + { + // Can't be valid so emit error and try to skip past end of this decl + fScanner->emitError(XMLErrs::ExpectedMarkupDecl); + fReaderMgr->skipPastChar(chCloseAngle); + } +} + + +// +// This method is called for a mixed model element's content mode. We've +// already scanned past the '(PCDATA' part by the time we get here. So +// everything else is element names separated by | characters until we +// hit the end. The passed element decl's content model is filled in with +// the information found. +// +bool DTDScanner::scanMixed(DTDElementDecl& toFill) +{ + // + // The terminating star is only required if there is something more + // than (PCDATA). + // + bool starRequired = false; + + // Get a buffer to be used below to get element names + XMLBufBid bbName(fBufMgr); + XMLBuffer& nameBuf = bbName.getBuffer(); + + // + // Create an initial content spec node. Its just a leaf node with a + // PCDATA element id. This current node pointer will be pushed down the + // tree as we go. + // + ContentSpecNode* curNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , XMLElementDecl::fgPCDataElemId + , fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + ); + + // + // Set the initial leaf as the temporary head. If we hit the first choice + // node, it will be set up here. When done, this is the node that's set + // as the content spec for the element. + // + ContentSpecNode* headNode = curNode; + + // Remember the original node so we can sense the first choice node + ContentSpecNode* orgNode = curNode; + + // + // We just loop around, getting the | character at the top and then + // looking for the next element name. We keep up with the last node + // and add each new one to its right node. + // + while (true) + { + // + // First of all we check for some grunt work details of skipping + // whitespace, expand PE refs, and catching invalid reps. + // + if (fReaderMgr->lookingAtChar(chPercent)) + { + // Expand it and continue + checkForPERef(false, true); + } + else if (fReaderMgr->skippedChar(chAsterisk)) + { + // + // Tell them they can't have reps in mixed model, but eat + // it and keep going if we are allowed to. + // + if (fScanner->emitErrorWillThrowException(XMLErrs::NoRepInMixed)) + { + delete headNode; + } + fScanner->emitError(XMLErrs::NoRepInMixed); + } + else if (fReaderMgr->skippedSpace()) + { + // Spaces are ok at this point, just eat them and continue + fReaderMgr->skipPastSpaces(); + } + else + { + if (!fReaderMgr->skippedChar(chPipe)) + { + // Has to be the closing paren now. + if (!fReaderMgr->skippedChar(chCloseParen)) + { + delete headNode; + fScanner->emitError(XMLErrs::UnterminatedContentModel, toFill.getElementName()->getLocalPart()); + return false; + } + + bool starSkipped = true; + if (!fReaderMgr->skippedChar(chAsterisk)) { + + starSkipped = false; + + if (starRequired) + { + if (fScanner->emitErrorWillThrowException(XMLErrs::ExpectedAsterisk)) + { + delete headNode; + } + fScanner->emitError(XMLErrs::ExpectedAsterisk); + } + } + + // + // Create a zero or more node and make the original head + // node its first child. + // + if (starRequired || starSkipped) { + headNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrMore + , headNode + , 0 + , true + , true + , fGrammarPoolMemoryManager + ); + } + + // Store the head node as the content spec of the element. + toFill.setContentSpec(headNode); + break; + } + + // Its more than just a PCDATA, so an ending star will be required now + starRequired = true; + + // Space is legal here so check for a PE ref, but don't require space + checkForPERef(false, true); + + // Get a name token + if (!fReaderMgr->getName(nameBuf)) + { + delete headNode; + fScanner->emitError(XMLErrs::ExpectedElementName); + return false; + } + + // + // Create a leaf node for it. If we can find the element id for + // this element, then use it. Else, we have to fault in an element + // decl, marked as created because of being in a content model. + // + XMLElementDecl* decl = fDTDGrammar->getElemDecl(fEmptyNamespaceId, 0, nameBuf.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE); + if (!decl) + { + decl = new (fGrammarPoolMemoryManager) DTDElementDecl + ( + nameBuf.getRawBuffer() + , fEmptyNamespaceId + , DTDElementDecl::Any + , fGrammarPoolMemoryManager + ); + decl->setCreateReason(XMLElementDecl::InContentModel); + decl->setExternalElemDeclaration(isReadingExternalEntity()); + fDTDGrammar->putElemDecl(decl); + } + + // + // If the current node is the original node, this is the first choice + // node, so create an initial choice node with the current node and + // the new element id. Store this as the head node. + // + // Otherwise, we have to steal the right node of the previous choice + // and weave in another choice node there, which has the old choice + // as its left and the new leaf as its right. + // + if (curNode == orgNode) + { + curNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::Choice + , curNode + , new (fGrammarPoolMemoryManager) ContentSpecNode + ( + decl->getElementName() + , fGrammarPoolMemoryManager + ) + , true + , true + , fGrammarPoolMemoryManager + ); + + // Remember the top node + headNode = curNode; + } + else + { + ContentSpecNode* oldRight = curNode->orphanSecond(); + curNode->setSecond + ( + new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::Choice + , oldRight + , new (fGrammarPoolMemoryManager) ContentSpecNode + ( + decl->getElementName() + , fGrammarPoolMemoryManager + ) + , true + , true + , fGrammarPoolMemoryManager + ) + ); + + // Make the new right node the current node + curNode = curNode->getSecond(); + } + } + } + + return true; +} + + +// +// This method is called when we see a 'emitError(XMLErrs::ExpectedWhitespace); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // + // And now we get a name, which is the name of the notation. Get a + // buffer for the name. + // + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::ExpectedNotationName); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // If namespaces are enabled, then no colons allowed + if (fScanner->getDoNamespaces()) + { + if (XMLString::indexOf(bbName.getRawBuffer(), chColon) != -1) + fScanner->emitError(XMLErrs::ColonNotLegalWithNS); + } + + // Space is required here so check for a PE ref, and require space + if (!checkForPERef(false, true)) + { + fScanner->emitError(XMLErrs::ExpectedWhitespace); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // + // And scan an external or public id. We need buffers to use for both + // of these. + // + XMLBufBid bbPubId(fBufMgr); + XMLBufBid bbSysId(fBufMgr); + if (!scanId(bbPubId.getBuffer(), bbSysId.getBuffer(), IDType_Either)) + { + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // We can have an optional space or PE ref here + checkForPERef(false, true); + + // + // See if it already exists. If so, add it to the notatino decl pool. + // Otherwise, if advanced callbacks are on, create a temp one and + // call out for that one. + // + XMLNotationDecl* decl = fDTDGrammar->getNotationDecl(bbName.getRawBuffer()); + bool isIgnoring = (decl != 0); + if (isIgnoring) + { + fScanner->emitError(XMLErrs::NotationAlreadyExists, bbName.getRawBuffer()); + } + else + { + // Fill in a new notation declaration and add it to the pool + const XMLCh* publicId = bbPubId.getRawBuffer(); + const XMLCh* systemId = bbSysId.getRawBuffer(); + ReaderMgr::LastExtEntityInfo lastInfo; + fReaderMgr->getLastExtEntityInfo(lastInfo); + + decl = new (fGrammarPoolMemoryManager) XMLNotationDecl + ( + bbName.getRawBuffer() + , (publicId && *publicId) ? publicId : 0 + , (systemId && *systemId) ? systemId : 0 + , (lastInfo.systemId && *lastInfo.systemId) ? lastInfo.systemId : 0 + , fGrammarPoolMemoryManager + ); + fDTDGrammar->putNotationDecl(decl); + } + + // + // If we have a document type handler, then tell it about this. If we + // are ignoring it, only call out if advanced callbacks are enabled. + // + if (fDocTypeHandler) + { + fDocTypeHandler->notationDecl + ( + *decl + , isIgnoring + ); + } + + // And one more optional space or PE ref + checkForPERef(false, true); + + // And skip the terminating bracket + if (!fReaderMgr->skippedChar(chCloseAngle)) + fScanner->emitError(XMLErrs::UnterminatedNotationDecl); +} + + +// +// Scans a PI and calls the appropriate callbacks. A PI can happen in either +// the document or the DTD, so it calls the appropriate handler according +// to the fInDocument flag. +// +// At entry we have just scanned the lookingAtSpace()) + { + fScanner->emitError(XMLErrs::PINameExpected); + fReaderMgr->skipPastSpaces(); + } + + // Get a buffer for the PI name and scan it in + XMLBufBid bbName(fBufMgr); + if (!fReaderMgr->getName(bbName.getBuffer())) + { + fScanner->emitError(XMLErrs::PINameExpected); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // Point the name pointer at the raw data + namePtr = bbName.getRawBuffer(); + + // See if it issome form of 'xml' and emit a warning + //if (!XMLString::compareIString(namePtr, XMLUni::fgXMLString)) + if (bbName.getLen() == 3 && + (((namePtr[0] == chLatin_x) || (namePtr[0] == chLatin_X)) && + ((namePtr[1] == chLatin_m) || (namePtr[1] == chLatin_M)) && + ((namePtr[2] == chLatin_l) || (namePtr[2] == chLatin_L)))) + fScanner->emitError(XMLErrs::NoPIStartsWithXML); + + // If namespaces are enabled, then no colons allowed + if (fScanner->getDoNamespaces()) + { + if (XMLString::indexOf(namePtr, chColon) != -1) + fScanner->emitError(XMLErrs::ColonNotLegalWithNS); + } + + // + // If we don't hit a space next, then the PI has no target. If we do + // then get out the target. Get a buffer for it as well + // + XMLBufBid bbTarget(fBufMgr); + if (fReaderMgr->skippedSpace()) + { + // Skip any leading spaces + fReaderMgr->skipPastSpaces(); + + bool gotLeadingSurrogate = false; + + // It does have a target, so lets move on to deal with that. + while (1) + { + const XMLCh nextCh = fReaderMgr->getNextChar(); + + // Watch for an end of file, which is always bad here + if (!nextCh) + { + fScanner->emitError(XMLErrs::UnterminatedPI); + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + } + + // Watch for potential terminating character + if (nextCh == chQuestion) + { + // It must be followed by '>' to be a termination of the target + if (fReaderMgr->skippedChar(chCloseAngle)) + break; + } + + // Check for correct surrogate pairs + if ((nextCh >= 0xD800) && (nextCh <= 0xDBFF)) + { + if (gotLeadingSurrogate) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + else + gotLeadingSurrogate = true; + } + else + { + if (gotLeadingSurrogate) + { + if ((nextCh < 0xDC00) || (nextCh > 0xDFFF)) + fScanner->emitError(XMLErrs::Expected2ndSurrogateChar); + } + // Its got to at least be a valid XML character + else if (!fReaderMgr->getCurrentReader()->isXMLChar(nextCh)) { + + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidCharacter, tmpBuf); + } + + gotLeadingSurrogate = false; + } + bbTarget.append(nextCh); + } + } + else + { + // No target, but make sure its terminated ok + if (!fReaderMgr->skippedChar(chQuestion)) + { + fScanner->emitError(XMLErrs::UnterminatedPI); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + if (!fReaderMgr->skippedChar(chCloseAngle)) + { + fScanner->emitError(XMLErrs::UnterminatedPI); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + } + + // Point the target pointer at the raw data + targetPtr = bbTarget.getRawBuffer(); + + // + // If we have a handler, then call it. + // + if (fDocTypeHandler) + { + fDocTypeHandler->doctypePI + ( + namePtr + , targetPtr + ); + } +} + + +// +// This method scans a public literal. It must be quoted and all of its +// characters must be valid public id characters. The quotes are discarded +// and the results are returned. +// +bool DTDScanner::scanPublicLiteral(XMLBuffer& toFill) +{ + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr->skipIfQuote(quoteCh)) { + fScanner->emitError(XMLErrs::ExpectedQuotedString); + return false; + } + + while (true) + { + const XMLCh nextCh = fReaderMgr->getNextChar(); + + // Watch for EOF + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + + if (nextCh == quoteCh) + break; + + // + // If its not a valid public id char, then report it but keep going + // since that's the best recovery scheme. + // + if (!fReaderMgr->getCurrentReader()->isPublicIdChar(nextCh)) + { + XMLCh tmpBuf[9]; + XMLString::binToText + ( + nextCh + , tmpBuf + , 8 + , 16 + , fMemoryManager + ); + fScanner->emitError(XMLErrs::InvalidPublicIdChar, tmpBuf); + } + + toFill.append(nextCh); + } + return true; +} + + +// +// This method handles scanning in a quoted system literal. It expects to +// start on the open quote and returns after eating the ending quote. There +// are not really any restrictions on the contents of system literals. +// +bool DTDScanner::scanSystemLiteral(XMLBuffer& toFill) +{ + toFill.reset(); + + // Get the next char which must be a single or double quote + XMLCh quoteCh; + if (!fReaderMgr->skipIfQuote(quoteCh)) { + fScanner->emitError(XMLErrs::ExpectedQuotedString); + return false; + } + + XMLCh nextCh; + // Break out on terminating quote + while ((nextCh=fReaderMgr->getNextChar())!=quoteCh) + { + // Watch for EOF + if (!nextCh) + ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); + toFill.append(nextCh); + } + return true; +} + + + +// +// This method is called to scan a text decl line, which can be the first +// line in an external entity or external subset. +// +// On entry the ' +// +void DTDScanner::scanTextDecl() +{ + // Skip any subsequent whitespace before the version string + fReaderMgr->skipPastSpaces(); + + // Next should be the version string + XMLBufBid bbVersion(fBufMgr); + if (fReaderMgr->skippedString(XMLUni::fgVersionString)) + { + if (!scanEq()) + { + fScanner->emitError(XMLErrs::ExpectedEqSign); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // + // Followed by a single or double quoted version. Get a buffer for + // the string. + // + if (!getQuotedString(bbVersion.getBuffer())) + { + fScanner->emitError(XMLErrs::BadXMLVersion); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // If its not our supported version, issue an error but continue + if (XMLString::equals(bbVersion.getRawBuffer(), XMLUni::fgVersion1_1)) { + if (fScanner->getXMLVersion() != XMLReader::XMLV1_1) + fScanner->emitError(XMLErrs::UnsupportedXMLVersion, bbVersion.getRawBuffer()); + } + else if (!XMLString::equals(bbVersion.getRawBuffer(), XMLUni::fgVersion1_0)) + fScanner->emitError(XMLErrs::UnsupportedXMLVersion, bbVersion.getRawBuffer()); + } + + // Ok, now we must have an encoding string + XMLBufBid bbEncoding(fBufMgr); + fReaderMgr->skipPastSpaces(); + bool gotEncoding = false; + if (fReaderMgr->skippedString(XMLUni::fgEncodingString)) + { + // There must be a equal sign next + if (!scanEq()) + { + fScanner->emitError(XMLErrs::ExpectedEqSign); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // Followed by a single or double quoted version string + getQuotedString(bbEncoding.getBuffer()); + if (bbEncoding.isEmpty() || !XMLString::isValidEncName(bbEncoding.getRawBuffer())) + { + fScanner->emitError(XMLErrs::BadXMLEncoding, bbEncoding.getRawBuffer()); + fReaderMgr->skipPastChar(chCloseAngle); + return; + } + + // Indicate that we got an encoding + gotEncoding = true; + } + + // + // Encoding declarations are required in the external entity + // if there is a text declaration present + // + if (!gotEncoding) + { + fScanner->emitError(XMLErrs::EncodingRequired); + fReaderMgr->skipPastChar(chCloseAngle); + return; + + } + + fReaderMgr->skipPastSpaces(); + if (!fReaderMgr->skippedChar(chQuestion)) + { + fScanner->emitError(XMLErrs::UnterminatedXMLDecl); + fReaderMgr->skipPastChar(chCloseAngle); + } + else if (!fReaderMgr->skippedChar(chCloseAngle)) + { + fScanner->emitError(XMLErrs::UnterminatedXMLDecl); + fReaderMgr->skipPastChar(chCloseAngle); + } + + // + // If we have a document type handler and advanced callbacks are on, + // then call the TextDecl callback + // + if (fDocTypeHandler) + { + fDocTypeHandler->TextDecl + ( + bbVersion.getRawBuffer() + , bbEncoding.getRawBuffer() + ); + } + + // + // If we got an encoding string, then we have to call back on the reader + // to tell it what the encoding is. + // + if (!bbEncoding.isEmpty()) + { + if (!fReaderMgr->getCurrentReader()->setEncoding(bbEncoding.getRawBuffer())) + fScanner->emitError(XMLErrs::ContradictoryEncoding, bbEncoding.getRawBuffer()); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.hpp new file mode 100644 index 000000000..1ebbb46d1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDScanner.hpp @@ -0,0 +1,277 @@ +/* + * 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: DTDScanner.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDSCANNER_HPP) +#define XERCESC_INCLUDE_GUARD_DTDSCANNER_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLScanner; + +/* + * Default implementation of an XML DTD scanner. + */ +class DocTypeHandler; + +class VALIDATORS_EXPORT DTDScanner : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Class specific types + // + // EntityExpRes + // Returned from scanEntityRef() to indicate how the expanded text + // was treated. + // + // IDTypes + // Type of the ID + // ----------------------------------------------------------------------- + enum EntityExpRes + { + EntityExp_Failed + , EntityExp_Pushed + , EntityExp_Returned + }; + + enum IDTypes + { + IDType_Public + , IDType_External + , IDType_Either + }; + + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDScanner + ( + DTDGrammar* dtdGrammar + , DocTypeHandler* const docTypeHandler + , MemoryManager* const grammarPoolMemoryManager + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~DTDScanner(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + DocTypeHandler* getDocTypeHandler(); + const DocTypeHandler* getDocTypeHandler() const; + + // ----------------------------------------------------------------------- + // Setter methods + // + // setScannerInfo() is called by the scanner to tell the DTDScanner + // about the stuff it needs to have access to. + // ----------------------------------------------------------------------- + void setScannerInfo + ( + XMLScanner* const owningScanner + , ReaderMgr* const readerMgr + , XMLBufferMgr* const bufMgr + ); + + void setDocTypeHandler + ( + DocTypeHandler* const handlerToSet + ); + + void scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD); + bool scanInternalSubset(); + bool scanId + ( + XMLBuffer& pubIdToFill + , XMLBuffer& sysIdToFill + , const IDTypes whatKind + ); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDScanner(const DTDScanner &); + DTDScanner& operator = (const DTDScanner&); + + // ----------------------------------------------------------------------- + // Private DTD scanning methods. These are all in XMLValidator2.cpp + // ----------------------------------------------------------------------- + bool checkForPERef + ( + const bool inLiteral + , const bool inMarkup + ); + bool expandPERef + ( + const bool scanExternal + , const bool inLiteral + , const bool inMarkup + , const bool throwEndOfExt = false + ); + bool getQuotedString(XMLBuffer& toFill); + XMLAttDef* scanAttDef(DTDElementDecl& elemDecl, XMLBuffer& bufToUse); + bool scanAttValue + ( + const XMLCh* const attrName + , XMLBuffer& toFill + , const XMLAttDef::AttTypes type + ); + void scanAttListDecl(); + ContentSpecNode* scanChildren + ( + const DTDElementDecl& elemDecl + , XMLBuffer& bufToUse + ); + bool scanCharRef(XMLCh& toFill, XMLCh& second); + void scanComment(); + bool scanContentSpec(DTDElementDecl& toFill); + void scanDefaultDecl(DTDAttDef& toFill); + void scanElementDecl(); + void scanEntityDecl(); + bool scanEntityDef(); + bool scanEntityLiteral(XMLBuffer& toFill); + bool scanEntityDef(DTDEntityDecl& decl, const bool isPEDecl); + EntityExpRes scanEntityRef(XMLCh& firstCh, XMLCh& secondCh, bool& escaped); + bool scanEnumeration + ( + const DTDAttDef& attDef + , XMLBuffer& toFill + , const bool notation + ); + bool scanEq(); + void scanIgnoredSection(); + void scanMarkupDecl(const bool parseTextDecl); + bool scanMixed(DTDElementDecl& toFill); + void scanNotationDecl(); + void scanPI(); + bool scanPublicLiteral(XMLBuffer& toFill); + bool scanSystemLiteral(XMLBuffer& toFill); + void scanTextDecl(); + bool isReadingExternalEntity(); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fDocTypeHandler + // This holds the optional doc type handler that can be installed + // and used to call back for all markup events. It is DTD specific. + // + // fDumAttDef + // fDumElemDecl + // fDumEntityDecl + // These are dummy objects into which mark decls are parsed when + // they are just overrides of previously declared markup decls. In + // such situations, the first one wins but we need to have somewhere + // to parse them into. So these are lazily created and used as needed + // when such markup decls are seen. + // + // fInternalSubset + // This is used to track whether we are in the internal subset or not, + // in which case we are in the external subset. + // + // fNextAttrId + // Since att defs are per-element, we don't have a validator wide + // attribute def pool. So we use a simpler data structure in each + // element decl to store its att defs, and we use this simple counter + // to apply a unique id to each new attribute. + // + // fDTDGrammar + // The DTD information we scanned like element decl, attribute decl + // are stored in this Grammar. + // + // fBufMgr + // This is the buffer manager of the scanner. This is provided as a + // convenience so that the DTDScanner doesn't have to create its own + // buffer manager during the parse process. + // + // fReaderMgr + // This is a pointer to the reader manager that is being used by the scanner. + // + // fScanner + // The pointer to the scanner to which this DTDScanner belongs + // + // fPEntityDeclPool + // This is a pool of EntityDecl objects, which contains all of the + // parameter entities that are declared in the DTD subsets. + // + // fEmptyNamespaceId + // The uri for all DTD decls + // + // fDocTypeReaderId + // The original reader in the fReaderMgr - to be compared against the + // current reader to decide whether we are processing an external/internal + // declaration + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + MemoryManager* fGrammarPoolMemoryManager; + DocTypeHandler* fDocTypeHandler; + DTDAttDef* fDumAttDef; + DTDElementDecl* fDumElemDecl; + DTDEntityDecl* fDumEntityDecl; + bool fInternalSubset; + unsigned int fNextAttrId; + DTDGrammar* fDTDGrammar; + XMLBufferMgr* fBufMgr; + ReaderMgr* fReaderMgr; + XMLScanner* fScanner; + NameIdPool* fPEntityDeclPool; + unsigned int fEmptyNamespaceId; + XMLSize_t fDocTypeReaderId; +}; + + +// --------------------------------------------------------------------------- +// DTDScanner: Getter methods +// --------------------------------------------------------------------------- +inline DocTypeHandler* DTDScanner::getDocTypeHandler() +{ + return fDocTypeHandler; +} + +inline const DocTypeHandler* DTDScanner::getDocTypeHandler() const +{ + return fDocTypeHandler; +} + + +// --------------------------------------------------------------------------- +// DTDScanner: Setter methods +// --------------------------------------------------------------------------- +inline void DTDScanner::setDocTypeHandler(DocTypeHandler* const handlerToSet) +{ + fDocTypeHandler = handlerToSet; +} + +// ----------------------------------------------------------------------- +// Helper methods +// ----------------------------------------------------------------------- +inline bool DTDScanner::isReadingExternalEntity() { + return (fDocTypeReaderId != fReaderMgr->getCurrentReaderNum()); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.cpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.cpp new file mode 100644 index 000000000..eb2f67ef3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.cpp @@ -0,0 +1,657 @@ +/* + * 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: DTDValidator.cpp 729944 2008-12-29 17:03:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DTDValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +DTDValidator::DTDValidator(XMLErrorReporter* const errReporter) : + + XMLValidator(errReporter) + , fDTDGrammar(0) +{ + reset(); +} + +DTDValidator::~DTDValidator() +{ +} + + +// --------------------------------------------------------------------------- +// DTDValidator: Implementation of the XMLValidator interface +// --------------------------------------------------------------------------- +bool DTDValidator::checkContent(XMLElementDecl* const elemDecl + , QName** const children + , XMLSize_t childCount + , XMLSize_t* indexFailingChild) +{ + // + // Look up the element id in our element decl pool. This will get us + // the element decl in our own way of looking at them. + // + if (!elemDecl) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Val_InvalidElemId, getScanner()->getMemoryManager()); + + // + // Get the content spec type of this element. This will tell us what + // to do to validate it. + // + const DTDElementDecl::ModelTypes modelType = ((DTDElementDecl*) elemDecl)->getModelType(); + + if (modelType == DTDElementDecl::Empty) + { + // + // We can do this one here. It cannot have any children. If it does + // we return 0 as the index of the first bad child. + // + if (childCount) + { + *indexFailingChild=0; + return false; + } + } + else if (modelType == DTDElementDecl::Any) + { + // We pass no judgement on this one, anything goes + } + else if ((modelType == DTDElementDecl::Mixed_Simple) + || (modelType == DTDElementDecl::Children)) + { + // Get the element's content model or fault it in + const XMLContentModel* elemCM = elemDecl->getContentModel(); + + // Ask it to validate and return its return + return elemCM->validateContent(children, childCount, getScanner()->getEmptyNamespaceId(), indexFailingChild, getScanner()->getMemoryManager()); + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMType, getScanner()->getMemoryManager()); + } + + // Went ok, so return success + return true; +} + + +void DTDValidator::faultInAttr(XMLAttr& toFill, const XMLAttDef& attDef) const +{ + toFill.set(0, attDef.getFullName(), attDef.getValue(), attDef.getType()); +} + +void DTDValidator::reset() +{ +} + + +bool DTDValidator::requiresNamespaces() const +{ + // Namespaces are not supported for DTDs + return false; +} + + +void +DTDValidator::validateAttrValue(const XMLAttDef* attDef + , const XMLCh* const attrValue + , bool preValidation + , const XMLElementDecl*) +{ + // + // Get quick refs to lost of of the stuff in the passed objects in + // order to simplify the code below, which will reference them very + // often. + // + const XMLAttDef::AttTypes type = attDef->getType(); + const XMLAttDef::DefAttTypes defType = attDef->getDefaultType(); + const XMLCh* const valueText = attDef->getValue(); + const XMLCh* const fullName = attDef->getFullName(); + const XMLCh* const enumList = attDef->getEnumeration(); + + // + // If the default type is fixed, then make sure the passed value maps + // to the fixed value. + // If during preContentValidation, the value we are validating is the fixed value itself + // so no need to compare. + // Only need to do this for regular attribute value validation + // + if (defType == XMLAttDef::Fixed && !preValidation) + { + if (!XMLString::equals(attrValue, valueText)) + emitError(XMLValid::NotSameAsFixedValue, fullName, attrValue, valueText); + } + + // + // If its a CDATA attribute, then we are done with any DTD level + // validation else do the rest. + // + if (type == XMLAttDef::CData) + return; + + + + // An empty string cannot be valid for any of the other types + if (!attrValue[0]) + { + emitError(XMLValid::InvalidEmptyAttValue, fullName); + return; + } + + // See whether we are doing multiple values or not + const bool multipleValues = + ( + (type == XMLAttDef::IDRefs) + || (type == XMLAttDef::Entities) + || (type == XMLAttDef::NmTokens) + || (type == XMLAttDef::Notation) + || (type == XMLAttDef::Enumeration) + ); + + // And whether we must check for a first name char + const bool firstNameChar = + ( + (type == XMLAttDef::ID) + || (type == XMLAttDef::IDRef) + || (type == XMLAttDef::IDRefs) + || (type == XMLAttDef::Entity) + || (type == XMLAttDef::Entities) + || (type == XMLAttDef::Notation) + ); + + // Whether it requires ref checking stuff + const bool isARefType + ( + (type == XMLAttDef::ID) + || (type == XMLAttDef::IDRef) + || (type == XMLAttDef::IDRefs) + ); + + // Some trigger flags to avoid issuing redundant errors and whatnot + bool alreadyCapped = false; + + // + // Make a copy of the text that we can mangle and get a pointer we can + // move through the value + // + + // Use a stack-based buffer, when possible... + XMLCh tempBuffer[100]; + + XMLCh* pszTmpVal = 0; + + ArrayJanitor janTmpVal(0); + + if (XMLString::stringLen(attrValue) < sizeof(tempBuffer) / sizeof(tempBuffer[0])) + { + XMLString::copyString(tempBuffer, attrValue); + pszTmpVal = tempBuffer; + } + else + { + janTmpVal.reset(XMLString::replicate(attrValue, getScanner()->getMemoryManager()), getScanner()->getMemoryManager()); + pszTmpVal = janTmpVal.get(); + } + + XMLCh* valPtr = pszTmpVal; + + bool doNamespace = getScanner()->getDoNamespaces(); + + while (true) + { + // + // Make sure the first character is a valid first name char, i.e. + // if its a Name value. For NmToken values we don't treat the first + // char any differently. + // + if (firstNameChar) + { + // If its not, emit and error but try to keep going + if (!getReaderMgr()->getCurrentReader()->isFirstNameChar(*valPtr)) + emitError(XMLValid::AttrValNotName, valPtr, fullName); + valPtr++; + } + + // Make sure all the remaining chars are valid name chars + while (*valPtr) + { + // + // If we hit a whitespace, its either a break between two + // or more values, or an error if we have a single value. + // + // + // XML1.0-3rd + // + // [6] Names ::= Name (#x20 Name)* + // [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* + // + // only and only ONE #x20 is allowed to be the delimiter + // + if (*valPtr==chSpace) + { + if (!multipleValues) + { + emitError(XMLValid::NoMultipleValues, fullName); + return; + } + + break; + } + + // Now this attribute can be of type + // ID, IDREF, IDREFS, ENTITY, ENTITIES, NOTATION, NMTOKEN, NMTOKENS, ENUMERATION + // All these must be valid XMLName + // If namespace is enabled, colon is not allowed in the first 6 + + if (doNamespace && *valPtr == chColon && firstNameChar) + emitError(XMLValid::ColonNotValidWithNS); + + if (!getReaderMgr()->getCurrentReader()->isNameChar(*valPtr)) + { + emitError(XMLValid::AttrValNotName, valPtr, fullName); + return; + } + valPtr++; + } + + // + // Cap it off at the current non-name char. If already capped, + // then remember this. + // + if (!(*valPtr)) + alreadyCapped = true; + *valPtr = 0; + + // + // If this type of attribute requires that we track reference + // stuff, then handle that. + // + if (isARefType) + { + if ((type == XMLAttDef::ID) + || (type == XMLAttDef::IDRef) + || (type == XMLAttDef::IDRefs)) + { + XMLRefInfo* find = getScanner()->getIDRefList()->get(pszTmpVal); + if (find) + { + if (find->getDeclared() && (type == XMLAttDef::ID)) + emitError(XMLValid::ReusedIDValue, pszTmpVal); + } + else + { + find = new (getScanner()->getMemoryManager()) XMLRefInfo + ( + pszTmpVal + , false + , false + , getScanner()->getMemoryManager() + ); + getScanner()->getIDRefList()->put((void*)find->getRefName(), find); + } + + // + // Mark it declared or used, which might be redundant in some cases + // but not worth checking + // + if (type == XMLAttDef::ID) + find->setDeclared(true); + else { + if (!preValidation) { + find->setUsed(true); + } + } + } + } + else if (!preValidation && ((type == XMLAttDef::Entity) || (type == XMLAttDef::Entities))) + { + // + // If its refering to a entity, then look up the name in the + // general entity pool. If not there, then its an error. If its + // not an external unparsed entity, then its an error. + // + // In case of pre-validation, the above errors should be ignored. + // + const XMLEntityDecl* decl = fDTDGrammar->getEntityDecl(pszTmpVal); + if (decl) + { + if (!decl->isUnparsed()) + emitError(XMLValid::BadEntityRefAttr, pszTmpVal, fullName); + } + else + { + emitError + ( + XMLValid::UnknownEntityRefAttr + , fullName + , pszTmpVal + ); + } + } + else if ((type == XMLAttDef::Notation) || (type == XMLAttDef::Enumeration)) + { + // + // Make sure that this value maps to one of the enumeration or + // notation values in the enumList parameter. We don't have to + // look it up in the notation pool (if a notation) because we + // will look up the enumerated values themselves. If they are in + // the notation pool (after the DTD is parsed), then obviously + // this value will be legal since it matches one of them. + // + if (!XMLString::isInList(pszTmpVal, enumList)) + emitError(XMLValid::DoesNotMatchEnumList, pszTmpVal, fullName); + } + + // If not doing multiple values, then we are done + if (!multipleValues) + break; + + // + // If we are at the end, then break out now, else move up to the + // next char and update the base pointer. + // + if (alreadyCapped) + break; + + valPtr++; + pszTmpVal = valPtr; + } + +} + +void DTDValidator::preContentValidation(bool +#if defined(XERCES_DEBUG) + reuseGrammar +#endif + ,bool validateDefAttr) +{ + // + // Lets enumerate all of the elements in the element decl pool + // and put out an error for any that did not get declared. + // We also check all of the attributes as well. + // + NameIdPoolEnumerator elemEnum = fDTDGrammar->getElemEnumerator(); + fDTDGrammar->setValidated(true); + while (elemEnum.hasMoreElements()) + { + const DTDElementDecl& curElem = elemEnum.nextElement(); + const DTDElementDecl::CreateReasons reason = curElem.getCreateReason(); + + // + // See if this element decl was ever marked as declared. If + // not, then put out an error. In some cases its just + // a warning, such as being referenced in a content model. + // + if (reason != XMLElementDecl::Declared) + { + if (reason == XMLElementDecl::AttList) + { + getScanner()->emitError + ( + XMLErrs::UndeclaredElemInAttList + , curElem.getFullName() + ); + } + else if (reason == XMLElementDecl::AsRootElem) + { + // It's ok that the root element is not declared in the DTD + /* + emitError + ( + XMLValid::UndeclaredElemInDocType + , curElem.getFullName() + );*/ + } + else if (reason == XMLElementDecl::InContentModel) + { + getScanner()->emitError + ( + XMLErrs::UndeclaredElemInCM + , curElem.getFullName() + ); + } + else + { + #if defined(XERCES_DEBUG) + if(reuseGrammar && reason == XMLElementDecl::JustFaultIn){ + } + else + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::DTD_UnknownCreateReason, getScanner()->getMemoryManager()); + #endif + } + } + + // + // Check all of the attributes of the current element. + // We check for: + // + // 1) Multiple ID attributes + // 2) That all of the default values of attributes are + // valid for their type. + // 3) That for any notation types, that their lists + // of possible values refer to declared notations. + // + // 4) XML1.0(3rd edition) + // + // Validity constraint: One Notation Per Element Type + // An element type MUST NOT have more than one NOTATION attribute specified. + // + // Validity constraint: No Notation on Empty Element + // For compatibility, an attribute of type NOTATION MUST NOT be declared on an element declared EMPTY. + // + // Validity constraint: No Duplicate Tokens + // The notation names in a single NotationType attribute declaration, as well as + // the NmTokens in a single Enumeration attribute declaration, MUST all be distinct. + // + + XMLAttDefList& attDefList = curElem.getAttDefList(); + bool seenId = false; + bool seenNOTATION = false; + bool elemEmpty = (curElem.getModelType() == DTDElementDecl::Empty); + + for(XMLSize_t i=0; i entEnum = fDTDGrammar->getEntityEnumerator(); + while (entEnum.hasMoreElements()) + { + const DTDEntityDecl& curEntity = entEnum.nextElement(); + + if (!curEntity.getNotationName()) + continue; + + // It has a notation name, so look it up + if (!fDTDGrammar->getNotationDecl(curEntity.getNotationName())) + { + emitError + ( + XMLValid::NotationNotDeclared + , curEntity.getNotationName() + ); + } + } +} + +void DTDValidator::postParseValidation() +{ + // + // At this time, there is nothing to do here. The scanner itself handles + // ID/IDREF validation, since that is the same no matter what kind of + // validator. + // +} + +// +// We need to verify that all of its possible values +// (in the enum list) +// is distinct and +// refer to valid notations if toValidateNotation is set on +// +void DTDValidator::checkTokenList(const XMLAttDef& curAttDef + , bool toValidateNotation) +{ + + XMLCh* list = XMLString::replicate(curAttDef.getEnumeration(), getScanner()->getMemoryManager()); + ArrayJanitor janList(list, getScanner()->getMemoryManager()); + + // + // Search forward for a space or a null. If a null, + // we are done. If a space, cap it and look it up. + // + bool breakFlag = false; + XMLCh* listPtr = list; + XMLCh* lastPtr = listPtr; + while (true) + { + while (*listPtr && (*listPtr != chSpace)) + listPtr++; + + // + // If at the end, indicate we need to break after + // this one. Else, cap it off here. + // + if (!*listPtr) + breakFlag = true; + else + *listPtr++ = chNull; + + //distinction check + //there should be no same token found in the remaining list + if (XMLString::isInList(lastPtr, listPtr)) + { + emitError + ( + XMLValid::AttrDupToken + , curAttDef.getFullName() + , lastPtr + ); + } + + if (toValidateNotation && !fDTDGrammar->getNotationDecl(lastPtr)) + { + emitError + ( + XMLValid::UnknownNotRefAttr + , curAttDef.getFullName() + , lastPtr + ); + } + + // Break out if we hit the end last time + if (breakFlag) + break; + + // Else move upwards and try again + lastPtr = listPtr; + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.hpp new file mode 100644 index 000000000..284bb82f9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DTDValidator.hpp @@ -0,0 +1,158 @@ +/* + * 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: DTDValidator.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DTDVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DTDVALIDATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLMsgLoader; + + +// +// This is a derivative of the abstract validator interface. This class +// implements a validator that supports standard XML 1.0 DTD semantics. +// This class handles scanning the internal and external subsets of the +// DTD, and provides the standard validation services against the DTD info +// it found. +// +class VALIDATORS_EXPORT DTDValidator : public XMLValidator +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DTDValidator(XMLErrorReporter* const errReporter = 0); + virtual ~DTDValidator(); + + // ----------------------------------------------------------------------- + // Implementation of the XMLValidator interface + // ----------------------------------------------------------------------- + virtual bool checkContent + ( + XMLElementDecl* const elemDecl + , QName** const children + , XMLSize_t childCount + , XMLSize_t* indexFailingChild + ); + + 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; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DTDValidator(const DTDValidator &); + DTDValidator& operator = (const DTDValidator&); + + // ----------------------------------------------------------------------- + // Helper + // ----------------------------------------------------------------------- + void checkTokenList(const XMLAttDef& attDef + , bool toValidateNotation); + + // ----------------------------------------------------------------------- + // Private data members + // + // fDTDGrammar + // The DTD information stored. + // + // ----------------------------------------------------------------------- + DTDGrammar* fDTDGrammar; +}; + +// --------------------------------------------------------------------------- +// Virtual interface +// --------------------------------------------------------------------------- +inline Grammar* DTDValidator::getGrammar() const { + return fDTDGrammar; +} + +inline void DTDValidator::setGrammar(Grammar* aGrammar) { + fDTDGrammar = (DTDGrammar*) aGrammar; +} + +inline void DTDValidator::validateElement (const XMLElementDecl*) { + // no special DTD Element validation +} + +// --------------------------------------------------------------------------- +// DTDValidator: DTD handler interface +// --------------------------------------------------------------------------- +inline bool DTDValidator::handlesDTD() const +{ + // We definitely want to handle DTD scanning + return true; +} + +// --------------------------------------------------------------------------- +// DTDValidator: Schema handler interface +// --------------------------------------------------------------------------- +inline bool DTDValidator::handlesSchema() const +{ + // No Schema scanning + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/DocTypeHandler.hpp b/project/jni/xerces/src/xercesc/validators/DTD/DocTypeHandler.hpp new file mode 100644 index 000000000..e467edb34 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/DocTypeHandler.hpp @@ -0,0 +1,145 @@ +/* + * 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: DocTypeHandler.hpp 557282 2007-07-18 14:54:15Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOCTYPEHANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_DOCTYPEHANDLER_HPP + +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This abstract class defines the document type handler API's which can be +// used to process the DTD events generated by the DTDScanner as it scans the +// internal and external subset. + +class VALIDATORS_EXPORT DocTypeHandler +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DocTypeHandler() + { + } + + virtual ~DocTypeHandler() + { + } + + + // ----------------------------------------------------------------------- + // The document type handler virtual handler interface + // ----------------------------------------------------------------------- + virtual void attDef + ( + const DTDElementDecl& elemDecl + , const DTDAttDef& attDef + , const bool ignoring + ) = 0; + + virtual void doctypeComment + ( + const XMLCh* const comment + ) = 0; + + virtual void doctypeDecl + ( + const DTDElementDecl& elemDecl + , const XMLCh* const publicId + , const XMLCh* const systemId + , const bool hasIntSubset + , const bool hasExtSubset = false + ) = 0; + + virtual void doctypePI + ( + const XMLCh* const target + , const XMLCh* const data + ) = 0; + + virtual void doctypeWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + ) = 0; + + virtual void elementDecl + ( + const DTDElementDecl& decl + , const bool isIgnored + ) = 0; + + virtual void endAttList + ( + const DTDElementDecl& elemDecl + ) = 0; + + virtual void endIntSubset() = 0; + + virtual void endExtSubset() = 0; + + virtual void entityDecl + ( + const DTDEntityDecl& entityDecl + , const bool isPEDecl + , const bool isIgnored + ) = 0; + + virtual void resetDocType() = 0; + + virtual void notationDecl + ( + const XMLNotationDecl& notDecl + , const bool isIgnored + ) = 0; + + virtual void startAttList + ( + const DTDElementDecl& elemDecl + ) = 0; + + virtual void startIntSubset() = 0; + + virtual void startExtSubset() = 0; + + virtual void TextDecl + ( + const XMLCh* const versionStr + , const XMLCh* const encodingStr + ) = 0; + + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DocTypeHandler(const DocTypeHandler&); + DocTypeHandler& operator=(const DocTypeHandler&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp b/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp new file mode 100644 index 000000000..11b354472 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.cpp @@ -0,0 +1,133 @@ +/* + * 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: XMLDTDDescriptionImpl.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLDTDDescriptionImpl: constructor and destructor +// --------------------------------------------------------------------------- +XMLDTDDescriptionImpl::XMLDTDDescriptionImpl(const XMLCh* const systemId + , MemoryManager* const memMgr ) +:XMLDTDDescription(memMgr) +,fSystemId(0) +,fRootName(0) +{ + if (systemId) + fSystemId = XMLString::replicate(systemId, memMgr); +} + +XMLDTDDescriptionImpl::~XMLDTDDescriptionImpl() +{ + if (fSystemId) + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fSystemId); + + if (fRootName) + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fRootName); +} + +const XMLCh* XMLDTDDescriptionImpl::getGrammarKey() const +{ + return getSystemId(); +} + +const XMLCh* XMLDTDDescriptionImpl::getRootName() const +{ + return fRootName; +} + +const XMLCh* XMLDTDDescriptionImpl::getSystemId() const +{ + return fSystemId; +} + +void XMLDTDDescriptionImpl::setRootName(const XMLCh* const rootName) +{ + if (fRootName) + { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fRootName); + fRootName = 0; + } + + if (rootName) + fRootName = XMLString::replicate(rootName, XMLGrammarDescription::getMemoryManager()); +} + +void XMLDTDDescriptionImpl::setSystemId(const XMLCh* const systemId) +{ + if (fSystemId) + { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fSystemId); + fSystemId = 0; + } + + if (systemId) + fSystemId = XMLString::replicate(systemId, XMLGrammarDescription::getMemoryManager()); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLDTDDescriptionImpl) + +void XMLDTDDescriptionImpl::serialize(XSerializeEngine& serEng) +{ + XMLDTDDescription::serialize(serEng); + + if (serEng.isStoring()) + { + serEng.writeString(fSystemId); + serEng.writeString(fRootName); + } + else + { + if (fSystemId) + { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fSystemId); + } + + serEng.readString((XMLCh*&)fSystemId); + + //the original root name which came from the ctor needs deallocated + if (fRootName) + { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fRootName); + } + + serEng.readString((XMLCh*&)fRootName); + } + +} + +XMLDTDDescriptionImpl::XMLDTDDescriptionImpl(MemoryManager* const memMgr) +:XMLDTDDescription(memMgr) +,fSystemId(0) +,fRootName(0) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp b/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp new file mode 100644 index 000000000..e065b0fa8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/DTD/XMLDTDDescriptionImpl.hpp @@ -0,0 +1,108 @@ +/* + * 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: XMLDTDDescriptionImpl.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLDTDDESCRIPTIONIMPL_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT XMLDTDDescriptionImpl : public XMLDTDDescription +{ +public : + // ----------------------------------------------------------------------- + /** @name constructor and destructor */ + // ----------------------------------------------------------------------- + //@{ + XMLDTDDescriptionImpl( + const XMLCh* const systemId + , MemoryManager* const memMgr + ); + + ~XMLDTDDescriptionImpl(); + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of GrammarDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * getGrammarKey + * + */ + virtual const XMLCh* getGrammarKey() const ; + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of DTDDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * Getter + * + */ + virtual const XMLCh* getRootName() const; + virtual const XMLCh* getSystemId() const; + + /** + * Setter + * + */ + virtual void setRootName(const XMLCh* const); + virtual void setSystemId(const XMLCh* const); + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLDTDDescriptionImpl) + + XMLDTDDescriptionImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLDTDDescriptionImpl(const XMLDTDDescriptionImpl& ); + XMLDTDDescriptionImpl& operator=(const XMLDTDDescriptionImpl& ); + //@} + + // ----------------------------------------------------------------------- + // + // fSystemId: + // SYSTEM ID of the grammar + // + // fRootName: + // root name of the grammar + // + // ----------------------------------------------------------------------- + + const XMLCh* fSystemId; + const XMLCh* fRootName; + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/AllContentModel.cpp b/project/jni/xerces/src/xercesc/validators/common/AllContentModel.cpp new file mode 100644 index 000000000..fc581bf81 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/AllContentModel.cpp @@ -0,0 +1,378 @@ +/* + * 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: AllContentModel.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// AllContentModel: Constructors and Destructor +// --------------------------------------------------------------------------- +AllContentModel::AllContentModel( ContentSpecNode* const parentContentSpec + , const bool isMixed + , MemoryManager* const manager) : + fMemoryManager(manager) + , fCount(0) + , fChildren(0) + , fChildOptional(0) + , fNumRequired(0) + , fIsMixed(isMixed) + , fHasOptionalContent(false) +{ + // + // Create a vector of unsigned ints that will be filled in with the + // ids of the child nodes. It will be expanded as needed but we give + // it an initial capacity of 64 which should be more than enough for + // 99% of the scenarios. + // + + ValueVectorOf children(64, fMemoryManager); + ValueVectorOf childOptional(64, fMemoryManager); + + // + // Get the parent element's content spec. This is the head of the tree + // of nodes that describes the content model. We will iterate this + // tree. + // + ContentSpecNode* curNode = parentContentSpec; + if (!curNode) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoParentCSN, fMemoryManager); + + // And now call the private recursive method that iterates the tree + if (curNode->getType() == ContentSpecNode::All + && curNode->getMinOccurs() == 0) { + fHasOptionalContent = true; + } + buildChildList(curNode, children, childOptional); + + // + // And now we know how many elements we need in our member list. So + // fill them in. + // + fCount = children.size(); + fChildren = (QName**) fMemoryManager->allocate(fCount * sizeof(QName*)); //new QName*[fCount]; + fChildOptional = (bool*) fMemoryManager->allocate(fCount * sizeof(bool)); //new bool[fCount]; + for (unsigned int index = 0; index < fCount; index++) { + fChildren[index] = new (fMemoryManager) QName(*(children.elementAt(index))); + fChildOptional[index] = childOptional.elementAt(index); + } +} + +AllContentModel::~AllContentModel() +{ + for (XMLSize_t index = 0; index < fCount; index++) + delete fChildren[index]; + fMemoryManager->deallocate(fChildren); //delete [] fChildren; + fMemoryManager->deallocate(fChildOptional); //delete [] fChildOptional; +} + +// --------------------------------------------------------------------------- +// AllContentModel: Implementation of the ContentModel virtual interface +// --------------------------------------------------------------------------- +// +//Under the XML Schema mixed model, +//the order and number of child elements appearing in an instance +//must agree with +//the order and number of child elements specified in the model. +// +bool +AllContentModel::validateContent( QName** const children + , XMLSize_t childCount + , unsigned int + , XMLSize_t* indexFailingChild + , MemoryManager* const manager) const +{ + // If had minOccurs of zero and there are + // no children to validate, trivially validate + if (childCount == 0 && (fHasOptionalContent || !fNumRequired)) + return true; + + // keep track of the required element seen + XMLSize_t numRequiredSeen = 0; + + if(childCount > 0) + { + // Check for duplicate element + bool* elementSeen = (bool*) manager->allocate(fCount*sizeof(bool)); //new bool[fCount]; + + const ArrayJanitor jan(elementSeen, manager); + + // initialize the array + for (XMLSize_t i = 0; i < fCount; i++) + elementSeen[i] = false; + + for (XMLSize_t outIndex = 0; outIndex < childCount; outIndex++) { + // Get the current child out of the source index + const QName* curChild = children[outIndex]; + + // If it's PCDATA, then we just accept that + if (fIsMixed && curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + // And try to find it in our list + XMLSize_t inIndex = 0; + for (; inIndex < fCount; inIndex++) + { + const QName* inChild = fChildren[inIndex]; + if ((inChild->getURI() == curChild->getURI()) && + (XMLString::equals(inChild->getLocalPart(), curChild->getLocalPart()))) { + // found it + // If this element was seen already, indicate an error was + // found at the duplicate index. + if (elementSeen[inIndex]) { + *indexFailingChild=outIndex; + return false; + } + else + elementSeen[inIndex] = true; + + if (!fChildOptional[inIndex]) + numRequiredSeen++; + + break; + } + } + + // We did not find this one, so the validation failed + if (inIndex == fCount) { + *indexFailingChild=outIndex; + return false; + } + + } + } + + // Were all the required elements of the encountered? + if (numRequiredSeen != fNumRequired) { + *indexFailingChild=childCount; + return false; + } + + // Everything seems to be ok, so return success + return true; +} + + +bool AllContentModel::validateContentSpecial(QName** const children + , XMLSize_t childCount + , unsigned int + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager) const +{ + // If had minOccurs of zero and there are + // no children to validate, trivially validate + if (childCount == 0 && (fHasOptionalContent || !fNumRequired)) + return true; + + // keep track of the required element seen + XMLSize_t numRequiredSeen = 0; + + if(childCount > 0) + { + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + // Check for duplicate element + bool* elementSeen = (bool*) manager->allocate(fCount*sizeof(bool)); //new bool[fCount]; + + const ArrayJanitor jan(elementSeen, manager); + + // initialize the array + for (XMLSize_t i = 0; i < fCount; i++) + elementSeen[i] = false; + + for (XMLSize_t outIndex = 0; outIndex < childCount; outIndex++) { + // Get the current child out of the source index + QName* const curChild = children[outIndex]; + + // If it's PCDATA, then we just accept that + if (fIsMixed && curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + // And try to find it in our list + XMLSize_t inIndex = 0; + for (; inIndex < fCount; inIndex++) + { + QName* const inChild = fChildren[inIndex]; + if ( comparator.isEquivalentTo(curChild, inChild)) { + // match + // If this element was seen already, indicate an error was + // found at the duplicate index. + if (elementSeen[inIndex]) { + *indexFailingChild=outIndex; + return false; + } + else + elementSeen[inIndex] = true; + + if (!fChildOptional[inIndex]) + numRequiredSeen++; + + break; + } + } + + // We did not find this one, so the validation failed + if (inIndex == fCount) { + *indexFailingChild=outIndex; + return false; + } + + } + } + + // Were all the required elements of the encountered? + if (numRequiredSeen != fNumRequired) { + *indexFailingChild=childCount; + return false; + } + + // Everything seems to be ok, so return success + return true; + +} + +void AllContentModel::checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName /*= 0*/ + ) +{ + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + XMLSize_t i, j; + + // rename back + for (i = 0; i < fCount; i++) { + unsigned int orgURIIndex = fChildren[i]->getURI(); + fChildren[i]->setURI(pContentSpecOrgURI[orgURIIndex]); + } + + // check whether there is conflict between any two leaves + for (i = 0; i < fCount; i++) { + for (j = i+1; j < fCount; j++) { + // If this is text in a Schema mixed content model, skip it. + if ( fIsMixed && + (( fChildren[i]->getURI() == XMLElementDecl::fgPCDataElemId) || + ( fChildren[j]->getURI() == XMLElementDecl::fgPCDataElemId))) + continue; + + if (XercesElementWildcard::conflict(pGrammar, + ContentSpecNode::Leaf, + fChildren[i], + ContentSpecNode::Leaf, + fChildren[j], + &comparator)) { + pValidator->emitError(XMLValid::UniqueParticleAttributionFail, + pComplexTypeName, + fChildren[i]->getRawName(), + fChildren[j]->getRawName()); + } + } + } +} + +// --------------------------------------------------------------------------- +// AllContentModel: Private helper methods +// --------------------------------------------------------------------------- +void +AllContentModel::buildChildList(ContentSpecNode* const curNode + , ValueVectorOf& toFill + , ValueVectorOf& toOptional) +{ + // Get the type of spec node our current node is + const ContentSpecNode::NodeTypes curType = curNode->getType(); + + if (curType == ContentSpecNode::All) + { + // Get both the child node pointers + ContentSpecNode* leftNode = curNode->getFirst(); + ContentSpecNode* rightNode = curNode->getSecond(); + + // Recurse on the left and right nodes + buildChildList(leftNode, toFill, toOptional); + if(rightNode) + buildChildList(rightNode, toFill, toOptional); + } + else if (curType == ContentSpecNode::Leaf) + { + // At leaf, add the element to list of elements permitted in the all + toFill.addElement(curNode->getElement()); + toOptional.addElement(false); + fNumRequired++; + } + else if (curType == ContentSpecNode::ZeroOrOne) + { + // At ZERO_OR_ONE node, subtree must be an element + // that was specified with minOccurs=0, maxOccurs=1 + ContentSpecNode* leftNode = curNode->getFirst(); + if (leftNode->getType() != ContentSpecNode::Leaf) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + + toFill.addElement(leftNode->getElement()); + toOptional.addElement(true); + } + // only allow ZeroOrMore when it's the father of a Loop + else if (curType == ContentSpecNode::ZeroOrMore && + curNode->getFirst()!=0 && + curNode->getFirst()->getType()==ContentSpecNode::Loop) + { + ContentSpecNode* leftNode = curNode->getFirst(); + buildChildList(leftNode, toFill, toOptional); + } + else if (curType == ContentSpecNode::Loop) + { + // At leaf, add the element to list of elements permitted in the all + int i; + for(i=0;igetMinOccurs();i++) + { + toFill.addElement(curNode->getElement()); + toOptional.addElement(false); + fNumRequired++; + } + if(curNode->getMaxOccurs()!=-1) + for(i=0;i<(curNode->getMaxOccurs() - curNode->getMinOccurs());i++) + { + toFill.addElement(curNode->getElement()); + toOptional.addElement(true); + } + } + else + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/AllContentModel.hpp b/project/jni/xerces/src/xercesc/validators/common/AllContentModel.hpp new file mode 100644 index 000000000..9ec5e023a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/AllContentModel.hpp @@ -0,0 +1,177 @@ +/* + * 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: AllContentModel.hpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ALLCONTENTMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_ALLCONTENTMODEL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; + +// +// AllContentModel is a derivative of the abstract content model base +// class that handles the special case of feature in schema. If a model +// is , all non-optional children must appear +// +// So, all we have to do is to keep an array of the possible children and +// validate by just looking up each child being validated by looking it up +// in the list, and make sure all non-optional children appear. +// +class AllContentModel : public XMLContentModel +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + AllContentModel + ( + ContentSpecNode* const parentContentSpec + , const bool isMixed + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~AllContentModel(); + + // ----------------------------------------------------------------------- + // Implementation of the ContentModel virtual interface + // ----------------------------------------------------------------------- + virtual bool validateContent + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual bool validateContentSpecial + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ; + + virtual unsigned int getNextState(unsigned int currentState, + XMLSize_t elementIndex) const; + + virtual bool handleRepetitions( const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elementIndex, + SubstitutionGroupComparator * comparator) const; + + virtual void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName = 0 + ) ; + +private : + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void buildChildList + ( + ContentSpecNode* const curNode + , ValueVectorOf& toFill + , ValueVectorOf& toType + ); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AllContentModel(); + AllContentModel(const AllContentModel&); + AllContentModel& operator=(const AllContentModel&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fCount + // The count of possible children in the fChildren member. + // + // fChildren + // The list of possible children that we have to accept. This array + // is allocated as large as needed in the constructor. + // + // fChildOptional + // The corresponding list of optional state of each child in fChildren + // True if the child is optional (i.e. minOccurs = 0). + // + // fNumRequired + // The number of required children in (i.e. minOccurs = 1) + // + // fIsMixed + // AllContentModel with mixed PCDATA. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + XMLSize_t fCount; + QName** fChildren; + bool* fChildOptional; + unsigned int fNumRequired; + bool fIsMixed; + bool fHasOptionalContent; +}; + +inline ContentLeafNameTypeVector* AllContentModel::getContentLeafNameTypeVector() const +{ + return 0; +} + +inline unsigned int +AllContentModel::getNextState(unsigned int, + XMLSize_t) const { + + return XMLContentModel::gInvalidTrans; +} + +inline bool +AllContentModel::handleRepetitions( const QName* const /*curElem*/, + unsigned int /*curState*/, + unsigned int /*currentLoop*/, + unsigned int& /*nextState*/, + unsigned int& /*nextLoop*/, + XMLSize_t /*elementIndex*/, + SubstitutionGroupComparator * /*comparator*/) const +{ + return true; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMAny.cpp b/project/jni/xerces/src/xercesc/validators/common/CMAny.cpp new file mode 100644 index 000000000..535fe86c6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMAny.cpp @@ -0,0 +1,110 @@ +/* + * 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: CMAny.cpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// CMUnaryOp: Constructors and Destructor +// --------------------------------------------------------------------------- +CMAny::CMAny( ContentSpecNode::NodeTypes type + , unsigned int URI + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager) : + CMNode(type, maxStates, manager) + , fURI(URI) + , fPosition(position) +{ + if ((type & 0x0f) != ContentSpecNode::Any + && (type & 0x0f) != ContentSpecNode::Any_Other + && (type & 0x0f) != ContentSpecNode::Any_NS) + { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::CM_NotValidSpecTypeForNode, + "CMAny", manager); + } + // Leaf nodes are never nullable unless its an epsilon node + fIsNullable=(fPosition == epsilonNode); +} + +CMAny::~CMAny() +{ +} + +// --------------------------------------------------------------------------- +// Getter methods +// --------------------------------------------------------------------------- +unsigned int CMAny::getURI() const +{ + return fURI; +} + +unsigned int CMAny::getPosition() const +{ + return fPosition; +} + +// --------------------------------------------------------------------------- +// Setter methods +// --------------------------------------------------------------------------- +void CMAny::setPosition(const unsigned int newPosition) +{ + fPosition = newPosition; +} + +// --------------------------------------------------------------------------- +// Implementation of public CMNode virtual interface +// --------------------------------------------------------------------------- +void CMAny::orphanChild() +{ +} + +// --------------------------------------------------------------------------- +// Implementation of protected CMNode virtual interface +// --------------------------------------------------------------------------- +void CMAny::calcFirstPos(CMStateSet& toSet) const +{ + // If we are an epsilon node, then the first pos is an empty set + if (isNullable()) + toSet.zeroBits(); + else + // Otherwise, its just the one bit of our position + toSet.setBit(fPosition); +} + +void CMAny::calcLastPos(CMStateSet& toSet) const +{ + // If we are an epsilon node, then the last pos is an empty set + if (isNullable()) + toSet.zeroBits(); + // Otherwise, its just the one bit of our position + else + toSet.setBit(fPosition); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/CMAny.hpp b/project/jni/xerces/src/xercesc/validators/common/CMAny.hpp new file mode 100644 index 000000000..d9a38e7ea --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMAny.hpp @@ -0,0 +1,99 @@ +/* + * 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: CMAny.hpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMANY_HPP) +#define XERCESC_INCLUDE_GUARD_CMANY_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CMStateSet; + +class CMAny : public CMNode +{ +public : + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + CMAny + ( + ContentSpecNode::NodeTypes type + , unsigned int URI + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~CMAny(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + unsigned int getURI() const; + + unsigned int getPosition() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setPosition(const unsigned int newPosition); + + // ----------------------------------------------------------------------- + // Implementation of the public CMNode virtual interface + // ----------------------------------------------------------------------- + virtual void orphanChild(); + + +protected : + // ----------------------------------------------------------------------- + // Implementation of the protected CMNode virtual interface + // ----------------------------------------------------------------------- + void calcFirstPos(CMStateSet& toSet) const; + void calcLastPos(CMStateSet& toSet) const; + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fURI; + // URI of the any content model. This value is set if the type is + // of the following: + // XMLContentSpec.CONTENTSPECNODE_ANY, + // XMLContentSpec.CONTENTSPECNODE_ANY_OTHER. + // + // fPosition + // Part of the algorithm to convert a regex directly to a DFA + // numbers each leaf sequentially. If its -1, that means its an + // epsilon node. Zero and greater are non-epsilon positions. + // ----------------------------------------------------------------------- + unsigned int fURI; + unsigned int fPosition; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMAny(const CMAny&); + CMAny& operator=(const CMAny&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.cpp b/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.cpp new file mode 100644 index 000000000..6d89eaf3d --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.cpp @@ -0,0 +1,150 @@ +/* + * 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: CMBinaryOp.cpp 677396 2008-07-16 19:36:20Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// CMBinaryOp: Constructors +// --------------------------------------------------------------------------- +CMBinaryOp::CMBinaryOp( ContentSpecNode::NodeTypes type + , CMNode* const leftToAdopt + , CMNode* const rightToAdopt + , unsigned int maxStates + , MemoryManager* const manager) : + CMNode(type, maxStates, manager) + , fLeftChild(leftToAdopt) + , fRightChild(rightToAdopt) +{ + // Insure that its one of the types we require + if (((type & 0x0f) != ContentSpecNode::Choice) + && ((type & 0x0f) != ContentSpecNode::Sequence)) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_BinOpHadUnaryType, manager); + } + // + // If its an alternation, then if either child is nullable then + // this node is nullable. If its a concatenation, then both of + // them have to be nullable. + // + if ((type & 0x0f) == ContentSpecNode::Choice) + fIsNullable=(fLeftChild->isNullable() || fRightChild->isNullable()); + else + fIsNullable=(fLeftChild->isNullable() && fRightChild->isNullable()); +} + +CMBinaryOp::~CMBinaryOp() +{ + delete fLeftChild; + delete fRightChild; +} + + +// --------------------------------------------------------------------------- +// CMBinaryOp: Getter methods +// --------------------------------------------------------------------------- +const CMNode* CMBinaryOp::getLeft() const +{ + return fLeftChild; +} + +CMNode* CMBinaryOp::getLeft() +{ + return fLeftChild; +} + +const CMNode* CMBinaryOp::getRight() const +{ + return fRightChild; +} + +CMNode* CMBinaryOp::getRight() +{ + return fRightChild; +} + + +// --------------------------------------------------------------------------- +// CMBinaryOp: Implementation of the public CMNode virtual interface +// --------------------------------------------------------------------------- +void CMBinaryOp::orphanChild() +{ + delete fLeftChild; + fLeftChild=0; + delete fRightChild; + fRightChild=0; +} + +// --------------------------------------------------------------------------- +// CMBinaryOp: Implementation of the protected CMNode virtual interface +// --------------------------------------------------------------------------- +void CMBinaryOp::calcFirstPos(CMStateSet& toSet) const +{ + if ((getType() & 0x0f) == ContentSpecNode::Choice) + { + // Its the the union of the first positions of our children. + toSet = fLeftChild->getFirstPos(); + toSet |= fRightChild->getFirstPos(); + } + else if ((getType() & 0x0f) == ContentSpecNode::Sequence) + { + // + // If our left child is nullable, then its the union of our + // children's first positions. Else is our left child's first + // positions. + // + toSet = fLeftChild->getFirstPos(); + if (fLeftChild->isNullable()) + toSet |= fRightChild->getFirstPos(); + } +} + +void CMBinaryOp::calcLastPos(CMStateSet& toSet) const +{ + if ((getType() & 0x0f) == ContentSpecNode::Choice) + { + // Its the the union of the first positions of our children. + toSet = fLeftChild->getLastPos(); + toSet |= fRightChild->getLastPos(); + } + else if ((getType() & 0x0f) == ContentSpecNode::Sequence) + { + // + // If our right child is nullable, then its the union of our + // children's last positions. Else is our right child's last + // positions. + // + toSet = fRightChild->getLastPos(); + if (fRightChild->isNullable()) + toSet |= fLeftChild->getLastPos(); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.hpp b/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.hpp new file mode 100644 index 000000000..63318232e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMBinaryOp.hpp @@ -0,0 +1,92 @@ +/* + * 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: CMBinaryOp.hpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMBINARYOP_HPP) +#define XERCESC_INCLUDE_GUARD_CMBINARYOP_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CMStateSet; + +class CMBinaryOp : public CMNode +{ +public : + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + CMBinaryOp + ( + ContentSpecNode::NodeTypes type + , CMNode* const leftToAdopt + , CMNode* const rightToAdopt + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~CMBinaryOp(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const CMNode* getLeft() const; + CMNode* getLeft(); + const CMNode* getRight() const; + CMNode* getRight(); + + + // ----------------------------------------------------------------------- + // Implementation of the public CMNode virtual interface + // ----------------------------------------------------------------------- + virtual void orphanChild(); + + +protected : + // ----------------------------------------------------------------------- + // Implementation of the protected CMNode virtual interface + // ----------------------------------------------------------------------- + void calcFirstPos(CMStateSet& toSet) const; + void calcLastPos(CMStateSet& toSet) const; + + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fLeftChild + // fRightChild + // These are the references to the two nodes that are on either side + // of this binary operation. We own them both. + // ----------------------------------------------------------------------- + CMNode* fLeftChild; + CMNode* fRightChild; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMBinaryOp(const CMBinaryOp&); + CMBinaryOp& operator=(const CMBinaryOp&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMLeaf.hpp b/project/jni/xerces/src/xercesc/validators/common/CMLeaf.hpp new file mode 100644 index 000000000..e3c496901 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMLeaf.hpp @@ -0,0 +1,253 @@ +/* + * 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: CMLeaf.hpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMLEAF_HPP) +#define XERCESC_INCLUDE_GUARD_CMLEAF_HPP + +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class represents a leaf in the content spec node tree of an +// element's content model. It just has an element qname and a position value, +// the latter of which is used during the building of a DFA. +// +class CMLeaf : public CMNode +{ +public : + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + CMLeaf + ( + QName* const element + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + CMLeaf + ( + QName* const element + , unsigned int position + , bool adopt + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~CMLeaf(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + QName* getElement(); + const QName* getElement() const; + unsigned int getPosition() const; + + virtual bool isRepeatableLeaf() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setPosition(const unsigned int newPosition); + + + // ----------------------------------------------------------------------- + // Implementation of public CMNode virtual interface + // ----------------------------------------------------------------------- + virtual void orphanChild(); + +protected : + // ----------------------------------------------------------------------- + // Implementation of protected CMNode virtual interface + // ----------------------------------------------------------------------- + void calcFirstPos(CMStateSet& toSet) const; + void calcLastPos(CMStateSet& toSet) const; + + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fElement + // This is the element that this leaf represents. + // + // fPosition + // Part of the algorithm to convert a regex directly to a DFA + // numbers each leaf sequentially. If its -1, that means its an + // epsilon node. All others are non-epsilon positions. + // + // fAdopt + // This node is responsible for the storage of the fElement QName. + // ----------------------------------------------------------------------- + QName* fElement; + unsigned int fPosition; + bool fAdopt; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMLeaf(const CMLeaf&); + CMLeaf& operator=(const CMLeaf&); +}; + + +// ----------------------------------------------------------------------- +// Constructors +// ----------------------------------------------------------------------- +inline CMLeaf::CMLeaf( QName* const element + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager) : + CMNode(ContentSpecNode::Leaf, maxStates, manager) + , fElement(0) + , fPosition(position) + , fAdopt(false) +{ + if (!element) + { + fElement = new (fMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , XMLElementDecl::fgInvalidElemId + , fMemoryManager + ); + // We have to be responsible for this QName - override default fAdopt + fAdopt = true; + } + else + { + fElement = element; + } + // Leaf nodes are never nullable unless its an epsilon node + fIsNullable=(fPosition == epsilonNode); +} + +inline CMLeaf::CMLeaf( QName* const element + , unsigned int position + , bool adopt + , unsigned int maxStates + , MemoryManager* const manager) : + CMNode(ContentSpecNode::Leaf, maxStates, manager) + , fElement(0) + , fPosition(position) + , fAdopt(adopt) +{ + if (!element) + { + fElement = new (fMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , XMLElementDecl::fgInvalidElemId + , fMemoryManager + ); + // We have to be responsible for this QName - override adopt parameter + fAdopt = true; + } + else + { + fElement = element; + } + // Leaf nodes are never nullable unless its an epsilon node + fIsNullable=(fPosition == epsilonNode); +} + +inline CMLeaf::~CMLeaf() +{ + if (fAdopt) + delete fElement; +} + + +// --------------------------------------------------------------------------- +// Getter methods +// --------------------------------------------------------------------------- +inline QName* CMLeaf::getElement() +{ + return fElement; +} + +inline const QName* CMLeaf::getElement() const +{ + return fElement; +} + +inline unsigned int CMLeaf::getPosition() const +{ + return fPosition; +} + +inline bool CMLeaf::isRepeatableLeaf() const +{ + return false; +} + +// --------------------------------------------------------------------------- +// Setter methods +// --------------------------------------------------------------------------- +inline void CMLeaf::setPosition(const unsigned int newPosition) +{ + fPosition = newPosition; +} + + +// --------------------------------------------------------------------------- +// Implementation of public CMNode virtual interface +// --------------------------------------------------------------------------- +inline void CMLeaf::orphanChild() +{ +} + +// --------------------------------------------------------------------------- +// Implementation of protected CMNode virtual interface +// --------------------------------------------------------------------------- +inline void CMLeaf::calcFirstPos(CMStateSet& toSet) const +{ + // If we are an epsilon node, then the first pos is an empty set + if (isNullable()) + { + toSet.zeroBits(); + return; + } + + // Otherwise, its just the one bit of our position + toSet.setBit(fPosition); +} + +inline void CMLeaf::calcLastPos(CMStateSet& toSet) const +{ + // If we are an epsilon node, then the last pos is an empty set + if (isNullable()) + { + toSet.zeroBits(); + return; + } + + // Otherwise, its just the one bit of our position + toSet.setBit(fPosition); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMNode.hpp b/project/jni/xerces/src/xercesc/validators/common/CMNode.hpp new file mode 100644 index 000000000..6373a0c8a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMNode.hpp @@ -0,0 +1,193 @@ +/* + * 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: CMNode.hpp 677430 2008-07-16 21:05:31Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMNODE_HPP) +#define XERCESC_INCLUDE_GUARD_CMNODE_HPP + +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class CMNode : public XMemory +{ +public : + enum { + // Special value to indicate a nullable node + epsilonNode = UINT_MAX - 1 + }; + + // ----------------------------------------------------------------------- + // Constructors and Destructors + // ----------------------------------------------------------------------- + CMNode + ( + const ContentSpecNode::NodeTypes type + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~CMNode(); + + + // ----------------------------------------------------------------------- + // Virtual methods to be provided derived node classes + // ----------------------------------------------------------------------- + virtual void orphanChild() = 0; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + ContentSpecNode::NodeTypes getType() const; + const CMStateSet& getFirstPos(); + const CMStateSet& getLastPos(); + bool isNullable() const; + +protected : + // ----------------------------------------------------------------------- + // Protected, abstract methods + // ----------------------------------------------------------------------- + virtual void calcFirstPos(CMStateSet& toUpdate) const = 0; + virtual void calcLastPos(CMStateSet& toUpdate) const = 0; + + // ----------------------------------------------------------------------- + // Protected data members + // + // fMemoryManager + // Pluggable memory manager for dynamic allocation/deallocation. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMNode(); + CMNode(const CMNode&); + CMNode& operator=(const CMNode&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fType + // The type of node. This indicates whether its a leaf or an + // operation. + // + // fFirstPos + // The set of NFA states that represent the entry states of this + // node in the DFA. + // + // fLastPos + // The set of NFA states that represent the final states of this + // node in the DFA. + // + // fMaxStates + // The maximum number of states that the NFA has, which means the + // max number of NFA states that have to be traced in the state + // sets during the building of the DFA. Its unfortunate that it + // has to be stored redundantly, but we need to fault in the + // state set members and they have to be sized to this size. + // + // fIsNullable + // Whether the node can be empty + // ----------------------------------------------------------------------- + ContentSpecNode::NodeTypes fType; + CMStateSet* fFirstPos; + CMStateSet* fLastPos; + unsigned int fMaxStates; + +protected: + bool fIsNullable; +}; + + + +// --------------------------------------------------------------------------- +// CMNode: Constructors and Destructors +// --------------------------------------------------------------------------- +inline CMNode::CMNode(const ContentSpecNode::NodeTypes type + , unsigned int maxStates + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fType(type) + , fFirstPos(0) + , fLastPos(0) + , fMaxStates(maxStates) + , fIsNullable(false) +{ +} + +inline CMNode::~CMNode() +{ + // Clean up any position sets that got created + delete fFirstPos; + delete fLastPos; +} + + +// --------------------------------------------------------------------------- +// CMNode: Getter methods +// --------------------------------------------------------------------------- +inline ContentSpecNode::NodeTypes CMNode::getType() const +{ + return fType; +} + +inline const CMStateSet& CMNode::getFirstPos() +{ + // + // Fault in the state set if needed. Since we can't use mutable members + // cast off the const'ness. + // + if (!fFirstPos) + { + fFirstPos = new (fMemoryManager) CMStateSet(fMaxStates, fMemoryManager); + calcFirstPos(*fFirstPos); + } + return *fFirstPos; +} + +inline const CMStateSet& CMNode::getLastPos() +{ + // + // Fault in the state set if needed. Since we can't use mutable members + // cast off the const'ness. + // + if (!fLastPos) + { + fLastPos = new (fMemoryManager) CMStateSet(fMaxStates, fMemoryManager); + calcLastPos(*fLastPos); + } + return *fLastPos; +} + +inline bool CMNode::isNullable() const +{ + return fIsNullable; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMRepeatingLeaf.hpp b/project/jni/xerces/src/xercesc/validators/common/CMRepeatingLeaf.hpp new file mode 100644 index 000000000..7fbd58e58 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMRepeatingLeaf.hpp @@ -0,0 +1,136 @@ +/* + * 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: CMRepeatingLeaf.hpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMREPEATINGLEAF_HPP) +#define XERCESC_INCLUDE_GUARD_CMREPEATINGLEAF_HPP + +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +// +// A compound content model leaf node which carries occurence information. +// +class CMRepeatingLeaf : public CMLeaf +{ +public : + // ----------------------------------------------------------------------- + // Constructors + // ----------------------------------------------------------------------- + CMRepeatingLeaf + ( + QName* const element + , int minOccurs + , int maxOccurs + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + CMRepeatingLeaf + ( + QName* const element + , int minOccurs + , int maxOccurs + , unsigned int position + , bool adopt + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + int getMinOccurs() const; + int getMaxOccurs() const; + + virtual bool isRepeatableLeaf() const; + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fMinOccurs + // fMaxOccurs + // The cardinality of the repeating leaf + // + // ----------------------------------------------------------------------- + int fMinOccurs; + int fMaxOccurs; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMRepeatingLeaf(const CMRepeatingLeaf&); + CMRepeatingLeaf& operator=(const CMRepeatingLeaf&); +}; + + +// ----------------------------------------------------------------------- +// Constructors +// ----------------------------------------------------------------------- +inline CMRepeatingLeaf::CMRepeatingLeaf( QName* const element + , int minOccurs + , int maxOccurs + , unsigned int position + , unsigned int maxStates + , MemoryManager* const manager) : + CMLeaf(element, position, maxStates, manager) + , fMinOccurs(minOccurs) + , fMaxOccurs(maxOccurs) +{ +} + +inline CMRepeatingLeaf::CMRepeatingLeaf( QName* const element + , int minOccurs + , int maxOccurs + , unsigned int position + , bool adopt + , unsigned int maxStates + , MemoryManager* const manager) : + CMLeaf(element, position, adopt, maxStates, manager) + , fMinOccurs(minOccurs) + , fMaxOccurs(maxOccurs) +{ +} + +// --------------------------------------------------------------------------- +// Getter methods +// --------------------------------------------------------------------------- +inline int CMRepeatingLeaf::getMinOccurs() const +{ + return fMinOccurs; +} + +inline int CMRepeatingLeaf::getMaxOccurs() const +{ + return fMaxOccurs; +} + +inline bool CMRepeatingLeaf::isRepeatableLeaf() const +{ + return true; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMStateSet.hpp b/project/jni/xerces/src/xercesc/validators/common/CMStateSet.hpp new file mode 100644 index 000000000..30ef98f56 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMStateSet.hpp @@ -0,0 +1,627 @@ +/* + * 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: CMStateSet.hpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMSTATESET_HPP) +#define XERCESC_INCLUDE_GUARD_CMSTATESET_HPP + +// DESCRIPTION: +// +// This class is a specialized bitset class for the content model code of +// the validator. It assumes that its never called with two objects of +// different bit counts, and that bit sets smaller than a threshold are far +// and away the most common. So it can be a lot more optimized than a general +// purpose utility bitset class +// + +#include +#include +#include +#include +#include + +#if XERCES_HAVE_EMMINTRIN_H +# include +#endif + +XERCES_CPP_NAMESPACE_BEGIN + +class CMStateSetEnumerator; + +// This value must be 4 in order to use the SSE2 instruction set +#define CMSTATE_CACHED_INT32_SIZE 4 + +// This value must be a multiple of 128 in order to use the SSE2 instruction set +#define CMSTATE_BITFIELD_CHUNK 1024 +#define CMSTATE_BITFIELD_INT32_SIZE (1024 / 32) + +struct CMDynamicBuffer +{ + // fArraySize + // This indicates the number of elements of the fBitArray vector + // + // fBitArray + // A vector of arrays of XMLInt32; each array is allocated on demand + // if a bit needs to be set in that range + // + // fMemoryManager + // The memory manager used to allocate and deallocate memory + // + XMLSize_t fArraySize; + XMLInt32** fBitArray; + MemoryManager* fMemoryManager; +}; + +class CMStateSet : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + CMStateSet( const XMLSize_t bitCount + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : + + fBitCount(bitCount) + , fDynamicBuffer(0) + { + // + // See if we need to allocate the byte array or whether we can live + // within the cached bit high performance scheme. + // + if (fBitCount > (CMSTATE_CACHED_INT32_SIZE * 32)) + { + fDynamicBuffer = (CMDynamicBuffer*)manager->allocate(sizeof(CMDynamicBuffer)); + fDynamicBuffer->fMemoryManager = manager; + // allocate an array of vectors, each one containing CMSTATE_BITFIELD_CHUNK bits + fDynamicBuffer->fArraySize = fBitCount / CMSTATE_BITFIELD_CHUNK; + if (fBitCount % CMSTATE_BITFIELD_CHUNK) + fDynamicBuffer->fArraySize++; + fDynamicBuffer->fBitArray = (XMLInt32**) fDynamicBuffer->fMemoryManager->allocate(fDynamicBuffer->fArraySize*sizeof(XMLInt32*)); + for(XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + fDynamicBuffer->fBitArray[index]=NULL; + } + else + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + fBits[index] = 0; + } + } + + CMStateSet(const CMStateSet& toCopy) : + XMemory(toCopy) + , fBitCount(toCopy.fBitCount) + , fDynamicBuffer(0) + { + // + // See if we need to allocate the byte array or whether we can live + // within the cahced bit high performance scheme. + // + if (fBitCount > (CMSTATE_CACHED_INT32_SIZE * 32)) + { + fDynamicBuffer = (CMDynamicBuffer*) toCopy.fDynamicBuffer->fMemoryManager->allocate(sizeof(CMDynamicBuffer)); + fDynamicBuffer->fMemoryManager = toCopy.fDynamicBuffer->fMemoryManager; + fDynamicBuffer->fArraySize = fBitCount / CMSTATE_BITFIELD_CHUNK; + if (fBitCount % CMSTATE_BITFIELD_CHUNK) + fDynamicBuffer->fArraySize++; + fDynamicBuffer->fBitArray = (XMLInt32**) fDynamicBuffer->fMemoryManager->allocate(fDynamicBuffer->fArraySize*sizeof(XMLInt32*)); + for(XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + { + if(toCopy.fDynamicBuffer->fBitArray[index]!=NULL) + { + allocateChunk(index); + memcpy((void *) fDynamicBuffer->fBitArray[index], + (const void *) toCopy.fDynamicBuffer->fBitArray[index], + CMSTATE_BITFIELD_INT32_SIZE * sizeof(XMLInt32)); + } + else + fDynamicBuffer->fBitArray[index]=NULL; + } + } + else + { + memcpy((void *) fBits, + (const void *) toCopy.fBits, + CMSTATE_CACHED_INT32_SIZE * sizeof(XMLInt32)); + } + } + + ~CMStateSet() + { + if(fDynamicBuffer) + { + for(XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + if(fDynamicBuffer->fBitArray[index]!=NULL) + deallocateChunk(index); + fDynamicBuffer->fMemoryManager->deallocate(fDynamicBuffer->fBitArray); + fDynamicBuffer->fMemoryManager->deallocate(fDynamicBuffer); + } + } + + + // ----------------------------------------------------------------------- + // Set manipulation methods + // ----------------------------------------------------------------------- + void operator|=(const CMStateSet& setToOr) + { + if(fDynamicBuffer==0) + { +#ifdef XERCES_HAVE_SSE2_INTRINSIC + if(XMLPlatformUtils::fgSSE2ok) + { + __m128i xmm1 = _mm_loadu_si128((__m128i*)fBits); + __m128i xmm2 = _mm_loadu_si128((__m128i*)setToOr.fBits); + __m128i xmm3 = _mm_or_si128(xmm1, xmm2); // OR 4 32-bit words + _mm_storeu_si128((__m128i*)fBits, xmm3); + } + else +#endif + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + if(setToOr.fBits[index]) + { + if(fBits[index]) + fBits[index] |= setToOr.fBits[index]; + else + fBits[index] = setToOr.fBits[index]; + } + } + } + else + { + for (XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + { + XMLInt32 *& other = setToOr.fDynamicBuffer->fBitArray[index]; + if(other!=NULL) + { + // if we haven't allocated the subvector yet, allocate it and copy + if(fDynamicBuffer->fBitArray[index]==NULL) + { + allocateChunk(index); + memcpy((void *) fDynamicBuffer->fBitArray[index], + (const void *) other, + CMSTATE_BITFIELD_INT32_SIZE * sizeof(XMLInt32)); + } + else + { + // otherwise, merge them + XMLInt32*& mine = fDynamicBuffer->fBitArray[index]; +#ifdef XERCES_HAVE_SSE2_INTRINSIC + if(XMLPlatformUtils::fgSSE2ok) + { + for(XMLSize_t subIndex = 0; subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex+=4) + { + __m128i xmm1 = _mm_load_si128((__m128i*)&other[subIndex]); + __m128i xmm2 = _mm_load_si128((__m128i*)&mine[subIndex]); + __m128i xmm3 = _mm_or_si128(xmm1, xmm2); // OR 4 32-bit words + _mm_store_si128((__m128i*)&mine[subIndex], xmm3); + } + } + else +#endif + { + for(XMLSize_t subIndex = 0; subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + if(setToOr.fDynamicBuffer->fBitArray[index][subIndex]) + { + if(fDynamicBuffer->fBitArray[index][subIndex]) + fDynamicBuffer->fBitArray[index][subIndex] |= setToOr.fDynamicBuffer->fBitArray[index][subIndex]; + else + fDynamicBuffer->fBitArray[index][subIndex] = setToOr.fDynamicBuffer->fBitArray[index][subIndex]; + } + } + } + } + } + } + } + + bool operator==(const CMStateSet& setToCompare) const + { + if (fBitCount != setToCompare.fBitCount) + return false; + + if(fDynamicBuffer==0) + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + { + if (fBits[index] != setToCompare.fBits[index]) + return false; + } + } + else + { + for (XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + { + XMLInt32 *& other = setToCompare.fDynamicBuffer->fBitArray[index], + *& mine = fDynamicBuffer->fBitArray[index]; + if(mine==NULL && other==NULL) + continue; + else if(mine==NULL || other==NULL) // the other should have been empty too + return false; + else + { + for(XMLSize_t subIndex = 0; subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + if(mine[subIndex]!=other[subIndex]) + return false; + } + } + } + return true; + } + + CMStateSet& operator=(const CMStateSet& srcSet) + { + if (this == &srcSet) + return *this; + + // They have to be the same size + if (fBitCount != srcSet.fBitCount) + { + if(fDynamicBuffer) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Bitset_NotEqualSize, fDynamicBuffer->fMemoryManager); + else + ThrowXML(RuntimeException, XMLExcepts::Bitset_NotEqualSize); + } + + if(fDynamicBuffer==0) + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + fBits[index] = srcSet.fBits[index]; + } + else + { + for (XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + if(srcSet.fDynamicBuffer->fBitArray[index]==NULL) + { + // delete this subentry + if(fDynamicBuffer->fBitArray[index]!=NULL) + deallocateChunk(index); + } + else + { + // if we haven't allocated the subvector yet, allocate it and copy + if(fDynamicBuffer->fBitArray[index]==NULL) + allocateChunk(index); + memcpy((void *) fDynamicBuffer->fBitArray[index], + (const void *) srcSet.fDynamicBuffer->fBitArray[index], + CMSTATE_BITFIELD_INT32_SIZE * sizeof(XMLInt32)); + } + } + return *this; + } + + XMLSize_t getBitCountInRange(XMLSize_t start, XMLSize_t end) const + { + XMLSize_t count = 0; + end /= 32; + if(fDynamicBuffer==0) + { + if(end > CMSTATE_CACHED_INT32_SIZE) + end = CMSTATE_CACHED_INT32_SIZE; + for (XMLSize_t index = start / 32; index < end; index++) + { + if (fBits[index] != 0) + for(int i=0;i<32;i++) + { + const XMLInt32 mask = 1UL << i; + if(fBits[index] & mask) + count++; + } + } + } + else + { + if(end > fDynamicBuffer->fArraySize) + end = fDynamicBuffer->fArraySize; + for (XMLSize_t index = start / 32; index < end; index++) + { + if(fDynamicBuffer->fBitArray[index]==NULL) + continue; + for(XMLSize_t subIndex=0;subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + { + if (fDynamicBuffer->fBitArray[index][subIndex] != 0) + for(int i=0;i<32;i++) + { + const XMLInt32 mask = 1UL << i; + if(fDynamicBuffer->fBitArray[index][subIndex] & mask) + count++; + } + } + } + } + return count; + } + + bool getBit(const XMLSize_t bitToGet) const + { + if (bitToGet >= fBitCount) + { + if(fDynamicBuffer) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Bitset_BadIndex, fDynamicBuffer->fMemoryManager); + else + ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Bitset_BadIndex); + } + + // And access the right bit and byte + if(fDynamicBuffer==0) + { + const XMLInt32 mask = 1UL << (bitToGet % 32); + const XMLSize_t byteOfs = bitToGet / 32; + return (fBits[byteOfs]!=0 && (fBits[byteOfs] & mask) != 0); + } + else + { + const XMLSize_t vectorOfs = bitToGet / CMSTATE_BITFIELD_CHUNK; + if(fDynamicBuffer->fBitArray[vectorOfs]==NULL) + return false; + const XMLInt32 mask = 1UL << (bitToGet % 32); + const XMLSize_t byteOfs = (bitToGet % CMSTATE_BITFIELD_CHUNK) / 32; + return (fDynamicBuffer->fBitArray[vectorOfs][byteOfs]!=0 && (fDynamicBuffer->fBitArray[vectorOfs][byteOfs] & mask) != 0); + } + } + + bool isEmpty() const + { + if(fDynamicBuffer==0) + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + { + if (fBits[index] != 0) + return false; + } + } + else + { + for (XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + { + if(fDynamicBuffer->fBitArray[index]==NULL) + continue; + for(XMLSize_t subIndex=0;subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + { + if (fDynamicBuffer->fBitArray[index][subIndex] != 0) + return false; + } + } + } + return true; + } + + void setBit(const XMLSize_t bitToSet) + { + if (bitToSet >= fBitCount) + { + if(fDynamicBuffer) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Bitset_BadIndex, fDynamicBuffer->fMemoryManager); + else + ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Bitset_BadIndex); + } + + const XMLInt32 mask = 1UL << (bitToSet % 32); + + // And access the right bit and byte + if(fDynamicBuffer==0) + { + const XMLSize_t byteOfs = bitToSet / 32; + fBits[byteOfs] &= ~mask; + fBits[byteOfs] |= mask; + } + else + { + const XMLSize_t vectorOfs = bitToSet / CMSTATE_BITFIELD_CHUNK; + if(fDynamicBuffer->fBitArray[vectorOfs]==NULL) + { + allocateChunk(vectorOfs); + for(XMLSize_t index=0;index < CMSTATE_BITFIELD_INT32_SIZE; index++) + fDynamicBuffer->fBitArray[vectorOfs][index]=0; + } + const XMLSize_t byteOfs = (bitToSet % CMSTATE_BITFIELD_CHUNK) / 32; + fDynamicBuffer->fBitArray[vectorOfs][byteOfs] &= ~mask; + fDynamicBuffer->fBitArray[vectorOfs][byteOfs] |= mask; + } + } + + void zeroBits() + { + if(fDynamicBuffer==0) + { + for (XMLSize_t index = 0; index < CMSTATE_CACHED_INT32_SIZE; index++) + fBits[index] = 0; + } + else + { + for (XMLSize_t index = 0; index < fDynamicBuffer->fArraySize; index++) + // delete this subentry + if(fDynamicBuffer->fBitArray[index]!=NULL) + deallocateChunk(index); + } + } + + XMLSize_t hashCode() const + { + XMLSize_t hash = 0; + if(fDynamicBuffer==0) + { + for (XMLSize_t index = 0; indexfArraySize; index++) + { + if(fDynamicBuffer->fBitArray[index]==NULL) + // simulates the iteration on the missing bits + for(XMLSize_t subIndex=0;subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + hash *= 31; + else + for(XMLSize_t subIndex=0;subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + hash = fDynamicBuffer->fBitArray[index][subIndex] + hash * 31; + } + } + return hash; + } + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMStateSet(); + + // ----------------------------------------------------------------------- + // Helpers + // ----------------------------------------------------------------------- + void allocateChunk(const XMLSize_t index) + { +#ifdef XERCES_HAVE_SSE2_INTRINSIC + if(XMLPlatformUtils::fgSSE2ok) + fDynamicBuffer->fBitArray[index]=(XMLInt32*)_mm_malloc(CMSTATE_BITFIELD_INT32_SIZE * sizeof(XMLInt32), 16); + else +#endif + fDynamicBuffer->fBitArray[index]=(XMLInt32*)fDynamicBuffer->fMemoryManager->allocate(CMSTATE_BITFIELD_INT32_SIZE * sizeof(XMLInt32)); + } + + void deallocateChunk(const XMLSize_t index) + { +#ifdef XERCES_HAVE_SSE2_INTRINSIC + if(XMLPlatformUtils::fgSSE2ok) + _mm_free(fDynamicBuffer->fBitArray[index]); + else +#endif + fDynamicBuffer->fMemoryManager->deallocate(fDynamicBuffer->fBitArray[index]); + fDynamicBuffer->fBitArray[index]=NULL; + } + + // ----------------------------------------------------------------------- + // Private data members + // + // fBitCount + // The count of bits that the outside world wants to support, + // so its the max bit index plus one. + // + // fBits + // When the bit count is less than a threshold (very common), these hold the bits. + // Otherwise, the fDynamicBuffer member holds htem. + // + // fDynamicBuffer + // If the bit count is greater than the threshold, then we allocate this structure to + // store the bits, the length, and the memory manager to allocate/deallocate + // the memory + // + // ----------------------------------------------------------------------- + XMLSize_t fBitCount; + XMLInt32 fBits[CMSTATE_CACHED_INT32_SIZE]; + CMDynamicBuffer* fDynamicBuffer; + + friend class CMStateSetEnumerator; +}; + +class CMStateSetEnumerator : public XMemory +{ +public: + CMStateSetEnumerator(const CMStateSet* toEnum, XMLSize_t start = 0) : + fToEnum(toEnum), + fIndexCount((XMLSize_t)-1), + fLastValue(0) + { + // if a starting bit is specified, place fIndexCount at the beginning of the previous 32 bit area + // so the findNext moves to the one where 'start' is located + if(start > 32) + fIndexCount = (start/32 - 1) * 32; + findNext(); + // if we found data, and fIndexCount is still pointing to the area where 'start' is located, erase the bits before 'start' + if(hasMoreElements() && fIndexCount < start) + { + for(XMLSize_t i=0;i< (start - fIndexCount);i++) + { + XMLInt32 mask=1UL << i; + if(fLastValue & mask) + fLastValue &= ~mask; + } + // in case the 32 bit area contained only bits before 'start', advance + if(fLastValue==0) + findNext(); + } + } + + bool hasMoreElements() + { + return fLastValue!=0; + } + + unsigned int nextElement() + { + for(int i=0;i<32;i++) + { + XMLInt32 mask=1UL << i; + if(fLastValue & mask) + { + fLastValue &= ~mask; + unsigned int retVal=(unsigned int)fIndexCount+i; + if(fLastValue==0) + findNext(); + return retVal; + } + } + return 0; + } + +private: + void findNext() + { + if(fToEnum->fDynamicBuffer==0) + { + XMLSize_t nOffset=((fIndexCount==(XMLSize_t)-1)?0:(fIndexCount/32)+1); + for(XMLSize_t index=nOffset;indexfBits[index]!=0) + { + fIndexCount=index*32; + fLastValue=fToEnum->fBits[index]; + return; + } + } + } + else + { + XMLSize_t nOffset=((fIndexCount==(XMLSize_t)-1)?0:(fIndexCount/CMSTATE_BITFIELD_CHUNK)); + XMLSize_t nSubOffset=((fIndexCount==(XMLSize_t)-1)?0:((fIndexCount % CMSTATE_BITFIELD_CHUNK) /32)+1); + for (XMLSize_t index = nOffset; indexfDynamicBuffer->fArraySize; index++) + { + if(fToEnum->fDynamicBuffer->fBitArray[index]!=NULL) + { + for(XMLSize_t subIndex=nSubOffset;subIndex < CMSTATE_BITFIELD_INT32_SIZE; subIndex++) + if(fToEnum->fDynamicBuffer->fBitArray[index][subIndex]!=0) + { + fIndexCount=index*CMSTATE_BITFIELD_CHUNK + subIndex*32; + fLastValue=fToEnum->fDynamicBuffer->fBitArray[index][subIndex]; + return; + } + } + nSubOffset = 0; // next chunks will be processed from the beginning + } + } + } + + const CMStateSet* fToEnum; + XMLSize_t fIndexCount; + XMLInt32 fLastValue; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.cpp b/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.cpp new file mode 100644 index 000000000..67cd900de --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.cpp @@ -0,0 +1,99 @@ +/* + * 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: CMUnaryOp.cpp 677396 2008-07-16 19:36:20Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// CMUnaryOp: Constructors and Destructor +// --------------------------------------------------------------------------- +CMUnaryOp::CMUnaryOp( ContentSpecNode::NodeTypes type + , CMNode* const nodeToAdopt + , unsigned int maxStates + , MemoryManager* const manager) : + CMNode(type, maxStates, manager) + , fChild(nodeToAdopt) +{ + // Insure that its one of the types we require + if ((type != ContentSpecNode::ZeroOrOne) + && (type != ContentSpecNode::ZeroOrMore) + && (type != ContentSpecNode::OneOrMore)) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnaryOpHadBinType, manager); + } + if (type == ContentSpecNode::OneOrMore) + fIsNullable=fChild->isNullable(); + else + fIsNullable=true; +} + +CMUnaryOp::~CMUnaryOp() +{ + delete fChild; +} + + +// --------------------------------------------------------------------------- +// CMUnaryOp: Getter methods +// --------------------------------------------------------------------------- +const CMNode* CMUnaryOp::getChild() const +{ + return fChild; +} + +CMNode* CMUnaryOp::getChild() +{ + return fChild; +} + + +// --------------------------------------------------------------------------- +// CMUnaryOp: Implementation of the public CMNode virtual interface +// --------------------------------------------------------------------------- +void CMUnaryOp::orphanChild() +{ + delete fChild; + fChild=0; +} + +// --------------------------------------------------------------------------- +// CMUnaryOp: Implementation of the protected CMNode virtual interface +// --------------------------------------------------------------------------- +void CMUnaryOp::calcFirstPos(CMStateSet& toSet) const +{ + // Its just based on our child node's first pos + toSet = fChild->getFirstPos(); +} + +void CMUnaryOp::calcLastPos(CMStateSet& toSet) const +{ + // Its just based on our child node's last pos + toSet = fChild->getLastPos(); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.hpp b/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.hpp new file mode 100644 index 000000000..a9b9d0e1a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/CMUnaryOp.hpp @@ -0,0 +1,88 @@ +/* + * 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: CMUnaryOp.hpp 677396 2008-07-16 19:36:20Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CMUNARYOP_HPP) +#define XERCESC_INCLUDE_GUARD_CMUNARYOP_HPP + +#include + + +XERCES_CPP_NAMESPACE_BEGIN + +class CMStateSet; + +class CMUnaryOp : public CMNode +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + CMUnaryOp + ( + ContentSpecNode::NodeTypes type + , CMNode* const nodeToAdopt + , unsigned int maxStates + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~CMUnaryOp(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const CMNode* getChild() const; + CMNode* getChild(); + + + // ----------------------------------------------------------------------- + // Implementation of the public CMNode virtual interface + // ----------------------------------------------------------------------- + virtual void orphanChild(); + + +protected : + // ----------------------------------------------------------------------- + // Implementation of the protected CMNode virtual interface + // ----------------------------------------------------------------------- + void calcFirstPos(CMStateSet& toSet) const; + void calcLastPos(CMStateSet& toSet) const; + + +private : + // ----------------------------------------------------------------------- + // Private data members + // + // fChild + // This is the reference to the one child that we have for this + // unary operation. We own it. + // ----------------------------------------------------------------------- + CMNode* fChild; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + CMUnaryOp(const CMUnaryOp&); + CMUnaryOp& operator=(const CMUnaryOp&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp b/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp new file mode 100644 index 000000000..c054b411c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.cpp @@ -0,0 +1,132 @@ +/* + * 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: ContentLeafNameTypeVector.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ContentLeafNameTypeVector: Constructors and Destructor +// --------------------------------------------------------------------------- +ContentLeafNameTypeVector::ContentLeafNameTypeVector +( + MemoryManager* const manager +) +: fMemoryManager(manager) +, fLeafNames(0) +, fLeafTypes(0) +, fLeafCount(0) +{ +} + +ContentLeafNameTypeVector::ContentLeafNameTypeVector +( + QName** const names + , ContentSpecNode::NodeTypes* const types + , const XMLSize_t count + , MemoryManager* const manager +) +: fMemoryManager(manager) +, fLeafNames(0) +, fLeafTypes(0) +, fLeafCount(0) +{ + setValues(names, types, count); +} + +/*** +copy ctor +***/ +ContentLeafNameTypeVector::ContentLeafNameTypeVector +( + const ContentLeafNameTypeVector& toCopy +) +: XMemory(toCopy) +, fMemoryManager(toCopy.fMemoryManager) +, fLeafNames(0) +, fLeafTypes(0) +, fLeafCount(0) +{ + fLeafCount=toCopy.getLeafCount(); + init(fLeafCount); + + for (XMLSize_t i=0; ifLeafCount; i++) + { + fLeafNames[i] = toCopy.getLeafNameAt(i); + fLeafTypes[i] = toCopy.getLeafTypeAt(i); + } +} + +ContentLeafNameTypeVector::~ContentLeafNameTypeVector() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// ContentSpecType: Setter methods +// --------------------------------------------------------------------------- +void ContentLeafNameTypeVector::setValues + ( + QName** const names + , ContentSpecNode::NodeTypes* const types + , const XMLSize_t count + ) +{ + cleanUp(); + init(count); + + for (XMLSize_t i=0; i= fLeafCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + return fLeafNames[pos]; +} + +ContentSpecNode::NodeTypes ContentLeafNameTypeVector::getLeafTypeAt + (const XMLSize_t pos) const +{ + if (pos >= fLeafCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex, fMemoryManager); + + return fLeafTypes[pos]; +} + +XMLSize_t ContentLeafNameTypeVector::getLeafCount() const +{ + return fLeafCount; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.hpp b/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.hpp new file mode 100644 index 000000000..d205adfad --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/ContentLeafNameTypeVector.hpp @@ -0,0 +1,119 @@ +/* + * 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: ContentLeafNameTypeVector.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CONTENTLEAFNAMETYPEVECTOR_HPP) +#define XERCESC_INCLUDE_GUARD_CONTENTLEAFNAMETYPEVECTOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLPARSER_EXPORT ContentLeafNameTypeVector : public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // ----------------------------------------------------------------------- + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ContentLeafNameTypeVector + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ContentLeafNameTypeVector + ( + QName** const qName + , ContentSpecNode::NodeTypes* const types + , const XMLSize_t count + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~ContentLeafNameTypeVector(); + + ContentLeafNameTypeVector(const ContentLeafNameTypeVector&); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + QName* getLeafNameAt(const XMLSize_t pos) const; + + ContentSpecNode::NodeTypes getLeafTypeAt(const XMLSize_t pos) const; + XMLSize_t getLeafCount() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setValues + ( + QName** const qName + , ContentSpecNode::NodeTypes* const types + , const XMLSize_t count + ); + + // ----------------------------------------------------------------------- + // Miscellaneous + // ----------------------------------------------------------------------- + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ContentLeafNameTypeVector& operator=(const ContentLeafNameTypeVector&); + + // ----------------------------------------------------------------------- + // helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + void init(const XMLSize_t size); + + // ----------------------------------------------------------------------- + // Private Data Members + // + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + QName** fLeafNames; + ContentSpecNode::NodeTypes *fLeafTypes; + XMLSize_t fLeafCount; +}; + +inline void ContentLeafNameTypeVector::cleanUp() +{ + fMemoryManager->deallocate(fLeafNames); //delete [] fLeafNames; + fMemoryManager->deallocate(fLeafTypes); //delete [] fLeafTypes; +} + +inline void ContentLeafNameTypeVector::init(const XMLSize_t size) +{ + fLeafNames = (QName**) fMemoryManager->allocate(size * sizeof(QName*));//new QName*[size]; + fLeafTypes = (ContentSpecNode::NodeTypes *) fMemoryManager->allocate + ( + size * sizeof(ContentSpecNode::NodeTypes) + ); //new ContentSpecNode::NodeTypes [size]; + fLeafCount = size; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.cpp b/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.cpp new file mode 100644 index 000000000..4c739ba68 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.cpp @@ -0,0 +1,323 @@ +/* + * 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: ContentSpecNode.cpp 933155 2010-04-12 09:07:02Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ContentSpecNode: Copy Constructor +// +// Note: this copy constructor has dependency on various get*() methods +// and shall be placed after those method's declaration. +// aka inline function compilation error on AIX 4.2, xlC 3 r ev.1 +// --------------------------------------------------------------------------- + +ContentSpecNode::ContentSpecNode(const ContentSpecNode& toCopy) : + XSerializable(toCopy) + , XMemory(toCopy) + , fMemoryManager(toCopy.fMemoryManager) + , fElement(0) + , fElementDecl(toCopy.fElementDecl) + , fFirst(0) + , fSecond(0) + , fType(toCopy.fType) + , fAdoptFirst(true) + , fAdoptSecond(true) + , fMinOccurs(toCopy.fMinOccurs) + , fMaxOccurs(toCopy.fMaxOccurs) +{ + const QName* tempElement = toCopy.getElement(); + if (tempElement) + fElement = new (fMemoryManager) QName(*tempElement); + + const ContentSpecNode *tmp = toCopy.getFirst(); + if (tmp) + fFirst = new (fMemoryManager) ContentSpecNode(*tmp); + + tmp = toCopy.getSecond(); + if (tmp) + fSecond = new (fMemoryManager) ContentSpecNode(*tmp); +} + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- +static void formatNode( const ContentSpecNode* const curNode + , const ContentSpecNode::NodeTypes parentType + , XMLBuffer& bufToFill) +{ + if (!curNode) + return; + + const ContentSpecNode* first = curNode->getFirst(); + const ContentSpecNode* second = curNode->getSecond(); + const ContentSpecNode::NodeTypes curType = curNode->getType(); + + // Get the type of the first node + const ContentSpecNode::NodeTypes firstType = first ? + first->getType() : + ContentSpecNode::Leaf; + + // Calculate the parens flag for the rep nodes + bool doRepParens = false; + if (((firstType != ContentSpecNode::Leaf) + && (parentType != ContentSpecNode::UnknownType)) + || ((firstType == ContentSpecNode::Leaf) + && (parentType == ContentSpecNode::UnknownType))) + { + doRepParens = true; + } + + // Now handle our type + switch(curType & 0x0f) + { + case ContentSpecNode::Leaf : + if (curNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) + bufToFill.append(XMLElementDecl::fgPCDataElemName); + else + { + bufToFill.append(curNode->getElement()->getRawName()); + // show the + and * modifiers also when we have a non-infinite number of repetitions + if(curNode->getMinOccurs()==0 && (curNode->getMaxOccurs()==-1 || curNode->getMaxOccurs()>1)) + bufToFill.append(chAsterisk); + else if(curNode->getMinOccurs()==0 && curNode->getMaxOccurs()==1) + bufToFill.append(chQuestion); + else if(curNode->getMinOccurs()==1 && (curNode->getMaxOccurs()==-1 || curNode->getMaxOccurs()>1)) + bufToFill.append(chPlus); + } + break; + + case ContentSpecNode::ZeroOrOne : + if (doRepParens) + bufToFill.append(chOpenParen); + formatNode(first, curType, bufToFill); + if (doRepParens) + bufToFill.append(chCloseParen); + bufToFill.append(chQuestion); + break; + + case ContentSpecNode::ZeroOrMore : + if (doRepParens) + bufToFill.append(chOpenParen); + formatNode(first, curType, bufToFill); + if (doRepParens) + bufToFill.append(chCloseParen); + bufToFill.append(chAsterisk); + break; + + case ContentSpecNode::OneOrMore : + if (doRepParens) + bufToFill.append(chOpenParen); + formatNode(first, curType, bufToFill); + if (doRepParens) + bufToFill.append(chCloseParen); + bufToFill.append(chPlus); + break; + + case ContentSpecNode::Choice : + if ((parentType & 0x0f) != (curType & 0x0f)) + bufToFill.append(chOpenParen); + formatNode(first, curType, bufToFill); + if(second!=NULL) + { + bufToFill.append(chPipe); + formatNode(second, curType, bufToFill); + } + if ((parentType & 0x0f) != (curType & 0x0f)) + bufToFill.append(chCloseParen); + break; + + case ContentSpecNode::Sequence : + if ((parentType & 0x0f) != (curType & 0x0f)) + bufToFill.append(chOpenParen); + formatNode(first, curType, bufToFill); + if(second!=NULL) + { + bufToFill.append(chComma); + formatNode(second, curType, bufToFill); + } + if ((parentType & 0x0f) != (curType & 0x0f)) + bufToFill.append(chCloseParen); + break; + + case ContentSpecNode::All : + if ((parentType & 0x0f) != (curType & 0x0f)) + { + bufToFill.append(chLatin_A); + bufToFill.append(chLatin_l); + bufToFill.append(chLatin_l); + bufToFill.append(chOpenParen); + } + formatNode(first, curType, bufToFill); + bufToFill.append(chComma); + formatNode(second, curType, bufToFill); + if ((parentType & 0x0f) != (curType & 0x0f)) + bufToFill.append(chCloseParen); + break; + } +} + + +// --------------------------------------------------------------------------- +// ContentSpecNode: Miscellaneous +// --------------------------------------------------------------------------- +void ContentSpecNode::formatSpec(XMLBuffer& bufToFill) const +{ + // Clean out the buffer first + bufToFill.reset(); + + if (fType == ContentSpecNode::Leaf) + bufToFill.append(chOpenParen); + formatNode + ( + this + , UnknownType + , bufToFill + ); + if (fType == ContentSpecNode::Leaf) + bufToFill.append(chCloseParen); +} + +int ContentSpecNode::getMinTotalRange() const { + + int min = fMinOccurs; + + if ((fType & 0x0f) == ContentSpecNode::Sequence + || fType == ContentSpecNode::All + || (fType & 0x0f) == ContentSpecNode::Choice) { + + int minFirst = fFirst->getMinTotalRange(); + + if (fSecond) { + + int minSecond = fSecond->getMinTotalRange(); + + if ((fType & 0x0f) == ContentSpecNode::Choice) { + min = min * ((minFirst < minSecond)? minFirst : minSecond); + } + else { + min = min * (minFirst + minSecond); + } + } + else + min = min * minFirst; + } + + return min; +} + +int ContentSpecNode::getMaxTotalRange() const { + + int max = fMaxOccurs; + + if (max == SchemaSymbols::XSD_UNBOUNDED) { + return SchemaSymbols::XSD_UNBOUNDED; + } + + if ((fType & 0x0f) == ContentSpecNode::Sequence + || fType == ContentSpecNode::All + || (fType & 0x0f) == ContentSpecNode::Choice) { + + int maxFirst = fFirst->getMaxTotalRange(); + + if (maxFirst == SchemaSymbols::XSD_UNBOUNDED) { + return SchemaSymbols::XSD_UNBOUNDED; + } + + if (fSecond) { + + int maxSecond = fSecond->getMaxTotalRange(); + + if (maxSecond == SchemaSymbols::XSD_UNBOUNDED) { + return SchemaSymbols::XSD_UNBOUNDED; + } + else { + + if ((fType & 0x0f) == ContentSpecNode::Choice) { + max = max * (maxFirst > maxSecond) ? maxFirst : maxSecond; + } + else { + max = max * (maxFirst + maxSecond); + } + } + } + else { + max = max * maxFirst; + } + } + + return max; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(ContentSpecNode) + +void ContentSpecNode::serialize(XSerializeEngine& serEng) +{ + /*** + * Since fElement, fFirst, fSecond are NOT created by the default + * constructor, we need to create them dynamically. + ***/ + + if (serEng.isStoring()) + { + serEng<>fElement; + fElementDecl = XMLElementDecl::loadElementDecl(serEng); + serEng>>fFirst; + serEng>>fSecond; + + int type; + serEng>>type; + fType = (NodeTypes)type; + + serEng>>fAdoptFirst; + serEng>>fAdoptSecond; + serEng>>fMinOccurs; + serEng>>fMaxOccurs; + } + +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.hpp b/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.hpp new file mode 100644 index 000000000..da8dda073 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/ContentSpecNode.hpp @@ -0,0 +1,467 @@ +/* + * 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: ContentSpecNode.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_CONTENTSPECNODE_HPP) +#define XERCESC_INCLUDE_GUARD_CONTENTSPECNODE_HPP + +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLBuffer; +class Grammar; + + +class XMLUTIL_EXPORT ContentSpecNode : public XSerializable, public XMemory +{ +public : + // ----------------------------------------------------------------------- + // Class specific types + // ----------------------------------------------------------------------- + enum NodeTypes + { + Leaf = 0 + , ZeroOrOne + , ZeroOrMore + , OneOrMore + , Choice + , Sequence + , Any + , Any_Other + , Any_NS = 8 + , All = 9 + , Loop = 10 + , Any_NS_Choice = 20 // 16 + 4 (Choice) + , ModelGroupSequence = 21 // 16 + 5 (Sequence) + , Any_Lax = 22 // 16 + 6 (Any) + , Any_Other_Lax = 23 // 16 + 7 (Any_Other) + , Any_NS_Lax = 24 // 16 + 8 (Any_NS) + , ModelGroupChoice = 36 // 32 + 4 (Choice) + , Any_Skip = 38 // 32 + 6 (Any) + , Any_Other_Skip = 39 // 32 + 7 (Any_Other) + , Any_NS_Skip = 40 // 32 + 8 (Any_NS) + + , UnknownType = -1 + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + ContentSpecNode(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ContentSpecNode + ( + QName* const toAdopt + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ContentSpecNode + ( + XMLElementDecl* const elemDecl + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ContentSpecNode + ( + QName* const toAdopt + , const bool copyQName + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ContentSpecNode + ( + const NodeTypes type + , ContentSpecNode* const firstToAdopt + , ContentSpecNode* const secondToAdopt + , const bool adoptFirst = true + , const bool adoptSecond = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ContentSpecNode(const ContentSpecNode&); + ~ContentSpecNode(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + QName* getElement(); + const QName* getElement() const; + XMLElementDecl* getElementDecl(); + const XMLElementDecl* getElementDecl() const; + ContentSpecNode* getFirst(); + const ContentSpecNode* getFirst() const; + ContentSpecNode* getSecond(); + const ContentSpecNode* getSecond() const; + NodeTypes getType() const; + ContentSpecNode* orphanFirst(); + ContentSpecNode* orphanSecond(); + int getMinOccurs() const; + int getMaxOccurs() const; + bool isFirstAdopted() const; + bool isSecondAdopted() const; + + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setElement(QName* const toAdopt); + void setFirst(ContentSpecNode* const toAdopt); + void setSecond(ContentSpecNode* const toAdopt); + void setType(const NodeTypes type); + void setMinOccurs(int min); + void setMaxOccurs(int max); + void setAdoptFirst(bool adoptFirst); + void setAdoptSecond(bool adoptSecond); + + + // ----------------------------------------------------------------------- + // Miscellaneous + // ----------------------------------------------------------------------- + void formatSpec (XMLBuffer& bufToFill) const; + bool hasAllContent(); + int getMinTotalRange() const; + int getMaxTotalRange() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(ContentSpecNode) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ContentSpecNode& operator=(const ContentSpecNode&); + + + // ----------------------------------------------------------------------- + // Private Data Members + // + // fElement + // If the type is Leaf/Any*, then this is the qName of the element. If the URI + // is fgPCDataElemId, then its a PCData node. Else, it is zero. + // + // fFirst + // fSecond + // The optional first and second nodes. The fType field indicates + // which of these are valid. The validity constraints are: + // + // Leaf = Neither valid + // ZeroOrOne, ZeroOrMore = First + // Choice, Sequence, All = First and Second + // Any* = Neither valid + // + // fType + // The type of node. This controls how many of the child node fields + // are used. + // + // fAdoptFirst + // Indicate if this ContentSpecNode adopts the fFirst, and is responsible + // for deleting it. + // + // fAdoptSecond + // Indicate if this ContentSpecNode adopts the fSecond, and is responsible + // for deleting it. + // + // fMinOccurs + // Indicate the minimum times that this node can occur + // + // fMaxOccurs + // Indicate the maximum times that this node can occur + // -1 (Unbounded), default (1) + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + QName* fElement; + XMLElementDecl* fElementDecl; + ContentSpecNode* fFirst; + ContentSpecNode* fSecond; + NodeTypes fType; + bool fAdoptFirst; + bool fAdoptSecond; + int fMinOccurs; + int fMaxOccurs; +}; + +// --------------------------------------------------------------------------- +// ContentSpecNode: Constructors and Destructor +// --------------------------------------------------------------------------- +inline ContentSpecNode::ContentSpecNode(MemoryManager* const manager) : + + fMemoryManager(manager) + , fElement(0) + , fElementDecl(0) + , fFirst(0) + , fSecond(0) + , fType(ContentSpecNode::Leaf) + , fAdoptFirst(true) + , fAdoptSecond(true) + , fMinOccurs(1) + , fMaxOccurs(1) +{ +} + +inline +ContentSpecNode::ContentSpecNode(QName* const element, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fElement(0) + , fElementDecl(0) + , fFirst(0) + , fSecond(0) + , fType(ContentSpecNode::Leaf) + , fAdoptFirst(true) + , fAdoptSecond(true) + , fMinOccurs(1) + , fMaxOccurs(1) +{ + if (element) + fElement = new (fMemoryManager) QName(*element); +} + +inline +ContentSpecNode::ContentSpecNode(XMLElementDecl* const elemDecl, + MemoryManager* const manager) : + + fMemoryManager(manager) + , fElement(0) + , fElementDecl(elemDecl) + , fFirst(0) + , fSecond(0) + , fType(ContentSpecNode::Leaf) + , fAdoptFirst(true) + , fAdoptSecond(true) + , fMinOccurs(1) + , fMaxOccurs(1) +{ + if (elemDecl) + fElement = new (manager) QName(*(elemDecl->getElementName())); +} + +inline +ContentSpecNode::ContentSpecNode( QName* const element + , const bool copyQName + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fElement(0) + , fElementDecl(0) + , fFirst(0) + , fSecond(0) + , fType(ContentSpecNode::Leaf) + , fAdoptFirst(true) + , fAdoptSecond(true) + , fMinOccurs(1) + , fMaxOccurs(1) +{ + if (copyQName) + { + if (element) + fElement = new (fMemoryManager) QName(*element); + } + else + { + fElement = element; + } +} + +inline +ContentSpecNode::ContentSpecNode(const NodeTypes type + , ContentSpecNode* const firstAdopt + , ContentSpecNode* const secondAdopt + , const bool adoptFirst + , const bool adoptSecond + , MemoryManager* const manager) : + + fMemoryManager(manager) + , fElement(0) + , fElementDecl(0) + , fFirst(firstAdopt) + , fSecond(secondAdopt) + , fType(type) + , fAdoptFirst(adoptFirst) + , fAdoptSecond(adoptSecond) + , fMinOccurs(1) + , fMaxOccurs(1) +{ +} + +inline ContentSpecNode::~ContentSpecNode() +{ + // Delete our children, which cause recursive cleanup + if (fAdoptFirst) { + delete fFirst; + } + + if (fAdoptSecond) { + delete fSecond; + } + + delete fElement; +} + +// --------------------------------------------------------------------------- +// ContentSpecNode: Getter methods +// --------------------------------------------------------------------------- +inline QName* ContentSpecNode::getElement() +{ + return fElement; +} + +inline const QName* ContentSpecNode::getElement() const +{ + return fElement; +} + +inline XMLElementDecl* ContentSpecNode::getElementDecl() +{ + return fElementDecl; +} + +inline const XMLElementDecl* ContentSpecNode::getElementDecl() const +{ + return fElementDecl; +} + +inline ContentSpecNode* ContentSpecNode::getFirst() +{ + return fFirst; +} + +inline const ContentSpecNode* ContentSpecNode::getFirst() const +{ + return fFirst; +} + +inline ContentSpecNode* ContentSpecNode::getSecond() +{ + return fSecond; +} + +inline const ContentSpecNode* ContentSpecNode::getSecond() const +{ + return fSecond; +} + +inline ContentSpecNode::NodeTypes ContentSpecNode::getType() const +{ + return fType; +} + +inline ContentSpecNode* ContentSpecNode::orphanFirst() +{ + ContentSpecNode* retNode = fFirst; + fFirst = 0; + return retNode; +} + +inline ContentSpecNode* ContentSpecNode::orphanSecond() +{ + ContentSpecNode* retNode = fSecond; + fSecond = 0; + return retNode; +} + +inline int ContentSpecNode::getMinOccurs() const +{ + return fMinOccurs; +} + +inline int ContentSpecNode::getMaxOccurs() const +{ + return fMaxOccurs; +} + +inline bool ContentSpecNode::isFirstAdopted() const +{ + return fAdoptFirst; +} + +inline bool ContentSpecNode::isSecondAdopted() const +{ + return fAdoptSecond; +} + + +// --------------------------------------------------------------------------- +// ContentSpecType: Setter methods +// --------------------------------------------------------------------------- +inline void ContentSpecNode::setElement(QName* const element) +{ + delete fElement; + fElement = 0; + if (element) + fElement = new (fMemoryManager) QName(*element); +} + +inline void ContentSpecNode::setFirst(ContentSpecNode* const toAdopt) +{ + if (fAdoptFirst) + delete fFirst; + fFirst = toAdopt; +} + +inline void ContentSpecNode::setSecond(ContentSpecNode* const toAdopt) +{ + if (fAdoptSecond) + delete fSecond; + fSecond = toAdopt; +} + +inline void ContentSpecNode::setType(const NodeTypes type) +{ + fType = type; +} + +inline void ContentSpecNode::setMinOccurs(int min) +{ + fMinOccurs = min; +} + +inline void ContentSpecNode::setMaxOccurs(int max) +{ + fMaxOccurs = max; +} + +inline void ContentSpecNode::setAdoptFirst(bool newState) +{ + fAdoptFirst = newState; +} + +inline void ContentSpecNode::setAdoptSecond(bool newState) +{ + fAdoptSecond = newState; +} + +// --------------------------------------------------------------------------- +// ContentSpecNode: Miscellaneous +// --------------------------------------------------------------------------- +inline bool ContentSpecNode::hasAllContent() { + + if (fType == ContentSpecNode::ZeroOrOne) { + return (fFirst->getType() == ContentSpecNode::All); + } + + return (fType == ContentSpecNode::All); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.cpp b/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.cpp new file mode 100644 index 000000000..63a409910 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.cpp @@ -0,0 +1,1685 @@ +/* + * 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: DFAContentModel.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +struct CMStateSetHasher +{ + XMLSize_t getHashVal(const void *const key, XMLSize_t mod) + { + const CMStateSet* const pkey = (const CMStateSet*) key; + return ((pkey->hashCode()) % mod); + } + + bool equals(const void *const key1, const void *const key2) + { + const CMStateSet* const pkey1 = (const CMStateSet*) key1; + const CMStateSet* const pkey2 = (const CMStateSet*) key2; + return (*pkey1==*pkey2); + } +}; + +// --------------------------------------------------------------------------- +// DFAContentModel: Constructors and Destructor +// --------------------------------------------------------------------------- +DFAContentModel::DFAContentModel( const bool dtd + , ContentSpecNode* const elemContentSpec + , MemoryManager* const manager) : + + fElemMap(0) + , fElemMapType(0) + , fElemMapSize(0) + , fEmptyOk(false) + , fEOCPos(0) + , fFinalStateFlags(0) + , fFollowList(0) + , fHeadNode(0) + , fLeafCount(0) + , fLeafList(0) + , fLeafListType(0) + , fTransTable(0) + , fTransTableSize(0) + , fCountingStates(0) + , fDTD(dtd) + , fIsMixed(false) + , fLeafNameTypeVector(0) + , fMemoryManager(manager) +{ + // And build the DFA data structures + buildDFA(elemContentSpec); +} + +DFAContentModel::DFAContentModel( const bool dtd + , ContentSpecNode* const elemContentSpec + , const bool isMixed + , MemoryManager* const manager): + + fElemMap(0) + , fElemMapType(0) + , fElemMapSize(0) + , fEmptyOk(false) + , fEOCPos(0) + , fFinalStateFlags(0) + , fFollowList(0) + , fHeadNode(0) + , fLeafCount(0) + , fLeafList(0) + , fLeafListType(0) + , fTransTable(0) + , fTransTableSize(0) + , fCountingStates(0) + , fDTD(dtd) + , fIsMixed(isMixed) + , fLeafNameTypeVector(0) + , fMemoryManager(manager) +{ + // And build the DFA data structures + buildDFA(elemContentSpec); +} + +DFAContentModel::~DFAContentModel() +{ + // + // Clean up all the stuff that is not just temporary representation + // data that was cleaned up after building the DFA. + // + fMemoryManager->deallocate(fFinalStateFlags); //delete [] fFinalStateFlags; + + unsigned int index; + for (index = 0; index < fTransTableSize; index++) + fMemoryManager->deallocate(fTransTable[index]); //delete [] fTransTable[index]; + fMemoryManager->deallocate(fTransTable); //delete [] fTransTable; + + if(fCountingStates) + { + for (unsigned int j = 0; j < fTransTableSize; ++j) + delete fCountingStates[j]; + fMemoryManager->deallocate(fCountingStates); + } + + for (index = 0; index < fLeafCount; index++) + delete fElemMap[index]; + fMemoryManager->deallocate(fElemMap); //delete [] fElemMap; + + fMemoryManager->deallocate(fElemMapType); //delete [] fElemMapType; + fMemoryManager->deallocate(fLeafListType); //delete [] fLeafListType; + + delete fLeafNameTypeVector; +} + + +// --------------------------------------------------------------------------- +// DFAContentModel: Implementation of the ContentModel virtual interface +// --------------------------------------------------------------------------- +bool +DFAContentModel::validateContent( QName** const children + , XMLSize_t childCount + , unsigned int + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + // + // If there are no children, then either we fail on the 0th element + // or we return success. It depends upon whether this content model + // accepts empty content, which we determined earlier. + // + if (!childCount) + { + // success + if(fEmptyOk) + return true; + *indexFailingChild=0; + return false; + } + + // + // Lets loop through the children in the array and move our way + // through the states. Note that we use the fElemMap array to map + // an element index to a state index. + // + unsigned int curState = 0; + unsigned int nextState = 0; + unsigned int loopCount = 0; + unsigned int childIndex = 0; + for (; childIndex < childCount; childIndex++) + { + // Get the current element index out + const QName* curElem = children[childIndex]; + const XMLCh* curElemRawName = 0; + if (fDTD) + curElemRawName = curElem->getRawName(); + + // If this is text in a Schema mixed content model, skip it. + if ( fIsMixed && + ( curElem->getURI() == XMLElementDecl::fgPCDataElemId)) + continue; + + // Look up this child in our element map + unsigned int elemIndex = 0; + for (; elemIndex < fElemMapSize; elemIndex++) + { + const QName* inElem = fElemMap[elemIndex]; + if (fDTD) { + if (XMLString::equals(inElem->getRawName(), curElemRawName)) { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else { + ContentSpecNode::NodeTypes type = fElemMapType[elemIndex]; + if (type == ContentSpecNode::Leaf) + { + if ((inElem->getURI() == curElem->getURI()) && + (XMLString::equals(inElem->getLocalPart(), curElem->getLocalPart()))) { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f)== ContentSpecNode::Any) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + else if ((type & 0x0f) == ContentSpecNode::Any_NS) + { + if (inElem->getURI() == curElem->getURI()) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f) == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curElem->getURI(); + if (uriId != 1 && uriId != inElem->getURI()) { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + } + }//for elemIndex + + // If "nextState" is -1, we found a match, but the transition is invalid + if (nextState == XMLContentModel::gInvalidTrans) + { + *indexFailingChild=childIndex; + return false; + } + + // If we didn't find it, then obviously not valid + if (elemIndex == fElemMapSize) + { + *indexFailingChild=childIndex; + return false; + } + + unsigned int nextLoop = 0; + if(!handleRepetitions(curElem, curState, loopCount, nextState, nextLoop, elemIndex, 0)) + { + *indexFailingChild=childIndex; + return false; + } + + curState = nextState; + loopCount = nextLoop; + nextState = 0; + + }//for childIndex + + // + // We transitioned all the way through the input list. However, that + // does not mean that we ended in a final state. So check whether + // our ending state is a final state. + // + if (!fFinalStateFlags[curState]) + { + *indexFailingChild=childIndex; + return false; + } + + // verify if we exited before the minOccurs was satisfied + if (fCountingStates != 0) { + Occurence* o = fCountingStates[curState]; + if (o != 0 && loopCount < (unsigned int)o->minOccurs) { + // not enough loops on the current state to be considered final. + *indexFailingChild=childIndex; + return false; + } + } + + //success + return true; +} + +bool DFAContentModel::validateContentSpecial(QName** const children + , XMLSize_t childCount + , unsigned int + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + if (childCount == 0) + { + if(fEmptyOk) + return true; + *indexFailingChild=0; + return false; + } + + // + // Lets loop through the children in the array and move our way + // through the states. Note that we use the fElemMap array to map + // an element index to a state index. + // + unsigned int curState = 0; + unsigned int loopCount = 0; + unsigned int nextState = 0; + unsigned int childIndex = 0; + for (; childIndex < childCount; childIndex++) + { + // Get the current element index out + QName* curElem = children[childIndex]; + + // If this is text in a Schema mixed content model, skip it. + if ( fIsMixed && + ( curElem->getURI() == XMLElementDecl::fgPCDataElemId)) + continue; + + // Look up this child in our element map + unsigned int elemIndex = 0; + for (; elemIndex < fElemMapSize; elemIndex++) + { + QName* inElem = fElemMap[elemIndex]; + ContentSpecNode::NodeTypes type = fElemMapType[elemIndex]; + if (type == ContentSpecNode::Leaf) + { + if (comparator.isEquivalentTo(curElem, inElem) ) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + + } + else if ((type & 0x0f)== ContentSpecNode::Any) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + else if ((type & 0x0f) == ContentSpecNode::Any_NS) + { + if (inElem->getURI() == curElem->getURI()) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f) == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curElem->getURI(); + if (uriId != 1 && uriId != inElem->getURI()) + { + nextState = fTransTable[curState][elemIndex]; + if (nextState != XMLContentModel::gInvalidTrans) + break; + } + } + }//for elemIndex + + // If "nextState" is -1, we found a match, but the transition is invalid + if (nextState == XMLContentModel::gInvalidTrans) + { + *indexFailingChild=childIndex; + return false; + } + + // If we didn't find it, then obviously not valid + if (elemIndex == fElemMapSize) + { + *indexFailingChild=childIndex; + return false; + } + + unsigned int nextLoop = 0; + if(!handleRepetitions(curElem, curState, loopCount, nextState, nextLoop, elemIndex, &comparator)) + { + *indexFailingChild=childIndex; + return false; + } + + curState = nextState; + loopCount = nextLoop; + nextState = 0; + + }//for childIndex + + // + // We transitioned all the way through the input list. However, that + // does not mean that we ended in a final state. So check whether + // our ending state is a final state. + // + if (!fFinalStateFlags[curState]) + { + *indexFailingChild=childIndex; + return false; + } + + // verify if we exited before the minOccurs was satisfied + if (fCountingStates != 0) { + Occurence* o = fCountingStates[curState]; + if (o != 0) { + if (loopCount < (unsigned int)o->minOccurs) { + // not enough loops on the current state. + *indexFailingChild=childIndex; + return false; + } + } + } + + //success + return true; +} + +bool DFAContentModel::handleRepetitions(const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elemIndex, + SubstitutionGroupComparator * comparator) const +{ + nextLoop = 0; + if (fCountingStates != 0) { + nextLoop = currentLoop; + Occurence* o = fCountingStates[curState]; + if (o != 0) { + if (curState == nextState) { + if (++nextLoop > (unsigned int)o->maxOccurs && o->maxOccurs != -1) { + // It's likely that we looped too many times on the current state + // however it's possible that we actually matched another particle + // which allows the same name. + // + // Consider: + // + // + // + // + // + // + // and + // + // + // + // + // + // + // In the DFA there will be two transitions from the current state which + // allow "foo". Note that this is not a UPA violation. The ambiguity of which + // transition to take is resolved by the current value of the counter. Since + // we've already seen enough instances of the first "foo" perhaps there is + // another element declaration or wildcard deeper in the element map which + // matches. + unsigned int tempNextState = 0; + + while (++elemIndex < fElemMapSize) { + QName* inElem = fElemMap[elemIndex]; + ContentSpecNode::NodeTypes type = fElemMapType[elemIndex]; + if (type == ContentSpecNode::Leaf) + { + if(comparator!=0) { + if (comparator->isEquivalentTo(curElem, inElem) ) + { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if (fDTD) { + if (XMLString::equals(inElem->getRawName(), curElem->getRawName())) { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + } + else { + if ((inElem->getURI() == curElem->getURI()) && + (XMLString::equals(inElem->getLocalPart(), curElem->getLocalPart()))) { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + } + } + else if ((type & 0x0f)== ContentSpecNode::Any) + { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + else if ((type & 0x0f) == ContentSpecNode::Any_NS) + { + if (inElem->getURI() == curElem->getURI()) + { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + } + else if ((type & 0x0f) == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curElem->getURI(); + if (uriId != 1 && uriId != inElem->getURI()) + { + tempNextState = fTransTable[curState][elemIndex]; + if (tempNextState != XMLContentModel::gInvalidTrans) + break; + } + } + } + + // if we still can't find a match, report the error + if (elemIndex == fElemMapSize) + return false; + + // if we found a match, set the next state and reset the + // counter if the next state is a counting state. + nextState = tempNextState; + Occurence* o = fCountingStates[nextState]; + if (o != 0) { + nextLoop = (elemIndex == XMLSize_t (o->elemIndex)) ? 1 : 0; + } + } + } + else if (nextLoop < (unsigned int)o->minOccurs) { + // not enough loops on the current state. + return false; + } + else { + // Exiting a counting state. If we're entering a new + // counting state, reset the counter. + o = fCountingStates[nextState]; + if (o != 0) { + nextLoop = (elemIndex == XMLSize_t (o->elemIndex)) ? 1 : 0; + } + } + } + else { + o = fCountingStates[nextState]; + if (o != 0) { + // Entering a new counting state. Reset the counter. + // If we've already seen one instance of the looping + // particle set the counter to 1, otherwise set it + // to 0. + nextLoop = (elemIndex == XMLSize_t (o->elemIndex)) ? 1 : 0; + } + } + } + return true; +} + +// --------------------------------------------------------------------------- +// DFAContentModel: Private helper methods +// --------------------------------------------------------------------------- +void DFAContentModel::buildDFA(ContentSpecNode* const curNode) +{ + unsigned int index; + + // + // The first step we need to take is to rewrite the content model using + // our CMNode objects, and in the process get rid of any repetition short + // cuts, converting them into '*' style repetitions or getting rid of + // repetitions altogether. + // + // The conversions done are: + // + // x+ -> (x|x*) + // x? -> (x|epsilon) + // + // This is a relatively complex scenario. What is happening is that we + // create a top level binary node of which the special EOC value is set + // as the right side node. The the left side is set to the rewritten + // syntax tree. The source is the original content model info from the + // decl pool. The rewrite is done by buildSyntaxTree() which recurses the + // decl pool's content of the element and builds a new tree in the + // process. + // + // Note that, during this operation, we set each non-epsilon leaf node's + // DFA state position and count the number of such leafs, which is left + // in the fLeafCount member. + // + fLeafCount=countLeafNodes(curNode); + fEOCPos = fLeafCount++; + + // We need to build an array of references to the non-epsilon + // leaf nodes. We will put them in the array according to their position values + // + fLeafList = (CMLeaf**) fMemoryManager->allocate(fLeafCount*sizeof(CMLeaf*)); //new CMLeaf*[fLeafCount]; + fLeafListType = (ContentSpecNode::NodeTypes*) fMemoryManager->allocate + ( + fLeafCount * sizeof(ContentSpecNode::NodeTypes) + ); //new ContentSpecNode::NodeTypes[fLeafCount]; + // + // And, moving onward... We now need to build the follow position sets + // for all the nodes. So we allocate an array of pointers to state sets, + // one for each leaf node (i.e. each significant DFA position.) + // + fFollowList = (CMStateSet**) fMemoryManager->allocate + ( + fLeafCount * sizeof(CMStateSet*) + ); //new CMStateSet*[fLeafCount]; + for (index = 0; index < fLeafCount; index++) + fFollowList[index] = new (fMemoryManager) CMStateSet(fLeafCount, fMemoryManager); + + // The buildSyntaxTree function will recursively iterate over the ContentSpecNode + // and build the CMNode hierarchy; it will also put every leaf node in the fLeafList + // array, then calculate the first and last position sets of each node. This is + // cached away in each of the nodes. + // + // Along the way we also set the leaf count in each node as the maximum + // state count. They must know this in order to create their first/last + // position sets. + // + unsigned int counter=0; + CMNode* nodeOrgContent = buildSyntaxTree(curNode, counter); + // + // Check to see whether this content model can handle an empty content, + // which is something we need to optimize by looking now before we + // throw away the info that would tell us that. + // + // If the left node of the head (the top level of the original content) + // is nullable, then its true. + // + fEmptyOk = nodeOrgContent->isNullable(); + + // + // And handle specially the EOC node, which also must be numbered and + // counted as a non-epsilon leaf node. It could not be handled in the + // above tree build because it was created before all that started. We + // save the EOC position since its used during the DFA building loop. + // + CMLeaf* nodeEOC = new (fMemoryManager) CMLeaf + ( + new (fMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , XMLContentModel::gEOCFakeId + , fMemoryManager + ) + , fEOCPos + , true + , fLeafCount + , fMemoryManager + ); + fHeadNode = new (fMemoryManager) CMBinaryOp + ( + ContentSpecNode::Sequence + , nodeOrgContent + , nodeEOC + , fLeafCount + , fMemoryManager + ); + + // Put also the final EOC node in the leaf array + fLeafList[counter] = new (fMemoryManager) CMLeaf + ( + nodeEOC->getElement() + , nodeEOC->getPosition() + , fLeafCount + , fMemoryManager + ); + fLeafListType[counter] = ContentSpecNode::Leaf; + + // + // Now handle our top level. We use our left child's last pos set and our + // right child's first pos set, so get them now for convenience. + // + const CMStateSet& last = nodeOrgContent->getLastPos(); + const CMStateSet& first = nodeEOC->getFirstPos(); + + // + // Now, for every position which is in our left child's last set + // add all of the states in our right child's first set to the + // follow set for that position. + // + CMStateSetEnumerator enumLast(&last); + while(enumLast.hasMoreElements()) + { + XMLSize_t index=enumLast.nextElement(); + *fFollowList[index] |= first; + } + + // + // And finally the big push... Now we build the DFA using all the states + // and the tree we've built up. First we set up the various data + // structures we are going to use while we do this. + // + // First of all we need an array of unique element ids in our content + // model. For each transition table entry, we need a set of contiguous + // indices to represent the transitions for a particular input element. + // So we need to a zero based range of indexes that map to element types. + // This element map provides that mapping. + // + fElemMap = (QName**) fMemoryManager->allocate + ( + fLeafCount * sizeof(QName*) + ); //new QName*[fLeafCount]; + fElemMapType = (ContentSpecNode::NodeTypes*) fMemoryManager->allocate + ( + fLeafCount * sizeof(ContentSpecNode::NodeTypes) + ); //new ContentSpecNode::NodeTypes[fLeafCount]; + fElemMapSize = 0; + + Occurence** elemOccurenceMap=0; + for (unsigned int outIndex = 0; outIndex < fLeafCount; outIndex++) + { + fElemMap[outIndex] = new (fMemoryManager) QName(fMemoryManager); + + if ( (fLeafListType[outIndex] & 0x0f) != ContentSpecNode::Leaf ) + if (!fLeafNameTypeVector) + fLeafNameTypeVector = new (fMemoryManager) ContentLeafNameTypeVector(fMemoryManager); + + // Get the current leaf's element index + CMLeaf* leaf=fLeafList[outIndex]; + const QName* element = leaf->getElement(); + const XMLCh* elementRawName = 0; + if (fDTD && element) + elementRawName = element->getRawName(); + + // See if the current leaf node's element index is in the list + unsigned int inIndex = 0; + + for (; inIndex < fElemMapSize; inIndex++) + { + const QName* inElem = fElemMap[inIndex]; + if (fDTD) { + if (XMLString::equals(inElem->getRawName(), elementRawName)) { + break; + } + } + else { + if ((fElemMapType[inIndex] == fLeafListType[outIndex]) && + (inElem->getURI() == element->getURI()) && + (XMLString::equals(inElem->getLocalPart(), element->getLocalPart()))) { + break; + } + } + } + + // If it was not in the list, then add it and bump the map size + if (inIndex == fElemMapSize) + { + fElemMap[fElemMapSize]->setValues(*element); + if(leaf->isRepeatableLeaf()) + { + if (elemOccurenceMap == 0) { + elemOccurenceMap = (Occurence**)fMemoryManager->allocate(fLeafCount*sizeof(Occurence*)); + memset(elemOccurenceMap, 0, fLeafCount*sizeof(Occurence*)); + } + elemOccurenceMap[fElemMapSize] = new (fMemoryManager) Occurence(((CMRepeatingLeaf*)leaf)->getMinOccurs(), ((CMRepeatingLeaf*)leaf)->getMaxOccurs(), fElemMapSize); + } + fElemMapType[fElemMapSize] = fLeafListType[outIndex]; + ++fElemMapSize; + } + } + + // set up the fLeafNameTypeVector object if there is one. + if (fLeafNameTypeVector) { + fLeafNameTypeVector->setValues(fElemMap, fElemMapType, fElemMapSize); + } + + /*** + * Optimization(Jan, 2001); We sort fLeafList according to + * elemIndex which is *uniquely* associated to each leaf. + * We are *assuming* that each element appears in at least one leaf. + **/ + // don't forget to delete it +#ifdef OPTIMIZED_BUT_STILL_LINEAR_SEARCH + int *fLeafSorter = (int*) fMemoryManager->allocate + ( + (fLeafCount + fElemMapSize) * sizeof(int) + ); //new int[fLeafCount + fElemMapSize]; + unsigned int fSortCount = 0; + + for (unsigned int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) + { + const QName* element = fElemMap[elemIndex]; + const XMLCh* elementRawName = 0; + if (fDTD && element) + elementRawName = element->getRawName(); + + for (unsigned int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) + { + const QName* leaf = fLeafList[leafIndex]->getElement(); + if (fDTD) { + if (XMLString::equals(leaf->getRawName(), elementRawName)) { + fLeafSorter[fSortCount++] = leafIndex; + } + } + else { + if ((fElemMapType[elemIndex] == fLeafListType[leafIndex]) && + (leaf->getURI() == element->getURI()) && + (XMLString::equals(leaf->getLocalPart(), element->getLocalPart()))) { + fLeafSorter[fSortCount++] = leafIndex; + } + } + } + fLeafSorter[fSortCount++] = -1; + } +#endif + + // instead of using a single array with -1 to separate elements, use a bidimensional map + unsigned int** fLeafSorter = (unsigned int**)fMemoryManager->allocate(fElemMapSize * sizeof(unsigned int*)); + unsigned int* tmpSorter = (unsigned int*)fMemoryManager->allocate(fLeafCount * sizeof(unsigned int)); + for (unsigned int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) + { + const QName* element = fElemMap[elemIndex]; + const XMLCh* elementRawName = 0; + if (fDTD && element) + elementRawName = element->getRawName(); + + unsigned int fSortCount=0; + for (unsigned int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) + { + const QName* leaf = fLeafList[leafIndex]->getElement(); + if (fDTD) { + if (XMLString::equals(leaf->getRawName(), elementRawName)) { + tmpSorter[fSortCount++] = leafIndex; + } + } + else { + if ((fElemMapType[elemIndex] == fLeafListType[leafIndex]) && + (leaf->getURI() == element->getURI()) && + (XMLString::equals(leaf->getLocalPart(), element->getLocalPart()))) { + tmpSorter[fSortCount++] = leafIndex; + } + } + } + + fLeafSorter[elemIndex]=(unsigned int*)fMemoryManager->allocate((fSortCount+1) * sizeof(unsigned int)); + fLeafSorter[elemIndex][0]=fSortCount; + for (unsigned int index=0;indexdeallocate(tmpSorter); + + // + // Next lets create some arrays, some that that hold transient info + // during the DFA build and some that are permament. These are kind of + // sticky since we cannot know how big they will get, but we don't want + // to use any collection type classes because of performance. + // + // Basically they will probably be about fLeafCount*2 on average, but can + // be as large as 2^(fLeafCount*2), worst case. So we start with + // fLeafCount*4 as a middle ground. This will be very unlikely to ever + // have to expand though, it if does, the overhead will be somewhat ugly. + // + unsigned int curArraySize = fLeafCount * 4; + CMStateSet** statesToDo = (CMStateSet**) + fMemoryManager->allocate + ( + curArraySize * sizeof(CMStateSet*) + ); //new const CMStateSet*[curArraySize]; + fFinalStateFlags = (bool*) fMemoryManager->allocate + ( + curArraySize * sizeof(bool) + ); //new bool[curArraySize]; + fTransTable = (unsigned int**) fMemoryManager->allocate + ( + curArraySize * sizeof(unsigned int*) + ); //new unsigned int*[curArraySize]; + + // + // Ok we start with the initial set as the first pos set of the head node + // (which is the seq node that holds the content model and the EOC node.) + // + CMStateSet* setT = new (fMemoryManager) CMStateSet(fHeadNode->getFirstPos()); + + // + // Note on memory leak: Bugzilla#2707: + // =================================== + // The CMBinary, pointed to by fHeadNode, shall be released by + // deleted by itself. + // + // fLeafList[] maintains its **OWN** copy of CMLeaf to avoid double deletion + // of CMLeaf. + // + + delete fHeadNode; + + // + // Init our two state flags. Basically the unmarked state counter is + // always chasing the current state counter. When it catches up, that + // means we made a pass through that did not add any new states to the + // lists, at which time we are done. We could have used a expanding array + // of flags which we used to mark off states as we complete them, but + // this is easier though less readable maybe. + // + unsigned int unmarkedState = 0; + unsigned int curState = 0; + + // + // Init the first transition table entry, and put the initial state + // into the states to do list, then bump the current state. + // + fTransTable[curState] = makeDefStateList(); + statesToDo[curState] = setT; + curState++; + + // + // the stateTable is an auxiliary means to fast + // identification of new state created (instead + // of sequential loop statesToDo to find out), + // while the role that statesToDo plays remain unchanged. + // + RefHashTableOf *stateTable = + new (fMemoryManager) RefHashTableOf + ( + curArraySize + , true + , fMemoryManager + ); + //stateTable->put((CMStateSet*)setT, new (fMemoryManager) XMLInteger(0)); + + // + // Ok, almost done with the algorithm from hell... We now enter the + // loop where we go until the states done counter catches up with + // the states to do counter. + // + CMStateSet* newSet = 0; + while (unmarkedState < curState) + { + // + // Get the next unmarked state out of the list of states to do. + // And get the associated transition table entry. + // + setT = statesToDo[unmarkedState]; + unsigned int* transEntry = fTransTable[unmarkedState]; + + // Mark this one final if it contains the EOC state + fFinalStateFlags[unmarkedState] = setT->getBit(fEOCPos); + + // Bump up the unmarked state count, marking this state done + unmarkedState++; + +#ifdef OPTIMIZED_BUT_STILL_LINEAR_SEARCH + // Optimization(Jan, 2001) + unsigned int sorterIndex = 0; + // Optimization(Jan, 2001) +#endif + + // Loop through each possible input symbol in the element map + for (unsigned int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) + { + // + // Build up a set of states which is the union of all of the + // follow sets of DFA positions that are in the current state. If + // we gave away the new set last time through then create a new + // one. Otherwise, zero out the existing one. + // + if (!newSet) + newSet = new (fMemoryManager) CMStateSet + ( + fLeafCount + , fMemoryManager + ); + else + newSet->zeroBits(); + +#ifdef OBSOLETED +// unoptimized code + for (unsigned int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) + { + // If this leaf index (DFA position) is in the current set... + if (setT->getBit(leafIndex)) + { + // + // If this leaf is the current input symbol, then we want + // to add its follow list to the set of states to transition + // to from the current state. + // + const QName* leaf = fLeafList[leafIndex]->getElement(); + const QName* element = fElemMap[elemIndex]; + if (fDTD) { + if (XMLString::equals(leaf->getRawName(), element->getRawName())) { + *newSet |= *fFollowList[leafIndex]; + } + } + else { + if ((leaf->getURI() == element->getURI()) && + (XMLString::equals(leaf->getLocalPart(), element->getLocalPart()))) { + *newSet |= *fFollowList[leafIndex]; + } + } + } + } // for leafIndex +#endif + +#ifdef OPTIMIZED_BUT_STILL_LINEAR_SEARCH + // Optimization(Jan, 2001) + int leafIndex = fLeafSorter[sorterIndex++]; + + while (leafIndex != -1) + { + // If this leaf index (DFA position) is in the current set... + if (setT->getBit(leafIndex)) + { + // + // If this leaf is the current input symbol, then we + // want to add its follow list to the set of states to + // transition to from the current state. + // + *newSet |= *fFollowList[leafIndex]; + } + leafIndex = fLeafSorter[sorterIndex++]; + } // while (leafIndex != -1) +#endif + + unsigned int* fLeafIndexes=fLeafSorter[elemIndex]; + unsigned int fNumItems=fLeafIndexes[0]; + if(fNumItems!=0) + { + // The algorithm requires finding the leaf that is present both in the bitfield of the current state, and in the + // list of places where the currently tested item can appear. When this occurs, the follow list of this parent item + // is added to the bitfield representing the next state. + // Both the bitfield and the list of places are sorted, so we can analyze them in two ways; either iterating over the + // parent items, testing the bitfield for the existence of the parent (N times a constant Tb), or by iterating over the + // bitfield (restricted to the range of the sorted list of places), using a binary search to locate the leaf in the + // sorted list of places (M times log(N) testing operations Ts) + // Assuming that the time to test a bit is roughly the same of the time needed to compute the average of two integers, + // plus a couple of comparisons and additions, we compare N agains M*log(N) to decide which algorithm should be faster given + // the two sets + if(fNumItems <= setT->getBitCountInRange(fLeafIndexes[1], fLeafIndexes[fNumItems])*log((float)fNumItems)) + { + for(unsigned int i=1; i<=fNumItems; ++i) + if(setT->getBit(fLeafIndexes[i])) + { + // + // If this leaf is the current input symbol, then we + // want to add its follow list to the set of states to + // transition to from the current state. + // + *newSet |= *fFollowList[ fLeafIndexes[i] ]; + } + } + else + { + // Further optimization: given that the bitfield enumerator returns the numbers in order, + // every time we raise the lower marker we know it will true also for the next bits, so + // the next binary search will not start from 1 but from this index + unsigned int lowIndex = 1; + // Start the enumerator from the first index in the sorted list of places, + // as nothing before that point will match + CMStateSetEnumerator enumBits(setT, fLeafIndexes[1]); + while(enumBits.hasMoreElements()) + { + unsigned int bitIndex=enumBits.nextElement(); + // if this leaf is greater than the last index in the sorted list of places, + // nothing can be found from now on, so get out of here + if(bitIndex > fLeafIndexes[fNumItems]) + break; + + // Check if this leaf index (DFA position) is in the current set + // (using binary search: the indexes are sorted) + unsigned int first=lowIndex,last=fNumItems,i; + while(first<=last) + { + i=(first+last)/2; + if(fLeafIndexes[i]>bitIndex) + last=i-1; + else if(fLeafIndexes[i]isEmpty()) + { + // + // Search the 'states to do' list to see if this new + // state set is already in there. + // + /*** + unsigned int stateIndex = 0; + for (; stateIndex < curState; stateIndex++) + { + if (*statesToDo[stateIndex] == *newSet) + break; + } + ***/ + + XMLInteger *stateObj = stateTable->get(newSet); + unsigned int stateIndex = (stateObj == 0 ? curState : stateObj->intValue()); + + // If we did not find it, then add it + if (stateIndex == curState) + { + // + // Put this new state into the states to do and init + // a new entry at the same index in the transition + // table. + // + statesToDo[curState] = newSet; + fTransTable[curState] = makeDefStateList(); + stateTable->put + ( + newSet + , new (fMemoryManager) XMLInteger(curState) + ); + + // We now have a new state to do so bump the count + curState++; + + // + // Null out the new set to indicate we adopted it. This + // will cause the creation of a new set on the next time + // around the loop. + // + newSet = 0; + } + + // + // Now set this state in the transition table's entry for this + // element (using its index), with the DFA state we will move + // to from the current state when we see this input element. + // + transEntry[elemIndex] = stateIndex; + + // Expand the arrays if we're full + if (curState == curArraySize) + { + // + // Yikes, we overflowed the initial array size, so we've + // got to expand all of these arrays. So adjust up the + // size by 50% and allocate new arrays. + // + const unsigned int newSize = (unsigned int)(curArraySize * 1.5); + CMStateSet** newToDo = (CMStateSet**) + fMemoryManager->allocate + ( + newSize * sizeof(CMStateSet*) + ); //new const CMStateSet*[newSize]; + bool* newFinalFlags = (bool*) fMemoryManager->allocate + ( + newSize * sizeof(bool) + ); //new bool[newSize]; + unsigned int** newTransTable = (unsigned int**) + fMemoryManager->allocate + ( + newSize * sizeof(unsigned int*) + ); //new unsigned int*[newSize]; + + // Copy over all of the existing content + for (unsigned int expIndex = 0; expIndex < curArraySize; expIndex++) + { + newToDo[expIndex] = statesToDo[expIndex]; + newFinalFlags[expIndex] = fFinalStateFlags[expIndex]; + newTransTable[expIndex] = fTransTable[expIndex]; + } + + // Clean up the old stuff + fMemoryManager->deallocate(statesToDo); //delete [] statesToDo; + fMemoryManager->deallocate(fFinalStateFlags); //delete [] fFinalStateFlags; + fMemoryManager->deallocate(fTransTable); //delete [] fTransTable; + + // Store the new array size and pointers + curArraySize = newSize; + statesToDo = newToDo; + fFinalStateFlags = newFinalFlags; + fTransTable = newTransTable; + } //if (curState == curArraySize) + } //if (!newSet->isEmpty()) + } // for elemIndex + } //while + + // Store the current state count in the trans table size + fTransTableSize = curState; + + // + // Fill in the occurence information for each looping state + // if we're using counters. + // + if (elemOccurenceMap != 0) { + fCountingStates = (Occurence**)fMemoryManager->allocate(fTransTableSize*sizeof(Occurence)); + memset(fCountingStates, 0, fTransTableSize*sizeof(Occurence*)); + for (unsigned int i = 0; i < fTransTableSize; ++i) { + unsigned int * transitions = fTransTable[i]; + for (unsigned int j = 0; j < fElemMapSize; ++j) { + if (i == transitions[j]) { + Occurence* old=elemOccurenceMap[j]; + if(old!=0) + fCountingStates[i] = new (fMemoryManager) Occurence(old->minOccurs, old->maxOccurs, old->elemIndex); + break; + } + } + } + for (unsigned int j = 0; j < fLeafCount; ++j) { + if(elemOccurenceMap[j]!=0) + delete elemOccurenceMap[j]; + } + fMemoryManager->deallocate(elemOccurenceMap); + } + + // If the last temp set was not stored, then clean it up + if (newSet) + delete newSet; + + // + // Now we can clean up all of the temporary data that was needed during + // DFA build. + // + + for (index = 0; index < fLeafCount; index++) + delete fFollowList[index]; + fMemoryManager->deallocate(fFollowList); //delete [] fFollowList; + + // + // removeAll() will delete all data, XMLInteger, + // while the keys are to be deleted by the + // deletion of statesToDo. + // + delete stateTable; + + for (index = 0; index < curState; index++) + delete statesToDo[index]; + fMemoryManager->deallocate(statesToDo); //delete [] statesToDo; + + for (index = 0; index < fLeafCount; index++) + delete fLeafList[index]; + fMemoryManager->deallocate(fLeafList); //delete [] fLeafList; + +#ifdef OPTIMIZED_BUT_STILL_LINEAR_SEARCH + fMemoryManager->deallocate(fLeafSorter); //delete [] fLeafSorter; +#endif + for (index=0; index < fElemMapSize; index++) + fMemoryManager->deallocate(fLeafSorter[index]); + fMemoryManager->deallocate(fLeafSorter); +} + +unsigned int DFAContentModel::countLeafNodes(ContentSpecNode* const curNode) +{ + unsigned int count = 0; + + // Get the spec type of the passed node + const ContentSpecNode::NodeTypes curType = curNode->getType(); + + if ((curType & 0x0f) == ContentSpecNode::Any + || (curType & 0x0f) == ContentSpecNode::Any_Other + || (curType & 0x0f) == ContentSpecNode::Any_NS + || curType == ContentSpecNode::Leaf + || curType == ContentSpecNode::Loop) + { + count++; + } + else + { + // + // Its not a leaf, so we have to recurse its left and maybe right + // nodes. Save both values before we recurse and trash the node. + // + ContentSpecNode* leftNode = curNode->getFirst(); + ContentSpecNode* rightNode = curNode->getSecond(); + + // Detect if we have a deep tree that can be analyzed using a loop instead of recursion + unsigned int nLoopCount=0; + ContentSpecNode* cursor=curNode; + while(cursor->getType()==ContentSpecNode::Sequence && cursor->getFirst() && cursor->getFirst()->getSecond()==rightNode) + { + nLoopCount++; + cursor=cursor->getFirst(); + } + if(nLoopCount!=0) + { + count += countLeafNodes(cursor); + for(unsigned int i=0;igetType(); + + if ((curType & 0x0f) == ContentSpecNode::Any + || (curType & 0x0f) == ContentSpecNode::Any_Other + || (curType & 0x0f) == ContentSpecNode::Any_NS) + { + retNode = new (fMemoryManager) CMAny + ( + curType + , curNode->getElement()->getURI() + , curIndex + , fLeafCount + , fMemoryManager + ); + fLeafList[curIndex] = new (fMemoryManager) CMLeaf + ( + new (fMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , curNode->getElement()->getURI() + , fMemoryManager + ) + , curIndex + , true + , fLeafCount + , fMemoryManager + ); + fLeafListType[curIndex] = curType; + ++curIndex; + } + else if (curType == ContentSpecNode::Leaf) + { + // + // Create a new leaf node, and pass it the current leaf count, which + // is its DFA state position. Bump the leaf count after storing it. + // This makes the positions zero based since we store first and then + // increment. + // + retNode = new (fMemoryManager) CMLeaf + ( + curNode->getElement() + , curIndex + , fLeafCount + , fMemoryManager + ); + fLeafList[curIndex] = new (fMemoryManager) CMLeaf + ( + curNode->getElement() + , curIndex + , fLeafCount + , fMemoryManager + ); + fLeafListType[curIndex] = ContentSpecNode::Leaf; + ++curIndex; + } + else if (curType == ContentSpecNode::Loop) + { + // + // Create a new leaf node, and pass it the current leaf count, which + // is its DFA state position. Bump the leaf count after storing it. + // This makes the positions zero based since we store first and then + // increment. + // + retNode = new (fMemoryManager) CMRepeatingLeaf + ( + curNode->getFirst()->getElement() + , curNode->getMinOccurs() + , curNode->getMaxOccurs() + , curIndex + , fLeafCount + , fMemoryManager + ); + fLeafList[curIndex] = new (fMemoryManager) CMRepeatingLeaf + ( + curNode->getFirst()->getElement() + , curNode->getMinOccurs() + , curNode->getMaxOccurs() + , curIndex + , fLeafCount + , fMemoryManager + ); + fLeafListType[curIndex] = curNode->getFirst()->getType(); + ++curIndex; + } + else + { + // + // Its not a leaf, so we have to recurse its left and maybe right + // nodes. Save both values before we recurse and trash the node. + // + ContentSpecNode* leftNode = curNode->getFirst(); + ContentSpecNode* rightNode = curNode->getSecond(); + + // Detect if we have a deep tree that can be analyzed using a loop instead of recursion + unsigned int nLoopCount=0; + ContentSpecNode* cursor=curNode; + while(cursor->getType()==ContentSpecNode::Sequence && cursor->getFirst() && cursor->getFirst()->getSecond()==rightNode) + { + nLoopCount++; + cursor=cursor->getFirst(); + } + if(nLoopCount!=0) + { + retNode = buildSyntaxTree(cursor, curIndex); + for(unsigned int i=0;igetLastPos(); + const CMStateSet& first = newRight->getFirstPos(); + + // + // Now, for every position which is in our left child's last set + // add all of the states in our right child's first set to the + // follow set for that position. + // + CMStateSetEnumerator enumLast(&last); + while(enumLast.hasMoreElements()) + { + XMLSize_t index=enumLast.nextElement(); + *fFollowList[index] |= first; + } + retNode = new (fMemoryManager) CMBinaryOp + ( + ContentSpecNode::Sequence + , retNode + , newRight + , fLeafCount + , fMemoryManager + ); + } + return retNode; + } + + if (((curType & 0x0f) == ContentSpecNode::Choice) + || ((curType & 0x0f) == ContentSpecNode::Sequence)) + { + // + // Recurse on both children, and return a binary op node with the + // two created sub nodes as its children. The node type is the + // same type as the source. + // + CMNode* newLeft = buildSyntaxTree(leftNode, curIndex); + CMNode* newRight = buildSyntaxTree(rightNode, curIndex); + if(((curType & 0x0f) == ContentSpecNode::Sequence)) + { + // + // Now handle our level. We use our left child's last pos set and our + // right child's first pos set, so get them now for convenience. + // + const CMStateSet& last = newLeft->getLastPos(); + const CMStateSet& first = newRight->getFirstPos(); + + // + // Now, for every position which is in our left child's last set + // add all of the states in our right child's first set to the + // follow set for that position. + // + CMStateSetEnumerator enumLast(&last); + while(enumLast.hasMoreElements()) + { + XMLSize_t index=enumLast.nextElement(); + *fFollowList[index] |= first; + } + } + retNode = new (fMemoryManager) CMBinaryOp + ( + curType + , newLeft + , newRight + , fLeafCount + , fMemoryManager + ); + } + else if (curType == ContentSpecNode::ZeroOrMore + || curType == ContentSpecNode::ZeroOrOne + || curType == ContentSpecNode::OneOrMore) + { + CMNode* newChild = buildSyntaxTree(leftNode, curIndex); + if (curType == ContentSpecNode::ZeroOrMore + || curType == ContentSpecNode::OneOrMore) + { + // + // Now handle our level. We use our own first and last position + // sets, so get them up front. + // + const CMStateSet& first = newChild->getFirstPos(); + const CMStateSet& last = newChild->getLastPos(); + + // + // For every position which is in our last position set, add all + // of our first position states to the follow set for that + // position. + // + CMStateSetEnumerator enumLast(&last); + while(enumLast.hasMoreElements()) + { + XMLSize_t index=enumLast.nextElement(); + *fFollowList[index] |= first; + } + } + // This one is fine as is, just change to our form + retNode = new (fMemoryManager) CMUnaryOp + ( + curType + , newChild + , fLeafCount + , fMemoryManager + ); + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + } + } + // fault in the first and last pos, then delete it children + retNode->getFirstPos(); + retNode->getLastPos(); + retNode->orphanChild(); + return retNode; +} + +// +// gInvalidTrans is used to represent bad transitions in the transition table +// entry for each state. So each entry is initialized to that value. This +// method creates a new entry and initializes it. +// +unsigned int* DFAContentModel::makeDefStateList() const +{ + unsigned int* retArray = (unsigned int*) fMemoryManager->allocate + ( + fElemMapSize * sizeof(unsigned int) + ); //new unsigned int[fElemMapSize]; + for (unsigned int index = 0; index < fElemMapSize; index++) + retArray[index] = XMLContentModel::gInvalidTrans; + return retArray; +} + +ContentLeafNameTypeVector* DFAContentModel::getContentLeafNameTypeVector() const +{ + //later change it to return the data member + return fLeafNameTypeVector; +} + +void DFAContentModel::checkUniqueParticleAttribution (SchemaGrammar* const pGrammar, + GrammarResolver* const pGrammarResolver, + XMLStringPool* const pStringPool, + XMLValidator* const pValidator, + unsigned int* const pContentSpecOrgURI, + const XMLCh* pComplexTypeName /*= 0*/) +{ + + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + unsigned int i, j, k; + + // Rename the URI back + for (i = 0; i < fElemMapSize; i++) { + + unsigned int orgURIIndex = fElemMap[i]->getURI(); + + if ((orgURIIndex != XMLContentModel::gEOCFakeId) && + (orgURIIndex != XMLContentModel::gEpsilonFakeId) && + (orgURIIndex != XMLElementDecl::fgInvalidElemId) && + (orgURIIndex != XMLElementDecl::fgPCDataElemId)) { + fElemMap[i]->setURI(pContentSpecOrgURI[orgURIIndex]); + } + } + + // Unique Particle Attribution + // Store the conflict results between any two elements in fElemMap + // 0 - not yet tested, 1 - conflict, (-1) - no conflict + signed char** conflictTable = (signed char**) fMemoryManager->allocate + ( + fElemMapSize * sizeof(signed char*) + ); + + // initialize the conflict table + for (j = 0; j < fElemMapSize; j++) { + conflictTable[j] = (signed char*) fMemoryManager->allocate + ( + fElemMapSize * sizeof(signed char) + ); + memset(conflictTable[j], 0, fElemMapSize*sizeof(signed char)); + } + + // for each state, check whether it has overlap transitions + for (i = 0; i < fTransTableSize; i++) { + for (j = 0; j < fElemMapSize; j++) { + for (k = j+1; k < fElemMapSize; k++) { + if (fTransTable[i][j] != XMLContentModel::gInvalidTrans && + fTransTable[i][k] != XMLContentModel::gInvalidTrans && + conflictTable[j][k] == 0) { + + // If this is text in a Schema mixed content model, skip it. + if ( fIsMixed && + (( fElemMap[j]->getURI() == XMLElementDecl::fgPCDataElemId) || + ( fElemMap[k]->getURI() == XMLElementDecl::fgPCDataElemId))) + continue; + + if (XercesElementWildcard::conflict(pGrammar, + fElemMapType[j], + fElemMap[j], + fElemMapType[k], + fElemMap[k], + &comparator)) { + if (fCountingStates != 0) { + Occurence* o = fCountingStates[i]; + // If "i" is a counting state and exactly one of the transitions + // loops back to "i" then the two particles do not overlap if + // minOccurs == maxOccurs. + if (o != 0 && + ((fTransTable[i][j] == i) ^ (fTransTable[i][k] == i)) && + o->minOccurs == o->maxOccurs) { + conflictTable[j][k] = -1; + continue; + } + } + conflictTable[j][k] = 1; + + XMLBuffer buf1(1023, fMemoryManager); + if (((fElemMapType[j] & 0x0f) == ContentSpecNode::Any) || + ((fElemMapType[j] & 0x0f) == ContentSpecNode::Any_NS)) + buf1.set(SchemaSymbols::fgATTVAL_TWOPOUNDANY); + else if ((fElemMapType[j] & 0x0f) == ContentSpecNode::Any_Other) + buf1.set(SchemaSymbols::fgATTVAL_TWOPOUNDOTHER); + else + buf1.set(fElemMap[j]->getRawName()); + + XMLBuffer buf2(1023, fMemoryManager); + if (((fElemMapType[k] & 0x0f) == ContentSpecNode::Any) || + ((fElemMapType[k] & 0x0f) == ContentSpecNode::Any_NS)) + buf2.set(SchemaSymbols::fgATTVAL_TWOPOUNDANY); + else if ((fElemMapType[k] & 0x0f) == ContentSpecNode::Any_Other) + buf2.set(SchemaSymbols::fgATTVAL_TWOPOUNDOTHER); + else + buf2.set(fElemMap[k]->getRawName()); + + pValidator->emitError(XMLValid::UniqueParticleAttributionFail, + pComplexTypeName, + buf1.getRawBuffer(), + buf2.getRawBuffer()); + } + else + conflictTable[j][k] = -1; + } + } + } + } + + for (i = 0; i < fElemMapSize; i++) + fMemoryManager->deallocate(conflictTable[i]); + fMemoryManager->deallocate(conflictTable); +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.hpp b/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.hpp new file mode 100644 index 000000000..dcb583d81 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/DFAContentModel.hpp @@ -0,0 +1,274 @@ +/* + * 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: DFAContentModel.hpp 677705 2008-07-17 20:15:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DFACONTENTMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_DFACONTENTMODEL_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; +class CMLeaf; +class CMRepeatingLeaf; +class CMNode; +class CMStateSet; + +// +// DFAContentModel is the heavy weight derivative of ContentModel that does +// all of the non-trivial element content validation. This guy does the full +// bore regular expression to DFA conversion to create a DFA that it then +// uses in its validation algorithm. +// +// NOTE: Upstream work insures that this guy will never see a content model +// with PCDATA in it. Any model with PCDATA is 'mixed' and is handled +// via the MixedContentModel class, since mixed models are very +// constrained in form and easily handled via a special case. This +// also makes our life much easier here. +// +class DFAContentModel : public XMLContentModel +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + DFAContentModel + ( + const bool dtd + , ContentSpecNode* const elemContentSpec + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DFAContentModel + ( + const bool dtd + , ContentSpecNode* const elemContentSpec + , const bool isMixed + , MemoryManager* const manager + ); + + virtual ~DFAContentModel(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual content model interface + // ----------------------------------------------------------------------- + virtual bool validateContent + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual bool validateContentSpecial + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName = 0 + ) ; + + virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ; + + virtual unsigned int getNextState(unsigned int currentState, + XMLSize_t elementIndex) const; + + virtual bool handleRepetitions( const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elementIndex, + SubstitutionGroupComparator * comparator) const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DFAContentModel(); + DFAContentModel(const DFAContentModel&); + DFAContentModel& operator=(const DFAContentModel&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void buildDFA(ContentSpecNode* const curNode); + CMNode* buildSyntaxTree(ContentSpecNode* const curNode, unsigned int& curIndex); + unsigned int* makeDefStateList() const; + unsigned int countLeafNodes(ContentSpecNode* const curNode); + + class Occurence : public XMemory + { + public: + Occurence(int minOcc, int maxOcc, int eltIndex); + + int minOccurs; + int maxOccurs; + int elemIndex; + }; + + // ----------------------------------------------------------------------- + // Private data members + // + // fElemMap + // fElemMapSize + // This is the map of unique input symbol elements to indices into + // each state's per-input symbol transition table entry. This is part + // of the built DFA information that must be kept around to do the + // actual validation. + // + // fElemMapType + // This is a map of whether the element map contains information + // related to ANY models. + // + // fEmptyOk + // This is an optimization. While building the transition table we + // can see whether this content model would approve of an empty + // content (which could happen if everything was optional.) So we + // set this flag and short circuit that check, which would otherwise + // be ugly and time consuming if we tried to determine it at each + // validation call. + // + // fEOCPos + // The NFA position of the special EOC (end of content) node. This + // is saved away since its used during the DFA build. + // + // fFinalStateFlags + // This is an array of booleans, one per state (there are + // fTransTableSize states in the DFA) that indicates whether that + // state is a final state. + // + // fFollowList + // The list of follow positions for each NFA position (i.e. for each + // non-epsilon leaf node.) This is only used during the building of + // the DFA, and is let go afterwards. + // + // fHeadNode + // This is the head node of our intermediate representation. It is + // only non-null during the building of the DFA (just so that it + // does not have to be passed all around.) Once the DFA is built, + // this is no longer required so its deleted. + // + // fLeafCount + // The count of leaf nodes. This is an important number that set some + // limits on the sizes of data structures in the DFA process. + // + // fLeafList + // An array of non-epsilon leaf nodes, which is used during the DFA + // build operation, then dropped. These are just references to nodes + // pointed to by fHeadNode, so we don't have to clean them up, just + // the actually leaf list array itself needs cleanup. + // + // fLeafListType + // Array mapping ANY types to the leaf list. + // + // fTransTable + // fTransTableSize + // This is the transition table that is the main by product of all + // of the effort here. It is an array of arrays of ints. The first + // dimension is the number of states we end up with in the DFA. The + // second dimensions is the number of unique elements in the content + // model (fElemMapSize). Each entry in the second dimension indicates + // the new state given that input for the first dimension's start + // state. + // + // The fElemMap array handles mapping from element indexes to + // positions in the second dimension of the transition table. + // + // fTransTableSize is the number of valid entries in the transition + // table, and in the other related tables such as fFinalStateFlags. + // + // fCountingStates + // This is the table holding the minOccurs/maxOccurs for elements + // that can be repeated a finite number of times. + // + // fDTD + // Boolean to allow DTDs to validate even with namespace support. + // + // fIsMixed + // DFA ContentModel with mixed PCDATA. + // ----------------------------------------------------------------------- + QName** fElemMap; + ContentSpecNode::NodeTypes* fElemMapType; + unsigned int fElemMapSize; + bool fEmptyOk; + unsigned int fEOCPos; + bool* fFinalStateFlags; + CMStateSet** fFollowList; + CMNode* fHeadNode; + unsigned int fLeafCount; + CMLeaf** fLeafList; + ContentSpecNode::NodeTypes* fLeafListType; + unsigned int** fTransTable; + unsigned int fTransTableSize; + Occurence** fCountingStates; + bool fDTD; + bool fIsMixed; + ContentLeafNameTypeVector * fLeafNameTypeVector; + MemoryManager* fMemoryManager; +}; + + +inline unsigned int +DFAContentModel::getNextState(unsigned int currentState, + XMLSize_t elementIndex) const { + + if (currentState == XMLContentModel::gInvalidTrans) { + return XMLContentModel::gInvalidTrans; + } + + if (currentState >= fTransTableSize || elementIndex >= fElemMapSize) { + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex, fMemoryManager); + } + + return fTransTable[currentState][elementIndex]; +} + +inline +DFAContentModel::Occurence::Occurence(int minOcc, int maxOcc, int eltIndex) +{ + minOccurs = minOcc; + maxOccurs = maxOcc; + elemIndex = eltIndex; +} + +XERCES_CPP_NAMESPACE_END + +#endif + diff --git a/project/jni/xerces/src/xercesc/validators/common/Grammar.cpp b/project/jni/xerces/src/xercesc/validators/common/Grammar.cpp new file mode 100644 index 000000000..40bac4a3e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/Grammar.cpp @@ -0,0 +1,84 @@ +/* + * 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: Grammar.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +#include + +//since we need to dynamically created each and every derivatives +//during deserialization by XSerializeEngine>>Derivative, we got +//to include all hpp + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(Grammar) + +void Grammar::serialize(XSerializeEngine&) +{ + //no data +} + +void Grammar::storeGrammar(XSerializeEngine& serEng + , Grammar* const grammar) +{ + if (grammar) + { + serEng<<(int) grammar->getGrammarType(); + serEng<>type; + + switch((GrammarType)type) + { + case DTDGrammarType: + DTDGrammar* dtdGrammar; + serEng>>dtdGrammar; + return dtdGrammar; + case SchemaGrammarType: + SchemaGrammar* schemaGrammar; + serEng>>schemaGrammar; + return schemaGrammar; + case UnKnown: + return 0; + default: //we treat this same as UnKnown + return 0; + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/Grammar.hpp b/project/jni/xerces/src/xercesc/validators/common/Grammar.hpp new file mode 100644 index 000000000..bf73c4757 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/Grammar.hpp @@ -0,0 +1,204 @@ +/* + * 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: Grammar.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_GRAMMAR_HPP) +#define XERCESC_INCLUDE_GUARD_GRAMMAR_HPP + +#include + +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLGrammarDescription; + +// +// This abstract class specifies the interface for a Grammar +// + +class VALIDATORS_EXPORT Grammar : public XSerializable, public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Class Specific Types + // + // DTDGrammarType - Indicate this Grammar is built from a DTD. + // SchemaGrammarType - Indicate this Grammar is built from a Schema. + // + // TOP_LEVEL_SCOPE - outermost scope level (i.e. global) of a declaration. + // For DTD, all element decls and attribute decls always + // have TOP_LEVEL_SCOPE. For schema, it may vary if + // it is inside a complex type. + // + // UNKNOWN_SCOPE - unknown scope level. None of the decls should have this. + // + // ----------------------------------------------------------------------- + enum GrammarType { + DTDGrammarType + , SchemaGrammarType + , UnKnown + }; + + enum { + // These are well-known values that must simply be larger + // than any reasonable scope + UNKNOWN_SCOPE = UINT_MAX - 0 + , TOP_LEVEL_SCOPE = UINT_MAX - 1 + }; + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + virtual ~Grammar(){}; + + // ----------------------------------------------------------------------- + // Virtual Getter methods + // ----------------------------------------------------------------------- + virtual GrammarType getGrammarType() const =0; + virtual const XMLCh* getTargetNamespace() const =0; + virtual bool getValidated() const = 0; + + // Element Decl + + // this method should only be used while the grammar is being + // constructed, not while it is being used + // in a validation episode! + virtual XMLElementDecl* findOrAddElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , bool& wasAdded + ) = 0; + + virtual XMLSize_t getElemId + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const = 0; + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const = 0; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) = 0; + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ) const = 0; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ) = 0; + + // Notation + virtual const XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + ) const=0; + + virtual XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + )=0; + + // ----------------------------------------------------------------------- + // Virtual Setter methods + // ----------------------------------------------------------------------- + virtual XMLElementDecl* putElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , const bool notDeclared = false + ) = 0; + + virtual XMLSize_t putElemDecl + ( + XMLElementDecl* const elemDecl + , const bool notDeclared = false + ) = 0; + + virtual XMLSize_t putNotationDecl + ( + XMLNotationDecl* const notationDecl + ) const=0; + + virtual void setValidated(const bool newState) = 0; + + // ----------------------------------------------------------------------- + // Virtual methods + // ----------------------------------------------------------------------- + virtual void reset()=0; + + virtual void setGrammarDescription( XMLGrammarDescription*) = 0; + virtual XMLGrammarDescription* getGrammarDescription() const = 0; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(Grammar) + + static void storeGrammar(XSerializeEngine& serEng + , Grammar* const grammar); + + static Grammar* loadGrammar(XSerializeEngine& serEng); + +protected : + // ----------------------------------------------------------------------- + // Hidden constructors + // ----------------------------------------------------------------------- + Grammar(){}; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Grammar(const Grammar&); + Grammar& operator=(const Grammar&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.cpp b/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.cpp new file mode 100644 index 000000000..94ec102c7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.cpp @@ -0,0 +1,445 @@ +/* + * 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 $ + */ + +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// GrammarResolver: Constructor and Destructor +// --------------------------------------------------------------------------- +GrammarResolver::GrammarResolver(XMLGrammarPool* const gramPool + , MemoryManager* const manager) +:fCacheGrammar(false) +,fUseCachedGrammar(false) +,fGrammarPoolFromExternalApplication(true) +,fStringPool(0) +,fGrammarBucket(0) +,fGrammarFromPool(0) +,fDataTypeReg(0) +,fMemoryManager(manager) +,fGrammarPool(gramPool) +,fXSModel(0) +,fGrammarPoolXSModel(0) +,fGrammarsToAddToXSModel(0) +{ + fGrammarBucket = new (manager) RefHashTableOf(29, true, manager); + + /*** + * Grammars in this set are not owned + */ + fGrammarFromPool = new (manager) RefHashTableOf(29, false, manager); + + if (!gramPool) + { + /*** + * We need to instantiate a default grammar pool object so that + * all grammars and grammar components could be created through + * the Factory methods + */ + fGrammarPool = new (manager) XMLGrammarPoolImpl(manager); + fGrammarPoolFromExternalApplication=false; + } + fStringPool = fGrammarPool->getURIStringPool(); + + // REVISIT: size + fGrammarsToAddToXSModel = new (manager) ValueVectorOf (29, manager); +} + +GrammarResolver::~GrammarResolver() +{ + delete fGrammarBucket; + delete fGrammarFromPool; + + if (fDataTypeReg) + delete fDataTypeReg; + + /*** + * delete the grammar pool iff it is created by this resolver + */ + if (!fGrammarPoolFromExternalApplication) + delete fGrammarPool; + + if (fXSModel) + delete fXSModel; + // don't delete fGrammarPoolXSModel! we don't own it! + delete fGrammarsToAddToXSModel; +} + +// --------------------------------------------------------------------------- +// GrammarResolver: Getter methods +// --------------------------------------------------------------------------- +DatatypeValidator* +GrammarResolver::getDatatypeValidator(const XMLCh* const uriStr, + const XMLCh* const localPartStr) { + + DatatypeValidator* dv = 0; + + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + if (!fDataTypeReg) { + + fDataTypeReg = new (fMemoryManager) DatatypeValidatorFactory(fMemoryManager); + } + + dv = fDataTypeReg->getDatatypeValidator(localPartStr); + } + else { + + Grammar* grammar = getGrammar(uriStr); + + if (grammar && grammar->getGrammarType() == Grammar::SchemaGrammarType) { + + XMLBuffer nameBuf(128, fMemoryManager); + + nameBuf.set(uriStr); + nameBuf.append(chComma); + nameBuf.append(localPartStr); + + dv = ((SchemaGrammar*) grammar)->getDatatypeRegistry()->getDatatypeValidator(nameBuf.getRawBuffer()); + } + } + + return dv; +} + +Grammar* GrammarResolver::getGrammar( const XMLCh* const namespaceKey) +{ + if (!namespaceKey) + return 0; + + Grammar* grammar = fGrammarBucket->get(namespaceKey); + + if (grammar) + return grammar; + + if (fUseCachedGrammar) + { + grammar = fGrammarFromPool->get(namespaceKey); + if (grammar) + { + return grammar; + } + else + { + XMLSchemaDescription* gramDesc = fGrammarPool->createSchemaDescription(namespaceKey); + Janitor janName(gramDesc); + grammar = fGrammarPool->retrieveGrammar(gramDesc); + if (grammar) + { + fGrammarFromPool->put((void*) grammar->getGrammarDescription()->getGrammarKey(), grammar); + } + return grammar; + } + } + + return 0; +} + +Grammar* GrammarResolver::getGrammar( XMLGrammarDescription* const gramDesc) +{ + if (!gramDesc) + return 0; + + Grammar* grammar = fGrammarBucket->get(gramDesc->getGrammarKey()); + + if (grammar) + return grammar; + + if (fUseCachedGrammar) + { + grammar = fGrammarFromPool->get(gramDesc->getGrammarKey()); + if (grammar) + { + return grammar; + } + else + { + grammar = fGrammarPool->retrieveGrammar(gramDesc); + if (grammar) + { + fGrammarFromPool->put((void*) grammar->getGrammarDescription()->getGrammarKey(), grammar); + } + return grammar; + } + } + + return 0; +} + +RefHashTableOfEnumerator +GrammarResolver::getGrammarEnumerator() const +{ + return RefHashTableOfEnumerator(fGrammarBucket, false, fMemoryManager); +} + +RefHashTableOfEnumerator +GrammarResolver::getReferencedGrammarEnumerator() const +{ + return RefHashTableOfEnumerator(fGrammarFromPool, false, fMemoryManager); +} + +RefHashTableOfEnumerator +GrammarResolver::getCachedGrammarEnumerator() const +{ + return fGrammarPool->getGrammarEnumerator(); +} + +bool GrammarResolver::containsNameSpace( const XMLCh* const nameSpaceKey ) +{ + if (!nameSpaceKey) + return false; + if (fGrammarBucket->containsKey(nameSpaceKey)) + return true; + if (fUseCachedGrammar) + { + if (fGrammarFromPool->containsKey(nameSpaceKey)) + return true; + + // Lastly, need to check in fGrammarPool + XMLSchemaDescription* gramDesc = fGrammarPool->createSchemaDescription(nameSpaceKey); + Janitor janName(gramDesc); + Grammar* grammar = fGrammarPool->retrieveGrammar(gramDesc); + if (grammar) + return true; + } + + return false; +} + +void GrammarResolver::putGrammar(Grammar* const grammarToAdopt) +{ + if (!grammarToAdopt) + return; + + /*** + * the grammar will be either in the grammarpool, or in the grammarbucket + */ + if (!fCacheGrammar || !fGrammarPool->cacheGrammar(grammarToAdopt)) + { + // either we aren't caching or the grammar pool doesn't want it + // so we need to look after it + fGrammarBucket->put( (void*) grammarToAdopt->getGrammarDescription()->getGrammarKey(), grammarToAdopt ); + if (grammarToAdopt->getGrammarType() == Grammar::SchemaGrammarType) + { + fGrammarsToAddToXSModel->addElement((SchemaGrammar*) grammarToAdopt); + } + } +} + +// --------------------------------------------------------------------------- +// GrammarResolver: methods +// --------------------------------------------------------------------------- +void GrammarResolver::reset() { + fGrammarBucket->removeAll(); + fGrammarsToAddToXSModel->removeAllElements(); + delete fXSModel; + fXSModel = 0; +} + +void GrammarResolver::resetCachedGrammar() +{ + //REVISIT: if the pool is locked this will fail... should throw an exception? + fGrammarPool->clear(); + // Even though fXSModel and fGrammarPoolXSModel will be invalid don't touch + // them here as getXSModel will handle this. + + //to clear all other references to the grammars just deleted from fGrammarPool + fGrammarFromPool->removeAll(); + +} + +void GrammarResolver::cacheGrammars() +{ + RefHashTableOfEnumerator grammarEnum(fGrammarBucket, false, fMemoryManager); + ValueVectorOf keys(8, fMemoryManager); + unsigned int keyCount = 0; + + // Build key set + while (grammarEnum.hasMoreElements()) + { + XMLCh* grammarKey = (XMLCh*) grammarEnum.nextElementKey(); + keys.addElement(grammarKey); + keyCount++; + } + + // PSVI: assume everything will be added, if caching fails add grammar back + // into vector + fGrammarsToAddToXSModel->removeAllElements(); + + // Cache + for (unsigned int i = 0; i < keyCount; i++) + { + XMLCh* grammarKey = keys.elementAt(i); + + /*** + * It is up to the GrammarPool implementation to handle duplicated grammar + */ + Grammar* grammar = fGrammarBucket->get(grammarKey); + if(fGrammarPool->cacheGrammar(grammar)) + { + // only orphan grammar if grammar pool accepts caching of it + fGrammarBucket->orphanKey(grammarKey); + } + else if (grammar->getGrammarType() == Grammar::SchemaGrammarType) + { + // add it back to list of grammars not in grammar pool + fGrammarsToAddToXSModel->addElement((SchemaGrammar*) grammar); + } + } + +} + +// --------------------------------------------------------------------------- +// GrammarResolver: Setter methods +// --------------------------------------------------------------------------- +void GrammarResolver::cacheGrammarFromParse(const bool aValue) +{ + reset(); + fCacheGrammar = aValue; +} + +Grammar* GrammarResolver::orphanGrammar(const XMLCh* const nameSpaceKey) +{ + if (fCacheGrammar) + { + Grammar* grammar = fGrammarPool->orphanGrammar(nameSpaceKey); + if (grammar) + { + if (fGrammarFromPool->containsKey(nameSpaceKey)) + fGrammarFromPool->removeKey(nameSpaceKey); + } + // Check to see if it's in fGrammarBucket, since + // we put it there if the grammar pool refused to + // cache it. + else if (fGrammarBucket->containsKey(nameSpaceKey)) + { + grammar = fGrammarBucket->orphanKey(nameSpaceKey); + } + + return grammar; + } + else + { + return fGrammarBucket->orphanKey(nameSpaceKey); + } +} + +XSModel *GrammarResolver::getXSModel() +{ + XSModel* xsModel; + if (fCacheGrammar || fUseCachedGrammar) + { + // We know if the grammarpool changed thru caching, orphaning and erasing + // but NOT by other mechanisms such as lockPool() or unlockPool() so it + // is safest to always get it. The grammarPool XSModel will only be + // regenerated if something changed. + bool XSModelWasChanged; + // The grammarpool will always return an xsmodel, even if it is just + // the schema for schema xsmodel... + xsModel = fGrammarPool->getXSModel(XSModelWasChanged); + if (XSModelWasChanged) + { + // we know the grammarpool XSModel has changed or this is the + // first call to getXSModel + if (!fGrammarPoolXSModel && (fGrammarsToAddToXSModel->size() == 0) && + !fXSModel) + { + fGrammarPoolXSModel = xsModel; + return fGrammarPoolXSModel; + } + else + { + fGrammarPoolXSModel = xsModel; + // We had previously augmented the grammar pool XSModel + // with our our grammars or we would like to upate it now + // so we have to regenerate the XSModel + fGrammarsToAddToXSModel->removeAllElements(); + RefHashTableOfEnumerator grammarEnum(fGrammarBucket, false, fMemoryManager); + while (grammarEnum.hasMoreElements()) + { + Grammar& grammar = (Grammar&) grammarEnum.nextElement(); + if (grammar.getGrammarType() == Grammar::SchemaGrammarType) + fGrammarsToAddToXSModel->addElement((SchemaGrammar*)&grammar); + } + delete fXSModel; + if (fGrammarsToAddToXSModel->size()) + { + fXSModel = new (fMemoryManager) XSModel(fGrammarPoolXSModel, this, fMemoryManager); + fGrammarsToAddToXSModel->removeAllElements(); + return fXSModel; + } + fXSModel = 0; + return fGrammarPoolXSModel; + } + } + else { + // we know that the grammar pool XSModel is the same as before + if (fGrammarsToAddToXSModel->size()) + { + // we need to update our fXSModel with the new grammars + if (fXSModel) + { + xsModel = new (fMemoryManager) XSModel(fXSModel, this, fMemoryManager); + fXSModel = xsModel; + } + else + { + fXSModel = new (fMemoryManager) XSModel(fGrammarPoolXSModel, this, fMemoryManager); + } + fGrammarsToAddToXSModel->removeAllElements(); + return fXSModel; + } + // Nothing has changed! + if (fXSModel) + { + return fXSModel; + } + else if (fGrammarPoolXSModel) + { + return fGrammarPoolXSModel; + } + fXSModel = new (fMemoryManager) XSModel(0, this, fMemoryManager); + return fXSModel; + } + } + // Not Caching... + if (fGrammarsToAddToXSModel->size()) + { + xsModel = new (fMemoryManager) XSModel(fXSModel, this, fMemoryManager); + fGrammarsToAddToXSModel->removeAllElements(); + fXSModel = xsModel; + } + else if (!fXSModel) + { + // create a new model only if we didn't have one already + fXSModel = new (fMemoryManager) XSModel(0, this, fMemoryManager); + } + return fXSModel; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.hpp b/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.hpp new file mode 100644 index 000000000..6c86eda31 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/GrammarResolver.hpp @@ -0,0 +1,271 @@ +/* + * 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: GrammarResolver.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_GRAMMARRESOLVER_HPP) +#define XERCESC_INCLUDE_GUARD_GRAMMARRESOLVER_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DatatypeValidator; +class DatatypeValidatorFactory; +class XMLGrammarDescription; + +/** + * This class embodies the representation of a Grammar pool Resolver. + * This class is called from the validator. + * + */ + +class VALIDATORS_EXPORT GrammarResolver : public XMemory +{ +public: + + /** @name Constructor and Destructor */ + //@{ + /** + * + * Default Constructor + */ + GrammarResolver( + XMLGrammarPool* const gramPool + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + /** + * Destructor + */ + ~GrammarResolver(); + + //@} + + /** @name Getter methods */ + //@{ + /** + * Retrieve the DatatypeValidator + * + * @param uriStr the namespace URI + * @param typeName the type name + * @return the DatatypeValidator associated with namespace & type name + */ + DatatypeValidator* getDatatypeValidator(const XMLCh* const uriStr, + const XMLCh* const typeName); + + /** + * Retrieve the DatatypeValidatorFactory used for built-in schema types + * + * @return the DatatypeValidator associated with namespace for XMLSchema + */ + DatatypeValidatorFactory* getBuiltinDatatypeValidatorFactory(); + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param gramDesc grammar description for the grammar + * @return Grammar abstraction associated with the grammar description + */ + Grammar* getGrammar( XMLGrammarDescription* const gramDesc ) ; + + /** + * Retrieve the grammar that is associated with the specified namespace key + * + * @param namespaceKey Namespace key into Grammar pool + * @return Grammar abstraction associated with the NameSpace key. + */ + Grammar* getGrammar( const XMLCh* const namespaceKey ) ; + + /** + * Get an enumeration of Grammar in the Grammar pool + * + * @return enumeration of Grammar in Grammar pool + */ + RefHashTableOfEnumerator getGrammarEnumerator() const; + + /** + * Get an enumeration of the referenced Grammars + * + * @return enumeration of referenced Grammars + */ + RefHashTableOfEnumerator getReferencedGrammarEnumerator() const; + + /** + * Get an enumeration of the cached Grammars in the Grammar pool + * + * @return enumeration of the cached Grammars in Grammar pool + */ + RefHashTableOfEnumerator getCachedGrammarEnumerator() const; + + /** + * Get a string pool of schema grammar element/attribute names/prefixes + * (used by TraverseSchema) + * + * @return a string pool of schema grammar element/attribute names/prefixes + */ + XMLStringPool* getStringPool(); + + /** + * Is the specified Namespace key in Grammar pool? + * + * @param nameSpaceKey Namespace key + * @return True if Namespace key association is in the Grammar pool. + */ + bool containsNameSpace( const XMLCh* const nameSpaceKey ); + + inline XMLGrammarPool* getGrammarPool() const; + + inline MemoryManager* getGrammarPoolMemoryManager() const; + + //@} + + /** @name Setter methods */ + //@{ + + /** + * Set the 'Grammar caching' flag + */ + void cacheGrammarFromParse(const bool newState); + + /** + * Set the 'Use cached grammar' flag + */ + void useCachedGrammarInParse(const bool newState); + + //@} + + + /** @name GrammarResolver methods */ + //@{ + /** + * Add the Grammar with Namespace Key associated to the Grammar Pool. + * The Grammar will be owned by the Grammar Pool. + * + * @param grammarToAdopt Grammar abstraction used by validator. + */ + void putGrammar(Grammar* const grammarToAdopt ); + + /** + * Returns the Grammar with Namespace Key associated from the Grammar Pool + * The Key entry is removed from the table (grammar is not deleted if + * adopted - now owned by caller). + * + * @param nameSpaceKey Key to associate with Grammar abstraction + */ + Grammar* orphanGrammar(const XMLCh* const nameSpaceKey); + + /** + * Cache the grammars in fGrammarBucket to fCachedGrammarRegistry. + * If a grammar with the same key is already cached, an exception is + * thrown and none of the grammars will be cached. + */ + void cacheGrammars(); + + /** + * Reset internal Namespace/Grammar registry. + */ + void reset(); + void resetCachedGrammar(); + + /** + * Returns an XSModel, either from the GrammarPool or by creating one + */ + XSModel* getXSModel(); + + + ValueVectorOf* getGrammarsToAddToXSModel(); + + //@} + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + GrammarResolver(const GrammarResolver&); + GrammarResolver& operator=(const GrammarResolver&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fStringPool The string pool used by TraverseSchema to store + // element/attribute names and prefixes. + // Always owned by Grammar pool implementation + // + // fGrammarBucket The parsed Grammar Pool, if no caching option. + // + // fGrammarFromPool Referenced Grammar Set, not owned + // + // fGrammarPool The Grammar Set either plugged or created. + // + // fDataTypeReg DatatypeValidatorFactory registry + // + // fMemoryManager Pluggable memory manager for dynamic memory + // allocation/deallocation + // ----------------------------------------------------------------------- + bool fCacheGrammar; + bool fUseCachedGrammar; + bool fGrammarPoolFromExternalApplication; + XMLStringPool* fStringPool; + RefHashTableOf* fGrammarBucket; + RefHashTableOf* fGrammarFromPool; + DatatypeValidatorFactory* fDataTypeReg; + MemoryManager* fMemoryManager; + XMLGrammarPool* fGrammarPool; + XSModel* fXSModel; + XSModel* fGrammarPoolXSModel; + ValueVectorOf* fGrammarsToAddToXSModel; +}; + +inline XMLStringPool* GrammarResolver::getStringPool() { + + return fStringPool; +} + + +inline void GrammarResolver::useCachedGrammarInParse(const bool aValue) +{ + fUseCachedGrammar = aValue; +} + +inline XMLGrammarPool* GrammarResolver::getGrammarPool() const +{ + return fGrammarPool; +} + +inline MemoryManager* GrammarResolver::getGrammarPoolMemoryManager() const +{ + return fGrammarPool->getMemoryManager(); +} + +inline ValueVectorOf* GrammarResolver::getGrammarsToAddToXSModel() +{ + return fGrammarsToAddToXSModel; +} + +inline DatatypeValidatorFactory* GrammarResolver::getBuiltinDatatypeValidatorFactory() +{ + return fDataTypeReg; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.cpp b/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.cpp new file mode 100644 index 000000000..d5d726e87 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.cpp @@ -0,0 +1,429 @@ +/* + * 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: MixedContentModel.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// MixedContentModel: Constructors and Destructor +// --------------------------------------------------------------------------- +MixedContentModel::MixedContentModel(const bool dtd + , ContentSpecNode* const parentContentSpec + , const bool ordered + , MemoryManager* const manager) : + fCount(0) + , fChildren(0) + , fChildTypes(0) + , fOrdered(ordered) + , fDTD(dtd) + , fMemoryManager(manager) +{ + // + // Create a vector of unsigned ints that will be filled in with the + // ids of the child nodes. It will be expanded as needed but we give + // it an initial capacity of 64 which should be more than enough for + // 99% of the scenarios. + // + ValueVectorOf children(64, fMemoryManager); + ValueVectorOf childTypes(64, fMemoryManager); + + // + // Get the parent element's content spec. This is the head of the tree + // of nodes that describes the content model. We will iterate this + // tree. + // + ContentSpecNode* curNode = parentContentSpec; + if (!curNode) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoParentCSN, fMemoryManager); + + // And now call the private recursive method that iterates the tree + buildChildList(curNode, children, childTypes); + + // + // And now we know how many elements we need in our member list. So + // fill them in. + // + fCount = children.size(); + fChildren = (QName**) fMemoryManager->allocate(fCount * sizeof(QName*)); //new QName*[fCount]; + fChildTypes = (ContentSpecNode::NodeTypes*) fMemoryManager->allocate + ( + fCount * sizeof(ContentSpecNode::NodeTypes) + ); //new ContentSpecNode::NodeTypes[fCount]; + for (XMLSize_t index = 0; index < fCount; index++) { + fChildren[index] = new (fMemoryManager) QName(*children.elementAt(index)); + fChildTypes[index] = childTypes.elementAt(index); + } +} + +MixedContentModel::~MixedContentModel() +{ + for (XMLSize_t index = 0; index < fCount; index++) { + delete fChildren[index]; + } + fMemoryManager->deallocate(fChildren); //delete [] fChildren; + fMemoryManager->deallocate(fChildTypes); //delete [] fChildTypes; +} + + +// --------------------------------------------------------------------------- +// MixedContentModel: Getter methods +// --------------------------------------------------------------------------- +bool MixedContentModel::hasDups() const +{ + // Can't have dups if only one child + if (fCount == 1) + return false; + + for (XMLSize_t index = 0; index < fCount; index++) + { + const QName* curVal = fChildren[index]; + for (XMLSize_t iIndex = 0; iIndex < fCount; iIndex++) + { + if (iIndex == index) + continue; + + if (fDTD) { + if (XMLString::equals(curVal->getRawName(), fChildren[iIndex]->getRawName())) { + return true; + } + } + else { + if ((curVal->getURI() == fChildren[iIndex]->getURI()) && + (XMLString::equals(curVal->getLocalPart(), fChildren[iIndex]->getLocalPart()))) { + return true; + } + } + } + } + return false; +} + + +// --------------------------------------------------------------------------- +// MixedContentModel: Implementation of the ContentModel virtual interface +// --------------------------------------------------------------------------- +// +//Under the XML Schema mixed model, +//the order and number of child elements appearing in an instance +//must agree with +//the order and number of child elements specified in the model. +// +bool +MixedContentModel::validateContent( QName** const children + , XMLSize_t childCount + , unsigned int + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + // must match order + if (fOrdered) { + unsigned int inIndex = 0; + for (unsigned int outIndex = 0; outIndex < childCount; outIndex++) { + + // Get the current child out of the source index + const QName* curChild = children[outIndex]; + + // If its PCDATA, then we just accept that + if (curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + ContentSpecNode::NodeTypes type = fChildTypes[inIndex]; + const QName* inChild = fChildren[inIndex]; + + if (type == ContentSpecNode::Leaf) { + if (fDTD) { + if (!XMLString::equals(inChild->getRawName(), curChild->getRawName())) { + *indexFailingChild=outIndex; + return false; + } + } + else { + if ((inChild->getURI() != curChild->getURI()) || + (!XMLString::equals(inChild->getLocalPart(), curChild->getLocalPart()))) { + *indexFailingChild=outIndex; + return false; + } + } + } + else if (type == ContentSpecNode::Any) { + } + else if (type == ContentSpecNode::Any_NS) { + if (inChild->getURI() != curChild->getURI()) + { + *indexFailingChild=outIndex; + return false; + } + } + else if (type == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curChild->getURI(); + if (uriId == 1 || uriId == inChild->getURI()) + { + *indexFailingChild=outIndex; + return false; + } + } + + // advance index + inIndex++; + } + } + + // can appear in any order + else { + for (unsigned int outIndex = 0; outIndex < childCount; outIndex++) { + // Get the current child out of the source index + const QName* curChild = children[outIndex]; + + // If its PCDATA, then we just accept that + if (curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + // And try to find it in our list + unsigned int inIndex = 0; + for (; inIndex < fCount; inIndex++) + { + ContentSpecNode::NodeTypes type = fChildTypes[inIndex]; + const QName* inChild = fChildren[inIndex]; + + if (type == ContentSpecNode::Leaf) { + if (fDTD) { + if (XMLString::equals(inChild->getRawName(), curChild->getRawName())) { + break; + } + } + else { + if ((inChild->getURI() == curChild->getURI()) && + (XMLString::equals(inChild->getLocalPart(), curChild->getLocalPart()))) { + break; + } + } + } + else if (type == ContentSpecNode::Any) { + break; + } + else if (type == ContentSpecNode::Any_NS) { + if (inChild->getURI() == curChild->getURI()) + break; + } + else if (type == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curChild->getURI(); + if (uriId != 1 && uriId != inChild->getURI()) + break; + } + + // REVISIT: What about checking for multiple ANY matches? + // The content model ambiguity *could* be checked + // by the caller before constructing the mixed + // content model. + } + // We did not find this one, so the validation failed + if (inIndex == fCount) + { + *indexFailingChild=outIndex; + return false; + } + } + } + + // Everything seems to be in order, so return success + return true; +} + + +bool MixedContentModel::validateContentSpecial(QName** const children + , XMLSize_t childCount + , unsigned int + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + // must match order + if (fOrdered) { + unsigned int inIndex = 0; + for (unsigned int outIndex = 0; outIndex < childCount; outIndex++) { + + // Get the current child out of the source index + QName* curChild = children[outIndex]; + + // If its PCDATA, then we just accept that + if (curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + ContentSpecNode::NodeTypes type = fChildTypes[inIndex]; + QName* inChild = fChildren[inIndex]; + + if (type == ContentSpecNode::Leaf) { + if ( !comparator.isEquivalentTo(curChild, inChild)) + { + *indexFailingChild=outIndex; + return false; + } + } + else if (type == ContentSpecNode::Any) { + } + else if (type == ContentSpecNode::Any_NS) { + if (inChild->getURI() != curChild->getURI()) + { + *indexFailingChild=outIndex; + return false; + } + } + else if (type == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curChild->getURI(); + if (uriId == 1 || uriId == inChild->getURI()) + { + *indexFailingChild=outIndex; + return false; + } + } + + // advance index + inIndex++; + } + } + + // can appear in any order + else { + for (unsigned int outIndex = 0; outIndex < childCount; outIndex++) { + // Get the current child out of the source index + QName* curChild = children[outIndex]; + + // If its PCDATA, then we just accept that + if (curChild->getURI() == XMLElementDecl::fgPCDataElemId) + continue; + + // And try to find it in our list + unsigned int inIndex = 0; + for (; inIndex < fCount; inIndex++) + { + ContentSpecNode::NodeTypes type = fChildTypes[inIndex]; + QName* inChild = fChildren[inIndex]; + + if (type == ContentSpecNode::Leaf) { + if ( comparator.isEquivalentTo(curChild, inChild)) + break; + } + else if (type == ContentSpecNode::Any) { + break; + } + else if (type == ContentSpecNode::Any_NS) { + if (inChild->getURI() == curChild->getURI()) + break; + } + else if (type == ContentSpecNode::Any_Other) + { + // Here we assume that empty string has id 1. + // + unsigned int uriId = curChild->getURI(); + if (uriId != 1 && uriId != inChild->getURI()) + break; + } + + // REVISIT: What about checking for multiple ANY matches? + // The content model ambiguity *could* be checked + // by the caller before constructing the mixed + // content model. + } + // We did not find this one, so the validation failed + if (inIndex == fCount) + { + *indexFailingChild=outIndex; + return false; + } + } + } + + // Everything seems to be in order, so return success + return true; +} + +// --------------------------------------------------------------------------- +// MixedContentModel: Private helper methods +// --------------------------------------------------------------------------- +void +MixedContentModel::buildChildList( ContentSpecNode* const curNode + , ValueVectorOf& toFill + , ValueVectorOf& toType) +{ + // Get the type of spec node our current node is + const ContentSpecNode::NodeTypes curType = curNode->getType(); + + // If its a leaf, then store its id in the target list + if ((curType == ContentSpecNode::Leaf) || + (curType == ContentSpecNode::Any) || + (curType == ContentSpecNode::Any_Other) || + (curType == ContentSpecNode::Any_NS) ) + { + toFill.addElement(curNode->getElement()); + toType.addElement(curType); + return; + } + + // Get both the child node pointers + ContentSpecNode* leftNode = curNode->getFirst(); + ContentSpecNode* rightNode = curNode->getSecond(); + + // And recurse according to the type of node + if (((curType & 0x0f) == ContentSpecNode::Choice) + || ((curType & 0x0f) == ContentSpecNode::Sequence)) + { + // Recurse on the left and right nodes + buildChildList(leftNode, toFill, toType); + + // The last node of a choice or sequence has a null right + if (rightNode) + buildChildList(rightNode, toFill, toType); + } + else if ((curType == ContentSpecNode::OneOrMore) + || (curType == ContentSpecNode::ZeroOrOne) + || (curType == ContentSpecNode::ZeroOrMore)) + { + // Just do the left node on this one + buildChildList(leftNode, toFill, toType); + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.hpp b/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.hpp new file mode 100644 index 000000000..c11f9e35a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/MixedContentModel.hpp @@ -0,0 +1,212 @@ +/* + * 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: MixedContentModel.hpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MIXEDCONTENTMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_MIXEDCONTENTMODEL_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; + +// +// MixedContentModel is a derivative of the abstract content model base +// class that handles the special case of mixed model elements. If an element +// is mixed model, it has PCDATA as its first possible content, followed +// by an alternation of the possible children. The children cannot have any +// numeration or order, so it must look like this: +// +// +// +// So, all we have to do is to keep an array of the possible children and +// validate by just looking up each child being validated by looking it up +// in the list. +// +class MixedContentModel : public XMLContentModel +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + MixedContentModel + ( + const bool dtd + , ContentSpecNode* const parentContentSpec + , const bool ordered = false + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~MixedContentModel(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool hasDups() const; + + // ----------------------------------------------------------------------- + // Implementation of the ContentModel virtual interface + // ----------------------------------------------------------------------- + virtual bool validateContent + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual bool validateContentSpecial + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ; + + virtual unsigned int getNextState(unsigned int currentState, + XMLSize_t elementIndex) const; + + virtual bool handleRepetitions( const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elementIndex, + SubstitutionGroupComparator * comparator) const; + + virtual void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName = 0 + ) ; + +private : + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void buildChildList + ( + ContentSpecNode* const curNode + , ValueVectorOf& toFill + , ValueVectorOf& toType + ); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MixedContentModel(); + MixedContentModel(const MixedContentModel&); + MixedContentModel& operator=(const MixedContentModel&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fCount + // The count of possible children in the fChildren member. + // + // fChildren + // The list of possible children that we have to accept. This array + // is allocated as large as needed in the constructor. + // + // fChildTypes + // The type of the children to support ANY. + // + // fOrdered + // True if mixed content model is ordered. DTD mixed content models + // are always unordered. + // + // fDTD + // Boolean to allow DTDs to validate even with namespace support. + // + // ----------------------------------------------------------------------- + XMLSize_t fCount; + QName** fChildren; + ContentSpecNode::NodeTypes* fChildTypes; + bool fOrdered; + bool fDTD; + MemoryManager* fMemoryManager; +}; + +inline ContentLeafNameTypeVector* MixedContentModel::getContentLeafNameTypeVector() const +{ + return 0; +} + +inline unsigned int +MixedContentModel::getNextState(unsigned int, + XMLSize_t) const { + + return XMLContentModel::gInvalidTrans; +} + +inline bool +MixedContentModel::handleRepetitions( const QName* const /*curElem*/, + unsigned int /*curState*/, + unsigned int /*currentLoop*/, + unsigned int& /*nextState*/, + unsigned int& /*nextLoop*/, + XMLSize_t /*elementIndex*/, + SubstitutionGroupComparator * /*comparator*/) const +{ + return true; +} + +inline void MixedContentModel::checkUniqueParticleAttribution + ( + SchemaGrammar* const + , GrammarResolver* const + , XMLStringPool* const + , XMLValidator* const + , unsigned int* const pContentSpecOrgURI + , const XMLCh* /*pComplexTypeName*/ /*= 0*/ + ) +{ + // rename back + unsigned int i = 0; + for (i = 0; i < fCount; i++) { + unsigned int orgURIIndex = fChildren[i]->getURI(); + if ((orgURIIndex != XMLContentModel::gEOCFakeId) && + (orgURIIndex != XMLElementDecl::fgInvalidElemId) && + (orgURIIndex != XMLElementDecl::fgPCDataElemId)) + fChildren[i]->setURI(pContentSpecOrgURI[orgURIIndex]); + } + + // for mixed content model, it's only a sequence + // UPA checking is not necessary +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.cpp b/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.cpp new file mode 100644 index 000000000..9fd0a49e3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.cpp @@ -0,0 +1,534 @@ +/* + * 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: SimpleContentModel.cpp 799211 2009-07-30 09:06:43Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SimpleContentModel: Implementation of the ContentModel virtual interface +// --------------------------------------------------------------------------- +// +// This method is called to validate our content. For this one, its just a +// pretty simple 'bull your way through it' test according to what kind of +// operation it is for. +// +bool +SimpleContentModel::validateContent(QName** const children + , XMLSize_t childCount + , unsigned int + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + // + // According to the type of operation, we do the correct type of + // content check. + // + XMLSize_t index; + switch(fOp & 0x0f) + { + case ContentSpecNode::Leaf : + // + // There can only be one child and it has to be of the + // element type we stored. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + // If the 0th child is not the right kind, report an error at 0 + if (fDTD) { + if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) { + *indexFailingChild=0; + return false; + } + } + else { + if ((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) { + *indexFailingChild=0; + return false; + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::ZeroOrOne : + // + // If the child count is greater than one, then obviously + // bad. Otherwise, if its one, then the one child must be + // of the type we stored. + // + if (childCount == 1) { + if (fDTD) { + if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) { + *indexFailingChild=0; + return false; + } + } + else { + if ((children[0]->getURI() != fFirstChild->getURI()) || + (!XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart()))) { + *indexFailingChild=0; + return false; + } + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::ZeroOrMore : + // + // If the child count is zero, that's fine. If its more than + // zero, then make sure that all children are of the element + // type that we stored. + // + if (childCount > 0) + { + if (fDTD) { + for (index = 0; index < childCount; index++) { + if (!XMLString::equals(children[index]->getRawName(), fFirstChild->getRawName())) { + *indexFailingChild=index; + return false; + } + } + } + else { + for (index = 0; index < childCount; index++) { + if ((children[index]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[index]->getLocalPart(), fFirstChild->getLocalPart())) { + *indexFailingChild=index; + return false; + } + } + } + } + break; + + case ContentSpecNode::OneOrMore : + // + // If the child count is zero, that's an error. If its more + // than zero, then make sure that all children are of the + // element type that we stored. + // + if (childCount == 0) + { + *indexFailingChild=0; + return false; + } + + if (fDTD) { + for (index = 0; index < childCount; index++) { + if (!XMLString::equals(children[index]->getRawName(), fFirstChild->getRawName())) { + *indexFailingChild=index; + return false; + } + } + } + else { + for (index = 0; index < childCount; index++) { + if ((children[index]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[index]->getLocalPart(), fFirstChild->getLocalPart())) { + *indexFailingChild=index; + return false; + } + } + } + break; + + case ContentSpecNode::Choice : + // + // There can only be one child, and it must be one of the + // two types we stored. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + if (fDTD) { + if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName()) && + !XMLString::equals(children[0]->getRawName(), fSecondChild->getRawName())) { + *indexFailingChild=0; + return false; + } + } + else { + if (((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) && + ((children[0]->getURI() != fSecondChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fSecondChild->getLocalPart()))) { + *indexFailingChild=0; + return false; + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::Sequence : + // + // There must be two children and they must be the two values + // we stored, in the stored order. So first check the obvious + // problem of an empty content, which would never be valid + // in this content mode. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + // test first child + if (fDTD) { + if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) { + *indexFailingChild=0; + return false; + } + } + else { + if ((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) { + *indexFailingChild=0; + return false; + } + } + // test second child, if present + if( childCount == 1) + { + // missing second child + *indexFailingChild=1; + return false; + } + else + { + if (fDTD) { + if (!XMLString::equals(children[1]->getRawName(), fSecondChild->getRawName())) { + *indexFailingChild=1; + return false; + } + } + else { + if ((children[1]->getURI() != fSecondChild->getURI()) || + !XMLString::equals(children[1]->getLocalPart(), fSecondChild->getLocalPart())) { + *indexFailingChild=1; + return false; + } + } + + if (childCount > 2) { + *indexFailingChild=2; + return false; + } + } + break; + + default : + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + break; + } + return true; +} + +bool SimpleContentModel::validateContentSpecial(QName** const children + , XMLSize_t childCount + , unsigned int + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const) const +{ + + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + // + // According to the type of operation, we do the correct type of + // content check. + // + unsigned int index; + switch(fOp & 0x0f) + { + case ContentSpecNode::Leaf : + // + // There can only be one child and it has to be of the + // element type we stored. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + if ((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) + { + if (!comparator.isEquivalentTo(children[0], fFirstChild)) + { + *indexFailingChild=0; + return false; + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::ZeroOrOne : + // + // If the child count is greater than one, then obviously + // bad. Otherwise, if its one, then the one child must be + // of the type we stored. + // + if ((childCount == 1) && + ((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart()))) + { + if(!comparator.isEquivalentTo(children[0], fFirstChild)) + { + *indexFailingChild=0; + return false; + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::ZeroOrMore : + // + // If the child count is zero, that's fine. If its more than + // zero, then make sure that all children are of the element + // type that we stored. + // + if (childCount > 0) + { + for (index = 0; index < childCount; index++) + { + if ((children[index]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[index]->getLocalPart(), fFirstChild->getLocalPart())) + { + if (!comparator.isEquivalentTo(children[index], fFirstChild)) + { + *indexFailingChild=index; + return false; + } + } + } + } + break; + + case ContentSpecNode::OneOrMore : + // + // If the child count is zero, that's an error. If its more + // than zero, then make sure that all children are of the + // element type that we stored. + // + if (childCount == 0) + { + *indexFailingChild=0; + return false; + } + + for (index = 0; index < childCount; index++) + { + if ((children[index]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[index]->getLocalPart(), fFirstChild->getLocalPart())) + { + if (!comparator.isEquivalentTo(children[index], fFirstChild)) + { + *indexFailingChild=index; + return false; + } + } + } + break; + + case ContentSpecNode::Choice : + // + // There can only be one child, and it must be one of the + // two types we stored. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + if (((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) && + ((children[0]->getURI() != fSecondChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fSecondChild->getLocalPart()))) + { + + if (!comparator.isEquivalentTo(children[0], fFirstChild) && + !comparator.isEquivalentTo(children[0], fSecondChild) ) + { + *indexFailingChild=0; + return false; + } + } + + if (childCount > 1) + { + *indexFailingChild=1; + return false; + } + break; + + case ContentSpecNode::Sequence : + // + // There must be two children and they must be the two values + // we stored, in the stored order. So first check the obvious + // problem of an empty content, which would never be valid + // in this content mode. + // + if (!childCount) + { + *indexFailingChild=0; + return false; + } + + // test first child + if ((children[0]->getURI() != fFirstChild->getURI()) || + !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) + { + if(!comparator.isEquivalentTo(children[0], fFirstChild)) + { + *indexFailingChild=0; + return false; + } + } + // test second child, if present + if( childCount == 1) + { + // missing second child + *indexFailingChild=1; + return false; + } + else + { + if ((children[1]->getURI() != fSecondChild->getURI()) || + !XMLString::equals(children[1]->getLocalPart(), fSecondChild->getLocalPart())) + { + if (!comparator.isEquivalentTo(children[1], fSecondChild)) + { + *indexFailingChild=1; + return false; + } + } + + if (childCount > 2) { + *indexFailingChild=2; + return false; + } + + } + break; + + default : + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + break; + } + return true; +} + +ContentLeafNameTypeVector* SimpleContentModel::getContentLeafNameTypeVector() const +{ + return 0; +} + +void SimpleContentModel::checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName /*= 0*/ + ) +{ + // rename back + unsigned int orgURIIndex = 0; + + orgURIIndex = fFirstChild->getURI(); + if ((orgURIIndex != XMLContentModel::gEOCFakeId) && + (orgURIIndex != XMLElementDecl::fgInvalidElemId) && + (orgURIIndex != XMLElementDecl::fgPCDataElemId)) + fFirstChild->setURI(pContentSpecOrgURI[orgURIIndex]); + + orgURIIndex = fSecondChild->getURI(); + if ((orgURIIndex != XMLContentModel::gEOCFakeId) && + (orgURIIndex != XMLElementDecl::fgInvalidElemId) && + (orgURIIndex != XMLElementDecl::fgPCDataElemId)) + fSecondChild->setURI(pContentSpecOrgURI[orgURIIndex]); + + // only possible violation is when it's a choice + if ((fOp & 0x0f) == ContentSpecNode::Choice) { + + SubstitutionGroupComparator comparator(pGrammarResolver, pStringPool); + + if (XercesElementWildcard::conflict(pGrammar, + ContentSpecNode::Leaf, + fFirstChild, + ContentSpecNode::Leaf, + fSecondChild, + &comparator)) + + pValidator->emitError(XMLValid::UniqueParticleAttributionFail, + pComplexTypeName, + fFirstChild->getRawName(), + fSecondChild->getRawName()); + } +} + +XERCES_CPP_NAMESPACE_END + diff --git a/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.hpp b/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.hpp new file mode 100644 index 000000000..36be0d86a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/common/SimpleContentModel.hpp @@ -0,0 +1,212 @@ +/* + * 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: SimpleContentModel.hpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SIMPLECONTENTMODEL_HPP) +#define XERCESC_INCLUDE_GUARD_SIMPLECONTENTMODEL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// SimpleContentModel is a derivative of the abstract content model base +// class that handles a small set of simple content models that are just +// way overkill to give the DFA treatment. +// +// DESCRIPTION: +// +// This guy handles the following scenarios: +// +// a +// a? +// a* +// a+ +// a,b +// a|b +// +// These all involve a unary operation with one element type, or a binary +// operation with two elements. These are very simple and can be checked +// in a simple way without a DFA and without the overhead of setting up a +// DFA for such a simple check. +// +// NOTE: Pass the XMLElementDecl::fgPCDataElemId value to represent a +// PCData node. Pass XMLElementDecl::fgInvalidElemId for unused element +// +class SimpleContentModel : public XMLContentModel +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + SimpleContentModel + ( + const bool dtd + , QName* const firstChild + , QName* const secondChild + , const ContentSpecNode::NodeTypes cmOp + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~SimpleContentModel(); + + + // ----------------------------------------------------------------------- + // Implementation of the ContentModel virtual interface + // ----------------------------------------------------------------------- + virtual bool validateContent + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual bool validateContentSpecial + ( + QName** const children + , XMLSize_t childCount + , unsigned int emptyNamespaceId + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLSize_t* indexFailingChild + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) const; + + virtual ContentLeafNameTypeVector *getContentLeafNameTypeVector() const; + + virtual unsigned int getNextState(unsigned int currentState, + XMLSize_t elementIndex) const; + + virtual bool handleRepetitions( const QName* const curElem, + unsigned int curState, + unsigned int currentLoop, + unsigned int& nextState, + unsigned int& nextLoop, + XMLSize_t elementIndex, + SubstitutionGroupComparator * comparator) const; + + virtual void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + , unsigned int* const pContentSpecOrgURI + , const XMLCh* pComplexTypeName = 0 + ) ; + + private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SimpleContentModel(); + SimpleContentModel(const SimpleContentModel&); + SimpleContentModel& operator=(const SimpleContentModel&); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fFirstChild + // fSecondChild + // The first (and optional second) child node. The + // operation code tells us whether the second child is used or not. + // + // fOp + // The operation that this object represents. Since this class only + // does simple contents, there is only ever a single operation + // involved (i.e. the children of the operation are always one or + // two leafs.) + // + // fDTD + // Boolean to allow DTDs to validate even with namespace support. */ + // + // ----------------------------------------------------------------------- + QName* fFirstChild; + QName* fSecondChild; + ContentSpecNode::NodeTypes fOp; + bool fDTD; + MemoryManager* const fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// SimpleContentModel: Constructors and Destructor +// --------------------------------------------------------------------------- +inline SimpleContentModel::SimpleContentModel +( + const bool dtd + , QName* const firstChild + , QName* const secondChild + , const ContentSpecNode::NodeTypes cmOp + , MemoryManager* const manager +) + : fFirstChild(0) + , fSecondChild(0) + , fOp(cmOp) + , fDTD(dtd) + , fMemoryManager(manager) +{ + if (firstChild) + fFirstChild = new (manager) QName(*firstChild); + else + fFirstChild = new (manager) QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId, manager); + + if (secondChild) + fSecondChild = new (manager) QName(*secondChild); + else + fSecondChild = new (manager) QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId, manager); +} + +inline SimpleContentModel::~SimpleContentModel() +{ + delete fFirstChild; + delete fSecondChild; +} + + +// --------------------------------------------------------------------------- +// SimpleContentModel: Virtual methods +// --------------------------------------------------------------------------- +inline unsigned int +SimpleContentModel::getNextState(unsigned int, + XMLSize_t) const { + + return XMLContentModel::gInvalidTrans; +} + +inline bool +SimpleContentModel::handleRepetitions( const QName* const /*curElem*/, + unsigned int /*curState*/, + unsigned int /*currentLoop*/, + unsigned int& /*nextState*/, + unsigned int& /*nextLoop*/, + XMLSize_t /*elementIndex*/, + SubstitutionGroupComparator * /*comparator*/) const +{ + return true; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp new file mode 100644 index 000000000..4e27a2d0b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.cpp @@ -0,0 +1,972 @@ +/* + * 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: AbstractNumericFacetValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +//since we need to dynamically created each and every derivatives +//during deserialization by XSerializeEngine>>Derivative, we got +//to include all hpp +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const int AbstractNumericFacetValidator::INDETERMINATE = 2; + +#define REPORT_FACET_ERROR(val1, val2, except_code, manager) \ + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException \ + , except_code \ + , val1->getFormattedString() \ + , val2->getFormattedString() \ + , manager); + +#define FROM_BASE_VALUE_SPACE(val, facetFlag, except_code, manager) \ + if ((thisFacetsDefined & facetFlag) != 0) \ +{ \ + try \ +{ \ + numBase->checkContent(val->getRawData(), (ValidationContext*)0, false, manager); \ +} \ + catch ( XMLException& ) \ +{ \ + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException \ + , except_code \ + , val->getRawData() \ + , manager); \ +} \ +} + + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +AbstractNumericFacetValidator::~AbstractNumericFacetValidator() +{ + if (!fMaxInclusiveInherited && fMaxInclusive) + delete fMaxInclusive; + + if (!fMaxExclusiveInherited && fMaxExclusive) + delete fMaxExclusive; + + if (!fMinInclusiveInherited && fMinInclusive) + delete fMinInclusive; + + if (!fMinExclusiveInherited && fMinExclusive) + delete fMinExclusive; + + //~RefVectorOf will delete all adopted elements + if (!fEnumerationInherited && fEnumeration) + delete fEnumeration; + + if (!fEnumerationInherited && fStrEnumeration) + delete fStrEnumeration; +} + +AbstractNumericFacetValidator::AbstractNumericFacetValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:DatatypeValidator(baseValidator, facets, finalSet, type, manager) +, fMaxInclusiveInherited(false) +, fMaxExclusiveInherited(false) +, fMinInclusiveInherited(false) +, fMinExclusiveInherited(false) +, fEnumerationInherited(false) +, fMaxInclusive(0) +, fMaxExclusive(0) +, fMinInclusive(0) +, fMinExclusive(0) +, fEnumeration(0) +, fStrEnumeration(0) +{ + //do not invoke init() here !!! +} + +// +// P1. Enumeration +// +void AbstractNumericFacetValidator::init(RefArrayVectorOf* const enums + , MemoryManager* const manager) +{ + + fStrEnumeration = enums; // save the literal value + // which is needed for getEnumString() + + if (enums) + { + setFacetsDefined(DatatypeValidator::FACET_ENUMERATION); + } + + assignFacet(manager); + inspectFacet(manager); + inspectFacetBase(manager); + inheritFacet(); +} + +// +// Assign facets +// assign common facets +// assign additional facet +// +void AbstractNumericFacetValidator::assignFacet(MemoryManager* const manager) +{ + + RefHashTableOf* facets = getFacets(); + + if (!facets) // no facets defined + return; + + XMLCh* key; + + RefHashTableOfEnumerator e(facets, false, manager); + + while (e.hasMoreElements()) + { + KVStringPair pair = e.nextElement(); + key = pair.getKey(); + XMLCh* value = pair.getValue(); + + if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN)) + { + setPattern(value); + if (getPattern()) + setFacetsDefined(DatatypeValidator::FACET_PATTERN); + // do not construct regex until needed + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXINCLUSIVE)) + { + try + { + setMaxInclusive(value); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxIncl, value, manager); + } + setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXEXCLUSIVE)) + { + try + { + setMaxExclusive(value); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxExcl, value, manager); + } + setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MININCLUSIVE)) + { + try + { + setMinInclusive(value); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinIncl, value, manager); + } + setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MINEXCLUSIVE)) + { + try + { + setMinExclusive(value); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinExcl, value, manager); + } + setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE); + } + else if (XMLString::equals(key, SchemaSymbols::fgATT_FIXED)) + { + unsigned int val; + bool retStatus; + try + { + retStatus = XMLString::textToBin(value, val, fMemoryManager); + } + catch (RuntimeException&) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager); + } + + if (!retStatus) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager); + } + + setFixed(val); + //no setFacetsDefined here + + } + else + { + assignAdditionalFacet(key, value, manager); + } + + }//while + +}// end of assigneFacet() + +// +// Check facet among self +// check common facets +// check Additional Facet Constraint +// +void AbstractNumericFacetValidator::inspectFacet(MemoryManager* const manager) +{ + + int thisFacetsDefined = getFacetsDefined(); + XMLNumber *thisMaxInclusive = getMaxInclusive(); + XMLNumber *thisMaxExclusive = getMaxExclusive(); + XMLNumber *thisMinInclusive = getMinInclusive(); + XMLNumber *thisMinExclusive = getMinExclusive(); + + if (!thisFacetsDefined) + return; + + // non co-existence checking + // check 4.3.8.c1 error: maxInclusive + maxExclusive + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) ) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_max_Incl_Excl, manager); + + // non co-existence checking + // check 4.3.9.c1 error: minInclusive + minExclusive + if (((thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) ) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_min_Incl_Excl, manager); + + // + // minExclusive < minInclusive <= maxInclusive < maxExclusive + // + // check 4.3.7.c1 must: minInclusive <= maxInclusive + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) ) + { + int result = compareValues(thisMinInclusive, thisMaxInclusive); + if ( result == 1 || result == INDETERMINATE ) + { + REPORT_FACET_ERROR(thisMinInclusive + , thisMaxInclusive + , XMLExcepts::FACET_maxIncl_minIncl + , manager) + } + } + + // check 4.3.8.c2 must: minExclusive <= maxExclusive + if ( ((thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) ) + { + int result = compareValues(getMinExclusive(), getMaxExclusive()); + if ( result == 1 || result == INDETERMINATE ) + { + REPORT_FACET_ERROR(thisMinExclusive + , thisMaxExclusive + , XMLExcepts::FACET_maxExcl_minExcl + , manager) + } + } + + // check 4.3.9.c2 must: minExclusive < maxInclusive + if ( ((thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) ) + { + int result = compareValues(getMinExclusive(), getMaxInclusive()); + if ( result != -1 ) + { + REPORT_FACET_ERROR(thisMinExclusive + , thisMaxInclusive + , XMLExcepts::FACET_maxIncl_minExcl + , manager) + } + } + + // check 4.3.10.c1 must: minInclusive < maxExclusive + if ( ((thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) ) + { + int result = compareValues(getMinInclusive(), getMaxExclusive()); + if ( result != -1) + { + REPORT_FACET_ERROR(thisMinInclusive + , thisMaxExclusive + , XMLExcepts::FACET_maxExcl_minIncl + , manager) + } + } + + checkAdditionalFacetConstraints(manager); + +}// end of inspectFacet() + +// +// Check vs base +// check common facets +// check enumeration +// check Additional Facet Constraint +// +void AbstractNumericFacetValidator::inspectFacetBase(MemoryManager* const manager) +{ + + AbstractNumericFacetValidator* numBase = (AbstractNumericFacetValidator*) getBaseValidator(); + int thisFacetsDefined = getFacetsDefined(); + + if ( (!thisFacetsDefined && !fEnumeration) || + !numBase ) + return; + + int baseFacetsDefined = numBase->getFacetsDefined(); + + XMLNumber *thisMaxInclusive = getMaxInclusive(); + XMLNumber *thisMaxExclusive = getMaxExclusive(); + XMLNumber *thisMinInclusive = getMinInclusive(); + XMLNumber *thisMinExclusive = getMinExclusive(); + + XMLNumber *baseMaxInclusive = numBase->getMaxInclusive(); + XMLNumber *baseMaxExclusive = numBase->getMaxExclusive(); + XMLNumber *baseMinInclusive = numBase->getMinInclusive(); + XMLNumber *baseMinExclusive = numBase->getMinExclusive(); + int baseFixed = numBase->getFixed(); + + // this + // minExclusive maxExclusive + // minInclusive maxInclusive + // + // base + // minExclusive maxExclusive + // minInclusive maxInclusive + // + + // check 4.3.7.c2 error: + // maxInclusive > base.maxInclusive && maxInclusive != base.maxInclusive if (base.fixed) + // maxInclusive >= base.maxExclusive + // maxInclusive < base.minInclusive + // maxInclusive <= base.minExclusive + + if ((thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + if ((baseFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + int result = compareValues(thisMaxInclusive, baseMaxInclusive); + + if (((baseFixed & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) && + (result != 0 )) + { + REPORT_FACET_ERROR(thisMaxInclusive + , baseMaxInclusive + , XMLExcepts::FACET_maxIncl_base_fixed + , manager) + } + + if (result == 1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMaxInclusive + , baseMaxInclusive + , XMLExcepts::FACET_maxIncl_base_maxIncl + , manager) + } + + } + + if ((baseFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + int result = compareValues(thisMaxInclusive, baseMaxExclusive); + if (result != -1 ) + { + REPORT_FACET_ERROR(thisMaxInclusive + , baseMaxExclusive + , XMLExcepts::FACET_maxIncl_base_maxExcl + , manager) + } + } + + + if ((baseFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + int result = compareValues(thisMaxInclusive, baseMinInclusive); + if (result == -1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMaxInclusive + , baseMinInclusive + , XMLExcepts::FACET_maxIncl_base_minIncl + , manager) + } + } + + if ((baseFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) + { + int result = compareValues(thisMaxInclusive, baseMinExclusive); + if (result != 1 ) + { + REPORT_FACET_ERROR(thisMaxInclusive + , baseMinExclusive + , XMLExcepts::FACET_maxIncl_base_minExcl + , manager) + } + } + + } + + // check 4.3.8.c3 error: + // maxExclusive > base.maxExclusive && maxExclusive != base.maxExclusive if (base.fixed) + // maxExclusive > base.maxInclusive + // maxExclusive <= base.minInclusive + // maxExclusive <= base.minExclusive + + if ((thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + int result = compareValues(thisMaxExclusive, baseMaxExclusive); + + if (((baseFixed & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) && + (result != 0 )) + { + REPORT_FACET_ERROR(thisMaxExclusive + , baseMaxExclusive + , XMLExcepts::FACET_maxExcl_base_fixed + , manager) + } + + if (result == 1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMaxExclusive + , baseMaxExclusive + , XMLExcepts::FACET_maxExcl_base_maxExcl + , manager) + } + + /** + * Schema Errata + * E2-16 maxExclusive + * + * derived type's maxExclusive must either be + * 1) equal to base' maxExclusive or + * 2) from the base type value space + * + */ + if (result != 0) + { + FROM_BASE_VALUE_SPACE(thisMaxExclusive + , DatatypeValidator::FACET_MAXEXCLUSIVE + , XMLExcepts::FACET_maxExcl_notFromBase + , manager) + } + } + else // base has no maxExclusive + { + FROM_BASE_VALUE_SPACE(thisMaxExclusive + , DatatypeValidator::FACET_MAXEXCLUSIVE + , XMLExcepts::FACET_maxExcl_notFromBase + , manager) + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + int result = compareValues(thisMaxExclusive, baseMaxInclusive); + if (result == 1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMaxExclusive + , baseMaxInclusive + , XMLExcepts::FACET_maxExcl_base_maxIncl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) + { + int result = compareValues(thisMaxExclusive, baseMinExclusive); + if (result != 1) + { + REPORT_FACET_ERROR(thisMaxExclusive + , baseMinExclusive + , XMLExcepts::FACET_maxExcl_base_minExcl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + int result = compareValues(thisMaxExclusive, baseMinInclusive); + if (result != 1) + { + REPORT_FACET_ERROR(thisMaxExclusive + , baseMinInclusive + , XMLExcepts::FACET_maxExcl_base_minIncl + , manager) + } + } + } + + // check 4.3.9.c3 error: + // minExclusive < base.minExclusive minExclusive != base.minExclusive if (base.fixed) + // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive + // minExclusive < base.minInclusive + // minExclusive >= base.maxExclusive + + if ((thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) + { + if (( baseFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) + { + int result = compareValues(thisMinExclusive, baseMinExclusive); + + if (((baseFixed & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) && + (result != 0 )) + { + REPORT_FACET_ERROR(thisMinExclusive + , baseMinExclusive + , XMLExcepts::FACET_minExcl_base_fixed + , manager) + } + + if (result == -1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMinExclusive + , baseMinExclusive + , XMLExcepts::FACET_minExcl_base_minExcl + , manager) + } + + /** + * Schema Errata + * E2-16 maxExclusive + * + * derived type's minExclusive must either be + * 1) equal to base' minxExclusive or + * 2) from the base type value space + * + * Note: deduced from, not explicitly expressed in the Errata + */ + if (result != 0) + { + FROM_BASE_VALUE_SPACE(thisMinExclusive + , DatatypeValidator::FACET_MINEXCLUSIVE + , XMLExcepts::FACET_minExcl_notFromBase + , manager) + } + } + else // base has no minExclusive + { + + FROM_BASE_VALUE_SPACE(thisMinExclusive + , DatatypeValidator::FACET_MINEXCLUSIVE + , XMLExcepts::FACET_minExcl_notFromBase + , manager) + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + int result = compareValues(thisMinExclusive, baseMaxInclusive); + if (result == 1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMinExclusive + , baseMaxInclusive + , XMLExcepts::FACET_minExcl_base_maxIncl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + int result = compareValues(thisMinExclusive, baseMinInclusive); + if (result == -1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMinExclusive + , baseMinInclusive + , XMLExcepts::FACET_minExcl_base_minIncl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + int result = compareValues(thisMinExclusive, baseMaxExclusive); + if (result != -1) + { + REPORT_FACET_ERROR(thisMinExclusive + , baseMaxExclusive + , XMLExcepts::FACET_minExcl_base_maxExcl + , manager) + } + } + + } + + // check 4.3.10.c2 error: + // minInclusive < base.minInclusive minInclusive != base.minInclusive if (base.fixed) + // minInclusive > base.maxInclusive + // minInclusive <= base.minExclusive + // minInclusive >= base.maxExclusive + + + if ((thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + if ((baseFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + int result = compareValues(thisMinInclusive, baseMinInclusive); + + if (((baseFixed & DatatypeValidator::FACET_MININCLUSIVE) != 0) && + (result != 0 )) + { + REPORT_FACET_ERROR(thisMinInclusive + , baseMinInclusive + , XMLExcepts::FACET_minIncl_base_fixed + , manager) + } + + if (result == -1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMinInclusive + , baseMinInclusive + , XMLExcepts::FACET_minIncl_base_minIncl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + int result = compareValues(thisMinInclusive, baseMaxInclusive); + if (result == 1 || result == INDETERMINATE) + { + REPORT_FACET_ERROR(thisMinInclusive + , baseMaxInclusive + , XMLExcepts::FACET_minIncl_base_maxIncl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) + { + int result = compareValues(thisMinInclusive, baseMinExclusive); + if (result != 1) + { + REPORT_FACET_ERROR(thisMinInclusive + , baseMinExclusive + , XMLExcepts::FACET_minIncl_base_minExcl + , manager) + } + } + + if (( baseFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + int result = compareValues(thisMinInclusive, baseMaxExclusive); + if (result != -1) + { + REPORT_FACET_ERROR(thisMinInclusive + , baseMaxExclusive + , XMLExcepts::FACET_minIncl_base_maxExcl + , manager) + } + } + + } + + checkAdditionalFacetConstraintsBase(manager); + + // check 4.3.5.c0 must: enumeration values from the value space of base + // + // In fact, the values in the enumeration shall go through validation + // of this class as well. + // this->checkContent(value, false); + // + if ( ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0) && + ( fStrEnumeration )) + { + setEnumeration(manager); + } + + // + // maxInclusive, maxExclusive, minInclusive and minExclusive + // shall come from the base's value space as well + // + + FROM_BASE_VALUE_SPACE(thisMaxInclusive + , DatatypeValidator::FACET_MAXINCLUSIVE + , XMLExcepts::FACET_maxIncl_notFromBase + , manager) + + FROM_BASE_VALUE_SPACE(thisMinInclusive + , DatatypeValidator::FACET_MININCLUSIVE + , XMLExcepts::FACET_minIncl_notFromBase + , manager) + +} //end of inspectFacetBase + +// +// Inherit facet from base +// a. inherit common facets +// b. inherit additional facet +// +void AbstractNumericFacetValidator::inheritFacet() +{ + + AbstractNumericFacetValidator* numBase = (AbstractNumericFacetValidator*) getBaseValidator(); + if (!numBase) + return; + + int thisFacetsDefined = getFacetsDefined(); + int baseFacetsDefined = numBase->getFacetsDefined(); + + // inherit enumeration + if ((( baseFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) == 0)) + { + fEnumeration = numBase->fEnumeration; + fEnumerationInherited = true; + setFacetsDefined(DatatypeValidator::FACET_ENUMERATION); + } + + // inherit maxInclusive + if ((( baseFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) ) + { + fMaxInclusive = numBase->getMaxInclusive(); + fMaxInclusiveInherited = true; + setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE); + } + + // inherit maxExclusive + if ((( baseFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) ) + { + fMaxExclusive = numBase->getMaxExclusive(); + fMaxExclusiveInherited = true; + setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE); + } + + // inherit minExclusive + if ((( baseFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) == 0) ) + { + fMinInclusive = numBase->getMinInclusive(); + fMinInclusiveInherited = true; + setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE); + } + + // inherit minExclusive + if ((( baseFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) == 0) ) + { + fMinExclusive = numBase->getMinExclusive(); + fMinExclusiveInherited = true; + setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE); + } + + inheritAdditionalFacet(); + + // inherit "fixed" option + setFixed(getFixed() | numBase->getFixed()); + +} + +const RefArrayVectorOf* AbstractNumericFacetValidator::getEnumString() const +{ + return (fEnumerationInherited? getBaseValidator()->getEnumString() : fStrEnumeration ); +} + + +void AbstractNumericFacetValidator::checkAdditionalFacetConstraints(MemoryManager* const) const +{ + return; +} + +void AbstractNumericFacetValidator::checkAdditionalFacetConstraintsBase(MemoryManager* const) const +{ + return; +} + +void AbstractNumericFacetValidator::inheritAdditionalFacet() +{ + return; +} + +void AbstractNumericFacetValidator::assignAdditionalFacet( const XMLCh* const key + , const XMLCh* const + , MemoryManager* const manager) +{ + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); +} + + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(AbstractNumericFacetValidator) + +/*** + * This dv needs to serialize/deserialize four boundary data members + * which are derivatives of XMLlNumber. + * The derivatives of this class, namely, Deciamldv, Doubledv, Floatdv and + * DateTimedv needs to write a typeEnum into the binary data stream, so + * during loading, this method reads the typeEnum first, and then instantiate + * the right type of objects, say XMLDouble, XMLFloat, XMLBigDecimal and + * XMLDateTime. + * + * + ***/ +void AbstractNumericFacetValidator::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + + /*** + * don't move this line out of the if statement, + * it is done purposely to allow AbstractNumericFacetValidator + * read the number type information before DatatypeValidator + * during loading + ***/ + DatatypeValidator::serialize(serEng); + + // need not write type info for the XMLNumber since + // the derivative class has done that + storeClusive(serEng, fMaxInclusiveInherited, fMaxInclusive); + storeClusive(serEng, fMaxExclusiveInherited, fMaxExclusive); + storeClusive(serEng, fMinInclusiveInherited, fMinInclusive); + storeClusive(serEng, fMinExclusiveInherited, fMinExclusive); + + serEng< + * Serialize RefVectorOf + ***/ + XTemplateSerializer::storeObject(fStrEnumeration, serEng); + XTemplateSerializer::storeObject(fEnumeration, serEng); + + } + else + { + // Read the number type info for the XMLNumber FIRST!!! + int nType; + XMLNumber::NumberType numType; + serEng>>nType; + numType = (XMLNumber::NumberType) nType; + + DatatypeValidator::serialize(serEng); + + loadClusive(serEng, fMaxInclusiveInherited, fMaxInclusive, numType, 1); + loadClusive(serEng, fMaxExclusiveInherited, fMaxExclusive, numType, 2); + loadClusive(serEng, fMinInclusiveInherited, fMinInclusive, numType, 3); + loadClusive(serEng, fMinExclusiveInherited, fMinExclusive, numType, 4); + + serEng>>fEnumerationInherited; + + /*** + * Deserialize RefArrayVectorOf + * Deserialize RefVectorOf + ***/ + XTemplateSerializer::loadObject(&fStrEnumeration, 8, true, serEng); + XTemplateSerializer::loadObject(&fEnumeration, 8, true, numType, serEng); + + } + +} + +// +// A user defined dv may inherit any of the Max/Min/Inc/Exc from a +// built dv, which will create its own Max/Min/Inc/Exc during the +// loading. Therefore if the user defined store and load this +// facet, and does not own it, that will cause leakage. +// +// To avoid checking if the facet belongs to a builtIn dv or not, we +// do this way, for any inherited *clusive, we will not store it, and later +// on during loading, we get it from the base dv. +// +void AbstractNumericFacetValidator::storeClusive(XSerializeEngine& serEng + , bool inherited + , XMLNumber* data) +{ + serEng<>inherited; + + if (!inherited) + data = XMLNumber::loadNumber(numType, serEng); + else + { + AbstractNumericFacetValidator* basedv = (AbstractNumericFacetValidator*) getBaseValidator(); + + switch(flag) + { + case 1: + data = basedv->getMaxInclusive(); + break; + case 2: + data = basedv->getMaxExclusive(); + break; + case 3: + data = basedv->getMinInclusive(); + break; + case 4: + data = basedv->getMinExclusive(); + break; + default: + break; + } + + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file AbstractNumericFacetValidator::cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp new file mode 100644 index 000000000..855a09eb5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericFacetValidator.hpp @@ -0,0 +1,201 @@ +/* + * 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: AbstractNumericFacetValidator.hpp 673155 2008-07-01 17:55:39Z dbertoni $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_FACET_VALIDATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT AbstractNumericFacetValidator : public DatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + virtual ~AbstractNumericFacetValidator(); + + //@} + + virtual const RefArrayVectorOf* getEnumString() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(AbstractNumericFacetValidator) + +protected: + + AbstractNumericFacetValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + void init(RefArrayVectorOf* const enums + , MemoryManager* const manager); + + // + // Abstract interface + // + virtual void assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager); + + virtual void inheritAdditionalFacet(); + + virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const; + + virtual void checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const; + + virtual int compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue) = 0; + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) = 0; + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + + virtual void setMaxInclusive(const XMLCh* const) = 0; + + virtual void setMaxExclusive(const XMLCh* const) = 0; + + virtual void setMinInclusive(const XMLCh* const) = 0; + + virtual void setMinExclusive(const XMLCh* const) = 0; + + virtual void setEnumeration(MemoryManager* const manager) = 0; + + static const int INDETERMINATE; + +public: +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + + inline XMLNumber* getMaxInclusive() const; + + inline XMLNumber* getMaxExclusive() const; + + inline XMLNumber* getMinInclusive() const; + + inline XMLNumber* getMinExclusive() const; + + inline RefVectorOf* getEnumeration() const; + +protected: + // ----------------------------------------------------------------------- + // Protected data members + // + // Allow access to derived class + // + // ----------------------------------------------------------------------- + bool fMaxInclusiveInherited; + bool fMaxExclusiveInherited; + bool fMinInclusiveInherited; + bool fMinExclusiveInherited; + bool fEnumerationInherited; + + XMLNumber* fMaxInclusive; + XMLNumber* fMaxExclusive; + XMLNumber* fMinInclusive; + XMLNumber* fMinExclusive; + + RefVectorOf* fEnumeration; // save the actual value + RefArrayVectorOf* fStrEnumeration; + +private: + + void assignFacet(MemoryManager* const manager); + + void inspectFacet(MemoryManager* const manager); + + void inspectFacetBase(MemoryManager* const manager); + + void inheritFacet(); + + void storeClusive(XSerializeEngine& + , bool + , XMLNumber*); + + void loadClusive(XSerializeEngine& + , bool& + , XMLNumber*& + , XMLNumber::NumberType + , int ); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AbstractNumericFacetValidator(const AbstractNumericFacetValidator&); + AbstractNumericFacetValidator& operator=(const AbstractNumericFacetValidator&); +}; + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + +inline XMLNumber* AbstractNumericFacetValidator::getMaxInclusive() const +{ + return fMaxInclusive; +} + +inline XMLNumber* AbstractNumericFacetValidator::getMaxExclusive() const +{ + return fMaxExclusive; +} + +inline XMLNumber* AbstractNumericFacetValidator::getMinInclusive() const +{ + return fMinInclusive; +} + +inline XMLNumber* AbstractNumericFacetValidator::getMinExclusive() const +{ + return fMinExclusive; +} + +inline RefVectorOf* AbstractNumericFacetValidator::getEnumeration() const +{ + return fEnumeration; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file AbstractNumericFacetValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.cpp new file mode 100644 index 000000000..32355e434 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.cpp @@ -0,0 +1,181 @@ +/* + * 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: AbstractNumericValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +#define REPORT_VALUE_ERROR(val1, val2, except_code, manager) \ + ThrowXMLwithMemMgr2(InvalidDatatypeValueException \ + , except_code \ + , val1->getFormattedString() \ + , val2->getFormattedString() \ + , manager); + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +AbstractNumericValidator::~AbstractNumericValidator() +{} + +AbstractNumericValidator::AbstractNumericValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractNumericFacetValidator(baseValidator, facets, finalSet, type, manager) +{ + //do not invoke init() here !!! +} + +void AbstractNumericValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + checkContent(content, context, false, manager); +} + +void AbstractNumericValidator::boundsCheck(const XMLNumber* const theData + , MemoryManager* const manager) +{ + int thisFacetsDefined = getFacetsDefined(); + int result; + + if (thisFacetsDefined == 0) + return; + + // must be < MaxExclusive + if ( (thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 ) + { + result = compareValues(theData, getMaxExclusive()); + if ( result != -1) + { + REPORT_VALUE_ERROR(theData + , getMaxExclusive() + , XMLExcepts::VALUE_exceed_maxExcl + , manager) + } + } + + // must be <= MaxInclusive + if ( (thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0 ) + { + result = compareValues(theData, getMaxInclusive()); + if (result == 1) + { + REPORT_VALUE_ERROR(theData + , getMaxInclusive() + , XMLExcepts::VALUE_exceed_maxIncl + , manager) + } + } + + // must be >= MinInclusive + if ( (thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0 ) + { + result = compareValues(theData, getMinInclusive()); + if (result == -1) + { + REPORT_VALUE_ERROR(theData + , getMinInclusive() + , XMLExcepts::VALUE_exceed_minIncl + , manager) + } + } + + // must be > MinExclusive + if ( (thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 ) + { + result = compareValues(theData, getMinExclusive()); + if (result != 1) + { + REPORT_VALUE_ERROR(theData + , getMinExclusive() + , XMLExcepts::VALUE_exceed_minExcl + , manager) + } + } +} + +const XMLCh* AbstractNumericValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + + if (toValidate) + { + AbstractNumericValidator* temp = (AbstractNumericValidator*) this; + + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + // XMLAbstractDoubleFloat::getCanonicalRepresentation handles + // exceptional cases + return XMLAbstractDoubleFloat::getCanonicalRepresentation(rawData, toUse); + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(AbstractNumericValidator) + +void AbstractNumericValidator::serialize(XSerializeEngine& serEng) +{ + AbstractNumericFacetValidator::serialize(serEng); + + /*** + * Need not to do anything else here + * + * Note: its derivatives, Doubledv, Floatdv and Decimaldv writes + * number type info into the binary data stream to be read + * by AbstractNumericFacetVaildator during loading, therefore + * this class can NOT write/read anything into/from the binary + * data stream. + * + * Later on, if this class has to write/read something into/from + * the binary data stream, we need to add a numberType data + * to XMLNumber and let AbstractNumericFacetValidator to write/read + * this number type info. + ***/ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file AbstractNumericValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.hpp new file mode 100644 index 000000000..eeab902f3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractNumericValidator.hpp @@ -0,0 +1,109 @@ +/* + * 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: AbstractNumericValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ABSTRACT_NUMERIC_VALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT AbstractNumericValidator : public AbstractNumericFacetValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + virtual ~AbstractNumericValidator(); + + //@} + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(AbstractNumericValidator) + +protected: + + AbstractNumericValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + inline void init(RefArrayVectorOf* const enums + , MemoryManager* const manager); + + // + // Abstract interface + // + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) = 0; + + void boundsCheck(const XMLNumber* const + , MemoryManager* const manager); + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AbstractNumericValidator(const AbstractNumericValidator&); + AbstractNumericValidator& operator=(const AbstractNumericValidator&); +}; + +inline void AbstractNumericValidator::init(RefArrayVectorOf* const enums + , MemoryManager* const manager) +{ + AbstractNumericFacetValidator::init(enums, manager); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file AbstractNumericValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.cpp new file mode 100644 index 000000000..3a829897b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.cpp @@ -0,0 +1,770 @@ +/* + * 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: AbstractStringValidator.cpp 834826 2009-11-11 10:03:53Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const int BUF_LEN = 64; + +#define REPORT_FACET_ERROR(val1, val2, except_code, manager) \ + XMLCh value1[BUF_LEN+1]; \ + XMLCh value2[BUF_LEN+1]; \ + XMLString::sizeToText(val1, value1, BUF_LEN, 10, manager); \ + XMLString::sizeToText(val2, value2, BUF_LEN, 10, manager); \ + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException \ + , except_code \ + , value1 \ + , value2 \ + , manager); + +#define REPORT_VALUE_ERROR(data, val1, val2, except_code, manager) \ + XMLCh value1[BUF_LEN+1]; \ + XMLCh value2[BUF_LEN+1]; \ + XMLString::sizeToText(val1, value1, BUF_LEN, 10, manager); \ + XMLString::sizeToText(val2, value2, BUF_LEN, 10, manager); \ + ThrowXMLwithMemMgr3(InvalidDatatypeValueException \ + , except_code \ + , data \ + , value1 \ + , value2 \ + , manager); + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +AbstractStringValidator::~AbstractStringValidator() +{ + //~RefVectorOf will delete all adopted elements + if ( !fEnumerationInherited && fEnumeration) + { + delete fEnumeration; + fEnumeration = 0; + } +} + +AbstractStringValidator::AbstractStringValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:DatatypeValidator(baseValidator, facets, finalSet, type, manager) +,fLength(0) +,fMaxLength(SchemaSymbols::fgINT_MAX_VALUE) +,fMinLength(0) +,fEnumerationInherited(false) +,fEnumeration(0) +{ + // init() is invoked from derived class's ctor instead of from + // here to allow correct resolution of virutal method, such as + // assigneAdditionalFacet(), inheritAdditionalFacet(). +} + +void AbstractStringValidator::init(RefArrayVectorOf* const enums + ,MemoryManager* const manager) +{ + + if (enums) + { + setEnumeration(enums, false); + normalizeEnumeration(manager); + } + + assignFacet(manager); + inspectFacet(manager); + inspectFacetBase(manager); + inheritFacet(); + +} + +// +// Assign facets +// assign common facets +// assign additional facet +// +void AbstractStringValidator::assignFacet(MemoryManager* const manager) +{ + + RefHashTableOf* facets = getFacets(); + + if (!facets) + return; + + XMLCh* key; + RefHashTableOfEnumerator e(facets, false, manager); + + while (e.hasMoreElements()) + { + KVStringPair pair = e.nextElement(); + key = pair.getKey(); + XMLCh* value = pair.getValue(); + + if (XMLString::equals(key, SchemaSymbols::fgELT_LENGTH)) + { + int val; + try + { + val = XMLString::parseInt(value, manager); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_Len, value, manager); + } + + if ( val < 0 ) + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_NonNeg_Len, value, manager); + + setLength(val); + setFacetsDefined(DatatypeValidator::FACET_LENGTH); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MINLENGTH)) + { + int val; + try + { + val = XMLString::parseInt(value, manager); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_minLen, value, manager); + } + + if ( val < 0 ) + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_NonNeg_minLen, value, manager); + + setMinLength(val); + setFacetsDefined(DatatypeValidator::FACET_MINLENGTH); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXLENGTH)) + { + int val; + try + { + val = XMLString::parseInt(value, manager); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_maxLen, value, manager); + } + + if ( val < 0 ) + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_NonNeg_maxLen, value, manager); + + setMaxLength(val); + setFacetsDefined(DatatypeValidator::FACET_MAXLENGTH); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN)) + { + setPattern(value); + if (getPattern()) + setFacetsDefined(DatatypeValidator::FACET_PATTERN); + // do not construct regex until needed + } + else if (XMLString::equals(key, SchemaSymbols::fgATT_FIXED)) + { + unsigned int val; + bool retStatus; + try + { + retStatus = XMLString::textToBin(value, val, fMemoryManager); + } + catch (RuntimeException&) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager); + } + + if (!retStatus) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager); + } + + setFixed(val); + //no setFacetsDefined here + } + // + // else if (XMLString::equals(key, SchemaSymbols::fgELT_SPECIAL_TOKEN)) + // TODO + // + // Note: whitespace is taken care of by TraverseSchema. + // + else + { + assignAdditionalFacet(key, value, manager); + } + }//while +}//end of assigneFacet() + +// +// Check facet among self +// check common facets +// check Additional Facet Constraint +// +void AbstractStringValidator::inspectFacet(MemoryManager* const manager) +{ + + int thisFacetsDefined = getFacetsDefined(); + + if (!thisFacetsDefined) + return; + + // check 4.3.1.c1 error: length & (maxLength | minLength) + if ((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) != 0) + { + if ((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_Len_maxLen, manager); + else if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) != 0)) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_Len_minLen, manager); + } + + // check 4.3.2.c1 must: minLength <= maxLength + if ((thisFacetsDefined & (DatatypeValidator::FACET_MINLENGTH + |DatatypeValidator::FACET_MAXLENGTH)) != 0) + { + XMLSize_t thisMinLength = getMinLength(); + XMLSize_t thisMaxLength = getMaxLength(); + if ( thisMinLength > thisMaxLength ) + { + REPORT_FACET_ERROR(thisMaxLength + , thisMinLength + , XMLExcepts::FACET_maxLen_minLen + , manager) + } + } + +}// end of inspectFacet() + +// +// Check vs base +// check common facets +// check enumeration +// check Additional Facet Constraint +// +void AbstractStringValidator::inspectFacetBase(MemoryManager* const manager) +{ + + AbstractStringValidator *pBaseValidator = (AbstractStringValidator*) getBaseValidator(); + int thisFacetsDefined = getFacetsDefined(); + + if ( (!thisFacetsDefined && !fEnumeration) || + (!pBaseValidator) ) + return; + + int baseFacetsDefined = pBaseValidator->getFacetsDefined(); + + XMLSize_t thisLength = getLength(); + XMLSize_t thisMinLength = getMinLength(); + XMLSize_t thisMaxLength = getMaxLength(); + + XMLSize_t baseLength = pBaseValidator->getLength(); + XMLSize_t baseMinLength = pBaseValidator->getMinLength(); + XMLSize_t baseMaxLength = pBaseValidator->getMaxLength(); + int baseFixed = pBaseValidator->getFixed(); + + /*** + check facets against base.facets + Note: later we need to check the "fix" option of the base type + and apply that to every individual facet. + ***/ + + /*** + Non coexistence of derived' length and base' (minLength | maxLength) + base' length and derived' (minLength | maxLength) + + E2-35 + It is an error for both length and either of minLength or maxLength to be members of {facets}, + unless they are specified in different derivation steps in which case the following must be true: + the {value} of minLength <= the {value} of length <= the {value} of maxLength + ***/ + + // error: length > base.maxLength + // length < base.minLength + if ((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) !=0) + { + if (((baseFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0) && + (thisLength > baseMaxLength) ) + { + REPORT_FACET_ERROR(thisLength + , baseMaxLength + , XMLExcepts::FACET_Len_baseMaxLen + , manager) + } + + if (((baseFacetsDefined & DatatypeValidator::FACET_MINLENGTH) !=0) && + (thisLength < baseMinLength) ) + { + REPORT_FACET_ERROR(thisLength + , baseMinLength + , XMLExcepts::FACET_Len_baseMinLen + , manager) + } + } + + // error: baseLength > maxLength + // baseLength < minLength + if ((baseFacetsDefined & DatatypeValidator::FACET_LENGTH) !=0) + { + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0) && + (baseLength > thisMaxLength) ) + { + REPORT_FACET_ERROR(thisMaxLength + , baseLength + , XMLExcepts::FACET_maxLen_baseLen + , manager) + } + + if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) !=0) && + (baseLength < thisMinLength) ) + { + REPORT_FACET_ERROR(thisMinLength + , baseLength + , XMLExcepts::FACET_minLen_baseLen + , manager) + } + } + + // check 4.3.1.c2 error: length != base.length + if (((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) !=0) && + ((baseFacetsDefined & DatatypeValidator::FACET_LENGTH) !=0)) + { + if ( thisLength != baseLength ) + { + REPORT_FACET_ERROR(thisLength + , baseLength + , XMLExcepts::FACET_Len_baseLen + , manager) + } + } + + /*** + |--- derived ---| + base.minLength <= minLength <= maxLength <= base.maxLength + |------------------- base -------------------| + ***/ + + // check 4.3.2.c1 must: minLength <= base.maxLength + if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH ) != 0) && + ((baseFacetsDefined & DatatypeValidator::FACET_MAXLENGTH ) != 0)) + { + if ( thisMinLength > baseMaxLength ) + { + REPORT_FACET_ERROR(thisMinLength + , baseMaxLength + , XMLExcepts::FACET_minLen_basemaxLen + , manager) + } + } + + // check 4.3.2.c2 error: minLength < base.minLength + if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) !=0) && + ((baseFacetsDefined & DatatypeValidator::FACET_MINLENGTH) != 0)) + { + if ((baseFixed & DatatypeValidator::FACET_MINLENGTH) !=0) + { + if ( thisMinLength != baseMinLength ) + { + REPORT_FACET_ERROR(thisMinLength + , baseMinLength + , XMLExcepts::FACET_minLen_base_fixed + , manager) + } + + } + else + { + if ( thisMinLength < baseMinLength ) + { + REPORT_FACET_ERROR(thisMinLength + , baseMinLength + , XMLExcepts::FACET_minLen_baseminLen + , manager) + } + } + } + + // check 4.3.2.c1 must: base.minLength <= maxLength + if (((baseFacetsDefined & DatatypeValidator::FACET_MINLENGTH) !=0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0)) + { + if ( baseMinLength > thisMaxLength ) + { + REPORT_FACET_ERROR(thisMaxLength + , baseMinLength + , XMLExcepts::FACET_maxLen_baseminLen + , manager) + } + } + + // check 4.3.3.c1 error: maxLength > base.maxLength + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0) && + ((baseFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0)) + { + if ((baseFixed & DatatypeValidator::FACET_MAXLENGTH) !=0) + { + if ( thisMaxLength != baseMaxLength ) + { + REPORT_FACET_ERROR(thisMaxLength + , baseMaxLength + , XMLExcepts::FACET_maxLen_base_fixed + , manager) + } + } + else + { + if ( thisMaxLength > baseMaxLength ) + { + REPORT_FACET_ERROR(thisMaxLength + , baseMaxLength + , XMLExcepts::FACET_maxLen_basemaxLen + , manager) + } + } + } + + // check 4.3.5.c0 must: enumeration values from the value space of base + if ( ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0) && + (getEnumeration() !=0)) + { + XMLSize_t i = 0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + // ask parent do a complete check + pBaseValidator->checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager); +#if 0 +// spec says that only base has to checkContent + // enum shall pass this->checkContent() as well. + checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager); +#endif + } + } + + checkAdditionalFacetConstraints(manager); + +} //end of inspectFacetBase + +// +// Inherit facet from base +// a. inherit common facets +// b. inherit additional facet +// +void AbstractStringValidator::inheritFacet() +{ + /*** + P3. Inherit facets from base.facets + + The reason of this inheriting (or copying values) is to ease + schema constraint checking, so that we need NOT trace back to our + very first base validator in the hierachy. Instead, we are pretty + sure checking against immediate base validator is enough. + ***/ + + AbstractStringValidator *pBaseValidator = (AbstractStringValidator*) getBaseValidator(); + + if (!pBaseValidator) + return; + + int thisFacetsDefined = getFacetsDefined(); + int baseFacetsDefined = pBaseValidator->getFacetsDefined(); + + // inherit length + if (((baseFacetsDefined & DatatypeValidator::FACET_LENGTH) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) == 0)) + { + setLength(pBaseValidator->getLength()); + setFacetsDefined(DatatypeValidator::FACET_LENGTH); + } + + // inherit minLength + if (((baseFacetsDefined & DatatypeValidator::FACET_MINLENGTH) !=0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) == 0)) + { + setMinLength(pBaseValidator->getMinLength()); + setFacetsDefined(DatatypeValidator::FACET_MINLENGTH); + } + + // inherit maxLength + if (((baseFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) !=0) && + ((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) == 0)) + { + setMaxLength(pBaseValidator->getMaxLength()); + setFacetsDefined(DatatypeValidator::FACET_MAXLENGTH); + } + + // inherit enumeration + if (((baseFacetsDefined & DatatypeValidator::FACET_ENUMERATION) !=0) && + ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) == 0)) + { + setEnumeration(pBaseValidator->getEnumeration(), true); + } + + // we don't inherit pattern + + // inherit "fixed" option + setFixed(getFixed() | pBaseValidator->getFixed()); + + // inherit additional facet + inheritAdditionalFacet(); + +} // end of inheritance + + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int AbstractStringValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + return XMLString::compareString(lValue, rValue); +} + +void AbstractStringValidator::validate( const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + checkContent(content, context, false, manager); +} + +void AbstractStringValidator::checkContent( const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager + ) +{ + + //validate against base validator if any + AbstractStringValidator *pBaseValidator = (AbstractStringValidator*) this->getBaseValidator(); + if (pBaseValidator) + pBaseValidator->checkContent(content, context, true, manager); + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + checkValueSpace(content, manager); + XMLSize_t length = getLength(content, manager); + + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) && + (length > getMaxLength())) + { + REPORT_VALUE_ERROR(content + , length + , getMaxLength() + , XMLExcepts::VALUE_GT_maxLen + , manager) + } + + if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) != 0) && + (length < getMinLength())) + { + REPORT_VALUE_ERROR(content + , length + , getMinLength() + , XMLExcepts::VALUE_LT_minLen + , manager) + } + + if (((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) != 0) && + (length != getLength())) + { + REPORT_VALUE_ERROR(content + , length + , getLength() + , XMLExcepts::VALUE_NE_Len + , manager) + } + + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + XMLCh* normContent = XMLString::replicate(content, manager); + ArrayJanitor jan(normContent, manager); + normalizeContent(normContent, manager); + + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (XMLString::equals(normContent, getEnumeration()->elementAt(i))) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + checkAdditionalFacet(content, manager); + +} + +const RefArrayVectorOf* AbstractStringValidator::getEnumString() const +{ + return getEnumeration(); +} + +void AbstractStringValidator::normalizeEnumeration(MemoryManager* const manager) +{ + AbstractStringValidator *pBaseValidator = (AbstractStringValidator*) getBaseValidator(); + + if (!fEnumeration || !pBaseValidator) + return; + + int baseFacetsDefined = pBaseValidator->getFacetsDefined(); + if ((baseFacetsDefined & DatatypeValidator::FACET_WHITESPACE) == 0) + return; + + short whiteSpace = pBaseValidator->getWSFacet(); + + if ( whiteSpace == DatatypeValidator::PRESERVE ) + { + return; + } + else if ( whiteSpace == DatatypeValidator::REPLACE ) + { + XMLSize_t enumLength = getEnumeration()->size(); + for ( XMLSize_t i=0; i < enumLength; i++) + { + XMLString::replaceWS(getEnumeration()->elementAt(i), manager); + } + } + else if ( whiteSpace == DatatypeValidator::COLLAPSE ) + { + XMLSize_t enumLength = getEnumeration()->size(); + for ( XMLSize_t i=0; i < enumLength; i++) + { + XMLString::collapseWS(getEnumeration()->elementAt(i), manager); + } + } +} + +void AbstractStringValidator::normalizeContent(XMLCh* const, MemoryManager* const) const +{ + // default implementation: do nothing + return; +} + + +void AbstractStringValidator::checkAdditionalFacetConstraints(MemoryManager* const) const +{ + return; +} + +void AbstractStringValidator::checkAdditionalFacet(const XMLCh* const + , MemoryManager* const) const +{ + return; +} + +void AbstractStringValidator::inheritAdditionalFacet() +{ + return; +} + +void AbstractStringValidator::assignAdditionalFacet( const XMLCh* const key + , const XMLCh* const + , MemoryManager* const manager) +{ + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); +} + +XMLSize_t AbstractStringValidator::getLength(const XMLCh* const content + , MemoryManager* const) const +{ + return XMLString::stringLen(content); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(AbstractStringValidator) + +void AbstractStringValidator::serialize(XSerializeEngine& serEng) +{ + + DatatypeValidator::serialize(serEng); + + if (serEng.isStoring()) + { + serEng.writeSize (fLength); + serEng.writeSize (fMaxLength); + serEng.writeSize (fMinLength); + serEng< + * + ***/ + XTemplateSerializer::storeObject(fEnumeration, serEng); + + } + else + { + serEng.readSize (fLength); + serEng.readSize (fMaxLength); + serEng.readSize (fMinLength); + serEng>>fEnumerationInherited; + + /*** + * + * Deserialize RefArrayVectorOf + * + ***/ + XTemplateSerializer::loadObject(&fEnumeration, 8, true, serEng); + + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file AbstractStringValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.hpp new file mode 100644 index 000000000..a2ab2c7b1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AbstractStringValidator.hpp @@ -0,0 +1,250 @@ +/* + * 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: AbstractStringValidator.hpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ABSTRACT_STRING_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ABSTRACT_STRING_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT AbstractStringValidator : public DatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + virtual ~AbstractStringValidator(); + + //@} + + virtual const RefArrayVectorOf* getEnumString() const; + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(AbstractStringValidator) + +protected: + + AbstractStringValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + void init(RefArrayVectorOf* const enums + , MemoryManager* const manager); + + // + // Abstract interface + // + virtual void assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager); + + virtual void inheritAdditionalFacet(); + + virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const; + + virtual void checkAdditionalFacet(const XMLCh* const content + , MemoryManager* const manager) const; + + virtual XMLSize_t getLength(const XMLCh* const content + , MemoryManager* const manager) const; + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) = 0; + + // + // to Allow ListDTV to overwrite + // + virtual void inspectFacetBase(MemoryManager* const manager); + + virtual void inheritFacet(); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + + /* + ** Base64BinaryDatatypeValidator to overwrite + */ + virtual void normalizeEnumeration(MemoryManager* const manager); + + virtual void normalizeContent(XMLCh* const, MemoryManager* const manager) const; + +public: +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + + inline XMLSize_t getLength() const; + + inline XMLSize_t getMaxLength() const; + + inline XMLSize_t getMinLength() const; + + inline RefArrayVectorOf* getEnumeration() const; + +protected: +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + + inline void setLength(XMLSize_t); + + inline void setMaxLength(XMLSize_t); + + inline void setMinLength(XMLSize_t); + + inline void setEnumeration(RefArrayVectorOf*, bool); + +private: + + void assignFacet(MemoryManager* const manager); + + void inspectFacet(MemoryManager* const manager); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AbstractStringValidator(const AbstractStringValidator&); + AbstractStringValidator& operator=(const AbstractStringValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // ----------------------------------------------------------------------- + XMLSize_t fLength; + XMLSize_t fMaxLength; + XMLSize_t fMinLength; + bool fEnumerationInherited; + RefArrayVectorOf* fEnumeration; +}; + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + +inline XMLSize_t AbstractStringValidator::getLength() const +{ + return fLength; +} + +inline XMLSize_t AbstractStringValidator::getMaxLength() const +{ + return fMaxLength; +} + +inline XMLSize_t AbstractStringValidator::getMinLength() const +{ + return fMinLength; +} + +inline RefArrayVectorOf* AbstractStringValidator:: getEnumeration() const +{ + return fEnumeration; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + +inline void AbstractStringValidator::setLength(XMLSize_t newLength) +{ + fLength = newLength; +} + +inline void AbstractStringValidator::setMaxLength(XMLSize_t newMaxLength) +{ + fMaxLength = newMaxLength; +} + +inline void AbstractStringValidator::setMinLength(XMLSize_t newMinLength) +{ + fMinLength = newMinLength; +} + +inline void AbstractStringValidator::setEnumeration(RefArrayVectorOf* enums + , bool inherited) +{ + if (enums) + { + if ( !fEnumerationInherited && fEnumeration) + delete fEnumeration; + + fEnumeration = enums; + fEnumerationInherited = inherited; + setFacetsDefined(DatatypeValidator::FACET_ENUMERATION); + } +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file AbstractStringValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp new file mode 100644 index 000000000..eb10bfe94 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp @@ -0,0 +1,98 @@ +/* + * 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: AnySimpleTypeDatatypeValidator.cpp 637054 2008-03-14 11:08:37Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// AnySimpleTypeDatatypeValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +AnySimpleTypeDatatypeValidator::AnySimpleTypeDatatypeValidator(MemoryManager* const manager) + : DatatypeValidator(0, 0, SchemaSymbols::XSD_RESTRICTION, DatatypeValidator::AnySimpleType, manager) +{ + setWhiteSpace(DatatypeValidator::PRESERVE); + setFinite(true); +} + +AnySimpleTypeDatatypeValidator::~AnySimpleTypeDatatypeValidator() +{ + +} + +// --------------------------------------------------------------------------- +// DatatypeValidators: Compare methods +// --------------------------------------------------------------------------- +int AnySimpleTypeDatatypeValidator::compare( const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + return XMLString::compareString(lValue, rValue); +} + +// --------------------------------------------------------------------------- +// AnySimpleTypeDatatypeValidator: Instance methods +// --------------------------------------------------------------------------- +DatatypeValidator* AnySimpleTypeDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int + , MemoryManager* const manager +) +{ + // We own them, so we will delete them first + delete facets; + delete enums; + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::DV_InvalidOperation, manager); + + // to satisfy some compilers + return 0; +} + +const RefArrayVectorOf* AnySimpleTypeDatatypeValidator::getEnumString() const +{ + return 0; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(AnySimpleTypeDatatypeValidator) + +void AnySimpleTypeDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file AnySimpleTypeDatatypeValidator.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp new file mode 100644 index 000000000..2d0670d5e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp @@ -0,0 +1,180 @@ +/* + * 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: AnySimpleTypeDatatypeValidator.hpp 637054 2008-03-14 11:08:37Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ANYSIMPLETYPEDATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ANYSIMPLETYPEDATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT AnySimpleTypeDatatypeValidator : public DatatypeValidator +{ +public: + // ----------------------------------------------------------------------- + // Public Constructor + // ----------------------------------------------------------------------- + /** @name Constructor */ + //@{ + + AnySimpleTypeDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Public Destructor + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + + virtual ~AnySimpleTypeDatatypeValidator(); + + //@} + + virtual const RefArrayVectorOf* getEnumString() const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter Functions */ + //@{ + + /** + * Returns whether the type is atomic or not + */ + virtual bool isAtomic() const; + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * Checks that the "content" string is valid datatype. + * If invalid, a Datatype validation exception is thrown. + * + * @param content A string containing the content to be validated + * + */ + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Checks whether a given type can be used as a substitute + * + * @param toCheck A datatype validator of the type to be used as a + * substitute + * + */ + + virtual bool isSubstitutableBy(const DatatypeValidator* const toCheck); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compares content in the Domain value vs. lexical value. + * + * @param value1 string to compare + * + * @param value2 string to compare + * + */ + virtual int compare(const XMLCh* const value1, const XMLCh* const value2 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(AnySimpleTypeDatatypeValidator) + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AnySimpleTypeDatatypeValidator(const AnySimpleTypeDatatypeValidator&); + AnySimpleTypeDatatypeValidator& operator=(const AnySimpleTypeDatatypeValidator&); +}; + + +// --------------------------------------------------------------------------- +// DatatypeValidator: Getters +// --------------------------------------------------------------------------- +inline bool AnySimpleTypeDatatypeValidator::isAtomic() const { + + return false; +} + +// --------------------------------------------------------------------------- +// DatatypeValidators: Validation methods +// --------------------------------------------------------------------------- +inline bool +AnySimpleTypeDatatypeValidator::isSubstitutableBy(const DatatypeValidator* const) +{ + return true; +} + +inline void +AnySimpleTypeDatatypeValidator::validate(const XMLCh* const + , ValidationContext* const + , MemoryManager* const) +{ + return; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file AnySimpleTypeDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp new file mode 100644 index 000000000..d553b4a79 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp @@ -0,0 +1,199 @@ +/* + * 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: AnyURIDatatypeValidator.cpp 676796 2008-07-15 05:04:13Z dbertoni $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +AnyURIDatatypeValidator::AnyURIDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::AnyURI, manager) +{} + +AnyURIDatatypeValidator::~AnyURIDatatypeValidator() +{ +} + +AnyURIDatatypeValidator::AnyURIDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::AnyURI, manager) +{ + init(enums, manager); +} + +DatatypeValidator* AnyURIDatatypeValidator::newInstance( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +{ + return (DatatypeValidator*) new (manager) AnyURIDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void AnyURIDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + bool validURI = true; + + // check 3.2.17.c0 must: URI (rfc 2396/2723) + try + { + // Support for relative URLs + // According to Java 1.1: URLs may also be specified with a + // String and the URL object that it is related to. + // + XMLSize_t len = XMLString::stringLen(content); + if (len) + { + // Encode special characters using XLink 5.4 algorithm + XMLBuffer encoded((len*3)+1, manager); + encode(content, len, encoded, manager); + validURI = XMLUri::isValidURI(true, encoded.getRawBuffer(), true); + } + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_URI_Malformed + , content + , manager); + } + + if (!validURI) { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_URI_Malformed + , content + , manager); + } +} + +/*** + * To encode special characters in anyURI, by using %HH to represent + * special ASCII characters: 0x00~0x1F, 0x7F, ' ', '<', '>', etc. + * and non-ASCII characters (whose value >= 128). + ***/ +void AnyURIDatatypeValidator::encode(const XMLCh* const content, const XMLSize_t len, XMLBuffer& encoded, MemoryManager* const manager) +{ + static const bool needEscapeMap[] = { + true , true , true , true , true , true , true , true , true , true , true , true , true , true , true , true , /* 0x00 to 0x0F need escape */ + true , true , true , true , true , true , true , true , true , true , true , true , true , true , true , true , /* 0x10 to 0x1F need escape */ + true , false, true , false, false, false, false, false, false, false, false, false, false, false, false, false, /* 0x20:' ', 0x22:'"' */ + false, false, false, false, false, false, false, false, false, false, false, false, true , false, true , false, /* 0x3C:'<', 0x3E:'>' */ + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, true , false, true , false, /* 0x5C:'\\', 0x5E:'^' */ + true , false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, /* 0x60:'`' */ + false, false, false, false, false, false, false, false, false, false, false, true , true , true , true , true /* 0x7B:'{', 0x7C:'|', 0x7D:'}', 0x7E:'~', 0x7F:DEL */ + }; + + // For each character in content + XMLSize_t i; + for (i = 0; i < len; i++) + { + int ch = (int)content[i]; + // If it's not an ASCII character, break here, and use UTF-8 encoding + if (ch >= 128) + break; + + if (needEscapeMap[ch]) + { + char tempStr[3] = "\0"; + sprintf(tempStr, "%02X", ch); + encoded.append('%'); + encoded.append((XMLCh)tempStr[0]); + encoded.append((XMLCh)tempStr[1]); + } + else + { + encoded.append((XMLCh)ch); + } + } + + // we saw some non-ascii character + if (i < len) { + // get UTF-8 bytes for the remaining sub-string + const XMLCh* remContent = (XMLCh*)&content[i]; + const XMLSize_t remContentLen = len - i; + XMLByte* UTF8Byte = (XMLByte*)manager->allocate((remContentLen*4+1) * sizeof(XMLByte)); + XMLSize_t charsEaten; + + XMLUTF8Transcoder transcoder(XMLUni::fgUTF8EncodingString, remContentLen*4+1, manager); + XMLSize_t utf8Len = transcoder.transcodeTo(remContent, remContentLen, UTF8Byte, remContentLen*4, charsEaten, XMLTranscoder::UnRep_RepChar); + assert(charsEaten == remContentLen); + + XMLSize_t j; + for (j = 0; j < utf8Len; j++) { + XMLByte b = UTF8Byte[j]; + if (b >= 128 || needEscapeMap[b]) + { + char tempStr[3] = "\0"; + sprintf(tempStr, "%02X", b); + encoded.append('%'); + encoded.append((XMLCh)tempStr[0]); + encoded.append((XMLCh)tempStr[1]); + } + else + { + encoded.append((XMLCh)b); + } + } + manager->deallocate(UTF8Byte); + } +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(AnyURIDatatypeValidator) + +void AnyURIDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file AnyURIDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.hpp new file mode 100644 index 000000000..1c2e3dc7d --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/AnyURIDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: AnyURIDatatypeValidator.hpp 608951 2008-01-04 18:21:22Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ANYURI_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ANYURI_DATATYPEVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLBuffer; + +class VALIDATORS_EXPORT AnyURIDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + AnyURIDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + AnyURIDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~AnyURIDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(AnyURIDatatypeValidator) + +protected: + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + AnyURIDatatypeValidator(const AnyURIDatatypeValidator&); + AnyURIDatatypeValidator& operator=(const AnyURIDatatypeValidator&); + void encode(const XMLCh* const content, const XMLSize_t len, XMLBuffer& encoded, MemoryManager* const manager); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file AnyURIDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp new file mode 100644 index 000000000..66922e41c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp @@ -0,0 +1,124 @@ +/* + * 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: Base64BinaryDatatypeValidator.cpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +Base64BinaryDatatypeValidator::Base64BinaryDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::Base64Binary, manager) +{} + +Base64BinaryDatatypeValidator::~Base64BinaryDatatypeValidator() +{} + +Base64BinaryDatatypeValidator::Base64BinaryDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::Base64Binary, manager) +{ + init(enums, manager); +} + +DatatypeValidator* Base64BinaryDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) Base64BinaryDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + if (!content || !*content) + return; + + if (Base64::getDataLength(content, manager, Base64::Conf_Schema) < 0) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Not_Base64 + , content + , manager); + } +} + +XMLSize_t Base64BinaryDatatypeValidator::getLength(const XMLCh* const content + , MemoryManager* const manager) const +{ + if (!content || !*content) + return 0; + + return (XMLSize_t)Base64::getDataLength(content, manager, Base64::Conf_Schema); +} + +void Base64BinaryDatatypeValidator::normalizeEnumeration(MemoryManager* const manager) +{ + + XMLSize_t enumLength = getEnumeration()->size(); + for ( XMLSize_t i=0; i < enumLength; i++) + { + XMLString::removeWS(getEnumeration()->elementAt(i), manager); + } + +} + +void Base64BinaryDatatypeValidator::normalizeContent(XMLCh* const content + , MemoryManager* const manager) const +{ + XMLString::removeWS(content, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(Base64BinaryDatatypeValidator) + +void Base64BinaryDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file Base64BinaryDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp new file mode 100644 index 000000000..c4c6ee410 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp @@ -0,0 +1,100 @@ +/* + * 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: Base64BinaryDatatypeValidator.hpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BASE64BINARY_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_BASE64BINARY_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT Base64BinaryDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + Base64BinaryDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + Base64BinaryDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~Base64BinaryDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(Base64BinaryDatatypeValidator) + +protected: + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + + virtual XMLSize_t getLength(const XMLCh* const content + , MemoryManager* const manager) const; + + virtual void normalizeEnumeration(MemoryManager* const manager); + + virtual void normalizeContent(XMLCh* const, MemoryManager* const manager) const; + +private: + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + Base64BinaryDatatypeValidator(const Base64BinaryDatatypeValidator&); + Base64BinaryDatatypeValidator& operator=(const Base64BinaryDatatypeValidator&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file Base64BinaryDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp new file mode 100644 index 000000000..be7072f36 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp @@ -0,0 +1,212 @@ +/* + * 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: BooleanDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +BooleanDatatypeValidator::BooleanDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Boolean, manager) +{ + + // Set Facets if any defined + if ( facets ) + { + + // Boolean shall NOT have enumeration + if (enums) { + delete enums; + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , "enumeration" + , manager); + } + + XMLCh* key; + XMLCh* value; + RefHashTableOfEnumerator e(facets, false, manager); + + while (e.hasMoreElements()) + { + KVStringPair pair = e.nextElement(); + key = pair.getKey(); + value = pair.getValue(); + + if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN)) + { + setPattern(value); + setFacetsDefined(DatatypeValidator::FACET_PATTERN); + } + else + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); + } + + } + + }// End of facet setting +} + +void BooleanDatatypeValidator::checkContent( const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + + //validate against base validator if any + BooleanDatatypeValidator *pBaseValidator = (BooleanDatatypeValidator*) this->getBaseValidator(); + if (pBaseValidator !=0) + pBaseValidator->checkContent(content, context, true, manager); + + // we check pattern first + if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + unsigned int i = 0; + for ( ; i < XMLUni::fgBooleanValueSpaceArraySize; i++ ) + { + if ( XMLString::equals(content, XMLUni::fgBooleanValueSpace[i])) + break; + } + + if (i == XMLUni::fgBooleanValueSpaceArraySize) + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_Name + , content + , SchemaSymbols::fgDT_BOOLEAN + , manager); + //Not valid boolean type + +} + +int BooleanDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + // need to check by bool semantics + // 1 == true + // 0 == false + + if (XMLString::equals(lValue, XMLUni::fgBooleanValueSpace[0])|| + XMLString::equals(lValue, XMLUni::fgBooleanValueSpace[2])) + { + if (XMLString::equals(rValue, XMLUni::fgBooleanValueSpace[0]) || + XMLString::equals(rValue, XMLUni::fgBooleanValueSpace[2])) + return 0; + } + else + if (XMLString::equals(lValue, XMLUni::fgBooleanValueSpace[1]) || + XMLString::equals(lValue, XMLUni::fgBooleanValueSpace[3])) + { + if (XMLString::equals(rValue, XMLUni::fgBooleanValueSpace[1]) || + XMLString::equals(rValue, XMLUni::fgBooleanValueSpace[3])) + return 0; + } + + return 1; +} + +const RefArrayVectorOf* BooleanDatatypeValidator::getEnumString() const +{ + return 0; +} + +/*** + * 3.2.2.2 Canonical representation + * + * The canonical representation for boolean is the set of literals {true, false}. + ***/ +const XMLCh* BooleanDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + + MemoryManager* toUse = memMgr? memMgr : getMemoryManager(); + + if (toValidate) + { + BooleanDatatypeValidator *temp = (BooleanDatatypeValidator*) this; + + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + return ( XMLString::equals(rawData, XMLUni::fgBooleanValueSpace[0]) || + XMLString::equals(rawData, XMLUni::fgBooleanValueSpace[2]) ) ? + XMLString::replicate(XMLUni::fgBooleanValueSpace[0], toUse) : + XMLString::replicate(XMLUni::fgBooleanValueSpace[1], toUse) ; + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(BooleanDatatypeValidator) + +void BooleanDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file BooleanDatatypeValidator.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp new file mode 100644 index 000000000..05f70838c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp @@ -0,0 +1,193 @@ +/* + * 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: BooleanDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_BOOLEAN_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_BOOLEAN_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT BooleanDatatypeValidator : public DatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + BooleanDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + BooleanDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~BooleanDatatypeValidator(); + + //@} + + virtual const RefArrayVectorOf* getEnumString() const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter Functions */ + //@{ + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(BooleanDatatypeValidator) + +private: + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + + // ----------------------------------------------------------------------- + // Unimplemented methods. + // ----------------------------------------------------------------------- + BooleanDatatypeValidator(const BooleanDatatypeValidator&); + BooleanDatatypeValidator& operator=(const BooleanDatatypeValidator&); + +}; + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +inline BooleanDatatypeValidator::BooleanDatatypeValidator(MemoryManager* const manager) +:DatatypeValidator(0, 0, 0, DatatypeValidator::Boolean, manager) +{ + setFinite(true); +} + +inline BooleanDatatypeValidator::~BooleanDatatypeValidator() +{ +} + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- + +inline DatatypeValidator* BooleanDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) BooleanDatatypeValidator(this, facets, enums, finalSet, manager); +} + +inline void BooleanDatatypeValidator::validate( const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + checkContent(content, context, false, manager); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file BooleanDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.cpp new file mode 100644 index 000000000..18c9d4b8a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.cpp @@ -0,0 +1,546 @@ +/* + * 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: DatatypeValidator.cpp 555320 2007-07-11 16:05:13Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +//since we need to dynamically created each and every derivatives +//during deserialization by XSerializeEngine>>Derivative, we got +//to include all hpp + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const int DV_BUILTIN = -1; +static const int DV_NORMAL = -2; +static const int DV_ZERO = -3; + +static const int TYPENAME_ZERO = -1; +static const int TYPENAME_S4S = -2; +static const int TYPENAME_NORMAL = -3; + +// --------------------------------------------------------------------------- +// DatatypeValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +DatatypeValidator::DatatypeValidator(DatatypeValidator* const baseValidator, + RefHashTableOf* const facets, + const int finalSet, + const ValidatorType type, + MemoryManager* const manager) + : fAnonymous(false) + , fFinite(false) + , fBounded(false) + , fNumeric(false) + , fWhiteSpace(COLLAPSE) + , fFinalSet(finalSet) + , fFacetsDefined(0) + , fFixed(0) + , fType(type) + , fOrdered(XSSimpleTypeDefinition::ORDERED_FALSE) + , fBaseValidator(baseValidator) + , fFacets(facets) + , fPattern(0) + , fRegex(0) + , fTypeName(0) + , fTypeLocalName(XMLUni::fgZeroLenString) + , fTypeUri(XMLUni::fgZeroLenString) + , fMemoryManager(manager) +{ +} + +DatatypeValidator::~DatatypeValidator() +{ + cleanUp(); +} + +const XMLCh* DatatypeValidator::getWSstring(const short theType) const +{ + switch (theType) + { + case PRESERVE: + return SchemaSymbols::fgWS_PRESERVE; + case REPLACE: + return SchemaSymbols::fgWS_REPLACE; + case COLLAPSE: + return SchemaSymbols::fgWS_COLLAPSE; + default: + return SchemaSymbols::fgWS_PRESERVE; + } + +} + +void DatatypeValidator::setTypeName(const XMLCh* const name, const XMLCh* const uri) +{ + if (fTypeName) { + + fMemoryManager->deallocate(fTypeName); + fTypeName = 0; + } + + if (name || uri) { + + XMLSize_t nameLen = XMLString::stringLen(name); + XMLSize_t uriLen = XMLString::stringLen(uri); + + fTypeName = (XMLCh*) fMemoryManager->allocate + ( + (nameLen + uriLen + 2)*sizeof(XMLCh) + ); + fTypeUri = fTypeName; + fTypeLocalName = &fTypeName[uriLen+1]; + + if (uri) + XMLString::moveChars(fTypeName, uri, uriLen+1); + else + fTypeName[0] = chNull; + + if (name) + XMLString::moveChars(&fTypeName[uriLen+1], name, nameLen+1); + else + fTypeName[uriLen+1] = chNull; + } + else + { + fTypeUri = fTypeLocalName = XMLUni::fgZeroLenString; + } +} + +void DatatypeValidator::setTypeName(const XMLCh* const typeName) +{ + if (fTypeName) + { + fMemoryManager->deallocate(fTypeName); + fTypeName = 0; + } + + if (typeName) + { + XMLSize_t nameLen = XMLString::stringLen(typeName); + int commaOffset = XMLString::indexOf(typeName, chComma); + + fTypeName = (XMLCh*) fMemoryManager->allocate + ( + (nameLen + 1) * sizeof(XMLCh) + ); + XMLString::moveChars(fTypeName, typeName, nameLen+1); + + if ( commaOffset == -1) { + fTypeUri = SchemaSymbols::fgURI_SCHEMAFORSCHEMA; + fTypeLocalName = fTypeName; + } + else { + fTypeUri = fTypeName; + fTypeLocalName = &fTypeName[commaOffset+1]; + fTypeName[commaOffset] = chNull; + } + } + else + { + fTypeUri = fTypeLocalName = XMLUni::fgZeroLenString; + } +} + +// --------------------------------------------------------------------------- +// DatatypeValidator: CleanUp methods +// --------------------------------------------------------------------------- +void DatatypeValidator::cleanUp() { + + delete fFacets; + delete fRegex; + if (fPattern) + fMemoryManager->deallocate(fPattern);//delete [] fPattern; + if (fTypeName) + fMemoryManager->deallocate(fTypeName); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(DatatypeValidator) + +void DatatypeValidator::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng< + ***/ + XTemplateSerializer::storeObject(fFacets, serEng); + + serEng.writeString(fPattern); + + if (fTypeUri==XMLUni::fgZeroLenString) + { + serEng<>fAnonymous; + serEng>>fFinite; + serEng>>fBounded; + serEng>>fNumeric; + + serEng>>fWhiteSpace; + serEng>>fFinalSet; + serEng>>fFacetsDefined; + serEng>>fFixed; + + int type; + serEng>>type; + fType=(ValidatorType)type; + + serEng>>type; + fOrdered = (XSSimpleTypeDefinition::ORDERING)type; + + + fBaseValidator = loadDV(serEng); + + /*** + * + * Deserialize RefHashTableOf + * + ***/ + XTemplateSerializer::loadObject(&fFacets, 29, true, serEng); + serEng.readString(fPattern); + + /*** + * Recreate through setTypeName() + * fTypeName + ***/ + + int flag; + serEng>>flag; + + if ( TYPENAME_ZERO == flag ) + { + setTypeName(0); + } + else if ( TYPENAME_S4S == flag ) + { + XMLCh* typeLocalName; + serEng.readString(typeLocalName); + ArrayJanitor janName(typeLocalName, fMemoryManager); + + setTypeName(typeLocalName); + } + else // TYPENAME_NORMAL + { + XMLCh* typeLocalName; + serEng.readString(typeLocalName); + ArrayJanitor janName(typeLocalName, fMemoryManager); + + XMLCh* typeUri; + serEng.readString(typeUri); + ArrayJanitor janUri(typeUri, fMemoryManager); + + setTypeName(typeLocalName, typeUri); + } + + /*** + * don't serialize fRegex + ***/ + fRegex = new (fMemoryManager) RegularExpression(fPattern, SchemaSymbols::fgRegEx_XOption, fMemoryManager); + + } + +} + +/*** + * + * When deserialized, we need to know, exactly what + * validator was serialized here. + * + * Design Issue: + * + * This extra type information is only necessary when + * we need to create and deserialize an DatatypeValidator + * derivative by operator >>, but not by object.serialize(). + * Therefore it is appropriate to save this type info by + * hosting object rather than by derivative.serialize(). + * + * + ***/ +void DatatypeValidator::storeDV(XSerializeEngine& serEng + , DatatypeValidator* const dv) +{ + if (dv) + { + //builtIndv + if (dv == DatatypeValidatorFactory::getBuiltInRegistry()->get(dv->getTypeLocalName())) + { + serEng<getTypeLocalName()); + } + else + { + serEng<getType(); + serEng<>flag; + + if (DV_BUILTIN == flag) + { + XMLCh* dvName; + serEng.readString(dvName); + ArrayJanitor janName(dvName, serEng.getMemoryManager()); + + return DatatypeValidatorFactory::getBuiltInRegistry()->get(dvName); + } + else if (DV_ZERO == flag) + { + return 0; + } + + int type; + serEng>>type; + + switch((ValidatorType)type) + { + case String: + StringDatatypeValidator* stringdv; + serEng>>stringdv; + return stringdv; + case AnyURI: + AnyURIDatatypeValidator* anyuridv; + serEng>>anyuridv; + return anyuridv; + case QName: + QNameDatatypeValidator* qnamedv; + serEng>>qnamedv; + return qnamedv; + case Name: + NameDatatypeValidator* namedv; + serEng>>namedv; + return namedv; + case NCName: + NCNameDatatypeValidator* ncnamedv; + serEng>>ncnamedv; + return ncnamedv; + case Boolean: + BooleanDatatypeValidator* booleandv; + serEng>>booleandv; + return booleandv; + case Float: + FloatDatatypeValidator* floatdv; + serEng>>floatdv; + return floatdv; + case Double: + DoubleDatatypeValidator* doubledv; + serEng>>doubledv; + return doubledv; + case Decimal: + DecimalDatatypeValidator* decimaldv; + serEng>>decimaldv; + return decimaldv; + case HexBinary: + HexBinaryDatatypeValidator* hexbinarydv; + serEng>>hexbinarydv; + return hexbinarydv; + case Base64Binary: + Base64BinaryDatatypeValidator* base64binarydv; + serEng>>base64binarydv; + return base64binarydv; + case Duration: + DurationDatatypeValidator* durationdv; + serEng>>durationdv; + return durationdv; + case DateTime: + DateTimeDatatypeValidator* datetimedv; + serEng>>datetimedv; + return datetimedv; + case Date: + DateDatatypeValidator* datedv; + serEng>>datedv; + return datedv; + case Time: + TimeDatatypeValidator* timedv; + serEng>>timedv; + return timedv; + case MonthDay: + MonthDayDatatypeValidator* monthdaydv; + serEng>>monthdaydv; + return monthdaydv; + case YearMonth: + YearMonthDatatypeValidator* yearmonthdv; + serEng>>yearmonthdv; + return yearmonthdv; + case Year: + YearDatatypeValidator* yeardv; + serEng>>yeardv; + return yeardv; + case Month: + MonthDatatypeValidator* monthdv; + serEng>>monthdv; + return monthdv; + case Day: + DayDatatypeValidator* daydv; + serEng>>daydv; + return daydv; + case ID: + IDDatatypeValidator* iddv; + serEng>>iddv; + return iddv; + case IDREF: + IDREFDatatypeValidator* idrefdv; + serEng>>idrefdv; + return idrefdv; + case ENTITY: + ENTITYDatatypeValidator* entitydv; + serEng>>entitydv; + return entitydv; + case NOTATION: + NOTATIONDatatypeValidator* notationdv; + serEng>>notationdv; + return notationdv; + case List: + ListDatatypeValidator* listdv; + serEng>>listdv; + return listdv; + case Union: + UnionDatatypeValidator* uniondv; + serEng>>uniondv; + return uniondv; + case AnySimpleType: + AnySimpleTypeDatatypeValidator* anysimpletypedv; + serEng>>anysimpletypedv; + return anysimpletypedv; + case UnKnown: + return 0; + default: //we treat this same as UnKnown + return 0; + } + +} + +/** + * Canonical Representation + * + */ +const XMLCh* DatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + + if (toValidate) + { + DatatypeValidator *temp = (DatatypeValidator*) this; + + try + { + temp->validate(rawData, 0, toUse); + } + catch (...) + { + return 0; + } + } + + return XMLString::replicate(rawData, toUse); +} + + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DatatypeValidator.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.hpp new file mode 100644 index 000000000..58a91beb8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidator.hpp @@ -0,0 +1,750 @@ +/* + * 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: DatatypeValidator.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DATATYPEVALIDATOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class MemoryManager; + +/** + * DataTypeValidator defines the interface that data type validators must + * obey. These validators can be supplied by the application writer and may + * be useful as standalone code as well as plugins to the validator + * architecture. + * + * Notice: + * The datatype validator will own the facets hashtable passed to it during + * construction, which means that the datatype validator will be responsible + * for the deletion. The facets hashtable will be created during parsing and + * passed to the appropriate datatype validator which in turn will delete it + * upon its destruction. + * + */ + + +class VALIDATORS_EXPORT DatatypeValidator : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constant data + // ----------------------------------------------------------------------- + //facets + enum { + FACET_LENGTH = 1, + FACET_MINLENGTH = 1<<1, + FACET_MAXLENGTH = 1<<2, + FACET_PATTERN = 1<<3, + FACET_ENUMERATION = 1<<4, + FACET_MAXINCLUSIVE = 1<<5, + FACET_MAXEXCLUSIVE = 1<<6, + FACET_MININCLUSIVE = 1<<7, + FACET_MINEXCLUSIVE = 1<<8, + FACET_TOTALDIGITS = 1<<9, + FACET_FRACTIONDIGITS = 1<<10, + FACET_ENCODING = 1<<11, + FACET_DURATION = 1<<12, + FACET_PERIOD = 1<<13, + FACET_WHITESPACE = 1<<14 + }; + + //2.4.2.6 whiteSpace - Datatypes + enum { + PRESERVE = 0, + REPLACE = 1, + COLLAPSE = 2 + }; + + enum ValidatorType { + String, + AnyURI, + QName, + Name, + NCName, + Boolean, + Float, + Double, + Decimal, + HexBinary, + Base64Binary, + Duration, + DateTime, + Date, + Time, + MonthDay, + YearMonth, + Year, + Month, + Day, + ID, + IDREF, + ENTITY, + NOTATION, + List, + Union, + AnySimpleType, + UnKnown + }; + + // ----------------------------------------------------------------------- + // Public Destructor + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + + virtual ~DatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter Functions */ + //@{ + + /** + * Returns the final values of the simpleType + */ + int getFinalSet() const; + + /** + * Returns the datatype facet if any is set. + */ + RefHashTableOf* getFacets() const; + + /** + * Returns default value (collapse) for whiteSpace facet. + * This function is overwritten in StringDatatypeValidator. + */ + short getWSFacet () const; + + /** + * Returns the base datatype validator if set. + */ + DatatypeValidator* getBaseValidator() const; + + /** + * Returns the 'class' type of datatype validator + */ + ValidatorType getType() const; + + /** + * Returns whether the type is atomic or not + * + * To be redefined in List/Union validators + */ + virtual bool isAtomic() const; + + /** + * Returns the datatype enumeration if any is set. + * Derived class shall provide their own copy. + */ + virtual const RefArrayVectorOf* getEnumString() const = 0; + + /** + * returns true if this type is anonymous + **/ + bool getAnonymous() const; + + /** + * sets this type to be anonymous + **/ + void setAnonymous(); + + /** + * Fundamental Facet: ordered + */ + XSSimpleTypeDefinition::ORDERING getOrdered() const; + + /** + * Fundamental Facet: cardinality. + */ + bool getFinite() const; + + /** + * Fundamental Facet: bounded. + */ + bool getBounded() const; + + /** + * Fundamental Facet: numeric. + */ + bool getNumeric() const; + + /** + * Canonical Representation + * + * Derivative datatype may overwrite this method once + * it has its own canonical representation other than + * the default one. + * + * @param rawData: data in raw string + * @param memMgr: memory manager + * @param toValiate: to validate the raw string or not + * + * @return: canonical representation of the data + * + * Note: + * + * 1. the return value is kept in memory allocated + * by the memory manager passed in or by dv's + * if no memory manager is provided. + * + * 2. client application is responsible for the + * proper deallocation of the memory allocated + * for the returned value. + * + * 3. In the case where the rawData is not valid + * with regards to the fundamental datatype, + * a null string is returned. + * + */ + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * Checks that the "content" string is valid datatype. + * If invalid, a Datatype validation exception is thrown. + * + * @param content A string containing the content to be validated + * + */ + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + /** + * Checks whether a given type can be used as a substitute + * + * @param toCheck A datatype validator of the type to be used as a + * substitute + * + * To be redefined in UnionDatatypeValidator + */ + + virtual bool isSubstitutableBy(const DatatypeValidator* const toCheck); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compares content in the Domain value vs. lexical value. + * + * e.g. If type is a float then 1.0 may be equivalent to 1 even though + * both are lexically different. + * + * @param value1 string to compare + * + * @param value2 string to compare + * + * We will provide a default behavior that should be redefined at the + * children level, if necessary (i.e. boolean case). + */ + virtual int compare(const XMLCh* const value1, const XMLCh* const value2 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ) = 0; + + /** + * Returns the uri,name of the type this validator is for + */ + const XMLCh* getTypeName() const; + + /** + * sets the uri,name that this validator is for - typeName is uri,name string. + * due to the internals of xerces this will set the uri to be the schema uri if + * there is no comma in typeName + */ + void setTypeName(const XMLCh* const typeName); + + /** + * sets the uri,name that this validator is for + */ + void setTypeName(const XMLCh* const name, const XMLCh* const uri); + + /** + * Returns the uri of the type this validator is for + */ + const XMLCh* getTypeUri() const; + + /** + * Returns the name of the type this validator is for + */ + const XMLCh* getTypeLocalName() const; + + /** + * Returns the plugged-in memory manager + */ + MemoryManager* getMemoryManager() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DatatypeValidator) + + /*** + * + * Serialize DatatypeValidator derivative + * + * Param + * serEng: serialize engine + * dv: DatatypeValidator derivative + * + * Return: + * + ***/ + static void storeDV(XSerializeEngine& serEng + , DatatypeValidator* const dv); + + /*** + * + * Create a DatatypeValidator derivative from the binary + * stream. + * + * Param + * serEng: serialize engine + * + * Return: + * DatatypeValidator derivative + * + ***/ + static DatatypeValidator* loadDV(XSerializeEngine& serEng); + +protected: + // ----------------------------------------------------------------------- + // Protected Constructors + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + /** + * + * @param baseValidator The base datatype validator for derived + * validators. Null if native validator. + * + * @param facets A hashtable of datatype facets (except enum). + * + * @param finalSet 'final' value of the simpleType + */ + + DatatypeValidator(DatatypeValidator* const baseValidator, + RefHashTableOf* const facets, + const int finalSet, + const ValidatorType type, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + + friend class DatatypeValidatorFactory; + friend class XSObjectFactory; + + /** + * facetDefined + */ + int getFacetsDefined() const; + void setFacetsDefined(int); + + /** + * fixed + */ + int getFixed() const; + void setFixed(int); + + + /** + * fPattern + */ + const XMLCh* getPattern() const; + void setPattern(const XMLCh* ); + + /** + * fRegex + */ + RegularExpression* getRegex() const; + void setRegex(RegularExpression* const); + + /** + * set fType + */ + void setType(ValidatorType); + + /** + * set fWhiteSpace + */ + void setWhiteSpace(short); + + /** + * get WSString + */ + const XMLCh* getWSstring(const short WSType) const; + + /** + * Fundamental Facet: ordered + */ + void setOrdered(XSSimpleTypeDefinition::ORDERING ordered); + + /** + * Fundamental Facet: cardinality. + */ + void setFinite(bool finite); + + /** + * Fundamental Facet: bounded. + */ + void setBounded(bool bounded); + + /** + * Fundamental Facet: numeric. + */ + void setNumeric(bool numeric); + +private: + // ----------------------------------------------------------------------- + // CleanUp methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DatatypeValidator(const DatatypeValidator&); + DatatypeValidator& operator=(const DatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fFinalSet + // stores "final" values of simpleTypes + // + // fBaseValidator + // This is a pointer to a base datatype validator. If value is null, + // it means we have a native datatype validator not a derived one. + // + // fFacets + // This is a hashtable of dataype facets. + // + // fType + // Stores the class type of datatype validator + // + // fFacetsDefined + // Stores the constaiting facets flag + // + // fPattern + // the pointer to the String of the pattern. The actual data is + // in the Facets. + // + // fRegex + // pointer to the RegularExpress object + // + // + // fFixed + // if {fixed} is true, then types for which this type is the + // {base type definition} cannot specify a value for a specific + // facet. + // + // fTypeName + // the uri,name of the type this validator will validate + // + // fTypeLocalName + // the name of the type this validator will validate + // + // fTypeUri + // the uri of the type this validator will validate + // fAnonymous + // true if this type is anonynous + // + // ----------------------------------------------------------------------- + bool fAnonymous; + bool fFinite; + bool fBounded; + bool fNumeric; + + short fWhiteSpace; + int fFinalSet; + int fFacetsDefined; + int fFixed; + + ValidatorType fType; + XSSimpleTypeDefinition::ORDERING fOrdered; + + DatatypeValidator* fBaseValidator; + RefHashTableOf* fFacets; + XMLCh* fPattern; + RegularExpression* fRegex; + XMLCh* fTypeName; + const XMLCh* fTypeLocalName; + const XMLCh* fTypeUri; + +protected: + // ----------------------------------------------------------------------- + // Protected data members + // + // fMemoryManager + // Pluggable memory manager for dynamic allocation/deallocation. + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + +}; + + +// --------------------------------------------------------------------------- +// DatatypeValidator: Getters +// --------------------------------------------------------------------------- +inline int DatatypeValidator::getFinalSet() const { + + return fFinalSet; +} + +inline RefHashTableOf* DatatypeValidator::getFacets() const { + + return fFacets; +} + +inline DatatypeValidator* DatatypeValidator::getBaseValidator() const { + + return fBaseValidator; +} + +inline short DatatypeValidator::getWSFacet() const { + + return fWhiteSpace; +} + +inline DatatypeValidator::ValidatorType DatatypeValidator::getType() const +{ + return fType; +} + +inline int DatatypeValidator::getFacetsDefined() const +{ + return fFacetsDefined; +} + +inline int DatatypeValidator::getFixed() const +{ + return fFixed; +} + +inline const XMLCh* DatatypeValidator::getPattern() const +{ + return fPattern; +} + +inline RegularExpression* DatatypeValidator::getRegex() const +{ + return fRegex; +} + +inline const XMLCh* DatatypeValidator::getTypeName() const +{ + return fTypeName; +} + +inline bool DatatypeValidator::getAnonymous() const +{ + return fAnonymous; +} + +inline const XMLCh* DatatypeValidator::getTypeLocalName() const +{ + return fTypeLocalName; +} + +inline const XMLCh* DatatypeValidator::getTypeUri() const +{ + return fTypeUri; +} + +inline MemoryManager* DatatypeValidator::getMemoryManager() const +{ + return fMemoryManager; +} + +inline XSSimpleTypeDefinition::ORDERING DatatypeValidator::getOrdered() const +{ + return fOrdered; +} + +inline bool DatatypeValidator::getFinite() const +{ + return fFinite; +} + +inline bool DatatypeValidator::getBounded() const +{ + return fBounded; +} + +inline bool DatatypeValidator::getNumeric() const +{ + return fNumeric; +} + +// --------------------------------------------------------------------------- +// DatatypeValidator: Setters +// --------------------------------------------------------------------------- +inline void DatatypeValidator::setType(ValidatorType theType) +{ + fType = theType; +} + +inline void DatatypeValidator::setWhiteSpace(short newValue) +{ + fWhiteSpace = newValue; +} + +inline void DatatypeValidator::setFacetsDefined(int facets) +{ + fFacetsDefined |= facets; +} + +inline void DatatypeValidator::setFixed(int fixed) +{ + fFixed |= fixed; +} + +inline void DatatypeValidator::setPattern(const XMLCh* pattern) +{ + if (fPattern) { + fMemoryManager->deallocate(fPattern);//delete [] fPattern; + delete fRegex; + } + fPattern = XMLString::replicate(pattern, fMemoryManager); + fRegex = new (fMemoryManager) RegularExpression(fPattern, SchemaSymbols::fgRegEx_XOption, fMemoryManager); +} + +inline void DatatypeValidator::setRegex(RegularExpression* const regex) +{ + fRegex = regex; +} + +inline bool DatatypeValidator::isAtomic() const { + + return true; +} + +inline void DatatypeValidator::setAnonymous() { + fAnonymous = true; +} + +inline void DatatypeValidator::setOrdered(XSSimpleTypeDefinition::ORDERING ordered) +{ + fOrdered = ordered; +} + +inline void DatatypeValidator::setFinite(bool finite) +{ + fFinite = finite; +} + +inline void DatatypeValidator::setBounded(bool bounded) +{ + fBounded = bounded; +} + +inline void DatatypeValidator::setNumeric(bool numeric) +{ + fNumeric = numeric; +} + +// --------------------------------------------------------------------------- +// DatatypeValidators: Compare methods +// --------------------------------------------------------------------------- +inline int DatatypeValidator::compare(const XMLCh* const lValue, + const XMLCh* const rValue + , MemoryManager* const) +{ + return XMLString::compareString(lValue, rValue); +} + +// --------------------------------------------------------------------------- +// DatatypeValidators: Validation methods +// --------------------------------------------------------------------------- +inline bool +DatatypeValidator::isSubstitutableBy(const DatatypeValidator* const toCheck) +{ + const DatatypeValidator* dv = toCheck; + + while (dv != 0) { + + if (dv == this) { + return true; + } + + dv = dv->getBaseValidator(); + } + + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp new file mode 100644 index 000000000..26d5e11f2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp @@ -0,0 +1,900 @@ +/* + * 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: DatatypeValidatorFactory.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Local const data +// --------------------------------------------------------------------------- +const XMLCh fgTokPattern[] = +{ + chBackSlash, chLatin_c, chPlus, chNull +}; + +//E2-43 +//[+\-]?[0-9]+ +const XMLCh fgIntegerPattern[] = +{ + chOpenSquare, chPlus, chBackSlash, chDash, chCloseSquare, chQuestion, + chOpenSquare, chDigit_0, chDash, chDigit_9, chCloseSquare, chPlus, chNull +}; + +//"\\i\\c*" +const XMLCh fgNamePattern[] = +{ + chBackSlash, chLatin_i, chBackSlash, chLatin_c, chAsterisk, chNull +}; + +//"[\\i-[:]][\\c-[:]]*" +const XMLCh fgNCNamePattern[] = +{ + chOpenSquare, chBackSlash, chLatin_i, chDash, chOpenSquare, chColon, chCloseSquare, + chCloseSquare, chOpenSquare, chBackSlash, chLatin_c, chDash, chOpenSquare, + chColon, chCloseSquare, chCloseSquare, chAsterisk, chNull +}; + + + +const XMLCh fgP0Y[] = +{ + chLatin_P, chDigit_0, chLatin_Y, chNull +}; + +const XMLCh fgP1Y[] = +{ + chLatin_P, chDigit_1, chLatin_Y, chNull +}; + +const XMLCh fgP100Y[] = +{ + chLatin_P, chDigit_1, chDigit_0, chDigit_0, chLatin_Y, chNull +}; + +const XMLCh fgPT24H[] = +{ + chLatin_P, chLatin_T, chDigit_2, chDigit_4, chLatin_H, chNull +}; + +const XMLCh fgP1M[] = +{ + chLatin_P, chDigit_1, chLatin_M, chNull +}; + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Static member data +// --------------------------------------------------------------------------- +RefHashTableOf* DatatypeValidatorFactory::fBuiltInRegistry = 0; +RefHashTableOf* DatatypeValidatorFactory::fCanRepRegistry = 0; + +void XMLInitializer::initializeDatatypeValidatorFactory() +{ + // @@ This is ugly. Need to make expandRegistryToFullSchemaSet + // static. + // + DatatypeValidatorFactory *dvFactory = new DatatypeValidatorFactory(); + if (dvFactory) { + dvFactory->expandRegistryToFullSchemaSet(); + delete dvFactory; + } +} + +void XMLInitializer::terminateDatatypeValidatorFactory() +{ + delete DatatypeValidatorFactory::fBuiltInRegistry; + DatatypeValidatorFactory::fBuiltInRegistry = 0; + + delete DatatypeValidatorFactory::fCanRepRegistry; + DatatypeValidatorFactory::fCanRepRegistry = 0; +} + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Constructors and Destructor +// --------------------------------------------------------------------------- +DatatypeValidatorFactory::DatatypeValidatorFactory(MemoryManager* const manager) + : fUserDefinedRegistry(0) + , fMemoryManager(manager) +{ +} + +DatatypeValidatorFactory::~DatatypeValidatorFactory() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Reset methods +// --------------------------------------------------------------------------- +void DatatypeValidatorFactory::resetRegistry() { + + if (fUserDefinedRegistry != 0) { + fUserDefinedRegistry->removeAll(); + } +} + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Registry initialization methods +// --------------------------------------------------------------------------- +void DatatypeValidatorFactory::expandRegistryToFullSchemaSet() +{ + //Initialize common Schema/DTD Datatype validator set + fBuiltInRegistry = new RefHashTableOf(29); + + DatatypeValidator *dv = new StringDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_STRING, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_STRING, dv); + + dv = new NOTATIONDatatypeValidator(); + dv->setTypeName(XMLUni::fgNotationString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) XMLUni::fgNotationString, dv); + + dv = new AnySimpleTypeDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_ANYSIMPLETYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_ANYSIMPLETYPE, dv); + + dv = new BooleanDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_BOOLEAN, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_BOOLEAN, dv); + + dv = new DecimalDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DECIMAL, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DECIMAL, dv); + + dv = new HexBinaryDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_HEXBINARY, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_HEXBINARY, dv); + + dv = new Base64BinaryDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_BASE64BINARY, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_BASE64BINARY, dv); + + dv = new DoubleDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DOUBLE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DOUBLE, dv); + + dv = new FloatDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_FLOAT, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_FLOAT, dv); + + dv = new AnyURIDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_ANYURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_ANYURI, dv); + + dv = new QNameDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_QNAME, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_QNAME, dv); + + dv = new DateTimeDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DATETIME, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DATETIME, dv); + + dv = new DateDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DATE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DATE, dv); + + dv = new TimeDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_TIME, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_TIME, dv); + + dv = new DayDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DAY, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DAY, dv); + + dv = new MonthDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_MONTH, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_MONTH, dv); + + dv = new MonthDayDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_MONTHDAY, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_MONTHDAY, dv); + + dv = new YearDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_YEAR, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_YEAR, dv); + + dv = new YearMonthDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_YEARMONTH, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_YEARMONTH, dv); + + dv = new DurationDatatypeValidator(); + dv->setTypeName(SchemaSymbols::fgDT_DURATION, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DURATION, dv); + + // REVISIT + // We are creating a lot of Hashtables for the facets of the different + // validators. It's better to have some kind of a memory pool and ask + // the pool to give us a new instance of the hashtable. + RefHashTableOf* facets = new RefHashTableOf(3); + + // Create 'normalizedString' datatype validator + facets->put((void*) SchemaSymbols::fgELT_WHITESPACE, + new KVStringPair(SchemaSymbols::fgELT_WHITESPACE, SchemaSymbols::fgWS_REPLACE)); + + createDatatypeValidator(SchemaSymbols::fgDT_NORMALIZEDSTRING, + getDatatypeValidator(SchemaSymbols::fgDT_STRING), + facets, 0, false, 0, false); + + // Create 'token' datatype validator + facets = new RefHashTableOf(3); + facets->put((void*) SchemaSymbols::fgELT_WHITESPACE, + new KVStringPair(SchemaSymbols::fgELT_WHITESPACE, SchemaSymbols::fgWS_COLLAPSE)); + + createDatatypeValidator(SchemaSymbols::fgDT_TOKEN, + getDatatypeValidator(SchemaSymbols::fgDT_NORMALIZEDSTRING), + facets, 0, false, 0, false); + + + dv = new NameDatatypeValidator(getDatatypeValidator(SchemaSymbols::fgDT_TOKEN), 0, 0, 0); + dv->setTypeName(SchemaSymbols::fgDT_NAME, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_NAME, dv); + + + dv = new NCNameDatatypeValidator(getDatatypeValidator(SchemaSymbols::fgDT_NAME), 0, 0, 0); + dv->setTypeName(SchemaSymbols::fgDT_NCNAME, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_NCNAME, dv); + + // Create 'NMTOKEN' datatype validator + facets = new RefHashTableOf(3); + + facets->put((void*) SchemaSymbols::fgELT_PATTERN , + new KVStringPair(SchemaSymbols::fgELT_PATTERN,fgTokPattern)); + facets->put((void*) SchemaSymbols::fgELT_WHITESPACE, + new KVStringPair(SchemaSymbols::fgELT_WHITESPACE, SchemaSymbols::fgWS_COLLAPSE)); + + createDatatypeValidator(XMLUni::fgNmTokenString, + getDatatypeValidator(SchemaSymbols::fgDT_TOKEN),facets, 0, false, 0, false); + + // Create 'NMTOKENS' datatype validator + facets = new RefHashTableOf(2); + facets->put((void*) SchemaSymbols::fgELT_MINLENGTH, + new KVStringPair(SchemaSymbols::fgELT_MINLENGTH, XMLUni::fgValueOne)); + + createDatatypeValidator(XMLUni::fgNmTokensString, + getDatatypeValidator(XMLUni::fgNmTokenString), facets, 0, true, 0, false); + + // Create 'language' datatype validator + facets = new RefHashTableOf(3); + + facets->put((void*) SchemaSymbols::fgELT_PATTERN, + new KVStringPair(SchemaSymbols::fgELT_PATTERN, XMLUni::fgLangPattern)); + + createDatatypeValidator(SchemaSymbols::fgDT_LANGUAGE, + getDatatypeValidator(SchemaSymbols::fgDT_TOKEN), + facets, 0, false, 0, false); + + // Create 'integer' datatype validator + facets = new RefHashTableOf(3); + + facets->put((void*) SchemaSymbols::fgELT_FRACTIONDIGITS, + new KVStringPair(SchemaSymbols::fgELT_FRACTIONDIGITS, XMLUni::fgValueZero)); + + facets->put((void*) SchemaSymbols::fgELT_PATTERN, + new KVStringPair(SchemaSymbols::fgELT_PATTERN, fgIntegerPattern)); + + createDatatypeValidator(SchemaSymbols::fgDT_INTEGER, + getDatatypeValidator(SchemaSymbols::fgDT_DECIMAL), + facets, 0, false, 0, false); + + // Create 'nonPositiveInteger' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgValueZero)); + + createDatatypeValidator(SchemaSymbols::fgDT_NONPOSITIVEINTEGER, + getDatatypeValidator(SchemaSymbols::fgDT_INTEGER), + facets, 0, false, 0, false); + + // Create 'negativeInteger' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgNegOne)); + + createDatatypeValidator(SchemaSymbols::fgDT_NEGATIVEINTEGER, + getDatatypeValidator(SchemaSymbols::fgDT_NONPOSITIVEINTEGER), + facets, 0, false, 0, false); + + // Create 'long' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgLongMaxInc)); + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgLongMinInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_LONG, + getDatatypeValidator(SchemaSymbols::fgDT_INTEGER), + facets, 0, false, 0, false); + + // Create 'int' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgIntMaxInc)); + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgIntMinInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_INT, + getDatatypeValidator(SchemaSymbols::fgDT_LONG), + facets, 0, false, 0, false); + + // Create 'short' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgShortMaxInc)); + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgShortMinInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_SHORT, + getDatatypeValidator(SchemaSymbols::fgDT_INT), + facets, 0, false, 0 ,false); + + // Create 'byte' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgByteMaxInc)); + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgByteMinInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_BYTE, + getDatatypeValidator(SchemaSymbols::fgDT_SHORT), + facets, 0, false, 0, false); + + // Create 'nonNegativeInteger' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgValueZero)); + + createDatatypeValidator(SchemaSymbols::fgDT_NONNEGATIVEINTEGER, + getDatatypeValidator(SchemaSymbols::fgDT_INTEGER), + facets, 0, false, 0, false); + + // Create 'unsignedLong' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgULongMaxInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_ULONG, + getDatatypeValidator(SchemaSymbols::fgDT_NONNEGATIVEINTEGER), + facets, 0, false, 0, false); + + // Create 'unsignedInt' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgUIntMaxInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_UINT, + getDatatypeValidator(SchemaSymbols::fgDT_ULONG), + facets, 0, false, 0, false); + + // Create 'unsignedShort' datatypeValidator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgUShortMaxInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_USHORT, + getDatatypeValidator(SchemaSymbols::fgDT_UINT), + facets, 0, false, 0, false); + + // Create 'unsignedByte' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MAXINCLUSIVE, XMLUni::fgUByteMaxInc)); + + createDatatypeValidator(SchemaSymbols::fgDT_UBYTE, + getDatatypeValidator(SchemaSymbols::fgDT_USHORT), + facets, 0, false, 0, false); + + // Create 'positiveInteger' datatype validator + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, + new KVStringPair(SchemaSymbols::fgELT_MININCLUSIVE, XMLUni::fgValueOne)); + + createDatatypeValidator(SchemaSymbols::fgDT_POSITIVEINTEGER, + getDatatypeValidator(SchemaSymbols::fgDT_NONNEGATIVEINTEGER), + facets, 0, false, 0, false); + + // Create 'ID', 'IDREF' and 'ENTITY' datatype validator + dv = new IDDatatypeValidator(getDatatypeValidator(SchemaSymbols::fgDT_NCNAME), 0, 0, 0); + dv->setTypeName(XMLUni::fgIDString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) XMLUni::fgIDString, dv); + + dv = new IDREFDatatypeValidator(getDatatypeValidator(SchemaSymbols::fgDT_NCNAME), 0, 0, 0); + dv->setTypeName(XMLUni::fgIDRefString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) XMLUni::fgIDRefString, dv); + + dv = new ENTITYDatatypeValidator(getDatatypeValidator(SchemaSymbols::fgDT_NCNAME), 0, 0, 0); + dv->setTypeName(XMLUni::fgEntityString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuiltInRegistry->put((void*) XMLUni::fgEntityString, dv); + + facets = new RefHashTableOf(2); + facets->put((void*) SchemaSymbols::fgELT_MINLENGTH, + new KVStringPair(SchemaSymbols::fgELT_MINLENGTH, XMLUni::fgValueOne)); + + // Create 'IDREFS' datatype validator + createDatatypeValidator + ( + XMLUni::fgIDRefsString + , getDatatypeValidator(XMLUni::fgIDRefString) + , facets + , 0 + , true + , 0 + , false + ); + + facets = new RefHashTableOf(2); + + facets->put((void*) SchemaSymbols::fgELT_MINLENGTH, + new KVStringPair(SchemaSymbols::fgELT_MINLENGTH, XMLUni::fgValueOne)); + + // Create 'ENTITIES' datatype validator + createDatatypeValidator + ( + XMLUni::fgEntitiesString + , getDatatypeValidator(XMLUni::fgEntityString) + , facets + , 0 + , true + , 0 + , false + ); + + initCanRepRegistory(); +} + + +/*** + * + * For Decimal-derivated, an instance of DecimalDatatypeValidator + * can be used by the primitive datatype, decimal, or any one of + * the derivated datatypes, such as int, long, unsighed short, just + * name a few, or any user-defined datatypes, which may derivate from + * either the primitive datatype, decimal, or from any one of those + * decimal derivated datatypes, or other user-defined datatypes, which + * in turn, indirectly derivate from decimal or decimal-derived. + * + * fCanRepRegisty captures deciaml dv and its derivatives. + * + ***/ +void DatatypeValidatorFactory::initCanRepRegistory() +{ + + /*** + * key: dv + * data: XMLCanRepGroup + ***/ + fCanRepRegistry = new RefHashTableOf(29, true); + + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_DECIMAL), + new XMLCanRepGroup(XMLCanRepGroup::Decimal)); + + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_INTEGER), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_LONG), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_INT), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_SHORT), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_BYTE), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_NONNEGATIVEINTEGER), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_POSITIVEINTEGER), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_signed)); + + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_NEGATIVEINTEGER), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_unsigned)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_ULONG), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_unsigned)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_UINT), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_unsigned)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_USHORT), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_unsigned)); + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_UBYTE), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_unsigned)); + + fCanRepRegistry->put((void*) getDatatypeValidator(SchemaSymbols::fgDT_NONPOSITIVEINTEGER), + new XMLCanRepGroup(XMLCanRepGroup::Decimal_Derived_npi)); +} + +/*** + * + * For any dv other than Decimaldv, return String only. + * Later on if support to dv other than Decimaldv arise, we may + * add them fCanRepRegistry during DatatypeValidatorFactory::initCanRepRegistory() + * + ***/ +XMLCanRepGroup::CanRepGroup DatatypeValidatorFactory::getCanRepGroup(const DatatypeValidator* const dv) +{ + if (!dv) + return XMLCanRepGroup::String; + + DatatypeValidator *curdv = (DatatypeValidator*) dv; + + while (curdv) + { + if (fCanRepRegistry->containsKey(curdv)) + return fCanRepRegistry->get(curdv)->getGroup(); + else + curdv = curdv->getBaseValidator(); + } + + return XMLCanRepGroup::String; +} + +DatatypeValidator* DatatypeValidatorFactory::getBuiltInBaseValidator(const DatatypeValidator* const dv) +{ + DatatypeValidator *curdv = (DatatypeValidator*)dv; + + while (curdv) + { + if (curdv == getBuiltInRegistry()->get(curdv->getTypeLocalName())) + return curdv; + else + curdv = curdv->getBaseValidator(); + } + + return 0; +} + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: factory methods +// --------------------------------------------------------------------------- +DatatypeValidator* DatatypeValidatorFactory::createDatatypeValidator +( + const XMLCh* const typeName + , DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const bool isDerivedByList + , const int finalSet + , const bool isUserDefined + , MemoryManager* const userManager +) +{ + if (baseValidator == 0) { + + if (facets) { + Janitor janFacets(facets); + } + + if (enums) { + Janitor janEnums(enums); + } + + return 0; + } + + DatatypeValidator* datatypeValidator = 0; + MemoryManager* const manager = (isUserDefined) + ? userManager : XMLPlatformUtils::fgMemoryManager; + + if (isDerivedByList) { + datatypeValidator = new (manager) ListDatatypeValidator(baseValidator, facets, enums, finalSet, manager); + + // Set PSVI information for Ordered, Numeric, Bounded & Finite + datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_FALSE); + datatypeValidator->setNumeric(false); + if (facets && + ((facets->get(SchemaSymbols::fgELT_LENGTH) || + (facets->get(SchemaSymbols::fgELT_MINLENGTH) && facets->get(SchemaSymbols::fgELT_MAXLENGTH))))) + { + datatypeValidator->setBounded(true); + datatypeValidator->setFinite(true); + } + else + { + datatypeValidator->setBounded(false); + datatypeValidator->setFinite(false); + } + } + else { + + if ((baseValidator->getType() != DatatypeValidator::String) && facets) { + + KVStringPair* value = facets->get(SchemaSymbols::fgELT_WHITESPACE); + + if (value != 0) { + facets->removeKey(SchemaSymbols::fgELT_WHITESPACE); + } + } + + datatypeValidator = baseValidator->newInstance + ( + facets + , enums + , finalSet + , manager + ); + + // Set PSVI information for Ordered, Numeric, Bounded & Finite + datatypeValidator->setOrdered(baseValidator->getOrdered()); + datatypeValidator->setNumeric(baseValidator->getNumeric()); + RefHashTableOf* baseFacets = baseValidator->getFacets(); + if (facets && + ((facets->get(SchemaSymbols::fgELT_MININCLUSIVE) || + facets->get(SchemaSymbols::fgELT_MINEXCLUSIVE) || + (baseFacets && (baseFacets->get(SchemaSymbols::fgELT_MININCLUSIVE) || + baseFacets->get(SchemaSymbols::fgELT_MINEXCLUSIVE))))) && + (facets->get(SchemaSymbols::fgELT_MAXINCLUSIVE) || + facets->get(SchemaSymbols::fgELT_MAXEXCLUSIVE) || + (baseFacets && ((baseFacets->get(SchemaSymbols::fgELT_MAXINCLUSIVE) || + baseFacets->get(SchemaSymbols::fgELT_MAXEXCLUSIVE)))))) + { + datatypeValidator->setBounded(true); + } + else + { + datatypeValidator->setBounded(false); + } + if (baseValidator->getFinite()) + { + datatypeValidator->setFinite(true); + } + else if (!facets) + { + datatypeValidator->setFinite(false); + } + else if (facets->get(SchemaSymbols::fgELT_LENGTH) || facets->get(SchemaSymbols::fgELT_MAXLENGTH) || + facets->get(SchemaSymbols::fgELT_TOTALDIGITS)) + { + datatypeValidator->setFinite(true); + } + //for efficiency use this instead of rechecking... + //else if ((facets->get(SchemaSymbols::fgELT_MININCLUSIVE) || facets->get(SchemaSymbols::fgELT_MINEXCLUSIVE)) && + // (facets->get(SchemaSymbols::fgELT_MAXINCLUSIVE) || facets->get(SchemaSymbols::fgELT_MAXEXCLUSIVE))) + else if (datatypeValidator->getBounded() || + datatypeValidator->getType() == DatatypeValidator::Date || + datatypeValidator->getType() == DatatypeValidator::YearMonth || + datatypeValidator->getType() == DatatypeValidator::Year || + datatypeValidator->getType() == DatatypeValidator::MonthDay || + datatypeValidator->getType() == DatatypeValidator::Day || + datatypeValidator->getType() == DatatypeValidator::Month) + { + if (facets->get(SchemaSymbols::fgELT_FRACTIONDIGITS)) + { + datatypeValidator->setFinite(true); + } + else + { + datatypeValidator->setFinite(false); + } + } + else + { + datatypeValidator->setFinite(false); + } + } + + if (datatypeValidator != 0) { + + if (isUserDefined) { + + if (!fUserDefinedRegistry) { + fUserDefinedRegistry = new (userManager) RefHashTableOf(29, userManager); + } + + fUserDefinedRegistry->put((void *)typeName, datatypeValidator); + } + else { + fBuiltInRegistry->put((void *)typeName, datatypeValidator); + } + + datatypeValidator->setTypeName(typeName); + } + + return datatypeValidator; +} + +static DatatypeValidator::ValidatorType getPrimitiveDV(DatatypeValidator::ValidatorType validationDV) +{ + if (validationDV == DatatypeValidator::ID || + validationDV == DatatypeValidator::IDREF || + validationDV == DatatypeValidator::ENTITY) + { + return DatatypeValidator::String; + } + return validationDV; +} + +DatatypeValidator* DatatypeValidatorFactory::createDatatypeValidator +( + const XMLCh* const typeName + , RefVectorOf* const validators + , const int finalSet + , const bool userDefined + , MemoryManager* const userManager +) +{ + if (validators == 0) + return 0; + + DatatypeValidator* datatypeValidator = 0; + MemoryManager* const manager = (userDefined) + ? userManager : XMLPlatformUtils::fgMemoryManager; + + datatypeValidator = new (manager) UnionDatatypeValidator(validators, finalSet, manager); + + if (datatypeValidator != 0) { + + if (userDefined) { + + if (!fUserDefinedRegistry) { + fUserDefinedRegistry = new (userManager) RefHashTableOf(29, userManager); + } + + fUserDefinedRegistry->put((void *)typeName, datatypeValidator); + } + else { + fBuiltInRegistry->put((void *)typeName, datatypeValidator); + } + datatypeValidator->setTypeName(typeName); + + // Set PSVI information for Ordered, Numeric, Bounded & Finite + XMLSize_t valSize = validators->size(); + if (valSize) + { + DatatypeValidator::ValidatorType ancestorId = getPrimitiveDV(validators->elementAt(0)->getType()); + + // For a union the ORDERED {value} is partial unless one of the following: + // 1. If every member of {member type definitions} is derived from a common ancestor other than the simple ur-type, then {value} is the same as that ancestor's ordered facet. + // 2. If every member of {member type definitions} has a {value} of false for the ordered facet, then {value} is false. + bool allOrderedFalse = true; + bool commonAnc = ancestorId != DatatypeValidator::AnySimpleType; + bool allNumeric = true; + bool allBounded = true; + bool allFinite = true; + + for(XMLSize_t i = 0 ; (i < valSize) && (commonAnc || allOrderedFalse || allNumeric || allBounded || allFinite); i++) + { + // for the other member types, check whether the value is false + // and whether they have the same ancestor as the first one + if (commonAnc) + commonAnc = ancestorId == getPrimitiveDV(validators->elementAt(i)->getType()); + if (allOrderedFalse) + allOrderedFalse = validators->elementAt(i)->getOrdered() == XSSimpleTypeDefinition::ORDERED_FALSE; + + if (allNumeric && !validators->elementAt(i)->getNumeric()) + { + allNumeric = false; + } + if (allBounded && (!validators->elementAt(i)->getBounded() || + ancestorId != getPrimitiveDV(validators->elementAt(i)->getType()))) + { + allBounded = false; + } + if (allFinite && !validators->elementAt(i)->getFinite()) + { + allFinite = false; + } + } + if (commonAnc) + { + datatypeValidator->setOrdered(validators->elementAt(0)->getOrdered()); + } + else if (allOrderedFalse) + { + datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_FALSE); + } + else + { + datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); + } + datatypeValidator->setNumeric(allNumeric); + datatypeValidator->setBounded(allBounded); + datatypeValidator->setFinite(allFinite); + } + else // size = 0 + { + datatypeValidator->setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); + datatypeValidator->setNumeric(true); + datatypeValidator->setBounded(true); + datatypeValidator->setFinite(true); + } + } + return datatypeValidator; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DatatypeValidatorFactory) + +void DatatypeValidatorFactory::serialize(XSerializeEngine& serEng) +{ + + // Need not to serialize static data member, fBuiltInRegistry + + if (serEng.isStoring()) + { + /*** + * Serialize RefHashTableOf + ***/ + XTemplateSerializer::storeObject(fUserDefinedRegistry, serEng); + } + else + { + /*** + * Deserialize RefHashTableOf + ***/ + XTemplateSerializer::loadObject(&fUserDefinedRegistry, 29, true, serEng); + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DatatypeValidatorFactory.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp new file mode 100644 index 000000000..c4ec0e8e9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp @@ -0,0 +1,285 @@ +/* + * 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: DatatypeValidatorFactory.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DATATYPEVALIDATORFACTORY_HPP) +#define XERCESC_INCLUDE_GUARD_DATATYPEVALIDATORFACTORY_HPP + +/** + * This class implements a factory of Datatype Validators. Internally the + * DatatypeValidators are kept in a registry. + * There is one instance of DatatypeValidatorFactory per Parser. + * There is one datatype Registry per instance of DatatypeValidatorFactory, + * such registry is first allocated with the number DatatypeValidators needed. + * e.g. + * If Parser finds an XML document with a DTD, a registry of DTD validators (only + * 9 validators) get initialized in the registry. + * The initialization process consist of instantiating the Datatype and + * facets and registering the Datatype into registry table. + * This implementation uses a Hashtable as a registry. The datatype validators created + * by the factory will be deleted by the registry. + * + * As the Parser parses an instance document it knows if validation needs + * to be checked. If no validation is necessary we should not instantiate a + * DatatypeValidatorFactory. + * If validation is needed, we need to instantiate a DatatypeValidatorFactory. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// DatatypeValidatorFactory: Local declaration +// --------------------------------------------------------------------------- +typedef RefHashTableOf KVStringPairHashTable; +typedef RefHashTableOf DVHashTable; +typedef RefArrayVectorOf XMLChRefVector; + + +class VALIDATORS_EXPORT DatatypeValidatorFactory : public XSerializable, public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Public Constructors and Destructor + // ----------------------------------------------------------------------- + /** @name Constructors */ + //@{ + + DatatypeValidatorFactory + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** @name Destructor. */ + //@{ + + ~DatatypeValidatorFactory(); + + //@} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter Functions */ + //@{ + + /** + * Returns the datatype validator + * + * @param dvType Datatype validator name/type + */ + DatatypeValidator* getDatatypeValidator(const XMLCh* const dvType) const; + + /** + * Returns the user defined registry of types + **/ + DVHashTable* getUserDefinedRegistry() const; + + + /** + * Returns the built in registry of types + **/ + static DVHashTable* getBuiltInRegistry(); + + //@} + + private: + /** + * Initializes registry with primitive and derived Simple types. + * + * This method does not clear the registry to clear the registry you + * have to call resetRegistry. + * + * The net effect of this method is to start with the smallest set of + * datatypes needed by the validator. + * + * If we start with Schema's then we initialize to full set of + * validators. + */ + void expandRegistryToFullSchemaSet(); + + public: + // ----------------------------------------------------------------------- + // Canonical Representation Group + // ----------------------------------------------------------------------- + void initCanRepRegistory(); + + static XMLCanRepGroup::CanRepGroup getCanRepGroup(const DatatypeValidator* const); + + static DatatypeValidator* getBuiltInBaseValidator(const DatatypeValidator* const); + + // ----------------------------------------------------------------------- + // Validator Factory methods + // ----------------------------------------------------------------------- + /** @name Validator Factory Functions */ + //@{ + + /** + * Creates a new datatype validator of type baseValidator's class and + * adds it to the registry + * + * @param typeName Datatype validator name + * + * @param baseValidator Base datatype validator + * + * @param facets datatype facets if any + * + * @param enums vector of values for enum facet + * + * @param isDerivedByList Indicates whether the datatype is derived by + * list or not + * + * @param finalSet 'final' values of the simpleType + * + * @param isUserDefined Indicates whether the datatype is built-in or + * user defined + */ + DatatypeValidator* createDatatypeValidator + ( + const XMLCh* const typeName + , DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const bool isDerivedByList + , const int finalSet = 0 + , const bool isUserDefined = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Creates a new datatype validator of type UnionDatatypeValidator and + * adds it to the registry + * + * @param typeName Datatype validator name + * + * @param validators Vector of datatype validators + * + * @param finalSet 'final' values of the simpleType + * + * @param isUserDefined Indicates whether the datatype is built-in or + * user defined + */ + DatatypeValidator* createDatatypeValidator + ( + const XMLCh* const typeName + , RefVectorOf* const validators + , const int finalSet + , const bool isUserDefined = true + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Reset datatype validator registry + */ + void resetRegistry(); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DatatypeValidatorFactory) + +private: + + // ----------------------------------------------------------------------- + // CleanUp methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DatatypeValidatorFactory(const DatatypeValidatorFactory&); + DatatypeValidatorFactory& operator=(const DatatypeValidatorFactory&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fUserDefinedRegistry + // This is a hashtable of user defined dataype validators. + // + // fBuiltInRegistry + // This is a hashtable of built-in primitive datatype validators. + // ----------------------------------------------------------------------- + XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf* fUserDefinedRegistry; + static XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf* fBuiltInRegistry; + static XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf* fCanRepRegistry; + XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const fMemoryManager; + + friend class XPath2ContextImpl; + friend class XMLInitializer; +}; + +inline DatatypeValidator* +DatatypeValidatorFactory::getDatatypeValidator(const XMLCh* const dvType) const +{ + if (dvType) { + if (fBuiltInRegistry && fBuiltInRegistry->containsKey(dvType)) { + return fBuiltInRegistry->get(dvType); + } + + if (fUserDefinedRegistry && fUserDefinedRegistry->containsKey(dvType)) { + return fUserDefinedRegistry->get(dvType); + + } + } + return 0; +} + +inline DVHashTable* +DatatypeValidatorFactory::getUserDefinedRegistry() const { + return fUserDefinedRegistry; +} + +inline DVHashTable* +DatatypeValidatorFactory::getBuiltInRegistry() { + return fBuiltInRegistry; +} +// --------------------------------------------------------------------------- +// DatatypeValidator: CleanUp methods +// --------------------------------------------------------------------------- +inline void DatatypeValidatorFactory::cleanUp() { + + if (fUserDefinedRegistry) + { + delete fUserDefinedRegistry; + fUserDefinedRegistry = 0; + } +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DatatypeValidatorFactory.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.cpp new file mode 100644 index 000000000..f2dec9def --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.cpp @@ -0,0 +1,140 @@ +/* + * 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: DateDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DateDatatypeValidator::DateDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Date, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +DateDatatypeValidator::DateDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Date, manager) +{ + init(enums, manager); +} + +DateDatatypeValidator::~DateDatatypeValidator() +{} + +DatatypeValidator* DateDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DateDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* DateDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseDate(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void DateDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseDate(); +} + +const XMLCh* DateDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + + if (toValidate) + { + DateDatatypeValidator* temp = (DateDatatypeValidator*) this; + + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + try + { + XMLDateTime aDateTime(rawData, toUse); + aDateTime.parseDate(); + return aDateTime.getDateCanonicalRepresentation(toUse); + } + catch (...) + { + return 0; + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DateDatatypeValidator) + +void DateDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DateDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.hpp new file mode 100644 index 000000000..e2bc8a614 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateDatatypeValidator.hpp @@ -0,0 +1,101 @@ +/* + * 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: DateDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DATE_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DATE_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DateDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + DateDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DateDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~DateDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DateDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DateDatatypeValidator(const DateDatatypeValidator&); + DateDatatypeValidator& operator=(const DateDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DateDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp new file mode 100644 index 000000000..f45705e40 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp @@ -0,0 +1,140 @@ +/* + * 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: DateTimeDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DateTimeDatatypeValidator::DateTimeDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::DateTime, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +DateTimeDatatypeValidator::DateTimeDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::DateTime, manager) +{ + init(enums, manager); +} + +DateTimeDatatypeValidator::~DateTimeDatatypeValidator() +{} + +DatatypeValidator* DateTimeDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DateTimeDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* DateTimeDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseDateTime(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void DateTimeDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseDateTime(); +} + +const XMLCh* DateTimeDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + + if (toValidate) + { + DateTimeDatatypeValidator* temp = (DateTimeDatatypeValidator*) this; + + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + try + { + XMLDateTime aDateTime(rawData, toUse); + aDateTime.parseDateTime(); + return aDateTime.getDateTimeCanonicalRepresentation(toUse); + } + catch (...) + { + return 0; + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DateTimeDatatypeValidator) + +void DateTimeDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DateTimeDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp new file mode 100644 index 000000000..cd486ad8e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp @@ -0,0 +1,102 @@ +/* + * 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: DateTimeDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DATETIME_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DATETIME_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DateTimeDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + DateTimeDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DateTimeDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~DateTimeDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DateTimeDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DateTimeDatatypeValidator(const DateTimeDatatypeValidator&); + DateTimeDatatypeValidator& operator=(const DateTimeDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DateTimeDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.cpp new file mode 100644 index 000000000..801ad2d57 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.cpp @@ -0,0 +1,303 @@ +/* + * 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: DateTimeValidator.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Macro +// --------------------------------------------------------------------------- +#define REPORT_VALUE_ERROR(val1, val2, except_code, manager) \ + ThrowXMLwithMemMgr2(InvalidDatatypeValueException \ + , except_code \ + , val1->getRawData() \ + , val2->getRawData() \ + , manager); + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DateTimeValidator::~DateTimeValidator() +{ +} + +DateTimeValidator::DateTimeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractNumericFacetValidator(baseValidator, facets, finalSet, type, manager) +{ + //do not invoke init() here !!! +} + +void DateTimeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + checkContent(content, context, false, manager); +} + +int DateTimeValidator::compare(const XMLCh* const value1 + , const XMLCh* const value2 + , MemoryManager* const manager) +{ + try + { + XMLDateTime *pDate1 = parse(value1, manager); + Janitor jName1(pDate1); + XMLDateTime *pDate2 = parse(value2, manager); + Janitor jName2(pDate2); + int result = compareDates(pDate1, pDate2, true); + return (result==INDETERMINATE)? -1 : result; + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) // RuntimeException e + { + return -1; // revisit after implement compareDates() + } + +} + + +void DateTimeValidator::checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + //validate against base validator if any + DateTimeValidator *pBaseValidator = (DateTimeValidator*) this->getBaseValidator(); + if (pBaseValidator) + pBaseValidator->checkContent(content, context, true, manager); + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + // the derived classes' parse() method constructs an + // XMLDateTime object anc invokes appropriate XMLDateTime's + // parser to parse the content. + XMLDateTime dateTimeValue(content, manager); + XMLDateTime* dateTime = &dateTimeValue; + + parse(dateTime); + + // must be < MaxExclusive + if ((thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) + { + if (compareValues(dateTime, getMaxExclusive()) != XMLDateTime::LESS_THAN) + { + REPORT_VALUE_ERROR( dateTime + , getMaxExclusive() + , XMLExcepts::VALUE_exceed_maxExcl + , manager) + } + } + + // must be <= MaxInclusive + if ((thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) + { + int result = compareValues(dateTime, getMaxInclusive()); + if ( result == XMLDateTime::GREATER_THAN || result == XMLDateTime::INDETERMINATE ) + { + REPORT_VALUE_ERROR( dateTime + , getMaxInclusive() + , XMLExcepts::VALUE_exceed_maxIncl + , manager) + } + } + + // must be >= MinInclusive + if ((thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0) + { + int result = compareValues(dateTime, getMinInclusive()); + if (result == XMLDateTime::LESS_THAN || result == XMLDateTime::INDETERMINATE) + { + REPORT_VALUE_ERROR( dateTime + , getMinInclusive() + , XMLExcepts::VALUE_exceed_minIncl + , manager) + } + } + + // must be > MinExclusive + if ( (thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 ) + { + if (compareValues(dateTime, getMinExclusive()) != XMLDateTime::GREATER_THAN) + { + REPORT_VALUE_ERROR( dateTime + , getMinExclusive() + , XMLExcepts::VALUE_exceed_minExcl + , manager) + } + } + + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (compareValues(dateTime, getEnumeration()->elementAt(i)) == XMLDateTime::EQUAL) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } +} + +// +// Comparision methods +// +int DateTimeValidator::compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue) +{ + return compareDates((XMLDateTime*) lValue, (XMLDateTime*) rValue, true); +} + +/** + * Compare algorithm described in dateDime (3.2.7). + * Duration datatype overwrites this method + * + * @param date1 normalized date representation of the first value + * @param date2 normalized date representation of the second value + * @param strict + * @return less, greater, less_equal, greater_equal, equal + */ +int DateTimeValidator::compareDates(const XMLDateTime* const date1 + , const XMLDateTime* const date2 + , bool) +{ + return XMLDateTime::compare(date1, date2); +} + +// +// In fact, the proper way of the following set*() shall be +// { +// if (fMaxInclusive) +// delete fMaxInclusive; +// +// fMaxInclusive = parse(value); +// +// } +// +// But we know this function is invoked once and only once +// since there is no duplicated facet passed in, therefore +// fMaxInclusive is alwasy zero before, so for the +// sake of performance, we do not do the checking/delete. +// + +void DateTimeValidator::setMaxInclusive(const XMLCh* const value) +{ + fMaxInclusive = parse(value, fMemoryManager); +} + +void DateTimeValidator::setMaxExclusive(const XMLCh* const value) +{ + fMaxExclusive = parse(value, fMemoryManager); +} + +void DateTimeValidator::setMinInclusive(const XMLCh* const value) +{ + fMinInclusive = parse(value, fMemoryManager); +} + +void DateTimeValidator::setMinExclusive(const XMLCh* const value) +{ + fMinExclusive = parse(value, fMemoryManager); +} + +void DateTimeValidator::setEnumeration(MemoryManager* const) +{ +// to do: do we need to check against base value space??? + + if (!fStrEnumeration) + return; + + XMLSize_t enumLength = fStrEnumeration->size(); + fEnumeration = new (fMemoryManager) RefVectorOf(enumLength, true, fMemoryManager); + fEnumerationInherited = false; + + for ( XMLSize_t i = 0; i < enumLength; i++) + fEnumeration->insertElementAt(parse(fStrEnumeration->elementAt(i), fMemoryManager), i); + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(DateTimeValidator) + +void DateTimeValidator::serialize(XSerializeEngine& serEng) +{ + /*** + * + * Note: All its derivatives share the same number type, that is + * XMLNumber::DateTime, so this class would write it. + ***/ + + if (serEng.isStoring()) + { + serEng<<(int) XMLNumber::DateTime; + } + + AbstractNumericFacetValidator::serialize(serEng); + + //dateTime can be instantiated during checkContent(), so don't serialize it. +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DateTimeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.hpp new file mode 100644 index 000000000..3f6f0e116 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DateTimeValidator.hpp @@ -0,0 +1,126 @@ +/* + * 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: DateTimeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DATETIME_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DATETIME_VALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DateTimeValidator : public AbstractNumericFacetValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public dtor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + virtual ~DateTimeValidator(); + + //@} + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual int compare(const XMLCh* const value1 + , const XMLCh* const value2 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DateTimeValidator) + +protected: + + // ----------------------------------------------------------------------- + // ctor used by derived class + // ----------------------------------------------------------------------- + DateTimeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // + // Abstract interface + // + + virtual int compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + + virtual void setMaxInclusive(const XMLCh* const); + + virtual void setMaxExclusive(const XMLCh* const); + + virtual void setMinInclusive(const XMLCh* const); + + virtual void setMinExclusive(const XMLCh* const); + + virtual void setEnumeration(MemoryManager* const manager); + +protected: + + // ----------------------------------------------------------------------- + // helper interface: to be implemented/overwritten by derived class + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager) = 0; + virtual void parse(XMLDateTime* const) = 0; + + // to be overwritten by duration + virtual int compareDates(const XMLDateTime* const lValue + , const XMLDateTime* const rValue + , bool strict); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DateTimeValidator(const DateTimeValidator&); + DateTimeValidator& operator=(const DateTimeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DateTimeValidator.hpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.cpp new file mode 100644 index 000000000..ff22db915 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.cpp @@ -0,0 +1,107 @@ +/* + * 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: DayDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DayDatatypeValidator::DayDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Day, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +DayDatatypeValidator::DayDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Day, manager) +{ + init(enums, manager); +} + +DayDatatypeValidator::~DayDatatypeValidator() +{} + +DatatypeValidator* DayDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DayDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* DayDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseDay(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void DayDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseDay(); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DayDatatypeValidator) + +void DayDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DayDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.hpp new file mode 100644 index 000000000..c66c59bb4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DayDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: DayDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DAY_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DAY_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DayDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor*/ + //@{ + + DayDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DayDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~DayDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DayDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DayDatatypeValidator(const DayDatatypeValidator&); + DayDatatypeValidator& operator=(const DayDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DayDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp new file mode 100644 index 000000000..31172e65f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp @@ -0,0 +1,615 @@ +/* + * 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: DecimalDatatypeValidator.cpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const int BUF_LEN = 64; + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DecimalDatatypeValidator::DecimalDatatypeValidator(MemoryManager* const manager) +:AbstractNumericValidator(0, 0, 0, DatatypeValidator::Decimal, manager) +, fTotalDigits(0) +, fFractionDigits(0) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_TOTAL); + setNumeric(true); +} + +DecimalDatatypeValidator::DecimalDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, DatatypeValidator::Decimal, manager) +, fTotalDigits(0) +, fFractionDigits(0) +{ + init(enums, manager); +} + +DecimalDatatypeValidator::~DecimalDatatypeValidator() +{ +} + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int DecimalDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const manager) +{ + XMLBigDecimal lObj(lValue, manager); + XMLBigDecimal rObj(rValue, manager); + + return compareValues(&lObj, &rObj); +} + +DatatypeValidator* DecimalDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DecimalDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// ----------------------------------------------------------------------- +// ctor provided to be used by derived classes +// ----------------------------------------------------------------------- +DecimalDatatypeValidator::DecimalDatatypeValidator(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, type, manager) +, fTotalDigits(0) +, fFractionDigits(0) +{ + //do not invoke init here !!! +} + +void DecimalDatatypeValidator::assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager) +{ + if (XMLString::equals(key, SchemaSymbols::fgELT_TOTALDIGITS)) + { + int val; + try + { + val = XMLString::parseInt(value, manager); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_TotalDigit, value, manager); + } + + // check 4.3.11.c0 must: totalDigits > 0 + if ( val <= 0 ) + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_PosInt_TotalDigit, value, manager); + + setTotalDigits(val); + setFacetsDefined(DatatypeValidator::FACET_TOTALDIGITS); + } + else if (XMLString::equals(key, SchemaSymbols::fgELT_FRACTIONDIGITS)) + { + int val; + try + { + val = XMLString::parseInt(value, manager); + } + catch (NumberFormatException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_FractDigit, value, manager); + } + + // check 4.3.12.c0 must: fractionDigits > 0 + if ( val < 0 ) + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_NonNeg_FractDigit, value, manager); + + setFractionDigits(val); + setFacetsDefined(DatatypeValidator::FACET_FRACTIONDIGITS); + } + else + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); + } +} + +void DecimalDatatypeValidator::inheritAdditionalFacet() +{ + + DecimalDatatypeValidator *numBase = (DecimalDatatypeValidator*) getBaseValidator(); + + if (!numBase) + return; + + int thisFacetsDefined = getFacetsDefined(); + int baseFacetsDefined = numBase->getFacetsDefined(); + + // inherit totalDigits + if ((( baseFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) == 0) ) + { + setTotalDigits(numBase->fTotalDigits); + setFacetsDefined(DatatypeValidator::FACET_TOTALDIGITS); + } + + // inherit fractionDigits + if ((( baseFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) && + (( thisFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) == 0) ) + { + setFractionDigits(numBase->fFractionDigits); + setFacetsDefined(DatatypeValidator::FACET_FRACTIONDIGITS); + } +} + +void DecimalDatatypeValidator::checkAdditionalFacetConstraints(MemoryManager* const manager) const +{ + int thisFacetsDefined = getFacetsDefined(); + + // check 4.3.12.c1 must: fractionDigits <= totalDigits + if ( ((thisFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) && + ((thisFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) ) + { + if ( fFractionDigits > fTotalDigits ) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(getFractionDigits(), value1, BUF_LEN, 10, manager); + XMLString::binToText(getTotalDigits(), value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_TotDigit_FractDigit + , value2 + , value1 + , manager); + } + } + +} + +void DecimalDatatypeValidator::checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const +{ + + DecimalDatatypeValidator *numBase = (DecimalDatatypeValidator*) getBaseValidator(); + + if (!numBase) + return; + + int thisFacetsDefined = getFacetsDefined(); + int baseFacetsDefined = numBase->getFacetsDefined(); + + // check 4.3.11.c1 error: totalDigits > base.totalDigits + // totalDigits != base.totalDigits if (base.fixed) + if (( thisFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) + { + if ( (( baseFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) && + ( fTotalDigits > numBase->fTotalDigits )) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(fTotalDigits, value1, BUF_LEN, 10, manager); + XMLString::binToText(numBase->fTotalDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_totalDigit_base_totalDigit + , value1 + , value2 + , manager); + } + + if ( (( baseFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) && + (( numBase->getFixed() & DatatypeValidator::FACET_TOTALDIGITS) != 0) && + ( fTotalDigits != numBase->fTotalDigits )) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(fTotalDigits, value1, BUF_LEN, 10, manager); + XMLString::binToText(numBase->fTotalDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_totalDigit_base_fixed + , value1 + , value2 + , manager); + } + } + + if (( thisFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) + { + // check question error: fractionDigits > base.fractionDigits ??? + if ( (( baseFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) && + ( fFractionDigits > numBase->fFractionDigits )) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(fFractionDigits, value1, BUF_LEN, 10, manager); + XMLString::binToText(numBase->fFractionDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_fractDigit_base_fractDigit + , value1 + , value2 + , manager); + } + + // check question error: fractionDigits > base.totalDigits ??? + if ( (( baseFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0) && + ( fFractionDigits > numBase->fTotalDigits )) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(fFractionDigits, value1, BUF_LEN, 10, manager); + XMLString::binToText(numBase->fTotalDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_fractDigit_base_totalDigit + , value1 + , value2 + , manager); + } + + // fractionDigits != base.fractionDigits if (base.fixed) + if ( (( baseFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) && + (( numBase->getFixed() & DatatypeValidator::FACET_FRACTIONDIGITS) != 0) && + ( fFractionDigits != numBase->fFractionDigits )) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(fFractionDigits, value1, BUF_LEN, 10, manager); + XMLString::binToText(numBase->fFractionDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_fractDigit_base_fixed + , value1 + , value2 + , manager); + } + } + +} + +int DecimalDatatypeValidator::compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue) +{ + return XMLBigDecimal::compareValues((XMLBigDecimal*) lValue, (XMLBigDecimal*) rValue, + ((XMLBigDecimal*)lValue)->getMemoryManager()); +} + +void DecimalDatatypeValidator::setMaxInclusive(const XMLCh* const value) +{ + fMaxInclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); +} + +void DecimalDatatypeValidator::setMaxExclusive(const XMLCh* const value) +{ + fMaxExclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); +} + +void DecimalDatatypeValidator::setMinInclusive(const XMLCh* const value) +{ + fMinInclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); +} + +void DecimalDatatypeValidator::setMinExclusive(const XMLCh* const value) +{ + fMinExclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); +} + +void DecimalDatatypeValidator::setEnumeration(MemoryManager* const manager) +{ + // check 4.3.5.c0 must: enumeration values from the value space of base + // + // 1. shall be from base value space + // 2. shall be from current value space as well ( shall go through boundsCheck() ) + // + if (!fStrEnumeration) + return; + + XMLSize_t i = 0; + XMLSize_t enumLength = fStrEnumeration->size(); + + DecimalDatatypeValidator *numBase = (DecimalDatatypeValidator*) getBaseValidator(); + if (numBase) + { + try + { + for ( i = 0; i < enumLength; i++) + { + numBase->checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } + } + catch (XMLException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_enum_base + , fStrEnumeration->elementAt(i) + , manager); + } + } +#if 0 +// spec says that only base has to checkContent + // We put the this->checkContent in a separate loop + // to not block original message with in that method. + // + for ( i = 0; i < enumLength; i++) + { + checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } +#endif + fEnumeration = new (manager) RefVectorOf(enumLength, true, manager); + fEnumerationInherited = false; + + for ( i = 0; i < enumLength; i++) + { + fEnumeration->insertElementAt(new (manager) XMLBigDecimal(fStrEnumeration->elementAt(i), manager), i); + } + +} + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- +void DecimalDatatypeValidator::checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + //validate against base validator if any + DecimalDatatypeValidator *pBase = (DecimalDatatypeValidator*) this->getBaseValidator(); + if (pBase) + pBase->checkContent(content, context, true, manager); + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + XMLBigDecimal compareDataValue(content, manager); + XMLBigDecimal* compareData = &compareDataValue; + + if (getEnumeration()) + { + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (compareValues(compareData, (XMLBigDecimal*) getEnumeration()->elementAt(i)) ==0 ) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + boundsCheck(compareData, manager); + + if ( (thisFacetsDefined & DatatypeValidator::FACET_FRACTIONDIGITS) != 0 ) + { + if ( compareData->getScale() > fFractionDigits ) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(compareData->getScale(), value1, BUF_LEN, 10, manager); + XMLString::binToText(fFractionDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr3(InvalidDatatypeFacetException + , XMLExcepts::VALUE_exceed_fractDigit + , compareData->getRawData() + , value1 + , value2 + , manager); + } + } + + if ( (thisFacetsDefined & DatatypeValidator::FACET_TOTALDIGITS) != 0 ) + { + if ( compareData->getTotalDigit() > fTotalDigits ) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(compareData->getTotalDigit(), value1, BUF_LEN, 10, manager); + XMLString::binToText(fTotalDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr3(InvalidDatatypeFacetException + , XMLExcepts::VALUE_exceed_totalDigit + , compareData->getRawData() + , value1 + , value2 + , manager); + } + + /*** + E2-44 totalDigits + ... by restricting it to numbers that are expressible as i x 10^-n + where i and n are integers such that |i| < 10^totalDigits and 0 <= n <= totalDigits. + ***/ + + if ( compareData->getScale() > fTotalDigits ) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::binToText(compareData->getScale(), value1, BUF_LEN, 10, manager); + XMLString::binToText(fTotalDigits, value2, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr3(InvalidDatatypeFacetException + , XMLExcepts::VALUE_exceed_totalDigit + , compareData->getRawData() + , value1 + , value2 + , manager); + } + } +} + +/*** + * 3.2.3 decimal + * + * . the preceding optional "+" sign is prohibited. + * . The decimal point is required. + * . Leading and trailing zeroes are prohibited subject to the following: + * there must be at least one digit to the right and to the left of the decimal point which may be a zero. + * + * + * 3.3.13 integer + * 3.3.16 long + * 3.3.17 int + * 3.3.18 short + * 3.3.19 byte + * 3.3.20 nonNegativeInteger + * 3.3.25 positiveInteger + * + * . the preceding optional "+" sign is prohibited and + * . leading zeroes are prohibited. + * + * + * E2-27 + * 3.3.14 nonPositiveInteger + * + * . In the canonical form for zero, the sign must be omitted. + * . leading zeroes are prohibited. + * + * 3.3.15 negativeInteger + * 3.3.21 unsignedLong + * 3.3.22 unsignedInt + * 3.3.23 unsignedShort + * 3.3.24 unsignedByte + * + * . leading zeroes are prohibited. + * + * Summary: + * . leading zeros are prohibited for all three groups + * . '-' is required for nonPositiveInteger if it is zero + * + ***/ + +const XMLCh* DecimalDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + DecimalDatatypeValidator* temp = (DecimalDatatypeValidator*) this; + + if (toValidate) + { + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + // XMLBigInteger::getCanonicalRepresentation and + // XMLBigDecimal::getCanonicalRepresentation will handle exceptional cases + XMLCanRepGroup::CanRepGroup dvType = DatatypeValidatorFactory::getCanRepGroup(temp); + + if ((dvType == XMLCanRepGroup::Decimal_Derived_signed) || + (dvType == XMLCanRepGroup::Decimal_Derived_unsigned) || + (dvType == XMLCanRepGroup::Decimal_Derived_npi) ) + { + return XMLBigInteger::getCanonicalRepresentation(rawData, toUse, dvType == XMLCanRepGroup::Decimal_Derived_npi); + } + else if (dvType == XMLCanRepGroup::Decimal) + { + return XMLBigDecimal::getCanonicalRepresentation(rawData, toUse); + } + else //in case? + { + return XMLString::replicate(rawData, toUse); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DecimalDatatypeValidator) + +void DecimalDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + /*** + * Note: + * + * During storing, we need write the specific number + * type info before calling base::serialize(). + * + * While loading, we do nothing here + ***/ + + if (serEng.isStoring()) + { + serEng<<(int) (XMLNumber::BigDecimal); + } + + AbstractNumericValidator::serialize(serEng); + + //don't serialize XMLBigDecimal* + if (serEng.isStoring()) + { + serEng<>fTotalDigits; + serEng>>fFractionDigits; + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DecimalDatatypeValidator::cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp new file mode 100644 index 000000000..e4e67c874 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp @@ -0,0 +1,218 @@ +/* + * 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: DecimalDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DECIMAL_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DECIMAL_DATATYPEVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLBigDecimal; + +class VALIDATORS_EXPORT DecimalDatatypeValidator : public AbstractNumericValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + DecimalDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DecimalDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~DecimalDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DecimalDatatypeValidator) + +protected: + +// ----------------------------------------------------------------------- +// ctor provided to be used by derived classes +// ----------------------------------------------------------------------- + DecimalDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericFacetValidator +// ----------------------------------------------------------------------- + + virtual void assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager); + + virtual void inheritAdditionalFacet(); + + virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const; + + virtual void checkAdditionalFacetConstraintsBase(MemoryManager* const manager) const; + + virtual int compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue); + + virtual void setMaxInclusive(const XMLCh* const); + + virtual void setMaxExclusive(const XMLCh* const); + + virtual void setMinInclusive(const XMLCh* const); + + virtual void setMinExclusive(const XMLCh* const); + + virtual void setEnumeration(MemoryManager* const manager); + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); +public: + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + + inline unsigned int getTotalDigits() const; + + inline unsigned int getFractionDigits() const; + +private: +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + + inline void setTotalDigits(unsigned int); + + inline void setFractionDigits(unsigned int); + + // ----------------------------------------------------------------------- + // Private data members + // + // ----------------------------------------------------------------------- + unsigned int fTotalDigits; + unsigned int fFractionDigits; + + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DecimalDatatypeValidator(const DecimalDatatypeValidator&); + DecimalDatatypeValidator& operator=(const DecimalDatatypeValidator&); +}; + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + +inline unsigned int DecimalDatatypeValidator::getTotalDigits() const +{ + return fTotalDigits; +} + +inline unsigned int DecimalDatatypeValidator::getFractionDigits() const +{ + return fFractionDigits; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + +inline void DecimalDatatypeValidator::setTotalDigits(unsigned int newTotalDigits) +{ + fTotalDigits = newTotalDigits; +} + +inline void DecimalDatatypeValidator::setFractionDigits(unsigned int newFractionDigits) +{ + fFractionDigits = newFractionDigits; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DecimalDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp new file mode 100644 index 000000000..a8e62fd79 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp @@ -0,0 +1,256 @@ +/* + * 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: DoubleDatatypeValidator.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DoubleDatatypeValidator::DoubleDatatypeValidator(MemoryManager* const manager) +:AbstractNumericValidator(0, 0, 0, DatatypeValidator::Double, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); + setBounded(true); + setFinite(true); + setNumeric(true); +} + +DoubleDatatypeValidator::DoubleDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, DatatypeValidator::Double, manager) +{ + init(enums, manager); +} + +DoubleDatatypeValidator::~DoubleDatatypeValidator() +{} + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int DoubleDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const manager) +{ + XMLDouble lObj(lValue, manager); + XMLDouble rObj(rValue, manager); + + return compareValues(&lObj, &rObj); +} + +DatatypeValidator* DoubleDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DoubleDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// ----------------------------------------------------------------------- +// ctor provided to be used by derived classes +// ----------------------------------------------------------------------- +DoubleDatatypeValidator::DoubleDatatypeValidator(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, type, manager) +{ + //do not invoke init here !!! +} + +int DoubleDatatypeValidator::compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue) +{ + return XMLDouble::compareValues((XMLDouble*) lValue, (XMLDouble*) rValue); +} + +void DoubleDatatypeValidator::setMaxInclusive(const XMLCh* const value) +{ + fMaxInclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); +} + +void DoubleDatatypeValidator::setMaxExclusive(const XMLCh* const value) +{ + fMaxExclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); +} + +void DoubleDatatypeValidator::setMinInclusive(const XMLCh* const value) +{ + fMinInclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); +} + +void DoubleDatatypeValidator::setMinExclusive(const XMLCh* const value) +{ + fMinExclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); +} + +void DoubleDatatypeValidator::setEnumeration(MemoryManager* const manager) +{ + // check 4.3.5.c0 must: enumeration values from the value space of base + // + // 1. shall be from base value space + // 2. shall be from current value space as well ( shall go through boundsCheck() ) + // + if (!fStrEnumeration) + return; + + XMLSize_t i = 0; + XMLSize_t enumLength = fStrEnumeration->size(); + + DoubleDatatypeValidator *numBase = (DoubleDatatypeValidator*) getBaseValidator(); + if (numBase) + { + try + { + for ( i = 0; i < enumLength; i++) + { + numBase->checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } + } + catch (XMLException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_enum_base + , fStrEnumeration->elementAt(i) + , manager); + + } + } + +#if 0 +// spec says that only base has to checkContent + // We put the this->checkContent in a separate loop + // to not block original message with in that method. + // + for ( i = 0; i < enumLength; i++) + { + checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } +#endif + + fEnumeration = new (manager) RefVectorOf(enumLength, true, manager); + fEnumerationInherited = false; + + for ( i = 0; i < enumLength; i++) + { + fEnumeration->insertElementAt(new (manager) XMLDouble(fStrEnumeration->elementAt(i), manager), i); + } +} + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- + +void DoubleDatatypeValidator::checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + + //validate against base validator if any + DoubleDatatypeValidator *pBase = (DoubleDatatypeValidator*) this->getBaseValidator(); + if (pBase) + pBase->checkContent(content, context, true, manager); + + // we check pattern first + if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + XMLDouble theValue(content, manager); + XMLDouble *theData = &theValue; + + if (getEnumeration()) + { + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (compareValues(theData, (XMLDouble*) getEnumeration()->elementAt(i)) ==0 ) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + boundsCheck(theData, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DoubleDatatypeValidator) + +void DoubleDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + /*** + * Note: + * + * During storing, we need write the specific number + * type info before calling base::serialize(). + * + * While loading, we do nothing here + ***/ + + if (serEng.isStoring()) + { + serEng<<(int) (XMLNumber::Double); + } + + AbstractNumericValidator::serialize(serEng); + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DoubleDatatypeValidator::cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.hpp new file mode 100644 index 000000000..545c10216 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DoubleDatatypeValidator.hpp @@ -0,0 +1,146 @@ +/* + * 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: DoubleDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DOUBLE_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DOUBLE_DATATYPEVALIDATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DoubleDatatypeValidator : public AbstractNumericValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + DoubleDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DoubleDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~DoubleDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DoubleDatatypeValidator) + +protected: + +// ----------------------------------------------------------------------- +// ctor provided to be used by derived classes +// ----------------------------------------------------------------------- + DoubleDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericFacetValidator +// ----------------------------------------------------------------------- + + virtual int compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue); + + virtual void setMaxInclusive(const XMLCh* const); + + virtual void setMaxExclusive(const XMLCh* const); + + virtual void setMinInclusive(const XMLCh* const); + + virtual void setMinExclusive(const XMLCh* const); + + virtual void setEnumeration(MemoryManager* const manager); + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DoubleDatatypeValidator(const DoubleDatatypeValidator &); + DoubleDatatypeValidator& operator = (const DoubleDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DoubleDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp new file mode 100644 index 000000000..5831fda4e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.cpp @@ -0,0 +1,114 @@ +/* + * 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: DurationDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +DurationDatatypeValidator::DurationDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Duration, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +DurationDatatypeValidator::DurationDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Duration, manager) +{ + init(enums, manager); +} + +DurationDatatypeValidator::~DurationDatatypeValidator() +{} + +DatatypeValidator* DurationDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) DurationDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* DurationDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseDuration(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void DurationDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseDuration(); +} + +int DurationDatatypeValidator::compareDates(const XMLDateTime* const date1 + , const XMLDateTime* const date2 + , bool strict) +{ + return XMLDateTime::compare(date1, date2, strict); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(DurationDatatypeValidator) + +void DurationDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DurationDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.hpp new file mode 100644 index 000000000..ba0822464 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/DurationDatatypeValidator.hpp @@ -0,0 +1,98 @@ +/* + * 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: DurationDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_DURATION_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_DURATION_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT DurationDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor. */ + //@{ + + DurationDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + DurationDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~DurationDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(DurationDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + virtual int compareDates(const XMLDateTime* const + , const XMLDateTime* const + , bool ); +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + DurationDatatypeValidator(const DurationDatatypeValidator &); + DurationDatatypeValidator& operator = (const DurationDatatypeValidator&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file DurationDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp new file mode 100644 index 000000000..157e4f5d1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.cpp @@ -0,0 +1,125 @@ +/* + * 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: ENTITYDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +ENTITYDatatypeValidator::ENTITYDatatypeValidator(MemoryManager* const manager) +:StringDatatypeValidator(0, 0, 0, DatatypeValidator::ENTITY, manager) +{} + +ENTITYDatatypeValidator::ENTITYDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::ENTITY, manager) +{ + init(enums, manager); +} + +ENTITYDatatypeValidator::~ENTITYDatatypeValidator() +{} + +DatatypeValidator* ENTITYDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) ENTITYDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int ENTITYDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + return ( XMLString::equals(lValue, rValue)? 0 : -1); +} + +void ENTITYDatatypeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + // use StringDatatypeValidator (which in turn, invoke + // the baseValidator) to validate content against + // facets if any. + // + StringDatatypeValidator::validate(content, context, manager); + + // + // parse the entity iff an EntityDeclPool is provided + // + if (context) + { + context->checkEntity(content); + } + +} + +void ENTITYDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // 3.3.11 check must: "NCName" + // + if ( !XMLChar1_0::isValidNCName(content, XMLString::stringLen(content)) ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_NCName + , content + , manager); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(ENTITYDatatypeValidator) + +void ENTITYDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + StringDatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + + /** + * End of file ENTITYDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.hpp new file mode 100644 index 000000000..f8f9865f9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/ENTITYDatatypeValidator.hpp @@ -0,0 +1,144 @@ +/* + * 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: ENTITYDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ENTITY_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ENTITY_DATATYPEVALIDATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT ENTITYDatatypeValidator : public StringDatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor. */ + //@{ + + ENTITYDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ENTITYDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~ENTITYDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(ENTITYDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + ENTITYDatatypeValidator(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type); + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ENTITYDatatypeValidator(const ENTITYDatatypeValidator&); + ENTITYDatatypeValidator& operator = (const ENTITYDatatypeValidator&); + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ENTITYDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp new file mode 100644 index 000000000..1a418e75a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp @@ -0,0 +1,255 @@ +/* + * 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: FloatDatatypeValidator.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +FloatDatatypeValidator::FloatDatatypeValidator(MemoryManager* const manager) +:AbstractNumericValidator(0, 0, 0, DatatypeValidator::Float, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); + setBounded(true); + setFinite(true); + setNumeric(true); +} + +FloatDatatypeValidator::FloatDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, DatatypeValidator::Float, manager) +{ + init(enums, manager); +} + +FloatDatatypeValidator::~FloatDatatypeValidator() +{} + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int FloatDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const manager) +{ + XMLFloat lObj(lValue, manager); + XMLFloat rObj(rValue, manager); + + return compareValues(&lObj, &rObj); +} + +DatatypeValidator* FloatDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) FloatDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// ----------------------------------------------------------------------- +// ctor provided to be used by derived classes +// ----------------------------------------------------------------------- +FloatDatatypeValidator::FloatDatatypeValidator(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractNumericValidator(baseValidator, facets, finalSet, type, manager) +{ + //do not invoke init here !!! +} + +int FloatDatatypeValidator::compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue) +{ + return XMLFloat::compareValues((XMLFloat*) lValue, (XMLFloat*) rValue); +} + +void FloatDatatypeValidator::setMaxInclusive(const XMLCh* const value) +{ + fMaxInclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); +} + +void FloatDatatypeValidator::setMaxExclusive(const XMLCh* const value) +{ + fMaxExclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); +} + +void FloatDatatypeValidator::setMinInclusive(const XMLCh* const value) +{ + fMinInclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); +} + +void FloatDatatypeValidator::setMinExclusive(const XMLCh* const value) +{ + fMinExclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); +} + +void FloatDatatypeValidator::setEnumeration(MemoryManager* const manager) +{ + // check 4.3.5.c0 must: enumeration values from the value space of base + // + // 1. shall be from base value space + // 2. shall be from current value space as well ( shall go through boundsCheck() ) + // + if (!fStrEnumeration) + return; + + XMLSize_t i = 0; + XMLSize_t enumLength = fStrEnumeration->size(); + + FloatDatatypeValidator *numBase = (FloatDatatypeValidator*) getBaseValidator(); + if (numBase) + { + try + { + for ( i = 0; i < enumLength; i++) + { + numBase->checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } + } + catch (XMLException&) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_enum_base + , fStrEnumeration->elementAt(i) + , manager); + + } + } +#if 0 +// spec says that only base has to checkContent + // We put the this->checkContent in a separate loop + // to not block original message with in that method. + // + for ( i = 0; i < enumLength; i++) + { + checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager); + } +#endif + + fEnumeration = new (fMemoryManager) RefVectorOf(enumLength, true, fMemoryManager); + fEnumerationInherited = false; + + for ( i = 0; i < enumLength; i++) + { + fEnumeration->insertElementAt(new (fMemoryManager) XMLFloat(fStrEnumeration->elementAt(i), fMemoryManager), i); + } +} + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- +void FloatDatatypeValidator::checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + + //validate against base validator if any + FloatDatatypeValidator *pBase = (FloatDatatypeValidator*) this->getBaseValidator(); + if (pBase) + pBase->checkContent(content, context, true, manager); + + // we check pattern first + if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + XMLFloat theValue(content, manager); + XMLFloat *theData = &theValue; + + if (getEnumeration() != 0) + { + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (compareValues(theData, (XMLFloat*) getEnumeration()->elementAt(i))==0) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + boundsCheck(theData, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(FloatDatatypeValidator) + +void FloatDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + /*** + * Note: + * + * During storing, we need write the specific number + * type info before calling base::serialize(). + * + * While loading, we do nothing here + ***/ + + if (serEng.isStoring()) + { + serEng<<(int) (XMLNumber::Float); + } + + AbstractNumericValidator::serialize(serEng); + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file FloatDatatypeValidator::cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.hpp new file mode 100644 index 000000000..ff05c37c3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/FloatDatatypeValidator.hpp @@ -0,0 +1,145 @@ +/* + * 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: FloatDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_FLOAT_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_FLOAT_DATATYPEVALIDATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT FloatDatatypeValidator : public AbstractNumericValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + FloatDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + FloatDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~FloatDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(FloatDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // ctor provided to be used by derived classes + // ----------------------------------------------------------------------- + FloatDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // ----------------------------------------------------------------------- + // Abstract interface from AbstractNumericFacetValidator + // ----------------------------------------------------------------------- + + virtual int compareValues(const XMLNumber* const lValue + , const XMLNumber* const rValue); + + virtual void setMaxInclusive(const XMLCh* const); + + virtual void setMaxExclusive(const XMLCh* const); + + virtual void setMinInclusive(const XMLCh* const); + + virtual void setMinExclusive(const XMLCh* const); + + virtual void setEnumeration(MemoryManager* const manager); + +// ----------------------------------------------------------------------- +// Abstract interface from AbstractNumericValidator +// ----------------------------------------------------------------------- + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + FloatDatatypeValidator(const FloatDatatypeValidator&); + FloatDatatypeValidator& operator = (const FloatDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file FloatDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp new file mode 100644 index 000000000..1618a3b71 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp @@ -0,0 +1,101 @@ +/* + * 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: HexBinaryDatatypeValidator.cpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +HexBinaryDatatypeValidator::HexBinaryDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::HexBinary, manager) +{} + +HexBinaryDatatypeValidator::~HexBinaryDatatypeValidator() +{} + +HexBinaryDatatypeValidator::HexBinaryDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::HexBinary, manager) +{ + init(enums, manager); +} + +DatatypeValidator* HexBinaryDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) HexBinaryDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content, + MemoryManager* const manager) +{ + if (HexBin::getDataLength(content) < 0) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Not_HexBin + , content + , manager); + } +} + +XMLSize_t HexBinaryDatatypeValidator::getLength(const XMLCh* const content + , MemoryManager* const) const +{ + return (XMLSize_t)HexBin::getDataLength(content); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(HexBinaryDatatypeValidator) + +void HexBinaryDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file HexBinaryDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp new file mode 100644 index 000000000..ca820d612 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp @@ -0,0 +1,101 @@ +/* + * 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: HexBinaryDatatypeValidator.hpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_HEXBINARY_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_HEXBINARY_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT HexBinaryDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + HexBinaryDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + HexBinaryDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~HexBinaryDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(HexBinaryDatatypeValidator) + +protected: + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + + virtual XMLSize_t getLength(const XMLCh* const content + , MemoryManager* const manager) const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + HexBinaryDatatypeValidator(const HexBinaryDatatypeValidator&); + HexBinaryDatatypeValidator& operator=(const HexBinaryDatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // Nil. + // ----------------------------------------------------------------------- +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file HexBinaryDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.cpp new file mode 100644 index 000000000..eed724ae7 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.cpp @@ -0,0 +1,123 @@ +/* + * 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: IDDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +IDDatatypeValidator::IDDatatypeValidator(MemoryManager* const manager) +:StringDatatypeValidator(0, 0, 0, DatatypeValidator::ID, manager) +{} + +IDDatatypeValidator::IDDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::ID, manager) +{ + init(enums, manager); +} + +IDDatatypeValidator::~IDDatatypeValidator() +{} + +DatatypeValidator* IDDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) IDDatatypeValidator(this, facets, enums, finalSet, manager); +} + +IDDatatypeValidator::IDDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, type, manager) +{ + // do not invoke init() here!!! +} + +void IDDatatypeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + // use StringDatatypeValidator (which in turn, invoke + // the baseValidator) to validate content against + // facets if any. + // + StringDatatypeValidator::validate(content, context, manager); + + // storing IDs to the global ID table + if (context) + { + context->addId(content); + } + +} + +void IDDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // 3.3.8 check must: "NCName" + // + if ( !XMLChar1_0::isValidNCName(content, XMLString::stringLen(content)) ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_NCName + , content + , manager); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IDDatatypeValidator) + +void IDDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + StringDatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IDDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.hpp new file mode 100644 index 000000000..1088c7d13 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/IDDatatypeValidator.hpp @@ -0,0 +1,132 @@ +/* + * 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: IDDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_ID_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_ID_DATATYPEVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT IDDatatypeValidator : public StringDatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + IDDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + IDDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~IDDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IDDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + IDDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IDDatatypeValidator(const IDDatatypeValidator&); + IDDatatypeValidator& operator=(const IDDatatypeValidator&); + // ----------------------------------------------------------------------- + // Private data members + // + // + // ----------------------------------------------------------------------- +}; + +XERCES_CPP_NAMESPACE_END + +#endif +/** + * End of file IDDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp new file mode 100644 index 000000000..dd0f6cf7f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.cpp @@ -0,0 +1,125 @@ +/* + * 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: IDREFDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +IDREFDatatypeValidator::IDREFDatatypeValidator(MemoryManager* const manager) +:StringDatatypeValidator(0, 0, 0, DatatypeValidator::IDREF, manager) +{} + +IDREFDatatypeValidator::IDREFDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::IDREF, manager) +{ + init(enums, manager); +} + +IDREFDatatypeValidator::~IDREFDatatypeValidator() +{} + +DatatypeValidator* IDREFDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) IDREFDatatypeValidator(this, facets, enums, finalSet, manager); +} + +IDREFDatatypeValidator::IDREFDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, type, manager) +{ + // do not invoke init() here!!! +} + +void IDREFDatatypeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + // use StringDatatypeValidator (which in turn, invoke + // the baseValidator) to validate content against + // facets if any. + // + StringDatatypeValidator::validate(content, context, manager); + + // this is different from java, since we always add, while + // in java, it is done as told. REVISIT. + // + if (context) + { + context->addIdRef(content); + } + +} + +void IDREFDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // 3.3.9 check must: "NCName" + // + if ( !XMLChar1_0::isValidNCName(content, XMLString::stringLen(content)) ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_NCName + , content + , manager); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IDREFDatatypeValidator) + +void IDREFDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + StringDatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IDREFDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.hpp new file mode 100644 index 000000000..01d73090a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/IDREFDatatypeValidator.hpp @@ -0,0 +1,135 @@ +/* + * 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: IDREFDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IDREF_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_IDREF_DATATYPEVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT IDREFDatatypeValidator : public StringDatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + IDREFDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + IDREFDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~IDREFDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IDREFDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + IDREFDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IDREFDatatypeValidator(const IDREFDatatypeValidator&); + IDREFDatatypeValidator& operator=(const IDREFDatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // + // ----------------------------------------------------------------------- + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IDREFDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeFacetException.hpp b/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeFacetException.hpp new file mode 100644 index 000000000..d62412df6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeFacetException.hpp @@ -0,0 +1,34 @@ +/* + * 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: InvalidDatatypeFacetException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_INVALIDDATATYPEFACETEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_INVALIDDATATYPEFACETEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(InvalidDatatypeFacetException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeValueException.hpp b/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeValueException.hpp new file mode 100644 index 000000000..6ec8e5c59 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/InvalidDatatypeValueException.hpp @@ -0,0 +1,34 @@ +/* + * 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: InvalidDatatypeValueException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_INVALIDDATATYPEVALUEEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_INVALIDDATATYPEVALUEEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(InvalidDatatypeValueException, XMLUTIL_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.cpp new file mode 100644 index 000000000..d6039b102 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.cpp @@ -0,0 +1,459 @@ +/* + * 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: ListDatatypeValidator.cpp 695949 2008-09-16 15:57:44Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const int BUF_LEN = 64; + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +ListDatatypeValidator::ListDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::List, manager) +,fContent(0) +{} + +ListDatatypeValidator::ListDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::List, manager) +,fContent(0) +{ + // + // baseValidator shall either + // an atomic DTV which servers as itemType, or + // another ListDTV from which, this ListDTV is derived by restriction. + // + // In either case, it shall be not null + // + if (!baseValidator) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_List_Null_baseValidator, manager); + + init(enums, manager); +} + +ListDatatypeValidator::~ListDatatypeValidator() +{} + +DatatypeValidator* ListDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) ListDatatypeValidator(this, facets, enums, finalSet, manager); +} + + +int ListDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const manager) +{ + DatatypeValidator* theItemTypeDTV = getItemTypeDTV(); + BaseRefVectorOf* lVector = XMLString::tokenizeString(lValue, manager); + Janitor > janl(lVector); + BaseRefVectorOf* rVector = XMLString::tokenizeString(rValue, manager); + Janitor > janr(rVector); + + XMLSize_t lNumberOfTokens = lVector->size(); + XMLSize_t rNumberOfTokens = rVector->size(); + + if (lNumberOfTokens < rNumberOfTokens) + return -1; + else if (lNumberOfTokens > rNumberOfTokens) + return 1; + else + { //compare each token + for ( XMLSize_t i = 0; i < lNumberOfTokens; i++) + { + int returnValue = theItemTypeDTV->compare(lVector->elementAt(i), rVector->elementAt(i), manager); + if (returnValue != 0) + return returnValue; //REVISIT: does it make sense to return -1 or +1..? + } + return 0; + } + +} + +void ListDatatypeValidator::validate( const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + setContent(content); + BaseRefVectorOf* tokenVector = XMLString::tokenizeString(content, manager); + Janitor > janName(tokenVector); + checkContent(tokenVector, content, context, false, manager); +} + +void ListDatatypeValidator::checkContent( const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + setContent(content); + BaseRefVectorOf* tokenVector = XMLString::tokenizeString(content, manager); + Janitor > janName(tokenVector); + checkContent(tokenVector, content, context, asBase, manager); +} + +// +// here content is a list of items +// +void ListDatatypeValidator::checkContent( BaseRefVectorOf* tokenVector + , const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + DatatypeValidator* bv = getBaseValidator(); + + if (bv->getType() == DatatypeValidator::List) + ((ListDatatypeValidator*)bv)->checkContent(tokenVector, content, context, true, manager); + else + { // the ultimate itemType DTV + for (unsigned int i = 0; i < tokenVector->size(); i++) + bv->validate(tokenVector->elementAt(i), context, manager); + } + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + //check every item in the list as a whole + if (getRegex()->matches(content, manager) == false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + XMLSize_t tokenNumber = tokenVector->size(); + + if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) && + (tokenNumber > getMaxLength())) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager); + XMLString::sizeToText(getMaxLength(), value2, BUF_LEN, 10, manager); + + ThrowXMLwithMemMgr3(InvalidDatatypeValueException + , XMLExcepts::VALUE_GT_maxLen + , getContent() + , value1 + , value2 + , manager); + } + + if (((thisFacetsDefined & DatatypeValidator::FACET_MINLENGTH) != 0) && + (tokenNumber < getMinLength())) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager); + XMLString::sizeToText(getMinLength(), value2, BUF_LEN, 10, manager); + + ThrowXMLwithMemMgr3(InvalidDatatypeValueException + , XMLExcepts::VALUE_LT_minLen + , getContent() + , value1 + , value2 + , manager); + } + + if (((thisFacetsDefined & DatatypeValidator::FACET_LENGTH) != 0) && + (tokenNumber != AbstractStringValidator::getLength())) + { + XMLCh value1[BUF_LEN+1]; + XMLCh value2[BUF_LEN+1]; + XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager); + XMLString::sizeToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager); + + ThrowXMLwithMemMgr3(InvalidDatatypeValueException + , XMLExcepts::VALUE_NE_Len + , getContent() + , value1 + , value2 + , manager); + } + + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + XMLSize_t i; + XMLSize_t enumLength = getEnumeration()->size(); + + for ( i = 0; i < enumLength; i++) + { + //optimization: we do a lexical comparision first + // this may be faster for string and its derived + if (XMLString::equals(getEnumeration()->elementAt(i), getContent())) + break; // a match found + + // do a value space check + // this is needed for decimal (and probably other types + // such as datetime related) + // eg. + // tokenVector = "1 2 3.0 4" vs enumeration = "1 2 3 4.0" + // + if (valueSpaceCheck(tokenVector, getEnumeration()->elementAt(i), manager)) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, getContent(), manager); + + } // enumeration + +} + +bool ListDatatypeValidator::valueSpaceCheck(BaseRefVectorOf* tokenVector + , const XMLCh* const enumStr + , MemoryManager* const manager) const +{ + DatatypeValidator* theItemTypeDTV = getItemTypeDTV(); + BaseRefVectorOf* enumVector = XMLString::tokenizeString(enumStr, manager); + Janitor > janName(enumVector); + + if (tokenVector->size() != enumVector->size()) + return false; + + for ( unsigned int j = 0; j < tokenVector->size(); j++ ) + { + if (theItemTypeDTV->compare(tokenVector->elementAt(j), enumVector->elementAt(j), manager) != 0) + return false; + } + + return true; +} + +DatatypeValidator* ListDatatypeValidator::getItemTypeDTV() const +{ + DatatypeValidator* bdv = this->getBaseValidator(); + + while (bdv->getType() == DatatypeValidator::List) + bdv = bdv->getBaseValidator(); + + return bdv; +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void ListDatatypeValidator::checkValueSpace(const XMLCh* const + , MemoryManager* const) +{} + +XMLSize_t ListDatatypeValidator::getLength(const XMLCh* const content + , MemoryManager* const manager) const +{ + BaseRefVectorOf* tokenVector = XMLString::tokenizeString(content, manager); + Janitor > janName(tokenVector); + + return tokenVector->size(); +} + +void ListDatatypeValidator::inspectFacetBase(MemoryManager* const manager) +{ + + // + // we are pretty sure baseValidator is not null + // + + if (getBaseValidator()->getType() == DatatypeValidator::List) + { + AbstractStringValidator::inspectFacetBase(manager); + } + else + { + // the first level ListDTV + // check 4.3.5.c0 must: enumeration values from the value space of base + if ( ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0) && + (getEnumeration() !=0) ) + { + XMLSize_t i; + XMLSize_t enumLength = getEnumeration()->size(); + try + { + for ( i = 0; i < enumLength; i++) + { + // ask the itemType for a complete check + BaseRefVectorOf* tempList = XMLString::tokenizeString(getEnumeration()->elementAt(i), manager); + Janitor > jan(tempList); + XMLSize_t tokenNumber = tempList->size(); + + try + { + for ( XMLSize_t j = 0; j < tokenNumber; j++) + getBaseValidator()->validate(tempList->elementAt(j), (ValidationContext*)0, manager); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } +#if 0 +// spec says that only base has to checkContent + // enum shall pass this->checkContent() as well. + checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager); +#endif + } + } + + catch ( XMLException& ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_enum_base + , getEnumeration()->elementAt(i) + , manager); + } + + } + + } + +}// End of inspectFacetBase() + +void ListDatatypeValidator::inheritFacet() +{ + + //iff the base validator is List, then we inherit + // + if (getBaseValidator()->getType() == DatatypeValidator::List) + { + AbstractStringValidator::inheritFacet(); + } + +} + +/*** + * 2.5.1.2 List datatypes + * + * The canonical-lexical-representation for the list datatype is defined as + * the lexical form in which each item in the list has the canonical + * lexical representation of its itemType. + ***/ +const XMLCh* ListDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : getMemoryManager(); + ListDatatypeValidator* temp = (ListDatatypeValidator*) this; + temp->setContent(rawData); + BaseRefVectorOf* tokenVector = XMLString::tokenizeString(rawData, toUse); + Janitor > janName(tokenVector); + + if (toValidate) + { + try + { + temp->checkContent(tokenVector, rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + XMLSize_t retBufSize = 2 * XMLString::stringLen(rawData); + XMLCh* retBuf = (XMLCh*) toUse->allocate(retBufSize * sizeof(XMLCh)); + retBuf[0] = 0; + XMLCh* retBufPtr = retBuf; + DatatypeValidator* itemDv = this->getItemTypeDTV(); + + try + { + for (unsigned int i = 0; i < tokenVector->size(); i++) + { + XMLCh* itemCanRep = (XMLCh*) itemDv->getCanonicalRepresentation(tokenVector->elementAt(i), toUse, false); + XMLSize_t itemLen = XMLString::stringLen(itemCanRep); + + if(retBufPtr+itemLen+2 >= retBuf+retBufSize) + { + // need to resize + XMLCh * oldBuf = retBuf; + retBuf = (XMLCh*) toUse->allocate(retBufSize * sizeof(XMLCh) * 4); + memcpy(retBuf, oldBuf, retBufSize * sizeof(XMLCh )); + retBufPtr = (retBufPtr - oldBuf) + retBuf; + toUse->deallocate(oldBuf); + retBufSize <<= 2; + } + + XMLString::catString(retBufPtr, itemCanRep); + retBufPtr = retBufPtr + itemLen; + *(retBufPtr++) = chSpace; + *(retBufPtr) = chNull; + toUse->deallocate(itemCanRep); + } + + return retBuf; + + } + catch (...) + { + return 0; + } +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(ListDatatypeValidator) + +void ListDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); + + //don't serialize fContent, since it is NOT owned and + //will be reset each time validate()/checkContent() invoked. +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ListDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.hpp new file mode 100644 index 000000000..817d39b52 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/ListDatatypeValidator.hpp @@ -0,0 +1,226 @@ +/* + * 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: ListDatatypeValidator.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_LIST_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_LIST_DATATYPEVALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT ListDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + ListDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ListDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~ListDatatypeValidator(); + + //@} + + /** @name Getter Functions */ + //@{ + /** + * Returns whether the type is atomic or not + */ + virtual bool isAtomic() const; + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + DatatypeValidator* getItemTypeDTV() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(ListDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes: No + // + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + + virtual XMLSize_t getLength(const XMLCh* const content + , MemoryManager* const manager) const; + + // + // Overwrite AbstractStringValidator's + // + virtual void inspectFacetBase(MemoryManager* const manager); + + virtual void inheritFacet(); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + +private: + + void checkContent( BaseRefVectorOf* tokenVector + , const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager + ); + + bool valueSpaceCheck(BaseRefVectorOf* tokenVector + , const XMLCh* const enumStr + , MemoryManager* const manager) const; + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- + + inline const XMLCh* getContent() const; + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- + + inline void setContent(const XMLCh* const content); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ListDatatypeValidator(const ListDatatypeValidator&); + ListDatatypeValidator& operator=(const ListDatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fContent + // temporary var referencing the content to be validated, + // for error reporting purpose. + // + // ----------------------------------------------------------------------- + const XMLCh* fContent; +}; + +// ----------------------------------------------------------------------- +// Getter methods +// ----------------------------------------------------------------------- +inline const XMLCh* ListDatatypeValidator::getContent() const +{ + return fContent; +} + +inline bool ListDatatypeValidator::isAtomic() const +{ + return false; +} + +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +inline void ListDatatypeValidator::setContent(const XMLCh* const content) +{ + fContent = content; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ListDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp new file mode 100644 index 000000000..22701047c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.cpp @@ -0,0 +1,108 @@ +/* + * 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: MonthDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +MonthDatatypeValidator::MonthDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Month, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +MonthDatatypeValidator::MonthDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Month, manager) +{ + init(enums, manager); +} + +MonthDatatypeValidator::~MonthDatatypeValidator() +{} + +DatatypeValidator* MonthDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) MonthDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* MonthDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseMonth(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void MonthDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseMonth(); +} + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(MonthDatatypeValidator) + +void MonthDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file MonthDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.hpp new file mode 100644 index 000000000..66975075b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/MonthDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: MonthDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MONTH_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_MONTH_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT MonthDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + MonthDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + MonthDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~MonthDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(MonthDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MonthDatatypeValidator(const MonthDatatypeValidator&); + MonthDatatypeValidator& operator=(const MonthDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file MonthDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp new file mode 100644 index 000000000..039a00b6c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.cpp @@ -0,0 +1,108 @@ +/* + * 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: MonthDayDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +MonthDayDatatypeValidator::MonthDayDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::MonthDay, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +MonthDayDatatypeValidator::MonthDayDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::MonthDay, manager) +{ + init(enums, manager); +} + +MonthDayDatatypeValidator::~MonthDayDatatypeValidator() +{} + +DatatypeValidator* MonthDayDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) MonthDayDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* MonthDayDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseMonthDay(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void MonthDayDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseMonthDay(); +} + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(MonthDayDatatypeValidator) + +void MonthDayDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file MonthDayDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.hpp new file mode 100644 index 000000000..e805976fb --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/MonthDayDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: MonthDayDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_MONTHDAY_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_MONTHDAY_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT MonthDayDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + MonthDayDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + MonthDayDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~MonthDayDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(MonthDayDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + MonthDayDatatypeValidator(const MonthDayDatatypeValidator&); + MonthDayDatatypeValidator& operator=(const MonthDayDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file MonthDayDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp new file mode 100644 index 000000000..05d07ea31 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.cpp @@ -0,0 +1,128 @@ +/* + * 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: NCNameDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +NCNameDatatypeValidator::NCNameDatatypeValidator(MemoryManager* const manager) +:StringDatatypeValidator(0, 0, 0, DatatypeValidator::NCName, manager) +{} + +NCNameDatatypeValidator::~NCNameDatatypeValidator() +{} + +NCNameDatatypeValidator::NCNameDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::NCName, manager) +{ + init(enums, manager); +} + +DatatypeValidator* NCNameDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) NCNameDatatypeValidator(this, facets, enums, finalSet, manager); +} + +NCNameDatatypeValidator::NCNameDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, type, manager) +{ + // do not invoke init() here!!! +} + +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int NCNameDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + return ( XMLString::equals(lValue, rValue)? 0 : -1); +} + +void NCNameDatatypeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + // use StringDatatypeValidator (which in turn, invoke + // the baseValidator) to validate content against + // facets if any. + // + StringDatatypeValidator::validate(content, context, manager); + + return; +} + +void NCNameDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // 3.3.7 check must: "NCName" + // + if ( !XMLChar1_0::isValidNCName(content, XMLString::stringLen(content)) ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_NCName + , content + , manager); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(NCNameDatatypeValidator) + +void NCNameDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + StringDatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + + /** + * End of file NCNameDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.hpp new file mode 100644 index 000000000..f39c48989 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NCNameDatatypeValidator.hpp @@ -0,0 +1,152 @@ +/* + * 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: NCNameDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NCNAME_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_NCNAME_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT NCNameDatatypeValidator : public StringDatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + NCNameDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + NCNameDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~NCNameDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(NCNameDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + NCNameDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + NCNameDatatypeValidator(const NCNameDatatypeValidator&); + NCNameDatatypeValidator& operator=(const NCNameDatatypeValidator&); + // ----------------------------------------------------------------------- + // Private data members + // + // + // ----------------------------------------------------------------------- + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file NCNameDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp new file mode 100644 index 000000000..246102c5e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp @@ -0,0 +1,154 @@ +/* + * 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: NOTATIONDatatypeValidator.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +NOTATIONDatatypeValidator::NOTATIONDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::NOTATION, manager) +{} + +NOTATIONDatatypeValidator::~NOTATIONDatatypeValidator() +{} + +NOTATIONDatatypeValidator::NOTATIONDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::NOTATION, manager) +{ + init(enums, manager); +} + +DatatypeValidator* NOTATIONDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) NOTATIONDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void NOTATIONDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + + if (!XMLString::isValidNOTATION(content, manager)) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_NOTATION_Invalid + , content + , manager); + } + +} + +void NOTATIONDatatypeValidator::checkContent( const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager + ) +{ + + //validate against base validator if any + NOTATIONDatatypeValidator *pBaseValidator = (NOTATIONDatatypeValidator*) this->getBaseValidator(); + if (pBaseValidator) + pBaseValidator->checkContent(content, context, true, manager); + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + checkValueSpace(content, manager); + + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + XMLCh* normContent = XMLString::replicate(content, manager); + ArrayJanitor jan(normContent, manager); + normalizeContent(normContent, manager); + + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (XMLString::equals(normContent, getEnumeration()->elementAt(i))) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + checkAdditionalFacet(content, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(NOTATIONDatatypeValidator) + +void NOTATIONDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file NOTATIONDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp new file mode 100644 index 000000000..6f5b9e5b5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp @@ -0,0 +1,103 @@ +/* + * 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: NOTATIONDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NOTATION_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_NOTATION_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT NOTATIONDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + NOTATIONDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + NOTATIONDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual ~NOTATIONDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(NOTATIONDatatypeValidator) + +protected: + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + NOTATIONDatatypeValidator(const NOTATIONDatatypeValidator&); + NOTATIONDatatypeValidator& operator=(const NOTATIONDatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // Nil + // ----------------------------------------------------------------------- +}; + +XERCES_CPP_NAMESPACE_END + +#endif +/** + * End of file NOTATIONDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.cpp new file mode 100644 index 000000000..8e32c76bb --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.cpp @@ -0,0 +1,128 @@ +/* + * 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: NameDatatypeValidator.cpp 558817 2007-07-23 18:12:54Z cargilld $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +NameDatatypeValidator::NameDatatypeValidator(MemoryManager* const manager) +:StringDatatypeValidator(0, 0, 0, DatatypeValidator::Name, manager) +{} + +NameDatatypeValidator::~NameDatatypeValidator() +{} + +NameDatatypeValidator::NameDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Name, manager) +{ + init(enums, manager); +} + +DatatypeValidator* NameDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) NameDatatypeValidator(this, facets, enums, finalSet, manager); +} + +NameDatatypeValidator::NameDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:StringDatatypeValidator(baseValidator, facets, finalSet, type, manager) +{ + // do not invoke init() here!!! +} +// ----------------------------------------------------------------------- +// Compare methods +// ----------------------------------------------------------------------- +int NameDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const) +{ + return ( XMLString::equals(lValue, rValue)? 0 : -1); +} + +void NameDatatypeValidator::validate(const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + // use StringDatatypeValidator (which in turn, invoke + // the baseValidator) to validate content against + // facets if any. + // + StringDatatypeValidator::validate(content, context, manager); + + return; +} + +void NameDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // 3.3.6 check must: "Name" + // + if ( !XMLChar1_0::isValidName(content)) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_Invalid_Name + , content + , SchemaSymbols::fgDT_NAME + , manager); + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(NameDatatypeValidator) + +void NameDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + StringDatatypeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + + /** + * End of file NameDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.hpp new file mode 100644 index 000000000..993042696 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/NameDatatypeValidator.hpp @@ -0,0 +1,151 @@ +/* + * 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: NameDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NAME_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_NAME_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT NameDatatypeValidator : public StringDatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + NameDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + NameDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~NameDatatypeValidator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + virtual int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(NameDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + NameDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + NameDatatypeValidator(const NameDatatypeValidator&); + NameDatatypeValidator& operator=(const NameDatatypeValidator&); + // ----------------------------------------------------------------------- + // Private data members + // + // + // ----------------------------------------------------------------------- + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file NameDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp new file mode 100644 index 000000000..8fe91c7cf --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp @@ -0,0 +1,272 @@ +/* + * 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: QNameDatatypeValidator.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +QNameDatatypeValidator::QNameDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::QName, manager) +{} + +QNameDatatypeValidator::~QNameDatatypeValidator() +{} + +QNameDatatypeValidator::QNameDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::QName, manager) +{ + init(enums, manager); +} + +DatatypeValidator* QNameDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) QNameDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- + +void QNameDatatypeValidator::checkValueSpace(const XMLCh* const content + , MemoryManager* const manager) +{ + // + // check 3.2.18.c0 must: QName + // + + if ( !XMLChar1_0::isValidQName(content, XMLString::stringLen(content)) ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_QName_Invalid + , content + , manager); + } +} + +void QNameDatatypeValidator::checkContent( const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager + ) +{ + + //validate against base validator if any + QNameDatatypeValidator *pBaseValidator = (QNameDatatypeValidator*) this->getBaseValidator(); + if (pBaseValidator) + pBaseValidator->checkContent(content, context, true, manager); + + int thisFacetsDefined = getFacetsDefined(); + + // we check pattern first + if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) ==false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + checkValueSpace(content, manager); + + int colonPos = 0; + XMLCh* prefix = 0; + ArrayJanitor jan(prefix, manager); + + if (context) { + prefix = XMLString::replicate(content, manager); + jan.reset(prefix, manager); + normalizeContent(prefix, manager); + + colonPos = XMLString::indexOf(content, chColon); + if (colonPos > 0) { + prefix[colonPos] = chNull; + if (context->isPrefixUnknown(prefix)) { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_QName_Invalid2 + , content + , manager); + } + } + } + +#if 0 + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + XMLCh* normContent = XMLString::replicate(content, manager); + ArrayJanitor jan(normContent, manager); + normalizeContent(normContent, manager); + + int i=0; + int enumLength = getEnumeration()->size(); + for ( ; i < enumLength; i++) + { + if (XMLString::equals(normContent, getEnumeration()->elementAt(i))) + break; + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } + + +#else + if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0) && context) + { + XMLCh* localName; + if (colonPos > 0) { + localName = prefix + colonPos + 1; + } + else { + localName = prefix; + } + + XMLCh* enumPrefix; + XMLCh* enumLocalName; + XMLSize_t i=0; + XMLSize_t enumLength = getEnumeration()->size(); + bool foundURIId = false; + const XMLCh* normURI = 0; + // The +=2 is because the enumeration has prefix:localname as one entry followed + // by the URI string for the prefix as the next entry. + for ( ; i < enumLength; i+=2) + { + enumPrefix = XMLString::replicate(getEnumeration()->elementAt(i), manager); + ArrayJanitor janEnum(enumPrefix, manager); + colonPos = XMLString::indexOf(enumPrefix, chColon, 0, manager); + + if (colonPos != -1) { + enumLocalName = enumPrefix + colonPos + 1; + enumPrefix[colonPos] = chNull; + } + else { + enumLocalName = enumPrefix; + } + + if (XMLString::equals(localName, enumLocalName)) { + if (colonPos < 0) + break; + + // now need to see if the prefix URI's are the same + if (!foundURIId) { + normURI = context->getURIForPrefix(prefix); + foundURIId = true; + } + if (XMLString::equals(normURI, getEnumeration()->elementAt(i+1))) + break; + } + } + + if (i == enumLength) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + } +#endif + + checkAdditionalFacet(content, manager); +} + +// +// Check vs base +// check common facets +// check enumeration +// check Additional Facet Constraint +// +void QNameDatatypeValidator::inspectFacetBase(MemoryManager* const manager) +{ + + QNameDatatypeValidator *pBaseValidator = (QNameDatatypeValidator*) getBaseValidator(); + int thisFacetsDefined = getFacetsDefined(); + + if ( (!thisFacetsDefined && !getEnumeration()) || + (!pBaseValidator) ) + return; + + // check 4.3.5.c0 must: enumeration values from the value space of base + if ( ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0) && + (getEnumeration() !=0)) + { + XMLSize_t i = 0; + XMLSize_t enumLength = getEnumeration()->size(); + // The +=2 is because the enumeration has prefix:localname as one entry followed + // by the URI string for the prefix as the next entry. + for ( ; i < enumLength; i+=2) + { + // ask parent do a complete check + pBaseValidator->checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager); +#if 0 +// spec says that only base has to checkContent + // enum shall pass this->checkContent() as well. + checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager); +#endif + } + } + + checkAdditionalFacetConstraints(manager); + +} //end of inspectFacetBase + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(QNameDatatypeValidator) + +void QNameDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file QNameDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp new file mode 100644 index 000000000..0451fdfde --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp @@ -0,0 +1,106 @@ +/* + * 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: QNameDatatypeValidator.hpp 577322 2007-09-19 14:58:04Z cargilld $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_QNAME_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_QNAME_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT QNameDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + QNameDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + QNameDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~QNameDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(QNameDatatypeValidator) + +protected: + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + + virtual void inspectFacetBase(MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + QNameDatatypeValidator(const QNameDatatypeValidator&); + QNameDatatypeValidator& operator=(const QNameDatatypeValidator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // Nil + // ----------------------------------------------------------------------- + +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file QNameDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.cpp new file mode 100644 index 000000000..aad14f8a4 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.cpp @@ -0,0 +1,204 @@ +/* + * 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: StringDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +StringDatatypeValidator::StringDatatypeValidator(MemoryManager* const manager) +:AbstractStringValidator(0, 0, 0, DatatypeValidator::String, manager) +{ + setWhiteSpace(DatatypeValidator::PRESERVE); +} + +StringDatatypeValidator::StringDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::String, manager) +{ + setWhiteSpace(DatatypeValidator::PRESERVE); + init(enums, manager); +} + +StringDatatypeValidator::~StringDatatypeValidator() +{} + +DatatypeValidator* StringDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) StringDatatypeValidator(this, facets, enums, finalSet, manager); +} + +StringDatatypeValidator::StringDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager) +:AbstractStringValidator(baseValidator, facets, finalSet, type, manager) +{ + setWhiteSpace(DatatypeValidator::PRESERVE); + // do not invoke init() here!!! +} + +// --------------------------------------------------------------------------- +// Utilities +// --------------------------------------------------------------------------- +void StringDatatypeValidator::assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager) +{ + if (XMLString::equals(key, SchemaSymbols::fgELT_WHITESPACE)) + { + // whiteSpace = preserve | replace | collapse + if (XMLString::equals(value, SchemaSymbols::fgWS_PRESERVE)) + setWhiteSpace(DatatypeValidator::PRESERVE); + else if (XMLString::equals(value, SchemaSymbols::fgWS_REPLACE)) + setWhiteSpace(DatatypeValidator::REPLACE); + else if (XMLString::equals(value, SchemaSymbols::fgWS_COLLAPSE)) + setWhiteSpace(DatatypeValidator::COLLAPSE); + else + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_WS, value, manager); + //("whiteSpace value '" + ws + "' must be one of 'preserve', 'replace', 'collapse'."); + + setFacetsDefined(DatatypeValidator::FACET_WHITESPACE); + } + else + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); + } +} + +void StringDatatypeValidator::inheritAdditionalFacet() +{ + StringDatatypeValidator *pBaseValidator = (StringDatatypeValidator*) getBaseValidator(); + + if (!pBaseValidator) + return; + + // inherit whitespace + if (((pBaseValidator->getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) !=0) && + ((getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) == 0)) + { + setWhiteSpace(getBaseValidator()->getWSFacet()); + setFacetsDefined(DatatypeValidator::FACET_WHITESPACE); + } +} + +void StringDatatypeValidator::checkAdditionalFacetConstraints(MemoryManager* const manager) const +{ + + StringDatatypeValidator *pBaseValidator = (StringDatatypeValidator*) getBaseValidator(); + + if (!pBaseValidator) + return; + + short thisWSFacet = getWSFacet(); + short baseWSFacet = pBaseValidator->getWSFacet(); + + // check 4.3.6.c1 error: whitespace + if (((getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) != 0) && + ((pBaseValidator->getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) != 0 )) + { + if ((baseWSFacet == DatatypeValidator::COLLAPSE) && + ((thisWSFacet == DatatypeValidator::PRESERVE) || + (thisWSFacet == DatatypeValidator::REPLACE))) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_WS_collapse, manager); + + if ((baseWSFacet == DatatypeValidator::REPLACE) && + (thisWSFacet == DatatypeValidator::PRESERVE)) + ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_WS_replace, manager); + + if (((pBaseValidator->getFixed() & DatatypeValidator::FACET_WHITESPACE) !=0) && + ( thisWSFacet != baseWSFacet)) + { + ThrowXMLwithMemMgr2(InvalidDatatypeFacetException + , XMLExcepts::FACET_whitespace_base_fixed + , getWSstring(thisWSFacet) + , getWSstring(baseWSFacet) + , manager); + } + } + +} + +void StringDatatypeValidator::checkAdditionalFacet(const XMLCh* const content + , MemoryManager* const manager) const +{ + // + // check WhiteSpace + // + if ((getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) != 0 ) + { + if ( getWSFacet() == DatatypeValidator::REPLACE ) + { + if (!XMLString::isWSReplaced(content)) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_WS_replaced, content, manager); + } + else if ( getWSFacet() == DatatypeValidator::COLLAPSE ) + { + if (!XMLString::isWSCollapsed(content)) + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_WS_collapsed, content, manager); + } + + } +} + +void StringDatatypeValidator::checkValueSpace(const XMLCh* const + , MemoryManager* const) +{} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(StringDatatypeValidator) + +void StringDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + AbstractStringValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file StringDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.hpp new file mode 100644 index 000000000..7437bdc6a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/StringDatatypeValidator.hpp @@ -0,0 +1,114 @@ +/* + * 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: StringDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_STRING_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_STRING_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT StringDatatypeValidator : public AbstractStringValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + StringDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + StringDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + virtual ~StringDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(StringDatatypeValidator) + +protected: + + // + // ctor provided to be used by derived classes + // + StringDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , const int finalSet + , const ValidatorType type + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual void assignAdditionalFacet(const XMLCh* const key + , const XMLCh* const value + , MemoryManager* const manager); + + virtual void inheritAdditionalFacet(); + + virtual void checkAdditionalFacetConstraints(MemoryManager* const manager) const; + + virtual void checkAdditionalFacet(const XMLCh* const content + , MemoryManager* const manager) const; + + virtual void checkValueSpace(const XMLCh* const content + , MemoryManager* const manager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + StringDatatypeValidator(const StringDatatypeValidator&); + StringDatatypeValidator& operator=(const StringDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file StringDatatypeValidator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp new file mode 100644 index 000000000..b27b0296f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp @@ -0,0 +1,140 @@ +/* + * 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: TimeDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +TimeDatatypeValidator::TimeDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Time, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +TimeDatatypeValidator::TimeDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Time, manager) +{ + init(enums, manager); +} + +TimeDatatypeValidator::~TimeDatatypeValidator() +{} + +DatatypeValidator* TimeDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) TimeDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* TimeDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseTime(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void TimeDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseTime(); +} + +const XMLCh* TimeDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : fMemoryManager; + + if (toValidate) + { + TimeDatatypeValidator* temp = (TimeDatatypeValidator*) this; + + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + try + { + XMLDateTime aDateTime(rawData, toUse); + aDateTime.parseTime(); + return aDateTime.getTimeCanonicalRepresentation(toUse); + } + catch (...) + { + return 0; + } + +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(TimeDatatypeValidator) + +void TimeDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file TimeDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp new file mode 100644 index 000000000..9e9178427 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp @@ -0,0 +1,104 @@ +/* + * 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: TimeDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TIME_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_TIME_DATATYPE_VALIDATOR_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT TimeDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + TimeDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + TimeDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~TimeDatatypeValidator(); + + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(TimeDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + TimeDatatypeValidator(const TimeDatatypeValidator&); + TimeDatatypeValidator& operator=(const TimeDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file TimeDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp new file mode 100644 index 000000000..cc5b4bbc0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp @@ -0,0 +1,465 @@ +/* + * 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: UnionDatatypeValidator.cpp 677559 2008-07-17 11:35:27Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +static const unsigned int BUF_LEN = 64; + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +UnionDatatypeValidator::UnionDatatypeValidator(MemoryManager* const manager) +:DatatypeValidator(0, 0, 0, DatatypeValidator::Union, manager) +,fEnumerationInherited(false) +,fMemberTypesInherited(false) +,fEnumeration(0) +,fMemberTypeValidators(0) + +{} + +UnionDatatypeValidator::~UnionDatatypeValidator() +{ + cleanUp(); +} + +UnionDatatypeValidator::UnionDatatypeValidator( + RefVectorOf* const memberTypeValidators + , const int finalSet + , MemoryManager* const manager) +:DatatypeValidator(0, 0, finalSet, DatatypeValidator::Union, manager) +,fEnumerationInherited(false) +,fMemberTypesInherited(false) +,fEnumeration(0) +,fMemberTypeValidators(0) +{ + if ( !memberTypeValidators ) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException + , XMLExcepts::FACET_Union_Null_memberTypeValidators, manager); + } + + // no pattern, no enumeration + fMemberTypeValidators = memberTypeValidators; +} + +typedef JanitorMemFunCall CleanupType; + +UnionDatatypeValidator::UnionDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager + , RefVectorOf* const memberTypeValidators + , const bool memberTypesInherited + ) +:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Union, manager) +,fEnumerationInherited(false) +,fMemberTypesInherited(memberTypesInherited) +,fEnumeration(0) +,fMemberTypeValidators(memberTypeValidators) +{ + // + // baseValidator another UnionDTV from which, + // this UnionDTV is derived by restriction. + // it shall be not null + // + if (!baseValidator) + { + ThrowXMLwithMemMgr(InvalidDatatypeFacetException + , XMLExcepts::FACET_Union_Null_baseValidator, manager); + } + + if (baseValidator->getType() != DatatypeValidator::Union) + { + XMLCh value1[BUF_LEN+1]; + XMLString::binToText(baseValidator->getType(), value1, BUF_LEN, 10, manager); + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Union_invalid_baseValidatorType + , value1 + , manager); + } + + CleanupType cleanup(this, &UnionDatatypeValidator::cleanUp); + + try + { + init(baseValidator, facets, enums, manager); + } + catch(const OutOfMemoryException&) + { + // Don't cleanup when out of memory, since executing the + // code can cause problems. + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +void UnionDatatypeValidator::init(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , MemoryManager* const manager) +{ + if (enums) + setEnumeration(enums, false); + + // Set Facets if any defined + if (facets) + { + XMLCh* key; + XMLCh* value; + RefHashTableOfEnumerator e(facets, false, manager); + + while (e.hasMoreElements()) + { + KVStringPair pair = e.nextElement(); + key = pair.getKey(); + value = pair.getValue(); + + if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN)) + { + setPattern(value); + if (getPattern()) + setFacetsDefined(DatatypeValidator::FACET_PATTERN); + // do not construct regex until needed + } + else + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_Invalid_Tag + , key + , manager); + } + }//while + + /*** + Schema constraint: Part I -- self checking + ***/ + // Nil + + /*** + Schema constraint: Part II base vs derived checking + ***/ + // check 4.3.5.c0 must: enumeration values from the value space of base + if ( ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0) && + (getEnumeration() !=0)) + { + XMLSize_t i = 0; + XMLSize_t enumLength = getEnumeration()->size(); + try + { + for ( ; i < enumLength; i++) + { + // ask parent do a complete check + // + // enum need NOT be passed this->checkContent() + // since there are no other facets for Union, parent + // checking is good enough. + // + baseValidator->validate(getEnumeration()->elementAt(i), (ValidationContext*)0, manager); + + } + } + + catch ( XMLException& ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeFacetException + , XMLExcepts::FACET_enum_base + , getEnumeration()->elementAt(i) + , manager); + } + } + + }// End of Facet setting + + /*** + Inherit facets from base.facets + + The reason of this inheriting (or copying values) is to ease + schema constraint checking, so that we need NOT trace back to our + very first base validator in the hierachy. Instead, we are pretty + sure checking against immediate base validator is enough. + ***/ + + UnionDatatypeValidator *pBaseValidator = (UnionDatatypeValidator*) baseValidator; + + // inherit enumeration + if (((pBaseValidator->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) !=0) && + ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) == 0)) + { + setEnumeration(pBaseValidator->getEnumeration(), true); + } + +} + +// +// 1) the bottom level UnionDTV would check against +// pattern and enumeration as well +// 2) each UnionDTV(s) above the bottom level UnionDTV and +// below the native UnionDTV (the top level DTV) +// would check against pattern only. +// 3) the natvie Union DTV (the top level DTV) would invoke +// memberTypeValidator to validate +// +void UnionDatatypeValidator::checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager) +{ + + DatatypeValidator* bv = getBaseValidator(); + if (bv) + ((UnionDatatypeValidator*)bv)->checkContent(content, context, true, manager); + else + { // 3) native union type + // check content against each member type validator in Union + // report an error only in case content is not valid against all member datatypes. + // + bool memTypeValid = false; + for ( unsigned int i = 0; i < fMemberTypeValidators->size(); ++i ) + { + if ( memTypeValid ) + break; + + try + { + fMemberTypeValidators->elementAt(i)->validate(content, context, manager); + memTypeValid = true; + + //set the validator of the type actually used to validate the content + DatatypeValidator *dtv = fMemberTypeValidators->elementAt(i); + // context will be null during schema construction + if(context) + context->setValidatingMemberType(dtv); + } + catch (XMLException&) + { + //absorbed + } + } // for + + if ( !memTypeValid ) + { + ThrowXMLwithMemMgr1(InvalidDatatypeValueException + , XMLExcepts::VALUE_no_match_memberType + , content + , manager); + //( "Content '"+content+"' does not match any union types" ); + } + } + + // 1) and 2). we check pattern first + if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 ) + { + if (getRegex()->matches(content, manager) == false) + { + ThrowXMLwithMemMgr2(InvalidDatatypeValueException + , XMLExcepts::VALUE_NotMatch_Pattern + , content + , getPattern() + , manager); + } + } + + // if this is a base validator, we only need to check pattern facet + // all other facet were inherited by the derived type + if (asBase) + return; + + if ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0 && + (getEnumeration() != 0)) + { + + // If the content match (compare equal) any enumeration with + // any of the member types, it is considerd valid. + // + RefVectorOf* memberDTV = getMemberTypeValidators(); + RefArrayVectorOf* tmpEnum = getEnumeration(); + XMLSize_t memberTypeNumber = memberDTV->size(); + XMLSize_t enumLength = tmpEnum->size(); + + for ( XMLSize_t memberIndex = 0; memberIndex < memberTypeNumber; ++memberIndex) + { + for ( XMLSize_t enumIndex = 0; enumIndex < enumLength; ++enumIndex) + { + try + { + if (memberDTV->elementAt(memberIndex)->compare(content, tmpEnum->elementAt(enumIndex), manager) == 0) + return; + } + catch (XMLException&) + { + //absorbed + } + } // for enumIndex + } // for memberIndex + + ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager); + + } // enumeration + +} + +// +// +// +int UnionDatatypeValidator::compare(const XMLCh* const lValue + , const XMLCh* const rValue + , MemoryManager* const manager) +{ + RefVectorOf* memberDTV = getMemberTypeValidators(); + XMLSize_t memberTypeNumber = memberDTV->size(); + + for ( XMLSize_t memberIndex = 0; memberIndex < memberTypeNumber; ++memberIndex) + { + // 'compare' can throw exceptions when the datatype is not valid, or just + // return -1; so attempt to validate both values to get the right validator + try + { + memberDTV->elementAt(memberIndex)->validate(lValue, 0, manager); + memberDTV->elementAt(memberIndex)->validate(rValue, 0, manager); + if (memberDTV->elementAt(memberIndex)->compare(lValue, rValue, manager) ==0) + return 0; + } + catch (XMLException&) + { + //absorbed + } + } + + //REVISIT: what does it mean for UNION1 to be or UNION2 ? + // As long as -1 or +1 indicates an unequality, return either of them is ok. + return -1; +} + +const RefArrayVectorOf* UnionDatatypeValidator::getEnumString() const +{ + return getEnumeration(); +} + +/*** + * 2.5.1.3 Union datatypes + * + * The canonical-lexical-representation for a union datatype is defined as the lexical form + * in which the values have the canonical lexical representation of the appropriate memberTypes. + ***/ +const XMLCh* UnionDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData + , MemoryManager* const memMgr + , bool toValidate) const +{ + MemoryManager* toUse = memMgr? memMgr : getMemoryManager(); + UnionDatatypeValidator* temp = (UnionDatatypeValidator*) this; + + if (toValidate) + { + try + { + temp->checkContent(rawData, 0, false, toUse); + } + catch (...) + { + return 0; + } + } + + //get the native unionDv + UnionDatatypeValidator* bdv = (UnionDatatypeValidator*) temp->getBaseValidator(); + while (bdv) + { + temp = bdv; + bdv = (UnionDatatypeValidator*) temp->getBaseValidator(); + } + + //let the member dv which recognize the rawData, to return + //us the canonical form + for ( unsigned int i = 0; i < temp->fMemberTypeValidators->size(); ++i ) + { + try + { + temp->fMemberTypeValidators->elementAt(i)->validate(rawData, 0, toUse); + return temp->fMemberTypeValidators->elementAt(i)->getCanonicalRepresentation(rawData, toUse, false); + } + catch (XMLException&) + { + //absorbed + } + } + + //if no member dv recognize it + return 0; +} + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(UnionDatatypeValidator) + +void UnionDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + + DatatypeValidator::serialize(serEng); + + if (serEng.isStoring()) + { + serEng< + * Serialize RefVectorOf + ***/ + XTemplateSerializer::storeObject(fEnumeration, serEng); + XTemplateSerializer::storeObject(fMemberTypeValidators, serEng); + } + else + { + serEng>>fEnumerationInherited; + serEng>>fMemberTypesInherited; + + /*** + * Deserialize RefArrayVectorOf + * Deserialize RefVectorOf + ***/ + XTemplateSerializer::loadObject(&fEnumeration, 8, true, serEng); + XTemplateSerializer::loadObject(&fMemberTypeValidators, 4, false, serEng); + } +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file UnionDatatypeValidator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp new file mode 100644 index 000000000..5e328b55b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp @@ -0,0 +1,320 @@ +/* + * 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: UnionDatatypeValidator.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_UNION_DATATYPEVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_UNION_DATATYPEVALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT UnionDatatypeValidator : public DatatypeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor. */ + //@{ + + UnionDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // + // constructor for native Union datatype validator + // + // + // + // + UnionDatatypeValidator + ( + RefVectorOf* const memberTypeValidators + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // + // constructor for derived Union datatype validator + // + // + // + // + // + // + // + UnionDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , RefVectorOf* const memberTypeValidators = 0 + , const bool memberTypesInherited = true + ); + + virtual ~UnionDatatypeValidator(); + + //@} + + virtual const RefArrayVectorOf* getEnumString() const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + /** @name Getter Functions */ + //@{ + /** + * Returns whether the type is atomic or not + */ + virtual bool isAtomic() const; + + virtual const XMLCh* getCanonicalRepresentation + ( + const XMLCh* const rawData + , MemoryManager* const memMgr = 0 + , bool toValidate = false + ) const; + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * validate that a string matches the boolean datatype + * @param content A string containing the content to be validated + * + * @exception throws InvalidDatatypeException if the content is + * is not valid. + */ + + virtual void validate + ( + const XMLCh* const content + , ValidationContext* const context = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** + * Checks whether a given type can be used as a substitute + * + * @param toCheck A datatype validator of the type to be used as a + * substitute + * + * To be redefined in UnionDatatypeValidator + */ + + virtual bool isSubstitutableBy(const DatatypeValidator* const toCheck); + + //@} + + // ----------------------------------------------------------------------- + // Compare methods + // ----------------------------------------------------------------------- + /** @name Compare Function */ + //@{ + + /** + * Compare two boolean data types + * + * @param content1 + * @param content2 + * @return + */ + int compare(const XMLCh* const, const XMLCh* const + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(UnionDatatypeValidator) + + + RefVectorOf* getMemberTypeValidators() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + UnionDatatypeValidator(const UnionDatatypeValidator&); + UnionDatatypeValidator& operator=(const UnionDatatypeValidator&); + + virtual void checkContent(const XMLCh* const content + , ValidationContext* const context + , bool asBase + , MemoryManager* const manager); + + void init(DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , MemoryManager* const manager); + + void cleanUp(); + + RefArrayVectorOf* getEnumeration() const; + + void setEnumeration(RefArrayVectorOf*, bool); + + + // ----------------------------------------------------------------------- + // Private data members + // + // fEnumeration + // we own it (or not, depending on state of fEnumerationInherited). + // + // fMemberTypeValidators + // we own it (or not, depending on the state of fMemberTypesInherited). + // + // ----------------------------------------------------------------------- + + bool fEnumerationInherited; + bool fMemberTypesInherited; + RefArrayVectorOf* fEnumeration; + RefVectorOf* fMemberTypeValidators; +}; + +inline DatatypeValidator* UnionDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) UnionDatatypeValidator(this, facets, enums, finalSet, manager, fMemberTypeValidators, true); +} + +inline void UnionDatatypeValidator::validate( const XMLCh* const content + , ValidationContext* const context + , MemoryManager* const manager) +{ + checkContent(content, context, false, manager); +} + +inline void UnionDatatypeValidator::cleanUp() +{ + //~RefVectorOf will delete all adopted elements + if ( !fEnumerationInherited && fEnumeration) + delete fEnumeration; + + if (!fMemberTypesInherited && fMemberTypeValidators) + delete fMemberTypeValidators; + +} + +inline RefArrayVectorOf* UnionDatatypeValidator:: getEnumeration() const +{ + return fEnumeration; +} + +inline void UnionDatatypeValidator::setEnumeration(RefArrayVectorOf* enums + , bool inherited) +{ + if (enums) + { + if ( !fEnumerationInherited && fEnumeration) + delete fEnumeration; + + fEnumeration = enums; + fEnumerationInherited = inherited; + setFacetsDefined(DatatypeValidator::FACET_ENUMERATION); + } +} + +// +// get the native UnionDTV's fMemberTypeValidators +// +inline +RefVectorOf* UnionDatatypeValidator::getMemberTypeValidators() const +{ + return this->fMemberTypeValidators; +} + +inline bool UnionDatatypeValidator::isAtomic() const { + + + + if (!fMemberTypeValidators) { + return false; + } + + XMLSize_t memberSize = fMemberTypeValidators->size(); + + for (XMLSize_t i=0; i < memberSize; i++) { + if (!fMemberTypeValidators->elementAt(i)->isAtomic()) { + return false; + } + } + + return true; +} + +inline bool UnionDatatypeValidator::isSubstitutableBy(const DatatypeValidator* const toCheck) { + + if (toCheck == this) { + return true; + } + + if (fMemberTypeValidators) { + XMLSize_t memberSize = fMemberTypeValidators->size(); + + for (XMLSize_t i=0; i < memberSize; i++) { + if ((fMemberTypeValidators->elementAt(i)->getType() == DatatypeValidator::Union) && + (fMemberTypeValidators->elementAt(i) == toCheck)) + return false; + if (fMemberTypeValidators->elementAt(i)->isSubstitutableBy(toCheck)) { + return true; + } + } + } + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file UnionDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.cpp b/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.cpp new file mode 100644 index 000000000..6cfb64294 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.cpp @@ -0,0 +1,44 @@ +/* + * 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: XMLCanRepGroup.cpp 471747 2006-11-06 14:31:56Z amassari $ + * + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XMLCanRepGroup::~XMLCanRepGroup() +{ +} + +XMLCanRepGroup::XMLCanRepGroup(CanRepGroup val) +:fData(val) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file DatatypeValidator.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.hpp b/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.hpp new file mode 100644 index 000000000..586ebbd0b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/XMLCanRepGroup.hpp @@ -0,0 +1,75 @@ +/* + * 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: XMLCanRepGroup.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLCANREPGROUP_HPP) +#define XERCESC_INCLUDE_GUARD_XMLCANREPGROUP_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT XMLCanRepGroup : public XMemory +{ +public: + + enum CanRepGroup { + Boolean, + DoubleFloat, + DateTime, + Time, + Decimal, + Decimal_Derived_signed, + Decimal_Derived_unsigned, + Decimal_Derived_npi, + String + }; + + ~XMLCanRepGroup(); + + XMLCanRepGroup(CanRepGroup val); + + inline CanRepGroup getGroup() const; + +private: + + CanRepGroup fData; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XMLCanRepGroup(const XMLCanRepGroup&); + XMLCanRepGroup& operator=(const XMLCanRepGroup&); + +}; + +inline XMLCanRepGroup::CanRepGroup XMLCanRepGroup::getGroup() const +{ + return fData; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XMLCanRepGroup.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.cpp new file mode 100644 index 000000000..bb7d2ed54 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.cpp @@ -0,0 +1,107 @@ +/* + * 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: YearDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +YearDatatypeValidator::YearDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::Year, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +YearDatatypeValidator::YearDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Year, manager) +{ + init(enums, manager); +} + +YearDatatypeValidator::~YearDatatypeValidator() +{} + +DatatypeValidator* YearDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) YearDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* YearDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseYear(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void YearDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseYear(); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(YearDatatypeValidator) + +void YearDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file YearDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.hpp new file mode 100644 index 000000000..20d22b744 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/YearDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: YearDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_YEAR_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_YEAR_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT YearDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + YearDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + YearDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~YearDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(YearDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + YearDatatypeValidator(const YearDatatypeValidator&); + YearDatatypeValidator& operator=(const YearDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file YearDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp b/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp new file mode 100644 index 000000000..13d4ccf63 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.cpp @@ -0,0 +1,108 @@ +/* + * 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: YearMonthDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Constructors and Destructor +// --------------------------------------------------------------------------- +YearMonthDatatypeValidator::YearMonthDatatypeValidator(MemoryManager* const manager) +:DateTimeValidator(0, 0, 0, DatatypeValidator::YearMonth, manager) +{ + setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL); +} + +YearMonthDatatypeValidator::YearMonthDatatypeValidator( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager) +:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::YearMonth, manager) +{ + init(enums, manager); +} + +YearMonthDatatypeValidator::~YearMonthDatatypeValidator() +{} + +DatatypeValidator* YearMonthDatatypeValidator::newInstance +( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager +) +{ + return (DatatypeValidator*) new (manager) YearMonthDatatypeValidator(this, facets, enums, finalSet, manager); +} + +// +// caller need to release the date created here +// +XMLDateTime* YearMonthDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager) +{ + XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager); + Janitor jan(pRetDate); + + try + { + pRetDate->parseYearMonth(); + } + catch(const OutOfMemoryException&) + { + jan.release(); + + throw; + } + + return jan.release(); +} + +void YearMonthDatatypeValidator::parse(XMLDateTime* const pDate) +{ + pDate->parseYearMonth(); +} + + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(YearMonthDatatypeValidator) + +void YearMonthDatatypeValidator::serialize(XSerializeEngine& serEng) +{ + DateTimeValidator::serialize(serEng); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file YearMonthDatatypeValidator::cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.hpp b/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.hpp new file mode 100644 index 000000000..98a5632e2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/datatype/YearMonthDatatypeValidator.hpp @@ -0,0 +1,95 @@ +/* + * 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: YearMonthDatatypeValidator.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_YEARMONTH_DATATYPE_VALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_YEARMONTH_DATATYPE_VALIDATOR_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT YearMonthDatatypeValidator : public DateTimeValidator +{ +public: + + // ----------------------------------------------------------------------- + // Public ctor/dtor + // ----------------------------------------------------------------------- + /** @name Constructors and Destructor */ + //@{ + + YearMonthDatatypeValidator + ( + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + YearMonthDatatypeValidator + ( + DatatypeValidator* const baseValidator + , RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~YearMonthDatatypeValidator(); + + //@} + + /** + * Returns an instance of the base datatype validator class + * Used by the DatatypeValidatorFactory. + */ + virtual DatatypeValidator* newInstance + ( + RefHashTableOf* const facets + , RefArrayVectorOf* const enums + , const int finalSet + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(YearMonthDatatypeValidator) + +protected: + + // ----------------------------------------------------------------------- + // implementation of (DateTimeValidator's) virtual interface + // ----------------------------------------------------------------------- + virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager); + virtual void parse(XMLDateTime* const); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + YearMonthDatatypeValidator(const YearMonthDatatypeValidator&); + YearMonthDatatypeValidator& operator=(const YearMonthDatatypeValidator&); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file YearMonthDatatypeValidator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.cpp b/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.cpp new file mode 100644 index 000000000..687611910 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.cpp @@ -0,0 +1,911 @@ +/* + * 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: ComplexTypeInfo.cpp 901107 2010-01-20 08:45:02Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Static member data +// --------------------------------------------------------------------------- +ComplexTypeInfo* ComplexTypeInfo::fAnyType = 0; + +void XMLInitializer::initializeComplexTypeInfo() +{ + // create type name + XMLCh typeName[128]; + XMLSize_t nsLen = XMLString::stringLen(SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + + XMLString::copyString(typeName, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + typeName[nsLen] = chComma; + XMLString::copyString(typeName + nsLen + 1, SchemaSymbols::fgATTVAL_ANYTYPE); + + // Create and initialize 'anyType' + ComplexTypeInfo::fAnyType = new ComplexTypeInfo(); + + ContentSpecNode* term = new ContentSpecNode + ( + new QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , 1 + ) + , false + ); + term->setType(ContentSpecNode::Any_Lax); + term->setMinOccurs(0); + term->setMaxOccurs(SchemaSymbols::XSD_UNBOUNDED); + + ContentSpecNode* particle = new ContentSpecNode + ( + ContentSpecNode::ModelGroupSequence + , term + , 0 + ); + + SchemaAttDef* attWildCard = new SchemaAttDef + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , 1 + , XMLAttDef::Any_Any + , XMLAttDef::ProcessContents_Lax + ); + + ComplexTypeInfo::fAnyType->setTypeName(typeName); + ComplexTypeInfo::fAnyType->setBaseComplexTypeInfo(ComplexTypeInfo::fAnyType); + ComplexTypeInfo::fAnyType->setDerivedBy(SchemaSymbols::XSD_RESTRICTION); + ComplexTypeInfo::fAnyType->setContentType(SchemaElementDecl::Mixed_Complex); + ComplexTypeInfo::fAnyType->setContentSpec(particle); + ComplexTypeInfo::fAnyType->setAttWildCard(attWildCard); +} + +void XMLInitializer::terminateComplexTypeInfo() +{ + delete ComplexTypeInfo::fAnyType; + ComplexTypeInfo::fAnyType = 0; +} + +ComplexTypeInfo* ComplexTypeInfo::getAnyType(unsigned int /*emptyNSId*/) +{ + return fAnyType; +} + + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +ComplexTypeInfo::ComplexTypeInfo(MemoryManager* const manager) + : fAnonymous(false) + , fAbstract(false) + , fAdoptContentSpec(true) + , fAttWithTypeId(false) + , fPreprocessed(false) + , fDerivedBy(0) + , fBlockSet(0) + , fFinalSet(0) + , fScopeDefined(Grammar::TOP_LEVEL_SCOPE) + , fContentType(SchemaElementDecl::Empty) + , fElementId(XMLElementDecl::fgInvalidElemId) + , fUniqueURI(0) + , fContentSpecOrgURISize(16) + , fTypeName(0) + , fTypeLocalName(0) + , fTypeUri(0) + , fBaseDatatypeValidator(0) + , fDatatypeValidator(0) + , fBaseComplexTypeInfo(0) + , fContentSpec(0) + , fAttWildCard(0) + , fAttList(0) + , fElements(0) + , fAttDefs(0) + , fContentModel(0) + , fFormattedModel(0) + , fContentSpecOrgURI(0) + , fLocator(0) + , fMemoryManager(manager) +{ + fAttDefs = new (fMemoryManager) RefHash2KeysTableOf(29, true, fMemoryManager); + fAttList = new (fMemoryManager) SchemaAttDefList(fAttDefs,fMemoryManager); +} + + +ComplexTypeInfo::~ComplexTypeInfo() +{ + fMemoryManager->deallocate(fTypeName); //delete [] fTypeName; + fMemoryManager->deallocate(fTypeLocalName); //delete [] fTypeLocalName; + fMemoryManager->deallocate(fTypeUri); //delete [] fTypeUri; + + if (fAdoptContentSpec) { + delete fContentSpec; + } + + delete fAttWildCard; + delete fAttDefs; + delete fAttList; + delete fElements; + delete fLocator; + + delete fContentModel; + fMemoryManager->deallocate(fFormattedModel); //delete [] fFormattedModel; + fMemoryManager->deallocate(fContentSpecOrgURI); //delete [] fContentSpecOrgURI; + +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Setter methods +// --------------------------------------------------------------------------- +void ComplexTypeInfo::addAttDef(SchemaAttDef* const toAdd) { + + // Tell this guy the element id of its parent (us) + toAdd->setElemId(getElementId()); + + fAttDefs->put((void*)(toAdd->getAttName()->getLocalPart()), + toAdd->getAttName()->getURI(), toAdd); + // update and/or create fAttList + fAttList->addAttDef(toAdd); +} + +void ComplexTypeInfo::setContentSpec(ContentSpecNode* const toAdopt) { + + if (fContentSpec && fAdoptContentSpec) { + delete fContentSpec; + } + + fContentSpec = toAdopt; +} + +void ComplexTypeInfo::setLocator(XSDLocator* const aLocator) { + + if (fLocator) + delete fLocator; + + fLocator = aLocator; +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Getter methods +// --------------------------------------------------------------------------- +XMLAttDefList& ComplexTypeInfo::getAttDefList() const +{ + // NOTE: if users plan on using nextElement() to access attributes + // they need to call Reset() explicitly (i.e attList.Reset()). + // It's better to get the attribute count and use an index to + // access attributes (especially if same grammar is used in + // multiple threads). + return *fAttList; +} + +const XMLCh* +ComplexTypeInfo::getFormattedContentModel() const +{ + // + // If its not already built, then call the protected virtual method + // to allow the derived class to build it (since only it knows.) + // Otherwise, just return the previously formatted methods. + // + // Since we are faulting this in, within a const getter, we have to + // cast off the const-ness. + // + if (!fFormattedModel) + ((ComplexTypeInfo*)this)->fFormattedModel = formatContentModel(); + + return fFormattedModel; +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Helper methods +// --------------------------------------------------------------------------- +void ComplexTypeInfo::checkUniqueParticleAttribution (SchemaGrammar* const pGrammar, + GrammarResolver* const pGrammarResolver, + XMLStringPool* const pStringPool, + XMLValidator* const pValidator) +{ + if (fContentSpec && !fContentModel) + { + fContentModel = makeContentModel(true); + if (fContentModel) { + fContentModel->checkUniqueParticleAttribution(pGrammar, pGrammarResolver, pStringPool, pValidator, fContentSpecOrgURI, fTypeLocalName); + } + } +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Private Helper methods +// --------------------------------------------------------------------------- +void ComplexTypeInfo::faultInAttDefList() const +{ + // Use a hash modulus of 29 and tell it owns its elements + ((ComplexTypeInfo*)this)->fAttDefs = + new (fMemoryManager) RefHash2KeysTableOf(29, true, fMemoryManager); +} + +XMLCh* ComplexTypeInfo::formatContentModel() const +{ + XMLCh* newValue = 0; + if (fContentType == SchemaElementDecl::Any) + { + newValue = XMLString::replicate(XMLUni::fgAnyString, fMemoryManager); + } + else if (fContentType == SchemaElementDecl::Empty || + fContentType == SchemaElementDecl::ElementOnlyEmpty) + { + newValue = XMLString::replicate(XMLUni::fgEmptyString, fMemoryManager); + } + else + { + // + // Use a temp XML buffer to format into. Content models could be + // pretty long, but very few will be longer than one K. The buffer + // will expand to handle the more pathological ones. + // + const ContentSpecNode* specNode = fContentSpec; + + if (specNode) { + XMLBuffer bufFmt(1023, fMemoryManager); + + specNode->formatSpec(bufFmt); + newValue = XMLString::replicate + ( + bufFmt.getRawBuffer() + , fMemoryManager + ); + } + } + return newValue; +} + +bool ComplexTypeInfo::useRepeatingLeafNodes(ContentSpecNode* particle) +{ + int maxOccurs = particle->getMaxOccurs(); + int minOccurs = particle->getMinOccurs(); + ContentSpecNode::NodeTypes type = particle->getType(); + + if (((type & 0x0f) == ContentSpecNode::Choice) || ((type & 0x0f) == ContentSpecNode::Sequence)) + { + if (minOccurs != 1 || maxOccurs != 1) { + if(particle->getFirst()!=0 && particle->getSecond()==0) + { + ContentSpecNode* particle2 = particle->getFirst(); + ContentSpecNode::NodeTypes type2 = particle2->getType(); + return (((type2 == ContentSpecNode::Leaf) || + ((type2 & 0x0f) == ContentSpecNode::Any) || + ((type2 & 0x0f) == ContentSpecNode::Any_Other) || + ((type2 & 0x0f) == ContentSpecNode::Any_NS)) && + particle2->getMinOccurs() == 1 && + particle2->getMaxOccurs() == 1); + } + return (particle->getFirst()==0 && particle->getSecond()==0); + } + if(particle->getFirst()!=0 && !useRepeatingLeafNodes(particle->getFirst())) + return false; + if(particle->getSecond()!=0 && !useRepeatingLeafNodes(particle->getSecond())) + return false; + } + return true; +} + +XMLContentModel* ComplexTypeInfo::makeContentModel(bool checkUPA) +{ + ContentSpecNode* aSpecNode = new (fMemoryManager) ContentSpecNode(*fContentSpec); + + if (checkUPA) { + fContentSpecOrgURI = (unsigned int*) fMemoryManager->allocate + ( + fContentSpecOrgURISize * sizeof(unsigned int) + ); //new unsigned int[fContentSpecOrgURISize]; + } + + aSpecNode = convertContentSpecTree(aSpecNode, checkUPA, useRepeatingLeafNodes(aSpecNode)); + + Janitor janSpecNode(aSpecNode); + + XMLContentModel* cmRet = 0; + if (fContentType == SchemaElementDecl::Simple || + fContentType == SchemaElementDecl::ElementOnlyEmpty) { + // just return nothing + } + else if (fContentType == SchemaElementDecl::Mixed_Simple) + { + // + // Just create a mixel content model object. This type of + // content model is optimized for mixed content validation. + // + cmRet = new (fMemoryManager) MixedContentModel(false, aSpecNode, false, fMemoryManager); + } + else if (fContentType == SchemaElementDecl::Mixed_Complex || + fContentType == SchemaElementDecl::Children) + { + bool isMixed = (fContentType == SchemaElementDecl::Mixed_Complex); + + // + // This method will create an optimal model for the complexity + // of the element's defined model. If its simple, it will create + // a SimpleContentModel object. If its a simple list, it will + // create a SimpleListContentModel object. If its complex, it + // will create a DFAContentModel object. + // + if(!aSpecNode) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + + ContentSpecNode::NodeTypes specType = aSpecNode->getType(); + // + // Do a sanity check that the node is does not have a PCDATA id. Since, + // if it was, it should have already gotten taken by the Mixed model. + // + if (aSpecNode->getElement() && aSpecNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoPCDATAHere, fMemoryManager); + + // + // According to the type of node, we will create the correct type of + // content model. + // + if (((specType & 0x0f) == ContentSpecNode::Any) || + ((specType & 0x0f) == ContentSpecNode::Any_Other) || + ((specType & 0x0f) == ContentSpecNode::Any_NS) || + specType == ContentSpecNode::Loop) { + // let fall through to build a DFAContentModel + } + else if (isMixed) + { + if (specType == ContentSpecNode::All) { + // All the nodes under an ALL must be additional ALL nodes and + // ELEMENTs (or ELEMENTs under ZERO_OR_ONE nodes.) + // We collapse the ELEMENTs into a single vector. + cmRet = new (fMemoryManager) AllContentModel(aSpecNode, true, fMemoryManager); + } + else if (specType == ContentSpecNode::ZeroOrOne) { + // An ALL node can appear under a ZERO_OR_ONE node. + if (aSpecNode->getFirst()->getType() == ContentSpecNode::All) { + cmRet = new (fMemoryManager) AllContentModel(aSpecNode->getFirst(), true, fMemoryManager); + } + } + + // otherwise, let fall through to build a DFAContentModel + } + else if (specType == ContentSpecNode::Leaf) + { + // Create a simple content model + cmRet = new (fMemoryManager) SimpleContentModel + ( + false + , aSpecNode->getElement() + , 0 + , ContentSpecNode::Leaf + , fMemoryManager + ); + } + else if (((specType & 0x0f) == ContentSpecNode::Choice) + || ((specType & 0x0f) == ContentSpecNode::Sequence)) + { + // + // Lets see if both of the children are leafs. If so, then it has to + // be a simple content model + // + if ((aSpecNode->getFirst()->getType() == ContentSpecNode::Leaf) + && (aSpecNode->getSecond()) + && (aSpecNode->getSecond()->getType() == ContentSpecNode::Leaf)) + { + cmRet = new (fMemoryManager) SimpleContentModel + ( + false + , aSpecNode->getFirst()->getElement() + , aSpecNode->getSecond()->getElement() + , specType + , fMemoryManager + ); + } + } + else if ((specType == ContentSpecNode::OneOrMore) + || (specType == ContentSpecNode::ZeroOrMore) + || (specType == ContentSpecNode::ZeroOrOne)) + { + // + // Its a repetition, so see if its one child is a leaf. If so its a + // repetition of a single element, so we can do a simple content + // model for that. + // + if (aSpecNode->getFirst()->getType() == ContentSpecNode::Leaf) + { + cmRet = new (fMemoryManager) SimpleContentModel + ( + false + , aSpecNode->getFirst()->getElement() + , 0 + , specType + , fMemoryManager + ); + } + else if (aSpecNode->getFirst()->getType() == ContentSpecNode::All) + cmRet = new (fMemoryManager) AllContentModel(aSpecNode->getFirst(), false, fMemoryManager); + + } + else if (specType == ContentSpecNode::All) + cmRet = new (fMemoryManager) AllContentModel(aSpecNode, false, fMemoryManager); + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, fMemoryManager); + } + + // Its not any simple type of content, so create a DFA based content model + if(cmRet==0) + cmRet = new (fMemoryManager) DFAContentModel(false, aSpecNode, isMixed, fMemoryManager); + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_MustBeMixedOrChildren, fMemoryManager); + } + + return cmRet; +} + +// --------------------------------------------------------------------------- +// SchemaElementDecl: Private helper methods +// --------------------------------------------------------------------------- + +ContentSpecNode* +ComplexTypeInfo::convertContentSpecTree(ContentSpecNode* const curNode, + bool checkUPA, + bool bAllowCompactSyntax) { + + if (!curNode) + return 0; + + const ContentSpecNode::NodeTypes curType = curNode->getType(); + + // When checking Unique Particle Attribution, rename leaf elements + if (checkUPA) { + if (curNode->getElement()) { + if (fUniqueURI == fContentSpecOrgURISize) { + resizeContentSpecOrgURI(); + } + + fContentSpecOrgURI[fUniqueURI] = curNode->getElement()->getURI(); + curNode->getElement()->setURI(fUniqueURI); + fUniqueURI++; + } + } + + // Get the spec type of the passed node + int minOccurs = curNode->getMinOccurs(); + int maxOccurs = curNode->getMaxOccurs(); + ContentSpecNode* retNode = curNode; + + if ((curType & 0x0f) == ContentSpecNode::Any + || (curType & 0x0f) == ContentSpecNode::Any_Other + || (curType & 0x0f) == ContentSpecNode::Any_NS + || curType == ContentSpecNode::Leaf) + { + retNode = expandContentModel(curNode, minOccurs, maxOccurs, bAllowCompactSyntax); + } + else if (((curType & 0x0f) == ContentSpecNode::Choice) + || (curType == ContentSpecNode::All) + || ((curType & 0x0f) == ContentSpecNode::Sequence)) + { + ContentSpecNode* childNode = curNode->getFirst(); + ContentSpecNode* leftNode = convertContentSpecTree(childNode, checkUPA, bAllowCompactSyntax); + ContentSpecNode* rightNode = curNode->getSecond(); + + if (!rightNode) { + + retNode = expandContentModel(leftNode, minOccurs, maxOccurs, bAllowCompactSyntax); + curNode->setAdoptFirst(false); + delete curNode; + return retNode; + } + + if (leftNode != childNode) { + + curNode->setAdoptFirst(false); + curNode->setFirst(leftNode); + curNode->setAdoptFirst(true); + } + + childNode = rightNode; + rightNode = convertContentSpecTree(childNode, checkUPA, bAllowCompactSyntax); + + if (rightNode != childNode) { + + curNode->setAdoptSecond(false); + curNode->setSecond(rightNode); + curNode->setAdoptSecond(true); + } + + retNode = expandContentModel(curNode, minOccurs, maxOccurs, bAllowCompactSyntax); + } + + return retNode; +} + +ContentSpecNode* ComplexTypeInfo::expandContentModel(ContentSpecNode* const specNode, + int minOccurs, + int maxOccurs, + bool bAllowCompactSyntax) +{ + if (!specNode) { + return 0; + } + + ContentSpecNode* saveNode = specNode; + ContentSpecNode* retNode = specNode; + + if (minOccurs == 1 && maxOccurs == 1) { + } + else if (minOccurs == 0 && maxOccurs == 1) { + + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrOne + , retNode + , 0 + , true + , true + , fMemoryManager + ); + } + else if (minOccurs == 0 && maxOccurs == -1) { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrMore + , retNode + , 0 + , true + , true + , fMemoryManager + ); + } + else if (minOccurs == 1 && maxOccurs == -1) { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::OneOrMore + , retNode + , 0 + , true + , true + , fMemoryManager + ); + } + // if what is being repeated is a leaf avoid expanding the tree + else if(bAllowCompactSyntax && + (saveNode->getType()==ContentSpecNode::Leaf || + (saveNode->getType() & 0x0f)==ContentSpecNode::Any || + (saveNode->getType() & 0x0f)==ContentSpecNode::Any_Other || + (saveNode->getType() & 0x0f)==ContentSpecNode::Any_NS)) + { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Loop + , retNode + , 0 + , true + , true + , fMemoryManager + ); + retNode->setMinOccurs(minOccurs); + retNode->setMaxOccurs(maxOccurs); + + if(minOccurs==0) + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrMore + , retNode + , 0 + , true + , true + , fMemoryManager + ); + else + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::OneOrMore + , retNode + , 0 + , true + , true + , fMemoryManager + ); + + } + else if (maxOccurs == -1) { + + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::OneOrMore + , retNode + , 0 + , true + , true + , fMemoryManager + ); + + for (int i=0; i < (minOccurs-1); i++) { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , saveNode + , retNode + , false + , true + , fMemoryManager + ); + } + } + else { + + if (minOccurs == 0) { + + ContentSpecNode* optional = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrOne + , saveNode + , 0 + , true + , true + , fMemoryManager + ); + + retNode = optional; + + for (int i=0; i < (maxOccurs-1); i++) { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , retNode + , optional + , true + , false + , fMemoryManager + ); + } + } + else { + + if (minOccurs > 1) { + + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , retNode + , saveNode + , true + , false + , fMemoryManager + ); + + for (int i=1; i < (minOccurs-1); i++) { + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , retNode + , saveNode + , true + , false + , fMemoryManager + ); + } + } + + int counter = maxOccurs-minOccurs; + + if (counter > 0) { + + ContentSpecNode* optional = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::ZeroOrOne + , saveNode + , 0 + , false + , true + , fMemoryManager + ); + + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , retNode + , optional + , true + , true + , fMemoryManager + ); + + for (int j=1; j < counter; j++) { + + retNode = new (fMemoryManager) ContentSpecNode + ( + ContentSpecNode::Sequence + , retNode + , optional + , true + , false + , fMemoryManager + ); + } + } + } + } + + return retNode; +} + +void ComplexTypeInfo::resizeContentSpecOrgURI() { + + unsigned int newSize = fContentSpecOrgURISize * 2; + unsigned int* newContentSpecOrgURI = (unsigned int*) fMemoryManager->allocate + ( + newSize * sizeof(unsigned int) + ); //new unsigned int[newSize]; + + // Copy the existing values + unsigned int index = 0; + for (; index < fContentSpecOrgURISize; index++) + newContentSpecOrgURI[index] = fContentSpecOrgURI[index]; + + for (; index < newSize; index++) + newContentSpecOrgURI[index] = 0; + + // Delete the old array and udpate our members + fMemoryManager->deallocate(fContentSpecOrgURI); //delete [] fContentSpecOrgURI; + fContentSpecOrgURI = newContentSpecOrgURI; + fContentSpecOrgURISize = newSize; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(ComplexTypeInfo) + +void ComplexTypeInfo::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<* fElements; + * Serialize RefHash2KeysTableOf* fAttDefs; + ***/ + XTemplateSerializer::storeObject(fElements, serEng); + XTemplateSerializer::storeObject(fAttDefs, serEng); + + /*** + * Don't serialize + * + * fContentModel; + * fFormattedModel; + * fLocator; + * + * fContentSpecOrgURI: start of the array + * fContentSpecOrgURISize: size of the array + * fUniqueURI: the current last element in the array + ***/ + } + else + { + serEng>>fAnonymous; + serEng>>fAbstract; + serEng>>fAdoptContentSpec; + serEng>>fAttWithTypeId; + serEng>>fPreprocessed; + serEng>>fDerivedBy; + serEng>>fBlockSet; + serEng>>fFinalSet; + serEng>>fScopeDefined; + serEng>>fContentType; + + serEng>>fElementId; + + serEng.readString(fTypeName); + serEng.readString(fTypeLocalName); + serEng.readString(fTypeUri); + + fBaseDatatypeValidator = DatatypeValidator::loadDV(serEng); + fDatatypeValidator = DatatypeValidator::loadDV(serEng); + + serEng>>fBaseComplexTypeInfo; + serEng>>fContentSpec; + serEng>>fAttWildCard; + delete fAttList; // will recreate it next... + serEng>>fAttList; + + /*** + * + * Deserialize RefVectorOf* fElements; + * Deserialize RefHash2KeysTableOf* fAttDefs; + ***/ + XTemplateSerializer::loadObject(&fElements, 8, false, serEng); + delete fAttDefs; // will recreate it next... + XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng); + + /*** + * Don't deserialize + * + * fFormattedModel; + * fLocator; + * + * fContentSpecOrgURI: start of the array + * fContentSpecOrgURISize: size of the array + * fUniqueURI: the current last element in the array + ***/ + + fFormattedModel = 0; + fLocator = 0; + fContentSpecOrgURI = 0; + fContentSpecOrgURISize = 0; + fUniqueURI = 0; + + // Create the content model by calling getContentModel(). This + // will ensure the grammar can be used concurrently by multiple + // parsers. + // Don't bother to do check unique particle attribution, since + // this will already have been done when the grammar was first + // created (if full schema checking was enabled). + getContentModel(false); + } +} + + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ComplexTypeInfo.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.hpp b/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.hpp new file mode 100644 index 000000000..7ed611c9c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/ComplexTypeInfo.hpp @@ -0,0 +1,531 @@ +/* + * 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: ComplexTypeInfo.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_COMPLEXTYPEINFO_HPP) +#define XERCESC_INCLUDE_GUARD_COMPLEXTYPEINFO_HPP + + +/** + * The class act as a place holder to store complex type information. + * + * The class is intended for internal use. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class DatatypeValidator; +class ContentSpecNode; +class SchemaAttDefList; +class SchemaElementDecl; +class XSDLocator; + + +class VALIDATORS_EXPORT ComplexTypeInfo : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors/Destructor + // ----------------------------------------------------------------------- + ComplexTypeInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ComplexTypeInfo(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getAbstract() const; + bool getAdoptContentSpec() const; + bool containsAttWithTypeId() const; + bool getPreprocessed() const; + int getDerivedBy() const; + int getBlockSet() const; + int getFinalSet() const; + unsigned int getScopeDefined() const; + unsigned int getElementId() const; + int getContentType() const; + XMLSize_t elementCount() const; + XMLCh* getTypeName() const; + DatatypeValidator* getBaseDatatypeValidator() const; + DatatypeValidator* getDatatypeValidator() const; + ComplexTypeInfo* getBaseComplexTypeInfo() const; + ContentSpecNode* getContentSpec() const; + const SchemaAttDef* getAttWildCard() const; + SchemaAttDef* getAttWildCard(); + const SchemaAttDef* getAttDef(const XMLCh* const baseName, + const int uriId) const; + SchemaAttDef* getAttDef(const XMLCh* const baseName, + const int uriId); + XMLAttDefList& getAttDefList() const; + const SchemaElementDecl* elementAt(const XMLSize_t index) const; + SchemaElementDecl* elementAt(const XMLSize_t index); + XMLContentModel* getContentModel(const bool checkUPA = false); + const XMLCh* getFormattedContentModel () const; + XSDLocator* getLocator() const; + const XMLCh* getTypeLocalName() const; + const XMLCh* getTypeUri() const; + + /** + * returns true if this type is anonymous + **/ + bool getAnonymous() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setAbstract(const bool isAbstract); + void setAdoptContentSpec(const bool toAdopt); + void setAttWithTypeId(const bool value); + void setPreprocessed(const bool aValue = true); + void setDerivedBy(const int derivedBy); + void setBlockSet(const int blockSet); + void setFinalSet(const int finalSet); + void setScopeDefined(const unsigned int scopeDefined); + void setElementId(const unsigned int elemId); + void setTypeName(const XMLCh* const typeName); + void setContentType(const int contentType); + void setBaseDatatypeValidator(DatatypeValidator* const baseValidator); + void setDatatypeValidator(DatatypeValidator* const validator); + void setBaseComplexTypeInfo(ComplexTypeInfo* const typeInfo); + void setContentSpec(ContentSpecNode* const toAdopt); + void setAttWildCard(SchemaAttDef* const toAdopt); + void addAttDef(SchemaAttDef* const toAdd); + void addElement(SchemaElementDecl* const toAdd); + void setLocator(XSDLocator* const aLocator); + + /** + * sets this type to be anonymous + **/ + void setAnonymous(); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + bool hasAttDefs() const; + bool contains(const XMLCh* const attName); + void checkUniqueParticleAttribution + ( + SchemaGrammar* const pGrammar + , GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool + , XMLValidator* const pValidator + ) ; + + /** + * Return a singleton that represents 'anyType' + * + * @param emptyNSId the uri id of the empty namespace + */ + static ComplexTypeInfo* getAnyType(unsigned int emptyNSId); + + /** + * Notification that lazy data has been deleted + */ + static void reinitAnyType(); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(ComplexTypeInfo) + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ComplexTypeInfo(const ComplexTypeInfo& elemInfo); + ComplexTypeInfo& operator= (const ComplexTypeInfo& other); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void faultInAttDefList() const; + bool useRepeatingLeafNodes(ContentSpecNode* particle); + XMLContentModel* makeContentModel(bool checkUPA = false); + XMLCh* formatContentModel () const ; + ContentSpecNode* expandContentModel(ContentSpecNode* const curNode, int minOccurs, int maxOccurs, bool bAllowCompactSyntax); + ContentSpecNode* convertContentSpecTree(ContentSpecNode* const curNode, bool checkUPA, bool bAllowCompactSyntax); + void resizeContentSpecOrgURI(); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fAnonymous; + bool fAbstract; + bool fAdoptContentSpec; + bool fAttWithTypeId; + bool fPreprocessed; + int fDerivedBy; + int fBlockSet; + int fFinalSet; + unsigned int fScopeDefined; + int fContentType; + + unsigned int fElementId; + unsigned int fUniqueURI; + unsigned int fContentSpecOrgURISize; + + XMLCh* fTypeName; + XMLCh* fTypeLocalName; + XMLCh* fTypeUri; + DatatypeValidator* fBaseDatatypeValidator; + DatatypeValidator* fDatatypeValidator; + ComplexTypeInfo* fBaseComplexTypeInfo; + ContentSpecNode* fContentSpec; + SchemaAttDef* fAttWildCard; + SchemaAttDefList* fAttList; + RefVectorOf* fElements; + RefHash2KeysTableOf* fAttDefs; + XMLContentModel* fContentModel; + XMLCh* fFormattedModel; + unsigned int* fContentSpecOrgURI; + XSDLocator* fLocator; + MemoryManager* fMemoryManager; + + static ComplexTypeInfo* fAnyType; + + friend class XMLInitializer; +}; + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Getter methods +// --------------------------------------------------------------------------- +inline bool ComplexTypeInfo::getAbstract() const { + + return fAbstract; +} + +inline bool ComplexTypeInfo::getAdoptContentSpec() const { + + return fAdoptContentSpec; +} + +inline bool ComplexTypeInfo::containsAttWithTypeId() const { + + return fAttWithTypeId; +} + +inline bool ComplexTypeInfo::getPreprocessed() const { + + return fPreprocessed; +} + +inline int ComplexTypeInfo::getDerivedBy() const { + + return fDerivedBy; +} + +inline int ComplexTypeInfo::getBlockSet() const { + + return fBlockSet; +} + +inline int ComplexTypeInfo::getFinalSet() const { + + return fFinalSet; +} + +inline unsigned int ComplexTypeInfo::getScopeDefined() const { + + return fScopeDefined; +} + +inline unsigned int ComplexTypeInfo::getElementId() const { + + return fElementId; +} + +inline int ComplexTypeInfo::getContentType() const { + + return fContentType; +} + +inline XMLSize_t ComplexTypeInfo::elementCount() const { + + if (fElements) { + return fElements->size(); + } + + return 0; +} + +inline XMLCh* ComplexTypeInfo::getTypeName() const { + return fTypeName; +} + +inline DatatypeValidator* ComplexTypeInfo::getBaseDatatypeValidator() const { + + return fBaseDatatypeValidator; +} + +inline DatatypeValidator* ComplexTypeInfo::getDatatypeValidator() const { + + return fDatatypeValidator; +} + +inline ComplexTypeInfo* ComplexTypeInfo::getBaseComplexTypeInfo() const { + + return fBaseComplexTypeInfo; +} + +inline ContentSpecNode* ComplexTypeInfo::getContentSpec() const { + + return fContentSpec; +} + +inline const SchemaAttDef* ComplexTypeInfo::getAttWildCard() const { + + return fAttWildCard; +} + +inline SchemaAttDef* ComplexTypeInfo::getAttWildCard() { + + return fAttWildCard; +} + +inline const SchemaAttDef* ComplexTypeInfo::getAttDef(const XMLCh* const baseName, + const int uriId) const { + + return fAttDefs->get(baseName, uriId); +} + +inline SchemaAttDef* ComplexTypeInfo::getAttDef(const XMLCh* const baseName, + const int uriId) +{ + return fAttDefs->get(baseName, uriId); +} + +inline SchemaElementDecl* +ComplexTypeInfo::elementAt(const XMLSize_t index) { + + if (!fElements) { + return 0; // REVISIT - need to throw an exception + } + + return fElements->elementAt(index); +} + +inline const SchemaElementDecl* +ComplexTypeInfo::elementAt(const XMLSize_t index) const { + + if (!fElements) { + return 0; // REVISIT - need to throw an exception + } + + return fElements->elementAt(index); +} + +inline XMLContentModel* ComplexTypeInfo::getContentModel(const bool checkUPA) +{ + if (!fContentModel && fContentSpec) + fContentModel = makeContentModel(checkUPA); + + return fContentModel; +} + +inline XSDLocator* ComplexTypeInfo::getLocator() const +{ + return fLocator; +} + +inline bool ComplexTypeInfo::getAnonymous() const { + return fAnonymous; +} + +inline const XMLCh* ComplexTypeInfo::getTypeLocalName() const +{ + return fTypeLocalName; +} + +inline const XMLCh* ComplexTypeInfo::getTypeUri() const +{ + return fTypeUri; +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Setter methods +// --------------------------------------------------------------------------- +inline void ComplexTypeInfo::setAbstract(const bool isAbstract) { + + fAbstract = isAbstract; +} + +inline void ComplexTypeInfo::setAdoptContentSpec(const bool toAdopt) { + + fAdoptContentSpec = toAdopt; +} + +inline void ComplexTypeInfo::setAttWithTypeId(const bool value) { + + fAttWithTypeId = value; +} + +inline void ComplexTypeInfo::setPreprocessed(const bool aValue) { + + fPreprocessed = aValue; +} + +inline void ComplexTypeInfo::setDerivedBy(const int derivedBy) { + + fDerivedBy = derivedBy; +} + +inline void ComplexTypeInfo::setBlockSet(const int blockSet) { + + fBlockSet = blockSet; +} + +inline void ComplexTypeInfo::setFinalSet(const int finalSet) { + + fFinalSet = finalSet; +} + +inline void ComplexTypeInfo::setScopeDefined(const unsigned int scopeDefined) { + + fScopeDefined = scopeDefined; +} + +inline void ComplexTypeInfo::setElementId(const unsigned int elemId) { + + fElementId = elemId; +} + +inline void +ComplexTypeInfo::setContentType(const int contentType) { + + fContentType = contentType; +} + +inline void ComplexTypeInfo::setTypeName(const XMLCh* const typeName) { + + fMemoryManager->deallocate(fTypeName);//delete [] fTypeName; + fMemoryManager->deallocate(fTypeLocalName);//delete [] fTypeLocalName; + fMemoryManager->deallocate(fTypeUri);//delete [] fTypeUri; + + if (typeName) + { + fTypeName = XMLString::replicate(typeName, fMemoryManager); + + int index = XMLString::indexOf(fTypeName, chComma); + XMLSize_t length = XMLString::stringLen(fTypeName); + fTypeLocalName = (XMLCh*) fMemoryManager->allocate + ( + (length - index + 1) * sizeof(XMLCh) + ); //new XMLCh[length - index + 1]; + XMLString::subString(fTypeLocalName, fTypeName, index + 1, length, fMemoryManager); + + fTypeUri = (XMLCh*) fMemoryManager->allocate + ( + (index + 1) * sizeof(XMLCh) + ); //new XMLCh[index + 1]; + XMLString::subString(fTypeUri, fTypeName, 0, index, fMemoryManager); + } + else + { + fTypeName = fTypeLocalName = fTypeUri = 0; + } +} + +inline void +ComplexTypeInfo::setBaseDatatypeValidator(DatatypeValidator* const validator) { + + fBaseDatatypeValidator = validator; +} + +inline void +ComplexTypeInfo::setDatatypeValidator(DatatypeValidator* const validator) { + + fDatatypeValidator = validator; +} + +inline void +ComplexTypeInfo::setBaseComplexTypeInfo(ComplexTypeInfo* const typeInfo) { + + fBaseComplexTypeInfo = typeInfo; +} + +inline void ComplexTypeInfo::addElement(SchemaElementDecl* const elem) { + + if (!fElements) { + fElements = new (fMemoryManager) RefVectorOf(8, false, fMemoryManager); + } + else if (fElements->containsElement(elem)) { + return; + } + + fElements->addElement(elem); +} + +inline void ComplexTypeInfo::setAttWildCard(SchemaAttDef* const toAdopt) { + + if (fAttWildCard) { + delete fAttWildCard; + } + + fAttWildCard = toAdopt; +} + +inline void ComplexTypeInfo::setAnonymous() { + fAnonymous = true; +} + +// --------------------------------------------------------------------------- +// ComplexTypeInfo: Helper methods +// --------------------------------------------------------------------------- +inline bool ComplexTypeInfo::hasAttDefs() const +{ + return !fAttDefs->isEmpty(); +} + +inline bool ComplexTypeInfo::contains(const XMLCh* const attName) { + + RefHash2KeysTableOfEnumerator enumDefs(fAttDefs, false, fMemoryManager); + + while (enumDefs.hasMoreElements()) { + + if (XMLString::equals(attName, enumDefs.nextElement().getAttName()->getLocalPart())) { + return true; + } + } + + return false; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ComplexTypeInfo.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.cpp b/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.cpp new file mode 100644 index 000000000..657526f2a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.cpp @@ -0,0 +1,798 @@ +/* + * 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. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local const data +// --------------------------------------------------------------------------- +static const XMLCh fgValueZero[] = +{ + chDigit_0, chNull +}; + +static const XMLCh fgValueOne[] = +{ + chDigit_1, chNull +}; + +static const XMLCh fgUnbounded[] = +{ + chLatin_u, chLatin_n, chLatin_b, chLatin_o, chLatin_u, chLatin_n, chLatin_d, + chLatin_e, chLatin_d, chNull +}; + +// --------------------------------------------------------------------------- +// Static member data initialization +// --------------------------------------------------------------------------- +ValueHashTableOf* GeneralAttributeCheck::fAttMap = 0; +ValueHashTableOf* GeneralAttributeCheck::fFacetsMap = 0; +DatatypeValidator* GeneralAttributeCheck::fNonNegIntDV = 0; +DatatypeValidator* GeneralAttributeCheck::fBooleanDV = 0; +DatatypeValidator* GeneralAttributeCheck::fAnyURIDV = 0; + +void XMLInitializer::initializeGeneralAttributeCheck() +{ + GeneralAttributeCheck::initialize (); +} + +void XMLInitializer::terminateGeneralAttributeCheck() +{ + delete GeneralAttributeCheck::fFacetsMap; + delete GeneralAttributeCheck::fAttMap; + + GeneralAttributeCheck::fAttMap = 0; + GeneralAttributeCheck::fFacetsMap = 0; + + GeneralAttributeCheck::fNonNegIntDV = 0; + GeneralAttributeCheck::fBooleanDV = 0; + GeneralAttributeCheck::fAnyURIDV = 0; +} + +void GeneralAttributeCheck::initialize() +{ + // Set up validators. + // + DatatypeValidatorFactory dvFactory; + + fNonNegIntDV = dvFactory.getDatatypeValidator(SchemaSymbols::fgDT_NONNEGATIVEINTEGER); + fBooleanDV = dvFactory.getDatatypeValidator(SchemaSymbols::fgDT_BOOLEAN); + fAnyURIDV = dvFactory.getDatatypeValidator(SchemaSymbols::fgDT_ANYURI); + + // TODO - add remaining valdiators + + // Map attributes. + // + fAttMap = new ValueHashTableOf(A_Count); + + fAttMap->put((void*)SchemaSymbols::fgATT_ABSTRACT, A_Abstract); + fAttMap->put((void*)SchemaSymbols::fgATT_ATTRIBUTEFORMDEFAULT, A_AttributeFormDefault); + fAttMap->put((void*)SchemaSymbols::fgATT_BASE, A_Base); + fAttMap->put((void*)SchemaSymbols::fgATT_BLOCK, A_Block); + fAttMap->put((void*)SchemaSymbols::fgATT_BLOCKDEFAULT, A_BlockDefault); + fAttMap->put((void*)SchemaSymbols::fgATT_DEFAULT, A_Default); + fAttMap->put((void*)SchemaSymbols::fgATT_ELEMENTFORMDEFAULT, A_ElementFormDefault); + fAttMap->put((void*)SchemaSymbols::fgATT_FINAL, A_Final); + fAttMap->put((void*)SchemaSymbols::fgATT_FINALDEFAULT, A_FinalDefault); + fAttMap->put((void*)SchemaSymbols::fgATT_FIXED, A_Fixed); + fAttMap->put((void*)SchemaSymbols::fgATT_FORM, A_Form); + fAttMap->put((void*)SchemaSymbols::fgATT_ID, A_ID); + fAttMap->put((void*)SchemaSymbols::fgATT_ITEMTYPE, A_ItemType); + fAttMap->put((void*)SchemaSymbols::fgATT_MAXOCCURS, A_MaxOccurs); + fAttMap->put((void*)SchemaSymbols::fgATT_MEMBERTYPES, A_MemberTypes); + fAttMap->put((void*)SchemaSymbols::fgATT_MINOCCURS, A_MinOccurs); + fAttMap->put((void*)SchemaSymbols::fgATT_MIXED, A_Mixed); + fAttMap->put((void*)SchemaSymbols::fgATT_NAME, A_Name); + fAttMap->put((void*)SchemaSymbols::fgATT_NAMESPACE, A_Namespace); + fAttMap->put((void*)SchemaSymbols::fgATT_NILLABLE, A_Nillable); + fAttMap->put((void*)SchemaSymbols::fgATT_PROCESSCONTENTS, A_ProcessContents); + fAttMap->put((void*)SchemaSymbols::fgATT_PUBLIC, A_Public); + fAttMap->put((void*)SchemaSymbols::fgATT_REF, A_Ref); + fAttMap->put((void*)SchemaSymbols::fgATT_REFER, A_Refer); + fAttMap->put((void*)SchemaSymbols::fgATT_SCHEMALOCATION, A_SchemaLocation); + fAttMap->put((void*)SchemaSymbols::fgATT_SOURCE, A_Source); + fAttMap->put((void*)SchemaSymbols::fgATT_SUBSTITUTIONGROUP, A_SubstitutionGroup); + fAttMap->put((void*)SchemaSymbols::fgATT_SYSTEM, A_System); + fAttMap->put((void*)SchemaSymbols::fgATT_TARGETNAMESPACE, A_TargetNamespace); + fAttMap->put((void*)SchemaSymbols::fgATT_TYPE, A_Type); + fAttMap->put((void*)SchemaSymbols::fgATT_USE, A_Use); + fAttMap->put((void*)SchemaSymbols::fgATT_VALUE, A_Value); + fAttMap->put((void*)SchemaSymbols::fgATT_VERSION, A_Version); + fAttMap->put((void*)SchemaSymbols::fgATT_XPATH, A_XPath); + + fFacetsMap = new ValueHashTableOf(13); + + fFacetsMap->put((void*) SchemaSymbols::fgELT_MINEXCLUSIVE, E_MinExclusive); + fFacetsMap->put((void*) SchemaSymbols::fgELT_MININCLUSIVE, E_MinInclusive); + fFacetsMap->put((void*) SchemaSymbols::fgELT_MAXEXCLUSIVE, E_MaxExclusive); + fFacetsMap->put((void*) SchemaSymbols::fgELT_MAXINCLUSIVE, E_MaxInclusive); + fFacetsMap->put((void*) SchemaSymbols::fgELT_TOTALDIGITS, E_TotalDigits); + fFacetsMap->put((void*) SchemaSymbols::fgELT_FRACTIONDIGITS, E_FractionDigits); + fFacetsMap->put((void*) SchemaSymbols::fgELT_LENGTH, E_Length); + fFacetsMap->put((void*) SchemaSymbols::fgELT_MINLENGTH, E_MinLength); + fFacetsMap->put((void*) SchemaSymbols::fgELT_MAXLENGTH, E_MaxLength); + fFacetsMap->put((void*) SchemaSymbols::fgELT_ENUMERATION, E_Enumeration); + fFacetsMap->put((void*) SchemaSymbols::fgELT_WHITESPACE, E_WhiteSpace); + fFacetsMap->put((void*) SchemaSymbols::fgELT_PATTERN, E_Pattern); +} + +// --------------------------------------------------------------------------- +// GeneralAttributeCheck: Constructors and Destructor +// --------------------------------------------------------------------------- +GeneralAttributeCheck::GeneralAttributeCheck(MemoryManager* const manager) + : fMemoryManager(manager) + , fIDValidator(manager) +{ +} + +GeneralAttributeCheck::~GeneralAttributeCheck() +{ +} + +// --------------------------------------------------------------------------- +// GeneralAttributeCheck: Validation methods +// --------------------------------------------------------------------------- +void +GeneralAttributeCheck::checkAttributes(const DOMElement* const elem, + const unsigned short elemContext, + TraverseSchema* const schema, + const bool isTopLevel, + ValueVectorOf* const nonXSAttList) +{ + if (nonXSAttList) + nonXSAttList->removeAllElements(); + + if (elem == 0 || !fAttMap || elemContext>=E_Count) + return; + + const XMLCh* elemName = elem->getLocalName(); + if (!XMLString::equals(SchemaSymbols::fgURI_SCHEMAFORSCHEMA, elem->getNamespaceURI())) { + schema->reportSchemaError + ( + elem + , XMLUni::fgXMLErrDomain + , XMLErrs::ELTSchemaNS + , elemName + ); + } + + DOMNamedNodeMap* eltAttrs = elem->getAttributes(); + const XMLSize_t attrCount = eltAttrs->getLength(); + XMLByte attList[A_Count]; + + memset(attList, 0, sizeof(attList)); + + for (XMLSize_t i = 0; i < attrCount; i++) { + + DOMNode* attribute = eltAttrs->item(i); + const XMLCh* attName = attribute->getNodeName(); + + // skip namespace declarations + if (XMLString::equals(attName, XMLUni::fgXMLNSString) + || XMLString::startsWith(attName, XMLUni::fgXMLNSColonString)) + continue; + + // Bypass attributes that start with xml + // add this to the list of "non-schema" attributes + if ((*attName == chLatin_X || *attName == chLatin_x) + && (*(attName+1) == chLatin_M || *(attName+1) == chLatin_m) + && (*(attName+2) == chLatin_L || *(attName+2) == chLatin_l)) { + + if (nonXSAttList) + nonXSAttList->addElement(attribute); + + continue; + } + + // for attributes with namespace prefix + const XMLCh* attrURI = attribute->getNamespaceURI(); + + if (attrURI != 0 && *attrURI) { + + // attributes with schema namespace are not allowed + // and not allowed on "documentation" and "appInfo" + if (XMLString::equals(attrURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) || + XMLString::equals(elemName, SchemaSymbols::fgELT_APPINFO) || + XMLString::equals(elemName, SchemaSymbols::fgELT_DOCUMENTATION)) { + + schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, + isTopLevel?XMLErrs::AttributeDisallowedGlobal:XMLErrs::AttributeDisallowedLocal, + attName, elemName); + } + else if (nonXSAttList) + { + nonXSAttList->addElement(attribute); + } + + continue; + } + + int attNameId = A_Invalid; + attName = attribute->getLocalName(); + + bool bContinue=false; // workaround for Borland bug with 'continue' in 'catch' + try { + attNameId= fAttMap->get(attName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + + schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, + isTopLevel?XMLErrs::AttributeDisallowedGlobal:XMLErrs::AttributeDisallowedLocal, + attName, elemName); + bContinue=true; + } + if(bContinue) + continue; + + if (fgElemAttTable[elemContext][attNameId] & Att_Mask) { + + attList[attNameId] = 1; + validate + ( + elem + , attName + , attribute->getNodeValue() + , fgElemAttTable[elemContext][attNameId] & DV_Mask + , schema + ); + } + else { + schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, + isTopLevel?XMLErrs::AttributeDisallowedGlobal:XMLErrs::AttributeDisallowedLocal, + attName, elemName); + } + } + + // ------------------------------------------------------------------ + // Check for required attributes + // ------------------------------------------------------------------ + for (unsigned int j=0; j < A_Count; j++) { + + if ((fgElemAttTable[elemContext][j] & Att_Required) && attList[j] == 0) { + schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, + isTopLevel?XMLErrs::AttributeRequiredGlobal:XMLErrs::AttributeRequiredLocal, + fAttNames[j], elemName); + } + } +} + + +void GeneralAttributeCheck::validate(const DOMElement* const elem, + const XMLCh* const attName, + const XMLCh* const attValue, + const short dvIndex, + TraverseSchema* const schema) +{ + bool isInvalid = false; + DatatypeValidator* dv = 0; + + ValidationContext* fValidationContext = schema->fSchemaInfo->getValidationContext(); + switch (dvIndex) { + case DV_Form: + if (!XMLString::equals(attValue, SchemaSymbols::fgATTVAL_QUALIFIED) + && !XMLString::equals(attValue, SchemaSymbols::fgATTVAL_UNQUALIFIED)) { + isInvalid = true; + } + break; + case DV_MaxOccurs: + // maxOccurs = (nonNegativeInteger | unbounded) + if (!XMLString::equals(attValue, fgUnbounded)) { + dv = fNonNegIntDV; + } + break; + case DV_MaxOccurs1: + if (!XMLString::equals(attValue, fgValueOne)) { + isInvalid = true; + } + break; + case DV_MinOccurs1: + if (!XMLString::equals(attValue, fgValueZero) + && !XMLString::equals(attValue, fgValueOne)) { + isInvalid = true; + } + break; + case DV_ProcessContents: + if (!XMLString::equals(attValue, SchemaSymbols::fgATTVAL_SKIP) + && !XMLString::equals(attValue, SchemaSymbols::fgATTVAL_LAX) + && !XMLString::equals(attValue, SchemaSymbols::fgATTVAL_STRICT)) { + isInvalid = true; + } + break; + case DV_Use: + if (!XMLString::equals(attValue, SchemaSymbols::fgATTVAL_OPTIONAL) + && !XMLString::equals(attValue, SchemaSymbols::fgATTVAL_PROHIBITED) + && !XMLString::equals(attValue, SchemaSymbols::fgATTVAL_REQUIRED)) { + isInvalid = true; + } + break; + case DV_WhiteSpace: + if (!XMLString::equals(attValue, SchemaSymbols::fgWS_PRESERVE) + && !XMLString::equals(attValue, SchemaSymbols::fgWS_REPLACE) + && !XMLString::equals(attValue, SchemaSymbols::fgWS_COLLAPSE)) { + isInvalid = true; + } + break; + case DV_Boolean: + dv = fBooleanDV; + break; + case DV_NonNegInt: + dv = fNonNegIntDV; + break; + case DV_AnyURI: + dv = fAnyURIDV; + break; + case DV_ID: + if (fValidationContext) + { + dv = &fIDValidator; + } + break; + } + + if (dv) { + try { + dv->validate(attValue, fValidationContext, fMemoryManager); + } + catch(const XMLException& excep) { + schema->reportSchemaError(elem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + isInvalid = true; + } + } + + if (isInvalid) { + schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidAttValue, + attValue, attName); + } +} + + +// --------------------------------------------------------------------------- +// Conditional methods for building the table +// --------------------------------------------------------------------------- + +// +// This code will set up the character flags table. Its defined out since +// this table is now written out and hard coded (at the bottom of this +// file) into the code itself. This code is retained in case there is +// any need to recreate it later. +// + +#if defined(NEED_TO_GEN_ELEM_ATT_MAP_TABLE) + +#include + +void GeneralAttributeCheck::initCharFlagTable() +{ + unsigned short attList[E_Count][A_Count]; + + for (unsigned int i=0; i < E_Count; i++) { + for (unsigned int j=0; j < A_Count; j++) { + attList[i][j] = 0; + } + } + + // + // Write it out to a temp file to be read back into this source later. + // + FILE* outFl = fopen("ea_table.out", "wt+"); + fprintf(outFl, "unsigned short GeneralAttributeCheck::fgElemAttTable[GeneralAttributeCheck::E_Count][GeneralAttributeCheck::A_Count] =\n{\n {"); + + //"all" + attList[E_All][A_ID] = Att_Optional | DV_ID; + attList[E_All][A_MaxOccurs] = Att_Optional | DV_MaxOccurs1; + attList[E_All][A_MinOccurs] = Att_Optional | DV_MinOccurs1; + + // "annotation" + attList[E_Annotation][A_ID] = Att_Optional | DV_ID; + + // "any" + attList[E_Any][A_ID] = Att_Optional | DV_ID; + attList[E_Any][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_Any][A_MinOccurs] = Att_Optional | DV_NonNegInt; + attList[E_Any][A_Namespace] = Att_Optional; + attList[E_Any][A_ProcessContents] = Att_Optional | DV_ProcessContents; + + // "anyAttribute" + attList[E_AnyAttribute][A_ID] = Att_Optional | DV_ID; + attList[E_AnyAttribute][A_Namespace] = Att_Optional; + attList[E_AnyAttribute][A_ProcessContents] = Att_Optional | DV_ProcessContents; + + // "appinfo" + attList[E_Appinfo][A_Source]= Att_Optional | DV_AnyURI; + + // attribute - global" + attList[E_AttributeGlobal][A_Default] = Att_Optional; + attList[E_AttributeGlobal][A_Fixed] = Att_Optional; + attList[E_AttributeGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_AttributeGlobal][A_Name] = Att_Required; + attList[E_AttributeGlobal][A_Type] = Att_Optional; + + // "attribute - local" + attList[E_AttributeLocal][A_Default] = Att_Optional; + attList[E_AttributeLocal][A_Fixed] = Att_Optional; + attList[E_AttributeLocal][A_Form]= Att_Optional | DV_Form; + attList[E_AttributeLocal][A_ID] = Att_Optional | DV_ID; + attList[E_AttributeLocal][A_Name] = Att_Required; + attList[E_AttributeLocal][A_Type] = Att_Optional; + attList[E_AttributeLocal][A_Use] = Att_Optional | DV_Use; + + // "attribute - ref" + attList[E_AttributeRef][A_Default] = Att_Optional; + attList[E_AttributeRef][A_Fixed] = Att_Optional; + attList[E_AttributeRef][A_ID] = Att_Optional | DV_ID; + attList[E_AttributeRef][A_Ref]= Att_Required; + attList[E_AttributeRef][A_Use] = Att_Optional | DV_Use; + + // "attributeGroup - global" + attList[E_AttributeGroupGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_AttributeGroupGlobal][A_Name] = Att_Required; + + // "attributeGroup - ref" + attList[E_AttributeGroupRef][A_ID] = Att_Optional | DV_ID; + attList[E_AttributeGroupRef][A_Ref]= Att_Required; + + // "choice" + attList[E_Choice][A_ID] = Att_Optional | DV_ID; + attList[E_Choice][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_Choice][A_MinOccurs] = Att_Optional | DV_NonNegInt; + + // "complexContent" + attList[E_ComplexContent][A_ID] = Att_Optional | DV_ID; + attList[E_ComplexContent][A_Mixed] = Att_Optional | DV_Boolean; + + // "complexType - global" + attList[E_ComplexTypeGlobal][A_Abstract] = Att_Optional | DV_Boolean; + attList[E_ComplexTypeGlobal][A_Block] = Att_Optional; + attList[E_ComplexTypeGlobal][A_Final] = Att_Optional; + attList[E_ComplexTypeGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_ComplexTypeGlobal][A_Mixed] = Att_Optional | DV_Boolean; + attList[E_ComplexTypeGlobal][A_Name] = Att_Required; + + // "complexType - local" + attList[E_ComplexTypeLocal][A_ID] = Att_Optional | DV_ID; + attList[E_ComplexTypeLocal][A_Mixed] = Att_Optional | DV_Boolean; + + // "documentation" + attList[E_Documentation][A_Source] = Att_Optional | DV_AnyURI; + + // "element - global" + attList[E_ElementGlobal][A_Abstract] = Att_Optional | DV_Boolean; + attList[E_ElementGlobal][A_Block] = Att_Optional; + attList[E_ElementGlobal][A_Default] = Att_Optional; + attList[E_ElementGlobal][A_Final] = Att_Optional; + attList[E_ElementGlobal][A_Fixed] = Att_Optional; + attList[E_ElementGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_ElementGlobal][A_Name] = Att_Required; + attList[E_ElementGlobal][A_Nillable] = Att_Optional | DV_Boolean; + attList[E_ElementGlobal][A_SubstitutionGroup] = Att_Optional; + attList[E_ElementGlobal][A_Type] = Att_Optional; + + // "element - local" + attList[E_ElementLocal][A_Block]= Att_Optional; + attList[E_ElementLocal][A_Default] = Att_Optional; + attList[E_ElementLocal][A_Fixed] = Att_Optional; + attList[E_ElementLocal][A_Form] = Att_Optional | DV_Form; + attList[E_ElementLocal][A_ID] = Att_Optional | DV_ID; + attList[E_ElementLocal][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_ElementLocal][A_MinOccurs] = Att_Optional | DV_NonNegInt; + attList[E_ElementLocal][A_Name] = Att_Required; + attList[E_ElementLocal][A_Nillable] = Att_Optional | DV_Boolean; + attList[E_ElementLocal][A_Type] = Att_Optional; + + //"element - ref" + attList[E_ElementRef][A_ID] = Att_Optional | DV_ID; + attList[E_ElementRef][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_ElementRef][A_MinOccurs] = Att_Optional | DV_NonNegInt; + attList[E_ElementRef][A_Ref] = Att_Required; + + // "enumeration" + attList[E_Enumeration][A_ID] = Att_Optional | DV_ID; + attList[E_Enumeration][A_Value] = Att_Optional; + + // "extension" + attList[E_Extension][A_Base] = Att_Required; + attList[E_Extension][A_ID] = Att_Optional | DV_ID; + + //"field" + attList[E_Field][A_ID] = Att_Optional | DV_ID; + attList[E_Field][A_XPath] = Att_Required; + + // "fractionDigits" + attList[E_FractionDigits][A_ID] = Att_Optional | DV_ID; + attList[E_FractionDigits][A_Value] = Att_Optional | DV_NonNegInt; + attList[E_FractionDigits][A_Fixed] = Att_Optional | DV_Boolean; + + // "group - global" + attList[E_GroupGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_GroupGlobal][A_Name] = Att_Required; + + // "group - ref" + attList[E_GroupRef][A_ID] = Att_Optional | DV_ID; + attList[E_GroupRef][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_GroupRef][A_MinOccurs] = Att_Optional | DV_NonNegInt; + attList[E_GroupRef][A_Ref] = Att_Required; + + // "import" + attList[E_Import][A_ID] = Att_Optional | DV_ID; + attList[E_Import][A_Namespace] = Att_Optional; + attList[E_Import][A_SchemaLocation] = Att_Optional; + + // "include" + attList[E_Include][A_ID] = Att_Optional | DV_ID; + attList[E_Include][A_SchemaLocation] = Att_Required; + + // "key" + attList[E_Key][A_ID] = Att_Optional | DV_ID; + attList[E_Key][A_Name] = Att_Required; + + // "keyref" + attList[E_KeyRef][A_ID] = Att_Optional | DV_ID; + attList[E_KeyRef][A_Name] = Att_Required; + attList[E_KeyRef][A_Refer] = Att_Required; + + // "length" + attList[E_Length][A_ID] = Att_Optional | DV_ID; + attList[E_Length][A_Value] = Att_Optional | DV_NonNegInt; + attList[E_Length][A_Fixed] = Att_Optional | DV_Boolean; + + // "list" + attList[E_List][A_ID] = Att_Optional | DV_ID; + attList[E_List][A_ItemType] = Att_Optional; + + // "maxExclusive" + attList[E_MaxExclusive][A_ID] = Att_Optional | DV_ID; + attList[E_MaxExclusive][A_Value] = Att_Optional; + attList[E_MaxExclusive][A_Fixed] = Att_Optional | DV_Boolean; + + // "maxInclusive" + attList[E_MaxInclusive][A_ID] = Att_Optional | DV_ID; + attList[E_MaxInclusive][A_Value] = Att_Optional; + attList[E_MaxInclusive][A_Fixed] = Att_Optional | DV_Boolean; + + // "maxLength" + attList[E_MaxLength][A_ID] = Att_Optional | DV_ID; + attList[E_MaxLength][A_Value] = Att_Optional | DV_NonNegInt; + attList[E_MaxLength][A_Fixed] = Att_Optional | DV_Boolean; + + // "minExclusive" + attList[E_MinExclusive][A_ID] = Att_Optional | DV_ID; + attList[E_MinExclusive][A_Value] = Att_Optional; + attList[E_MinExclusive][A_Fixed] = Att_Optional | DV_Boolean; + + // "minInclusive" + attList[E_MinInclusive][A_ID] = Att_Optional | DV_ID; + attList[E_MinInclusive][A_Value] = Att_Optional; + attList[E_MinInclusive][A_Fixed] = Att_Optional | DV_Boolean; + + // "minLength" + attList[E_MinLength][A_ID] = Att_Optional | DV_ID; + attList[E_MinLength][A_Value] = Att_Optional | DV_NonNegInt; + attList[E_MinLength][A_Fixed] = Att_Optional | DV_Boolean; + + // "notation" + attList[E_Notation][A_ID] = Att_Optional | DV_ID; + attList[E_Notation][A_Name] = Att_Required; + attList[E_Notation][A_Public] = Att_Optional; + attList[E_Notation][A_System] = Att_Optional | DV_AnyURI; + + // "pattern" + attList[E_Pattern][A_ID] = Att_Optional; + attList[E_Pattern][A_Value] = Att_Optional; + + // "redefine" + attList[E_Redefine][A_ID] = Att_Optional | DV_ID; + attList[E_Redefine][A_SchemaLocation] = Att_Required; + + // "restriction" + attList[E_Restriction][A_Base] = Att_Optional; + attList[E_Restriction][A_ID] = Att_Optional | DV_ID; + + // "schema" + attList[E_Schema][A_AttributeFormDefault] = Att_Optional | DV_Form; + attList[E_Schema][A_BlockDefault] = Att_Optional; + attList[E_Schema][A_ElementFormDefault] = Att_Optional | DV_Form; + attList[E_Schema][A_FinalDefault] = Att_Optional; + attList[E_Schema][A_ID] = Att_Optional | DV_ID; + attList[E_Schema][A_TargetNamespace] = Att_Optional; + attList[E_Schema][A_Version] = Att_Optional; + + // "selector" + attList[E_Selector][A_ID] = Att_Optional | DV_ID; + attList[E_Selector][A_XPath] = Att_Required; + + // "sequence" + attList[E_Sequence][A_ID] = Att_Optional | DV_ID; + attList[E_Sequence][A_MaxOccurs] = Att_Optional | DV_MaxOccurs; + attList[E_Sequence][A_MinOccurs] = Att_Optional | DV_NonNegInt; + + // "simpleContent" + attList[E_SimpleContent][A_ID] = Att_Optional | DV_ID; + + // "simpleType - global" + attList[E_SimpleTypeGlobal][A_Final] = Att_Optional; + attList[E_SimpleTypeGlobal][A_ID] = Att_Optional | DV_ID; + attList[E_SimpleTypeGlobal][A_Name] = Att_Required; + + // "simpleType - local" + attList[E_SimpleTypeLocal][A_Final] = Att_Optional; + attList[E_SimpleTypeLocal][A_ID] = Att_Optional | DV_ID; + + // "totalDigits" + attList[E_TotalDigits][A_ID] = Att_Optional | DV_ID; + attList[E_TotalDigits][A_Value] = Att_Optional | DV_NonNegInt; + attList[E_TotalDigits][A_Fixed] = Att_Optional | DV_Boolean; + + // "union" + attList[E_Union][A_ID] = Att_Optional | DV_ID; + attList[E_Union][A_MemberTypes] = Att_Optional; + + // "unique" + attList[E_Unique][A_ID] = Att_Optional | DV_ID; + attList[E_Unique][A_Name] = Att_Required; + + // "whitespace" + attList[E_WhiteSpace][A_ID] = Att_Optional | DV_ID; + attList[E_WhiteSpace][A_Value] = Att_Optional | DV_WhiteSpace; + attList[E_WhiteSpace][A_Fixed] = Att_Optional | DV_Boolean; + + for (unsigned int j=0; j < E_Count; j++) { + + for (unsigned int index = 0; index < A_Count-1; index++) + { + fprintf(outFl, " %d,", attList[j][index]); + } + + fprintf(outFl, " %d", attList[j][A_Count - 1]); + + if (j + 1 == E_Count) + fprintf(outFl, "}\n};"); + else + fprintf(outFl, "},\n {"); + } + + fclose(outFl); +} + +#endif + + +unsigned short GeneralAttributeCheck::fgElemAttTable[GeneralAttributeCheck::E_Count][GeneralAttributeCheck::A_Count] = +{ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 258, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 130, 0, 10, 0, 0, 2, 0, 1026, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 2, 0, 1026, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 66, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2050, 0, 0, 0}, + { 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2050, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 130, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 18, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 34, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, + { 18, 0, 0, 2, 0, 2, 0, 2, 0, 2, 0, 34, 0, 0, 0, 0, 0, 1, 0, 18, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0}, + { 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 66, 34, 0, 130, 0, 10, 0, 1, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 130, 0, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 130, 0, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 66, 0, 0, 2, 0, 66, 0, 2, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 130, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4098, 0, 0} +}; + +const XMLCh* GeneralAttributeCheck::fAttNames[GeneralAttributeCheck::A_Count] = +{ + SchemaSymbols::fgATT_ABSTRACT, + SchemaSymbols::fgATT_ATTRIBUTEFORMDEFAULT, + SchemaSymbols::fgATT_BASE, + SchemaSymbols::fgATT_BLOCK, + SchemaSymbols::fgATT_BLOCKDEFAULT, + SchemaSymbols::fgATT_DEFAULT, + SchemaSymbols::fgATT_ELEMENTFORMDEFAULT, + SchemaSymbols::fgATT_FINAL, + SchemaSymbols::fgATT_FINALDEFAULT, + SchemaSymbols::fgATT_FIXED, + SchemaSymbols::fgATT_FORM, + SchemaSymbols::fgATT_ID, + SchemaSymbols::fgATT_ITEMTYPE, + SchemaSymbols::fgATT_MAXOCCURS, + SchemaSymbols::fgATT_MEMBERTYPES, + SchemaSymbols::fgATT_MINOCCURS, + SchemaSymbols::fgATT_MIXED, + SchemaSymbols::fgATT_NAME, + SchemaSymbols::fgATT_NAMESPACE, + SchemaSymbols::fgATT_NILLABLE, + SchemaSymbols::fgATT_PROCESSCONTENTS, + SchemaSymbols::fgATT_PUBLIC, + SchemaSymbols::fgATT_REF, + SchemaSymbols::fgATT_REFER, + SchemaSymbols::fgATT_SCHEMALOCATION, + SchemaSymbols::fgATT_SOURCE, + SchemaSymbols::fgATT_SUBSTITUTIONGROUP, + SchemaSymbols::fgATT_SYSTEM, + SchemaSymbols::fgATT_TARGETNAMESPACE, + SchemaSymbols::fgATT_TYPE, + SchemaSymbols::fgATT_USE, + SchemaSymbols::fgATT_VALUE, + SchemaSymbols::fgATT_VERSION, + SchemaSymbols::fgATT_XPATH, +}; + +XERCES_CPP_NAMESPACE_END + +/** + * End of file GeneralAttributeCheck.cpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.hpp b/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.hpp new file mode 100644 index 000000000..792678aeb --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/GeneralAttributeCheck.hpp @@ -0,0 +1,258 @@ +/* + * 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: GeneralAttributeCheck.hpp 729944 2008-12-29 17:03:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_GENERALATTRIBUTECHECK_HPP) +#define XERCESC_INCLUDE_GUARD_GENERALATTRIBUTECHECK_HPP + +/** + * A general purpose class to check for valid values of attributes, as well + * as check for proper association with corresponding schema elements. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward declaration +// --------------------------------------------------------------------------- +class TraverseSchema; +class DOMElement; +class DOMNode; + +class VALIDATORS_EXPORT GeneralAttributeCheck : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + //Elements + enum + { + E_All, + E_Annotation, + E_Any, + E_AnyAttribute, + E_Appinfo, + E_AttributeGlobal, + E_AttributeLocal, + E_AttributeRef, + E_AttributeGroupGlobal, + E_AttributeGroupRef, + E_Choice, + E_ComplexContent, + E_ComplexTypeGlobal, + E_ComplexTypeLocal, + E_Documentation, + E_ElementGlobal, + E_ElementLocal, + E_ElementRef, + E_Enumeration, + E_Extension, + E_Field, + E_FractionDigits, + E_GroupGlobal, + E_GroupRef, + E_Import, + E_Include, + E_Key, + E_KeyRef, + E_Length, + E_List, + E_MaxExclusive, + E_MaxInclusive, + E_MaxLength, + E_MinExclusive, + E_MinInclusive, + E_MinLength, + E_Notation, + E_Pattern, + E_Redefine, + E_Restriction, + E_Schema, + E_Selector, + E_Sequence, + E_SimpleContent, + E_SimpleTypeGlobal, + E_SimpleTypeLocal, + E_TotalDigits, + E_Union, + E_Unique, + E_WhiteSpace, + + E_Count, + E_Invalid = -1 + }; + + //Attributes + enum + { + A_Abstract, + A_AttributeFormDefault, + A_Base, + A_Block, + A_BlockDefault, + A_Default, + A_ElementFormDefault, + A_Final, + A_FinalDefault, + A_Fixed, + A_Form, + A_ID, + A_ItemType, + A_MaxOccurs, + A_MemberTypes, + A_MinOccurs, + A_Mixed, + A_Name, + A_Namespace, + A_Nillable, + A_ProcessContents, + A_Public, + A_Ref, + A_Refer, + A_SchemaLocation, + A_Source, + A_SubstitutionGroup, + A_System, + A_TargetNamespace, + A_Type, + A_Use, + A_Value, + A_Version, + A_XPath, + + A_Count, + A_Invalid = -1 + }; + + //Validators + enum { + + DV_String = 0, + DV_AnyURI = 4, + DV_NonNegInt = 8, + DV_Boolean = 16, + DV_ID = 32, + DV_Form = 64, + DV_MaxOccurs = 128, + DV_MaxOccurs1 = 256, + DV_MinOccurs1 = 512, + DV_ProcessContents = 1024, + DV_Use = 2048, + DV_WhiteSpace = 4096, + + DV_Mask = (DV_AnyURI | DV_NonNegInt | DV_Boolean | DV_ID | DV_Form | + DV_MaxOccurs | DV_MaxOccurs1 | DV_MinOccurs1 | + DV_ProcessContents | DV_Use | DV_WhiteSpace) + }; + + // generate element-attributes map table +#if defined(NEED_TO_GEN_ELEM_ATT_MAP_TABLE) + static void initCharFlagTable(); +#endif + + // ----------------------------------------------------------------------- + // Constructor/Destructor + // ----------------------------------------------------------------------- + GeneralAttributeCheck(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~GeneralAttributeCheck(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + unsigned short getFacetId(const XMLCh* const facetName, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + void checkAttributes(const DOMElement* const elem, + const unsigned short elemContext, + TraverseSchema* const schema, + const bool isTopLevel = false, + ValueVectorOf* const nonXSAttList = 0); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + GeneralAttributeCheck(const GeneralAttributeCheck&); + GeneralAttributeCheck& operator=(const GeneralAttributeCheck&); + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + void validate(const DOMElement* const elem, const XMLCh* const attName, const XMLCh* const attValue, + const short dvIndex, TraverseSchema* const schema); + + // ----------------------------------------------------------------------- + // Private Constants + // ----------------------------------------------------------------------- + // optional vs. required attribute + enum { + Att_Required = 1, + Att_Optional = 2, + Att_Mask = 3 + }; + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + static ValueHashTableOf* fAttMap; + static ValueHashTableOf* fFacetsMap; + static DatatypeValidator* fNonNegIntDV; + static DatatypeValidator* fBooleanDV; + static DatatypeValidator* fAnyURIDV; + static unsigned short fgElemAttTable[E_Count][A_Count]; + static const XMLCh* fAttNames[A_Count]; + MemoryManager* fMemoryManager; + IDDatatypeValidator fIDValidator; + +private: + static void initialize(); + + friend class XMLInitializer; +}; + + +// --------------------------------------------------------------------------- +// GeneralAttributeCheck: Getter methods +// --------------------------------------------------------------------------- +inline unsigned short +GeneralAttributeCheck::getFacetId(const XMLCh* const facetName, MemoryManager* const manager) { + + return fFacetsMap->get(facetName, manager); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file GeneralAttributeCheck.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.cpp b/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.cpp new file mode 100644 index 000000000..4ce400739 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.cpp @@ -0,0 +1,317 @@ +/* + * 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: NamespaceScope.cpp 729944 2008-12-29 17:03:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// NamespaceScope: Constructors and Destructor +// --------------------------------------------------------------------------- +NamespaceScope::NamespaceScope(MemoryManager* const manager /*= XMLPlatformUtils::fgMemoryManager*/) : + fEmptyNamespaceId(0) + , fStackCapacity(8) + , fStackTop(0) + , fPrefixPool(109, manager) + , fStack(0) + , fMemoryManager(manager) +{ + // Do an initial allocation of the stack and zero it out + fStack = (StackElem**) fMemoryManager->allocate + ( + fStackCapacity * sizeof(StackElem*) + );//new StackElem*[fStackCapacity]; + memset(fStack, 0, fStackCapacity * sizeof(StackElem*)); +} + +NamespaceScope::NamespaceScope(const NamespaceScope* const initialize, MemoryManager* const manager /*= XMLPlatformUtils::fgMemoryManager*/) : + fEmptyNamespaceId(0) + , fStackCapacity(8) + , fStackTop(0) + , fPrefixPool(109, manager) + , fStack(0) + , fMemoryManager(manager) +{ + // Do an initial allocation of the stack and zero it out + fStack = (StackElem**) fMemoryManager->allocate + ( + fStackCapacity * sizeof(StackElem*) + );//new StackElem*[fStackCapacity]; + memset(fStack, 0, fStackCapacity * sizeof(StackElem*)); + + if(initialize) + { + reset(initialize->fEmptyNamespaceId); + + // copy the existing bindings + for (unsigned int index = initialize->fStackTop; index > 0; index--) + { + // Get a convenience pointer to the current element + StackElem* curRow = initialize->fStack[index-1]; + + // If no prefixes mapped at this level, then go the next one + if (!curRow->fMapCount) + continue; + + for (unsigned int mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++) + { + // go from the id to the prefix + const XMLCh* prefix = initialize->fPrefixPool.getValueForId(curRow->fMap[mapIndex].fPrefId); + + // if the prefix is not already known, add it + if(getNamespaceForPrefix(prefix)==fEmptyNamespaceId) + addPrefix(prefix, curRow->fMap[mapIndex].fURIId); + } + } + } +} + +NamespaceScope::~NamespaceScope() +{ + // + // Start working from the bottom of the stack and clear it out as we + // go up. Once we hit an uninitialized one, we can break out. + // + for (unsigned int stackInd = 0; stackInd < fStackCapacity; stackInd++) + { + // If this entry has been set, then lets clean it up + if (!fStack[stackInd]) + break; + + // Delete the row for this entry, then delete the row structure + fMemoryManager->deallocate(fStack[stackInd]->fMap);//delete [] fStack[stackInd]->fMap; + delete fStack[stackInd]; + } + + // Delete the stack array itself now + fMemoryManager->deallocate(fStack);//delete [] fStack; +} + + +// --------------------------------------------------------------------------- +// NamespaceScope: Stack access +// --------------------------------------------------------------------------- +unsigned int NamespaceScope::increaseDepth() +{ + // See if we need to expand the stack + if (fStackTop == fStackCapacity) + expandStack(); + + // If this element has not been initialized yet, then initialize it + if (!fStack[fStackTop]) + { + fStack[fStackTop] = new (fMemoryManager) StackElem; + fStack[fStackTop]->fMapCapacity = 0; + fStack[fStackTop]->fMap = 0; + } + + // Set up the new top row + fStack[fStackTop]->fMapCount = 0; + + // Bump the top of stack + fStackTop++; + + return fStackTop-1; +} + +unsigned int NamespaceScope::decreaseDepth() +{ + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_StackUnderflow, fMemoryManager); + + fStackTop--; + + return fStackTop; +} + + +// --------------------------------------------------------------------------- +// NamespaceScope: Prefix map methods +// --------------------------------------------------------------------------- +void NamespaceScope::addPrefix(const XMLCh* const prefixToAdd, + const unsigned int uriId) { + + if (!fStackTop) + ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::ElemStack_EmptyStack, fMemoryManager); + + // Get a convenience pointer to the stack top row + StackElem* curRow = fStack[fStackTop - 1]; + + // Map the prefix to its unique id + const unsigned int prefId = fPrefixPool.addOrFind(prefixToAdd); + + // Search the map at this level for the passed prefix + for (unsigned int mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++) + { + if (curRow->fMap[mapIndex].fPrefId == prefId) + { + curRow->fMap[mapIndex].fURIId = uriId; + return; + } + } + + // + // Add a new element to the prefix map for this element. If its full, + // then expand it out. + // + if (curRow->fMapCount == curRow->fMapCapacity) + expandMap(curRow); + + // + // And now add a new element for this prefix. + // + curRow->fMap[curRow->fMapCount].fPrefId = prefId; + curRow->fMap[curRow->fMapCount].fURIId = uriId; + + // Bump the map count now + curRow->fMapCount++; +} + +unsigned int +NamespaceScope::getNamespaceForPrefix(const XMLCh* const prefixToMap) const { + + // + // Map the prefix to its unique id, from the prefix string pool. If its + // not a valid prefix, then its a failure. + // + unsigned int prefixId = fPrefixPool.getId(prefixToMap); + + if (!prefixId){ + return fEmptyNamespaceId; + } + + // + // Start at the stack top and work backwards until we come to some + // element that mapped this prefix. + // + for (unsigned int index = fStackTop; index > 0; index--) + { + // Get a convenience pointer to the current element + StackElem* curRow = fStack[index-1]; + + // If no prefixes mapped at this level, then go the next one + if (!curRow->fMapCount) + continue; + + // Search the map at this level for the passed prefix + for (unsigned int mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++) + { + if (curRow->fMap[mapIndex].fPrefId == prefixId) + return curRow->fMap[mapIndex].fURIId; + } + } + + return fEmptyNamespaceId; +} + + +// --------------------------------------------------------------------------- +// NamespaceScope: Miscellaneous methods +// --------------------------------------------------------------------------- +void NamespaceScope::reset(const unsigned int emptyId) +{ + // Flush the prefix pool and put back in the standard prefixes + fPrefixPool.flushAll(); + + // Reset the stack top to clear the stack + fStackTop = 0; + + // And store the new special URI ids + fEmptyNamespaceId = emptyId; + + // add the first storage + increaseDepth(); +} + + +// --------------------------------------------------------------------------- +// Namespace: Private helpers +// --------------------------------------------------------------------------- +void NamespaceScope::expandMap(StackElem* const toExpand) +{ + // For convenience get the old map size + const unsigned int oldCap = toExpand->fMapCapacity; + + // + // Expand the capacity by 25%, or initialize it to 16 if its currently + // empty. Then allocate a new temp buffer. + // + const unsigned int newCapacity = oldCap ? + (unsigned int)(oldCap * 1.25) : 16; + PrefMapElem* newMap = (PrefMapElem*) fMemoryManager->allocate + ( + newCapacity * sizeof(PrefMapElem) + );//new PrefMapElem[newCapacity]; + + // + // Copy over the old stuff. We DON'T have to zero out the new stuff + // since this is a by value map and the current map index controls what + // is relevant. + // + memcpy(newMap, toExpand->fMap, oldCap * sizeof(PrefMapElem)); + + // Delete the old map and store the new stuff + fMemoryManager->deallocate(toExpand->fMap);//delete [] toExpand->fMap; + toExpand->fMap = newMap; + toExpand->fMapCapacity = newCapacity; +} + +void NamespaceScope::expandStack() +{ + // Expand the capacity by 25% and allocate a new buffer + const unsigned int newCapacity = (unsigned int)(fStackCapacity * 1.25); + StackElem** newStack = (StackElem**) fMemoryManager->allocate + ( + newCapacity * sizeof(StackElem*) + );//new StackElem*[newCapacity]; + + // Copy over the old stuff + memcpy(newStack, fStack, fStackCapacity * sizeof(StackElem*)); + + // + // And zero out the new stuff. Though we use a stack top, we reuse old + // stack contents so we need to know if elements have been initially + // allocated or not as we push new stuff onto the stack. + // + memset + ( + &newStack[fStackCapacity] + , 0 + , (newCapacity - fStackCapacity) * sizeof(StackElem*) + ); + + // Delete the old array and update our members + fMemoryManager->deallocate(fStack);//delete [] fStack; + fStack = newStack; + fStackCapacity = newCapacity; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file NamespaceScope.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.hpp b/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.hpp new file mode 100644 index 000000000..2a83bcd8a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/NamespaceScope.hpp @@ -0,0 +1,169 @@ +/* + * 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: NamespaceScope.hpp 729944 2008-12-29 17:03:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_NAMESPACESCOPE_HPP) +#define XERCESC_INCLUDE_GUARD_NAMESPACESCOPE_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Define a pure interface to allow XercesXPath to work on both NamespaceScope and DOMXPathNSResolver +class VALIDATORS_EXPORT XercesNamespaceResolver +{ +public: + virtual unsigned int getNamespaceForPrefix(const XMLCh* const prefix) const = 0; +}; + +// +// NamespaceScope provides a data structure for mapping namespace prefixes +// to their URI's. The mapping accurately reflects the scoping of namespaces +// at a particular instant in time. +// + +class VALIDATORS_EXPORT NamespaceScope : public XMemory, + public XercesNamespaceResolver +{ +public : + // ----------------------------------------------------------------------- + // Class specific data types + // + // These really should be private, but some of the compilers we have to + // support are too dumb to deal with that. + // + // PrefMapElem + // fURIId is the id of the URI from the validator's URI map. The + // fPrefId is the id of the prefix from our own prefix pool. The + // namespace stack consists of these elements. + // + // StackElem + // The fMapCapacity is how large fMap has grown so far. fMapCount + // is how many of them are valid right now. + // ----------------------------------------------------------------------- + struct PrefMapElem : public XMemory + { + unsigned int fPrefId; + unsigned int fURIId; + }; + + struct StackElem : public XMemory + { + PrefMapElem* fMap; + unsigned int fMapCapacity; + unsigned int fMapCount; + }; + + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + NamespaceScope(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + NamespaceScope(const NamespaceScope* const initialize, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~NamespaceScope(); + + + // ----------------------------------------------------------------------- + // Stack access + // ----------------------------------------------------------------------- + unsigned int increaseDepth(); + unsigned int decreaseDepth(); + + // ----------------------------------------------------------------------- + // Prefix map methods + // ----------------------------------------------------------------------- + void addPrefix(const XMLCh* const prefixToAdd, + const unsigned int uriId); + + virtual unsigned int getNamespaceForPrefix(const XMLCh* const prefixToMap) const; + + + // ----------------------------------------------------------------------- + // Miscellaneous methods + // ----------------------------------------------------------------------- + bool isEmpty() const; + void reset(const unsigned int emptyId); + unsigned int getEmptyNamespaceId() const; + + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + NamespaceScope(const NamespaceScope&); + NamespaceScope& operator=(const NamespaceScope&); + + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void expandMap(StackElem* const toExpand); + void expandStack(); + + + // ----------------------------------------------------------------------- + // Data members + // + // fEmptyNamespaceId + // This is the special URI id for the "" namespace, which is magic + // because of the xmlns="" operation. + // + // fPrefixPool + // This is the prefix pool where prefixes are hashed and given unique + // ids. These ids are used to track prefixes in the element stack. + // + // fStack + // fStackCapacity + // fStackTop + // This the stack array. Its an array of pointers to StackElem + // structures. The capacity is the current high water mark of the + // stack. The top is the current top of stack (i.e. the part of it + // being used.) + // ----------------------------------------------------------------------- + unsigned int fEmptyNamespaceId; + unsigned int fStackCapacity; + unsigned int fStackTop; + XMLStringPool fPrefixPool; + StackElem** fStack; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// NamespaceScope: Miscellaneous methods +// --------------------------------------------------------------------------- +inline bool NamespaceScope::isEmpty() const +{ + return (fStackTop == 0); +} + +inline unsigned int NamespaceScope::getEmptyNamespaceId() const +{ + return fEmptyNamespaceId; +} + + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file NameSpaceScope.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/PSVIDefs.hpp b/project/jni/xerces/src/xercesc/validators/schema/PSVIDefs.hpp new file mode 100644 index 000000000..6e1c46185 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/PSVIDefs.hpp @@ -0,0 +1,40 @@ +/* + * 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: PSVIDefs.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_PSVIDEFS_HPP) +#define XERCESC_INCLUDE_GUARD_PSVIDEFS_HPP + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT PSVIDefs +{ +public: + enum PSVIScope + { + SCP_ABSENT // declared in group/attribute group + , SCP_GLOBAL // global declaration or ref + , SCP_LOCAL // local declaration + }; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.cpp new file mode 100644 index 000000000..c79da4c5a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.cpp @@ -0,0 +1,178 @@ +/* + * 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: SchemaAttDef.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaAttDef: Implementation of the XMLAttDef interface +// --------------------------------------------------------------------------- +const XMLCh* SchemaAttDef::getFullName() const +{ + return fAttName->getRawName(); +} + +// --------------------------------------------------------------------------- +// SchemaAttDef: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaAttDef::SchemaAttDef(MemoryManager* const manager) : + XMLAttDef(XMLAttDef::CData, XMLAttDef::Implied, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fAttName(0) + , fDatatypeValidator(0) + , fNamespaceList(0) + , fBaseAttDecl(0) +{ +} + +SchemaAttDef::SchemaAttDef( const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , MemoryManager* const manager) : + XMLAttDef(type, defType, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fDatatypeValidator(0) + , fNamespaceList(0) + , fBaseAttDecl(0) +{ + fAttName = new (manager) QName(prefix, localPart, uriId, manager); +} + +SchemaAttDef::SchemaAttDef( const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const XMLCh* const attValue + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , const XMLCh* const enumValues + , MemoryManager* const manager) : + + XMLAttDef(attValue, type, defType, enumValues, manager) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fDatatypeValidator(0) + , fNamespaceList(0) + , fBaseAttDecl(0) +{ + fAttName = new (manager) QName(prefix, localPart, uriId, manager); +} + +SchemaAttDef::SchemaAttDef(const SchemaAttDef* other) : + + XMLAttDef(other->getValue(), other->getType(), + other->getDefaultType(), other->getEnumeration(), + other->getMemoryManager()) + , fElemId(XMLElementDecl::fgInvalidElemId) + , fPSVIScope(other->fPSVIScope) + , fAttName(0) + , fDatatypeValidator(other->fDatatypeValidator) + , fNamespaceList(0) + , fBaseAttDecl(other->fBaseAttDecl) +{ + QName* otherName = other->getAttName(); + fAttName = new (getMemoryManager()) QName(otherName->getPrefix(), + otherName->getLocalPart(), otherName->getURI(), + getMemoryManager()); + + if (other->fNamespaceList && other->fNamespaceList->size()) { + fNamespaceList = new (getMemoryManager()) ValueVectorOf(*(other->fNamespaceList)); + } +} + +SchemaAttDef::~SchemaAttDef() +{ + delete fAttName; + delete fNamespaceList; +} + + +// --------------------------------------------------------------------------- +// SchemaAttDef: Setter methods +// --------------------------------------------------------------------------- +void SchemaAttDef::setAttName(const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId ) +{ + fAttName->setName(prefix, localPart, uriId); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(SchemaAttDef) + +void SchemaAttDef::serialize(XSerializeEngine& serEng) +{ + + XMLAttDef::serialize(serEng); + + if (serEng.isStoring()) + { + serEng.writeSize (fElemId); + serEng<<(int)fPSVIScope; + + serEng< + ***/ + XTemplateSerializer::storeObject(fNamespaceList, serEng); + + serEng<>i; + fPSVIScope = (PSVIDefs::PSVIScope)i; + + serEng>>fAttName; + + fDatatypeValidator = DatatypeValidator::loadDV(serEng); + + /*** + * Deserialize ValueVectorOf + ***/ + XTemplateSerializer::loadObject(&fNamespaceList, 8, false, serEng); + + serEng>>fBaseAttDecl; + } +} + + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.hpp new file mode 100644 index 000000000..40b807946 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDef.hpp @@ -0,0 +1,252 @@ +/* + * 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: SchemaAttDef.hpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAATTDEF_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAATTDEF_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DatatypeValidator; +class QName; +class ComplexTypeInfo; +// +// This class is a derivative of the core XMLAttDef class. This class adds +// any Schema specific data members and provides Schema specific implementations +// of any underlying attribute def virtual methods. +// +class VALIDATORS_EXPORT SchemaAttDef : public XMLAttDef +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructors + // ----------------------------------------------------------------------- + SchemaAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + SchemaAttDef + ( + const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const XMLAttDef::AttTypes type = CData + , const XMLAttDef::DefAttTypes defType = Implied + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + SchemaAttDef + ( + const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const XMLCh* const attValue + , const XMLAttDef::AttTypes type + , const XMLAttDef::DefAttTypes defType + , const XMLCh* const enumValues = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + SchemaAttDef + ( + const SchemaAttDef* other + ); + virtual ~SchemaAttDef(); + + // ----------------------------------------------------------------------- + // Implementation of the XMLAttDef interface + // ----------------------------------------------------------------------- + virtual const XMLCh* getFullName() const; + virtual void reset(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLSize_t getElemId() const; + QName* getAttName() const; + DatatypeValidator* getDatatypeValidator() const; + ValueVectorOf* getNamespaceList() const; + const SchemaAttDef* getBaseAttDecl() const; + SchemaAttDef* getBaseAttDecl(); + PSVIDefs::PSVIScope getPSVIScope() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setElemId(const XMLSize_t newId); + void setAttName + ( + const XMLCh* const prefix + ,const XMLCh* const localPart + ,const int uriId = -1 + ); + void setDatatypeValidator(DatatypeValidator* newDatatypeValidator); + void setBaseAttDecl(SchemaAttDef* const attDef); + void setPSVIScope(const PSVIDefs::PSVIScope toSet); + + void setNamespaceList(const ValueVectorOf* const toSet); + void resetNamespaceList(); + void setEnclosingCT(ComplexTypeInfo* complexTypeInfo); + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(SchemaAttDef) + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaAttDef(const SchemaAttDef&); + SchemaAttDef& operator=(const SchemaAttDef&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fElemId + // This is the id of the element (the id is into the element decl + // pool) of the element this attribute def said it belonged to. + // This is used later to link back to the element, mostly for + // validation purposes. + // + // fAttName + // This is the name of the attribute. + // + // fDatatypeValidator + // The DatatypeValidator used to validate this attribute type. + // + // fNamespaceList + // The list of namespace values for a wildcard attribute + // + // fBaseAttDecl + // The base attribute declaration that this attribute is based on + // NOTE: we do not have a notion of attribute use, so in the case + // of ref'd attributes and inherited attributes, we make a copy + // of the actual attribute declaration. The fBaseAttDecl stores that + // declaration, and will be helpful when we build the XSModel (i.e + // easy access the XSAnnotation object). + // ----------------------------------------------------------------------- + XMLSize_t fElemId; + + PSVIDefs::PSVIScope fPSVIScope; + + QName* fAttName; + DatatypeValidator* fDatatypeValidator; + ValueVectorOf* fNamespaceList; + SchemaAttDef* fBaseAttDecl; +}; + + +// --------------------------------------------------------------------------- +// SchemaAttDef: Getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t SchemaAttDef::getElemId() const +{ + return fElemId; +} + + +inline QName* SchemaAttDef::getAttName() const +{ + return fAttName; +} + +inline DatatypeValidator* SchemaAttDef::getDatatypeValidator() const +{ + return fDatatypeValidator; +} + +inline ValueVectorOf* +SchemaAttDef::getNamespaceList() const { + return fNamespaceList; +} + +inline SchemaAttDef* SchemaAttDef::getBaseAttDecl() +{ + return fBaseAttDecl; +} + +inline const SchemaAttDef* SchemaAttDef::getBaseAttDecl() const +{ + return fBaseAttDecl; +} + +inline PSVIDefs::PSVIScope SchemaAttDef::getPSVIScope() const +{ + return fPSVIScope; +} + +// --------------------------------------------------------------------------- +// SchemaAttDef: Setter methods +// --------------------------------------------------------------------------- +inline void SchemaAttDef::setElemId(const XMLSize_t newId) +{ + fElemId = newId; +} + +inline void SchemaAttDef::setDatatypeValidator(DatatypeValidator* newDatatypeValidator) +{ + fDatatypeValidator = newDatatypeValidator; +} + +inline void SchemaAttDef::resetNamespaceList() { + + if (fNamespaceList && fNamespaceList->size()) { + fNamespaceList->removeAllElements(); + } +} + +inline void SchemaAttDef::setNamespaceList(const ValueVectorOf* const toSet) { + + if (toSet && toSet->size()) { + + if (fNamespaceList) { + *fNamespaceList = *toSet; + } + else { + fNamespaceList = new (getMemoryManager()) ValueVectorOf(*toSet); + } + } + else { + resetNamespaceList(); + } +} + +inline void SchemaAttDef::reset() { +} + +inline void SchemaAttDef::setEnclosingCT(ComplexTypeInfo*) +{ +} + +inline void SchemaAttDef::setBaseAttDecl(SchemaAttDef* const attDef) +{ + fBaseAttDecl = attDef; +} + +inline void SchemaAttDef::setPSVIScope(const PSVIDefs::PSVIScope toSet) +{ + fPSVIScope = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.cpp new file mode 100644 index 000000000..6e25263c8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.cpp @@ -0,0 +1,201 @@ +/* + * 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: SchemaAttDefList.cpp 679359 2008-07-24 11:15:19Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaAttDefList: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaAttDefList::SchemaAttDefList(RefHash2KeysTableOf* const listToUse, MemoryManager* const manager) +: XMLAttDefList(manager) +,fEnum(0) +,fList(listToUse) +,fArray(0) +,fSize(0) +,fCount(0) +{ + fEnum = new (getMemoryManager()) RefHash2KeysTableOfEnumerator(listToUse, false, getMemoryManager()); + fArray = (SchemaAttDef **)((getMemoryManager())->allocate( sizeof(SchemaAttDef*) << 1)); + fSize = 2; +} + +SchemaAttDefList::~SchemaAttDefList() +{ + delete fEnum; + (getMemoryManager())->deallocate(fArray); +} + + +// --------------------------------------------------------------------------- +// SchemaAttDefList: Implementation of the virtual interface +// --------------------------------------------------------------------------- + +bool SchemaAttDefList::isEmpty() const +{ + return fList->isEmpty(); +} + + +XMLAttDef* SchemaAttDefList::findAttDef(const unsigned int uriID + , const XMLCh* const attName) +{ + const int colonInd = XMLString::indexOf(attName, chColon); + + // An index of 0 is really an error, but the QName class doesn't check for + // that case either... + const XMLCh* const localPart = colonInd >= 0 ? attName + colonInd + 1 : attName; + + return fList->get((void*)localPart, uriID); +} + + +const XMLAttDef* +SchemaAttDefList::findAttDef( const unsigned int uriID + , const XMLCh* const attName) const +{ + const int colonInd = XMLString::indexOf(attName, chColon); + + // An index of 0 is really an error, but the QName class doesn't check for + // that case either... + const XMLCh* const localPart = colonInd >= 0 ? attName + colonInd + 1 : attName; + + return fList->get((void*)localPart, uriID); +} + + +XMLAttDef* SchemaAttDefList::findAttDef( const XMLCh* const + , const XMLCh* const) +{ + //need numeric URI id to locate the attribute, that's how it was stored + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Pool_InvalidId, getMemoryManager()); + return 0; +} + + +const XMLAttDef* +SchemaAttDefList::findAttDef( const XMLCh* const + , const XMLCh* const) const +{ + //need numeric URI id to locate the attribute, that's how it was stored + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Pool_InvalidId, getMemoryManager()); + return 0; +} + +/** + * return total number of attributes in this list + */ +XMLSize_t SchemaAttDefList::getAttDefCount() const +{ + return fCount; +} + +/** + * return attribute at the index-th position in the list. + */ +XMLAttDef &SchemaAttDefList::getAttDef(XMLSize_t index) +{ + if(index >= fCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttrList_BadIndex, getMemoryManager()); + return *(fArray[index]); +} + +/** + * return attribute at the index-th position in the list. + */ +const XMLAttDef &SchemaAttDefList::getAttDef(XMLSize_t index) const +{ + if(index >= fCount) + ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::AttrList_BadIndex, getMemoryManager()); + return *(fArray[index]); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(SchemaAttDefList) + +void SchemaAttDefList::serialize(XSerializeEngine& serEng) +{ + + XMLAttDefList::serialize(serEng); + + if (serEng.isStoring()) + { + /*** + * + * Serialize RefHash2KeysTableOf + * + ***/ + XTemplateSerializer::storeObject(fList, serEng); + serEng.writeSize (fCount); + + // do not serialize fEnum + } + else + { + /*** + * + * Deserialize RefHash2KeysTableOf + * + ***/ + XTemplateSerializer::loadObject(&fList, 29, true, serEng); + + // assume empty so we can size fArray just right + serEng.readSize (fSize); + if (!fEnum && fList) + { + fEnum = new (getMemoryManager()) RefHash2KeysTableOfEnumerator(fList, false, getMemoryManager()); + } + if(fSize) + { + (getMemoryManager())->deallocate(fArray); + fArray = (SchemaAttDef **)((getMemoryManager())->allocate( sizeof(SchemaAttDef*) * fSize)); + fCount = 0; + while(fEnum->hasMoreElements()) + { + fArray[fCount++] = &fEnum->nextElement(); + } + } + } + +} + +SchemaAttDefList::SchemaAttDefList(MemoryManager* const manager) +: XMLAttDefList(manager) +,fEnum(0) +,fList(0) +,fArray(0) +,fSize(0) +,fCount(0) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.hpp new file mode 100644 index 000000000..3093855a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaAttDefList.hpp @@ -0,0 +1,181 @@ +/* + * 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: SchemaAttDefList.hpp 673679 2008-07-03 13:50:10Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAATTDEFLIST_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAATTDEFLIST_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This is a derivative of the framework abstract class which defines the +// interface to a list of attribute defs that belong to a particular +// element. The scanner needs to be able to get a list of the attributes +// that an element supports, for use during the validation process and for +// fixed/default attribute processing. +// +// For us, we just wrap the RefHash2KeysTableOf collection that the SchemaElementDecl +// class uses to store the attributes that belong to it. +// +// This class does not adopt the hash table, it just references it. The +// hash table is owned by the element decl it is a member of. +// +class VALIDATORS_EXPORT SchemaAttDefList : public XMLAttDefList +{ +public : + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + SchemaAttDefList + ( + RefHash2KeysTableOf* const listToUse, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~SchemaAttDefList(); + + + // ----------------------------------------------------------------------- + // Implementation of the virtual interface + // ----------------------------------------------------------------------- + + virtual bool isEmpty() const; + virtual XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ); + virtual const XMLAttDef* findAttDef + ( + const unsigned int uriID + , const XMLCh* const attName + ) const; + virtual XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ); + virtual const XMLAttDef* findAttDef + ( + const XMLCh* const attURI + , const XMLCh* const attName + ) const; + + XMLAttDef* findAttDefLocalPart + ( + const unsigned int uriID + , const XMLCh* const attLocalPart + ); + + const XMLAttDef* findAttDefLocalPart + ( + const unsigned int uriID + , const XMLCh* const attLocalPart + ) const; + + /** + * return total number of attributes in this list + */ + virtual XMLSize_t getAttDefCount() const ; + + /** + * return attribute at the index-th position in the list. + */ + virtual XMLAttDef &getAttDef(XMLSize_t index) ; + + /** + * return attribute at the index-th position in the list. + */ + virtual const XMLAttDef &getAttDef(XMLSize_t index) const ; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(SchemaAttDefList) + + SchemaAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaAttDefList(const SchemaAttDefList&); + SchemaAttDefList& operator=(const SchemaAttDefList&); + + void addAttDef(SchemaAttDef *toAdd); + + // ----------------------------------------------------------------------- + // Private data members + // + // fEnum + // This is an enumerator for the list that we use to do the enumerator + // type methods of this class. + // + // fList + // The list of SchemaAttDef objects that represent the attributes that + // a particular element supports. + // fArray + // vector of pointers to the DTDAttDef objects contained in this list + // fSize + // size of fArray + // fCount + // number of DTDAttDef objects currently stored in this list + // ----------------------------------------------------------------------- + RefHash2KeysTableOfEnumerator* fEnum; + RefHash2KeysTableOf* fList; + SchemaAttDef** fArray; + XMLSize_t fSize; + XMLSize_t fCount; + + friend class ComplexTypeInfo; +}; + +inline void SchemaAttDefList::addAttDef(SchemaAttDef *toAdd) +{ + if(fCount == fSize) + { + // need to grow fArray + fSize <<= 1; + SchemaAttDef** newArray = (SchemaAttDef **)((getMemoryManager())->allocate( sizeof(SchemaAttDef*) * fSize )); + memcpy(newArray, fArray, fCount * sizeof(SchemaAttDef *)); + (getMemoryManager())->deallocate(fArray); + fArray = newArray; + } + fArray[fCount++] = toAdd; +} + +inline XMLAttDef* SchemaAttDefList::findAttDefLocalPart(const unsigned int uriID + , const XMLCh* const attLocalPart) +{ + return fList->get((void*)attLocalPart, uriID); +} + +inline const XMLAttDef* SchemaAttDefList::findAttDefLocalPart(const unsigned int uriID + , const XMLCh* const attLocalPart) const +{ + return fList->get((void*)attLocalPart, uriID); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.cpp new file mode 100644 index 000000000..ef4d1fc47 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.cpp @@ -0,0 +1,277 @@ +/* + * 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: SchemaElementDecl.cpp 609971 2008-01-08 13:30:47Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaElementDecl: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaElementDecl::SchemaElementDecl(MemoryManager* const manager) : + XMLElementDecl(manager) + , fModelType(Any) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fEnclosingScope(Grammar::TOP_LEVEL_SCOPE) + , fFinalSet(0) + , fBlockSet(0) + , fMiscFlags(0) + , fDefaultValue(0) + , fComplexTypeInfo(0) + , fAttDefs(0) + , fIdentityConstraints(0) + , fAttWildCard(0) + , fSubstitutionGroupElem(0) + , fDatatypeValidator(0) +{ +} + +SchemaElementDecl::SchemaElementDecl(const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const SchemaElementDecl::ModelTypes type + , const unsigned int enclosingScope + , MemoryManager* const manager) : + XMLElementDecl(manager) + , fModelType(type) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fEnclosingScope(enclosingScope) + , fFinalSet(0) + , fBlockSet(0) + , fMiscFlags(0) + , fDefaultValue(0) + , fComplexTypeInfo(0) + , fAttDefs(0) + , fIdentityConstraints(0) + , fAttWildCard(0) + , fSubstitutionGroupElem(0) + , fDatatypeValidator(0) +{ + setElementName(prefix, localPart, uriId); +} + +SchemaElementDecl::SchemaElementDecl(const QName* const elementName + , const SchemaElementDecl::ModelTypes type + , const unsigned int enclosingScope + , MemoryManager* const manager) : + XMLElementDecl(manager) + , fModelType(type) + , fPSVIScope(PSVIDefs::SCP_ABSENT) + , fEnclosingScope(enclosingScope) + , fFinalSet(0) + , fBlockSet(0) + , fMiscFlags(0) + , fDefaultValue(0) + , fComplexTypeInfo(0) + , fAttDefs(0) + , fIdentityConstraints(0) + , fAttWildCard(0) + , fSubstitutionGroupElem(0) + , fDatatypeValidator(0) +{ + setElementName(elementName); +} + +SchemaElementDecl::~SchemaElementDecl() +{ + getMemoryManager()->deallocate(fDefaultValue);//delete [] fDefaultValue; + delete fAttDefs; + delete fIdentityConstraints; + delete fAttWildCard; +} + + +// --------------------------------------------------------------------------- +// SchemaElementDecl: XMLElementDecl virtual interface implementation +// --------------------------------------------------------------------------- +XMLAttDefList& SchemaElementDecl::getAttDefList() const +{ + if (!fComplexTypeInfo) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::DV_InvalidOperation, getMemoryManager()); + } + + return fComplexTypeInfo->getAttDefList(); +} + + +XMLElementDecl::CharDataOpts SchemaElementDecl::getCharDataOpts() const +{ + SchemaElementDecl::ModelTypes modelType = fModelType; + + if (fComplexTypeInfo) { + modelType = (SchemaElementDecl::ModelTypes) fComplexTypeInfo->getContentType(); + } + + XMLElementDecl::CharDataOpts retVal; + switch(modelType) + { + case Children : + case ElementOnlyEmpty : + retVal = XMLElementDecl::SpacesOk; + break; + + case Empty : + retVal = XMLElementDecl::NoCharData; + break; + + default : + retVal = XMLElementDecl::AllCharData; + break; + } + return retVal; +} + + +bool SchemaElementDecl::hasAttDefs() const +{ + if (fComplexTypeInfo) { + return fComplexTypeInfo->hasAttDefs(); + } + + // If the collection hasn't been faulted in, then no att defs + return false; + +} + +const XMLCh* +SchemaElementDecl::getFormattedContentModel() const +{ + if (fComplexTypeInfo) { + return fComplexTypeInfo->getFormattedContentModel(); + } + return 0; +} + +// --------------------------------------------------------------------------- +// SchemaElementDecl: Getter methods +// --------------------------------------------------------------------------- +const SchemaAttDef* SchemaElementDecl::getAttDef(const XMLCh* const baseName, const int uriId) const +{ + if (fComplexTypeInfo) { + return fComplexTypeInfo->getAttDef(baseName, uriId); + } + + // If no complex type, then return a null + return 0; + +} + +SchemaAttDef* SchemaElementDecl::getAttDef(const XMLCh* const baseName, const int uriId) +{ + if (fComplexTypeInfo) { + return fComplexTypeInfo->getAttDef(baseName, uriId); + } + + // If no complex type, then return a null + return 0; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(SchemaElementDecl) + +void SchemaElementDecl::serialize(XSerializeEngine& serEng) +{ + + XMLElementDecl::serialize(serEng); + + if (serEng.isStoring()) + { + serEng<<(int)fModelType; + serEng<<(int)fPSVIScope; + + serEng<* fAttDefs; + ***/ + + XTemplateSerializer::storeObject(fAttDefs, serEng); + + /*** + * Serialize RefVectorOf* fIdentityConstraints; + ***/ + XTemplateSerializer::storeObject(fIdentityConstraints, serEng); + + serEng<>i; + fModelType = (ModelTypes)i; + serEng>>i; + fPSVIScope = (PSVIDefs::PSVIScope)i; + + serEng>>fEnclosingScope; + serEng>>fFinalSet; + serEng>>fBlockSet; + serEng>>fMiscFlags; + + serEng.readString(fDefaultValue); + + serEng>>fComplexTypeInfo; + + /*** + * DeSerialize RefHash2KeysTableOf* fAttDefs; + ***/ + XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng); + + /*** + * DeSerialize RefVectorOf* fIdentityConstraints; + ***/ + XTemplateSerializer::loadObject(&fIdentityConstraints, 16, true, serEng); + + serEng>>fAttWildCard; + serEng>>fSubstitutionGroupElem; + fDatatypeValidator = DatatypeValidator::loadDV(serEng); + } +} + +XMLElementDecl::objectType SchemaElementDecl::getObjectType() const +{ + return Schema; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.hpp new file mode 100644 index 000000000..2b79ebad5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaElementDecl.hpp @@ -0,0 +1,438 @@ +/* + * 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: SchemaElementDecl.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAELEMENTDECL_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAELEMENTDECL_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class ContentSpecNode; +class SchemaAttDefList; + +// +// This class is a derivative of the basic element decl. This one implements +// the virtuals so that they work for a Schema. +// +class VALIDATORS_EXPORT SchemaElementDecl : public XMLElementDecl +{ +public : + + // ----------------------------------------------------------------------- + // Class specific types + // + // ModelTypes + // Indicates the type of content model that an element has. This + // indicates how the content model is represented and validated. + // ----------------------------------------------------------------------- + enum ModelTypes + { + Empty + , Any + , Mixed_Simple + , Mixed_Complex + , Children + , Simple + , ElementOnlyEmpty + , ModelTypes_Count + }; + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + SchemaElementDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + SchemaElementDecl + ( + const XMLCh* const prefix + , const XMLCh* const localPart + , const int uriId + , const ModelTypes modelType = Any + , const unsigned int enclosingScope = Grammar::TOP_LEVEL_SCOPE + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + SchemaElementDecl + ( + const QName* const elementName + , const ModelTypes modelType = Any + , const unsigned int enclosingScope = Grammar::TOP_LEVEL_SCOPE + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + ~SchemaElementDecl(); + + + // ----------------------------------------------------------------------- + // The virtual element decl interface + // ----------------------------------------------------------------------- + virtual XMLAttDefList& getAttDefList() const; + virtual CharDataOpts getCharDataOpts() const; + virtual bool hasAttDefs() const; + virtual const ContentSpecNode* getContentSpec() const; + virtual ContentSpecNode* getContentSpec(); + virtual void setContentSpec(ContentSpecNode* toAdopt); + virtual XMLContentModel* getContentModel(); + virtual void setContentModel(XMLContentModel* const newModelToAdopt); + virtual const XMLCh* getFormattedContentModel () const; + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + const SchemaAttDef* getAttDef(const XMLCh* const baseName, const int uriId) const; + SchemaAttDef* getAttDef(const XMLCh* const baseName, const int uriId); + const SchemaAttDef* getAttWildCard() const; + SchemaAttDef* getAttWildCard(); + ModelTypes getModelType() const; + PSVIDefs::PSVIScope getPSVIScope() const; + DatatypeValidator* getDatatypeValidator() const; + unsigned int getEnclosingScope() const; + int getFinalSet() const; + int getBlockSet() const; + int getMiscFlags() const; + XMLCh* getDefaultValue() const; + ComplexTypeInfo* getComplexTypeInfo() const; + virtual bool isGlobalDecl() const; + SchemaElementDecl* getSubstitutionGroupElem() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setModelType(const SchemaElementDecl::ModelTypes toSet); + void setPSVIScope(const PSVIDefs::PSVIScope toSet); + void setDatatypeValidator(DatatypeValidator* newDatatypeValidator); + void setEnclosingScope(const unsigned int enclosingScope); + void setFinalSet(const int finalSet); + void setBlockSet(const int blockSet); + void setMiscFlags(const int flags); + void setDefaultValue(const XMLCh* const value); + void setComplexTypeInfo(ComplexTypeInfo* const typeInfo); + void setAttWildCard(SchemaAttDef* const attWildCard); + void setSubstitutionGroupElem(SchemaElementDecl* const elemDecl); + + // ----------------------------------------------------------------------- + // IC methods + // ----------------------------------------------------------------------- + void addIdentityConstraint(IdentityConstraint* const ic); + XMLSize_t getIdentityConstraintCount() const; + IdentityConstraint* getIdentityConstraintAt(XMLSize_t index) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(SchemaElementDecl) + + virtual XMLElementDecl::objectType getObjectType() const; + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaElementDecl(const SchemaElementDecl&); + SchemaElementDecl& operator=(const SchemaElementDecl&); + + // ----------------------------------------------------------------------- + // Private data members + // + // fModelType + // The content model type of this element. This tells us what kind + // of content model to create. + // + // fDatatypeValidator + // The DatatypeValidator used to validate this element type. + // + // fEnclosingScope + // The enclosing scope where this element is declared. + // + // fFinalSet + // The value set of the 'final' attribute. + // + // fBlockSet + // The value set of the 'block' attribute. + // + // fMiscFlags + // Stores 'abstract/nullable' values + // + // fDefaultValue + // The default/fixed value + // + // fComplexTypeInfo + // Stores complex type information + // (no need to delete - handled by schema grammar) + // + // fAttDefs + // The list of attributes that are faulted in for this element + // when ComplexTypeInfo does not exist. We want to keep track + // of these faulted in attributes to avoid duplicate redundant + // error. + // + // fIdentityConstraints + // Store information about an element identity constraints. + // + // fAttWildCard + // Store wildcard attribute in the case of an element with a type of + // 'anyType'. + // + // fSubstitutionGroupElem + // The substitution group element declaration. + // ----------------------------------------------------------------------- + + // ----------------------------------------------------------------------- + ModelTypes fModelType; + PSVIDefs::PSVIScope fPSVIScope; + + unsigned int fEnclosingScope; + int fFinalSet; + int fBlockSet; + int fMiscFlags; + XMLCh* fDefaultValue; + ComplexTypeInfo* fComplexTypeInfo; + RefHash2KeysTableOf* fAttDefs; + RefVectorOf* fIdentityConstraints; + SchemaAttDef* fAttWildCard; + SchemaElementDecl* fSubstitutionGroupElem; + DatatypeValidator* fDatatypeValidator; +}; + +// --------------------------------------------------------------------------- +// SchemaElementDecl: XMLElementDecl virtual interface implementation +// --------------------------------------------------------------------------- +inline ContentSpecNode* SchemaElementDecl::getContentSpec() +{ + if (fComplexTypeInfo != 0) { + return fComplexTypeInfo->getContentSpec(); + } + + return 0; +} + +inline const ContentSpecNode* SchemaElementDecl::getContentSpec() const +{ + if (fComplexTypeInfo != 0) { + return fComplexTypeInfo->getContentSpec(); + } + + return 0; +} + +inline void +SchemaElementDecl::setContentSpec(ContentSpecNode*) +{ + //Handled by complexType +} + +inline XMLContentModel* SchemaElementDecl::getContentModel() +{ + if (fComplexTypeInfo != 0) { + return fComplexTypeInfo->getContentModel(); + } + return 0; +} + +inline void +SchemaElementDecl::setContentModel(XMLContentModel* const) +{ + //Handled by complexType +} + + +// --------------------------------------------------------------------------- +// SchemaElementDecl: Getter methods +// --------------------------------------------------------------------------- +inline SchemaElementDecl::ModelTypes SchemaElementDecl::getModelType() const +{ + if (fComplexTypeInfo) { + return (SchemaElementDecl::ModelTypes) fComplexTypeInfo->getContentType(); + } + + return fModelType; +} + +inline PSVIDefs::PSVIScope SchemaElementDecl::getPSVIScope() const +{ + return fPSVIScope; +} + +inline DatatypeValidator* SchemaElementDecl::getDatatypeValidator() const +{ + return fDatatypeValidator; +} + +inline unsigned int SchemaElementDecl::getEnclosingScope() const +{ + return fEnclosingScope; +} + +inline int SchemaElementDecl::getFinalSet() const +{ + return fFinalSet; +} + +inline int SchemaElementDecl::getBlockSet() const +{ + return fBlockSet; +} + +inline int SchemaElementDecl::getMiscFlags() const +{ + return fMiscFlags; +} + +inline XMLCh* SchemaElementDecl::getDefaultValue() const +{ + return fDefaultValue; +} + +inline ComplexTypeInfo* SchemaElementDecl::getComplexTypeInfo() const +{ + return fComplexTypeInfo; +} + +inline const SchemaAttDef* SchemaElementDecl::getAttWildCard() const { + return fAttWildCard; +} + +inline SchemaAttDef* SchemaElementDecl::getAttWildCard() { + return fAttWildCard; +} + +inline bool SchemaElementDecl::isGlobalDecl() const { + + return (fEnclosingScope == Grammar::TOP_LEVEL_SCOPE); +} + +inline SchemaElementDecl* +SchemaElementDecl::getSubstitutionGroupElem() const { + + return fSubstitutionGroupElem; +} + +// --------------------------------------------------------------------------- +// SchemaElementDecl: Setter methods +// --------------------------------------------------------------------------- +inline void +SchemaElementDecl::setModelType(const SchemaElementDecl::ModelTypes toSet) +{ + fModelType = toSet; +} + +inline void +SchemaElementDecl::setPSVIScope(const PSVIDefs::PSVIScope toSet) +{ + fPSVIScope = toSet; +} + +inline void SchemaElementDecl::setDatatypeValidator(DatatypeValidator* newDatatypeValidator) +{ + fDatatypeValidator = newDatatypeValidator; +} + +inline void SchemaElementDecl::setEnclosingScope(const unsigned int newEnclosingScope) +{ + fEnclosingScope = newEnclosingScope; +} + +inline void SchemaElementDecl::setFinalSet(const int finalSet) +{ + fFinalSet = finalSet; +} + +inline void SchemaElementDecl::setBlockSet(const int blockSet) +{ + fBlockSet = blockSet; +} + +inline void SchemaElementDecl::setMiscFlags(const int flags) +{ + fMiscFlags = flags; +} + +inline void SchemaElementDecl::setDefaultValue(const XMLCh* const value) +{ + if (fDefaultValue) { + getMemoryManager()->deallocate(fDefaultValue);//delete[] fDefaultValue; + } + + fDefaultValue = XMLString::replicate(value, getMemoryManager()); +} + +inline void +SchemaElementDecl::setComplexTypeInfo(ComplexTypeInfo* const typeInfo) +{ + fComplexTypeInfo = typeInfo; +} + +inline void +SchemaElementDecl::setAttWildCard(SchemaAttDef* const attWildCard) { + + if (fAttWildCard) + delete fAttWildCard; + + fAttWildCard = attWildCard; +} + +inline void +SchemaElementDecl::setSubstitutionGroupElem(SchemaElementDecl* const elemDecl) { + + fSubstitutionGroupElem = elemDecl; +} + +// --------------------------------------------------------------------------- +// SchemaElementDecl: IC methods +// --------------------------------------------------------------------------- +inline void +SchemaElementDecl::addIdentityConstraint(IdentityConstraint* const ic) { + + if (!fIdentityConstraints) { + fIdentityConstraints = new (getMemoryManager()) RefVectorOf(16, true, getMemoryManager()); + } + + fIdentityConstraints->addElement(ic); +} + +inline XMLSize_t SchemaElementDecl::getIdentityConstraintCount() const { + + if (fIdentityConstraints) { + return fIdentityConstraints->size(); + } + + return 0; +} + +inline IdentityConstraint* +SchemaElementDecl::getIdentityConstraintAt(XMLSize_t index) const { + + if (fIdentityConstraints) { + return fIdentityConstraints->elementAt(index); + } + + return 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.cpp new file mode 100644 index 000000000..636b96ae0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.cpp @@ -0,0 +1,369 @@ +/* + * 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: SchemaGrammar.cpp 883376 2009-11-23 15:45:23Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// SchemaGrammar: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaGrammar::SchemaGrammar(MemoryManager* const manager) : + fTargetNamespace(0) + , fElemDeclPool(0) + , fElemNonDeclPool(0) + , fGroupElemDeclPool(0) + , fNotationDeclPool(0) + , fAttributeDeclRegistry(0) + , fComplexTypeRegistry(0) + , fGroupInfoRegistry(0) + , fAttGroupInfoRegistry(0) + , fValidSubstitutionGroups(0) + , fValidationContext(0) + , fMemoryManager(manager) + , fGramDesc(0) + , fAnnotations(0) + , fValidated(false) + , fDatatypeRegistry(manager) + , fScopeCount (0) + , fAnonTypeCount (0) +{ + CleanupType cleanup(this, &SchemaGrammar::cleanUp); + + // + // Init all the pool members. + // + // Investigate what the optimum values would be for the various + // pools. + // + fElemDeclPool = new (fMemoryManager) RefHash3KeysIdPool(109, true, 128, fMemoryManager); + + try { + // should not be necessary now that grammars, once built, + // are read-only + // fElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + fGroupElemDeclPool = new (fMemoryManager) RefHash3KeysIdPool(109, false, 128, fMemoryManager); + fNotationDeclPool = new (fMemoryManager) NameIdPool(109, 128, fMemoryManager); + fValidationContext = new (fMemoryManager) ValidationContextImpl(fMemoryManager); + + //REVISIT: use grammarPool to create + fGramDesc = new (fMemoryManager) XMLSchemaDescriptionImpl(XMLUni::fgXMLNSURIName, fMemoryManager); + + // Create annotation table + fAnnotations = new (fMemoryManager) RefHashTableOf + ( + 29, true, fMemoryManager + ); + + // + // Call our own reset method. This lets us have the pool setup stuff + // done in just one place (because this stame setup stuff has to be + // done every time we are reset.) + // + reset(); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +SchemaGrammar::~SchemaGrammar() +{ + cleanUp(); +} + + +// ----------------------------------------------------------------------- +// Virtual methods +// ----------------------------------------------------------------------- +XMLElementDecl* SchemaGrammar::findOrAddElemDecl (const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , bool& wasAdded ) +{ + // See it it exists + SchemaElementDecl* retVal = (SchemaElementDecl*) getElemDecl(uriId, baseName, qName, scope); + + // if not, then add this in + if (!retVal) + { + retVal = new (fMemoryManager) SchemaElementDecl + ( + prefixName + , baseName + , uriId + , SchemaElementDecl::Any + , Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + const XMLSize_t elemId = fElemNonDeclPool->put((void*)retVal->getBaseName(), uriId, scope, retVal); + retVal->setId(elemId); + wasAdded = true; + } + else + { + wasAdded = false; + } + return retVal; +} + +XMLElementDecl* SchemaGrammar::putElemDecl (const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const + , unsigned int scope + , const bool notDeclared) +{ + SchemaElementDecl* retVal = new (fMemoryManager) SchemaElementDecl + ( + prefixName + , baseName + , uriId + , SchemaElementDecl::Any + , Grammar::TOP_LEVEL_SCOPE + , fMemoryManager + ); + if(notDeclared) + { + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + retVal->setId(fElemNonDeclPool->put((void*)retVal->getBaseName(), uriId, scope, retVal)); + } else + { + retVal->setId(fElemDeclPool->put((void*)retVal->getBaseName(), uriId, scope, retVal)); + } + return retVal; +} + +void SchemaGrammar::reset() +{ + // + // We need to reset all of the pools. + // + fElemDeclPool->removeAll(); + if(fElemNonDeclPool) + fElemNonDeclPool->removeAll(); + fGroupElemDeclPool->removeAll(); + fNotationDeclPool->removeAll(); + fAnnotations->removeAll(); + fValidated = false; +} + + +void SchemaGrammar::cleanUp() +{ + delete fElemDeclPool; + if(fElemNonDeclPool) + delete fElemNonDeclPool; + delete fGroupElemDeclPool; + delete fNotationDeclPool; + fMemoryManager->deallocate(fTargetNamespace);//delete [] fTargetNamespace; + delete fAttributeDeclRegistry; + delete fComplexTypeRegistry; + delete fGroupInfoRegistry; + delete fAttGroupInfoRegistry; + delete fValidSubstitutionGroups; + delete fValidationContext; + delete fGramDesc; + delete fAnnotations; +} + +void SchemaGrammar::setGrammarDescription(XMLGrammarDescription* gramDesc) +{ + if ((!gramDesc) || + (gramDesc->getGrammarType() != Grammar::SchemaGrammarType)) + return; + + if (fGramDesc) + delete fGramDesc; + + //adopt the grammar Description + fGramDesc = (XMLSchemaDescription*) gramDesc; +} + +// --------------------------------------------------------------------------- +// SchemaGrammar: Helper methods +// --------------------------------------------------------------------------- +void SchemaGrammar::putAnnotation(void* key, XSAnnotation* const annotation) +{ + fAnnotations->put(key, annotation); +} + +void SchemaGrammar::addAnnotation(XSAnnotation* const annotation) +{ + XSAnnotation* lAnnot = fAnnotations->get(this); + + if (lAnnot) + lAnnot->setNext(annotation); + else + fAnnotations->put(this, annotation); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(SchemaGrammar) + +void SchemaGrammar::serialize(XSerializeEngine& serEng) +{ + + /*** + * don't serialize ValidationContext* fValidationContext; + * fElemNonDeclPool + ***/ + + Grammar::serialize(serEng); + + if (serEng.isStoring()) + { + //serialize DatatypeValidatorFactory first + fDatatypeRegistry.serialize(serEng); + + /*** + * + * Serialize RefHash3KeysIdPool* fElemDeclPool; + * Serialize RefHash3KeysIdPool* fGroupElemDeclPool; + * + ***/ + XTemplateSerializer::storeObject(fElemDeclPool, serEng); + XTemplateSerializer::storeObject(fGroupElemDeclPool, serEng); + + /*** + * Serialize NameIdPool* fNotationDeclPool; + ***/ + XTemplateSerializer::storeObject(fNotationDeclPool, serEng); + + /*** + * + * Serialize RefHashTableOf* fAttributeDeclRegistry; + * Serialize RefHashTableOf* fComplexTypeRegistry; + * Serialize RefHashTableOf* fGroupInfoRegistry; + * Serialize RefHashTableOf* fAttGroupInfoRegistry; + * Serialize RefHashTableOf* fIDRefList; + * + ***/ + + XTemplateSerializer::storeObject(fAttributeDeclRegistry, serEng); + XTemplateSerializer::storeObject(fComplexTypeRegistry, serEng); + XTemplateSerializer::storeObject(fGroupInfoRegistry, serEng); + XTemplateSerializer::storeObject(fAttGroupInfoRegistry, serEng); + + /*** + * Serialize RefHash2KeysTableOf* fValidSubstitutionGroups; + ***/ + XTemplateSerializer::storeObject(fValidSubstitutionGroups, serEng); + + /*** + * Serialize RefHashTableOf* fAnnotations; + ***/ + XTemplateSerializer::storeObject(fAnnotations, serEng); + + serEng.writeString(fTargetNamespace); + serEng<serialize(serEng); + + } + else + { + fDatatypeRegistry.serialize(serEng); + + /*** + * + * Deserialize RefHash3KeysIdPool* fElemDeclPool; + * Deserialize RefHash3KeysIdPool* fGroupElemDeclPool; + * + ***/ + XTemplateSerializer::loadObject(&fElemDeclPool, 109, true, 128, serEng); + XTemplateSerializer::loadObject(&fGroupElemDeclPool, 109, true, 128, serEng); + + /*** + * Deserialize NameIdPool* fNotationDeclPool; + ***/ + XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); + + /*** + * + * Deserialize RefHashTableOf* fAttributeDeclRegistry; + * Deserialize RefHashTableOf* fComplexTypeRegistry; + * Deserialize RefHashTableOf* fGroupInfoRegistry; + * Deserialize RefHashTableOf* fAttGroupInfoRegistry; + * Deserialize RefHashTableOf* fIDRefList; + * + ***/ + + XTemplateSerializer::loadObject(&fAttributeDeclRegistry, 29, true, serEng); + XTemplateSerializer::loadObject(&fComplexTypeRegistry, 29, true, serEng); + XTemplateSerializer::loadObject(&fGroupInfoRegistry, 13, true, serEng); + XTemplateSerializer::loadObject(&fAttGroupInfoRegistry, 13, true, serEng); + + /*** + * Deserialize RefHash2KeysTableOf* fValidSubstitutionGroups; + ***/ + XTemplateSerializer::loadObject(&fValidSubstitutionGroups, 29, true, serEng); + + /*** + * Deserialize RefHashTableOf* fAnnotations; + ***/ + XTemplateSerializer::loadObject(&fAnnotations, 29, true, serEng); + + serEng.readString(fTargetNamespace); + serEng>>fValidated; + + /*** + * serialize() method shall be used to load object + * which has been created in ctor + ***/ + fGramDesc->serialize(serEng); + + } +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.hpp new file mode 100644 index 000000000..a06062a5f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaGrammar.hpp @@ -0,0 +1,638 @@ +/* + * 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: SchemaGrammar.hpp 883376 2009-11-23 15:45:23Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAGRAMMAR_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAGRAMMAR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// This class stores the Schema information +// NOTE: Schemas are not namespace aware, so we just use regular NameIdPool +// data structures to store element and attribute decls. They are all set +// to be in the global namespace and the full QName is used as the base name +// of the decl. This means that all the URI parameters below are expected +// to be null pointers (and anything else will cause an exception.) +// + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class ComplexTypeInfo; +class XercesGroupInfo; +class XercesAttGroupInfo; +class XSAnnotation; + +// --------------------------------------------------------------------------- +// typedef declaration +// --------------------------------------------------------------------------- +typedef ValueVectorOf ElemVector; + + +class VALIDATORS_EXPORT SchemaGrammar : public Grammar +{ +public: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + SchemaGrammar(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~SchemaGrammar(); + + // ----------------------------------------------------------------------- + // Implementation of Virtual Interface + // ----------------------------------------------------------------------- + virtual Grammar::GrammarType getGrammarType() const; + virtual const XMLCh* getTargetNamespace() const; + + // this method should only be used while the grammar is being + // constructed, not while it is being used + // in a validation episode! + virtual XMLElementDecl* findOrAddElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , bool& wasAdded + ) ; + + virtual XMLSize_t getElemId + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const ; + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ) const ; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const qName + , unsigned int scope + ); + + virtual const XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ) const; + + virtual XMLElementDecl* getElemDecl + ( + const unsigned int elemId + ); + + virtual const XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + ) const; + + virtual XMLNotationDecl* getNotationDecl + ( + const XMLCh* const notName + ); + + virtual bool getValidated() const; + + virtual XMLElementDecl* putElemDecl + ( + const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const prefixName + , const XMLCh* const qName + , unsigned int scope + , const bool notDeclared = false + ); + + virtual XMLSize_t putElemDecl + ( + XMLElementDecl* const elemDecl + , const bool notDeclared = false + ) ; + + virtual XMLSize_t putNotationDecl + ( + XMLNotationDecl* const notationDecl + ) const; + + virtual void setValidated(const bool newState); + + virtual void reset(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + RefHash3KeysIdPoolEnumerator getElemEnumerator() const; + NameIdPoolEnumerator getNotationEnumerator() const; + RefHashTableOf* getAttributeDeclRegistry() const; + RefHashTableOf* getComplexTypeRegistry() const; + RefHashTableOf* getGroupInfoRegistry() const; + RefHashTableOf* getAttGroupInfoRegistry() const; + DatatypeValidatorFactory* getDatatypeRegistry(); + RefHash2KeysTableOf* getValidSubstitutionGroups() const; + + // @deprecated + ValidationContext* getValidationContext() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setTargetNamespace(const XMLCh* const targetNamespace); + void setAttributeDeclRegistry(RefHashTableOf* const attReg); + void setComplexTypeRegistry(RefHashTableOf* const other); + void setGroupInfoRegistry(RefHashTableOf* const other); + void setAttGroupInfoRegistry(RefHashTableOf* const other); + void setValidSubstitutionGroups(RefHash2KeysTableOf* const); + + virtual void setGrammarDescription( XMLGrammarDescription*); + virtual XMLGrammarDescription* getGrammarDescription() const; + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + XMLSize_t putGroupElemDecl + ( + XMLElementDecl* const elemDecl + ) const; + + // ----------------------------------------------------------------------- + // Annotation management methods + // ----------------------------------------------------------------------- + /** + * Add annotation to the list of annotations for a given key + */ + void putAnnotation(void* key, XSAnnotation* const annotation); + + /** + * Add global annotation + * + * Note: XSAnnotation acts as a linked list + */ + void addAnnotation(XSAnnotation* const annotation); + + /** + * Retrieve the annotation that is associated with the specified key + * + * @param key represents a schema component object (i.e. SchemaGrammar) + * @return XSAnnotation associated with the key object + */ + XSAnnotation* getAnnotation(const void* const key); + + /** + * Retrieve the annotation that is associated with the specified key + * + * @param key represents a schema component object (i.e. SchemaGrammar) + * @return XSAnnotation associated with the key object + */ + const XSAnnotation* getAnnotation(const void* const key) const; + + /** + * Get global annotation + */ + XSAnnotation* getAnnotation(); + const XSAnnotation* getAnnotation() const; + + /** + * Get annotation hash table, to enumerate through them + */ + RefHashTableOf* getAnnotations(); + const RefHashTableOf* getAnnotations() const; + + /** + * Get/set scope count. + */ + unsigned int getScopeCount () const; + void setScopeCount (unsigned int); + + /** + * Get/set anonymous type count. + */ + unsigned int getAnonTypeCount () const; + void setAnonTypeCount (unsigned int); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(SchemaGrammar) + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaGrammar(const SchemaGrammar&); + SchemaGrammar& operator=(const SchemaGrammar&); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Private data members + // + // fElemDeclPool + // This is the element decl pool. It contains all of the elements + // declared in the Schema (and their associated attributes.) + // + // fElemNonDeclPool + // This is the element decl pool that is is populated as new elements + // are seen in the XML document (not declared in the Schema), and they + // are given default characteristics. + // + // fGroupElemDeclPool + // This is the element decl pool for elements in a group that are + // referenced in different scope. It contains all of the elements + // declared in the Schema (and their associated attributes.) + // + // fNotationDeclPool + // This is a pool of NotationDecl objects, which contains all of the + // notations declared in the Schema. + // + // fTargetNamespace + // Target name space for this grammar. + // + // fAttributeDeclRegistry + // Global attribute declarations + // + // fComplexTypeRegistry + // Stores complexType declaration info + // + // fGroupInfoRegistry + // Stores global declaration info + // + // fAttGroupInfoRegistry + // Stores global declaration info + // + // fDatatypeRegistry + // Datatype validator factory + // + // fValidSubstitutionGroups + // Valid list of elements that can substitute a given element + // + // fIDRefList + // List of ids of schema declarations extracted during schema grammar + // traversal + // + // fValidated + // Indicates if the content of the Grammar has been pre-validated + // or not (UPA checking, etc.). When using a cached grammar, no need + // for pre content validation. + // + // fGramDesc: adopted + // + // ----------------------------------------------------------------------- + XMLCh* fTargetNamespace; + RefHash3KeysIdPool* fElemDeclPool; + RefHash3KeysIdPool* fElemNonDeclPool; + RefHash3KeysIdPool* fGroupElemDeclPool; + NameIdPool* fNotationDeclPool; + RefHashTableOf* fAttributeDeclRegistry; + RefHashTableOf* fComplexTypeRegistry; + RefHashTableOf* fGroupInfoRegistry; + RefHashTableOf* fAttGroupInfoRegistry; + RefHash2KeysTableOf* fValidSubstitutionGroups; + // @deprecated + ValidationContext* fValidationContext; + MemoryManager* fMemoryManager; + XMLSchemaDescription* fGramDesc; + RefHashTableOf* fAnnotations; + + bool fValidated; + DatatypeValidatorFactory fDatatypeRegistry; + + unsigned int fScopeCount; + unsigned int fAnonTypeCount; +}; + + +// --------------------------------------------------------------------------- +// SchemaGrammar: Getter methods +// --------------------------------------------------------------------------- +inline RefHash3KeysIdPoolEnumerator +SchemaGrammar::getElemEnumerator() const +{ + return RefHash3KeysIdPoolEnumerator(fElemDeclPool, false, fMemoryManager); +} + +inline NameIdPoolEnumerator +SchemaGrammar::getNotationEnumerator() const +{ + return NameIdPoolEnumerator(fNotationDeclPool, fMemoryManager); +} + +inline RefHashTableOf* SchemaGrammar::getAttributeDeclRegistry() const { + + return fAttributeDeclRegistry; +} + +inline RefHashTableOf* +SchemaGrammar::getComplexTypeRegistry() const { + + return fComplexTypeRegistry; +} + +inline RefHashTableOf* +SchemaGrammar::getGroupInfoRegistry() const { + + return fGroupInfoRegistry; +} + +inline RefHashTableOf* +SchemaGrammar::getAttGroupInfoRegistry() const { + + return fAttGroupInfoRegistry; +} + +inline DatatypeValidatorFactory* SchemaGrammar::getDatatypeRegistry() { + + return &fDatatypeRegistry; +} + +inline RefHash2KeysTableOf* +SchemaGrammar::getValidSubstitutionGroups() const { + + return fValidSubstitutionGroups; +} + +// @deprecated +inline ValidationContext* SchemaGrammar::getValidationContext() const { + + return fValidationContext; +} + +inline XMLGrammarDescription* SchemaGrammar::getGrammarDescription() const +{ + return fGramDesc; +} + +inline XSAnnotation* SchemaGrammar::getAnnotation(const void* const key) +{ + return fAnnotations->get(key); +} + +inline const XSAnnotation* SchemaGrammar::getAnnotation(const void* const key) const +{ + return fAnnotations->get(key); +} + +inline XSAnnotation* SchemaGrammar::getAnnotation() +{ + return fAnnotations->get(this); +} + +inline const XSAnnotation* SchemaGrammar::getAnnotation() const +{ + return fAnnotations->get(this); +} + +inline RefHashTableOf* SchemaGrammar::getAnnotations() +{ + return fAnnotations; +} + +inline const RefHashTableOf* SchemaGrammar::getAnnotations() const +{ + return fAnnotations; +} +// ----------------------------------------------------------------------- +// Setter methods +// ----------------------------------------------------------------------- +inline void SchemaGrammar::setTargetNamespace(const XMLCh* const targetNamespace) +{ + if (fTargetNamespace) + fMemoryManager->deallocate(fTargetNamespace);//delete [] fTargetNamespace; + fTargetNamespace = XMLString::replicate(targetNamespace, fMemoryManager); +} + +inline void +SchemaGrammar::setAttributeDeclRegistry(RefHashTableOf* const attReg) { + + fAttributeDeclRegistry = attReg; +} + +inline void +SchemaGrammar::setComplexTypeRegistry(RefHashTableOf* const other) { + + fComplexTypeRegistry = other; +} + +inline void +SchemaGrammar::setGroupInfoRegistry(RefHashTableOf* const other) { + + fGroupInfoRegistry = other; +} + +inline void +SchemaGrammar::setAttGroupInfoRegistry(RefHashTableOf* const other) { + + fAttGroupInfoRegistry = other; +} + +inline void +SchemaGrammar::setValidSubstitutionGroups(RefHash2KeysTableOf* const other) { + + fValidSubstitutionGroups = other; +} + + +// --------------------------------------------------------------------------- +// SchemaGrammar: Virtual methods +// --------------------------------------------------------------------------- +inline Grammar::GrammarType SchemaGrammar::getGrammarType() const { + return Grammar::SchemaGrammarType; +} + +inline const XMLCh* SchemaGrammar::getTargetNamespace() const { + return fTargetNamespace; +} + +// Element Decl +inline XMLSize_t SchemaGrammar::getElemId (const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const + , unsigned int scope ) const +{ + // + // In this case, we don't return zero to mean 'not found', so we have to + // map it to the official not found value if we don't find it. + // + const SchemaElementDecl* decl = fElemDeclPool->getByKey(baseName, uriId, scope); + if (!decl) { + + decl = fGroupElemDeclPool->getByKey(baseName, uriId, scope); + + if (!decl) + return XMLElementDecl::fgInvalidElemId; + } + return decl->getId(); +} + +inline const XMLElementDecl* SchemaGrammar::getElemDecl( const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const + , unsigned int scope ) const +{ + const SchemaElementDecl* decl = fElemDeclPool->getByKey(baseName, uriId, scope); + + if (!decl) { + + decl = fGroupElemDeclPool->getByKey(baseName, uriId, scope); + + if (!decl && fElemNonDeclPool) + decl = fElemNonDeclPool->getByKey(baseName, uriId, scope); + } + + return decl; +} + +inline XMLElementDecl* SchemaGrammar::getElemDecl (const unsigned int uriId + , const XMLCh* const baseName + , const XMLCh* const + , unsigned int scope ) +{ + SchemaElementDecl* decl = fElemDeclPool->getByKey(baseName, uriId, scope); + + if (!decl) { + + decl = fGroupElemDeclPool->getByKey(baseName, uriId, scope); + + if (!decl && fElemNonDeclPool) + decl = fElemNonDeclPool->getByKey(baseName, uriId, scope); + } + + return decl; +} + +inline const XMLElementDecl* SchemaGrammar::getElemDecl(const unsigned int elemId) const +{ + // Look up this element decl by id + const SchemaElementDecl* decl = fElemDeclPool->getById(elemId); + + if (!decl) + decl = fGroupElemDeclPool->getById(elemId); + + return decl; +} + +inline XMLElementDecl* SchemaGrammar::getElemDecl(const unsigned int elemId) +{ + // Look up this element decl by id + SchemaElementDecl* decl = fElemDeclPool->getById(elemId); + + if (!decl) + decl = fGroupElemDeclPool->getById(elemId); + + return decl; +} + +inline XMLSize_t +SchemaGrammar::putElemDecl(XMLElementDecl* const elemDecl, + const bool notDeclared) +{ + if (notDeclared) + { + if(!fElemNonDeclPool) + fElemNonDeclPool = new (fMemoryManager) RefHash3KeysIdPool(29, true, 128, fMemoryManager); + return fElemNonDeclPool->put(elemDecl->getBaseName(), elemDecl->getURI(), ((SchemaElementDecl* )elemDecl)->getEnclosingScope(), (SchemaElementDecl*) elemDecl); + } + + return fElemDeclPool->put(elemDecl->getBaseName(), elemDecl->getURI(), ((SchemaElementDecl* )elemDecl)->getEnclosingScope(), (SchemaElementDecl*) elemDecl); +} + +inline XMLSize_t SchemaGrammar::putGroupElemDecl (XMLElementDecl* const elemDecl) const +{ + return fGroupElemDeclPool->put(elemDecl->getBaseName(), elemDecl->getURI(), ((SchemaElementDecl* )elemDecl)->getEnclosingScope(), (SchemaElementDecl*) elemDecl); +} + +// Notation Decl +inline const XMLNotationDecl* SchemaGrammar::getNotationDecl(const XMLCh* const notName) const +{ + return fNotationDeclPool->getByKey(notName); +} + +inline XMLNotationDecl* SchemaGrammar::getNotationDecl(const XMLCh* const notName) +{ + return fNotationDeclPool->getByKey(notName); +} + +inline XMLSize_t SchemaGrammar::putNotationDecl(XMLNotationDecl* const notationDecl) const +{ + return fNotationDeclPool->put(notationDecl); +} + +inline bool SchemaGrammar::getValidated() const +{ + return fValidated; +} + +inline void SchemaGrammar::setValidated(const bool newState) +{ + fValidated = newState; +} + +inline unsigned int +SchemaGrammar::getScopeCount () const +{ + return fScopeCount; +} + +inline void +SchemaGrammar::setScopeCount (unsigned int scopeCount) +{ + fScopeCount = scopeCount; +} + +inline unsigned int +SchemaGrammar::getAnonTypeCount () const +{ + return fAnonTypeCount; +} + +inline void +SchemaGrammar::setAnonTypeCount (unsigned int count) +{ + fAnonTypeCount = count; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.cpp new file mode 100644 index 000000000..cb6feaff6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.cpp @@ -0,0 +1,251 @@ +/* + * 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: SchemaInfo.cpp 925236 2010-03-19 14:29:47Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaInfo::SchemaInfo(const unsigned short elemAttrDefaultQualified, + const int blockDefault, + const int finalDefault, + const int targetNSURI, + const NamespaceScope* const currNamespaceScope, + const XMLCh* const schemaURL, + const XMLCh* const targetNSURIString, + const DOMElement* const root, + XMLScanner* xmlScanner, + MemoryManager* const manager) + : fAdoptInclude(false) + , fProcessed(false) + , fElemAttrDefaultQualified(elemAttrDefaultQualified) + , fBlockDefault(blockDefault) + , fFinalDefault(finalDefault) + , fTargetNSURI(targetNSURI) + , fNamespaceScope(0) + , fSchemaRootElement(root) + , fIncludeInfoList(0) + , fImportedInfoList(0) + , fImportingInfoList(0) + , fFailedRedefineList(0) + , fRecursingAnonTypes(0) + , fRecursingTypeNames(0) + , fNonXSAttList(0) + , fValidationContext(0) + , fMemoryManager(manager) +{ + fImportingInfoList = new (fMemoryManager) RefVectorOf(4, false, fMemoryManager); + + memset( + fTopLevelComponents, + 0, + sizeof(fTopLevelComponents[0]) * C_Count); + memset( + fLastTopLevelComponent, + 0, + sizeof(fLastTopLevelComponent[0]) * C_Count); + + fNonXSAttList = new (fMemoryManager) ValueVectorOf(2, fMemoryManager); + fValidationContext = new (fMemoryManager) ValidationContextImpl(fMemoryManager); + fNamespaceScope = new (fMemoryManager) NamespaceScope(currNamespaceScope, fMemoryManager); + fCurrentSchemaURL = XMLString::replicate(schemaURL, fMemoryManager); + fTargetNSURIString = XMLString::replicate(targetNSURIString, fMemoryManager); + + fValidationContext->setScanner (xmlScanner); + fValidationContext->setNamespaceScope(fNamespaceScope); +} + + +SchemaInfo::~SchemaInfo() +{ + fMemoryManager->deallocate(fCurrentSchemaURL);//delete [] fCurrentSchemaURL; + fMemoryManager->deallocate(fTargetNSURIString); + delete fImportedInfoList; + + if (fAdoptInclude) + delete fIncludeInfoList; + + delete fImportingInfoList; + delete fFailedRedefineList; + delete fRecursingAnonTypes; + delete fRecursingTypeNames; + + for (unsigned int i = 0; i < C_Count; i++) { + delete fTopLevelComponents[i]; + } + + delete fNonXSAttList; + delete fValidationContext; + delete fNamespaceScope; +} + +// --------------------------------------------------------------------------- +// SchemaInfo: +// --------------------------------------------------------------------------- +DOMElement* +SchemaInfo::getTopLevelComponent(const unsigned short compCategory, + const XMLCh* const compName, + const XMLCh* const name, + SchemaInfo** enclosingSchema) { + + if (fSchemaRootElement == 0) + return 0; + + SchemaInfo* currentInfo = this; + DOMElement* child = getTopLevelComponent(compCategory, compName, name); + + if (child == 0) { + + XMLSize_t listSize = (fIncludeInfoList) ? fIncludeInfoList->size() : 0; + + for (XMLSize_t i=0; i < listSize; i++) { + + currentInfo = fIncludeInfoList->elementAt(i); + + if (currentInfo == this) + continue; + + child = currentInfo->getTopLevelComponent(compCategory, compName, name); + + if (child != 0) { + + *enclosingSchema = currentInfo; + break; + } + } + } + + return child; +} + + +DOMElement* +SchemaInfo::getTopLevelComponent(const unsigned short compCategory, + const XMLCh* const compName, + const XMLCh* const name) { + + if (fSchemaRootElement == 0 || compCategory >= C_Count) + return 0; + + DOMElement* child = XUtil::getFirstChildElement(fSchemaRootElement); + + if (!child) + return 0; + + RefHashTableOf* compList = fTopLevelComponents[compCategory]; + + if (fTopLevelComponents[compCategory] == 0) { + + compList= new (fMemoryManager) RefHashTableOf(17, false, fMemoryManager); + fTopLevelComponents[compCategory] = compList; + } + else { + DOMElement* cachedChild = compList->get(name); + if(cachedChild) + return cachedChild; + + child = fLastTopLevelComponent[compCategory]; + } + + DOMElement* redefParent = (DOMElement*) child->getParentNode(); + + // Parent is not "redefine" + if (!XMLString::equals(redefParent->getLocalName(),SchemaSymbols::fgELT_REDEFINE)) + redefParent = 0; + + while (child != 0) { + + fLastTopLevelComponent[compCategory]=child; + if (XMLString::equals(child->getLocalName(), compName)) { + + const XMLCh* cName=child->getAttribute(SchemaSymbols::fgATT_NAME); + compList->put((void*)cName, child); + + if (XMLString::equals(cName, name)) + return child; + } + else if (XMLString::equals(child->getLocalName(),SchemaSymbols::fgELT_REDEFINE) + && (!fFailedRedefineList || !fFailedRedefineList->containsElement(child))) { // if redefine + + DOMElement* redefineChild = XUtil::getFirstChildElement(child); + + while (redefineChild != 0) { + + fLastTopLevelComponent[compCategory]=redefineChild; + if ((!fFailedRedefineList || !fFailedRedefineList->containsElement(redefineChild)) + && XMLString::equals(redefineChild->getLocalName(), compName)) { + + const XMLCh* rName=redefineChild->getAttribute(SchemaSymbols::fgATT_NAME); + compList->put((void*)rName, redefineChild); + + if (XMLString::equals(rName, name)) + return redefineChild; + } + + redefineChild = XUtil::getNextSiblingElement(redefineChild); + } + } + + child = XUtil::getNextSiblingElement(child); + + if (child == 0 && redefParent) { + + child = XUtil::getNextSiblingElement(redefParent); + redefParent = 0; + } + } + + return child; +} + +void SchemaInfo::updateImportingInfo(SchemaInfo* const importingInfo) { + + if (!fImportingInfoList->containsElement(importingInfo)) { + fImportingInfoList->addElement(importingInfo); + } + + XMLSize_t listSize = importingInfo->fImportingInfoList->size(); + + for (XMLSize_t i=0; i < listSize; i++) { + + SchemaInfo* tmpInfo = importingInfo->fImportingInfoList->elementAt(i); + + if (tmpInfo != this && !fImportingInfoList->containsElement(tmpInfo)) { + fImportingInfoList->addElement(tmpInfo); + } + } +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file SchemaInfo.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.hpp new file mode 100644 index 000000000..9dad859c8 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaInfo.hpp @@ -0,0 +1,432 @@ +/* + * 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: SchemaInfo.hpp 925236 2010-03-19 14:29:47Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAINFO_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAINFO_HPP + + +/** When in a , type definitions being used (and indeed + * refs to 's and 's) may refer to info + * items either in the schema being redefined, in the , + * or else in the schema doing the redefining. Because of this + * latter we have to be prepared sometimes to look for our type + * definitions outside the schema stored in fSchemaRootElement. + * This simple class does this; it's just a linked list that + * lets us look at the 's on the queue; note also that this + * should provide us with a mechanism to handle nested 's. + * It's also a handy way of saving schema info when importing/including. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class XMLScanner; +class ValidationContext; +class NamespaceScope; + +class VALIDATORS_EXPORT SchemaInfo : public XMemory +{ +public: + + enum ListType { + // Redefine is treated as an include + IMPORT = 1, + INCLUDE = 2 + }; + + enum { + C_ComplexType, + C_SimpleType, + C_Group, + C_Attribute, + C_AttributeGroup, + C_Element, + C_Notation, + + C_Count + }; + + // ----------------------------------------------------------------------- + // Constructor/Destructor + // ----------------------------------------------------------------------- + SchemaInfo(const unsigned short fElemAttrDefaultQualified, + const int blockDefault, + const int finalDefault, + const int targetNSURI, + const NamespaceScope* const currNamespaceScope, + const XMLCh* const schemaURL, + const XMLCh* const targetNSURIString, + const DOMElement* const root, + XMLScanner* xmlScanner, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~SchemaInfo(); + + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XMLCh* getCurrentSchemaURL() const; + const XMLCh* getTargetNSURIString() const; + const DOMElement* getRoot() const; + bool getProcessed() const; + int getBlockDefault() const; + int getFinalDefault() const; + int getTargetNSURI() const; + NamespaceScope* getNamespaceScope() const; + unsigned short getElemAttrDefaultQualified() const; + BaseRefVectorEnumerator getImportingListEnumerator() const; + ValueVectorOf* getRecursingAnonTypes() const; + ValueVectorOf* getRecursingTypeNames() const; + ValueVectorOf* getNonXSAttList() const; + ValidationContext* getValidationContext() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setProcessed(const bool aValue = true); + void setBlockDefault(const int aValue); + void setFinalDefault(const int aValue); + void setElemAttrDefaultQualified(const unsigned short aValue); + void resetRoot (); + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + void addSchemaInfo(SchemaInfo* const toAdd, const ListType aListType); + bool containsInfo(const SchemaInfo* const toCheck, const ListType aListType) const; + SchemaInfo* getImportInfo(const unsigned int namespaceURI) const; + DOMElement* getTopLevelComponent(const unsigned short compCategory, + const XMLCh* const compName, + const XMLCh* const name); + DOMElement* getTopLevelComponent(const unsigned short compCategory, + const XMLCh* const compName, + const XMLCh* const name, + SchemaInfo** enclosingSchema); + void updateImportingInfo(SchemaInfo* const importingInfo); + bool circularImportExist(const unsigned int nameSpaceURI); + bool isFailedRedefine(const DOMElement* const anElem); + void addFailedRedefine(const DOMElement* const anElem); + void addRecursingType(const DOMElement* const elem, const XMLCh* const name); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaInfo(const SchemaInfo&); + SchemaInfo& operator=(const SchemaInfo&); + + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void clearTopLevelComponents(); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fAdoptInclude; + bool fProcessed; + unsigned short fElemAttrDefaultQualified; + int fBlockDefault; + int fFinalDefault; + int fTargetNSURI; + NamespaceScope* fNamespaceScope; + XMLCh* fCurrentSchemaURL; + XMLCh* fTargetNSURIString; + const DOMElement* fSchemaRootElement; + RefVectorOf* fIncludeInfoList; + RefVectorOf* fImportedInfoList; + RefVectorOf* fImportingInfoList; + ValueVectorOf* fFailedRedefineList; + ValueVectorOf* fRecursingAnonTypes; + ValueVectorOf* fRecursingTypeNames; + RefHashTableOf* fTopLevelComponents[C_Count]; + DOMElement* fLastTopLevelComponent[C_Count]; + ValueVectorOf* fNonXSAttList; + ValidationContext* fValidationContext; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// SchemaInfo: Getter methods +// --------------------------------------------------------------------------- +inline unsigned short SchemaInfo::getElemAttrDefaultQualified() const { + + return fElemAttrDefaultQualified; +} + +inline bool SchemaInfo::getProcessed() const { + + return fProcessed; +} + +inline int SchemaInfo::getBlockDefault() const { + + return fBlockDefault; +} + +inline int SchemaInfo::getFinalDefault() const { + + return fFinalDefault; +} + +inline NamespaceScope* SchemaInfo::getNamespaceScope() const { + return fNamespaceScope; +} + +inline XMLCh* SchemaInfo::getCurrentSchemaURL() const { + + return fCurrentSchemaURL; +} + +inline const XMLCh* SchemaInfo::getTargetNSURIString() const { + + return fTargetNSURIString; +} + +inline const DOMElement* SchemaInfo::getRoot() const { + + return fSchemaRootElement; +} + +inline int SchemaInfo::getTargetNSURI() const { + + return fTargetNSURI; +} + +inline BaseRefVectorEnumerator +SchemaInfo::getImportingListEnumerator() const { + + return BaseRefVectorEnumerator(fImportingInfoList); +} + +inline ValueVectorOf* +SchemaInfo::getRecursingAnonTypes() const { + + return fRecursingAnonTypes; +} + + +inline ValueVectorOf* +SchemaInfo::getRecursingTypeNames() const { + + return fRecursingTypeNames; +} + +inline ValueVectorOf* SchemaInfo::getNonXSAttList() const +{ + return fNonXSAttList; +} + +// --------------------------------------------------------------------------- +// Setter methods +// --------------------------------------------------------------------------- +inline void SchemaInfo::setBlockDefault(const int aValue) { + + fBlockDefault = aValue; +} + +inline void SchemaInfo::setFinalDefault(const int aValue) { + + fFinalDefault = aValue; +} + +inline void SchemaInfo::setElemAttrDefaultQualified(const unsigned short aValue) { + + fElemAttrDefaultQualified = aValue; +} + +inline void SchemaInfo::setProcessed(const bool aValue) { + + fProcessed = aValue; + +/* if (fProcessed && fIncludeInfoList) { + + unsigned int includeListLen = fIncludeInfoList->size()); + for (unsigned int i = 0; i < includeListLen; i++) { + fIncludeInfoList->elementAt(i)->clearTopLevelComponents(); + } + }*/ +} + +inline void SchemaInfo::resetRoot () +{ + fSchemaRootElement = 0; +} + +// --------------------------------------------------------------------------- +// SchemaInfo: Access methods +// --------------------------------------------------------------------------- +inline void SchemaInfo::addSchemaInfo(SchemaInfo* const toAdd, + const ListType aListType) { + + if (aListType == IMPORT) { + + if (!fImportedInfoList) + fImportedInfoList = new (fMemoryManager) RefVectorOf(4, false, fMemoryManager); + + if (!fImportedInfoList->containsElement(toAdd)) { + + fImportedInfoList->addElement(toAdd); + toAdd->updateImportingInfo(this); + } + } + else { + + if (!fIncludeInfoList) { + + fIncludeInfoList = new (fMemoryManager) RefVectorOf(8, false, fMemoryManager); + fAdoptInclude = true; + } + + if (!fIncludeInfoList->containsElement(toAdd)) { + + fIncludeInfoList->addElement(toAdd); + //code was originally: + //toAdd->fIncludeInfoList = fIncludeInfoList; + //however for handling multiple imports this was causing + //to schemaInfo's to have the same fIncludeInfoList which they + //both owned so when it was deleted it crashed. + if (toAdd->fIncludeInfoList) { + if (toAdd->fIncludeInfoList != fIncludeInfoList) { + XMLSize_t size = toAdd->fIncludeInfoList->size(); + for (XMLSize_t i=0; icontainsElement(toAdd->fIncludeInfoList->elementAt(i))) { + fIncludeInfoList->addElement(toAdd->fIncludeInfoList->elementAt(i)); + } + } + size = fIncludeInfoList->size(); + for (XMLSize_t j=0; jfIncludeInfoList->containsElement(fIncludeInfoList->elementAt(j))) { + toAdd->fIncludeInfoList->addElement(fIncludeInfoList->elementAt(j)); + } + } + } + } + else { + toAdd->fIncludeInfoList = fIncludeInfoList; + } + } + } +} + +inline SchemaInfo* SchemaInfo::getImportInfo(const unsigned int namespaceURI) const { + + XMLSize_t importSize = (fImportedInfoList) ? fImportedInfoList->size() : 0; + SchemaInfo* currInfo = 0; + + for (XMLSize_t i=0; i < importSize; i++) { + + currInfo = fImportedInfoList->elementAt(i); + + if (currInfo->getTargetNSURI() == (int) namespaceURI) + return currInfo; + } + + return 0; +} + +inline ValidationContext* SchemaInfo::getValidationContext() const { + + return fValidationContext; +} + +inline bool SchemaInfo::containsInfo(const SchemaInfo* const toCheck, + const ListType aListType) const { + + if ((aListType == INCLUDE) && fIncludeInfoList) { + return fIncludeInfoList->containsElement(toCheck); + } + else if ((aListType == IMPORT) && fImportedInfoList) { + return fImportedInfoList->containsElement(toCheck); + } + + return false; +} + +inline bool SchemaInfo::circularImportExist(const unsigned int namespaceURI) { + + XMLSize_t importSize = fImportingInfoList->size(); + + for (XMLSize_t i=0; i < importSize; i++) { + if (fImportingInfoList->elementAt(i)->getTargetNSURI() == (int) namespaceURI) { + return true; + } + } + + return false; +} + +inline bool SchemaInfo::isFailedRedefine(const DOMElement* const anElem) { + + if (fFailedRedefineList) + return (fFailedRedefineList->containsElement(anElem)); + + return false; +} + +inline void SchemaInfo::addFailedRedefine(const DOMElement* const anElem) { + + if (!fFailedRedefineList) { + fFailedRedefineList = new (fMemoryManager) ValueVectorOf(4, fMemoryManager); + } + + fFailedRedefineList->addElement(anElem); +} + +inline void SchemaInfo::addRecursingType(const DOMElement* const elem, + const XMLCh* const name) { + + if (!fRecursingAnonTypes) { + fRecursingAnonTypes = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + fRecursingTypeNames = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + } + + fRecursingAnonTypes->addElement(elem); + fRecursingTypeNames->addElement(name); +} + +inline void SchemaInfo::clearTopLevelComponents() { + + for (unsigned int i = 0; i < C_Count; i++) { + + delete fTopLevelComponents[i]; + fTopLevelComponents[i] = 0; + fLastTopLevelComponent[i] = 0; + } +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file SchemaInfo.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.cpp new file mode 100644 index 000000000..3294c9024 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.cpp @@ -0,0 +1,1022 @@ +/* + * 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: SchemaSymbols.cpp 802804 2009-08-10 14:21:48Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaSymbols: Static data +// --------------------------------------------------------------------------- +const XMLCh SchemaSymbols::fgURI_XSI[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, + chForwardSlash, chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, + chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash, + chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, + chLatin_X, chLatin_M, chLatin_L, chLatin_S, + chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chDash, chLatin_i, + chLatin_n, chLatin_s, chLatin_t, chLatin_a, chLatin_n, chLatin_c, + chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgURI_SCHEMAFORSCHEMA[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, + chForwardSlash, chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, + chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash, + chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, + chLatin_X, chLatin_M, chLatin_L, chLatin_S, + chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chNull +}; + +// deprecated (typo) +const XMLCh SchemaSymbols::fgXSI_SCHEMALOCACTION[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, + chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +// deprecated (typo) +const XMLCh SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCACTION[] = +{ + chLatin_n, chLatin_o, chLatin_N, chLatin_a, chLatin_m, chLatin_e, + chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_S, + chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_L, + chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, + chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgXSI_SCHEMALOCATION[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, + chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCATION[] = +{ + chLatin_n, chLatin_o, chLatin_N, chLatin_a, chLatin_m, chLatin_e, + chLatin_s, chLatin_p, chLatin_a, chLatin_c, chLatin_e, chLatin_S, + chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_L, + chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, + chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgXSI_TYPE[] = +{ + chLatin_t, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ALL[] = +{ + chLatin_a, chLatin_l, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ANNOTATION[] = +{ + chLatin_a, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, + chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ANY[] = +{ + chLatin_a, chLatin_n, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgELT_WILDCARD[] = +{ + chLatin_a, chLatin_n, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ANYATTRIBUTE[] = +{ + chLatin_a, chLatin_n, chLatin_y, chLatin_A, chLatin_t, chLatin_t, + chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_APPINFO[] = +{ + chLatin_a, chLatin_p, chLatin_p, chLatin_i, chLatin_n, chLatin_f, chLatin_o, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ATTRIBUTE[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, + chLatin_u, chLatin_t, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ATTRIBUTEGROUP[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, + chLatin_u, chLatin_t, chLatin_e, chLatin_G, chLatin_r, chLatin_o, + chLatin_u, chLatin_p, chNull +}; + +const XMLCh SchemaSymbols::fgELT_CHOICE[] = +{ + chLatin_c, chLatin_h, chLatin_o, chLatin_i, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_COMPLEXTYPE[] = +{ + chLatin_c, chLatin_o, chLatin_m, chLatin_p, chLatin_l, chLatin_e, + chLatin_x, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_CONTENT[] = +{ + chLatin_c, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, + chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_DOCUMENTATION[] = +{ + chLatin_d, chLatin_o, chLatin_c, chLatin_u, chLatin_m, chLatin_e, chLatin_n, + chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_DURATION[] = +{ + chLatin_d, chLatin_u, chLatin_r, chLatin_a, chLatin_t, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ELEMENT[] = +{ + chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, + chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ENCODING[] = +{ + chLatin_e, chLatin_n, chLatin_c, chLatin_o, chLatin_d, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgELT_ENUMERATION[] = +{ + chLatin_e, chLatin_n, chLatin_u, chLatin_m, chLatin_e, chLatin_r, + chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_FIELD[] = +{ + chLatin_f, chLatin_i, chLatin_e, chLatin_l, chLatin_d, chNull +}; + + +const XMLCh SchemaSymbols::fgELT_WHITESPACE[] = +{ + chLatin_w, chLatin_h, chLatin_i, chLatin_t, chLatin_e, chLatin_S, + chLatin_p, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_GROUP[] = +{ + chLatin_g, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chNull +}; + +const XMLCh SchemaSymbols::fgELT_IMPORT[] = +{ + chLatin_i, chLatin_m, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_INCLUDE[] = +{ + chLatin_i, chLatin_n, chLatin_c, chLatin_l, chLatin_u, chLatin_d, + chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_REDEFINE[] = +{ + chLatin_r, chLatin_e, chLatin_d, chLatin_e, chLatin_f, chLatin_i, + chLatin_n, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_KEY[] = +{ + chLatin_k, chLatin_e, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgELT_KEYREF[] = +{ + chLatin_k, chLatin_e, chLatin_y, chLatin_r, chLatin_e, chLatin_f, chNull +}; + +const XMLCh SchemaSymbols::fgELT_LENGTH[] = +{ + chLatin_l, chLatin_e, chLatin_n, chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MAXEXCLUSIVE[] = +{ + chLatin_m, chLatin_a, chLatin_x, chLatin_E, chLatin_x, chLatin_c, + chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MAXINCLUSIVE[] = +{ + chLatin_m, chLatin_a, chLatin_x, chLatin_I, chLatin_n, chLatin_c, + chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MAXLENGTH[] = +{ + chLatin_m, chLatin_a, chLatin_x, chLatin_L, chLatin_e, chLatin_n, + chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MINEXCLUSIVE[] = +{ + chLatin_m, chLatin_i, chLatin_n, chLatin_E, chLatin_x, chLatin_c, + chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MININCLUSIVE[] = +{ + chLatin_m, chLatin_i, chLatin_n, chLatin_I, chLatin_n, chLatin_c, + chLatin_l, chLatin_u, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_MINLENGTH[] = +{ + chLatin_m, chLatin_i, chLatin_n, chLatin_L, chLatin_e, chLatin_n, + chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgELT_NOTATION[] = +{ + chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_PATTERN[] = +{ + chLatin_p, chLatin_a, chLatin_t, chLatin_t, chLatin_e, chLatin_r, + chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_PERIOD[] = +{ + chLatin_p, chLatin_e, chLatin_r, chLatin_i, chLatin_o, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgELT_TOTALDIGITS[] = +{ + chLatin_t, chLatin_o, chLatin_t, chLatin_a, chLatin_l, chLatin_D, + chLatin_i, chLatin_g, chLatin_i, chLatin_t, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgELT_FRACTIONDIGITS[] = +{ + chLatin_f, chLatin_r, chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, + chLatin_n, chLatin_D, chLatin_i, chLatin_g, chLatin_i, chLatin_t, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgELT_SCHEMA[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chNull +}; + +const XMLCh SchemaSymbols::fgELT_SELECTOR[] = +{ + chLatin_s, chLatin_e, chLatin_l, chLatin_e, chLatin_c, chLatin_t, + chLatin_o, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgELT_SEQUENCE[] = +{ + chLatin_s, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_n, + chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_SIMPLETYPE[] = +{ + chLatin_s, chLatin_i, chLatin_m, chLatin_p, chLatin_l, chLatin_e, + chLatin_T, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_UNION[] = +{ + chLatin_u, chLatin_n, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_LIST[] = +{ + chLatin_l, chLatin_i, chLatin_s, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_UNIQUE[] = +{ + chLatin_u, chLatin_n, chLatin_i, chLatin_q, chLatin_u, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgELT_COMPLEXCONTENT[] = +{ + chLatin_c, chLatin_o, chLatin_m, chLatin_p, chLatin_l, chLatin_e, + chLatin_x, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, + chLatin_n, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_SIMPLECONTENT[] = +{ + chLatin_s, chLatin_i, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chLatin_C, + chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgELT_RESTRICTION[] = +{ + chLatin_r, chLatin_e, chLatin_s, chLatin_t, chLatin_r, chLatin_i, + chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgELT_EXTENSION[] = +{ + chLatin_e, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, + chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATT_ABSTRACT[] = +{ + chLatin_a, chLatin_b, chLatin_s, chLatin_t, chLatin_r, chLatin_a, + chLatin_c, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_ATTRIBUTEFORMDEFAULT[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, + chLatin_u, chLatin_t, chLatin_e, chLatin_F, chLatin_o, chLatin_r, + chLatin_m, chLatin_D, chLatin_e, chLatin_f, chLatin_a, chLatin_u, + chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_BASE[] = +{ + chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_ITEMTYPE[] = +{ + chLatin_i, chLatin_t, chLatin_e, chLatin_m, chLatin_T, chLatin_y, + chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_MEMBERTYPES[] = +{ + chLatin_m, chLatin_e, chLatin_m, chLatin_b, chLatin_e, chLatin_r, + chLatin_T, chLatin_y, chLatin_p, chLatin_e, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgATT_BLOCK[] = +{ + chLatin_b, chLatin_l, chLatin_o, chLatin_c, chLatin_k, chNull +}; + +const XMLCh SchemaSymbols::fgATT_BLOCKDEFAULT[] = +{ + chLatin_b, chLatin_l, chLatin_o, chLatin_c, chLatin_k, chLatin_D, + chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_DEFAULT[] = +{ + chLatin_d, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_ELEMENTFORMDEFAULT[] = +{ + chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, + chLatin_t, chLatin_F, chLatin_o, chLatin_r, chLatin_m, chLatin_D, + chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_SUBSTITUTIONGROUP[] = +{ + chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, + chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, + chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chNull +}; + +const XMLCh SchemaSymbols::fgATT_FINAL[] = +{ + chLatin_f, chLatin_i, chLatin_n, chLatin_a, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgATT_FINALDEFAULT[] = +{ + chLatin_f, chLatin_i, chLatin_n, chLatin_a, chLatin_l, chLatin_D, + chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATT_FIXED[] = +{ + chLatin_f, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATT_FORM[] = +{ + chLatin_f, chLatin_o, chLatin_r, chLatin_m, chNull +}; + +const XMLCh SchemaSymbols::fgATT_ID[] = +{ + chLatin_i, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATT_MAXOCCURS[] = +{ + chLatin_m, chLatin_a, chLatin_x, chLatin_O, chLatin_c, chLatin_c, + chLatin_u, chLatin_r, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgATT_MINOCCURS[] = +{ + chLatin_m, chLatin_i, chLatin_n, chLatin_O, chLatin_c, chLatin_c, + chLatin_u, chLatin_r, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgATT_NAME[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_NAMESPACE[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, + chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_NILL[] = +{ + chLatin_n, chLatin_i, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgATT_NILLABLE[] = +{ + chLatin_n, chLatin_i, chLatin_l, chLatin_l, chLatin_a, chLatin_b, + chLatin_l, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_PROCESSCONTENTS[] = +{ + chLatin_p, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, + chLatin_s, chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, + chLatin_n, chLatin_t, chLatin_s, chNull +}; + +const XMLCh SchemaSymbols::fgATT_REF[] = +{ + chLatin_r, chLatin_e, chLatin_f, chNull +}; + +const XMLCh SchemaSymbols::fgATT_REFER[] = +{ + chLatin_r, chLatin_e, chLatin_f, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgATT_SCHEMALOCATION[] = +{ + chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, + chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_t, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATT_SOURCE[] = +{ + chLatin_s, chLatin_o, chLatin_u, chLatin_r, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_SYSTEM[] = +{ + chLatin_s, chLatin_y, chLatin_s, chLatin_t, chLatin_e, chLatin_m, chNull +}; + +const XMLCh SchemaSymbols::fgATT_PUBLIC[] = +{ + chLatin_p, chLatin_u, chLatin_b, chLatin_l, chLatin_i, chLatin_c, chNull +}; + +const XMLCh SchemaSymbols::fgATT_TARGETNAMESPACE[] = +{ + chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, + chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_TYPE[] = +{ + chLatin_t, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_USE[] = +{ + chLatin_u, chLatin_s, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_VALUE[] = +{ + chLatin_v, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATT_MIXED[] = +{ + chLatin_m, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATT_VERSION[] = +{ + chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i, + chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATT_XPATH[] = +{ + chLatin_x, chLatin_p, chLatin_a, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TWOPOUNDANY[] = +{ + chPound, chPound, chLatin_a, chLatin_n, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TWOPOUNDLOCAL[] = +{ + chPound, chPound, chLatin_l, chLatin_o, chLatin_c, chLatin_a, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TWOPOUNDOTHER[] = +{ + chPound, chPound, chLatin_o, chLatin_t, chLatin_h, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TWOPOUNDTRAGETNAMESPACE[] = +{ + chPound, chPound, chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, + chLatin_t, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, + chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_POUNDALL[] = +{ + chPound, chLatin_a, chLatin_l, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_BASE64[] = +{ + chLatin_b, chLatin_a, chLatin_s, chLatin_e, chDigit_6, chDigit_4, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_BOOLEAN[] = +{ + chLatin_b, chLatin_o, chLatin_o, chLatin_l, chLatin_e, chLatin_a, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_DEFAULT[] = +{ + chLatin_d, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_ELEMENTONLY[] = +{ + chLatin_e, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, + chLatin_t, chLatin_O, chLatin_n, chLatin_l, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_EMPTY[] = +{ + chLatin_e, chLatin_m, chLatin_p, chLatin_t, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_EXTENSION[] = +{ + chLatin_e, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, + chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_FALSE[] = +{ + chLatin_f, chLatin_a, chLatin_l, chLatin_s, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_FIXED[] = +{ + chLatin_f, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_HEX[] = +{ + chLatin_h, chLatin_e, chLatin_x, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_ID[] = +{ + chLatin_I, chLatin_D, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_LAX[] = +{ + chLatin_l, chLatin_a, chLatin_x, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_MAXLENGTH[] = +{ + chLatin_m, chLatin_a, chLatin_x, chLatin_L, chLatin_e, chLatin_n, + chLatin_g, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_MINLENGTH[] = +{ + chLatin_m, chLatin_i, chLatin_n, chLatin_L, chLatin_e, chLatin_n, + chLatin_g, chLatin_t, chLatin_h, chNull +}; + + +const XMLCh SchemaSymbols::fgATTVAL_MIXED[] = +{ + chLatin_m, chLatin_i, chLatin_x, chLatin_e, chLatin_d, chNull +}; + + +const XMLCh SchemaSymbols::fgATTVAL_NCNAME[] = +{ + chLatin_N, chLatin_C, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_OPTIONAL[] = +{ + chLatin_o, chLatin_p, chLatin_t, chLatin_i, chLatin_o, chLatin_n, + chLatin_a, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_PROHIBITED[] = +{ + chLatin_p, chLatin_r, chLatin_o, chLatin_h, chLatin_i, chLatin_b, + chLatin_i, chLatin_t, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_QNAME[] = +{ + chLatin_Q, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_QUALIFIED[] = +{ + chLatin_q, chLatin_u, chLatin_a, chLatin_l, chLatin_i, chLatin_f, + chLatin_i, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_REQUIRED[] = +{ + chLatin_r, chLatin_e, chLatin_q, chLatin_u, chLatin_i, chLatin_r, + chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_RESTRICTION[] = +{ + chLatin_r, chLatin_e, chLatin_s, chLatin_t, chLatin_r, chLatin_i, + chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_SKIP[] = +{ + chLatin_s, chLatin_k, chLatin_i, chLatin_p, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_STRICT[] = +{ + chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_c, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_STRING[] = +{ + chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TEXTONLY[] = +{ + chLatin_t, chLatin_e, chLatin_x, chLatin_t, chLatin_O, chLatin_n, + chLatin_l, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TIMEDURATION[] = +{ + chLatin_t, chLatin_i, chLatin_m, chLatin_e, chLatin_D, chLatin_u, + chLatin_r, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_TRUE[] = +{ + chLatin_t, chLatin_r, chLatin_u, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_UNQUALIFIED[] = +{ + chLatin_u, chLatin_n, chLatin_q, chLatin_u, chLatin_a, chLatin_l, + chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_URI[] = +{ + chLatin_u, chLatin_r, chLatin_i, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_URIREFERENCE[] = +{ + chLatin_u, chLatin_r, chLatin_i, chLatin_R, chLatin_e, chLatin_f, + chLatin_e, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_SUBSTITUTIONGROUP[] = +{ + chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, + chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, + chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_SUBSTITUTION[] = +{ + chLatin_s, chLatin_u, chLatin_b, chLatin_s, chLatin_t, chLatin_i, + chLatin_t, chLatin_u, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgATTVAL_ANYTYPE[] = +{ + chLatin_a, chLatin_n, chLatin_y, chLatin_T, chLatin_y, chLatin_p, + chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgWS_PRESERVE[] = +{ + chLatin_p, chLatin_r, chLatin_e, chLatin_s, chLatin_e, chLatin_r, + chLatin_v, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgWS_COLLAPSE[] = +{ + chLatin_c, chLatin_o, chLatin_l, chLatin_l, chLatin_a, chLatin_p, + chLatin_s, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgWS_REPLACE[] = +{ + chLatin_r, chLatin_e, chLatin_p, chLatin_l, chLatin_a, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_STRING[] = +{ + chLatin_s, chLatin_t, chLatin_r, chLatin_i, chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgDT_TOKEN[] = +{ + chLatin_t, chLatin_o, chLatin_k, chLatin_e, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgDT_LANGUAGE[] = +{ + chLatin_l, chLatin_a, chLatin_n, chLatin_g, chLatin_u, chLatin_a, + chLatin_g, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NAME[] = +{ + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NCNAME[] = +{ + chLatin_N, chLatin_C, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_INTEGER[] = +{ + chLatin_i, chLatin_n, chLatin_t, chLatin_e, chLatin_g, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DECIMAL[] = +{ + chLatin_d, chLatin_e, chLatin_c, chLatin_i, chLatin_m, chLatin_a, chLatin_l, chNull +}; + +const XMLCh SchemaSymbols::fgDT_BOOLEAN[] = +{ + chLatin_b, chLatin_o, chLatin_o, chLatin_l, chLatin_e, chLatin_a, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NONPOSITIVEINTEGER[] = +{ + chLatin_n, chLatin_o, chLatin_n, chLatin_P, chLatin_o, chLatin_s, + chLatin_i, chLatin_t, chLatin_i, chLatin_v, chLatin_e, chLatin_I, + chLatin_n, chLatin_t, chLatin_e, chLatin_g, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NEGATIVEINTEGER[] = +{ + chLatin_n, chLatin_e, chLatin_g, chLatin_a, chLatin_t, chLatin_i, + chLatin_v, chLatin_e, chLatin_I, chLatin_n, chLatin_t, chLatin_e, + chLatin_g, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_LONG[] = +{ + chLatin_l, chLatin_o, chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgDT_INT[] = +{ + chLatin_i, chLatin_n, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgDT_SHORT[] = +{ + chLatin_s, chLatin_h, chLatin_o, chLatin_r, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgDT_BYTE[] = +{ + chLatin_b, chLatin_y, chLatin_t, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NONNEGATIVEINTEGER[] = +{ + chLatin_n, chLatin_o, chLatin_n, chLatin_N, chLatin_e, chLatin_g, + chLatin_a, chLatin_t, chLatin_i, chLatin_v, chLatin_e, chLatin_I, + chLatin_n, chLatin_t, chLatin_e, chLatin_g, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_ULONG[] = +{ + chLatin_u, chLatin_n, chLatin_s, chLatin_i, chLatin_g, chLatin_n, + chLatin_e, chLatin_d, chLatin_L, chLatin_o, chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgDT_UINT[] = +{ + chLatin_u, chLatin_n, chLatin_s, chLatin_i, chLatin_g, chLatin_n, + chLatin_e, chLatin_d, chLatin_I, chLatin_n, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgDT_USHORT[] = +{ + chLatin_u, chLatin_n, chLatin_s, chLatin_i, chLatin_g, chLatin_n, chLatin_e, + chLatin_d, chLatin_S, chLatin_h, chLatin_o, chLatin_r, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgDT_UBYTE[] = +{ + chLatin_u, chLatin_n, chLatin_s, chLatin_i, chLatin_g, chLatin_n, + chLatin_e, chLatin_d, chLatin_B, chLatin_y, chLatin_t, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_POSITIVEINTEGER[] = +{ + chLatin_p, chLatin_o, chLatin_s, chLatin_i, chLatin_t, chLatin_i, + chLatin_v, chLatin_e, chLatin_I, chLatin_n, chLatin_t, chLatin_e, + chLatin_g, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DATETIME[] = +{ + chLatin_d, chLatin_a, chLatin_t, chLatin_e, + chLatin_T, chLatin_i, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DATE[] = +{ + chLatin_d, chLatin_a, chLatin_t, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_TIME[] = +{ + chLatin_t, chLatin_i, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DURATION[] = +{ + chLatin_d, chLatin_u, chLatin_r, chLatin_a, + chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DAY[] = +{ + chLatin_g, chLatin_D, chLatin_a, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgDT_MONTH[] = +{ + chLatin_g, chLatin_M, chLatin_o, chLatin_n, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgDT_MONTHDAY[] = +{ + chLatin_g, chLatin_M, chLatin_o, chLatin_n, chLatin_t, chLatin_h, + chLatin_D, chLatin_a, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgDT_YEAR[] = +{ + chLatin_g, chLatin_Y, chLatin_e, chLatin_a, chLatin_r, chNull +}; + +const XMLCh SchemaSymbols::fgDT_YEARMONTH[] = +{ + chLatin_g, chLatin_Y, chLatin_e, chLatin_a, chLatin_r, + chLatin_M, chLatin_o, chLatin_n, chLatin_t, chLatin_h, chNull +}; + +const XMLCh SchemaSymbols::fgDT_BASE64BINARY[] = +{ + chLatin_b, chLatin_a, chLatin_s, chLatin_e, chDigit_6, chDigit_4, + chLatin_B, chLatin_i, chLatin_n, chLatin_a, chLatin_r, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgDT_HEXBINARY[] = +{ + chLatin_h, chLatin_e, chLatin_x, + chLatin_B, chLatin_i, chLatin_n, chLatin_a, chLatin_r, chLatin_y, chNull +}; + +const XMLCh SchemaSymbols::fgDT_FLOAT[] = +{ + chLatin_f, chLatin_l, chLatin_o, chLatin_a, chLatin_t, chNull +}; + +const XMLCh SchemaSymbols::fgDT_DOUBLE[] = +{ + chLatin_d, chLatin_o, chLatin_u, chLatin_b, chLatin_l, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_URIREFERENCE[] = +{ + chLatin_u, chLatin_r, chLatin_i, chLatin_R, chLatin_e, chLatin_f, + chLatin_e, chLatin_r, chLatin_e, chLatin_n, chLatin_c, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_ANYURI[] = +{ + chLatin_a, chLatin_n, chLatin_y, chLatin_U, chLatin_R, chLatin_I, chNull +}; + +const XMLCh SchemaSymbols::fgDT_QNAME[] = +{ + chLatin_Q, chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgDT_NORMALIZEDSTRING[] = +{ + chLatin_n, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_l, chLatin_i, + chLatin_z, chLatin_e, chLatin_d, chLatin_S, chLatin_t, chLatin_r, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh SchemaSymbols::fgDT_ANYSIMPLETYPE[] = +{ + chLatin_a, chLatin_n, chLatin_y, chLatin_S, chLatin_i, chLatin_m, chLatin_p, + chLatin_l, chLatin_e, chLatin_T, chLatin_y, chLatin_p, chLatin_e, chNull +}; + +const XMLCh SchemaSymbols::fgRegEx_XOption[] = +{ + chLatin_X, chNull +}; + +const XMLCh SchemaSymbols::fgRedefIdentifier[] = +{ + chUnderscore, chLatin_r, chLatin_d, chLatin_f, chLatin_n, chNull +}; + +const int SchemaSymbols::fgINT_MIN_VALUE = 0x80000000; + +const int SchemaSymbols::fgINT_MAX_VALUE = 0x7fffffff; + +XERCES_CPP_NAMESPACE_END + +/** + * End of file SchemaSymbols.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.hpp new file mode 100644 index 000000000..7e51afb70 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaSymbols.hpp @@ -0,0 +1,254 @@ +/* + * 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: SchemaSymbols.hpp 802804 2009-08-10 14:21:48Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMASYMBOLS_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMASYMBOLS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + * Collection of symbols used to parse a Schema Grammar + */ + +class VALIDATORS_EXPORT SchemaSymbols +{ +public : + // ----------------------------------------------------------------------- + // Constant data + // ----------------------------------------------------------------------- + static const XMLCh fgURI_XSI[]; + static const XMLCh fgURI_SCHEMAFORSCHEMA[]; + // deprecated (typo) + static const XMLCh fgXSI_SCHEMALOCACTION[]; + // deprecated (typo) + static const XMLCh fgXSI_NONAMESPACESCHEMALOCACTION[]; + static const XMLCh fgXSI_SCHEMALOCATION[]; + static const XMLCh fgXSI_NONAMESPACESCHEMALOCATION[]; + static const XMLCh fgXSI_TYPE[]; + static const XMLCh fgELT_ALL[]; + static const XMLCh fgELT_ANNOTATION[]; + static const XMLCh fgELT_ANY[]; + static const XMLCh fgELT_WILDCARD[]; + static const XMLCh fgELT_ANYATTRIBUTE[]; + static const XMLCh fgELT_APPINFO[]; + static const XMLCh fgELT_ATTRIBUTE[]; + static const XMLCh fgELT_ATTRIBUTEGROUP[]; + static const XMLCh fgELT_CHOICE[]; + static const XMLCh fgELT_COMPLEXTYPE[]; + static const XMLCh fgELT_CONTENT[]; + static const XMLCh fgELT_DOCUMENTATION[]; + static const XMLCh fgELT_DURATION[]; + static const XMLCh fgELT_ELEMENT[]; + static const XMLCh fgELT_ENCODING[]; + static const XMLCh fgELT_ENUMERATION[]; + static const XMLCh fgELT_FIELD[]; + static const XMLCh fgELT_WHITESPACE[]; + static const XMLCh fgELT_GROUP[]; + static const XMLCh fgELT_IMPORT[]; + static const XMLCh fgELT_INCLUDE[]; + static const XMLCh fgELT_REDEFINE[]; + static const XMLCh fgELT_KEY[]; + static const XMLCh fgELT_KEYREF[]; + static const XMLCh fgELT_LENGTH[]; + static const XMLCh fgELT_MAXEXCLUSIVE[]; + static const XMLCh fgELT_MAXINCLUSIVE[]; + static const XMLCh fgELT_MAXLENGTH[]; + static const XMLCh fgELT_MINEXCLUSIVE[]; + static const XMLCh fgELT_MININCLUSIVE[]; + static const XMLCh fgELT_MINLENGTH[]; + static const XMLCh fgELT_NOTATION[]; + static const XMLCh fgELT_PATTERN[]; + static const XMLCh fgELT_PERIOD[]; + static const XMLCh fgELT_TOTALDIGITS[]; + static const XMLCh fgELT_FRACTIONDIGITS[]; + static const XMLCh fgELT_SCHEMA[]; + static const XMLCh fgELT_SELECTOR[]; + static const XMLCh fgELT_SEQUENCE[]; + static const XMLCh fgELT_SIMPLETYPE[]; + static const XMLCh fgELT_UNION[]; + static const XMLCh fgELT_LIST[]; + static const XMLCh fgELT_UNIQUE[]; + static const XMLCh fgELT_COMPLEXCONTENT[]; + static const XMLCh fgELT_SIMPLECONTENT[]; + static const XMLCh fgELT_RESTRICTION[]; + static const XMLCh fgELT_EXTENSION[]; + static const XMLCh fgATT_ABSTRACT[]; + static const XMLCh fgATT_ATTRIBUTEFORMDEFAULT[]; + static const XMLCh fgATT_BASE[]; + static const XMLCh fgATT_ITEMTYPE[]; + static const XMLCh fgATT_MEMBERTYPES[]; + static const XMLCh fgATT_BLOCK[]; + static const XMLCh fgATT_BLOCKDEFAULT[]; + static const XMLCh fgATT_DEFAULT[]; + static const XMLCh fgATT_ELEMENTFORMDEFAULT[]; + static const XMLCh fgATT_SUBSTITUTIONGROUP[]; + static const XMLCh fgATT_FINAL[]; + static const XMLCh fgATT_FINALDEFAULT[]; + static const XMLCh fgATT_FIXED[]; + static const XMLCh fgATT_FORM[]; + static const XMLCh fgATT_ID[]; + static const XMLCh fgATT_MAXOCCURS[]; + static const XMLCh fgATT_MINOCCURS[]; + static const XMLCh fgATT_NAME[]; + static const XMLCh fgATT_NAMESPACE[]; + static const XMLCh fgATT_NILL[]; + static const XMLCh fgATT_NILLABLE[]; + static const XMLCh fgATT_PROCESSCONTENTS[]; + static const XMLCh fgATT_REF[]; + static const XMLCh fgATT_REFER[]; + static const XMLCh fgATT_SCHEMALOCATION[]; + static const XMLCh fgATT_SOURCE[]; + static const XMLCh fgATT_SYSTEM[]; + static const XMLCh fgATT_PUBLIC[]; + static const XMLCh fgATT_TARGETNAMESPACE[]; + static const XMLCh fgATT_TYPE[]; + static const XMLCh fgATT_USE[]; + static const XMLCh fgATT_VALUE[]; + static const XMLCh fgATT_MIXED[]; + static const XMLCh fgATT_VERSION[]; + static const XMLCh fgATT_XPATH[]; + static const XMLCh fgATTVAL_TWOPOUNDANY[]; + static const XMLCh fgATTVAL_TWOPOUNDLOCAL[]; + static const XMLCh fgATTVAL_TWOPOUNDOTHER[]; + static const XMLCh fgATTVAL_TWOPOUNDTRAGETNAMESPACE[]; + static const XMLCh fgATTVAL_POUNDALL[]; + static const XMLCh fgATTVAL_BASE64[]; + static const XMLCh fgATTVAL_BOOLEAN[]; + static const XMLCh fgATTVAL_DEFAULT[]; + static const XMLCh fgATTVAL_ELEMENTONLY[]; + static const XMLCh fgATTVAL_EMPTY[]; + static const XMLCh fgATTVAL_EXTENSION[]; + static const XMLCh fgATTVAL_FALSE[]; + static const XMLCh fgATTVAL_FIXED[]; + static const XMLCh fgATTVAL_HEX[]; + static const XMLCh fgATTVAL_ID[]; + static const XMLCh fgATTVAL_LAX[]; + static const XMLCh fgATTVAL_MAXLENGTH[]; + static const XMLCh fgATTVAL_MINLENGTH[]; + static const XMLCh fgATTVAL_MIXED[]; + static const XMLCh fgATTVAL_NCNAME[]; + static const XMLCh fgATTVAL_OPTIONAL[]; + static const XMLCh fgATTVAL_PROHIBITED[]; + static const XMLCh fgATTVAL_QNAME[]; + static const XMLCh fgATTVAL_QUALIFIED[]; + static const XMLCh fgATTVAL_REQUIRED[]; + static const XMLCh fgATTVAL_RESTRICTION[]; + static const XMLCh fgATTVAL_SKIP[]; + static const XMLCh fgATTVAL_STRICT[]; + static const XMLCh fgATTVAL_STRING[]; + static const XMLCh fgATTVAL_TEXTONLY[]; + static const XMLCh fgATTVAL_TIMEDURATION[]; + static const XMLCh fgATTVAL_TRUE[]; + static const XMLCh fgATTVAL_UNQUALIFIED[]; + static const XMLCh fgATTVAL_URI[]; + static const XMLCh fgATTVAL_URIREFERENCE[]; + static const XMLCh fgATTVAL_SUBSTITUTIONGROUP[]; + static const XMLCh fgATTVAL_SUBSTITUTION[]; + static const XMLCh fgATTVAL_ANYTYPE[]; + static const XMLCh fgWS_PRESERVE[]; + static const XMLCh fgWS_COLLAPSE[]; + static const XMLCh fgWS_REPLACE[]; + static const XMLCh fgDT_STRING[]; + static const XMLCh fgDT_TOKEN[]; + static const XMLCh fgDT_LANGUAGE[]; + static const XMLCh fgDT_NAME[]; + static const XMLCh fgDT_NCNAME[]; + static const XMLCh fgDT_INTEGER[]; + static const XMLCh fgDT_DECIMAL[]; + static const XMLCh fgDT_BOOLEAN[]; + static const XMLCh fgDT_NONPOSITIVEINTEGER[]; + static const XMLCh fgDT_NEGATIVEINTEGER[]; + static const XMLCh fgDT_LONG[]; + static const XMLCh fgDT_INT[]; + static const XMLCh fgDT_SHORT[]; + static const XMLCh fgDT_BYTE[]; + static const XMLCh fgDT_NONNEGATIVEINTEGER[]; + static const XMLCh fgDT_ULONG[]; + static const XMLCh fgDT_UINT[]; + static const XMLCh fgDT_USHORT[]; + static const XMLCh fgDT_UBYTE[]; + static const XMLCh fgDT_POSITIVEINTEGER[]; +//datetime + static const XMLCh fgDT_DATETIME[]; + static const XMLCh fgDT_DATE[]; + static const XMLCh fgDT_TIME[]; + static const XMLCh fgDT_DURATION[]; + static const XMLCh fgDT_DAY[]; + static const XMLCh fgDT_MONTH[]; + static const XMLCh fgDT_MONTHDAY[]; + static const XMLCh fgDT_YEAR[]; + static const XMLCh fgDT_YEARMONTH[]; + + static const XMLCh fgDT_BASE64BINARY[]; + static const XMLCh fgDT_HEXBINARY[]; + static const XMLCh fgDT_FLOAT[]; + static const XMLCh fgDT_DOUBLE[]; + static const XMLCh fgDT_URIREFERENCE[]; + static const XMLCh fgDT_ANYURI[]; + static const XMLCh fgDT_QNAME[]; + static const XMLCh fgDT_NORMALIZEDSTRING[]; + static const XMLCh fgDT_ANYSIMPLETYPE[]; + static const XMLCh fgRegEx_XOption[]; + static const XMLCh fgRedefIdentifier[]; + static const int fgINT_MIN_VALUE; + static const int fgINT_MAX_VALUE; + + enum { + XSD_EMPTYSET = 0, + XSD_SUBSTITUTION = 1, + XSD_EXTENSION = 2, + XSD_RESTRICTION = 4, + XSD_LIST = 8, + XSD_UNION = 16, + XSD_ENUMERATION = 32 + }; + + // group orders + enum { + XSD_CHOICE = 0, + XSD_SEQUENCE= 1, + XSD_ALL = 2 + }; + + enum { + XSD_UNBOUNDED = -1, + XSD_NILLABLE = 1, + XSD_ABSTRACT = 2, + XSD_FIXED = 4 + }; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaSymbols(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file SchemaSymbols.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.cpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.cpp new file mode 100644 index 000000000..95480e590 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.cpp @@ -0,0 +1,2094 @@ +/* + * 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.cpp 806488 2009-08-21 10:36:58Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaValidator: Constructors and Destructor +// --------------------------------------------------------------------------- +SchemaValidator::SchemaValidator( XMLErrorReporter* const errReporter + , MemoryManager* const manager) : + + XMLValidator(errReporter) + , fMemoryManager(manager) + , fSchemaGrammar(0) + , fGrammarResolver(0) + , fXsiType(0) + , fNil(false) + , fNilFound(false) + , fCurrentDatatypeValidator(0) + , fNotationBuf(0) + , fDatatypeBuffer(1023, manager) + , fTrailing(false) + , fSeenNonWhiteSpace(false) + , fSeenId(false) + , fTypeStack(0) + , fMostRecentAttrValidator(0) + , fErrorOccurred(false) + , fElemIsSpecified(false) +{ + fTypeStack = new (fMemoryManager) ValueStackOf(8, fMemoryManager); +} + +SchemaValidator::~SchemaValidator() +{ + delete fXsiType; + delete fTypeStack; + + if (fNotationBuf) + delete fNotationBuf; +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Implementation of the XMLValidator interface +// --------------------------------------------------------------------------- +bool SchemaValidator::checkContent (XMLElementDecl* const elemDecl + , QName** const children + , XMLSize_t childCount + , XMLSize_t* indexFailingChild) +{ + fErrorOccurred = false; + fElemIsSpecified = false; + + // + // Look up the element id in our element decl pool. This will get us + // the element decl in our own way of looking at them. + // + if (!elemDecl) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Val_InvalidElemId, fMemoryManager); + + // + // Get the content spec type of this element. This will tell us what + // to do to validate it. + // + // the top of the type stack always knows best... + ComplexTypeInfo* currType = fTypeStack->pop(); + + const SchemaElementDecl::ModelTypes modelType = (currType) + ? (SchemaElementDecl::ModelTypes)(currType->getContentType()) + : ((SchemaElementDecl*)elemDecl)->getModelType(); + + if (modelType == SchemaElementDecl::Empty || + modelType == SchemaElementDecl::ElementOnlyEmpty) + { + // + // We can do this one here. It cannot have any children. If it does + // we return 0 as the index of the first bad child. + // + if (childCount) { + fErrorOccurred = true; + *indexFailingChild=0; + return false; + } + } + else if ((modelType == SchemaElementDecl::Mixed_Simple) + || (modelType == SchemaElementDecl::Mixed_Complex) + || (modelType == SchemaElementDecl::Children)) + { + // if nillable, it's an error to have value + // XML Schema REC: Validation Rule: Element Locally Valid (Element) + // 3.2.1 The element information item must have no + // character or element information item [children]. + // + if (fNil) { + if (childCount > 0 || !XMLString::equals(fDatatypeBuffer.getRawBuffer(), XMLUni::fgZeroLenString)) { + emitError(XMLValid::NilAttrNotEmpty, elemDecl->getFullName()); + fErrorOccurred = true; + } + } + else { + // Get the element's content model or fault it in + XMLContentModel* elemCM = (currType) + ? currType->getContentModel() + : ((SchemaElementDecl*)elemDecl)->getContentModel(); + + // Ask it to validate and return its return + unsigned int emptyNS = getScanner()->getEmptyNamespaceId(); + bool result = elemCM->validateContent(children, childCount, emptyNS, indexFailingChild, getScanner()->getMemoryManager()); + if (!result) { + result = elemCM->validateContentSpecial(children + , childCount + , emptyNS + , fGrammarResolver + , fGrammarResolver->getStringPool() + , indexFailingChild + , getScanner()->getMemoryManager()); + } + + if(!result) { + fErrorOccurred = true; + } + + return result; + } + } + else if (modelType == SchemaElementDecl::Simple || modelType == SchemaElementDecl::Any) + { + // Normally for SchemaElementDecl::Any, We pass no judgement on it and anything goes + // but if there is a fXsiTypeValidator, we need to use it for validation + if (modelType == SchemaElementDecl::Simple && childCount > 0) { + emitError(XMLValid::SimpleTypeHasChild, elemDecl->getFullName()); + fErrorOccurred = true; + } + else + { + XMLCh* value = fDatatypeBuffer.getRawBuffer(); + XMLCh* elemDefaultValue = ((SchemaElementDecl*) elemDecl)->getDefaultValue(); + + if (fNil) + { + if ((!XMLString::equals(value, XMLUni::fgZeroLenString)) + || elemDefaultValue) + { + emitError(XMLValid::NilAttrNotEmpty, elemDecl->getFullName()); + fErrorOccurred = true; + } + } + else if (fCurrentDatatypeValidator) + { + DatatypeValidator::ValidatorType eleDefDVType = fCurrentDatatypeValidator->getType(); + bool validateCanonical = false; + if (eleDefDVType == DatatypeValidator::NOTATION) + { + // if notation, need to bind URI to notation first + if (!fNotationBuf) + fNotationBuf = new (fMemoryManager) XMLBuffer(1023, fMemoryManager); + + // Make sure that this value maps to one of the + // notation values in the enumList parameter. We don't have to + // look it up in the notation pool (if a notation) because we + // will look up the enumerated values themselves. If they are in + // the notation pool (after the Grammar is parsed), then obviously + // this value will be legal since it matches one of them. + int colonPos = -1; + unsigned int uriId = getScanner()->resolveQName(value, *fNotationBuf, ElemStack::Mode_Element, colonPos); + + const XMLCh* uriText = getScanner()->getURIText(uriId); + if (uriText && *uriText) { + fNotationBuf->set(uriText); + fNotationBuf->append(chColon); + fNotationBuf->append(&value[colonPos + 1]); + value = fNotationBuf->getRawBuffer(); + } + } + + if (elemDefaultValue) + { + if (XMLString::equals(value, XMLUni::fgZeroLenString)) + { + fElemIsSpecified = true; + // if this element didn't specified any value + // use default value + if (getScanner()->getDocHandler()) + getScanner()->getDocHandler()->docCharacters(elemDefaultValue, XMLString::stringLen(elemDefaultValue), false); + + // Normally for default value, it has been validated already during TraverseSchema + // But if there was a xsi:type and this validator is fXsiTypeValidator, + // need to validate again + // we determine this if the current content dataype validator + // is neither the one in the element nor the one in the current + // complex type (if any) + if ((fCurrentDatatypeValidator != ((SchemaElementDecl*)elemDecl)->getDatatypeValidator()) + && (!fTypeStack->peek() || (fCurrentDatatypeValidator != fTypeStack->peek()->getDatatypeValidator()))) { + value = elemDefaultValue; + validateCanonical = true; + } + else + value = 0; + } + else + { + // this element has specified some value + // if the flag is FIXED, then this value must be same as default value + if ((((SchemaElementDecl*)elemDecl)->getMiscFlags() & SchemaSymbols::XSD_FIXED) != 0) + { + if (fCurrentDatatypeValidator->compare(value, elemDefaultValue, fMemoryManager) != 0 ) + { + emitError(XMLValid::FixedDifferentFromActual, elemDecl->getFullName()); + fErrorOccurred = true; + } + } + } + } + + if ((!fErrorOccurred) && value) + { + try { + fCurrentDatatypeValidator->validate(value, getScanner()->getValidationContext(), fMemoryManager); + if (validateCanonical) { + XMLCh* canonical = (XMLCh*) fCurrentDatatypeValidator->getCanonicalRepresentation(value, fMemoryManager); + ArrayJanitor tempCanonical(canonical, fMemoryManager); + fCurrentDatatypeValidator->validate(canonical, getScanner()->getValidationContext(), fMemoryManager); + } + } + catch (XMLException& idve) + { + emitError (XMLValid::DatatypeError, idve.getCode(), idve.getMessage()); + fErrorOccurred = true; + } + catch(const OutOfMemoryException&) { + throw; + } + catch (...) + { + emitError(XMLValid::GenericError); + throw; + } + } + } + else if (modelType == SchemaElementDecl::Simple) + { + emitError(XMLValid::NoDatatypeValidatorForSimpleType, elemDecl->getFullName()); + fErrorOccurred = true; + } + // modelType is any + else if (elemDefaultValue) + { + if (XMLString::equals(value, XMLUni::fgZeroLenString)) + { + fElemIsSpecified = true; + // if this element didn't specified any value + // use default value + if (getScanner()->getDocHandler()) { + getScanner()->getDocHandler()->docCharacters(elemDefaultValue, XMLString::stringLen(elemDefaultValue), false); + } + } + } + } + } + else + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMType, fMemoryManager); + } + + // must rely on scanner to clear fDatatypeBuffer + // since it may need to query its contents after this method completes + fNil = false; + fNilFound = false; + fTrailing=false; + fSeenNonWhiteSpace = false; + fCurrentDatatypeValidator = 0; + + // Went ok, so return success + return true; +} + +void SchemaValidator::faultInAttr (XMLAttr& toFill, const XMLAttDef& attDef) const +{ + // + // At this level, we cannot set the URI id. So we just set it to zero + // and leave it at that. The scanner, who called us, will look at the + // prefix we stored (if any), resolve it, and store the URL id if any. + // + SchemaAttDef* schemaAttDef = (SchemaAttDef*) &attDef; + QName* attName = schemaAttDef->getAttName(); + + toFill.set + ( + attName->getURI() + , attName->getLocalPart() + , attName->getPrefix() + , schemaAttDef->getValue() + , schemaAttDef->getType() + ); +} + +void SchemaValidator::reset() +{ + fTrailing = false; + fSeenNonWhiteSpace = false; + fSeenId = false; + fTypeStack->removeAllElements(); + delete fXsiType; + fXsiType = 0; + fCurrentDatatypeValidator = 0; + fNil = false; + fNilFound = false; + fDatatypeBuffer.reset(); + fErrorOccurred = false; +} + +bool SchemaValidator::requiresNamespaces() const +{ + return true; +} + +void SchemaValidator::validateAttrValue (const XMLAttDef* attDef + , const XMLCh* const attrValue + , bool preValidation + , const XMLElementDecl* elemDecl) +{ + fErrorOccurred = false; + + //turn on IdRefList checking + getScanner()->getValidationContext()->toCheckIdRefList(true); + + // + // Get quick refs to lot of the stuff in the passed objects in + // order to simplify the code below, which will reference them very + // often. + // + XMLAttDef::AttTypes type = attDef->getType(); + const XMLAttDef::DefAttTypes defType = attDef->getDefaultType(); + + // + // If the default type is fixed, then make sure the passed value maps + // to the fixed value. + // + // If during preContentValidation, the value we are validating is the fixed value itself + // so no need to compare. + // Only need to do this for regular attribute value validation + // + if ((defType == XMLAttDef::Fixed || defType == XMLAttDef::Required_And_Fixed) && !preValidation) + { + const XMLCh* const valueText = attDef->getValue(); + if (!XMLString::equals(attrValue, valueText)) { + emitError(XMLValid::NotSameAsFixedValue, attDef->getFullName(), attrValue, valueText); + fErrorOccurred = true; + } + } + + // An empty string cannot be valid for non_CDATA any of the other types + if (!attrValue[0] && type != XMLAttDef::Simple) + { + emitError(XMLValid::InvalidEmptyAttValue, attDef->getFullName()); + // accords with original DOMTypeInfo implementation, but this does not feel right. + fMostRecentAttrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + fErrorOccurred = true; + return; + } + + DatatypeValidator* attDefDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); + if (!attDefDV) { + emitError(XMLValid::NoDatatypeValidatorForAttribute, attDef->getFullName()); + fErrorOccurred = true; + } + else { + DatatypeValidator::ValidatorType attDefDVType = attDefDV->getType(); + ValidationContext *context = getScanner()->getValidationContext(); + try { + + // first, if notation, need to bind URI to notation first + if (attDefDVType == DatatypeValidator::NOTATION) + { + // + // Make sure that this value maps to one of the + // notation values in the enumList parameter. We don't have to + // look it up in the notation pool (if a notation) because we + // will look up the enumerated values themselves. If they are in + // the notation pool (after the Grammar is parsed), then obviously + // this value will be legal since it matches one of them. + // + XMLBuffer notationBuf(1023, fMemoryManager); + int colonPos = -1; + unsigned int uriId = getScanner()->resolveQName(attrValue, notationBuf, ElemStack::Mode_Element, colonPos); + const XMLCh* uriText = getScanner()->getURIText(uriId); + if (uriText && *uriText) { + notationBuf.set(uriText); + notationBuf.append(chColon); + notationBuf.append(&attrValue[colonPos + 1]); + } + else { + notationBuf.set(attrValue); + } + + attDefDV->validate(notationBuf.getRawBuffer() + , context + , fMemoryManager); + } + else { + attDefDV->validate(attrValue + , context + , fMemoryManager); + } + + } + catch (XMLException& idve) { + fErrorOccurred = true; + emitError (XMLValid::DatatypeError, idve.getCode(), idve.getMessage()); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) { + emitError(XMLValid::GenericError); + fMostRecentAttrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + fErrorOccurred = true; + throw; + } + fMostRecentAttrValidator = attDefDV; + // now we can look for ID's, entities, ... + + // set up the entitydeclpool in ENTITYDatatypeValidator + // and the idreflist in ID/IDREFDatatypeValidator + + // indicate if this attribute is of type ID + bool thisIsAnId = false; + + if (attDefDVType == DatatypeValidator::List) { + DatatypeValidator* itemDTV = ((ListDatatypeValidator*)attDefDV)->getItemTypeDTV(); + DatatypeValidator::ValidatorType itemDTVType = itemDTV->getType(); + if (itemDTVType == DatatypeValidator::ID) { + thisIsAnId = true; + } + else if (itemDTVType == DatatypeValidator::IDREF) { + // if in prevalidatoin, do not add attDef to IDREFList + if (preValidation) + //todo: when to setIdRefList back to non-null + getScanner()->getValidationContext()->toCheckIdRefList(false); + } + } + else if (attDefDVType == DatatypeValidator::Union) { + DatatypeValidator *memberDTV = context->getValidatingMemberType(); + // actual type for DOMTypeInfo is memberDTV + fMostRecentAttrValidator = memberDTV; + // no member datatype validator if there was an error + if(memberDTV) + { + DatatypeValidator::ValidatorType memberDTVType = memberDTV->getType(); + if (memberDTVType == DatatypeValidator::ID) { + thisIsAnId = true; + } + else if (memberDTVType == DatatypeValidator::IDREF) { + // if in prevalidatoin, do not add attDef to IDREFList + if (preValidation) + getScanner()->getValidationContext()->toCheckIdRefList(false); + } + } + } + else if (attDefDVType == DatatypeValidator::ID) { + thisIsAnId = true; + } + else if (attDefDVType == DatatypeValidator::IDREF) { + // if in prevalidation, do not add attDef to IDREFList + if (preValidation) + getScanner()->getValidationContext()->toCheckIdRefList(false); + } + if (thisIsAnId) { + if (fSeenId) { + emitError + ( + XMLValid::MultipleIdAttrs + , elemDecl->getFullName() + ); + fErrorOccurred = true; + } + else + fSeenId = true; + } + + } + + if(fErrorOccurred) { + fMostRecentAttrValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + fTrailing = false; + fSeenNonWhiteSpace = false; +} + +void SchemaValidator::validateElement(const XMLElementDecl* elemDef) +{ + ComplexTypeInfo* elemTypeInfo = ((SchemaElementDecl*)elemDef)->getComplexTypeInfo(); + fTypeStack->push(elemTypeInfo); + fCurrentDatatypeValidator = (elemTypeInfo) + ? elemTypeInfo->getDatatypeValidator() + : ((SchemaElementDecl*)elemDef)->getDatatypeValidator(); + + fErrorOccurred = false; + + if (fXsiType) { + // handle "xsi:type" right here + DatatypeValidator *xsiTypeDV = 0; + unsigned int uri = fXsiType->getURI(); + const XMLCh* localPart = fXsiType->getLocalPart(); + + if (uri != XMLElementDecl::fgInvalidElemId && + uri != XMLElementDecl::fgPCDataElemId && + uri != XMLContentModel::gEpsilonFakeId && + uri != XMLContentModel::gEOCFakeId) { + + // retrieve Grammar for the uri + const XMLCh* uriStr = getScanner()->getURIText(uri); + SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr); + if (!sGrammar) { + + // Check built-in simple types + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + xsiTypeDV = fGrammarResolver->getDatatypeValidator(uriStr, localPart); + + if (!xsiTypeDV) { + emitError(XMLValid::BadXsiType, fXsiType->getRawName()); + fErrorOccurred = true; + } + else { + if (elemTypeInfo || (fCurrentDatatypeValidator + && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV))) { + // the type is not derived from ancestor + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + else if(fCurrentDatatypeValidator != xsiTypeDV) + { + // the type is derived from ancestor + if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) { + emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName()); + fErrorOccurred = true; + } + if (elemDef->hasAttDefs()) { + // if we have an attribute but xsi:type's type is simple, we have a problem... + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + } + fCurrentDatatypeValidator = xsiTypeDV; + } + } + else { + // Grammar not found + emitError(XMLValid::GrammarNotFound, uriStr); + fErrorOccurred = true; + } + } + else if (sGrammar->getGrammarType() != Grammar::SchemaGrammarType) { + emitError(XMLValid::GrammarNotFound, uriStr); + fErrorOccurred = true; + } + else { + // retrieve complexType registry and DatatypeValidator registry + RefHashTableOf* complexTypeRegistry = sGrammar->getComplexTypeRegistry(); + if (!complexTypeRegistry) { + emitError(XMLValid::BadXsiType, fXsiType->getRawName()); + fErrorOccurred = true; + } + else { + + // retrieve the typeInfo specified in xsi:type + XMLBuffer aBuffer(1023, fMemoryManager); + aBuffer.set(uriStr); + aBuffer.append(chComma); + aBuffer.append(localPart); + ComplexTypeInfo* typeInfo = complexTypeRegistry->get(aBuffer.getRawBuffer()); + + if (typeInfo) { + // typeInfo is found + if (typeInfo->getAbstract()) { + emitError(XMLValid::NoAbstractInXsiType, aBuffer.getRawBuffer()); + fErrorOccurred = true; + } + else + { + if (elemTypeInfo) + { + ComplexTypeInfo* tempType = typeInfo; + while (tempType) { + if (tempType == elemTypeInfo) + break; + tempType = tempType->getBaseComplexTypeInfo(); + } + + if (!tempType) { + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + else if(elemTypeInfo != typeInfo) { + // perform the check on the entire inheritance chain + ComplexTypeInfo* tempType = typeInfo; + while (tempType) { + if (tempType == elemTypeInfo) + break; + int derivationMethod = tempType->getDerivedBy(); + if ((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) { + emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName()); + fErrorOccurred = true; + } + if ((elemTypeInfo->getBlockSet() & derivationMethod) != 0) { + emitError(XMLValid::TypeNoSubforBlock, elemTypeInfo->getTypeName()); + fErrorOccurred = true; + } + tempType = tempType->getBaseComplexTypeInfo(); + } + } + } + else + { + // if the original type is a simple type, check derivation ok. + if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(typeInfo->getDatatypeValidator())) { + // the type is not derived from ancestor + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + } + + if (!fErrorOccurred) + { + fTypeStack->pop(); + fTypeStack->push(typeInfo); + fCurrentDatatypeValidator = typeInfo->getDatatypeValidator(); + } + } + } + else + { + // typeInfo not found + xsiTypeDV = fGrammarResolver->getDatatypeValidator(uriStr, localPart); + + if (!xsiTypeDV) { + emitError(XMLValid::BadXsiType, fXsiType->getRawName()); + fErrorOccurred = true; + } + else { + if (fCurrentDatatypeValidator && !fCurrentDatatypeValidator->isSubstitutableBy(xsiTypeDV)) { + // the type is not derived from ancestor + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + else if(fCurrentDatatypeValidator != xsiTypeDV) + { + DatatypeValidator::ValidatorType derivedType=xsiTypeDV->getType(); + if((derivedType == DatatypeValidator::List || derivedType == DatatypeValidator::Union) && fCurrentDatatypeValidator==0) + { + // the substitution is always allowed if the type is list or union and the base type was xs:anySimpleType + } + else + { + // the type is derived from ancestor + if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) { + emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName()); + fErrorOccurred = true; + } + if (elemDef->hasAttDefs()) { + // if we have an attribute but xsi:type's type is simple, we have a problem... + emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName()); + fErrorOccurred = true; + } + } + } + + fCurrentDatatypeValidator = xsiTypeDV; + } + } + } + } + } + + delete fXsiType; + fXsiType = 0; + } + else { + // + // xsi:type was not specified... + // If the corresponding type is abstract, detect an error + // + if (elemTypeInfo && elemTypeInfo->getAbstract()) { + emitError(XMLValid::NoUseAbstractType, elemDef->getFullName()); + fErrorOccurred = true; + } + } + + // + // Check whether this element is abstract. If so, an error + // + int miscFlags = ((SchemaElementDecl*)elemDef)->getMiscFlags(); + if ((miscFlags & SchemaSymbols::XSD_ABSTRACT) != 0) { + emitError(XMLValid::NoDirectUseAbstractElement, elemDef->getFullName()); + fErrorOccurred = true; + } + + // + // Check whether this element allows Nillable + // + if (fNilFound && (miscFlags & SchemaSymbols::XSD_NILLABLE) == 0 ) { + fNil = false; + fNilFound = false; + emitError(XMLValid::NillNotAllowed, elemDef->getFullName()); + fErrorOccurred = true; + } + + fDatatypeBuffer.reset(); + fTrailing = false; + fSeenNonWhiteSpace = false; + fSeenId = false; +} + +void SchemaValidator::preContentValidation(bool, + bool validateDefAttr) +{ + // Lets go through all the grammar in the GrammarResolver + // and validate those that has not been validated yet + // + // Lets enumerate all of the elements in the element decl pool + // and put out an error for any that did not get declared. + // We also check all of the attributes as well. + // + // And enumerate all the complextype info in the grammar + // and do Unique Particle Attribution Checking + + RefHashTableOfEnumerator grammarEnum = fGrammarResolver->getGrammarEnumerator(); + while (grammarEnum.hasMoreElements()) + { + SchemaGrammar& sGrammar = (SchemaGrammar&) grammarEnum.nextElement(); + if (sGrammar.getGrammarType() != Grammar::SchemaGrammarType || sGrammar.getValidated()) + continue; + + sGrammar.setValidated(true); + + RefHash3KeysIdPoolEnumerator elemEnum = sGrammar.getElemEnumerator(); + + while (elemEnum.hasMoreElements()) + { + SchemaElementDecl& curElem = elemEnum.nextElement(); + + // First check if declared or not + // + // See if this element decl was ever marked as declared. If + // not, then put out an error. In some cases its just + // a warning, such as being referenced in a content model. + // + const SchemaElementDecl::CreateReasons reason = curElem.getCreateReason(); + + if (reason != XMLElementDecl::Declared) + { + if (reason == XMLElementDecl::AttList) + { + getScanner()->emitError + ( + XMLErrs::UndeclaredElemInAttList + , curElem.getFullName() + ); + } + else if (reason == XMLElementDecl::AsRootElem) + { + emitError + ( + XMLValid::UndeclaredElemInDocType + , curElem.getFullName() + ); + } + else if (reason == XMLElementDecl::InContentModel) + { + getScanner()->emitError + ( + XMLErrs::UndeclaredElemInCM + , curElem.getFullName() + ); + } + else + { + } + } + + // + // Then check all of the attributes of the current element. + // We check for: + // + // 1) Multiple ID attributes + // 2) That all of the default values of attributes are + // valid for their type. + // 3) That for any notation types, that their lists + // of possible values refer to declared notations. + // + if (curElem.hasAttDefs()) { + XMLAttDefList& attDefList = curElem.getAttDefList(); + bool seenId = false; + + for(XMLSize_t i=0; i janList(list, fMemoryManager); + + // + // Search forward for a space or a null. If a null, + // we are done. If a space, cap it and look it up. + // + bool breakFlag = false; + XMLCh* listPtr = list; + XMLCh* lastPtr = listPtr; + while (true) + { + while (*listPtr && (*listPtr != chSpace)) + listPtr++; + + // + // If at the end, indicate we need to break after + // this one. Else, cap it off here. + // + if (!*listPtr) + breakFlag = true; + else + *listPtr = chNull; + + if (!sGrammar.getNotationDecl(lastPtr)) + { + emitError + ( + XMLValid::UnknownNotRefAttr + , curAttDef.getFullName() + , lastPtr + ); + } + + // Break out if we hit the end last time + if (breakFlag) + break; + + // Else move upwards and try again + listPtr++; + lastPtr = listPtr; + } + } + + // If it has a default/fixed value, then validate it + if (validateDefAttr && curAttDef.getValue()) + { + validateAttrValue + ( + &curAttDef + , curAttDef.getValue() + , true + , &curElem + ); + } + } + } + } + + // For each complex type info, check the Unique Particle Attribution + if (getScanner()->getValidationSchemaFullChecking()) { + RefHashTableOf* complexTypeRegistry = sGrammar.getComplexTypeRegistry(); + + RefHashTableOfEnumerator complexTypeEnum(complexTypeRegistry, false, fMemoryManager); + while (complexTypeEnum.hasMoreElements()) + { + ComplexTypeInfo& curTypeInfo = complexTypeEnum.nextElement(); + curTypeInfo.checkUniqueParticleAttribution(&sGrammar, fGrammarResolver, fGrammarResolver->getStringPool(), this); + checkParticleDerivation(&sGrammar, &curTypeInfo); + checkRefElementConsistency(&sGrammar, &curTypeInfo); + } + + RefHashTableOf* groupInfoRegistry = sGrammar.getGroupInfoRegistry(); + RefHashTableOfEnumerator groupEnum(groupInfoRegistry, false, fMemoryManager); + + while (groupEnum.hasMoreElements()) { + + XercesGroupInfo& curGroup = groupEnum.nextElement(); + XercesGroupInfo* baseGroup = curGroup.getBaseGroup(); + + if (baseGroup) { + try { + checkParticleDerivationOk(&sGrammar, curGroup.getContentSpec(), curGroup.getScope(), + baseGroup->getContentSpec(), baseGroup->getScope()); + } + catch (const XMLException& excep) { + fSchemaErrorReporter.emitError(excep, curGroup.getLocator()); + } + } + + if (curGroup.getCheckElementConsistency()) + checkRefElementConsistency(&sGrammar, 0, &curGroup); + } + } + } +} + +void SchemaValidator::postParseValidation() +{ + // + // At this time, there is nothing to do here. The scanner itself handles + // ID/IDREF validation, since that is the same no matter what kind of + // validator. + // +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Validator method +// --------------------------------------------------------------------------- +// Do Schema Normalization depends on the WhiteSpace Facet +// preserve : No normalization is done +// replace : All occurrences of #x9 (tab), #xA (linefeed) and #xD (carriage return) +// are replaced with #x20 (space). +// collapse : Subsequent to the replacements specified above under replace, +// contiguous sequences of #x20s are collapsed to a single #x20, +// and initial and/or final #x20s are deleted. +// +void SchemaValidator::normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* const value, XMLBuffer& toFill, bool bStandalone /*= false*/) +{ + toFill.reset(); + + //empty string + if (!*value) + return; + + if(bStandalone) + fTrailing = fSeenNonWhiteSpace = false; + + short wsFacet = dV->getWSFacet(); + + // Loop through the chars of the source value and normalize it + // according to the whitespace facet + XMLCh nextCh; + const XMLCh* srcPtr = value; + XMLReader* fCurReader = getReaderMgr()->getCurrentReader(); + + if (wsFacet == DatatypeValidator::REPLACE) + { + while (*srcPtr) + { + nextCh = *srcPtr++; + if (fCurReader->isWhitespace(nextCh)) + nextCh = chSpace; + // Add this char to the target buffer + toFill.append(nextCh); + } + } + else // COLLAPSE + { + enum States + { + InWhitespace + , InContent + }; + + States curState = fTrailing ? InWhitespace : InContent; + while (*srcPtr) + { + nextCh = *srcPtr++; + if (curState == InContent) + { + if (fCurReader->isWhitespace(nextCh)) + { + curState = InWhitespace; + continue; + } + fSeenNonWhiteSpace = true; + } + else if (curState == InWhitespace) + { + if (fCurReader->isWhitespace(nextCh)) + continue; + if (fSeenNonWhiteSpace) + toFill.append(chSpace); + curState = InContent; + fSeenNonWhiteSpace = true; + } + // Add this char to the target buffer + toFill.append(nextCh); + } + + if (fCurReader->isWhitespace(*(srcPtr-1))) + fTrailing = true; + else + fTrailing = false; + } + if(bStandalone) + fTrailing = fSeenNonWhiteSpace = false; +} + + +// --------------------------------------------------------------------------- +// SchemaValidator: Particle Derivation Checking +// --------------------------------------------------------------------------- +void SchemaValidator::checkRefElementConsistency(SchemaGrammar* const currentGrammar, + const ComplexTypeInfo* const curTypeInfo, + const XercesGroupInfo* const curGroup) { + + XMLSize_t elemCount = (curTypeInfo) ? curTypeInfo->elementCount() : curGroup->elementCount(); + int elemScope = (curTypeInfo) ? curTypeInfo->getScopeDefined() : curGroup->getScope(); + XSDLocator* typeInfoLocator = (curTypeInfo) ? curTypeInfo->getLocator() : curGroup->getLocator(); + + for (XMLSize_t i=0; i < elemCount; i++) { + + const SchemaElementDecl* elemDecl = (curTypeInfo) ? curTypeInfo->elementAt(i) : curGroup->elementAt(i); + + if (elemDecl->isGlobalDecl()) { + + unsigned int elemURI = elemDecl->getURI(); + const XMLCh* elemName = elemDecl->getBaseName(); + const SchemaElementDecl* other = (SchemaElementDecl*) + currentGrammar->getElemDecl(elemURI, elemName, 0, elemScope); + + if (other + && (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() || + elemDecl->getDatatypeValidator() != other->getDatatypeValidator())) { + fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, + XMLUni::fgXMLErrDomain, typeInfoLocator, elemName, 0, 0, 0, fMemoryManager); + continue; + } + + RefHash2KeysTableOf* validSubsGroups = currentGrammar->getValidSubstitutionGroups(); + ValueVectorOf* subsElements = validSubsGroups->get(elemName, elemURI); + + if (subsElements) { + + XMLSize_t subsElemSize = subsElements->size(); + + for (XMLSize_t j=0; j < subsElemSize; j++) { + + SchemaElementDecl* subsElem = subsElements->elementAt(j); + const XMLCh* subsElemName = subsElem->getBaseName(); + other = (SchemaElementDecl*) + currentGrammar->getElemDecl(subsElem->getURI(), subsElemName, 0, elemScope); + + if (other + && (subsElem->getComplexTypeInfo() != other->getComplexTypeInfo() + || subsElem->getDatatypeValidator() != other->getDatatypeValidator())) { + fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, + XMLUni::fgXMLErrDomain, typeInfoLocator, elemName, 0, 0, 0, fMemoryManager); + } + } + } + } + } +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Particle Derivation Checking +// --------------------------------------------------------------------------- +void SchemaValidator::checkParticleDerivation(SchemaGrammar* const currentGrammar, + const ComplexTypeInfo* const curTypeInfo) { + + ComplexTypeInfo* baseTypeInfo = 0; + ContentSpecNode* curSpecNode = 0; + + if (curTypeInfo->getDerivedBy() == SchemaSymbols::XSD_RESTRICTION + && ((baseTypeInfo = curTypeInfo->getBaseComplexTypeInfo()) != 0) + && ((curSpecNode = curTypeInfo->getContentSpec()) != 0)) { + + try { + checkParticleDerivationOk(currentGrammar, curSpecNode, + curTypeInfo->getScopeDefined(), + baseTypeInfo->getContentSpec(), + baseTypeInfo->getScopeDefined(), baseTypeInfo); + } + catch (const XMLException& excep) { + fSchemaErrorReporter.emitError(excep, curTypeInfo->getLocator()); + } + } +} + +ContentSpecNode* SchemaValidator::getNonUnaryGroup(ContentSpecNode* const pNode) { + + int pNodeType = (pNode->getType() & 0x0f); + if (pNodeType == ContentSpecNode::Leaf + || pNodeType == ContentSpecNode::Any + || pNodeType == ContentSpecNode::Any_Other + || pNodeType == ContentSpecNode::Any_NS) + return pNode; + + if (pNode->getMinOccurs() == 1 && pNode->getMaxOccurs() == 1 + && pNode->getFirst() && !pNode->getSecond()) + return getNonUnaryGroup(pNode->getFirst()); + + return pNode; +} + +void SchemaValidator::checkParticleDerivationOk(SchemaGrammar* const aGrammar, + ContentSpecNode* const curNode, + const int derivedScope, + ContentSpecNode* const baseNode, + const int baseScope, + const ComplexTypeInfo* const baseInfo, + const bool toCheckOccurence) { + + // Check for pointless occurrences of all, choice, sequence. The result is + // the contentspec which is not pointless. If the result is a non-pointless + // group, Vector is filled in with the children of interest + if (curNode && !baseNode) + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_EmptyBase, fMemoryManager); + + if (!curNode) + return; + + ContentSpecNode* curSpecNode = getNonUnaryGroup(curNode); + ContentSpecNode* baseSpecNode = getNonUnaryGroup(baseNode); + ValueVectorOf curVector(8, fMemoryManager); + ValueVectorOf baseVector(8, fMemoryManager); + ContentSpecNode::NodeTypes curNodeType = curSpecNode->getType(); + ContentSpecNode::NodeTypes baseNodeType = baseSpecNode->getType(); + + if ((curNodeType & 0x0f) == ContentSpecNode::Sequence || + (curNodeType & 0x0f) == ContentSpecNode::Choice || + curNodeType == ContentSpecNode::All) { + curSpecNode = checkForPointlessOccurrences(curSpecNode, curNodeType, &curVector); + } + + if ((baseNodeType & 0x0f) == ContentSpecNode::Sequence || + (baseNodeType & 0x0f) == ContentSpecNode::Choice || + baseNodeType == ContentSpecNode::All) { + baseSpecNode = checkForPointlessOccurrences(baseSpecNode, baseNodeType, &baseVector); + } + + curNodeType = curSpecNode->getType(); + baseNodeType = baseSpecNode->getType(); + + switch (curNodeType & 0x0f) { + case ContentSpecNode::Leaf: + { + switch (baseNodeType & 0x0f) { + case ContentSpecNode::Leaf: + { + checkNameAndTypeOK(aGrammar, curSpecNode, derivedScope, baseSpecNode, baseScope, baseInfo); + return; + } + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + checkNSCompat(curSpecNode, baseSpecNode, toCheckOccurence); + return; + } + case ContentSpecNode::Choice: + case ContentSpecNode::Sequence: + case ContentSpecNode::All: + { + checkRecurseAsIfGroup(aGrammar, curSpecNode, derivedScope, + baseSpecNode, baseScope, &baseVector, baseInfo); + return; + } + default: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, fMemoryManager); + } + } + } + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + switch (baseNodeType & 0x0f) { + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + checkNSSubset(curSpecNode, baseSpecNode); + return; + } + case ContentSpecNode::Choice: + case ContentSpecNode::Sequence: + case ContentSpecNode::All: + case ContentSpecNode::Leaf: + { + if (baseNodeType == ContentSpecNode::Any_NS_Choice) { + if (checkNSSubsetChoiceRoot(curSpecNode, baseSpecNode)) { + return; + } + } + + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes1, fMemoryManager); + } + default: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, fMemoryManager); + } + } + } + case ContentSpecNode::All: + { + switch (baseNodeType & 0x0f) { + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + checkNSRecurseCheckCardinality(aGrammar, curSpecNode, &curVector, derivedScope, baseSpecNode, toCheckOccurence); + return; + } + case ContentSpecNode::All: + { + checkRecurse(aGrammar, curSpecNode, derivedScope, &curVector, + baseSpecNode, baseScope, &baseVector, baseInfo); + return; + } + case ContentSpecNode::Choice: + case ContentSpecNode::Sequence: + case ContentSpecNode::Leaf: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes2, fMemoryManager); + } + default: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, fMemoryManager); + } + } + } + case ContentSpecNode::Choice: + { + switch (baseNodeType & 0x0f) { + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + checkNSRecurseCheckCardinality(aGrammar, curSpecNode, &curVector, derivedScope, baseSpecNode, toCheckOccurence); + return; + } + case ContentSpecNode::Choice: + { + checkRecurse(aGrammar, curSpecNode, derivedScope, &curVector, + baseSpecNode, baseScope, &baseVector, baseInfo, true); + return; + } + case ContentSpecNode::All: + case ContentSpecNode::Sequence: + case ContentSpecNode::Leaf: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes3, fMemoryManager); + } + default: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, fMemoryManager); + } + } + } + case ContentSpecNode::Sequence: + { + switch (baseNodeType & 0x0f) { + case ContentSpecNode::Any: + case ContentSpecNode::Any_Other: + case ContentSpecNode::Any_NS: + { + checkNSRecurseCheckCardinality(aGrammar, curSpecNode, &curVector, derivedScope, baseSpecNode, toCheckOccurence); + return; + } + case ContentSpecNode::All: + { + checkRecurseUnordered(aGrammar, curSpecNode, &curVector, derivedScope, + baseSpecNode, &baseVector, baseScope, baseInfo); + return; + } + case ContentSpecNode::Sequence: + { + checkRecurse(aGrammar, curSpecNode, derivedScope, &curVector, + baseSpecNode, baseScope, &baseVector, baseInfo); + return; + } + case ContentSpecNode::Choice: + { + checkMapAndSum(aGrammar, curSpecNode, &curVector, derivedScope, + baseSpecNode, &baseVector, baseScope, baseInfo); + return; + } + case ContentSpecNode::Leaf: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes4, fMemoryManager); + } + default: + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_InvalidContentType, fMemoryManager); + } + } + } + } +} + +ContentSpecNode* +SchemaValidator::checkForPointlessOccurrences(ContentSpecNode* const specNode, + const ContentSpecNode::NodeTypes nodeType, + ValueVectorOf* const nodes) { + + ContentSpecNode* rightNode = specNode->getSecond(); + int min = specNode->getMinOccurs(); + int max = specNode->getMaxOccurs(); + + if (!rightNode) { + + gatherChildren(nodeType, specNode->getFirst(), nodes); + + if (nodes->size() == 1 && min == 1 && max == 1) { + return nodes->elementAt(0); + } + + return specNode; + } + + gatherChildren(nodeType, specNode->getFirst(), nodes); + gatherChildren(nodeType, rightNode, nodes); + + return specNode; +} + +void SchemaValidator::gatherChildren(const ContentSpecNode::NodeTypes parentNodeType, + ContentSpecNode* const specNode, + ValueVectorOf* const nodes) { + + if (!specNode) { + return; + } + + int min = specNode->getMinOccurs(); + int max = specNode->getMaxOccurs(); + ContentSpecNode::NodeTypes nodeType = specNode->getType(); + ContentSpecNode* rightNode = specNode->getSecond(); + + if (nodeType == ContentSpecNode::Leaf || + (nodeType & 0x0f) == ContentSpecNode::Any || + (nodeType & 0x0f) == ContentSpecNode::Any_NS || + (nodeType & 0x0f) == ContentSpecNode::Any_Other) { + nodes->addElement(specNode); + } + else if (min !=1 || max != 1) { + nodes->addElement(specNode); + } + else if (!rightNode) { + gatherChildren(nodeType, specNode->getFirst(), nodes); + } + else if ((parentNodeType & 0x0f) == (nodeType & 0x0f)) { + + gatherChildren(nodeType, specNode->getFirst(), nodes); + gatherChildren(nodeType, rightNode, nodes); + } + else { + nodes->addElement(specNode); + } +} + +void +SchemaValidator::checkNSCompat(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode, + const bool toCheckOccurence) { + + // check Occurrence ranges + if (toCheckOccurence && + !isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_OccurRangeE, + derivedSpecNode->getElement()->getLocalPart(), fMemoryManager); + } + + // check wildcard subset + if (!wildcardEltAllowsNamespace(baseSpecNode, derivedSpecNode->getElement()->getURI())) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NSCompat1, + derivedSpecNode->getElement()->getLocalPart(), fMemoryManager); + } +} + +bool +SchemaValidator::wildcardEltAllowsNamespace(const ContentSpecNode* const baseSpecNode, + const unsigned int derivedURI) { + + ContentSpecNode::NodeTypes nodeType = baseSpecNode->getType(); + + if ((nodeType & 0x0f) == ContentSpecNode::Any) { + return true; + } + + unsigned int baseURI = baseSpecNode->getElement()->getURI(); + + if ((nodeType & 0x0f) == ContentSpecNode::Any_NS) { + if (derivedURI == baseURI) { + return true; + } + } + else { // must be ANY_OTHER + if (derivedURI != baseURI && derivedURI != getScanner()->getEmptyNamespaceId()) { + return true; + } + } + + return false; +} + +void +SchemaValidator::checkNameAndTypeOK(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + const int derivedScope, + const ContentSpecNode* const baseSpecNode, + const int baseScope, + const ComplexTypeInfo* const baseInfo) { + + if (derivedSpecNode->getMaxOccurs() == 0) + return; + + unsigned int derivedURI = derivedSpecNode->getElement()->getURI(); + + // case of mixed complex types with attributes only + if (derivedURI == XMLElementDecl::fgPCDataElemId) { + return; + } + + SchemaGrammar* dGrammar = currentGrammar; + + if (derivedURI != getScanner()->getEmptyNamespaceId()) + { + const XMLCh* dURI = fGrammarResolver->getStringPool()->getValueForId(derivedURI); + dGrammar= (SchemaGrammar*) fGrammarResolver->getGrammar(dURI); + } + + if (!dGrammar) { //something is wrong + return; + } + + const XMLCh* derivedName = derivedSpecNode->getElement()->getLocalPart(); + + SchemaElementDecl* derivedElemDecl = findElement(derivedScope, derivedURI, derivedName, dGrammar); + + if (!derivedElemDecl) { + return; + } + + const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart(); + unsigned int baseURI = baseSpecNode->getElement()->getURI(); + bool subsGroup = false; + + if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) { + // Check if derived is substitutable for base. + // + SchemaElementDecl* e = derivedElemDecl->getSubstitutionGroupElem (); + + for (; e != 0; e = e->getSubstitutionGroupElem ()) { + if (XMLString::equals(e->getBaseName (), baseName) && e->getURI () == baseURI) { + break; + } + } + + if (e == 0) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NameTypeOK1, fMemoryManager); + } + + subsGroup = true; + } + + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_OccurRangeE, derivedName, fMemoryManager); + } + + // Find the schema grammar for the base element using the base type as + // a reference if it is available (it is unavailable if we are checking + // element group restriction which happens in redefine). + // + SchemaGrammar* bGrammar = dGrammar; + + if (baseInfo) + { + const XMLCh* baseTypeURI = baseInfo->getTypeUri (); + + if (baseTypeURI != 0 && *baseTypeURI != 0) // Non-empty namespace. + bGrammar= (SchemaGrammar*) fGrammarResolver->getGrammar(baseTypeURI); + + if (!bGrammar) { //something is wrong + return; + } + } + + SchemaElementDecl* baseElemDecl = + findElement(baseScope, baseURI, baseName, bGrammar, baseInfo); + + if (!baseElemDecl) { + return; + } + + int derivedFlags = derivedElemDecl->getMiscFlags(); + int baseFlags = baseElemDecl->getMiscFlags(); + + if (((baseFlags & SchemaSymbols::XSD_NILLABLE) == 0) && + ((derivedFlags & SchemaSymbols::XSD_NILLABLE) != 0)) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK2, derivedName, fMemoryManager); + } + + const XMLCh* derivedDefVal = derivedElemDecl->getDefaultValue(); + const XMLCh* baseDefVal = baseElemDecl->getDefaultValue(); + + if (baseDefVal && (baseFlags & SchemaSymbols::XSD_FIXED) != 0 && + ((derivedFlags & SchemaSymbols::XSD_FIXED) == 0 || + !XMLString::equals(derivedDefVal, baseDefVal))) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK3, derivedName, fMemoryManager); + } + + int derivedBlockSet = derivedElemDecl->getBlockSet(); + int baseBlockSet = baseElemDecl->getBlockSet(); + + if ((derivedBlockSet & baseBlockSet) != baseBlockSet) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK4, derivedName, fMemoryManager); + } + + // check identity constraints + checkICRestriction(derivedElemDecl, baseElemDecl, derivedName, baseName); + + // check that the derived element's type is derived from the base's. + if (!subsGroup) + checkTypesOK(derivedElemDecl, baseElemDecl, derivedName); +} + +SchemaElementDecl* +SchemaValidator::findElement(const int scope, const unsigned int uriIndex, + const XMLCh* const name, + SchemaGrammar* const grammar, + const ComplexTypeInfo* const typeInfo) { + + // check for element at given scope first + SchemaElementDecl* elemDecl = (SchemaElementDecl*) grammar->getElemDecl(uriIndex, name, 0, scope); + + // if not found, check at global scope + if (!elemDecl) { + + elemDecl = (SchemaElementDecl*) + grammar->getElemDecl(uriIndex, name, 0, Grammar::TOP_LEVEL_SCOPE); + + // if still not found, and base is specified, look it up there + if (!elemDecl && typeInfo) { + + const ComplexTypeInfo* baseInfo = typeInfo; + + while (baseInfo) { + + elemDecl = (SchemaElementDecl*) + grammar->getElemDecl(uriIndex, name, 0, baseInfo->getScopeDefined()); + + if (elemDecl) { + break; + } + + baseInfo = baseInfo->getBaseComplexTypeInfo(); + } + } + } + + return elemDecl; +} + +void +SchemaValidator::checkICRestriction(const SchemaElementDecl* const derivedElemDecl, + const SchemaElementDecl* const baseElemDecl, + const XMLCh* const derivedElemName, + const XMLCh* const baseElemName) { + + // REVIST - need to get more clarification + XMLSize_t derivedICCount = derivedElemDecl->getIdentityConstraintCount(); + XMLSize_t baseICCount = baseElemDecl->getIdentityConstraintCount(); + + if (derivedICCount > baseICCount) { + ThrowXMLwithMemMgr2(RuntimeException, XMLExcepts::PD_NameTypeOK6, derivedElemName, baseElemName, fMemoryManager); + } + + for (XMLSize_t i=0; i < derivedICCount; i++) { + + bool found = false; + IdentityConstraint* ic= derivedElemDecl->getIdentityConstraintAt(i); + + for (XMLSize_t j=0; j < baseICCount; j++) { + if (*ic == *(baseElemDecl->getIdentityConstraintAt(j))) { + + found = true; + break; + } + } + + if (!found) { + ThrowXMLwithMemMgr2(RuntimeException, XMLExcepts::PD_NameTypeOK7, derivedElemName, baseElemName, fMemoryManager); + } + } +} + +void +SchemaValidator::checkTypesOK(const SchemaElementDecl* const derivedElemDecl, + const SchemaElementDecl* const baseElemDecl, + const XMLCh* const derivedElemName) { + + SchemaElementDecl::ModelTypes baseType = baseElemDecl->getModelType(); + + if (baseType == SchemaElementDecl::Any) { + return; + } + + ComplexTypeInfo* rInfo = derivedElemDecl->getComplexTypeInfo(); + ComplexTypeInfo* bInfo = baseElemDecl->getComplexTypeInfo(); + + if (derivedElemDecl->getModelType() == SchemaElementDecl::Simple) { + + if (baseType != SchemaElementDecl::Simple) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); + } + + if (!rInfo) { + + DatatypeValidator* bDV = baseElemDecl->getDatatypeValidator(); + + if (bInfo || bDV == 0 || + !bDV->isSubstitutableBy(derivedElemDecl->getDatatypeValidator())) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); + } + + return; + } + } + + if (rInfo == bInfo) + return; + + for (; rInfo && rInfo != bInfo; rInfo = rInfo->getBaseComplexTypeInfo()) { + if (rInfo->getDerivedBy() != SchemaSymbols::XSD_RESTRICTION) { + + rInfo = 0; + break; + } + } + + if (!rInfo) { + ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::PD_NameTypeOK5, derivedElemName, fMemoryManager); + } +} + +void +SchemaValidator::checkRecurseAsIfGroup(SchemaGrammar* const currentGrammar, + ContentSpecNode* const derivedSpecNodeIn, + const int derivedScope, + const ContentSpecNode* const baseSpecNode, + const int baseScope, + ValueVectorOf* const baseNodes, + const ComplexTypeInfo* const baseInfo) { + + ContentSpecNode::NodeTypes baseType = baseSpecNode->getType(); + bool toLax = false; + + //Treat the element as if it were in a group of the same variety as base + ContentSpecNode derivedGroupNode(baseType, derivedSpecNodeIn, 0, false, true, fMemoryManager); + const ContentSpecNode* const derivedSpecNode = &derivedGroupNode; + + if ((baseSpecNode->getType() & 0x0f) == ContentSpecNode::Choice) { + toLax = true; + } + + // Instead of calling this routine, inline it + // checkRecurse(currentGrammar, &derivedGroupNode, derivedScope, &derivedNodes, + // baseSpecNode, baseScope, baseNodes, baseInfo, toLax); + + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); + } + + // check for mapping of children + XMLExcepts::Codes codeToThrow = XMLExcepts::NoError; + XMLSize_t count2= baseNodes->size(); + XMLSize_t current = 0; + + { + bool matched = false; + + for (XMLSize_t j = current; j < count2; j++) { + + ContentSpecNode* baseNode = baseNodes->elementAt(j); + current++; + + bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' + try { + + checkParticleDerivationOk(currentGrammar, derivedSpecNodeIn, + derivedScope, baseNode, baseScope, baseInfo); + matched = true; + break; + } + catch(const XMLException&) { + if (!toLax && baseNode->getMinTotalRange()) { + bDoBreak=true; + } + } + if(bDoBreak) + break; + } + + // did not find a match + if (!matched) { + codeToThrow = XMLExcepts::PD_Recurse2; + } + } + + // Now, see if there are some elements in the base we didn't match up + // in case of Sequence or All + if (!toLax && codeToThrow == XMLExcepts::NoError) { + for (XMLSize_t j = current; j < count2; j++) { + if (baseNodes->elementAt(j)->getMinTotalRange() * baseSpecNode->getMinOccurs()) { //!emptiable + codeToThrow = XMLExcepts::PD_Recurse2; + break; + } + } + } + + if (codeToThrow != XMLExcepts::NoError) { + ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager); + } +} + +void +SchemaValidator::checkRecurse(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + const int derivedScope, + ValueVectorOf* const derivedNodes, + const ContentSpecNode* const baseSpecNode, + const int baseScope, + ValueVectorOf* const baseNodes, + const ComplexTypeInfo* const baseInfo, + const bool toLax) { + + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); + } + + // check for mapping of children + XMLExcepts::Codes codeToThrow = XMLExcepts::NoError; + XMLSize_t count1= derivedNodes->size(); + XMLSize_t count2= baseNodes->size(); + XMLSize_t current = 0; + + for (XMLSize_t i=0; ielementAt(j); + current++; + + bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' + try { + + checkParticleDerivationOk(currentGrammar, derivedNodes->elementAt(i), + derivedScope, baseNode, baseScope, baseInfo); + matched = true; + break; + } + catch(const XMLException&) { + if (!toLax && baseNode->getMinTotalRange()) { + bDoBreak=true; + } + } + if(bDoBreak) + break; + } + + // did not find a match + if (!matched) { + + codeToThrow = XMLExcepts::PD_Recurse2; + break; + } + } + + // Now, see if there are some elements in the base we didn't match up + // in case of Sequence or All + if (!toLax && codeToThrow == XMLExcepts::NoError) { + for (XMLSize_t j = current; j < count2; j++) { + if (baseNodes->elementAt(j)->getMinTotalRange()) { //!emptiable + codeToThrow = XMLExcepts::PD_Recurse2; + break; + } + } + } + + if (codeToThrow != XMLExcepts::NoError) { + ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager); + } +} + +void SchemaValidator::checkNSSubset(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode) { + + // check Occurrence ranges + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NSSubset1, fMemoryManager); + } + + if (!isWildCardEltSubset(derivedSpecNode, baseSpecNode)) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NSSubset2, fMemoryManager); + } +} + +bool SchemaValidator::checkNSSubsetChoiceRoot(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode) { + bool found = false; + + if (baseSpecNode->getType() == ContentSpecNode::Any_NS_Choice) { + const ContentSpecNode* first = baseSpecNode->getFirst(); + const ContentSpecNode* second = baseSpecNode->getSecond(); + + if (first) { + found = checkNSSubsetChoiceRoot(derivedSpecNode, first); + if (found) return true; + } + if (second) { + found = checkNSSubsetChoiceRoot(derivedSpecNode, second); + if (found) return true; + } + } + else { // should be Any_NS + found = checkNSSubsetChoice(derivedSpecNode, baseSpecNode); + } + + return found; +} + +bool SchemaValidator::checkNSSubsetChoice(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode) { + + // check Occurrence ranges + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + return false; + } + + if (!isWildCardEltSubset(derivedSpecNode, baseSpecNode)) { + return false; + } + return true; +} + +bool +SchemaValidator::isWildCardEltSubset(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode) { + + ContentSpecNode::NodeTypes baseType = baseSpecNode->getType(); + + if ((baseType & 0x0f) == ContentSpecNode::Any) { + return true; + } + + ContentSpecNode::NodeTypes derivedType = derivedSpecNode->getType(); + unsigned int baseURI = baseSpecNode->getElement()->getURI(); + unsigned int derivedURI = derivedSpecNode->getElement()->getURI(); + + // Below we assume that empty string has id 1. + // + if (((derivedType & 0x0f) == ContentSpecNode::Any_Other) && + ((baseType & 0x0f) == ContentSpecNode::Any_Other) && + (baseURI == derivedURI || baseURI == 1)) { + return true; + } + + if ((derivedType & 0x0f) == ContentSpecNode::Any_NS) { + + if (((baseType & 0x0f) == ContentSpecNode::Any_NS) && + baseURI == derivedURI) { + return true; + } + + if (((baseType & 0x0f) == ContentSpecNode::Any_Other) && + (derivedURI == 1 || baseURI != derivedURI)) { + return true; + } + } + + return false; +} + +void +SchemaValidator::checkNSRecurseCheckCardinality(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + const bool toCheckOccurence) { + + // Implement total range check + int derivedMin = derivedSpecNode->getMinTotalRange(); + int derivedMax = derivedSpecNode->getMaxTotalRange(); + + // check Occurrence ranges + if (toCheckOccurence && + !isOccurrenceRangeOK(derivedMin, derivedMax, baseSpecNode->getMinOccurs(), + baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NSRecurseCheckCardinality1, fMemoryManager); + } + + // Check that each member of the group is a valid restriction of the wildcard + XMLSize_t nodesCount = derivedNodes->size(); + + for (XMLSize_t i = 0; i < nodesCount; i++) { + checkParticleDerivationOk(currentGrammar, derivedNodes->elementAt(i), derivedScope, baseSpecNode, -1, 0, false); + } +} + +void +SchemaValidator::checkRecurseUnordered(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + ValueVectorOf* const baseNodes, + const int baseScope, + const ComplexTypeInfo* const baseInfo) { + + // check Occurrence ranges + if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(), + baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); + } + + XMLExcepts::Codes codeToThrow = XMLExcepts::NoError; + XMLSize_t derivedCount= derivedNodes->size(); + XMLSize_t baseCount = baseNodes->size(); + bool* foundIt = (bool*) fMemoryManager->allocate + ( + baseCount * sizeof(bool) + );//new bool[baseCount]; + ArrayJanitor janFoundIt(foundIt, fMemoryManager); + + for (XMLSize_t k=0; k < baseCount; k++) { + foundIt[k] = false; + } + + // check for mapping of children + for (XMLSize_t i = 0; i < derivedCount; i++) { + + ContentSpecNode* derivedNode = derivedNodes->elementAt(i); + bool matched = false; + + for (XMLSize_t j = 0; j < baseCount; j++) { + + try { + + checkParticleDerivationOk(currentGrammar, derivedNode, derivedScope, + baseNodes->elementAt(j), baseScope, baseInfo); + + if (foundIt[j]) { + break; + } + + foundIt[j] = true; + matched = true; + break; + } + catch (const XMLException&) { + } + } + + // didn't find a match. + if (!matched) { + + codeToThrow = XMLExcepts::PD_RecurseUnordered; + break; + } + } + + // For all unmapped particles in base, check to see it it's emptiable or not + if (codeToThrow == XMLExcepts::NoError) { + for (XMLSize_t j=0; j < baseCount; j++) { + if (!foundIt[j] && baseNodes->elementAt(j)->getMinTotalRange()) { + + codeToThrow = XMLExcepts::PD_RecurseUnordered; + break; + } + } + } + + if (codeToThrow != XMLExcepts::NoError) { + ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager); + } +} + +void +SchemaValidator::checkMapAndSum(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + ValueVectorOf* const baseNodes, + const int baseScope, + const ComplexTypeInfo* const baseInfo) { + + // check Occurrence ranges + XMLSize_t derivedCount = derivedNodes->size(); + XMLSize_t baseCount = baseNodes->size(); + int derivedMin = derivedSpecNode->getMinOccurs() * (unsigned int)derivedCount; + int derivedMax = derivedSpecNode->getMaxOccurs(); + + if (derivedMax != SchemaSymbols::XSD_UNBOUNDED) { + derivedMax *= (unsigned int)derivedCount; + } + + if (!isOccurrenceRangeOK(derivedMin, derivedMax, baseSpecNode->getMinOccurs(), + baseSpecNode->getMaxOccurs())) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1, fMemoryManager); + } + + // check for mapping of children + for (XMLSize_t i = 0; i < derivedCount; i++) { + + ContentSpecNode* derivedNode = derivedNodes->elementAt(i); + bool matched = false; + + for (XMLSize_t j = 0; j < baseCount && !matched; j++) { + + try { + + checkParticleDerivationOk(currentGrammar, derivedNode, derivedScope, + baseNodes->elementAt(j), baseScope, baseInfo); + matched = true; + } + catch (const XMLException&) { + } + } + + // didn't find a match. + if (!matched) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_MapAndSum, fMemoryManager); + } + } + +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.hpp b/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.hpp new file mode 100644 index 000000000..e1dda3acb --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SchemaValidator.hpp @@ -0,0 +1,443 @@ +/* + * 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 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SCHEMAVALIDATOR_HPP) +#define XERCESC_INCLUDE_GUARD_SCHEMAVALIDATOR_HPP + +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class 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 bool checkContent + ( + XMLElementDecl* const elemDecl + , QName** const children + , XMLSize_t childCount + , XMLSize_t* indexFailingChild + ); + + 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, bool bStandalone = false); + + // ----------------------------------------------------------------------- + // 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 resetNillable(); + 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; + bool getIsXsiTypeSet() const; + const XMLCh* getNormalizedValue() const; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SchemaValidator(const SchemaValidator&); + SchemaValidator& operator=(const SchemaValidator&); + + // ----------------------------------------------------------------------- + // Element Consistency 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* const nodes); + void gatherChildren(const ContentSpecNode::NodeTypes parentNodeType, + ContentSpecNode* const specNode, + ValueVectorOf* 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* const nodes, + const ComplexTypeInfo* const baseInfo); + void checkRecurse(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + const int derivedScope, + ValueVectorOf* const derivedNodes, + const ContentSpecNode* const baseSpecNode, + const int baseScope, + ValueVectorOf* const baseNodes, + const ComplexTypeInfo* const baseInfo, + const bool toLax = false); + void checkNSSubset(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode); + bool checkNSSubsetChoiceRoot(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode); + bool checkNSSubsetChoice(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode); + bool isWildCardEltSubset(const ContentSpecNode* const derivedSpecNode, + const ContentSpecNode* const baseSpecNode); + void checkNSRecurseCheckCardinality(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + const bool toCheckOccurence); + void checkRecurseUnordered(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + ValueVectorOf* const baseNodes, + const int baseScope, + const ComplexTypeInfo* const baseInfo); + void checkMapAndSum(SchemaGrammar* const currentGrammar, + const ContentSpecNode* const derivedSpecNode, + ValueVectorOf* const derivedNodes, + const int derivedScope, + ContentSpecNode* const baseSpecNode, + ValueVectorOf* const baseNodes, + const int baseScope, + const ComplexTypeInfo* const baseInfo); + ContentSpecNode* getNonUnaryGroup(ContentSpecNode* const pNode); + + // ----------------------------------------------------------------------- + // Private data members + // + // ----------------------------------------------------------------------- + // The following comes from or set by the Scanner + // fSchemaGrammar + // The current schema grammar used by the validator + // + // fGrammarResolver + // All the schema grammar stored + // + // fXsiType + // Store the Schema Type Attribute Value if schema type is specified + // + // fNil + // Indicates if a nil value is acceptable + // fNilFound + // Indicates if Nillable has been set + // ----------------------------------------------------------------------- + // The following used internally in the validator + // + // fCurrentDatatypeValidator + // The validator used for validating the content of elements + // with simple types + // + // fDatatypeBuffer + // Buffer for simple type element string content + // + // fTrailing + // Previous chunk had a trailing space + // + // fSeenNonWhiteSpace + // Seen a non-whitespace character in the previous chunk + // + // fSeenId + // Indicate if an attribute of ID type has been seen already, reset per element. + // + // fSchemaErrorReporter + // Report schema process errors + // + // fTypeStack + // Stack of complex type declarations. + // + // fMostRecentAttrValidator + // DatatypeValidator that validated attribute most recently processed + // + // fErrorOccurred + // whether an error occurred in the most recent operation + // ----------------------------------------------------------------------- + MemoryManager* fMemoryManager; + SchemaGrammar* fSchemaGrammar; + GrammarResolver* fGrammarResolver; + QName* fXsiType; + bool fNil; + bool fNilFound; + DatatypeValidator* fCurrentDatatypeValidator; + XMLBuffer* fNotationBuf; + XMLBuffer fDatatypeBuffer; + bool fTrailing; + bool fSeenNonWhiteSpace; + bool fSeenId; + XSDErrorReporter fSchemaErrorReporter; + ValueStackOf* fTypeStack; + DatatypeValidator * fMostRecentAttrValidator; + bool fErrorOccurred; + bool fElemIsSpecified; +}; + + +// --------------------------------------------------------------------------- +// SchemaValidator: Setter methods +// --------------------------------------------------------------------------- +inline void SchemaValidator::setGrammarResolver(GrammarResolver* grammarResolver) { + fGrammarResolver = grammarResolver; +} + +inline void SchemaValidator::setXsiType(const XMLCh* const prefix + , const XMLCh* const localPart + , const unsigned int uriId) +{ + delete fXsiType; + fXsiType = new (fMemoryManager) QName(prefix, localPart, uriId, fMemoryManager); +} + +inline void SchemaValidator::setNillable(bool isNil) { + fNil = isNil; + fNilFound = true; +} + +inline void SchemaValidator::resetNillable() { + fNil = false; + fNilFound = false; +} + +inline void SchemaValidator::setExitOnFirstFatal(const bool newValue) { + + fSchemaErrorReporter.setExitOnFirstFatal(newValue); +} + +inline void SchemaValidator::setDatatypeBuffer(const XMLCh* const value) +{ + fDatatypeBuffer.append(value); +} + +inline void SchemaValidator::clearDatatypeBuffer() +{ + fDatatypeBuffer.reset(); +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Getter methods +// --------------------------------------------------------------------------- +inline ComplexTypeInfo* SchemaValidator::getCurrentTypeInfo() const { + if (fTypeStack->empty()) + return 0; + return fTypeStack->peek(); +} + +inline DatatypeValidator * SchemaValidator::getCurrentDatatypeValidator() const +{ + return fCurrentDatatypeValidator; +} +inline DatatypeValidator *SchemaValidator::getMostRecentAttrValidator() const +{ + return fMostRecentAttrValidator; +} + +// --------------------------------------------------------------------------- +// Virtual interface +// --------------------------------------------------------------------------- +inline Grammar* SchemaValidator::getGrammar() const { + return fSchemaGrammar; +} + +inline void SchemaValidator::setGrammar(Grammar* aGrammar) { + fSchemaGrammar = (SchemaGrammar*) aGrammar; +} + +inline void SchemaValidator::setErrorReporter(XMLErrorReporter* const errorReporter) { + + XMLValidator::setErrorReporter(errorReporter); + fSchemaErrorReporter.setErrorReporter(errorReporter); +} + +// --------------------------------------------------------------------------- +// SchemaValidator: DTD handler interface +// --------------------------------------------------------------------------- +inline bool SchemaValidator::handlesDTD() const +{ + // No DTD scanning + return false; +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Schema handler interface +// --------------------------------------------------------------------------- +inline bool SchemaValidator::handlesSchema() const +{ + return true; +} + +// --------------------------------------------------------------------------- +// SchemaValidator: Particle derivation checking +// --------------------------------------------------------------------------- +inline bool +SchemaValidator::isOccurrenceRangeOK(const int min1, const int max1, + const int min2, const int max2) { + + if (min1 >= min2 && + (max2 == SchemaSymbols::XSD_UNBOUNDED || + (max1 != SchemaSymbols::XSD_UNBOUNDED && max1 <= max2))) { + return true; + } + return false; +} + +inline bool SchemaValidator::getErrorOccurred() const +{ + return fErrorOccurred; +} + +inline bool SchemaValidator::getIsElemSpecified() const +{ + return fElemIsSpecified; +} + +inline const XMLCh* SchemaValidator::getNormalizedValue() const +{ + return fDatatypeBuffer.getRawBuffer(); +} + +inline bool SchemaValidator::getIsXsiTypeSet() const +{ + return (fXsiType!=0); +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp b/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp new file mode 100644 index 000000000..dbb5d7f01 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp @@ -0,0 +1,210 @@ +/* + * 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: SubstitutionGroupComparator.cpp 794273 2009-07-15 14:13:07Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +bool SubstitutionGroupComparator::isEquivalentTo(const QName* const anElement + , const QName* const exemplar) +{ + if (!anElement && !exemplar) + return true; + + if ((!anElement && exemplar) || (anElement && !exemplar)) + return false; + + + if (XMLString::equals(anElement->getLocalPart(), exemplar->getLocalPart()) && + (anElement->getURI() == exemplar->getURI())) + return true; // they're the same! + + if (!fGrammarResolver || !fStringPool ) + { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::SubGrpComparator_NGR, anElement->getMemoryManager()); + } + + unsigned int uriId = anElement->getURI(); + if (uriId == XMLContentModel::gEOCFakeId || + uriId == XMLContentModel::gEpsilonFakeId || + uriId == XMLElementDecl::fgPCDataElemId || + uriId == XMLElementDecl::fgInvalidElemId) + return false; + + const XMLCh* uri = fStringPool->getValueForId(uriId); + const XMLCh* localpart = anElement->getLocalPart(); + + // In addition to simply trying to find a chain between anElement and exemplar, + // we need to make sure that no steps in the chain are blocked. + // That is, at every step, we need to make sure that the element + // being substituted for will permit being substituted + // for, and whether the type of the element will permit derivations in + // instance documents of this sort. + + if (!uri) + return false; + + SchemaGrammar *sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uri); + if (!sGrammar || sGrammar->getGrammarType() == Grammar::DTDGrammarType) + return false; + + SchemaElementDecl* anElementDecl = (SchemaElementDecl*) sGrammar->getElemDecl(uriId, localpart, 0, Grammar::TOP_LEVEL_SCOPE); + if (!anElementDecl) + return false; + + SchemaElementDecl* pElemDecl = anElementDecl->getSubstitutionGroupElem(); + bool foundIt = false; + + while (pElemDecl) //(substitutionGroupFullName) + { + if (XMLString::equals(pElemDecl->getBaseName(), exemplar->getLocalPart()) && + (pElemDecl->getURI() == exemplar->getURI())) + { + // time to check for block value on element + if((pElemDecl->getBlockSet() & SchemaSymbols::XSD_SUBSTITUTION) != 0) + return false; + + foundIt = true; + break; + } + + pElemDecl = pElemDecl->getSubstitutionGroupElem(); + }//while + + if (!foundIt) + return false; + + // this will contain anElement's complexType information. + ComplexTypeInfo *aComplexType = anElementDecl->getComplexTypeInfo(); + int exemplarBlockSet = pElemDecl->getBlockSet(); + + if(!aComplexType) + { + // check on simpleType case + DatatypeValidator *anElementDV = anElementDecl->getDatatypeValidator(); + DatatypeValidator *exemplarDV = pElemDecl->getDatatypeValidator(); + + return((anElementDV == 0) || + ((anElementDV == exemplarDV) || + ((exemplarBlockSet & SchemaSymbols::XSD_RESTRICTION) == 0))); + } + + // 2.3 The set of all {derivation method}s involved in the derivation of D's {type definition} from C's {type definition} does not intersect with the union of the blocking constraint, C's {prohibited substitutions} (if C is complex, otherwise the empty set) and the {prohibited substitutions} (respectively the empty set) of any intermediate {type definition}s in the derivation of D's {type definition} from C's {type definition}. + // prepare the combination of {derivation method} and + // {disallowed substitution} + int devMethod = 0; + int blockConstraint = exemplarBlockSet; + + ComplexTypeInfo *exemplarComplexType = pElemDecl->getComplexTypeInfo(); + ComplexTypeInfo *tempType = aComplexType;; + + while (tempType != 0 && + tempType != exemplarComplexType) + { + devMethod |= tempType->getDerivedBy(); + tempType = tempType->getBaseComplexTypeInfo(); + if (tempType) { + blockConstraint |= tempType->getBlockSet(); + } + } + if (tempType != exemplarComplexType) { + return false; + } + if ((devMethod & blockConstraint) != 0) { + return false; + } + + return true; +} + + +bool SubstitutionGroupComparator::isAllowedByWildcard(SchemaGrammar* const pGrammar, + QName* const element, + unsigned int wuri, bool wother) +{ + // whether the uri is allowed directly by the wildcard + unsigned int uriId = element->getURI(); + + // Here we assume that empty string has id 1. + // + if ((!wother && uriId == wuri) || + (wother && + uriId != 1 && + uriId != wuri && + uriId != XMLContentModel::gEOCFakeId && + uriId != XMLContentModel::gEpsilonFakeId && + uriId != XMLElementDecl::fgPCDataElemId && + uriId != XMLElementDecl::fgInvalidElemId)) + { + return true; + } + + // get all elements that can substitute the current element + RefHash2KeysTableOf* theValidSubstitutionGroups = pGrammar->getValidSubstitutionGroups(); + + if (!theValidSubstitutionGroups) + return false; + + ValueVectorOf* subsElements = theValidSubstitutionGroups->get(element->getLocalPart(), uriId); + + if (!subsElements) + return false; + + // then check whether there exists one element that is allowed by the wildcard + XMLSize_t size = subsElements->size(); + + for (XMLSize_t i = 0; i < size; i++) + { + unsigned int subUriId = subsElements->elementAt(i)->getElementName()->getURI(); + + // Here we assume that empty string has id 1. + // + if ((!wother && subUriId == wuri) || + (wother && + subUriId != 1 && + subUriId != wuri && + subUriId != XMLContentModel::gEOCFakeId && + subUriId != XMLContentModel::gEpsilonFakeId && + subUriId != XMLElementDecl::fgPCDataElemId && + subUriId != XMLElementDecl::fgInvalidElemId)) + { + return true; + } + } + return false; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file SubstitutionGroupComparator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.hpp b/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.hpp new file mode 100644 index 000000000..c5ab8ff9b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/SubstitutionGroupComparator.hpp @@ -0,0 +1,126 @@ +/* + * 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: SubstitutionGroupComparator.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_SUBSTITUTIONGROUPCOMPARATOR_HPP) +#define XERCESC_INCLUDE_GUARD_SUBSTITUTIONGROUPCOMPARATOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class SchemaGrammar; + +class VALIDATORS_EXPORT SubstitutionGroupComparator : public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Public Constructor + // ----------------------------------------------------------------------- + /** @name Constructor. */ + //@{ + + SubstitutionGroupComparator(GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool); + + + //@} + + // ----------------------------------------------------------------------- + // Public Destructor + // ----------------------------------------------------------------------- + /** @name Destructor. */ + //@{ + + ~SubstitutionGroupComparator(); + + //@} + + // ----------------------------------------------------------------------- + // Validation methods + // ----------------------------------------------------------------------- + /** @name Validation Function */ + //@{ + + /** + * Checks that the "anElement" is within the substitution group. + * + * @param anElement QName of the element + * + * @param exemplar QName of the head element in the group + */ + bool isEquivalentTo(const QName* const anElement + , const QName* const exemplar); + //@} + + /* + * check whether one element or any element in its substitution group + * is allowed by a given wildcard uri + * + * @param pGrammar the grammar where the wildcard is declared + * @param element the QName of a given element + * @param wuri the uri of the wildcard + * @param wother whether the uri is from ##other, so wuri is excluded + * + * @return whether the element is allowed by the wildcard + */ + bool isAllowedByWildcard(SchemaGrammar* const pGrammar, QName* const element, unsigned int wuri, bool wother); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SubstitutionGroupComparator(); + SubstitutionGroupComparator(const SubstitutionGroupComparator&); + SubstitutionGroupComparator& operator=(const SubstitutionGroupComparator&); + + // ----------------------------------------------------------------------- + // Private data members + // + // + // ----------------------------------------------------------------------- + GrammarResolver *fGrammarResolver; + XMLStringPool *fStringPool; +}; + + +// --------------------------------------------------------------------------- +// SubstitutionGroupComparator: Getters +// --------------------------------------------------------------------------- +inline SubstitutionGroupComparator::SubstitutionGroupComparator(GrammarResolver* const pGrammarResolver + , XMLStringPool* const pStringPool) +:fGrammarResolver(pGrammarResolver) +,fStringPool(pStringPool) +{} + +inline SubstitutionGroupComparator::~SubstitutionGroupComparator() +{} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file SubstitutionGroupComparator.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.cpp b/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.cpp new file mode 100644 index 000000000..8c561e01c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.cpp @@ -0,0 +1,9459 @@ +/* + * 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: TraverseSchema.cpp 925236 2010-03-19 14:29:47Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// TraverseSchema: Local declaration +// --------------------------------------------------------------------------- + +// This helper class will handle the parsing of namespace prefixes for a given DOMElement, and its winding back +class NamespaceScopeManager +{ +public: + NamespaceScopeManager(const DOMElement* const node, SchemaInfo* info, TraverseSchema* traverser) + { + fScopeAdded=node?traverser->retrieveNamespaceMapping(node):false; + fSchemaInfo=info; + } + ~NamespaceScopeManager() + { + if(fScopeAdded) + fSchemaInfo->getNamespaceScope()->decreaseDepth(); + + } +protected: + bool fScopeAdded; + SchemaInfo* fSchemaInfo; +}; + +// --------------------------------------------------------------------------- +// TraverseSchema: Static member data +// --------------------------------------------------------------------------- + + +// --------------------------------------------------------------------------- +// TraverseSchema: Local const data +// --------------------------------------------------------------------------- +static const XMLCh fgAnonSNamePrefix[] = +{ + chUnderscore, chUnderscore, chLatin_A, chLatin_n, chLatin_o, chLatin_n, chLatin_S, chNull +}; + +static const XMLCh fgAnonCNamePrefix[] = +{ + chUnderscore, chUnderscore, chLatin_A, chLatin_n, chLatin_o, chLatin_n, chLatin_C, chNull +}; + +static const XMLCh fgUnbounded[] = +{ + chLatin_u, chLatin_n, chLatin_b, chLatin_o, chLatin_u, chLatin_n, chLatin_d, + chLatin_e, chLatin_d, chNull +}; + +static const XMLCh fgValueOne[] = +{ + chDigit_1, chNull +}; + +static const XMLCh fgValueZero[] = +{ + chDigit_0, chNull +}; + +static const XMLCh* fgIdentityConstraints[] = +{ + SchemaSymbols::fgELT_UNIQUE, + SchemaSymbols::fgELT_KEY, + SchemaSymbols::fgELT_KEYREF +}; + +static const XMLCh fgSynthetic_Annotation[] = +{ + chLatin_S, chLatin_y, chLatin_n, chLatin_t, chLatin_h, chLatin_e, chLatin_t + , chLatin_i, chLatin_c, chUnderscore + , chLatin_A, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t + , chLatin_i, chLatin_o, chLatin_n, chNull +}; + + +// Flags for global declaration +enum { + ENUM_ELT_SIMPLETYPE, + ENUM_ELT_COMPLEXTYPE, + ENUM_ELT_ELEMENT, + ENUM_ELT_ATTRIBUTE, + ENUM_ELT_ATTRIBUTEGROUP, + ENUM_ELT_GROUP, + ENUM_ELT_SIZE +}; + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// TraverseSchema: Constructors and Destructor +// --------------------------------------------------------------------------- +TraverseSchema::TraverseSchema( DOMElement* const schemaRoot + , XMLStringPool* const uriStringPool + , SchemaGrammar* const schemaGrammar + , GrammarResolver* const grammarResolver + , RefHash2KeysTableOf* cachedSchemaInfoList + , RefHash2KeysTableOf* schemaInfoList + , XMLScanner* const xmlScanner + , const XMLCh* const schemaURL + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errorReporter + , MemoryManager* const manager + , bool multipleImport) + : fFullConstraintChecking(false) + , fTargetNSURI(-1) + , fEmptyNamespaceURI(-1) + , fCurrentScope(Grammar::TOP_LEVEL_SCOPE) + , fScopeCount(schemaGrammar->getScopeCount ()) + , fAnonXSTypeCount(schemaGrammar->getAnonTypeCount ()) + , fCircularCheckIndex(0) + , fTargetNSURIString(0) + , fDatatypeRegistry(0) + , fGrammarResolver(grammarResolver) + , fSchemaGrammar(schemaGrammar) + , fEntityHandler(entityHandler) + , fErrorReporter(errorReporter) + , fURIStringPool(uriStringPool) + , fStringPool(0) + , fBuffer(1023, manager) + , fScanner(xmlScanner) + , fAttributeDeclRegistry(0) + , fComplexTypeRegistry(0) + , fGroupRegistry(0) + , fAttGroupRegistry(0) + , fIC_ElementsNS(0) + , fPreprocessedNodes(0) + , fSchemaInfo(0) + , fCurrentGroupInfo(0) + , fCurrentAttGroupInfo(0) + , fCurrentComplexType(0) + , fCurrentTypeNameStack(0) + , fCurrentGroupStack(0) + , fIC_Elements(0) + , fDeclStack(0) + , fGlobalDeclarations(0) + , fNonXSAttList(0) + , fImportedNSList(0) + , fIC_NodeListNS(0) + , fNotationRegistry(0) + , fRedefineComponents(0) + , fIdentityConstraintNames(0) + , fValidSubstitutionGroups(0) + , fSchemaInfoList(schemaInfoList) + , fCachedSchemaInfoList (cachedSchemaInfoList) + , fParser(0) + , fLocator(0) + , fMemoryManager(manager) + , fGrammarPoolMemoryManager(fGrammarResolver->getGrammarPoolMemoryManager()) + , fAnnotation(0) + , fAttributeCheck(manager) +{ + CleanupType cleanup(this, &TraverseSchema::cleanUp); + + try { + + if (fGrammarResolver && schemaRoot && fURIStringPool) { + + init(); + + if (multipleImport) + { + // If we are working on an existing schema, do some + // intitialization that is otherwise done by preprocessSchema. + // + fComplexTypeRegistry = fSchemaGrammar->getComplexTypeRegistry(); + fGroupRegistry = fSchemaGrammar->getGroupInfoRegistry(); + fAttGroupRegistry = fSchemaGrammar->getAttGroupInfoRegistry(); + fAttributeDeclRegistry = fSchemaGrammar->getAttributeDeclRegistry(); + fValidSubstitutionGroups = fSchemaGrammar->getValidSubstitutionGroups(); + } + + preprocessSchema(schemaRoot, schemaURL, multipleImport); + doTraverseSchema(schemaRoot); + + // Store the scope and anon type counts in case we need to add + // more to this grammar (multi-import case). schemaGrammar and + // fSchemaGrammar should be the same here. + // + fSchemaGrammar->setScopeCount (fScopeCount); + fSchemaGrammar->setAnonTypeCount (fAnonXSTypeCount); + } + + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +TraverseSchema::~TraverseSchema() +{ + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// TraverseSchema: Traversal methods +// --------------------------------------------------------------------------- +void TraverseSchema::doTraverseSchema(const DOMElement* const schemaRoot) { + + // process children nodes + processChildren(schemaRoot); + + // Handle identity constraints - keyref + if (fIC_ElementsNS && fIC_ElementsNS->containsKey(fTargetNSURIString)) { + + fIC_Elements = fIC_ElementsNS->get(fTargetNSURIString); + + XMLSize_t icListSize = fIC_Elements->size(); + + for (XMLSize_t i=0; i < icListSize; i++) { + + SchemaElementDecl* curElem = fIC_Elements->elementAt(i); + ValueVectorOf* icNodes = fIC_NodeListNS->get(curElem); + XMLSize_t icNodesSize = icNodes->size(); + + for (XMLSize_t j = 0; j < icNodesSize; j++) { + traverseKeyRef(icNodes->elementAt(j), curElem); + } + } + } + + if (fScanner->getValidateAnnotations() && !fSchemaGrammar->getAnnotations()->isEmpty()) + { + validateAnnotations(); + } + fSchemaInfo->setProcessed(); +} + +void TraverseSchema::preprocessSchema(DOMElement* const schemaRoot, + const XMLCh* const schemaURL, + bool multipleImport) { + if (!multipleImport) { + // Make sure namespace binding is defaulted + const XMLCh* rootPrefix = schemaRoot->getPrefix(); + + if (rootPrefix == 0 || !*rootPrefix) { + + const XMLCh* xmlnsStr = schemaRoot->getAttribute(XMLUni::fgXMLNSString); + + if (!xmlnsStr || !*xmlnsStr) { + schemaRoot->setAttribute(XMLUni::fgXMLNSString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + } + } + + // Set schemaGrammar data and add it to GrammarResolver + // For complex type registry, attribute decl registry , group/attGroup + // and namespace mapping, needs to check whether the passed in + // Grammar was a newly instantiated one. + fComplexTypeRegistry = fSchemaGrammar->getComplexTypeRegistry(); + + if (fComplexTypeRegistry == 0 ) { + + fComplexTypeRegistry = new (fGrammarPoolMemoryManager) RefHashTableOf(29, fGrammarPoolMemoryManager); + fSchemaGrammar->setComplexTypeRegistry(fComplexTypeRegistry); + } + + fGroupRegistry = fSchemaGrammar->getGroupInfoRegistry(); + + if (fGroupRegistry == 0 ) { + + fGroupRegistry = new (fGrammarPoolMemoryManager) RefHashTableOf(13, fGrammarPoolMemoryManager); + fSchemaGrammar->setGroupInfoRegistry(fGroupRegistry); + } + + fAttGroupRegistry = fSchemaGrammar->getAttGroupInfoRegistry(); + + if (fAttGroupRegistry == 0 ) { + + fAttGroupRegistry = new (fGrammarPoolMemoryManager) RefHashTableOf(13, fGrammarPoolMemoryManager); + fSchemaGrammar->setAttGroupInfoRegistry(fAttGroupRegistry); + } + + fAttributeDeclRegistry = fSchemaGrammar->getAttributeDeclRegistry(); + + if (fAttributeDeclRegistry == 0) { + + fAttributeDeclRegistry = new (fGrammarPoolMemoryManager) RefHashTableOf(29, fGrammarPoolMemoryManager); + fSchemaGrammar->setAttributeDeclRegistry(fAttributeDeclRegistry); + } + + fValidSubstitutionGroups = fSchemaGrammar->getValidSubstitutionGroups(); + + if (!fValidSubstitutionGroups) { + + fValidSubstitutionGroups = new (fGrammarPoolMemoryManager) RefHash2KeysTableOf(29, fGrammarPoolMemoryManager); + fSchemaGrammar->setValidSubstitutionGroups(fValidSubstitutionGroups); + } + + //Retrieve the targetnamespace URI information + const XMLCh* targetNSURIStr = schemaRoot->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + fSchemaGrammar->setTargetNamespace(targetNSURIStr); + + fCurrentScope = Grammar::TOP_LEVEL_SCOPE; + fTargetNSURIString = fSchemaGrammar->getTargetNamespace(); + fTargetNSURI = fURIStringPool->addOrFind(fTargetNSURIString); + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) fSchemaGrammar->getGrammarDescription(); + gramDesc->setTargetNamespace(fTargetNSURIString); + + fGrammarResolver->putGrammar(fSchemaGrammar); + } + else { + fCurrentScope = Grammar::TOP_LEVEL_SCOPE; + + fTargetNSURIString = fSchemaGrammar->getTargetNamespace(); + fTargetNSURI = fURIStringPool->addOrFind(fTargetNSURIString); + } + + SchemaInfo* currInfo = new (fMemoryManager) SchemaInfo(0, 0, 0, fTargetNSURI, + fSchemaInfo?fSchemaInfo->getNamespaceScope():NULL, + schemaURL, + fTargetNSURIString, schemaRoot, + fScanner, + fGrammarPoolMemoryManager); + + if (fSchemaInfo) + fSchemaInfo->addSchemaInfo(currInfo, SchemaInfo::IMPORT); + else + { + currInfo->getNamespaceScope()->reset(fEmptyNamespaceURI); + // Add mapping for the xml prefix + currInfo->getNamespaceScope()->addPrefix(XMLUni::fgXMLString, fURIStringPool->addOrFind(XMLUni::fgXMLURIName)); + } + addImportedNS(currInfo->getTargetNSURI()); + + fSchemaInfo = currInfo; + fSchemaInfoList->put((void*) fSchemaInfo->getCurrentSchemaURL(), fSchemaInfo->getTargetNSURI(), fSchemaInfo); + fSchemaInfo->addSchemaInfo(fSchemaInfo, SchemaInfo::INCLUDE); + traverseSchemaHeader(schemaRoot); + + // preprocess chidren + preprocessChildren(schemaRoot); +} + + +void TraverseSchema::traverseSchemaHeader(const DOMElement* const schemaRoot) { + + // Make sure that the root element is + if (!XMLString::equals(schemaRoot->getLocalName(), SchemaSymbols::fgELT_SCHEMA)) { + reportSchemaError(schemaRoot, XMLUni::fgXMLErrDomain, XMLErrs::InvalidXMLSchemaRoot); + } + + // Make sure that the targetNamespace value is not empty string + checkForEmptyTargetNamespace(schemaRoot); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + schemaRoot, GeneralAttributeCheck::E_Schema, this + , true, fSchemaInfo->getNonXSAttList() + ); + + retrieveNamespaceMapping(schemaRoot); + // Add mapping for the default namespace + if ((!fTargetNSURIString || !*fTargetNSURIString) && schemaRoot->getAttributeNode(XMLUni::fgXMLNSString)==NULL) + fSchemaInfo->getNamespaceScope()->addPrefix(XMLUni::fgZeroLenString, fEmptyNamespaceURI); + + unsigned short elemAttrDefaultQualified = 0; + + if (XMLString::equals(schemaRoot->getAttribute(SchemaSymbols::fgATT_ELEMENTFORMDEFAULT), + SchemaSymbols::fgATTVAL_QUALIFIED)) { + elemAttrDefaultQualified |= Elem_Def_Qualified; + } + + if (XMLString::equals(schemaRoot->getAttribute(SchemaSymbols::fgATT_ATTRIBUTEFORMDEFAULT), + SchemaSymbols::fgATTVAL_QUALIFIED)) { + elemAttrDefaultQualified |= Attr_Def_Qualified; + } + + fSchemaInfo->setElemAttrDefaultQualified(elemAttrDefaultQualified); + fSchemaInfo->setBlockDefault(parseBlockSet(schemaRoot, ES_Block, true)); + fSchemaInfo->setFinalDefault(parseFinalSet(schemaRoot, ECS_Final, true)); +} + + +XSAnnotation* +TraverseSchema::traverseAnnotationDecl(const DOMElement* const annotationElem, + ValueVectorOf* const nonXSAttList, + const bool topLevel) { + + NamespaceScopeManager nsMgr(annotationElem, fSchemaInfo, this); + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + annotationElem, GeneralAttributeCheck::E_Annotation, this, topLevel + ); + + const XMLCh* contents = 0; + DOMElement* child = XUtil::getFirstChildElement(annotationElem); + if (child) { + for (; + child != 0; + child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + + if (XMLString::equals(name, SchemaSymbols::fgELT_APPINFO)) { + + DOMNode* textContent = child->getFirstChild(); + if (textContent && textContent->getNodeType() == DOMNode::TEXT_NODE) + contents = ((DOMText*) textContent)->getData(); + + fAttributeCheck.checkAttributes(child, GeneralAttributeCheck::E_Appinfo, this); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_DOCUMENTATION)) { + + DOMNode* textContent = child->getFirstChild(); + if (textContent && textContent->getNodeType() == DOMNode::TEXT_NODE) + contents = ((DOMText*) textContent)->getData(); + + fAttributeCheck.checkAttributes(child, GeneralAttributeCheck::E_Documentation, this); + } + else { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::InvalidAnnotationContent); + } + } + } + else + { + // If the Annotation has no children, get the text directly + DOMNode* textContent = annotationElem->getFirstChild(); + if (textContent && textContent->getNodeType() == DOMNode::TEXT_NODE) + contents = ((DOMText*) textContent)->getData(); + } + + if (contents && !fScanner->getIgnoreAnnotations()) + { + XSAnnotation* theAnnotation = 0; + + XMLSize_t nonXSAttSize = nonXSAttList->size(); + + if (nonXSAttSize) + { + int annotTokenStart = XMLString::patternMatch( + contents, SchemaSymbols::fgELT_ANNOTATION); + + if (annotTokenStart == -1) // something is wrong + return 0; + + // set annotation element + fBuffer.set(contents, annotTokenStart + 10); + + for (XMLSize_t i=0; ielementAt(i); + + if (!XMLString::equals( + annotationElem->getAttributeNS( + attNode->getNamespaceURI(), attNode->getLocalName()) + , XMLUni::fgZeroLenString) + ) + { + continue; + } + + fBuffer.append(chSpace); + fBuffer.append(attNode->getNodeName()); + fBuffer.append(chEqual); + fBuffer.append(chDoubleQuote); + processAttValue(attNode->getNodeValue(), fBuffer); + fBuffer.append(chDoubleQuote); + } + + // add remaining annotation content + fBuffer.append(contents + annotTokenStart + 10); + + theAnnotation = new (fGrammarPoolMemoryManager) XSAnnotation(fBuffer.getRawBuffer(), fGrammarPoolMemoryManager); + } + else + { + theAnnotation = new (fGrammarPoolMemoryManager) XSAnnotation(contents, fGrammarPoolMemoryManager); + } + + /*** + * set line, col and systemId info + ***/ + theAnnotation->setLineCol( + ((XSDElementNSImpl*)annotationElem)->getLineNo() + , ((XSDElementNSImpl*)annotationElem)->getColumnNo() + ); + theAnnotation->setSystemId(fSchemaInfo->getCurrentSchemaURL()); + + return theAnnotation; + } + + return 0; +} + + +/** + * Traverse include + * + * + * Content: (annotation?) + * + */ +void TraverseSchema::preprocessInclude(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Include, this, true, fNonXSAttList); + + // ----------------------------------------------------------------------- + // First, handle any ANNOTATION declaration + // ----------------------------------------------------------------------- + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + + if (fAnnotation) + fSchemaGrammar->addAnnotation(fAnnotation); + else if (fScanner->getGenerateSyntheticAnnotations() && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + fSchemaGrammar->addAnnotation(fAnnotation); + } + + // ----------------------------------------------------------------------- + // Get 'schemaLocation' attribute + // ----------------------------------------------------------------------- + const XMLCh* schemaLocation = getElementAttValue(elem, SchemaSymbols::fgATT_SCHEMALOCATION, DatatypeValidator::AnyURI); + + if (!schemaLocation || !*schemaLocation) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNoSchemaLocation, SchemaSymbols::fgELT_INCLUDE); + return; + } + + // ------------------------------------------------------------------ + // Resolve schema location + // ------------------------------------------------------------------ + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + InputSource* srcToFill = resolveSchemaLocation(schemaLocation, + XMLResourceIdentifier::SchemaInclude); + Janitor janSrc(srcToFill); + + // Nothing to do + if (!srcToFill) { + return; + } + + const XMLCh* includeURL = srcToFill->getSystemId(); + SchemaInfo* includeSchemaInfo = fCachedSchemaInfoList->get(includeURL, fTargetNSURI); + + if (!includeSchemaInfo && fSchemaInfoList != fCachedSchemaInfoList) + includeSchemaInfo = fSchemaInfoList->get(includeURL, fTargetNSURI); + + if (includeSchemaInfo) { + + fSchemaInfo->addSchemaInfo(includeSchemaInfo, SchemaInfo::INCLUDE); + return; + } + + // ------------------------------------------------------------------ + // Parse input source + // ------------------------------------------------------------------ + if (!fParser) + fParser = new (fGrammarPoolMemoryManager) XSDDOMParser(0, fGrammarPoolMemoryManager, 0); + + fParser->setValidationScheme(XercesDOMParser::Val_Never); + fParser->setDoNamespaces(true); + fParser->setUserEntityHandler(fEntityHandler); + fParser->setUserErrorReporter(fErrorReporter); + + // Should just issue warning if the schema is not found + bool flag = srcToFill->getIssueFatalErrorIfNotFound(); + srcToFill->setIssueFatalErrorIfNotFound(false); + + fParser->parse(*srcToFill); + + // Reset the InputSource + srcToFill->setIssueFatalErrorIfNotFound(flag); + + if (fParser->getSawFatal() && fScanner->getExitOnFirstFatal()) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::SchemaScanFatalError); + + // ------------------------------------------------------------------ + // Get root element + // ------------------------------------------------------------------ + DOMDocument* document = fParser->getDocument(); + + if (document) { + + DOMElement* root = document->getDocumentElement(); + + if (root) { + + const XMLCh* targetNSURIString = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + + // check to see if targetNameSpace is right + if (*targetNSURIString + && !XMLString::equals(targetNSURIString,fTargetNSURIString)){ + reportSchemaError(root, XMLUni::fgXMLErrDomain, XMLErrs::IncludeNamespaceDifference, + schemaLocation, targetNSURIString); + return; + } + + // if targetNamespace is empty, change it to includ'g schema + // targetNamespace + if (!*targetNSURIString && root->getAttributeNode(XMLUni::fgXMLNSString) == 0 + && fTargetNSURI != fEmptyNamespaceURI) { + root->setAttribute(XMLUni::fgXMLNSString, fTargetNSURIString); + } + + // -------------------------------------------------------- + // Update schema information with included schema + // -------------------------------------------------------- + SchemaInfo* saveInfo = fSchemaInfo; + + fSchemaInfo = new (fMemoryManager) SchemaInfo(0, 0, 0, fTargetNSURI, + fSchemaInfo->getNamespaceScope(), + includeURL, + fTargetNSURIString, root, + fScanner, + fGrammarPoolMemoryManager); + + fSchemaInfoList->put((void*) fSchemaInfo->getCurrentSchemaURL(), + fSchemaInfo->getTargetNSURI(), fSchemaInfo); + fPreprocessedNodes->put((void*) elem, fSchemaInfo); + saveInfo->addSchemaInfo(fSchemaInfo, SchemaInfo::INCLUDE); + traverseSchemaHeader(root); + preprocessChildren(root); + fSchemaInfo = saveInfo; + } + } +} + + +void TraverseSchema::traverseInclude(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + SchemaInfo* includeInfo = fPreprocessedNodes->get(elem); + + if (includeInfo) { + + SchemaInfo* saveInfo = fSchemaInfo; + + fSchemaInfo = includeInfo; + processChildren(includeInfo->getRoot()); + fSchemaInfo = saveInfo; + } +} + + +/** + * Traverse import + * + * + * Content: (annotation?) + * + */ +void TraverseSchema::preprocessImport(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Import, this, true, fNonXSAttList); + + // ----------------------------------------------------------------------- + // First, handle any ANNOTATION declaration + // ----------------------------------------------------------------------- + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + + if (fAnnotation) + fSchemaGrammar->addAnnotation(fAnnotation); + else if (fScanner->getGenerateSyntheticAnnotations() && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + fSchemaGrammar->addAnnotation(fAnnotation); + } + // ----------------------------------------------------------------------- + // Handle 'namespace' attribute + // ----------------------------------------------------------------------- + const XMLCh* nameSpace = getElementAttValue(elem, SchemaSymbols::fgATT_NAMESPACE, DatatypeValidator::AnyURI); + const XMLCh* nameSpaceValue = nameSpace ? nameSpace : XMLUni::fgZeroLenString; + + if (XMLString::equals(nameSpaceValue, fTargetNSURIString)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::Import_1_1); + return; + } + + if (!*nameSpaceValue && fTargetNSURI == fEmptyNamespaceURI) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::Import_1_2); + return; + } + + // ------------------------------------------------------------------ + // Get 'schemaLocation' attribute + // ------------------------------------------------------------------ + const XMLCh* schemaLocation = getElementAttValue(elem, SchemaSymbols::fgATT_SCHEMALOCATION, DatatypeValidator::AnyURI); + + // ------------------------------------------------------------------ + // Resolve namespace to a grammar + // ------------------------------------------------------------------ + Grammar* aGrammar = 0; + + { + XMLSchemaDescription* gramDesc =fGrammarResolver->getGrammarPool()->createSchemaDescription(nameSpaceValue); + Janitor janName(gramDesc); + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_IMPORT); + gramDesc->setLocationHints(schemaLocation); + aGrammar = fGrammarResolver->getGrammar(gramDesc); + } + + bool grammarFound = (aGrammar && (aGrammar->getGrammarType() == Grammar::SchemaGrammarType)); + + if (grammarFound) { + addImportedNS(fURIStringPool->addOrFind(nameSpaceValue)); + } + + // a bare doesn't load anything + if(!schemaLocation && !nameSpace) + return; + + // ------------------------------------------------------------------ + // Resolve schema location + // ------------------------------------------------------------------ + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + InputSource* srcToFill = resolveSchemaLocation(schemaLocation, + XMLResourceIdentifier::SchemaImport, nameSpace); + + // Nothing to do + if (!srcToFill) { + if (!grammarFound) { + addImportedNS(fURIStringPool->addOrFind(nameSpaceValue)); + } + + return; + } + + Janitor janSrc(srcToFill); + const XMLCh* importURL = srcToFill->getSystemId(); + unsigned int nameSpaceId = nameSpace ? fURIStringPool->addOrFind(nameSpace) : fEmptyNamespaceURI; + + SchemaInfo* importSchemaInfo = fCachedSchemaInfoList->get(importURL, nameSpaceId); + + if (!importSchemaInfo && fSchemaInfoList != fCachedSchemaInfoList) + importSchemaInfo = fSchemaInfoList->get(importURL, nameSpaceId); + + if (importSchemaInfo) { + fSchemaInfo->addSchemaInfo(importSchemaInfo, SchemaInfo::IMPORT); + addImportedNS(importSchemaInfo->getTargetNSURI()); + return; + } + + if (grammarFound) { + if (!fScanner->getHandleMultipleImports()) + return; + } + + // ------------------------------------------------------------------ + // Parse input source + // ------------------------------------------------------------------ + if (!fParser) + fParser = new (fGrammarPoolMemoryManager) XSDDOMParser(0, fGrammarPoolMemoryManager, 0); + + fParser->setValidationScheme(XercesDOMParser::Val_Never); + fParser->setDoNamespaces(true); + fParser->setUserEntityHandler(fEntityHandler); + fParser->setUserErrorReporter(fErrorReporter); + + // Should just issue warning if the schema is not found + bool flag = srcToFill->getIssueFatalErrorIfNotFound(); + srcToFill->setIssueFatalErrorIfNotFound(false); + + fParser->parse(*srcToFill) ; + + // Reset the InputSource + srcToFill->setIssueFatalErrorIfNotFound(flag); + + if (fParser->getSawFatal() && fScanner->getExitOnFirstFatal()) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::SchemaScanFatalError); + + // ------------------------------------------------------------------ + // Get root element + // ------------------------------------------------------------------ + DOMDocument* document = fParser->getDocument(); + + if (document) { + + DOMElement* root = document->getDocumentElement(); + + if (!root) { + return; + } + + const XMLCh* targetNSURIString = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + + if (!XMLString::equals(targetNSURIString, nameSpaceValue)) { + reportSchemaError(root, XMLUni::fgXMLErrDomain, XMLErrs::ImportNamespaceDifference, + schemaLocation, targetNSURIString, nameSpaceValue); + } + else { + + // -------------------------------------------------------- + // Preprocess new schema + // -------------------------------------------------------- + SchemaInfo* saveInfo = fSchemaInfo; + fSchemaGrammar->setScopeCount (fScopeCount); + fSchemaGrammar->setAnonTypeCount (fAnonXSTypeCount); + if (grammarFound) { + fSchemaGrammar = (SchemaGrammar*) aGrammar; + } + else { + fSchemaGrammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager); + } + fScopeCount = fSchemaGrammar->getScopeCount (); + fAnonXSTypeCount = fSchemaGrammar->getAnonTypeCount (); + + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) fSchemaGrammar->getGrammarDescription(); + gramDesc->setContextType(XMLSchemaDescription::CONTEXT_IMPORT); + gramDesc->setLocationHints(importURL); + + preprocessSchema(root, importURL, grammarFound); + fPreprocessedNodes->put((void*) elem, fSchemaInfo); + + // -------------------------------------------------------- + // Restore old schema information + // -------------------------------------------------------- + restoreSchemaInfo(saveInfo, SchemaInfo::IMPORT); + } + } +} + + +void TraverseSchema::traverseImport(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + SchemaInfo* importInfo = fPreprocessedNodes->get(elem); + + if (importInfo) { + + // -------------------------------------------------------- + // Traverse new schema + // -------------------------------------------------------- + SchemaInfo* saveInfo = fSchemaInfo; + + restoreSchemaInfo(importInfo, SchemaInfo::IMPORT); + doTraverseSchema(importInfo->getRoot()); + + // -------------------------------------------------------- + // Restore old schema information + // -------------------------------------------------------- + restoreSchemaInfo(saveInfo, SchemaInfo::IMPORT); + } +} + + +/** + * Traverse redefine declaration + * + * + * schemaLocation = uriReference + * {any attributes with non-schema namespace . . .}> + * Content: (annotation | ( + * attributeGroup | complexType | group | simpleType))* + * + */ +void TraverseSchema::preprocessRedefine(const DOMElement* const redefineElem) { + + NamespaceScopeManager nsMgr(redefineElem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + redefineElem, GeneralAttributeCheck::E_Redefine, this, true + ); + + // First, we look through the children of redefineElem. Each one will + // correspond to an element of the redefined schema that we need to + // redefine. To do this, we rename the element of the redefined schema, + // and rework the base or ref tag of the kid we're working on to refer to + // the renamed group or derive the renamed type. Once we've done this, we + // actually go through the schema being redefined and convert it to a + // grammar. Only then do we run through redefineDecl's kids and put them + // in the grammar. + SchemaInfo* redefiningInfo = fSchemaInfo; + + if (!openRedefinedSchema(redefineElem)) { + + redefiningInfo->addFailedRedefine(redefineElem); + return; + } + + if (!fRedefineComponents) { + fRedefineComponents = new (fMemoryManager) RefHash2KeysTableOf(13, (bool) false, fMemoryManager); + } + + SchemaInfo* redefinedInfo = fSchemaInfo; + renameRedefinedComponents(redefineElem, redefiningInfo, redefinedInfo); + + // Now we have to preprocess our nicely-renamed schemas. + if (fPreprocessedNodes->containsKey(redefineElem)) { + + fSchemaInfo = redefinedInfo; + preprocessChildren(fSchemaInfo->getRoot()); + } + + fSchemaInfo = redefiningInfo; +} + +void TraverseSchema::traverseRedefine(const DOMElement* const redefineElem) { + + NamespaceScopeManager nsMgr(redefineElem, fSchemaInfo, this); + + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo* redefinedInfo = fPreprocessedNodes->get(redefineElem); + + if (redefinedInfo) { + + // Now we have to march through our nicely-renamed schemas. When + // we do these traversals other 's may perhaps be + // encountered; we leave recursion to sort this out. + fSchemaInfo = redefinedInfo; + processChildren(fSchemaInfo->getRoot()); + fSchemaInfo = saveInfo; + + // Now traverse our own + processChildren(redefineElem); + } +} + + +/** + * Traverse the Choice, Sequence declaration + * + * + */ +ContentSpecNode* +TraverseSchema::traverseChoiceSequence(const DOMElement* const elem, + const int modelGroupType, + bool& hasChildren) +{ + hasChildren = false; + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Sequence, this, false, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Process contents + // ----------------------------------------------------------------------- + DOMElement* child = checkContent(elem, XUtil::getFirstChildElement(elem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + Janitor left(0); + Janitor right(0); + + bool hadContent = false; + + Janitor contentSpecNode(0); + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + hasChildren = true; + contentSpecNode.release(); + bool seeParticle = false; + bool wasAny = false; + const XMLCh* childName = child->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_ELEMENT)) { + + SchemaElementDecl* elemDecl = traverseElementDecl(child); + + if (!elemDecl ) + continue; + + contentSpecNode.reset(new (fGrammarPoolMemoryManager) ContentSpecNode + ( + elemDecl + , fGrammarPoolMemoryManager + )); + seeParticle = true; + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_GROUP)) { + + XercesGroupInfo* grpInfo = traverseGroupDecl(child, false); + + if (!grpInfo) { + continue; + } + + ContentSpecNode* grpContentSpecNode = grpInfo->getContentSpec(); + + if (!grpContentSpecNode) { + continue; + } + + if (grpContentSpecNode->hasAllContent()) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::AllContentLimited); + continue; + } + + contentSpecNode.reset(new (fGrammarPoolMemoryManager) ContentSpecNode(*grpContentSpecNode)); + seeParticle = true; + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_CHOICE)) { + bool hasChild; + contentSpecNode.reset(traverseChoiceSequence(child,ContentSpecNode::Choice, hasChild)); + seeParticle = true; + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_SEQUENCE)) { + bool hasChild; + contentSpecNode.reset(traverseChoiceSequence(child,ContentSpecNode::Sequence, hasChild)); + seeParticle = true; + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_ANY)) { + + contentSpecNode.reset(traverseAny(child)); + seeParticle = true; + wasAny = true; + } + else { + reportSchemaError(child, XMLUni::fgValidityDomain, XMLValid::GroupContentRestricted, + childName, + ((ContentSpecNode::NodeTypes) modelGroupType) == ContentSpecNode::Choice?SchemaSymbols::fgELT_CHOICE:SchemaSymbols::fgELT_SEQUENCE); + } + + if (seeParticle) { + checkMinMax(contentSpecNode.get(), child, Not_All_Context); + if (wasAny && contentSpecNode.get()->getMaxOccurs() == 0) { + contentSpecNode.reset(0); + } + } + + if (contentSpecNode.get()) { + hadContent = true; + } + + if (left.get() == 0) { + left.reset(contentSpecNode.release()); + } + else if (right.get() == 0) { + right.reset(contentSpecNode.release()); + } + else { + ContentSpecNode* newNode = + new (fGrammarPoolMemoryManager) ContentSpecNode + ( + (ContentSpecNode::NodeTypes) modelGroupType + , left.get() + , right.get() + , true + , true + , fGrammarPoolMemoryManager + ); + + left.release(); + right.release(); + + left.reset(newNode); + right.reset(contentSpecNode.release()); + } + } + contentSpecNode.release(); + + if (hadContent) + { + ContentSpecNode* newNode = + new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ((ContentSpecNode::NodeTypes) modelGroupType) == ContentSpecNode::Choice + ? ContentSpecNode::ModelGroupChoice : ContentSpecNode::ModelGroupSequence + , left.get() + , right.get() + , true + , true + , fGrammarPoolMemoryManager + ); + + left.release(); + + left.reset(newNode); + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(left.get(), janAnnot.release()); + } + + right.release(); + return left.release(); +} + +/** + * Traverse SimpleType declaration: + * + * Content: (annotation? , ((list | restriction | union))) + * + * + * traverse || + */ +DatatypeValidator* +TraverseSchema::traverseSimpleTypeDecl(const DOMElement* const childElem, + const bool topLevel, int baseRefContext) +{ + NamespaceScopeManager nsMgr(childElem, fSchemaInfo, this); + + // ------------------------------------------------------------------ + // Process contents + // ------------------------------------------------------------------ + const XMLCh* name = getElementAttValue(childElem,SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + bool nameEmpty = (!name || !*name); + + if (topLevel && nameEmpty) { + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameGlobalElement, + SchemaSymbols::fgELT_SIMPLETYPE); + return 0; + } + else if(!topLevel && !nameEmpty) { + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::AttributeDisallowedLocal, + SchemaSymbols::fgATT_NAME, childElem->getLocalName()); + return 0; + } + + if (nameEmpty) { // anonymous simpleType + name = genAnonTypeName(fgAnonSNamePrefix); + } + else if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name)) ) { + + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_SIMPLETYPE, name); + return 0; + } + + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(name); + + unsigned int fullTypeNameId = fStringPool->addOrFind(fBuffer.getRawBuffer()); + const XMLCh* fullName = fStringPool->getValueForId(fullTypeNameId); + + //check if we have already traversed the same simpleType decl + DatatypeValidator* dv = fDatatypeRegistry->getDatatypeValidator(fullName); + + if (!dv) { + + // ------------------------------------------------------------------- + // Check attributes + // ------------------------------------------------------------------- + unsigned short scope = (topLevel) ? GeneralAttributeCheck::E_SimpleTypeGlobal + : GeneralAttributeCheck::E_SimpleTypeLocal; + + fAttributeCheck.checkAttributes( + childElem, scope, this, topLevel, fNonXSAttList + ); + + // Circular constraint checking + if (fCurrentTypeNameStack->containsElement(fullTypeNameId)) { + + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::NoCircularDefinition, name); + return 0; + } + + fCurrentTypeNameStack->addElement(fullTypeNameId); + + // Get 'final' values + int finalSet = parseFinalSet(childElem, S_Final); + + // annotation?,(list|restriction|union) + DOMElement* content= checkContent( + childElem, XUtil::getFirstChildElement(childElem), false); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(childElem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + if (content == 0) { + + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::EmptySimpleTypeContent); + popCurrentTypeNameStack(); + return 0; + } + + const XMLCh* varietyName = content->getLocalName(); + + // Remark: some code will be repeated in list|restriction| union but it + // is cleaner that way + if (XMLString::equals(varietyName, SchemaSymbols::fgELT_LIST)) { //traverse List + if ((baseRefContext & SchemaSymbols::XSD_LIST) != 0) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AtomicItemType); + popCurrentTypeNameStack(); + return 0; + } + + dv = traverseByList(childElem, content, name, fullName, finalSet, &janAnnot); + } + else if (XMLString::equals(varietyName, SchemaSymbols::fgELT_RESTRICTION)) { //traverse Restriction + dv = traverseByRestriction(childElem, content, name, fullName, finalSet, &janAnnot); + } + else if (XMLString::equals(varietyName, SchemaSymbols::fgELT_UNION)) { //traverse union + dv = traverseByUnion(childElem, content, name, fullName, finalSet, baseRefContext, &janAnnot); + } + else { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::FeatureUnsupported, varietyName); + popCurrentTypeNameStack(); + } + + if (dv) { + if (nameEmpty) + dv->setAnonymous(); + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(dv, janAnnot.release()); + } + } + + return dv; +} + +/** + * Traverse ComplexType Declaration - CR Implementation. + * + * + * Content: (annotation? , (simpleContent | complexContent | + * ( (group | all | choice | sequence)? , + * ( (attribute | attributeGroup)* , anyAttribute?)))) + * + */ +int TraverseSchema::traverseComplexTypeDecl(const DOMElement* const elem, + const bool topLevel, + const XMLCh* const recursingTypeName) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // Get the attributes of the complexType + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + bool isAnonymous = false; + + if (!name || !*name) { + + if (topLevel) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TopLevelNoNameComplexType); + return -1; + } + + if (recursingTypeName) + name = recursingTypeName; + else { + name = genAnonTypeName(fgAnonCNamePrefix); + isAnonymous = true; + } + } + + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name)) ) { + + //REVISIT - Should we return or continue and save type with wrong name? + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_COMPLEXTYPE, name); + return -1; + } + + // ------------------------------------------------------------------ + // Check if the type has already been registered + // ------------------------------------------------------------------ + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(name); + + int typeNameIndex = fStringPool->addOrFind(fBuffer.getRawBuffer()); + const XMLCh* fullName = fStringPool->getValueForId(typeNameIndex); + ComplexTypeInfo* typeInfo = 0; + + if (topLevel || recursingTypeName) { + + typeInfo = fComplexTypeRegistry->get(fullName); + + if (typeInfo && !typeInfo->getPreprocessed()) { + return typeNameIndex; + } + } + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + bool preProcessFlag = (typeInfo) ? typeInfo->getPreprocessed() : false; + if (!preProcessFlag) { + fAttributeCheck.checkAttributes( + elem, (topLevel) ? GeneralAttributeCheck::E_ComplexTypeGlobal + : GeneralAttributeCheck::E_ComplexTypeLocal + , this, topLevel, fNonXSAttList + ); + } + + // ----------------------------------------------------------------------- + // Create a new instance + // ----------------------------------------------------------------------- + XMLSize_t previousCircularCheckIndex = fCircularCheckIndex; + unsigned int previousScope = fCurrentScope; + + if (preProcessFlag) { + + fCurrentScope = typeInfo->getScopeDefined(); + typeInfo->setPreprocessed(false); + } + else { + + // ------------------------------------------------------------------ + // Register the type + // ------------------------------------------------------------------ + typeInfo = new (fGrammarPoolMemoryManager) ComplexTypeInfo(fGrammarPoolMemoryManager); + if(isAnonymous) { + typeInfo->setAnonymous(); + } + + fCurrentScope = fScopeCount++; + fComplexTypeRegistry->put((void*) fullName, typeInfo); + typeInfo->setTypeName(fullName); + typeInfo->setScopeDefined(fCurrentScope); + + if (fFullConstraintChecking) { + + XSDLocator* aLocator = new (fGrammarPoolMemoryManager) XSDLocator(); + aLocator->setValues(fStringPool->getValueForId(fStringPool->addOrFind(fSchemaInfo->getCurrentSchemaURL())), + 0, ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + typeInfo->setLocator(aLocator); + } + } + + fCurrentTypeNameStack->addElement(typeNameIndex); + ComplexTypeInfo* saveTypeInfo = fCurrentComplexType; + fCurrentComplexType = typeInfo; + + // ------------------------------------------------------------------ + // First, handle any ANNOTATION declaration and get next child + // ------------------------------------------------------------------ + DOMElement* child = checkContent(elem, XUtil::getFirstChildElement(elem), true, !preProcessFlag); + + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + // ------------------------------------------------------------------ + // Process the content of the complex type declaration + // ------------------------------------------------------------------ + try { + + const XMLCh* mixedVal = getElementAttValue(elem,SchemaSymbols::fgATT_MIXED, DatatypeValidator::Boolean); + bool isMixed = false; + + if ((mixedVal && *mixedVal) + && (XMLString::equals(SchemaSymbols::fgATTVAL_TRUE, mixedVal) + || XMLString::equals(fgValueOne, mixedVal))) { + isMixed = true; + } + + if (child == 0) { + // EMPTY complexType with complexContent + processComplexContent(elem, name, child, typeInfo, 0, isMixed); + } + else { + + const XMLCh* childName = child->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_SIMPLECONTENT)) { + + // SIMPLE CONTENT element + traverseSimpleContentDecl(name, fullName, child, typeInfo, &janAnnot); + + if (XUtil::getNextSiblingElement(child) != 0) { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildFollowingSimpleContent); + } + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_COMPLEXCONTENT)) { + + // COMPLEX CONTENT element + traverseComplexContentDecl(name, child, typeInfo, isMixed, &janAnnot); + + if (XUtil::getNextSiblingElement(child) != 0) { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildFollowingConplexContent); + } + } + else if (fCurrentGroupInfo) { + typeInfo->setPreprocessed(true); + } + else { + // We must have .... + // GROUP, ALL, SEQUENCE or CHOICE, followed by optional attributes + // Note that it's possible that only attributes are specified. + processComplexContent(elem, name, child, typeInfo, 0, isMixed); + } + } + } + catch(const TraverseSchema::ExceptionCodes aCode) { + if (aCode == TraverseSchema::InvalidComplexTypeInfo) + defaultComplexTypeInfo(typeInfo); + else if (aCode == TraverseSchema::RecursingElement) + typeInfo->setPreprocessed(); + } + + // ------------------------------------------------------------------ + // Finish the setup of the typeInfo + // ------------------------------------------------------------------ + if (!preProcessFlag) { + + const XMLCh* abstractAttVal = getElementAttValue(elem, SchemaSymbols::fgATT_ABSTRACT, DatatypeValidator::Boolean); + int blockSet = parseBlockSet(elem, C_Block); + int finalSet = parseFinalSet(elem, EC_Final); + + typeInfo->setBlockSet(blockSet); + typeInfo->setFinalSet(finalSet); + + if ((abstractAttVal && *abstractAttVal) + && (XMLString::equals(abstractAttVal, SchemaSymbols::fgATTVAL_TRUE) + || XMLString::equals(abstractAttVal, fgValueOne))) { + typeInfo->setAbstract(true); + } + else { + typeInfo->setAbstract(false); + } + } + + // Store Annotation + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(typeInfo, janAnnot.release()); + + // ------------------------------------------------------------------ + // Before exiting, restore the scope, mainly for nested anonymous types + // ------------------------------------------------------------------ + popCurrentTypeNameStack(); + fCircularCheckIndex = previousCircularCheckIndex; + fCurrentScope = previousScope; + fCurrentComplexType = saveTypeInfo; + + return typeNameIndex; +} + +/** + * Traverse Group Declaration. + * + * + * Content: (annotation? , (all | choice | sequence)?) + * + * + */ +XercesGroupInfo* +TraverseSchema::traverseGroupDecl(const DOMElement* const elem, + const bool topLevel) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + const XMLCh* ref = getElementAttValue(elem, SchemaSymbols::fgATT_REF, DatatypeValidator::QName); + bool nameEmpty = (!name || !*name); + bool refEmpty = (!ref || !*ref); + + if (nameEmpty && topLevel) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameGlobalElement, + SchemaSymbols::fgELT_GROUP); + return 0; + } + + if (nameEmpty && refEmpty) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameRefGroup); + return 0; + } + + // ------------------------------------------------------------------ + // Check attributes + // ------------------------------------------------------------------ + unsigned short scope = (topLevel) ? GeneralAttributeCheck::E_GroupGlobal + : GeneralAttributeCheck::E_GroupRef; + fAttributeCheck.checkAttributes(elem, scope, this, topLevel, fNonXSAttList); + + // ------------------------------------------------------------------ + // Handle "ref=" + // ------------------------------------------------------------------ + if (!topLevel) { + + if (refEmpty) { + return 0; + } + + return processGroupRef(elem, ref); + } + + // name must be a valid NCName + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_GROUP, name); + return 0; + } + + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(name); + + unsigned int nameIndex = fStringPool->addOrFind(fBuffer.getRawBuffer()); + const XMLCh* fullName = fStringPool->getValueForId(nameIndex); + XercesGroupInfo* groupInfo = fGroupRegistry->get(fullName); + + if (groupInfo) { + return groupInfo; + } + + // ------------------------------------------------------------------ + // Check for annotations + // ------------------------------------------------------------------ + DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + // ------------------------------------------------------------------ + // Process contents of global groups + // ------------------------------------------------------------------ + unsigned int saveScope = fCurrentScope; + Janitor specNode(0); + XercesGroupInfo* saveGroupInfo = fCurrentGroupInfo; + + Janitor newGroupInfoJan(new (fGrammarPoolMemoryManager) XercesGroupInfo( + fStringPool->addOrFind(name), fTargetNSURI, fGrammarPoolMemoryManager)); + fCurrentGroupStack->addElement(nameIndex); + XercesGroupInfo* const newGroupInfo = newGroupInfoJan.get(); + fCurrentGroupInfo = newGroupInfo; + + fCurrentScope = fScopeCount++; + fCurrentGroupInfo->setScope(fCurrentScope); + + if (content == 0) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::GroupContentError, name); + } + else { + + if (content->getAttributeNode(SchemaSymbols::fgATT_MINOCCURS) != 0 + || content->getAttributeNode(SchemaSymbols::fgATT_MAXOCCURS) != 0) { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::MinMaxOnGroupChild); + } + + bool illegalChild = false; + const XMLCh* childName = content->getLocalName(); + bool hasChild; + + + if (XMLString::equals(childName, SchemaSymbols::fgELT_SEQUENCE)) { + specNode.reset(traverseChoiceSequence(content, ContentSpecNode::Sequence, hasChild)); + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_CHOICE)) { + specNode.reset(traverseChoiceSequence(content, ContentSpecNode::Choice, hasChild)); + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_ALL)) { + specNode.reset(traverseAll(content, hasChild)); + } + else { + illegalChild = true; + } + + if (illegalChild || XUtil::getNextSiblingElement(content) != 0) { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::GroupContentError, name); + } + + // copy local elements to complex type if it exists + if (fCurrentComplexType) + processElements(elem, fCurrentGroupInfo, fCurrentComplexType); + } + + // ------------------------------------------------------------------ + // Set groupInfo and pop group name from stack + // ------------------------------------------------------------------ + XMLSize_t stackSize = fCurrentGroupStack->size(); + + if (stackSize != 0) { + fCurrentGroupStack->removeElementAt(stackSize - 1); + } + + fCurrentGroupInfo->setContentSpec(specNode.release()); + fGroupRegistry->put((void*) fullName, fCurrentGroupInfo); + newGroupInfoJan.release(); + fCurrentGroupInfo = saveGroupInfo; + fCurrentScope = saveScope; + + // Store Annotation + if (!janAnnot.isDataNull()) { + fSchemaGrammar->putAnnotation(newGroupInfo, janAnnot.release()); + } + + if (fFullConstraintChecking) { + + XSDLocator* aLocator = new (fGrammarPoolMemoryManager) XSDLocator(); + + newGroupInfo->setLocator(aLocator); + aLocator->setValues(fStringPool->getValueForId(fStringPool->addOrFind(fSchemaInfo->getCurrentSchemaURL())), + 0, ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + + if (fRedefineComponents && fRedefineComponents->get(SchemaSymbols::fgELT_GROUP, nameIndex)) + { + + fBuffer.set(fullName); + fBuffer.append(SchemaSymbols::fgRedefIdentifier); + unsigned int rdfNameIndex = fStringPool->addOrFind(fBuffer.getRawBuffer()); + + if (fCurrentGroupStack->containsElement(rdfNameIndex)) + { + reportSchemaError(aLocator, XMLUni::fgXMLErrDomain, XMLErrs::NoCircularDefinition, name); + } + else + { + XercesGroupInfo* baseGroup = fGroupRegistry->get(fBuffer.getRawBuffer()); + if (baseGroup) + { + newGroupInfo->setBaseGroup(baseGroup); + } + else + { + fBuffer.set(name); + fBuffer.append(SchemaSymbols::fgRedefIdentifier); + SchemaInfo* saveInfo = fSchemaInfo; + DOMElement* groupElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_Group, + SchemaSymbols::fgELT_GROUP, fBuffer.getRawBuffer(), &fSchemaInfo); + + if (groupElem != 0) { + baseGroup = traverseGroupDecl(groupElem); + newGroupInfo->setBaseGroup(baseGroup); + fSchemaInfo = saveInfo; + } + else + { + reportSchemaError(aLocator, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNotFound, + SchemaSymbols::fgELT_GROUP, fTargetNSURIString, fBuffer.getRawBuffer()); + } + } + } + } + } + + return newGroupInfo; +} + + +/** + * Traverse attributeGroup Declaration. + * + * + * Content: (annotation? , (attribute|attributeGroup)*, anyAttribute?) + * + * + */ +XercesAttGroupInfo* +TraverseSchema::traverseAttributeGroupDecl(const DOMElement* const elem, + ComplexTypeInfo* const typeInfo, + const bool topLevel) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + const XMLCh* ref = getElementAttValue(elem, SchemaSymbols::fgATT_REF, DatatypeValidator::QName); + bool nameEmpty = (!name || !*name) ? true : false; + bool refEmpty = (!ref || !*ref) ? true : false; + + if (nameEmpty && topLevel) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameGlobalElement, + SchemaSymbols::fgELT_ATTRIBUTEGROUP); + return 0; + } + + if (nameEmpty && refEmpty) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameRefAttGroup); + return 0; + } + + // ------------------------------------------------------------------ + // Check attributes + // ------------------------------------------------------------------ + unsigned short scope = (topLevel) ? GeneralAttributeCheck::E_AttributeGroupGlobal + : GeneralAttributeCheck::E_AttributeGroupRef; + fAttributeCheck.checkAttributes(elem, scope, this, topLevel, fNonXSAttList); + + // ------------------------------------------------------------------ + // Handle "ref=" + // ------------------------------------------------------------------ + XercesAttGroupInfo* attGroupInfo; + Janitor janAttGroupInfo(0); + if (!topLevel) { + + if (refEmpty) { + return 0; + } + + attGroupInfo = processAttributeGroupRef(elem, ref, typeInfo); + } + else + { + // name must be a valid NCName + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_ATTRIBUTEGROUP, name); + return 0; + } + + // Check for annotations + DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + // Process contents of global attributeGroups + XercesAttGroupInfo* saveAttGroupInfo = fCurrentAttGroupInfo; + janAttGroupInfo.reset(new (fGrammarPoolMemoryManager) XercesAttGroupInfo( + fStringPool->addOrFind(name), fTargetNSURI, fGrammarPoolMemoryManager)); + + fDeclStack->addElement(elem); + fCurrentAttGroupInfo = janAttGroupInfo.get(); + + for (; content !=0; content = XUtil::getNextSiblingElement(content)) { + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_ATTRIBUTE)) { + traverseAttributeDecl(content, typeInfo); + } + else if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_ATTRIBUTEGROUP)) { + traverseAttributeGroupDecl(content, typeInfo); + } + else { + break; + } + } + + if (content != 0) { + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_ANYATTRIBUTE)) { + + SchemaAttDef* anyAtt = traverseAnyAttribute(content); + + if (anyAtt) { + fCurrentAttGroupInfo->addAnyAttDef(anyAtt); + } + + if (XUtil::getNextSiblingElement(content) != 0) { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AttGroupContentError, name); + } + } + else { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AttGroupContentError, name); + } + } + + // Pop declaration + fDeclStack->removeElementAt(fDeclStack->size() - 1); + + fAttGroupRegistry->put((void*) fStringPool->getValueForId(fStringPool->addOrFind(name)), janAttGroupInfo.get()); + // Restore old attGroupInfo + attGroupInfo = janAttGroupInfo.release(); + fCurrentAttGroupInfo = saveAttGroupInfo; + + // Check Attribute Derivation Restriction OK + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(name); + + unsigned int nameIndex = fStringPool->addOrFind(fBuffer.getRawBuffer()); + + if (fRedefineComponents && fRedefineComponents->get(SchemaSymbols::fgELT_ATTRIBUTEGROUP, nameIndex)) { + + fBuffer.set(name); + fBuffer.append(SchemaSymbols::fgRedefIdentifier); + XercesAttGroupInfo* baseAttGroupInfo = fAttGroupRegistry->get(fBuffer.getRawBuffer()); + + if (baseAttGroupInfo) + checkAttDerivationOK(elem, baseAttGroupInfo, attGroupInfo); + } + + // Store annotation + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(attGroupInfo, janAnnot.release()); + } + + // calculate complete wildcard if necessary + if (attGroupInfo) + { + XMLSize_t anyAttCount = attGroupInfo->anyAttributeCount(); + if (anyAttCount && !attGroupInfo->getCompleteWildCard()) + { + SchemaAttDef* attGroupWildCard = new (fGrammarPoolMemoryManager) + SchemaAttDef(attGroupInfo->anyAttributeAt(0)); + + for (XMLSize_t k= 1; k < anyAttCount; k++) + attWildCardIntersection(attGroupWildCard, attGroupInfo->anyAttributeAt(k)); + + attGroupInfo->setCompleteWildCard(attGroupWildCard); + } + } + + return attGroupInfo; +} + + +inline XercesAttGroupInfo* +TraverseSchema::traverseAttributeGroupDeclNS(const DOMElement* const elem, + const XMLCh* const uriStr, + const XMLCh* const name) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ------------------------------------------------------------------ + // Get grammar information + // ------------------------------------------------------------------ + Grammar* aGrammar = fGrammarResolver->getGrammar(uriStr); + + if (!aGrammar || aGrammar->getGrammarType() != Grammar::SchemaGrammarType) { + + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, uriStr); + return 0; + } + + XercesAttGroupInfo* attGroupInfo = ((SchemaGrammar*)aGrammar)->getAttGroupInfoRegistry()->get(name); + + return attGroupInfo; +} + +/** + * Traverse Any declaration + * + * + * Content: (annotation?) + * + */ +ContentSpecNode* +TraverseSchema::traverseAny(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Any, this, false, fNonXSAttList + ); + + // ------------------------------------------------------------------ + // First, handle any ANNOTATION declaration + // ------------------------------------------------------------------ + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + // ------------------------------------------------------------------ + // Get attributes + // ------------------------------------------------------------------ + const XMLCh* const processContents = getElementAttValue(elem, SchemaSymbols::fgATT_PROCESSCONTENTS); + const XMLCh* const nameSpace = getElementAttValue(elem, SchemaSymbols::fgATT_NAMESPACE); + + // ------------------------------------------------------------------ + // Set default node type based on 'processContents' value + // ------------------------------------------------------------------ + ContentSpecNode::NodeTypes anyType = ContentSpecNode::Any; + ContentSpecNode::NodeTypes anyLocalType = ContentSpecNode::Any_NS; + ContentSpecNode::NodeTypes anyOtherType = ContentSpecNode::Any_Other; + + if ((processContents && *processContents) + && !XMLString::equals(processContents, SchemaSymbols::fgATTVAL_STRICT)) { + + if (XMLString::equals(processContents, SchemaSymbols::fgATTVAL_LAX)) { + + anyType = ContentSpecNode::Any_Lax; + anyOtherType = ContentSpecNode::Any_Other_Lax; + anyLocalType = ContentSpecNode::Any_NS_Lax; + } + else if (XMLString::equals(processContents, SchemaSymbols::fgATTVAL_SKIP)) { + + anyType = ContentSpecNode::Any_Skip; + anyOtherType = ContentSpecNode::Any_Other_Skip; + anyLocalType = ContentSpecNode::Any_NS_Skip; + } + } + + // ------------------------------------------------------------------ + // Process 'namespace' attribute + // ------------------------------------------------------------------ + ContentSpecNode* retSpecNode = 0; + + if ((!nameSpace || !*nameSpace) + || XMLString::equals(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDANY)) { + retSpecNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , fEmptyNamespaceURI + , fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + ); + retSpecNode->setType(anyType); + } + else if (XMLString::equals(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDOTHER)) { + retSpecNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , fTargetNSURI, fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + ); + retSpecNode->setType(anyOtherType); + } + else { + + XMLStringTokenizer nameSpaceTokens(nameSpace, fMemoryManager); + ValueVectorOf uriList(8, fGrammarPoolMemoryManager); + Janitor firstNode(0); + Janitor secondNode(0); + DatatypeValidator* anyURIDV = fDatatypeRegistry->getDatatypeValidator(SchemaSymbols::fgDT_ANYURI); + + while (nameSpaceTokens.hasMoreTokens()) { + + const XMLCh* tokenElem = nameSpaceTokens.nextToken(); + int uriIndex = fEmptyNamespaceURI; + + if (!XMLString::equals(tokenElem,SchemaSymbols::fgATTVAL_TWOPOUNDLOCAL)) { // not ##local + + if (XMLString::equals(tokenElem,SchemaSymbols::fgATTVAL_TWOPOUNDTRAGETNAMESPACE)) { + uriIndex = fTargetNSURI; + } + else { + try { + anyURIDV->validate(tokenElem + , fSchemaInfo->getValidationContext() + , fMemoryManager); + } + catch(const XMLException& excep) { + reportSchemaError(elem, excep); + } + uriIndex = fURIStringPool->addOrFind(tokenElem); + } + } + + if (uriList.containsElement(uriIndex)) { + continue; + } + + uriList.addElement(uriIndex); + + firstNode.release(); + firstNode.reset( new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , uriIndex, fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + )); + firstNode.get()->setType(anyLocalType); + + if (secondNode.get() == 0) { + secondNode.reset(firstNode.release()); + } + else { + ContentSpecNode* newNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::Any_NS_Choice + , secondNode.get() + , firstNode.get() + , true + , true + , fGrammarPoolMemoryManager + ); + secondNode.release(); + secondNode.reset(newNode); + firstNode.release(); + } + } + firstNode.release(); + retSpecNode = secondNode.release(); + } + + // Store annotation + if (retSpecNode && !janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(retSpecNode, janAnnot.release()); + + return retSpecNode; +} + + +/** + * Traverse all + * + * + * Content: (annotation?, element*) + * + */ +ContentSpecNode* +TraverseSchema::traverseAll(const DOMElement* const elem, bool& hasChildren) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + hasChildren = false; + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_All, this, false, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Process contents + // ----------------------------------------------------------------------- + DOMElement* child = checkContent(elem, XUtil::getFirstChildElement(elem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + if (child == 0) { + return 0; + } + + Janitor left(0); + Janitor right(0); + Janitor contentSpecNode(0); + bool hadContent = false; + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + hasChildren = true; + contentSpecNode.release(); + const XMLCh* childName = child->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_ELEMENT)) { + + SchemaElementDecl* elemDecl = traverseElementDecl(child); + + if (!elemDecl) + continue; + + contentSpecNode.reset(new (fGrammarPoolMemoryManager) ContentSpecNode + ( + elemDecl + , fGrammarPoolMemoryManager + )); + checkMinMax(contentSpecNode.get(), child, All_Element); + } + else { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::AllContentError, childName); + continue; + } + + hadContent = true; + + if (!left.get()) { + left.reset(contentSpecNode.release()); + } + else if (!right.get()) { + right.reset(contentSpecNode.release()); + } + else { + ContentSpecNode* newNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::All + , left.get() + , right.get() + , true + , true + , fGrammarPoolMemoryManager + ); + left.release(); + left.reset(newNode); + right.release(); + right.reset(contentSpecNode.release()); + } + } + contentSpecNode.release(); + + if (hadContent) { + ContentSpecNode* newNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::All + , left.get() + , right.get() + , true + , true + , fGrammarPoolMemoryManager + ); + + left.release(); + left.reset(newNode); + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(left.get(), janAnnot.release()); + } + right.release(); + return left.release(); +} + +/** + * Traverses Schema attribute declaration. + * + * + * Content: (annotation? , simpleType?) + * + * + * @param elem: the declaration of the attribute under consideration + * + * @param typeInfo: Contains the complex type info of the element to which + * the attribute declaration is attached. + * + */ +void TraverseSchema::traverseAttributeDecl(const DOMElement* const elem, + ComplexTypeInfo* const typeInfo, + const bool topLevel) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + const XMLCh* ref = getElementAttValue(elem, SchemaSymbols::fgATT_REF, DatatypeValidator::QName); + bool nameEmpty = (!name || !*name); + bool refEmpty = (!ref || !*ref); + + if (nameEmpty && refEmpty) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameRefAttribute); + return; + } + + if (topLevel && nameEmpty) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TopLevelNoNameAttribute); + return; + } + + // ------------------------------------------------------------------ + // Check attributes + // ------------------------------------------------------------------ + unsigned short scope = (topLevel) + ? GeneralAttributeCheck::E_AttributeGlobal + : (refEmpty) ? GeneralAttributeCheck::E_AttributeLocal + : GeneralAttributeCheck::E_AttributeRef; + + fAttributeCheck.checkAttributes(elem, scope, this, topLevel, fNonXSAttList); + + const XMLCh* defaultVal = getElementAttValue(elem, SchemaSymbols::fgATT_DEFAULT); + const XMLCh* fixedVal = getElementAttValue(elem, SchemaSymbols::fgATT_FIXED); + const XMLCh* useVal = getElementAttValue(elem, SchemaSymbols::fgATT_USE); + const XMLCh* attForm = getElementAttValue(elem, SchemaSymbols::fgATT_FORM); + const XMLCh* dvType = getElementAttValue(elem, SchemaSymbols::fgATT_TYPE, DatatypeValidator::QName); + DOMElement* simpleType = checkContent(elem, XUtil::getFirstChildElement(elem), true); + Janitor janAnnot(fAnnotation); + bool badContent = false; + + while (simpleType != 0) { + + const XMLCh* contentName = simpleType->getLocalName(); + + if (XMLString::equals(SchemaSymbols::fgELT_SIMPLETYPE, contentName)) { + + if (XUtil::getNextSiblingElement(simpleType) != 0) { + badContent = true; + } + break; + } + + badContent = true; + simpleType = XUtil::getNextSiblingElement(simpleType); + } + + if (badContent) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidAttributeContent, + (name) ? name : ref); + } + + if (defaultVal) { + + if (fixedVal) { + + fixedVal = 0; + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttributeDefaultFixedValue, + (name) ? name : ref); + } + + if ((useVal && *useVal) + && !XMLString::equals(useVal, SchemaSymbols::fgATTVAL_OPTIONAL)) { + + useVal = 0; + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NotOptionalDefaultAttValue, + (name) ? name : ref); + } + } + + // processing ref + if (!refEmpty && !topLevel) { + + // Check ref representation OK - 3.2.3::3.2 + if (attForm || dvType || (simpleType != 0)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttributeRefContentError, + (name) ? name : ref); + } + + processAttributeDeclRef(elem, typeInfo, ref, useVal, defaultVal, fixedVal); + return; + } + + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + janAnnot.reset(fAnnotation); + } + + // processing 'name' + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name)) + || XMLString::equals(name, XMLUni::fgXMLNSString)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, SchemaSymbols::fgELT_ATTRIBUTE, name); + return; + } + + // Check for duplicate declaration + const XMLCh* qualified = SchemaSymbols::fgATTVAL_QUALIFIED; + int uriIndex = fEmptyNamespaceURI; + + if ((fTargetNSURIString && *fTargetNSURIString) + && (topLevel || XMLString::equals(attForm, qualified) + || ((fSchemaInfo->getElemAttrDefaultQualified() & Attr_Def_Qualified) + && (!attForm || !*attForm)))) { + uriIndex = fTargetNSURI; + } + + // make sure that attribute namespace is not xsi uri + if (XMLString::equals(fTargetNSURIString, SchemaSymbols::fgURI_XSI)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidAttTNS, name); + return; + } + + if (typeInfo && typeInfo->getAttDef(name, uriIndex) != 0) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttribute, name); + return; + } + else if (fCurrentAttGroupInfo && fCurrentAttGroupInfo->containsAttribute(name, uriIndex)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttribute, name); + return; + } + + DatatypeValidator* dv = 0; + XMLAttDef::AttTypes attType = XMLAttDef::Simple; + SchemaInfo* saveInfo = fSchemaInfo; + + if (simpleType != 0) { + + if (dvType && *dvType) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttributeWithTypeAndSimpleType, name); + } + + dv = traverseSimpleTypeDecl(simpleType, false); + } + else if (!dvType || !*dvType) { + dv = fDatatypeRegistry->getDatatypeValidator(SchemaSymbols::fgDT_ANYSIMPLETYPE); + } + else { + + checkEnumerationRequiredNotation(elem, name, dvType); + + const XMLCh* localPart = getLocalPart(dvType); + const XMLCh* prefix = getPrefix(dvType); + const XMLCh* typeURI = resolvePrefixToURI(elem, prefix); + DatatypeValidator* dvBack = 0; + + if (XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + dv = fDatatypeRegistry->getDatatypeValidator(localPart); + dvBack = dv; + } + else { //isn't of the schema for schemas namespace... + + dv = getAttrDatatypeValidatorNS(elem, localPart, typeURI); + dvBack = dv; + + while(dv != 0 && !XMLString::equals(dv->getTypeUri(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + dv = dv->getBaseValidator(); + } + + if(dv) + localPart = dv->getTypeLocalName(); + } + + if(dv) { + if (XMLString::equals(localPart,XMLUni::fgIDString)) { + attType = XMLAttDef::ID; + } + else if (XMLString::equals(localPart,XMLUni::fgIDRefString)) { + attType = XMLAttDef::IDRef; + } + else if (XMLString::equals(localPart,XMLUni::fgIDRefsString)) { + attType = XMLAttDef::IDRefs; + } + else if (XMLString::equals(localPart,XMLUni::fgEntityString)) { + attType = XMLAttDef::Entity; + } + else if (XMLString::equals(localPart,XMLUni::fgEntitiesString)) { + attType = XMLAttDef::Entities; + } + else if (XMLString::equals(localPart,XMLUni::fgNmTokenString)) { + attType = XMLAttDef::NmToken; + } + else if (XMLString::equals(localPart,XMLUni::fgNmTokensString)) { + attType = XMLAttDef::NmTokens; + } + else if (XMLString::equals(localPart,XMLUni::fgNotationString)) { + attType = XMLAttDef::Notation; + } + else { + attType = XMLAttDef::Simple; + } + } + else + attType = XMLAttDef::Simple; + + dv = dvBack; + + if (!dv) { + reportSchemaError + ( + elem + , XMLUni::fgXMLErrDomain + , XMLErrs::AttributeSimpleTypeNotFound + , typeURI + , localPart + , name + ); + } + } + + // restore schema information, if necessary + fSchemaInfo = saveInfo; + + bool required = false; + bool prohibited = false; + + if (useVal && *useVal) { + + if (XMLString::equals(useVal, SchemaSymbols::fgATTVAL_REQUIRED)) { + required = true; + } + else if (XMLString::equals(useVal, SchemaSymbols::fgATTVAL_PROHIBITED)) { + prohibited = true; + } + } + + // validate fixed/default values + const XMLCh* valueToCheck = defaultVal ? defaultVal : fixedVal; + bool ofTypeID = (dv && dv->getType() == DatatypeValidator::ID); + + if (attType == XMLAttDef::Simple && dv && valueToCheck) { + + short wsFacet = dv->getWSFacet(); + if((wsFacet == DatatypeValidator::REPLACE && !XMLString::isWSReplaced(valueToCheck)) || + (wsFacet == DatatypeValidator::COLLAPSE && !XMLString::isWSCollapsed(valueToCheck))) + { + XMLCh* normalizedValue=XMLString::replicate(valueToCheck, fMemoryManager); + ArrayJanitor tempURIName(normalizedValue, fMemoryManager); + if(wsFacet == DatatypeValidator::REPLACE) + XMLString::replaceWS(normalizedValue, fMemoryManager); + else if(wsFacet == DatatypeValidator::COLLAPSE) + XMLString::collapseWS(normalizedValue, fMemoryManager); + valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(normalizedValue)); + } + try { + dv->validate(valueToCheck + , fSchemaInfo->getValidationContext() + , fMemoryManager); + } + catch (const XMLException& excep) { + reportSchemaError(elem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DatatypeValidationFailure, valueToCheck); + } + } + else if((attType == XMLAttDef::NmTokens || attType==XMLAttDef::IDRefs || attType==XMLAttDef::Entities) && + valueToCheck && !XMLString::isWSCollapsed(valueToCheck)) + { + XMLCh* normalizedValue=XMLString::replicate(valueToCheck, fMemoryManager); + ArrayJanitor tempURIName(normalizedValue, fMemoryManager); + XMLString::collapseWS(normalizedValue, fMemoryManager); + valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(normalizedValue)); + } + + if (ofTypeID && valueToCheck) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttDeclPropCorrect3, name); + } + + // check for multiple attributes with type derived from ID + if (!topLevel && ofTypeID) { + + if (fCurrentAttGroupInfo) { + + if (fCurrentAttGroupInfo->containsTypeWithId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttGrpPropCorrect3, name); + return; + } + + fCurrentAttGroupInfo->setTypeWithId(true); + } + else { + + if (typeInfo->containsAttWithTypeId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttDeclPropCorrect5, name); + return; + } + + typeInfo->setAttWithTypeId(true); + } + } + + // create SchemaAttDef + SchemaAttDef* attDef = new (fGrammarPoolMemoryManager) SchemaAttDef + ( + XMLUni::fgZeroLenString + , name + , uriIndex + , attType + , XMLAttDef::Implied + , fGrammarPoolMemoryManager + ); + + attDef->setDatatypeValidator(dv); + + if (prohibited) { + attDef->setDefaultType(XMLAttDef::Prohibited); + } + else if (required) { + + if (fixedVal) { + attDef->setDefaultType(XMLAttDef::Required_And_Fixed); + } + else { + attDef->setDefaultType(XMLAttDef::Required); + } + } + else { + + if (fixedVal) { + attDef->setDefaultType(XMLAttDef::Fixed); + } + else if (defaultVal) { + attDef->setDefaultType(XMLAttDef::Default); + } + } + + if (valueToCheck) { + attDef->setValue(valueToCheck); + } + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(attDef, janAnnot.release()); + + if (topLevel) + { + fAttributeDeclRegistry->put((void*) fStringPool->getValueForId(fStringPool->addOrFind(name)), attDef); + attDef->setPSVIScope(PSVIDefs::SCP_GLOBAL); + } + else + { + if (typeInfo) + { + typeInfo->addAttDef(attDef); + if (!fCurrentAttGroupInfo) + attDef->setPSVIScope(PSVIDefs::SCP_LOCAL); + } + + if (fCurrentAttGroupInfo) { + fCurrentAttGroupInfo->addAttDef(attDef, (typeInfo != 0)); + } + } +} + + +/** + * Traverses Schema element declaration. + * + * + * + * @param elem: the declaration of the element under consideration + */ +SchemaElementDecl* +TraverseSchema::traverseElementDecl(const DOMElement* const elem, + const bool topLevel) +{ + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // if local element and ref attribute exists + if (!topLevel) + { + const XMLCh* refName = getElementAttValue(elem, SchemaSymbols::fgATT_REF, DatatypeValidator::QName); + if (refName) + return processElementDeclRef(elem, refName); + } + + // check for empty name + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + if (!name || !*name) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameRefElement); + return 0; + } + + // make sure that name is a valid NCName + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, + XMLErrs::InvalidDeclarationName, SchemaSymbols::fgELT_ELEMENT, name); + return 0; + } + + // if element already exists, just return --- revisit, it should not happen + if (topLevel) + { + SchemaElementDecl* retDecl = (SchemaElementDecl*) fSchemaGrammar->getElemDecl(fTargetNSURI, name, 0, Grammar::TOP_LEVEL_SCOPE); + if (retDecl) + return retDecl; + } + + // Check attributes + unsigned short scope = (topLevel) ? GeneralAttributeCheck::E_ElementGlobal + : GeneralAttributeCheck::E_ElementLocal; + + fAttributeCheck.checkAttributes(elem, scope, this, topLevel, fNonXSAttList); + + // check annotation + const DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); + // Put annotations on all elements for the situation where there is a group of + // elements and not all have annotations. + //if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + if (!fAnnotation && fScanner->getGenerateSyntheticAnnotations()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + // Create element decl + bool isDuplicate = false; + const XMLCh* valueConstraint = 0; + SchemaElementDecl* elemDecl = + createSchemaElementDecl(elem, name, isDuplicate, valueConstraint, topLevel); + + if (!isDuplicate) { + + fSchemaGrammar->putElemDecl(elemDecl); + + if (valueConstraint) + elemDecl->setDefaultValue(valueConstraint); + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(elemDecl, janAnnot.release()); + + if (fCurrentComplexType && + elemDecl->getEnclosingScope() == fCurrentComplexType->getScopeDefined()) { + fCurrentComplexType->addElement(elemDecl); + elemDecl->setPSVIScope(PSVIDefs::SCP_LOCAL); + } + + if (fCurrentGroupInfo && + elemDecl->getEnclosingScope() == fCurrentGroupInfo->getScope()) { + fCurrentGroupInfo->addElement(elemDecl); + elemDecl->setPSVIScope(PSVIDefs::SCP_ABSENT); + } + } + else { + if (fAnnotation) { + XSAnnotation* xsAnnot = fSchemaGrammar->getAnnotation(elemDecl); + if (!xsAnnot) { + fSchemaGrammar->putAnnotation(elemDecl, janAnnot.release()); + } + else { + xsAnnot->setNext(janAnnot.release()); + } + } + } + + // Process children + bool anonymousType = false; + ComplexTypeInfo* typeInfo = 0; + DatatypeValidator* validator = 0; + + if (content != 0) + { + const XMLCh* contentName = content->getLocalName(); + + if (XMLString::equals(contentName, SchemaSymbols::fgELT_COMPLEXTYPE)) + { + const XMLCh* temp = content->getAttribute(SchemaSymbols::fgATT_NAME); + + if (temp && *temp) + { + // REVISIT - we are bypassing the complex type declaration. + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AnonComplexTypeWithName, name); + } + else + { + typeInfo = checkForComplexTypeInfo(content); + + if (typeInfo) + { + validator = typeInfo->getDatatypeValidator(); + + if (!isDuplicate) { + + //Recursing element + if (typeInfo->getPreprocessed()) { + + const XMLCh* typeInfoName = typeInfo->getTypeName(); + fSchemaInfo->addRecursingType(content, typeInfoName + XMLString::indexOf(typeInfoName, chComma) + 1); + } + } + } + } + + anonymousType = true; + content = XUtil::getNextSiblingElement(content); + } + else if (XMLString::equals(contentName, SchemaSymbols::fgELT_SIMPLETYPE)) + { + const XMLCh* temp = content->getAttribute(SchemaSymbols::fgATT_NAME); + if (temp && *temp) + // REVISIT - we are bypassing the simple type declaration. + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AnonSimpleTypeWithName, name); + else + validator = checkForSimpleTypeValidator(content); + + anonymousType = true; + content = XUtil::getNextSiblingElement(content); + } + + // Check for identity constraints + if (content != 0) + { + content = checkIdentityConstraintContent(content); + if (content != 0) + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::InvalidElementContent); + } + } + + // Handle 'type' attribute + const XMLCh* typeStr = getElementAttValue(elem, SchemaSymbols::fgATT_TYPE, DatatypeValidator::QName); + if (typeStr) + { + if (anonymousType) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::ElementWithTypeAndAnonType, name); + } + else if (*typeStr) + { + const XMLCh* typeLocalPart = getLocalPart(typeStr); + const XMLCh* typePrefix = getPrefix(typeStr); + const XMLCh* typeURI = resolvePrefixToURI(elem, typePrefix); + + if (!XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + || !XMLString::equals(typeLocalPart, SchemaSymbols::fgATTVAL_ANYTYPE)) + { + checkEnumerationRequiredNotation(elem, name, typeStr); + + bool noErrorFound = true; + const XMLCh* anotherSchemaURI = checkTypeFromAnotherSchema(elem, typeStr); + + // get complex type info + typeInfo = getElementComplexTypeInfo(elem, typeStr, anotherSchemaURI); + + // get simple type validtor - if not a complex type + if (typeInfo) + validator = typeInfo->getDatatypeValidator(); + else + validator = getElementTypeValidator(elem, typeStr, noErrorFound, anotherSchemaURI); + } + } + } + + // check for duplicate elements with different types. + if (isDuplicate) + { + DatatypeValidator* eltDV = elemDecl->getDatatypeValidator(); + ComplexTypeInfo* eltTypeInfo = elemDecl->getComplexTypeInfo(); + + if ( (eltTypeInfo != typeInfo) || (eltDV != validator)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateElementDeclaration, name); + } + } + // Set element declararion type information + else + { + elemDecl->setDatatypeValidator(validator); + elemDecl->setComplexTypeInfo(typeInfo); + + if (validator) + elemDecl->setModelType(SchemaElementDecl::Simple); + else if (typeInfo) + elemDecl->setModelType((SchemaElementDecl::ModelTypes)typeInfo->getContentType()); + + if (topLevel) { + + // Handle the substitutionGroup + const XMLCh* subsGroupName = getElementAttValue(elem, SchemaSymbols::fgATT_SUBSTITUTIONGROUP, DatatypeValidator::QName); + if (subsGroupName && *subsGroupName) + processSubstitutionGroup(elem, elemDecl, typeInfo, validator, subsGroupName); + } + + // process identity constraints + DOMElement* ic = XUtil::getFirstChildElementNS( + elem, fgIdentityConstraints, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, 3); + + if (ic) + processElemDeclIC(ic, elemDecl); + } + + if (!typeInfo && !validator) + { + if (!isDuplicate) + { + elemDecl->setModelType(SchemaElementDecl::Any); + elemDecl->setAttWildCard( + new (fGrammarPoolMemoryManager) SchemaAttDef( + XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, + fEmptyNamespaceURI, XMLAttDef::Any_Any, + XMLAttDef::ProcessContents_Lax, fGrammarPoolMemoryManager + ) + ); + } + } + else if (valueConstraint) + { + if (!checkElemDeclValueConstraint(elem, elemDecl, valueConstraint, typeInfo, validator) + && !isDuplicate) + { + int miscFlags = elemDecl->getMiscFlags(); + miscFlags &= ~ SchemaSymbols::XSD_FIXED; + elemDecl->setDefaultValue(0); + elemDecl->setMiscFlags(miscFlags); + } + } + + return elemDecl; +} + +/** + * Traverses Schema notation declaration. + * + * + * Content: (annotation?) + * + * + * @param elem: the declaration of the element under consideration + */ +const XMLCh* TraverseSchema::traverseNotationDecl(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Notation, this, true, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Process notation attributes/elements + // ----------------------------------------------------------------------- + const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + bool nameEmpty = (!name || !*name) ? true : false; + + if (nameEmpty) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNameGlobalElement, + SchemaSymbols::fgELT_NOTATION); + return 0; + } + + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_NOTATION, name); + return 0; + } + + if (fNotationRegistry->containsKey(name, fTargetNSURI)) { + return name; + } + + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + + const XMLCh* publicId = getElementAttValue(elem, SchemaSymbols::fgATT_PUBLIC); + const XMLCh* systemId = getElementAttValue(elem, SchemaSymbols::fgATT_SYSTEM, DatatypeValidator::AnyURI); + + fNotationRegistry->put((void*) fStringPool->getValueForId(fStringPool->addOrFind(name)), + fTargetNSURI, 0); + + // for PSVI we need to store the notational decl + XMLNotationDecl* decl = new (fGrammarPoolMemoryManager) XMLNotationDecl + ( + name, + publicId, + systemId, + 0, + fGrammarPoolMemoryManager + ); + decl->setNameSpaceId(fTargetNSURI); + fSchemaGrammar->putNotationDecl(decl); + + if (fAnnotation) + fSchemaGrammar->putAnnotation(decl, fAnnotation); + else if (fScanner->getGenerateSyntheticAnnotations() && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + fSchemaGrammar->putAnnotation(decl, fAnnotation); + } + return name; +} + +const XMLCh* TraverseSchema::traverseNotationDecl(const DOMElement* const elem, + const XMLCh* const name, + const XMLCh* const uriStr) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + SchemaInfo* saveInfo = fSchemaInfo; + + if (fTargetNSURI != (int) uriId) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uriStr); + return 0; + } + + Grammar* grammar = fGrammarResolver->getGrammar(uriStr); + + if (grammar == 0 || grammar->getGrammarType() != Grammar::SchemaGrammarType) { + + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, uriStr); + return 0; + } + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + + if (!impInfo || impInfo->getProcessed()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, uriStr, name); + return 0; + } + + fSchemaInfo = impInfo; + fTargetNSURI = fSchemaInfo->getTargetNSURI(); + } + + DOMElement* notationElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_Notation, + SchemaSymbols::fgELT_NOTATION, name, &fSchemaInfo); + + if (notationElem == 0) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::Notation_DeclNotFound, uriStr, name); + return 0; + } + + const XMLCh* notationName = traverseNotationDecl(notationElem); + + fSchemaInfo = saveInfo; + fTargetNSURI = fSchemaInfo->getTargetNSURI(); + + return notationName; +} + +/** + * Traverses Schema list simple type declaration. + * + * + * Content: (annotation?, simpleType?) + * + * + */ +DatatypeValidator* +TraverseSchema::traverseByList(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + Janitor* const janAnnot) { + + NamespaceScopeManager nsMgr(contentElem, fSchemaInfo, this); + + DatatypeValidator* baseValidator = 0; + const XMLCh* baseTypeName = getElementAttValue(contentElem, SchemaSymbols::fgATT_ITEMTYPE, DatatypeValidator::QName); + + fAttributeCheck.checkAttributes( + contentElem, GeneralAttributeCheck::E_List, this, false, fNonXSAttList + ); + + const DOMElement* tempEl = XUtil::getNextSiblingElement(contentElem); + if (tempEl != 0) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::SimpleTypeContentError, tempEl->getLocalName()); + } + + DOMElement* content = 0; + + if (!baseTypeName || !*baseTypeName) { // must 'see' + + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), false); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + if (!content) { + + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::ExpectedSimpleTypeInList, typeName); + popCurrentTypeNameStack(); + return 0; + } + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_SIMPLETYPE)) { + baseValidator = checkForSimpleTypeValidator(content, SchemaSymbols::XSD_LIST); + } + else { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::ListUnionRestrictionError, typeName); + popCurrentTypeNameStack(); + return 0; + } + + content = XUtil::getNextSiblingElement(content); + } + else { // base was provided - get proper validator + + baseValidator = findDTValidator(contentElem, typeName, baseTypeName, SchemaSymbols::XSD_LIST); + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + } + + DatatypeValidator* newDV = 0; + + if (baseValidator) { + + if (!baseValidator->isAtomic()) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::AtomicItemType, baseTypeName); + } + else { + + // 'content' should be empty + // If an annotation was encountered we have already traversed it in + // checkContent in the case of a base provided (only allowed child is + // an annotation). + if (content != 0) { // report an error and continue + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::SimpleTypeDerivationByListError, typeName); + } + + // create & register validator for "generated" type + try { + newDV = fDatatypeRegistry->createDatatypeValidator( + qualifiedName, baseValidator, 0, 0, true, finalSet, true, fGrammarPoolMemoryManager); + } + catch (const XMLException& excep) { + reportSchemaError(contentElem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, + XMLErrs::DatatypeValidatorCreationError, typeName); + } + } + } + + popCurrentTypeNameStack(); + return newDV; +} + +/** + * Traverses Schema restriction simple type declaration. + * + * + * Content: (annotation?, (simpleType?, + * (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)) + * + * + */ +DatatypeValidator* +TraverseSchema::traverseByRestriction(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + Janitor* const janAnnot) { + + NamespaceScopeManager nsMgr(contentElem, fSchemaInfo, this); + + DatatypeValidator* baseValidator = 0; + DatatypeValidator* newDV = 0; + const XMLCh* baseTypeName = getElementAttValue(contentElem, SchemaSymbols::fgATT_BASE, DatatypeValidator::QName); + + fAttributeCheck.checkAttributes( + contentElem, GeneralAttributeCheck::E_Restriction, this, false, fNonXSAttList + ); + + const DOMElement* tempEl = XUtil::getNextSiblingElement(contentElem); + if (tempEl != 0) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::SimpleTypeContentError, tempEl->getLocalName()); + } + + DOMElement* content = 0; + + if (!baseTypeName || !*baseTypeName) { // must 'see' + + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), false); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + if (content == 0) { + + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::ExpectedSimpleTypeInRestriction); + popCurrentTypeNameStack(); + return 0; + } + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_SIMPLETYPE)) { + baseValidator = checkForSimpleTypeValidator(content); + } + else { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::ListUnionRestrictionError, typeName); + popCurrentTypeNameStack(); + return 0; + } + + // Check for facets + content = XUtil::getNextSiblingElement(content); + } + else { // base was provided - get proper validator + + baseValidator = findDTValidator(contentElem, typeName, baseTypeName, SchemaSymbols::XSD_RESTRICTION); + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + } + + if (baseValidator) { + + // Get facets if any existing + typedef RefHashTableOf KVRefHash; + Janitor janFacets(0); + //RefHashTableOf* facets = 0; + typedef RefArrayVectorOf XMLChRefArray; + Janitor enums(0); + //RefArrayVectorOf* enums = 0; + XMLBuffer pattern(128, fGrammarPoolMemoryManager); + Janitor janEnumAnnot(0); + Janitor janPatternAnnot(0); + XMLCh fixedFlagStr[16]; + unsigned int fixedFlag = 0; + unsigned short scope = 0; + bool isFirstPattern = true; + bool sawPattern = false; + + + while (content != 0) { + + if (content->getNodeType() == DOMNode::ELEMENT_NODE) { + + NamespaceScopeManager nsMgr(content, fSchemaInfo, this); + + const XMLCh* facetName = content->getLocalName(); + + bool bContinue=false; // workaround for Borland bug with 'continue' in 'catch' + try { + scope = fAttributeCheck.getFacetId(facetName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::InvalidFacetName, facetName); + content = XUtil::getNextSiblingElement(content); + bContinue=true; + } + if(bContinue) + continue; + + fAttributeCheck.checkAttributes( + content, scope, this, false, fNonXSAttList + ); + if (checkContent(rootElem, XUtil::getFirstChildElement(content), true) != 0) + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + + const XMLCh* attValue = content->getAttribute(SchemaSymbols::fgATT_VALUE); + if (janFacets.get() == 0) { + janFacets.reset(new (fGrammarPoolMemoryManager) RefHashTableOf(29, true, fGrammarPoolMemoryManager)); + + } + + if (XMLString::equals(facetName, SchemaSymbols::fgELT_ENUMERATION)) { + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(content, fNonXSAttList); + } + if (fAnnotation) { + if (janEnumAnnot.isDataNull()) + janEnumAnnot.reset(fAnnotation); + else + janEnumAnnot.get()->setNext(fAnnotation); + } + + // REVISIT + // if validator is a notation datatype validator, we need + // to get the qualified name first before adding it to the + // enum buffer + if (!enums.get()) { + enums.reset(new (fGrammarPoolMemoryManager) RefArrayVectorOf(8, true, fGrammarPoolMemoryManager)); + } + + if (baseValidator->getType() == DatatypeValidator::NOTATION) { + + const XMLCh* localPart = getLocalPart(attValue); + const XMLCh* prefix = getPrefix(attValue); + const XMLCh* uriStr = (prefix && *prefix) ? resolvePrefixToURI(content, prefix) : fTargetNSURIString; + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!fNotationRegistry->containsKey(localPart, uriId)) { + traverseNotationDecl(content, localPart, uriStr); + } + + if (uriStr && *uriStr) { + fBuffer.set(uriStr); + fBuffer.append(chColon); + fBuffer.append(localPart); + enums.get()->addElement(XMLString::replicate(fBuffer.getRawBuffer(), fGrammarPoolMemoryManager)); + } + else { + enums.get()->addElement(XMLString::replicate(localPart, fGrammarPoolMemoryManager)); + } + + } + else if (baseValidator->getType() == DatatypeValidator::QName) { + // We need the URI string for the prefix to determine + // if that matches the value in the instance document. + // Code was just comparing the string of prefix:localname + // and if the schema and instance document had different + // prefixes with the same URI string then we were giving an error. + const XMLCh* prefix = getPrefix(attValue); + const XMLCh* uriStr = (prefix && *prefix) ? resolvePrefixToURI(content, prefix) : fTargetNSURIString; + + enums.get()->addElement(XMLString::replicate(attValue, fGrammarPoolMemoryManager)); + enums.get()->addElement(XMLString::replicate(uriStr, fGrammarPoolMemoryManager)); + } + else { + enums.get()->addElement(XMLString::replicate(attValue, fGrammarPoolMemoryManager)); + } + } + else if (XMLString::equals(facetName, SchemaSymbols::fgELT_PATTERN)) { + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(content, fNonXSAttList); + } + if (fAnnotation) { + if (janPatternAnnot.isDataNull()) + janPatternAnnot.reset(fAnnotation); + else + janPatternAnnot.get()->setNext(fAnnotation); + } + sawPattern = true; + if (isFirstPattern) { // fBuffer.isEmpty() - overhead call + + isFirstPattern = false; + pattern.set(attValue); + } + else { //datatypes: 5.2.4 pattern + + pattern.append(chPipe); + pattern.append(attValue); + } + } + else { + + if (janFacets.get()->containsKey(facetName)) { + + if (fAnnotation) + delete fAnnotation; + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateFacet, facetName); + } + else { + + if (XMLString::equals(facetName, SchemaSymbols::fgELT_WHITESPACE) + && baseValidator->getType() != DatatypeValidator::String + && !XMLString::equals(attValue, SchemaSymbols::fgWS_COLLAPSE)) { + + if (fAnnotation) + delete fAnnotation; + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::WS_CollapseExpected, attValue); + } + else { + + const XMLCh* facetStr = fStringPool->getValueForId(fStringPool->addOrFind(facetName)); + KVStringPair* kv = new (fGrammarPoolMemoryManager) KVStringPair(facetStr, attValue, fGrammarPoolMemoryManager); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(content, fNonXSAttList); + } + if (fAnnotation) + fSchemaGrammar->putAnnotation(kv, fAnnotation); + + janFacets.get()->put((void*) facetStr, kv); + checkFixedFacet(content, facetStr, baseValidator, fixedFlag); + } + } + } + } + + content = XUtil::getNextSiblingElement(content); + } // end while + + if (sawPattern) { + + KVStringPair* kv = new (fGrammarPoolMemoryManager) KVStringPair(SchemaSymbols::fgELT_PATTERN, pattern.getRawBuffer(), pattern.getLen(), fGrammarPoolMemoryManager); + if (!janPatternAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(kv, janPatternAnnot.release()); + janFacets.get()->put((void*) SchemaSymbols::fgELT_PATTERN, kv); + } + + if (fixedFlag) { + + XMLString::binToText(fixedFlag, fixedFlagStr, 15, 10, fGrammarPoolMemoryManager); + janFacets.get()->put((void*) SchemaSymbols::fgATT_FIXED, + new (fGrammarPoolMemoryManager) KVStringPair(SchemaSymbols::fgATT_FIXED, fixedFlagStr, fGrammarPoolMemoryManager)); + } + + if (enums.get() && !janEnumAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(enums.get(), janEnumAnnot.release()); + + try { + newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName, baseValidator, janFacets.release(), enums.release(), false, finalSet, true, fGrammarPoolMemoryManager); + } + catch (const XMLException& excep) { + reportSchemaError(contentElem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, + XMLErrs::DatatypeValidatorCreationError, typeName); + } + } + popCurrentTypeNameStack(); + return newDV; +} + +/** + * Traverses Schema union simple type declaration. + * + * + * Content: (annotation?, simpleType*) + * + * + */ +DatatypeValidator* +TraverseSchema::traverseByUnion(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + int baseRefContext, + Janitor* const janAnnot) { + + NamespaceScopeManager nsMgr(contentElem, fSchemaInfo, this); + + fAttributeCheck.checkAttributes( + contentElem, GeneralAttributeCheck::E_Union, this, false, fNonXSAttList + ); + + const DOMElement* tempEl = XUtil::getNextSiblingElement(contentElem); + if (tempEl != 0) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::SimpleTypeContentError, tempEl->getLocalName()); + } + + const XMLCh* baseTypeName = getElementAttValue(contentElem, SchemaSymbols::fgATT_MEMBERTYPES); + DatatypeValidator* baseValidator = 0; + RefVectorOf* validators = new (fGrammarPoolMemoryManager) RefVectorOf(4, false, fGrammarPoolMemoryManager); + Janitor > janValidators(validators); + DOMElement* content = 0; + + if (baseTypeName && *baseTypeName) { //base was provided - get proper validator. + + XMLStringTokenizer unionMembers(baseTypeName, fGrammarPoolMemoryManager); + int tokCount = unionMembers.countTokens(); + + for (int i = 0; i < tokCount; i++) { + + const XMLCh* memberTypeName = unionMembers.nextToken(); + + baseValidator = findDTValidator(contentElem, typeName, memberTypeName, SchemaSymbols::XSD_UNION); + + if (baseValidator == 0) { + + popCurrentTypeNameStack(); + return 0; + } + + validators->addElement(baseValidator); + } + + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), true); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + } + else { // must 'see' + + content = checkContent(rootElem, XUtil::getFirstChildElement(contentElem), false); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentElem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + if (content == 0) { + + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::ExpectedSimpleTypeInUnion, typeName); + popCurrentTypeNameStack(); + return 0; + } + + if (!XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_SIMPLETYPE)) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::ListUnionRestrictionError, typeName); + popCurrentTypeNameStack(); + return 0; + } + } + + // process union content of simpleType children if any + while (content != 0) { + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_SIMPLETYPE)) { + + baseValidator = checkForSimpleTypeValidator(content, baseRefContext | SchemaSymbols::XSD_UNION); + + if (baseValidator == 0) { + + popCurrentTypeNameStack(); + return 0; + } + + validators->addElement(baseValidator); + } + else { + // REVISIT - should we break. For now, we will continue and move to + // the next sibling + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::ListUnionRestrictionError, typeName); + } + + content = XUtil::getNextSiblingElement(content); + } // end while + + DatatypeValidator* newDV = 0; + janValidators.orphan(); + + try { + newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName, validators, finalSet, true, fGrammarPoolMemoryManager); + } + catch (const XMLException& excep) { + reportSchemaError(contentElem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, + XMLErrs::DatatypeValidatorCreationError, typeName); + } + + popCurrentTypeNameStack(); + return newDV; +} + + +/** + * Traverse SimpleContent Declaration + * + * + * + * Content: (annotation? , (restriction | extension)) + * + * + * + * + * Content: (annotation?, (simpleType?, (minExclusive | minInclusive + * | maxExclusive | maxInclusive | totalDigits | fractionDigits + * | length | minLength | maxLength | enumeration | pattern + * | whiteSpace)*)?, ((attribute | attributeGroup)* , anyAttribute?)) + * + * + * + * Content: (annotation? , ((attribute | attributeGroup)* , anyAttribute?)) + * + * + */ +void TraverseSchema::traverseSimpleContentDecl(const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const DOMElement* const contentDecl, + ComplexTypeInfo* const typeInfo, + Janitor* const janAnnot) +{ + NamespaceScopeManager nsMgr(contentDecl, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + bool preProcessFlag = typeInfo->getPreprocessed(); + + if (!preProcessFlag) { + fAttributeCheck.checkAttributes( + contentDecl, GeneralAttributeCheck::E_SimpleContent + , this, false, fNonXSAttList + ); + } + + // ----------------------------------------------------------------------- + // Set the content type to be simple, and initialize content spec handle + // ----------------------------------------------------------------------- + typeInfo->setContentType(SchemaElementDecl::Simple); + + // ----------------------------------------------------------------------- + // Process annotation if any + // ----------------------------------------------------------------------- + DOMElement* simpleContent = checkContent(contentDecl, XUtil::getFirstChildElement(contentDecl), false, !preProcessFlag); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentDecl, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + // If there are no children, return + if (simpleContent == 0) { + + reportSchemaError(contentDecl, XMLUni::fgXMLErrDomain, XMLErrs::EmptySimpleTypeContent); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + NamespaceScopeManager nsMgr2(simpleContent, fSchemaInfo, this); + // ----------------------------------------------------------------------- + // The content should be either "restriction" or "extension" + // ----------------------------------------------------------------------- + if (!preProcessFlag) { + const XMLCh* const contentName = simpleContent->getLocalName(); + + if (XMLString::equals(contentName, SchemaSymbols::fgATTVAL_RESTRICTION)) { + + fAttributeCheck.checkAttributes( + simpleContent, GeneralAttributeCheck::E_Restriction + , this, false, fNonXSAttList + ); + typeInfo->setDerivedBy(SchemaSymbols::XSD_RESTRICTION); + } + else if (XMLString::equals(contentName, SchemaSymbols::fgATTVAL_EXTENSION)) { + + fAttributeCheck.checkAttributes( + simpleContent, GeneralAttributeCheck::E_Extension + , this, false, fNonXSAttList + ); + typeInfo->setDerivedBy(SchemaSymbols::XSD_EXTENSION); + } + else { + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidSimpleContent); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + + //Skip over any annotations in the restriction or extension elements + DOMElement* content = checkContent(simpleContent, XUtil::getFirstChildElement(simpleContent), true, !preProcessFlag); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(simpleContent, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + // ----------------------------------------------------------------------- + // Handle the base type name + // ----------------------------------------------------------------------- + const XMLCh* baseName = getElementAttValue(simpleContent, SchemaSymbols::fgATT_BASE, DatatypeValidator::QName); + + if (!baseName || !*baseName) { + + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::UnspecifiedBase); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + const XMLCh* prefix = getPrefix(baseName); + const XMLCh* localPart = getLocalPart(baseName); + const XMLCh* uri = resolvePrefixToURI(simpleContent, prefix); + + // check for 'anyType' + if (XMLString::equals(uri, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + && XMLString::equals(localPart, SchemaSymbols::fgATTVAL_ANYTYPE)) { + + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidSimpleContentBase, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + processBaseTypeInfo(simpleContent, baseName, localPart, uri, typeInfo); + + ComplexTypeInfo* baseTypeInfo = typeInfo->getBaseComplexTypeInfo(); + DatatypeValidator* baseValidator = typeInfo->getBaseDatatypeValidator(); + + if (baseValidator != 0 && baseTypeInfo == 0) { + + // check that the simpleType does not preclude derivation by extension + if ((baseValidator->getFinalSet() & SchemaSymbols::XSD_EXTENSION) == typeInfo->getDerivedBy()) { + + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::DisallowedSimpleTypeExtension, + baseName, typeName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + //Schema Spec: 5.11: Complex Type Definition Properties Correct: 2 + if (typeInfo->getDerivedBy() == SchemaSymbols::XSD_RESTRICTION) { + + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidComplexTypeBase, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + + // check that the base isn't a complex type with complex content + // and that derivation method is not included in 'final' + bool simpleTypeRequired = false; + + if (baseTypeInfo) { + + if (baseTypeInfo->getContentType() != SchemaElementDecl::Simple) { + + // Schema Errata: E1-27 + if (typeInfo->getDerivedBy() == SchemaSymbols::XSD_RESTRICTION + && ((baseTypeInfo->getContentType() == SchemaElementDecl::Mixed_Simple + || baseTypeInfo->getContentType() == SchemaElementDecl::Mixed_Complex) + && emptiableParticle(baseTypeInfo->getContentSpec()))) { + simpleTypeRequired = true; + } + else { + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidSimpleContentBase, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + + if ((baseTypeInfo->getFinalSet() & typeInfo->getDerivedBy()) != 0) { + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::ForbiddenDerivation, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + + // ----------------------------------------------------------------------- + // Process the content of the derivation + // ----------------------------------------------------------------------- + if (typeInfo->getDerivedBy() == SchemaSymbols::XSD_RESTRICTION) { + + if(baseTypeInfo) + typeInfo->setBaseDatatypeValidator(baseTypeInfo->getDatatypeValidator()); + + if (content != 0) { + + // --------------------------------------------------------------- + // There may be a simple type definition in the restriction + // element. The data type validator will be based on it, if + // specified + // --------------------------------------------------------------- + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_SIMPLETYPE)) { + + DatatypeValidator* simpleTypeDV = traverseSimpleTypeDecl(content, false); + + if (simpleTypeDV) { + + // Check that the simpleType validator is validly derived + // from base + DatatypeValidator* baseDV = typeInfo->getBaseDatatypeValidator(); + + if (baseDV && !baseDV->isSubstitutableBy(simpleTypeDV)) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::InvalidContentRestriction); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + typeInfo->setBaseDatatypeValidator(simpleTypeDV); + content = XUtil::getNextSiblingElement(content); + } + else { + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + // Schema Errata E1-27 + // Complex Type Definition Restriction OK: 2.2 + else if (simpleTypeRequired) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::CT_SimpleTypeChildRequired); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + // --------------------------------------------------------------- + // Build up the facet info + // --------------------------------------------------------------- + RefHashTableOf* facets = 0; + RefArrayVectorOf* enums = 0; + XMLBuffer pattern(128, fGrammarPoolMemoryManager); + XMLCh fixedFlagStr[16]; + unsigned int fixedFlag = 0; + unsigned short scope = 0; + bool isFirstPattern = true; + + while (content != 0) { + + const XMLCh* facetName = content->getLocalName(); + + bool bDoBreak=false; // workaround for Borland bug with 'break' in 'catch' + // if not a valid facet, break from the loop + try { + scope = fAttributeCheck.getFacetId(facetName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + bDoBreak=true; + } + if(bDoBreak) + break; + + if (content->getNodeType() == DOMNode::ELEMENT_NODE) { + + fAttributeCheck.checkAttributes(content, scope, this); + + const XMLCh* attValue = content->getAttribute(SchemaSymbols::fgATT_VALUE); + + if (facets == 0) { + facets = new (fGrammarPoolMemoryManager) RefHashTableOf(29, true, fGrammarPoolMemoryManager); + } + + if (XMLString::equals(facetName, SchemaSymbols::fgELT_ENUMERATION)) { + + if (!enums) { + enums = new (fGrammarPoolMemoryManager) RefArrayVectorOf(8, true, fGrammarPoolMemoryManager); + } + + enums->addElement(XMLString::replicate(attValue, fGrammarPoolMemoryManager)); + } + else if (XMLString::equals(facetName, SchemaSymbols::fgELT_PATTERN)) { + + if (isFirstPattern) { // fBuffer.isEmpty() - overhead call + + isFirstPattern = false; + pattern.set(attValue); + } + else { //datatypes: 5.2.4 pattern + + pattern.append(chPipe); + pattern.append(attValue); + } + } + else { + + if (facets->containsKey(facetName)) { + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateFacet, facetName); + } + else { + + const XMLCh* facetNameStr = + fStringPool->getValueForId(fStringPool->addOrFind(facetName)); + + facets->put((void*) facetNameStr, new (fGrammarPoolMemoryManager) KVStringPair(facetNameStr, attValue, fGrammarPoolMemoryManager)); + checkFixedFacet(content, facetNameStr, typeInfo->getBaseDatatypeValidator(), fixedFlag); + } + } + } + + content = XUtil::getNextSiblingElement(content); + } + + if (facets) { + + if (!pattern.isEmpty()) { + facets->put + ( + (void*) SchemaSymbols::fgELT_PATTERN, + new (fGrammarPoolMemoryManager) KVStringPair + ( + SchemaSymbols::fgELT_PATTERN + , pattern.getRawBuffer() + , pattern.getLen() + , fGrammarPoolMemoryManager + ) + ); + } + + if (fixedFlag) { + + XMLString::binToText(fixedFlag, fixedFlagStr, 15, 10, fGrammarPoolMemoryManager); + facets->put((void*) SchemaSymbols::fgATT_FIXED, + new (fGrammarPoolMemoryManager) KVStringPair(SchemaSymbols::fgATT_FIXED, fixedFlagStr, fGrammarPoolMemoryManager)); + } + + try { + + DatatypeValidator* simpleDV = + fDatatypeRegistry->createDatatypeValidator + ( + qualifiedName, + typeInfo->getBaseDatatypeValidator(), + facets, enums, false, 0, true, fGrammarPoolMemoryManager + ); + simpleDV->setAnonymous(); + typeInfo->setDatatypeValidator(simpleDV); + } + catch (const XMLException& excep) { + reportSchemaError(simpleContent, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) { + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::DatatypeValidatorCreationError, typeName); + } + } + else { + typeInfo->setDatatypeValidator(typeInfo->getBaseDatatypeValidator()); + } + } + else { + + // Schema Errata E1-27 + // Complex Type Definition Restriction OK: 2.2 + if (simpleTypeRequired) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::CT_SimpleTypeChildRequired); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + typeInfo->setDatatypeValidator(typeInfo->getBaseDatatypeValidator()); + } + } // end RESTRICTION + else { // EXTENSION + + ComplexTypeInfo* baseTypeInfo = typeInfo->getBaseComplexTypeInfo(); + + if (baseTypeInfo!= 0) { + + typeInfo->setBaseDatatypeValidator(baseTypeInfo->getDatatypeValidator()); + } + + typeInfo->setDatatypeValidator(typeInfo->getBaseDatatypeValidator()); + } + + // ----------------------------------------------------------------------- + // Process attributes if any + // ----------------------------------------------------------------------- + processAttributes(simpleContent, content, typeInfo); + + if (XUtil::getNextSiblingElement(simpleContent) != 0) { + reportSchemaError(simpleContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildInSimpleContent); + } + +} // End of function traverseSimpleContentDecl + +/** + * Traverse complexContent Declaration + * + * + * + * Content: (annotation? , (restriction | extension)) + * + * + * + * + * Content: (annotation? , (group | all | choice | sequence)?, + * ((attribute | attributeGroup)* , anyAttribute?)) + * + * + * + * Content: (annotation? , (group | all | choice | sequence)?, + * ((attribute | attributeGroup)* , anyAttribute?)) + * + */ +void TraverseSchema::traverseComplexContentDecl(const XMLCh* const typeName, + const DOMElement* const contentDecl, + ComplexTypeInfo* const typeInfo, + const bool isMixed, + Janitor* const janAnnot) +{ + NamespaceScopeManager nsMgr(contentDecl, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check attributes + // ----------------------------------------------------------------------- + bool preProcessFlag = typeInfo->getPreprocessed(); + + if (!preProcessFlag) { + fAttributeCheck.checkAttributes( + contentDecl, GeneralAttributeCheck::E_ComplexContent + , this, false, fNonXSAttList + ); + } + + // ----------------------------------------------------------------------- + // Determine whether the content is mixed, or element-only + // Setting here overrides any setting on the complex type decl + // ----------------------------------------------------------------------- + const XMLCh* const mixed = getElementAttValue(contentDecl, SchemaSymbols::fgATT_MIXED, DatatypeValidator::Boolean); + bool mixedContent = isMixed; + + if (mixed) { + if (XMLString::equals(mixed, SchemaSymbols::fgATTVAL_TRUE) + || XMLString::equals(mixed, fgValueOne)) { + mixedContent = true; + } + else if (XMLString::equals(mixed, SchemaSymbols::fgATTVAL_FALSE) + || XMLString::equals(mixed, fgValueZero)) { + mixedContent = false; + } + } + + // ----------------------------------------------------------------------- + // Since the type must have complex content, set the simple type validators + // to null + // ----------------------------------------------------------------------- + typeInfo->setDatatypeValidator(0); + typeInfo->setBaseDatatypeValidator(0); + + DOMElement* complexContent = checkContent(contentDecl,XUtil::getFirstChildElement(contentDecl),false, !preProcessFlag); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(contentDecl, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + // If there are no children, return + if (complexContent == 0) { + throw TraverseSchema::InvalidComplexTypeInfo; + } + + NamespaceScopeManager nsMgr2(complexContent, fSchemaInfo, this); + // ----------------------------------------------------------------------- + // The content should be either "restriction" or "extension" + // ----------------------------------------------------------------------- + const XMLCh* const complexContentName = complexContent->getLocalName(); + + if (XMLString::equals(complexContentName, SchemaSymbols::fgELT_RESTRICTION)) { + typeInfo->setDerivedBy(SchemaSymbols::XSD_RESTRICTION); + } + else if (XMLString::equals(complexContentName, SchemaSymbols::fgELT_EXTENSION)) { + typeInfo->setDerivedBy(SchemaSymbols::XSD_EXTENSION); + } + else { + + reportSchemaError(complexContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidComplexContent); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + // ----------------------------------------------------------------------- + // Handle the base type name + // ----------------------------------------------------------------------- + const XMLCh* baseName = getElementAttValue(complexContent, SchemaSymbols::fgATT_BASE, DatatypeValidator::QName); + + if (!baseName || !*baseName) { + + reportSchemaError(complexContent, XMLUni::fgXMLErrDomain, XMLErrs::UnspecifiedBase); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + const XMLCh* prefix = getPrefix(baseName); + const XMLCh* localPart = getLocalPart(baseName); + const XMLCh* uri = resolvePrefixToURI(complexContent, prefix); + bool isBaseAnyType = false; + + // ------------------------------------------------------------- + // check if the base is "anyType" + // ------------------------------------------------------------- + if (XMLString::equals(uri, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) && + XMLString::equals(localPart, SchemaSymbols::fgATTVAL_ANYTYPE)) { + isBaseAnyType = true; + } + else { + + processBaseTypeInfo(complexContent, baseName, localPart, uri, typeInfo); + + //Check that the base is a complex type + if (typeInfo->getBaseComplexTypeInfo() == 0) { + + reportSchemaError(complexContent, XMLUni::fgXMLErrDomain, XMLErrs::BaseNotComplexType); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + + if (fCurrentGroupInfo) // defer processing until later + throw TraverseSchema::RecursingElement; + + // ----------------------------------------------------------------------- + // Process the content of the derivation + // ----------------------------------------------------------------------- + //Skip over any annotations in the restriction or extension elements + DOMElement* content = checkContent(complexContent, XUtil::getFirstChildElement(complexContent), true); + if (fAnnotation) + { + if (janAnnot->isDataNull()) + janAnnot->reset(fAnnotation); + else + janAnnot->get()->setNext(fAnnotation); + } + + processComplexContent(complexContent, typeName, content, typeInfo, localPart, + mixedContent, isBaseAnyType); + + if (XUtil::getNextSiblingElement(complexContent) != 0) { + reportSchemaError(complexContent, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildInComplexContent); + } +} + + +/** + * + * processContents = (lax | skip | strict) : strict + * Content: (annotation?) + * + */ +SchemaAttDef* TraverseSchema::traverseAnyAttribute(const DOMElement* const elem) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_AnyAttribute, this, false, fNonXSAttList + ); + + // ------------------------------------------------------------------ + // First, handle any ANNOTATION declaration + // ------------------------------------------------------------------ + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AnyAttributeContentError); + } + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + // ------------------------------------------------------------------ + // Get attributes + // ------------------------------------------------------------------ + const XMLCh* const processContents = getElementAttValue(elem, SchemaSymbols::fgATT_PROCESSCONTENTS); + const XMLCh* const nameSpace = getElementAttValue(elem, SchemaSymbols::fgATT_NAMESPACE); + + // ------------------------------------------------------------------ + // Set default att type based on 'processContents' value + // ------------------------------------------------------------------ + XMLAttDef::DefAttTypes attDefType = XMLAttDef::ProcessContents_Strict; + + if ((!processContents || !*processContents) + || XMLString::equals(processContents, SchemaSymbols::fgATTVAL_STRICT)) { + // Do nothing - defaulted already + } + else if (XMLString::equals(processContents, SchemaSymbols::fgATTVAL_SKIP)) { + attDefType = XMLAttDef::ProcessContents_Skip; + } + else if (XMLString::equals(processContents, SchemaSymbols::fgATTVAL_LAX)) { + attDefType = XMLAttDef::ProcessContents_Lax; + } + + // ------------------------------------------------------------------ + // Process 'namespace' attribute + // ------------------------------------------------------------------ + int uriIndex = fEmptyNamespaceURI; + XMLAttDef::AttTypes attType = XMLAttDef::Any_Any; + ValueVectorOf namespaceList(8, fGrammarPoolMemoryManager); + + if ((!nameSpace || !*nameSpace) + || XMLString::equals(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDANY)) { + // Do nothing - defaulted already + } + else if (XMLString::equals(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDOTHER)) { + + attType = XMLAttDef::Any_Other; + uriIndex = fTargetNSURI; + } + else { + + XMLStringTokenizer tokenizer(nameSpace, fGrammarPoolMemoryManager); + DatatypeValidator* anyURIDV = fDatatypeRegistry->getDatatypeValidator(SchemaSymbols::fgDT_ANYURI); + + attType = XMLAttDef::Any_List; + + while (tokenizer.hasMoreTokens()) { + + const XMLCh* token = tokenizer.nextToken(); + + if (XMLString::equals(token, SchemaSymbols::fgATTVAL_TWOPOUNDLOCAL)) { + uriIndex = fEmptyNamespaceURI; + } + else if (XMLString::equals(token, SchemaSymbols::fgATTVAL_TWOPOUNDTRAGETNAMESPACE)) { + uriIndex = fTargetNSURI; + } + else { + + try { + anyURIDV->validate(token + , fSchemaInfo->getValidationContext() + , fMemoryManager); + } + catch(const XMLException& excep) { + reportSchemaError(elem, excep); + } + uriIndex = fURIStringPool->addOrFind(token); + } + + if (!namespaceList.containsElement(uriIndex)) { + namespaceList.addElement(uriIndex); + } + } + + uriIndex = fEmptyNamespaceURI; + } + + // ------------------------------------------------------------------ + // Create wildcard attribute + // ------------------------------------------------------------------ + SchemaAttDef* attDef = new (fGrammarPoolMemoryManager) SchemaAttDef(XMLUni::fgZeroLenString, + XMLUni::fgZeroLenString, + uriIndex, attType, attDefType, + fGrammarPoolMemoryManager); + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(attDef, janAnnot.release()); + + if (namespaceList.size()) { + attDef->setNamespaceList(&namespaceList); + } + + return attDef; +} + +/** + * + */ +void TraverseSchema::traverseKey(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl) { + + NamespaceScopeManager nsMgr(icElem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + icElem, GeneralAttributeCheck::E_Key, this, false, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Create identity constraint + // ----------------------------------------------------------------------- + const XMLCh* name = getElementAttValue(icElem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_KEY, name); + return; + } + + + if (!fIdentityConstraintNames) { + fIdentityConstraintNames = new (fMemoryManager) RefHash2KeysTableOf(29, (bool) false, fMemoryManager); + } + else if (fIdentityConstraintNames->containsKey(name, fTargetNSURI)) { + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_DuplicateDecl, name); + return; + } + + IC_Key* icKey = new (fGrammarPoolMemoryManager) IC_Key(name, elemDecl->getBaseName(), fGrammarPoolMemoryManager); + Janitor janKey(icKey); + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, icKey); + + // ----------------------------------------------------------------------- + // Get selector and fields + // ----------------------------------------------------------------------- + if (!traverseIdentityConstraint(icKey, icElem)) { + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, 0); + return; + } + + // ----------------------------------------------------------------------- + // Add key to element declaration + // ----------------------------------------------------------------------- + elemDecl->addIdentityConstraint(icKey); + icKey->setNamespaceURI(fTargetNSURI); + janKey.orphan(); +} + +/** + * + */ +void TraverseSchema::traverseUnique(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl) { + + NamespaceScopeManager nsMgr(icElem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + icElem, GeneralAttributeCheck::E_Unique, this, false, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Create identity constraint + // ----------------------------------------------------------------------- + const XMLCh* name = getElementAttValue(icElem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_UNIQUE, name); + return; + } + + if (!fIdentityConstraintNames) { + fIdentityConstraintNames = new (fGrammarPoolMemoryManager) RefHash2KeysTableOf(29, (bool) false, fGrammarPoolMemoryManager); + } + else if (fIdentityConstraintNames->containsKey(name, fTargetNSURI)) { + + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_DuplicateDecl, name); + return; + } + + IC_Unique* icUnique = new (fGrammarPoolMemoryManager) IC_Unique(name, elemDecl->getBaseName(), fGrammarPoolMemoryManager); + Janitor janUnique(icUnique); + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, icUnique); + + // ----------------------------------------------------------------------- + // Get selector and fields + // ----------------------------------------------------------------------- + if (!traverseIdentityConstraint(icUnique, icElem)) { + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, 0); + return; + } + + // ----------------------------------------------------------------------- + // Add identity cosntraints to element declaration + // ----------------------------------------------------------------------- + elemDecl->addIdentityConstraint(icUnique); + icUnique->setNamespaceURI(fTargetNSURI); + janUnique.orphan(); +} + +/** + * + */ +void TraverseSchema::traverseKeyRef(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl) { + + NamespaceScopeManager nsMgr(icElem, fSchemaInfo, this); + + // ----------------------------------------------------------------------- + // Check Attributes + // ----------------------------------------------------------------------- + fAttributeCheck.checkAttributes( + icElem, GeneralAttributeCheck::E_KeyRef, this, false, fNonXSAttList + ); + + // ----------------------------------------------------------------------- + // Verify that key reference "refer" attribute is valid + // ----------------------------------------------------------------------- + const XMLCh* name = getElementAttValue(icElem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + const XMLCh* refer = getElementAttValue(icElem, SchemaSymbols::fgATT_REFER, DatatypeValidator::QName); + + if (!XMLChar1_0::isValidNCName(name, XMLString::stringLen(name))) { + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidDeclarationName, + SchemaSymbols::fgELT_KEYREF, name); + return; + } + + const XMLCh* prefix = getPrefix(refer); + const XMLCh* localPart = getLocalPart(refer); + + // we use the DOM API, as the NamespaceScope is now pointing to a different place + const XMLCh* uriStr = icElem->lookupNamespaceURI(*prefix==0?NULL:prefix); + if ((!uriStr || !*uriStr) && (prefix && *prefix)) + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::UnresolvedPrefix, prefix); + if(!uriStr) + uriStr=XMLUni::fgZeroLenString; + + IdentityConstraint* icKey = (fIdentityConstraintNames) + ? fIdentityConstraintNames->get(localPart, fURIStringPool->addOrFind(uriStr)) : 0; + + if (!icKey) { + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_KeyRefReferNotFound, name, localPart); + return; + } + + // ----------------------------------------------------------------------- + // Create identity constraint + // ----------------------------------------------------------------------- + if(fIdentityConstraintNames->containsKey(name, fTargetNSURI)) { + + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_DuplicateDecl, name); + return; + } + + IC_KeyRef* icKeyRef = new (fGrammarPoolMemoryManager) IC_KeyRef(name, elemDecl->getBaseName(), icKey, fGrammarPoolMemoryManager); + Janitor janKeyRef(icKeyRef); + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, icKeyRef); + + // ----------------------------------------------------------------------- + // Get selector and fields + // ----------------------------------------------------------------------- + if (!traverseIdentityConstraint(icKeyRef, icElem)) { + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, 0); + return; + } + + // ----------------------------------------------------------------------- + // Add key reference to element decl + // ----------------------------------------------------------------------- + if (icKeyRef->getFieldCount() != icKey->getFieldCount()) { + + fIdentityConstraintNames->put((void*) name, fTargetNSURI, 0); + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_KeyRefCardinality, + name, icKey->getIdentityConstraintName()); + } + else { + + elemDecl->addIdentityConstraint(icKeyRef); + icKeyRef->setNamespaceURI(fTargetNSURI); + janKeyRef.orphan(); + } +} + + +bool TraverseSchema::traverseIdentityConstraint(IdentityConstraint* const ic, + const DOMElement* const icElem) { + + NamespaceScopeManager nsMgr(icElem, fSchemaInfo, this); + + // ------------------------------------------------------------------ + // First, handle any ANNOTATION declaration + // ------------------------------------------------------------------ + DOMElement* elem = checkContent(icElem, XUtil::getFirstChildElement(icElem), false); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(icElem, fNonXSAttList); + } + Janitor janAnnot(fAnnotation); + + // ------------------------------------------------------------------ + // Get selector + // ------------------------------------------------------------------ + if (elem == 0) { + +// reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_BadContent); + return false; + } + + if (!XMLString::equals(elem->getLocalName(), SchemaSymbols::fgELT_SELECTOR)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::IC_BadContent); + return false; + } + + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Selector, this, false, fNonXSAttList + ); + if (checkContent(icElem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot.isDataNull()) + janAnnot.reset(fAnnotation); + else + janAnnot.get()->setNext(fAnnotation); + } + + // ------------------------------------------------------------------ + // Get xpath attribute + // ------------------------------------------------------------------ + const XMLCh* xpathExpr = getElementAttValue(elem, SchemaSymbols::fgATT_XPATH); + XMLSize_t xpathLen = XMLString::stringLen(xpathExpr); + + if (!xpathExpr || !xpathLen) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::IC_XPathExprMissing); + return false; + } + + // ------------------------------------------------------------------ + // Parse xpath expression + // ------------------------------------------------------------------ + try { + + XercesXPath* sXPath = new (fGrammarPoolMemoryManager) XercesXPath(xpathExpr, fStringPool, fSchemaInfo->getNamespaceScope(), fEmptyNamespaceURI, true, fGrammarPoolMemoryManager); + IC_Selector* icSelector = new (fGrammarPoolMemoryManager) IC_Selector(sXPath, ic); + ic->setSelector(icSelector); + } + catch (const XPathException& e) { + + reportSchemaError(elem, e); + return false; + } + + // ------------------------------------------------------------------ + // Get fields + // ------------------------------------------------------------------ + elem = XUtil::getNextSiblingElement(elem); + + if (elem == 0) { + + reportSchemaError(icElem, XMLUni::fgXMLErrDomain, XMLErrs::IC_BadContent); + return false; + } + + while (elem != 0) { + + if (!XMLString::equals(elem->getLocalName(), SchemaSymbols::fgELT_FIELD)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::IC_BadContent); + } + else { + // General Attribute Checking + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_Field, this, false, fNonXSAttList + ); + if (checkContent(icElem, XUtil::getFirstChildElement(elem), true) != 0) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::OnlyAnnotationExpected); + if (fScanner->getGenerateSyntheticAnnotations() && !fAnnotation && fNonXSAttList->size()) + { + fAnnotation = generateSyntheticAnnotation(elem, fNonXSAttList); + } + if (fAnnotation) + { + if (janAnnot.isDataNull()) + janAnnot.reset(fAnnotation); + else + janAnnot.get()->setNext(fAnnotation); + } + + // xpath expression parsing + xpathExpr = getElementAttValue(elem, SchemaSymbols::fgATT_XPATH); + + if (!xpathExpr || !*xpathExpr) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::IC_XPathExprMissing); + return false; + } + + try { + + XercesXPath* fieldXPath = new (fGrammarPoolMemoryManager) XercesXPath + ( + xpathExpr + , fStringPool + , fSchemaInfo->getNamespaceScope() + , fEmptyNamespaceURI + , false + , fGrammarPoolMemoryManager + ); + IC_Field* icField = new (fGrammarPoolMemoryManager) IC_Field(fieldXPath, ic); + ic->addField(icField); + } + catch (const XPathException& e) { + + reportSchemaError(elem, e); + return false; + } + } + + elem = XUtil::getNextSiblingElement(elem); + } + + if (!janAnnot.isDataNull()) + fSchemaGrammar->putAnnotation(ic, janAnnot.release()); + + if (ic->getFieldCount() == 0) { + return false; + } + + return true; +} + +// --------------------------------------------------------------------------- +// TraverseSchema: Helper methods +// --------------------------------------------------------------------------- +bool TraverseSchema::retrieveNamespaceMapping(const DOMElement* const elem) { + + DOMNamedNodeMap* eltAttrs = elem->getAttributes(); + bool seenNS=false; + const XMLSize_t attrCount = eltAttrs->getLength(); + + for (XMLSize_t i = 0; i < attrCount; i++) { + + DOMNode* attribute = eltAttrs->item(i); + + if (!attribute) { + break; + } + + const XMLCh* attName = attribute->getNodeName(); + + // starts with 'xmlns:' + if (XMLString::startsWith(attName, XMLUni::fgXMLNSColonString)) { + if(!seenNS) + fSchemaInfo->getNamespaceScope()->increaseDepth(); + seenNS=true; + + int offsetIndex = XMLString::indexOf(attName, chColon); + const XMLCh* attValue = attribute->getNodeValue(); + + fSchemaInfo->getNamespaceScope()->addPrefix(attName + offsetIndex + 1, fURIStringPool->addOrFind(attValue)); + } + else if (XMLString::equals(attName, XMLUni::fgXMLNSString)) { // == 'xmlns' + if(!seenNS) + fSchemaInfo->getNamespaceScope()->increaseDepth(); + seenNS=true; + + const XMLCh* attValue = attribute->getNodeValue(); + fSchemaInfo->getNamespaceScope()->addPrefix(XMLUni::fgZeroLenString, fURIStringPool->addOrFind(attValue)); + } + } // end for + return seenNS; +} + +void TraverseSchema::processChildren(const DOMElement* const root) { + + NamespaceScopeManager nsMgr(root, fSchemaInfo, this); + + bool sawAnnotation = false; + // process , and info items. + DOMElement* child = XUtil::getFirstChildElement(root); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + + if (XMLString::equals(name, SchemaSymbols::fgELT_ANNOTATION)) { + XSAnnotation* annot = traverseAnnotationDecl( + child, fSchemaInfo->getNonXSAttList(), true); + if (annot) { + fSchemaGrammar->addAnnotation(annot); + sawAnnotation = true; + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_INCLUDE)) { + traverseInclude(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_IMPORT)) { + traverseImport(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_REDEFINE)) { + traverseRedefine(child); + } + else + break; + } + + // child refers to the first info item which is not or + // one of the schema inclusion/importation declarations. + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + const XMLCh* typeName = getElementAttValue(child, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + int fullNameId = 0; + + if (typeName) { + + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(typeName); + fullNameId = fStringPool->addOrFind(fBuffer.getRawBuffer()); + } + + if (XMLString::equals(name, SchemaSymbols::fgELT_ANNOTATION)) { + XSAnnotation* annot = traverseAnnotationDecl( + child, fSchemaInfo->getNonXSAttList(), true); + if (annot) { + fSchemaGrammar->addAnnotation(annot); + sawAnnotation = true; + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_SIMPLETYPE)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_SIMPLETYPE]->containsElement(fullNameId) + || fGlobalDeclarations[ENUM_ELT_COMPLEXTYPE]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateGlobalType, + SchemaSymbols::fgELT_SIMPLETYPE, typeName, SchemaSymbols::fgELT_COMPLEXTYPE); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_SIMPLETYPE]->addElement(fullNameId); + } + } + + traverseSimpleTypeDecl(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_COMPLEXTYPE)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_SIMPLETYPE]->containsElement(fullNameId) + || fGlobalDeclarations[ENUM_ELT_COMPLEXTYPE]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateGlobalType, + SchemaSymbols::fgELT_COMPLEXTYPE, typeName, SchemaSymbols::fgELT_SIMPLETYPE); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_COMPLEXTYPE]->addElement(fullNameId); + } + } + + traverseComplexTypeDecl(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_ELEMENT)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_ELEMENT]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateGlobalDeclaration, + SchemaSymbols::fgELT_ELEMENT, typeName); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_ELEMENT]->addElement(fullNameId); + } + } + + traverseElementDecl(child, true); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_ATTRIBUTEGROUP)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_ATTRIBUTEGROUP]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateGlobalDeclaration, + SchemaSymbols::fgELT_ATTRIBUTEGROUP, typeName); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_ATTRIBUTEGROUP]->addElement(fullNameId); + } + } + + if (!typeName || !fAttGroupRegistry->containsKey(typeName)) { + traverseAttributeGroupDecl(child, 0, true); + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_ATTRIBUTE)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_ATTRIBUTE]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttribute, typeName); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_ATTRIBUTE]->addElement(fullNameId); + } + } + + if (!typeName || !fAttributeDeclRegistry->containsKey(typeName)) { + traverseAttributeDecl( child, 0, true); + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_GROUP)) { + + if (typeName && *typeName) { + if (fGlobalDeclarations[ENUM_ELT_GROUP]->containsElement(fullNameId)) { + + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateGlobalDeclaration, + SchemaSymbols::fgELT_GROUP, typeName); + continue; + } + else { + fGlobalDeclarations[ENUM_ELT_GROUP]->addElement(fullNameId); + } + } + + if (!typeName || !fGroupRegistry->containsKey(fBuffer.getRawBuffer())) { + traverseGroupDecl(child); + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_NOTATION)) { + traverseNotationDecl(child); + } + else { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::SchemaElementContentError); + } + } // for each child node + + + if (fScanner->getGenerateSyntheticAnnotations() && fSchemaInfo->getNonXSAttList()->size() && !sawAnnotation) + { + // synthesize a global annotation here. + fSchemaGrammar->addAnnotation( + generateSyntheticAnnotation(root, fSchemaInfo->getNonXSAttList()) + ); + } + + // Handle recursing elements - if any + ValueVectorOf* recursingAnonTypes = fSchemaInfo->getRecursingAnonTypes(); + + if (recursingAnonTypes) { + + ValueVectorOf* recursingTypeNames = fSchemaInfo->getRecursingTypeNames(); + XMLSize_t recurseSize = recursingAnonTypes->size(); + + for (XMLSize_t i=0; i < recurseSize; i++) { + traverseComplexTypeDecl(recursingAnonTypes->elementAt(i), false, + recursingTypeNames->elementAt(i)); + } + + recursingAnonTypes->removeAllElements(); + recursingTypeNames->removeAllElements(); + } +} + +void TraverseSchema::preprocessChildren(const DOMElement* const root) { + + NamespaceScopeManager nsMgr(root, fSchemaInfo, this); + + // process , and info items. + DOMElement* child = XUtil::getFirstChildElement(root); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + + if (XMLString::equals(name, SchemaSymbols::fgELT_ANNOTATION)) { + continue; + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_INCLUDE)) { + preprocessInclude(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_IMPORT)) { + preprocessImport(child); + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_REDEFINE)) { + preprocessRedefine(child); + } + else + break; + } +} + +DOMElement* TraverseSchema::checkContent( const DOMElement* const rootElem + , DOMElement* const contentElem + , const bool isEmpty + , const bool processAnnot) +{ + DOMElement* content = contentElem; + const XMLCh* name = getElementAttValue(rootElem,SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + fAnnotation = 0; + Janitor janAnnot(0); + if (!content) { + + if (!isEmpty) { + reportSchemaError(rootElem, XMLUni::fgXMLErrDomain, XMLErrs::ContentError, name); + } + + return 0; + } + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_ANNOTATION)) { + + if (processAnnot) { + janAnnot.reset(traverseAnnotationDecl(content, fNonXSAttList)); + } + content = XUtil::getNextSiblingElement(content); + + if (!content) { // must be followed by content + + if (!isEmpty) { + reportSchemaError(contentElem, XMLUni::fgXMLErrDomain, XMLErrs::ContentError, name); + } + fAnnotation = janAnnot.release(); + return 0; + } + + if (XMLString::equals(content->getLocalName(), SchemaSymbols::fgELT_ANNOTATION)) { + + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::AnnotationError, name); + return 0; + } + fAnnotation = janAnnot.release(); + } + return content; +} + + +DatatypeValidator* +TraverseSchema::getDatatypeValidator(const XMLCh* const uriStr, + const XMLCh* const localPartStr) { + + DatatypeValidator* dv = 0; + + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + dv = fDatatypeRegistry->getDatatypeValidator(localPartStr); + } + else { + + fBuffer.set(uriStr); + fBuffer.append(chComma); + fBuffer.append(localPartStr); + + if ((uriStr) && !XMLString::equals(uriStr, fTargetNSURIString)) { + + Grammar* grammar = fGrammarResolver->getGrammar(uriStr); + + if (grammar && grammar->getGrammarType() == Grammar::SchemaGrammarType) { + dv = ((SchemaGrammar*) grammar)->getDatatypeRegistry()->getDatatypeValidator(fBuffer.getRawBuffer()); + } + } + else { + dv = fDatatypeRegistry->getDatatypeValidator(fBuffer.getRawBuffer()); + } + } + + return dv; +} + + +DatatypeValidator* +TraverseSchema::checkForSimpleTypeValidator(const DOMElement* const content, + int baseRefContext) { + + DatatypeValidator* baseValidator = traverseSimpleTypeDecl(content, false, baseRefContext); + + if (!baseValidator) { + + const XMLCh* name = getElementAttValue(content,SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::UnknownSimpleType, name); + } + + return baseValidator; +} + +ComplexTypeInfo* +TraverseSchema::checkForComplexTypeInfo(const DOMElement* const content) { + + int typeNameIndex = traverseComplexTypeDecl(content, false); + ComplexTypeInfo* baseTypeInfo = 0; + + if (typeNameIndex != -1) { + baseTypeInfo = fComplexTypeRegistry->get(fStringPool->getValueForId(typeNameIndex)); + } + + if (typeNameIndex == -1 || baseTypeInfo == 0) { + + const XMLCh* name = getElementAttValue(content,SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + reportSchemaError(content, XMLUni::fgXMLErrDomain, XMLErrs::UnknownComplexType, name); + } + + return baseTypeInfo; +} + +DatatypeValidator* +TraverseSchema::findDTValidator(const DOMElement* const elem, + const XMLCh* const derivedTypeName, + const XMLCh* const baseTypeName, + const int baseRefContext) { + + const XMLCh* prefix = getPrefix(baseTypeName); + const XMLCh* localPart = getLocalPart(baseTypeName); + const XMLCh* uri = resolvePrefixToURI(elem, prefix); + DatatypeValidator* baseValidator = getDatatypeValidator(uri, localPart); + + if (baseValidator == 0) { + + // Check if the base is from the schema for schema namespace + // + if (XMLString::equals(uri, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, uri, localPart); + return 0; + } + + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + SchemaInfo* saveInfo = fSchemaInfo; + unsigned int saveScope = fCurrentScope; + + if (!XMLString::equals(uri, fTargetNSURIString) && (uri && *uri)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uri); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uri); + return 0; + } + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + + if (!impInfo || impInfo->getProcessed()) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, uri, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + + DOMElement* baseTypeNode = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_SimpleType, + SchemaSymbols::fgELT_SIMPLETYPE, localPart, &fSchemaInfo); + + if (baseTypeNode != 0) { + + baseValidator = traverseSimpleTypeDecl(baseTypeNode); + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + } + } + + if (baseValidator == 0) { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::UnknownBaseDatatype, baseTypeName, derivedTypeName); + } + else if ((baseValidator->getFinalSet() & baseRefContext) != 0) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisallowedBaseDerivation, baseTypeName); + return 0; + } + + return baseValidator; +} + + +const XMLCh* TraverseSchema::resolvePrefixToURI(const DOMElement* const elem, + const XMLCh* const prefix) { + + unsigned int nameSpaceIndex = fSchemaInfo->getNamespaceScope()->getNamespaceForPrefix(prefix); + const XMLCh* uriStr = fURIStringPool->getValueForId(nameSpaceIndex); + + if ((!uriStr || !*uriStr) && (prefix && *prefix)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::UnresolvedPrefix, prefix); + return XMLUni::fgZeroLenString; + } + + return uriStr; +} + +SchemaElementDecl* +TraverseSchema::processElementDeclRef(const DOMElement* const elem, + const XMLCh* const refName) +{ + // check attributes + fAttributeCheck.checkAttributes( + elem, GeneralAttributeCheck::E_ElementRef, this, false, fNonXSAttList + ); + + // handle annotation + DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); + Janitor janAnnot(fAnnotation); + + // do not generate synthetic annotation for element reference... + + if (content != 0) + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::NoContentForRef, SchemaSymbols::fgELT_ELEMENT); + + SchemaElementDecl* refElemDecl = getGlobalElemDecl(elem, refName); + + if (!refElemDecl) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::RefElementNotFound, refName); + } + else + { + if (fCurrentComplexType) + fCurrentComplexType->addElement(refElemDecl); + + if (fCurrentGroupInfo) + fCurrentGroupInfo->addElement(refElemDecl); + } + + return refElemDecl; +} + +int TraverseSchema::parseBlockSet(const DOMElement* const elem, + const int blockType, const bool isRoot) { + + const XMLCh* blockVal = (isRoot) ? getElementAttValue(elem, SchemaSymbols::fgATT_BLOCKDEFAULT) + : getElementAttValue(elem, SchemaSymbols::fgATT_BLOCK); + + // blockVal == 0 means 'block attribute is missing'; *blockVal == 0 means 'block="" found' + if (blockVal == 0) + return fSchemaInfo->getBlockDefault(); + + int blockSet = 0; + + if (XMLString::equals(blockVal, SchemaSymbols::fgATTVAL_POUNDALL)) { + + blockSet = SchemaSymbols::XSD_EXTENSION + SchemaSymbols::XSD_RESTRICTION + SchemaSymbols::XSD_SUBSTITUTION; + return blockSet; + } + + XMLStringTokenizer tokenizer(blockVal, fGrammarPoolMemoryManager); + + while (tokenizer.hasMoreTokens()) { + + XMLCh* token = tokenizer.nextToken(); + + if (XMLString::equals(token, SchemaSymbols::fgATTVAL_SUBSTITUTION) + && blockType == ES_Block) { + + if ((blockSet & SchemaSymbols::XSD_SUBSTITUTION) == 0 ) { + blockSet += SchemaSymbols::XSD_SUBSTITUTION; + } + } + else if (XMLString::equals(token, SchemaSymbols::fgATTVAL_EXTENSION)) { + + if ((blockSet & SchemaSymbols::XSD_EXTENSION) == 0) { + blockSet += SchemaSymbols::XSD_EXTENSION; + } + } + else if (XMLString::equals(token, SchemaSymbols::fgATTVAL_RESTRICTION)) { + + if ((blockSet & SchemaSymbols::XSD_RESTRICTION) == 0 ) { + blockSet += SchemaSymbols::XSD_RESTRICTION; + } + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidBlockValue, blockVal); + } + } //end while + + return blockSet; +} + +int TraverseSchema::parseFinalSet(const DOMElement* const elem, + const int finalType, const bool isRoot) { + + const XMLCh* finalVal = (isRoot) ? getElementAttValue(elem, SchemaSymbols::fgATT_FINALDEFAULT) + : getElementAttValue(elem, SchemaSymbols::fgATT_FINAL); + + // finalVal == 0 means 'final attribute is missing'; *finalVal == 0 means 'final="" found' + if (finalVal == 0) + return fSchemaInfo->getFinalDefault(); + + int finalSet = 0; + + if (XMLString::equals(finalVal, SchemaSymbols::fgATTVAL_POUNDALL)) { + + finalSet = SchemaSymbols::XSD_RESTRICTION + SchemaSymbols::XSD_LIST + + SchemaSymbols::XSD_UNION + SchemaSymbols::XSD_EXTENSION; + return finalSet; + } + + XMLStringTokenizer tokenizer(finalVal, fGrammarPoolMemoryManager); + + while (tokenizer.hasMoreTokens()) { + + XMLCh* token = tokenizer.nextToken(); + + if (XMLString::equals(token, SchemaSymbols::fgELT_UNION) + && (finalType == S_Final || finalType == ECS_Final)) { + + if ((finalSet & SchemaSymbols::XSD_UNION) == 0) { + finalSet += SchemaSymbols::XSD_UNION; + } + } + else if (XMLString::equals(token, SchemaSymbols::fgATTVAL_EXTENSION) + && (finalType == EC_Final || finalType == ECS_Final)) { + + if ((finalSet & SchemaSymbols::XSD_EXTENSION) == 0) { + finalSet += SchemaSymbols::XSD_EXTENSION; + } + } + else if (XMLString::equals(token, SchemaSymbols::fgELT_LIST) + && (finalType == S_Final || finalType == ECS_Final)) { + + if ((finalSet & SchemaSymbols::XSD_LIST) == 0 ) { + finalSet += SchemaSymbols::XSD_LIST; + } + } + else if (XMLString::equals(token, SchemaSymbols::fgATTVAL_RESTRICTION)) { + + if ((finalSet & SchemaSymbols::XSD_RESTRICTION) == 0 ) { + finalSet += SchemaSymbols::XSD_RESTRICTION; + } + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidFinalValue, finalVal); + } + } //end while + + return finalSet; +} + + +const DOMElement* +TraverseSchema::checkIdentityConstraintContent(const DOMElement* const content) { + + const DOMElement* child = content; + + if (child != 0) { + + do { + + if (!isIdentityConstraintName(child->getLocalName())) { + break; + } + + child = XUtil::getNextSiblingElement(child); + + } while (child != 0); + } + + return child; +} + +bool TraverseSchema::isIdentityConstraintName(const XMLCh* const name) { + + return (XMLString::equals(name, SchemaSymbols::fgELT_KEY) + || XMLString::equals(name, SchemaSymbols::fgELT_KEYREF) + || XMLString::equals(name, SchemaSymbols::fgELT_UNIQUE)); +} + +const XMLCh* +TraverseSchema::checkTypeFromAnotherSchema(const DOMElement* const elem, + const XMLCh* const typeStr) { + + const XMLCh* prefix = getPrefix(typeStr); + const XMLCh* typeURI = resolvePrefixToURI(elem, prefix); + + if (!XMLString::equals(typeURI, fTargetNSURIString) + && !XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + ) { + return typeURI; + } + + return 0; +} + +DatatypeValidator* +TraverseSchema::getElementTypeValidator(const DOMElement* const elem, + const XMLCh* const typeStr, + bool& noErrorDetected, + const XMLCh* const otherSchemaURI) +{ + const XMLCh* localPart = getLocalPart(typeStr); + const XMLCh* typeURI = otherSchemaURI; + DatatypeValidator* dv = 0; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + SchemaInfo* saveInfo = fSchemaInfo; + unsigned int saveScope = fCurrentScope; + + if (otherSchemaURI && *otherSchemaURI) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(otherSchemaURI); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, otherSchemaURI); + return 0; + } + + dv = getDatatypeValidator(typeURI, localPart); + + if (dv) { + return dv; + } + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + + if (!impInfo || impInfo->getProcessed()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, typeURI, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + else { + const XMLCh* prefix = getPrefix(typeStr); + + typeURI = resolvePrefixToURI(elem, prefix); + dv = getDatatypeValidator(typeURI, localPart); + } + + if (!dv) { + + if (!XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + || XMLString::equals(fTargetNSURIString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + DOMElement* typeElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_SimpleType, + SchemaSymbols::fgELT_SIMPLETYPE, localPart, &fSchemaInfo); + + if (typeElem) { + traverseSimpleTypeDecl(typeElem); + dv = getDatatypeValidator(typeURI, localPart); + } + } + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + if (!dv) { + + noErrorDetected = false; + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, typeURI, localPart); + } + } + + return dv; +} + + +DatatypeValidator* +TraverseSchema::getAttrDatatypeValidatorNS(const DOMElement* const elem, + const XMLCh* localPart, + const XMLCh* typeURI) +{ + DatatypeValidator* dv = getDatatypeValidator(typeURI, localPart); + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + SchemaInfo* saveInfo = fSchemaInfo; + unsigned int saveScope = fCurrentScope; + + if (!XMLString::equals(typeURI, fTargetNSURIString) + && (typeURI && *typeURI)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(typeURI); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, typeURI); + return 0; + } + + if (!dv) { + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + + if (!impInfo || impInfo->getProcessed()) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, typeURI, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + + if (!dv) { + + DOMElement* typeElem = fSchemaInfo->getTopLevelComponent + ( + SchemaInfo::C_SimpleType + , SchemaSymbols::fgELT_SIMPLETYPE + , localPart + , &fSchemaInfo + ); + + if (typeElem) + dv = traverseSimpleTypeDecl(typeElem); + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + } + + return dv; +} + +ComplexTypeInfo* +TraverseSchema::getElementComplexTypeInfo(const DOMElement* const elem, + const XMLCh* const typeStr, + const XMLCh* const otherSchemaURI) +{ + const XMLCh* localPart = getLocalPart(typeStr); + const XMLCh* prefix = getPrefix(typeStr); + const XMLCh* typeURI = (otherSchemaURI) ? otherSchemaURI : resolvePrefixToURI(elem, prefix); + ComplexTypeInfo* typeInfo = 0; + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + unsigned int saveScope = fCurrentScope; + + fBuffer.set(typeURI); + fBuffer.append(chComma); + fBuffer.append(localPart); + + if (otherSchemaURI != 0) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(typeURI); + + if (!isImportingNS(uriId)) + return 0; + + Grammar* aGrammar = fGrammarResolver->getGrammar(typeURI); + + if (!aGrammar || aGrammar->getGrammarType() != Grammar::SchemaGrammarType) { + return 0; + } + + typeInfo = ((SchemaGrammar*)aGrammar)->getComplexTypeRegistry()->get(fBuffer.getRawBuffer()); + + if (typeInfo) { + return typeInfo; + } + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + + if (!impInfo || impInfo->getProcessed()) { + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + else { + typeInfo = fComplexTypeRegistry->get(fBuffer.getRawBuffer()); + } + + if (!typeInfo) { + if (!XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) || + XMLString::equals(fTargetNSURIString, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + DOMElement* typeNode = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_ComplexType, + SchemaSymbols::fgELT_COMPLEXTYPE, localPart, &fSchemaInfo); + + if (typeNode) { + // fBuffer is reused by traverseComplexTypeDecl, so we have to store its current value + XMLBuffer buffCopy(fBuffer.getLen()+1, fMemoryManager); + buffCopy.set(fBuffer.getRawBuffer()); + traverseComplexTypeDecl(typeNode); + typeInfo = fComplexTypeRegistry->get(buffCopy.getRawBuffer()); + } + } + } + + // restore schema information + restoreSchemaInfo(saveInfo, infoType, saveScope); + return typeInfo; +} + + +SchemaElementDecl* +TraverseSchema::getGlobalElemDecl(const DOMElement* const elem, + const XMLCh* const qName) +{ + const XMLCh* nameURI = resolvePrefixToURI(elem, getPrefix(qName)); + const XMLCh* localPart = getLocalPart(qName); + SchemaElementDecl* elemDecl = 0; + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + unsigned int saveScope = fCurrentScope; + unsigned int uriId = fURIStringPool->addOrFind(nameURI); + + if (fSchemaInfo->getTargetNSURI() != (int) uriId) + { + //if (!XMLString::equals(nameURI, fTargetNSURIString)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + if (!isImportingNS(uriId)) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, nameURI); + return 0; + } + + Grammar* grammar = fGrammarResolver->getGrammar(nameURI); + + if (grammar && grammar->getGrammarType() == Grammar::SchemaGrammarType) + { + elemDecl = (SchemaElementDecl*) grammar->getElemDecl( + uriId, localPart, 0, Grammar::TOP_LEVEL_SCOPE); + } + else + { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, nameURI); + return 0; + } + + if (!elemDecl) + { + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(uriId); + if (!impInfo || impInfo->getProcessed()) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, nameURI, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + else + { + elemDecl = (SchemaElementDecl*) + fSchemaGrammar->getElemDecl(fTargetNSURI, localPart, 0, Grammar::TOP_LEVEL_SCOPE); + } + + if (!elemDecl) + { + DOMElement* subsGroupElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_Element, + SchemaSymbols::fgELT_ELEMENT,localPart, &fSchemaInfo); + + if (subsGroupElem) + elemDecl = traverseElementDecl(subsGroupElem, true); + + if (!elemDecl) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, nameURI, localPart); + } + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + return elemDecl; +} + +bool +TraverseSchema::isSubstitutionGroupValid(const DOMElement* const elem, + const SchemaElementDecl* const subsElemDecl, + const ComplexTypeInfo* const typeInfo, + const DatatypeValidator* const validator, + const XMLCh* const elemName, + const bool toEmit) { + + // here we must do two things: + // 1. Make sure there actually *is* a relation between the types of + // the element being nominated and the element doing the nominating; + // (see PR 3.3.6 point #3 in the first tableau, for instance; this + // and the corresponding tableaux from 3.4.6 and 3.14.6 rule out the nominated + // element having an anonymous type declaration. + // 2. Make sure the nominated element allows itself to be nominated by + // an element with the given type-relation. + // Note: we assume that (complex|simple)Type processing checks + // whether the type in question allows itself to + // be modified as this element desires. + + // if substitution element has any as content model type, return true + bool subsRestricted = false; + if (subsElemDecl->getModelType() == SchemaElementDecl::Any) { + + if ((subsElemDecl->getFinalSet() & SchemaSymbols::XSD_RESTRICTION) == 0 + || (typeInfo == 0 && validator == 0)) + return true; + else + subsRestricted = true; + } + // Check for type relationship; + // that is, make sure that the type we're deriving has some relatoinship + // to substitutionGroupElt's type. + else if (typeInfo) { // do complexType case ...need testing + + ComplexTypeInfo* subsTypeInfo = subsElemDecl->getComplexTypeInfo(); + + if (subsTypeInfo == typeInfo) + return true; + + int derivationMethod = typeInfo->getDerivedBy(); + + if (subsTypeInfo == 0) { // take care of complexType based on simpleType case... + + DatatypeValidator* elemDV = typeInfo->getDatatypeValidator(); + DatatypeValidator* subsValidator = subsElemDecl->getDatatypeValidator(); + + if (elemDV == subsValidator) { + return true; + } + else if (subsValidator && subsValidator->isSubstitutableBy(elemDV)) { + if ((subsElemDecl->getFinalSet() & derivationMethod) == 0) { + return true; + } + else { + subsRestricted = true; + } + } + } + else { // complex content + + const ComplexTypeInfo* elemTypeInfo = typeInfo; + + for (; elemTypeInfo && elemTypeInfo != subsTypeInfo; + elemTypeInfo = elemTypeInfo->getBaseComplexTypeInfo()) { + } + + if (elemTypeInfo) { + if ((subsElemDecl->getFinalSet() & derivationMethod) == 0) { + return true; + } + else { + subsRestricted = true; + } + } + } + } + else if (validator) { // do simpleType case... + + if (!subsElemDecl->getComplexTypeInfo()) { + // first, check for type relation. + DatatypeValidator* subsValidator = subsElemDecl->getDatatypeValidator(); + + if (subsValidator == validator) { + return true; + } + else if (subsValidator && subsValidator->isSubstitutableBy(validator) + && ((subsElemDecl->getFinalSet() & SchemaSymbols::XSD_RESTRICTION) == 0)) { + return true; + } + } + } + else // validator==0 && typeInfo==0 -- no checking + return true; + + if (toEmit) { + if (subsRestricted) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidSubstitutionGroupElement, + elemName, subsElemDecl->getBaseName()); + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::SubstitutionGroupTypeMismatch, elemName); + } + } + + return false; +} + + +SchemaElementDecl* +TraverseSchema::createSchemaElementDecl(const DOMElement* const elem, + const XMLCh* const name, + bool& isDuplicate, + const XMLCh*& valConstraint, + const bool topLevel) +{ + unsigned int enclosingScope = fCurrentScope; + int uriIndex = fEmptyNamespaceURI; + + if (topLevel) { + + uriIndex = fTargetNSURI; + enclosingScope = Grammar::TOP_LEVEL_SCOPE; + } + else + { + const XMLCh* elemForm = getElementAttValue(elem, SchemaSymbols::fgATT_FORM); + + if (((!elemForm || !*elemForm) && + (fSchemaInfo->getElemAttrDefaultQualified() & Elem_Def_Qualified)) + || XMLString::equals(elemForm,SchemaSymbols::fgATTVAL_QUALIFIED)) + uriIndex = fTargetNSURI; + + // Check for duplicate elements + SchemaElementDecl* other = (SchemaElementDecl*) + fSchemaGrammar->getElemDecl(uriIndex, name, 0, enclosingScope); + + if (other != 0) + { + isDuplicate = true; + return other; + } + } + + // create element decl and add it to the grammar + Janitor elemDecl(new (fGrammarPoolMemoryManager) SchemaElementDecl( + XMLUni::fgZeroLenString , name, uriIndex , SchemaElementDecl::Any + , enclosingScope , fGrammarPoolMemoryManager + )); + + elemDecl->setCreateReason(XMLElementDecl::Declared); + + if (topLevel) + elemDecl->setPSVIScope(PSVIDefs::SCP_GLOBAL); + + // process attributes + processElemDeclAttrs(elem, elemDecl.get(), valConstraint, topLevel); + + return elemDecl.release(); +} + + +void TraverseSchema::processAttributeDeclRef(const DOMElement* const elem, + ComplexTypeInfo* const typeInfo, + const XMLCh* const refName, + const XMLCh* const useAttr, + const XMLCh* const defaultVal, + const XMLCh* const fixedVal) { + + if (!typeInfo && !fCurrentAttGroupInfo) { + return; + } + + const XMLCh* prefix = getPrefix(refName); + const XMLCh* localPart = getLocalPart(refName); + const XMLCh* uriStr = resolvePrefixToURI(elem, prefix); + unsigned int attURI = fURIStringPool->addOrFind(uriStr); + + // Check for duplicate references + if (typeInfo && typeInfo->getAttDef(localPart, attURI)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateRefAttribute, uriStr, localPart); + return; + } + else if (fCurrentAttGroupInfo && fCurrentAttGroupInfo->containsAttribute(localPart, attURI)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateRefAttribute, uriStr, localPart); + return; + } + + // check for different namespace + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + SchemaAttDef* refAttDef = 0; + unsigned int saveScope = fCurrentScope; + + if (!XMLString::equals(uriStr, fTargetNSURIString)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uriStr); + return; + } + + Grammar* grammar = fGrammarResolver->getGrammar(uriStr); + + if (grammar == 0 || grammar->getGrammarType() != Grammar::SchemaGrammarType) { + + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, uriStr); + return; + } + + refAttDef = (SchemaAttDef*) ((SchemaGrammar*) grammar)->getAttributeDeclRegistry()->get(localPart); + + if (!refAttDef) { + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(attURI); + + if (!impInfo || impInfo->getProcessed()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TopLevelAttributeNotFound, refName); + return; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + + // if Global attribute registry does not contain the ref attribute, get + // the referred attribute declaration and traverse it. + if (!refAttDef) { + + if (fAttributeDeclRegistry->containsKey(localPart) == false) { + + DOMElement* referredAttribute = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_Attribute, + SchemaSymbols::fgELT_ATTRIBUTE, localPart, &fSchemaInfo); + + if (referredAttribute != 0) { + traverseAttributeDecl(referredAttribute, 0, true); + } + } + + refAttDef = (SchemaAttDef*) fAttributeDeclRegistry->get(localPart); + } + + // restore schema information, if necessary + if (fSchemaInfo != saveInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + if (!refAttDef) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TopLevelAttributeNotFound, refName); + return; + } + + XMLAttDef::DefAttTypes refAttDefType = refAttDef->getDefaultType(); + const XMLCh* refAttValue = refAttDef->getValue(); + bool invalidAttUse = false; + + if (refAttDefType == XMLAttDef::Fixed && + (defaultVal || (fixedVal && !XMLString::equals(fixedVal, refAttValue)))) { + + invalidAttUse = true; + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttUseCorrect, refName); + } + + DatatypeValidator* attDV = refAttDef->getDatatypeValidator(); + + //check for multiple attributes with type derived from ID + if (attDV && attDV->getType() == DatatypeValidator::ID) { + + if (fCurrentAttGroupInfo) { + + if (fCurrentAttGroupInfo->containsTypeWithId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttGrpPropCorrect3, refName); + return; + } + + fCurrentAttGroupInfo->setTypeWithId(true); + } + else { + + if (typeInfo->containsAttWithTypeId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttDeclPropCorrect5, refName); + return; + } + + typeInfo->setAttWithTypeId(true); + } + } + + bool required = XMLString::equals(useAttr,SchemaSymbols::fgATTVAL_REQUIRED); + bool prohibited = XMLString::equals(useAttr,SchemaSymbols::fgATTVAL_PROHIBITED); + QName* attQName = refAttDef->getAttName(); + SchemaAttDef* attDef = new (fGrammarPoolMemoryManager) SchemaAttDef(attQName->getPrefix(), + attQName->getLocalPart(), + attQName->getURI(), + refAttValue, + refAttDef->getType(), + refAttDefType, + 0, fGrammarPoolMemoryManager); + + attDef->setBaseAttDecl(refAttDef); + attDef->setPSVIScope(PSVIDefs::SCP_GLOBAL); + + if (refAttDefType == XMLAttDef::Fixed) { + if (required && !invalidAttUse) { + attDef->setDefaultType(XMLAttDef::Required_And_Fixed); + } + } + else { + + if (prohibited) { + attDef->setDefaultType(XMLAttDef::Prohibited); + } + else { + + const XMLCh* valueConstraint = defaultVal; + + if (required){ + + if (fixedVal) { + + attDef->setDefaultType(XMLAttDef::Required_And_Fixed); + valueConstraint = fixedVal; + } + else { + attDef->setDefaultType(XMLAttDef::Required); + } + } + else + { + if (fixedVal) { + attDef->setDefaultType(XMLAttDef::Fixed); + valueConstraint = fixedVal; + } + else if (defaultVal) { + attDef->setDefaultType(XMLAttDef::Default); + } + } + + if (valueConstraint) { + + // validate content of value constraint + if (attDV) { + + if (attDV->getType() == DatatypeValidator::ID) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttDeclPropCorrect3, refName); + } + else { + try { + attDV->validate(valueConstraint + , fSchemaInfo->getValidationContext() + , fMemoryManager); + } + catch(const XMLException& excep) { + reportSchemaError(elem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch (...) { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DatatypeValidationFailure, valueConstraint); + } + } + } + + attDef->setValue(valueConstraint); + } + } + } + + attDef->setDatatypeValidator(attDV); + + bool toClone = false; + + if (typeInfo) { + + toClone = true; + typeInfo->addAttDef(attDef); + } + + if (fCurrentAttGroupInfo) { + fCurrentAttGroupInfo->addAttDef(attDef, toClone); + } +} + + +int TraverseSchema::checkMinMax(ContentSpecNode* const specNode, + const DOMElement* const elem, + const int allContextFlag) { + + int minOccurs = 1; + int maxOccurs = 1; + const XMLCh* minOccursStr = getElementAttValue(elem, SchemaSymbols::fgATT_MINOCCURS, DatatypeValidator::Decimal); + const XMLCh* maxOccursStr = getElementAttValue(elem, SchemaSymbols::fgATT_MAXOCCURS, DatatypeValidator::Decimal); + + if (!minOccursStr || !*minOccursStr) { + if (specNode) + minOccurs = specNode->getMinOccurs(); + } + else { + try { + minOccurs = XMLString::parseInt(minOccursStr, fMemoryManager); + } + catch(const NumberFormatException& e) + { + // REVISIT: report a warning that we replaced a number too big? + if(e.getCode()==XMLExcepts::Str_ConvertOverflow) + minOccurs = 500; + else + minOccurs = 1; + } + catch(const OutOfMemoryException&) + { + throw; + } + + if (specNode) + specNode->setMinOccurs(minOccurs); + } + + bool isMaxUnbounded = XMLString::equals(maxOccursStr, fgUnbounded); + + if (isMaxUnbounded) { + maxOccurs = SchemaSymbols::XSD_UNBOUNDED; + if (specNode) + specNode->setMaxOccurs(maxOccurs); + } + else { + if (!maxOccursStr || !*maxOccursStr) { + if (specNode) + maxOccurs = specNode->getMaxOccurs(); + } + else { + try { + maxOccurs = XMLString::parseInt(maxOccursStr, fMemoryManager); + } + catch(const NumberFormatException& e) + { + // REVISIT: report a warning that we replaced a number too big? + if(e.getCode()==XMLExcepts::Str_ConvertOverflow && minOccurs < 500) + maxOccurs = 500; + else + maxOccurs = minOccurs; + } + catch(const OutOfMemoryException&) + { + throw; + } + + if (specNode) + specNode->setMaxOccurs(maxOccurs); + } + } + + if (minOccurs == 0 && maxOccurs == 0){ + return minOccurs; + } + + // Constraint checking for min/max value + if (!isMaxUnbounded) { + + XMLCh tmpMinStr[128]; + XMLCh tmpMaxStr[128]; + + XMLString::binToText(minOccurs, tmpMinStr, 127, 10, fMemoryManager); + XMLString::binToText(maxOccurs, tmpMaxStr, 127, 10, fMemoryManager); + + if (maxOccurs < 1) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidAttValue, + tmpMaxStr, SchemaSymbols::fgATT_MAXOCCURS); + if (specNode) + specNode->setMaxOccurs(minOccurs); + } + else if (maxOccurs < minOccurs) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidMin2MaxOccurs, + tmpMinStr, tmpMaxStr); + if (specNode) + specNode->setMaxOccurs(minOccurs); + } + } + + // Constraint checking for 'all' content + bool isAllElement = (allContextFlag == All_Element); + bool isAllGroup = (allContextFlag == All_Group); + bool isGroupRefAll = (allContextFlag == Group_Ref_With_All); + + if (isAllElement || isAllGroup || isGroupRefAll) { + + if (maxOccurs != 1 || minOccurs > 1) { + + // set back correct value in order to carry on + if (specNode) { + + specNode->setMaxOccurs(1); + + if (minOccurs > 1) + specNode->setMinOccurs(1); + } + + if (isAllElement) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadMinMaxAllElem); + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadMinMaxAllCT); + } + } + } + return minOccurs; +} + + +void TraverseSchema::processComplexContent(const DOMElement* const ctElem, + const XMLCh* const typeName, + const DOMElement* const childElem, + ComplexTypeInfo* const typeInfo, + const XMLCh* const baseLocalPart, + const bool isMixed, + const bool isBaseAnyType) { + + NamespaceScopeManager nsMgr(childElem, fSchemaInfo, this); + + Janitor specNodeJan(0); + ContentSpecNode* specNode = specNodeJan.get(); + const DOMElement* attrNode = 0; + int typeDerivedBy = typeInfo->getDerivedBy(); + ComplexTypeInfo* baseTypeInfo = typeInfo->getBaseComplexTypeInfo(); + int baseContentType = (baseTypeInfo) ? baseTypeInfo->getContentType() : SchemaElementDecl::Empty; + + if (baseTypeInfo) { + + if (typeDerivedBy == SchemaSymbols::XSD_RESTRICTION) { + + // check to see if the baseType permits derivation by restriction + if((baseTypeInfo->getFinalSet() & typeDerivedBy) != 0) { + + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::ForbiddenDerivationByRestriction, + baseLocalPart); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + else { + + // check to see if the baseType permits derivation by extension + if((baseTypeInfo->getFinalSet() & typeDerivedBy) != 0) { + + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::ForbiddenDerivationByExtension, baseLocalPart); + throw TraverseSchema::InvalidComplexTypeInfo; // REVISIT - should we continue + } + + processElements(ctElem, baseTypeInfo, typeInfo); + } + } + + bool effectiveContent_hasChild = false; + + if (childElem != 0) { + + fCircularCheckIndex = fCurrentTypeNameStack->size(); + + // -------------------------------------------------------------------- + // GROUP, ALL, SEQUENCE or CHOICE, followed by attributes, if specified. + // Note that it's possible that only attributes are specified. + // -------------------------------------------------------------------- + const XMLCh* childName = childElem->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_GROUP)) { + + XercesGroupInfo* grpInfo = traverseGroupDecl(childElem, false); + + if (grpInfo) { + + ContentSpecNode* const groupSpecNode = grpInfo->getContentSpec(); + + if (groupSpecNode) { + + int contentContext = groupSpecNode->hasAllContent() ? Group_Ref_With_All : Not_All_Context; + specNodeJan.reset(new (fGrammarPoolMemoryManager) ContentSpecNode(*groupSpecNode)); + specNode = specNodeJan.get(); + checkMinMax(specNode, childElem, contentContext); + } + } + + attrNode = XUtil::getNextSiblingElement(childElem); + + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_SEQUENCE)) { + + specNodeJan.reset(traverseChoiceSequence(childElem, ContentSpecNode::Sequence, effectiveContent_hasChild)); + specNode = specNodeJan.get(); + checkMinMax(specNode, childElem); + attrNode = XUtil::getNextSiblingElement(childElem); + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_CHOICE)) { + + specNodeJan.reset(traverseChoiceSequence(childElem, ContentSpecNode::Choice, effectiveContent_hasChild)); + specNode = specNodeJan.get(); + int minOccurs = checkMinMax(specNode, childElem); + if (!effectiveContent_hasChild && minOccurs != 0) { + effectiveContent_hasChild = true; + } + + attrNode = XUtil::getNextSiblingElement(childElem); + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_ALL)) { + + specNodeJan.reset(traverseAll(childElem, effectiveContent_hasChild)); + specNode = specNodeJan.get(); + checkMinMax(specNode, childElem, All_Group); + attrNode = XUtil::getNextSiblingElement(childElem); + } + else if (isAttrOrAttrGroup(childElem)) { + // reset the contentType + typeInfo->setContentType(SchemaElementDecl::Any); + attrNode = childElem; + } + else { + reportSchemaError(childElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildInComplexType, childName); + } + } + + typeInfo->setContentSpec(specNode); + typeInfo->setAdoptContentSpec(true); + specNodeJan.release(); + bool specNodeWasNull = false; + + // ----------------------------------------------------------------------- + // Merge in information from base, if it exists + // ----------------------------------------------------------------------- + if (baseTypeInfo) { + + ContentSpecNode* baseSpecNode = baseTypeInfo->getContentSpec(); + + if (typeDerivedBy == SchemaSymbols::XSD_RESTRICTION) { + + //check derivation valid - content type is empty (5.2) + if (!typeInfo->getContentSpec()) { + + if (baseContentType != SchemaElementDecl::Empty + && !emptiableParticle(baseSpecNode)) { + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::EmptyComplexRestrictionDerivation); + } + } + + // Delay particle constraint checking (5.3) until we have processed + // the whole schema. + } + else { + + // Compose the final content model by concatenating the base and + // the current in sequence + if (!specNode) { + specNodeWasNull = true; + if (isMixed) { + if (baseSpecNode && baseSpecNode->hasAllContent()) { + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::NotAllContent); + throw TraverseSchema::InvalidComplexTypeInfo; // REVISIT - should we continue + } + } + if (baseSpecNode) { + specNodeJan.reset(new (fGrammarPoolMemoryManager) ContentSpecNode(*baseSpecNode)); + specNode = specNodeJan.get(); + typeInfo->setContentSpec(specNode); + typeInfo->setAdoptContentSpec(true); + specNodeJan.release(); + } + } + else if (baseSpecNode) { + + if (specNode->hasAllContent() || baseSpecNode->hasAllContent()) { + + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::NotAllContent); + throw TraverseSchema::InvalidComplexTypeInfo; // REVISIT - should we continue + } + + // Check for derivation valid (extension) - 1.4.3.2.2.1 + if ((isMixed && baseContentType == SchemaElementDecl::Children) + || (!isMixed && baseContentType != SchemaElementDecl::Children)) { + + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::MixedOrElementOnly, baseLocalPart, typeName); + throw TraverseSchema::InvalidComplexTypeInfo; //REVISIT - should we continue + } + + typeInfo->setAdoptContentSpec(false); + typeInfo->setContentSpec + ( + new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::ModelGroupSequence + , new (fGrammarPoolMemoryManager) ContentSpecNode(*baseSpecNode) + , specNode + , true + , true + , fGrammarPoolMemoryManager + ) + ); + typeInfo->setAdoptContentSpec(true); + } + } + } + else { + typeInfo->setDerivedBy(0); + } + + // ------------------------------------------------------------- + // Set the content type + // ------------------------------------------------------------- + if (isBaseAnyType && typeDerivedBy == SchemaSymbols::XSD_EXTENSION) { + + ContentSpecNode* anySpecNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , fEmptyNamespaceURI, fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + ); + + anySpecNode->setType(ContentSpecNode::Any_Lax); + anySpecNode->setMinOccurs(0); + anySpecNode->setMaxOccurs(SchemaSymbols::XSD_UNBOUNDED); + + if (!specNode) { + typeInfo->setContentSpec(anySpecNode); + typeInfo->setDerivedBy(typeDerivedBy); + } + else { + + typeInfo->setAdoptContentSpec(false); + typeInfo->setContentSpec + ( + new (fGrammarPoolMemoryManager) ContentSpecNode + ( + ContentSpecNode::ModelGroupSequence + , anySpecNode + , specNode + , true + , true + , fGrammarPoolMemoryManager + ) + ); + typeInfo->setAdoptContentSpec(true); + + if (!isMixed) { + + reportSchemaError(ctElem, XMLUni::fgXMLErrDomain, XMLErrs::MixedOrElementOnly, baseLocalPart, typeName); + throw TraverseSchema::InvalidComplexTypeInfo; //REVISIT - should we continue + } + } + + typeInfo->setContentType(SchemaElementDecl::Mixed_Complex); + } + else if (isMixed) { + + if (specNode != 0) { + typeInfo->setContentType(SchemaElementDecl::Mixed_Complex); + } + else { + // add #PCDATA leaf and set its minOccurs to 0 + ContentSpecNode* pcdataNode = new (fGrammarPoolMemoryManager) ContentSpecNode + ( + new (fGrammarPoolMemoryManager) QName + ( + XMLUni::fgZeroLenString + , XMLUni::fgZeroLenString + , XMLElementDecl::fgPCDataElemId + , fGrammarPoolMemoryManager + ) + , false + , fGrammarPoolMemoryManager + ); + + pcdataNode->setMinOccurs(0); + typeInfo->setContentSpec(pcdataNode); + typeInfo->setAdoptContentSpec(true); + typeInfo->setContentType(SchemaElementDecl::Mixed_Simple); + } + } + else if (specNodeWasNull && + (typeDerivedBy == SchemaSymbols::XSD_EXTENSION) && + baseTypeInfo) { + typeInfo->setBaseDatatypeValidator(baseTypeInfo->getBaseDatatypeValidator()); + typeInfo->setDatatypeValidator(baseTypeInfo->getDatatypeValidator()); + typeInfo->setContentType(baseTypeInfo->getContentType()); + } + else if (typeInfo->getContentSpec() == 0) { + if (!effectiveContent_hasChild) { + typeInfo->setContentType(SchemaElementDecl::Empty); + } + else { + typeInfo->setContentType(SchemaElementDecl::ElementOnlyEmpty); + } + } + else { + typeInfo->setContentType(SchemaElementDecl::Children); + } + + // ------------------------------------------------------------- + // Now, check attributes and handle + // ------------------------------------------------------------- + if (attrNode != 0) { + + if (!isAttrOrAttrGroup(attrNode)) { + reportSchemaError(attrNode, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildInComplexType, + attrNode->getLocalName()); + } + else { + processAttributes(ctElem, attrNode, typeInfo, isBaseAnyType); + } + } + else if (baseTypeInfo != 0 || isBaseAnyType) { + processAttributes(ctElem, 0, typeInfo, isBaseAnyType); + } +} + + +void TraverseSchema::processBaseTypeInfo(const DOMElement* const elem, + const XMLCh* const baseName, + const XMLCh* const localPart, + const XMLCh* const uriStr, + ComplexTypeInfo* const typeInfo) { + + SchemaInfo* saveInfo = fSchemaInfo; + ComplexTypeInfo* baseComplexTypeInfo = 0; + DatatypeValidator* baseDTValidator = 0; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + unsigned int saveScope = fCurrentScope; + + // check if the base type is from another schema + if (!XMLString::equals(uriStr, fTargetNSURIString)) { + + // check for datatype validator if it's schema for schema URI + if (XMLString::equals(uriStr, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + baseDTValidator = getDatatypeValidator(uriStr, localPart); + + if (!baseDTValidator) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BaseTypeNotFound, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + else { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uriStr); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + baseComplexTypeInfo = getTypeInfoFromNS(elem, uriStr, localPart); + + if (!baseComplexTypeInfo) { + + baseDTValidator = getDatatypeValidator(uriStr, localPart); + + if (!baseDTValidator) + { + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(fURIStringPool->addOrFind(uriStr)); + + if (!impInfo || impInfo->getProcessed()) + { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BaseTypeNotFound, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + } + } + else { + + fBuffer.set(uriStr); + fBuffer.append(chComma); + fBuffer.append(localPart); + + // assume the base is a complexType and try to locate the base type first + const XMLCh* fullBaseName = fBuffer.getRawBuffer(); + baseComplexTypeInfo = fComplexTypeRegistry->get(fullBaseName); + + // Circular check + if (baseComplexTypeInfo) { + + if (fCurrentTypeNameStack->containsElement(fStringPool->addOrFind(fullBaseName), fCircularCheckIndex)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoCircularDefinition, fullBaseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + else if (fCurrentTypeNameStack->containsElement(fStringPool->addOrFind(fullBaseName))) { + + typeInfo->setBaseComplexTypeInfo(baseComplexTypeInfo); + throw TraverseSchema::RecursingElement; + } + else if (baseComplexTypeInfo->getPreprocessed()) { + baseComplexTypeInfo = 0; + } + } + } + + // if not found, 2 possibilities: + // 1: ComplexType in question has not been compiled yet; + // 2: base is SimpleType; + if (!baseComplexTypeInfo && !baseDTValidator) { + + baseDTValidator = getDatatypeValidator(uriStr, localPart); + + if (baseDTValidator == 0) { + + DOMElement* baseTypeNode = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_ComplexType, + SchemaSymbols::fgELT_COMPLEXTYPE, localPart, &fSchemaInfo); + + if (baseTypeNode != 0) { + + int baseTypeSymbol = traverseComplexTypeDecl(baseTypeNode); + baseComplexTypeInfo = fComplexTypeRegistry->get(fStringPool->getValueForId(baseTypeSymbol)); + } + else { + + baseTypeNode = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_SimpleType, + SchemaSymbols::fgELT_SIMPLETYPE, localPart, &fSchemaInfo); + + if (baseTypeNode != 0) { + + baseDTValidator = traverseSimpleTypeDecl(baseTypeNode); + + if (baseDTValidator == 0) { + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, uriStr, localPart, uriStr); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + else { + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BaseTypeNotFound, baseName); + throw TraverseSchema::InvalidComplexTypeInfo; + } + } + } + } // end if + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + typeInfo->setBaseComplexTypeInfo(baseComplexTypeInfo); + typeInfo->setBaseDatatypeValidator(baseDTValidator); +} + + +ComplexTypeInfo* TraverseSchema::getTypeInfoFromNS(const DOMElement* const elem, + const XMLCh* const uriStr, + const XMLCh* const localPart) +{ + + Grammar* grammar = fGrammarResolver->getGrammar(uriStr); + + if (grammar != 0 && grammar->getGrammarType() == Grammar::SchemaGrammarType) { + + fBuffer.set(uriStr); + fBuffer.append(chComma); + fBuffer.append(localPart); + + ComplexTypeInfo* typeInfo = + ((SchemaGrammar*)grammar)->getComplexTypeRegistry()->get(fBuffer.getRawBuffer()); + + return typeInfo; + } + else { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, uriStr); + } + + return 0; +} + + +void TraverseSchema::processAttributes(const DOMElement* const elem, + const DOMElement* const attElem, + ComplexTypeInfo* const typeInfo, + const bool isBaseAnyType) { + + // If we do not have a complexTypeInfo, then what is the point of + // processing. + if (typeInfo == 0) { + return; + } + + ComplexTypeInfo* baseTypeInfo = typeInfo->getBaseComplexTypeInfo(); + if (baseTypeInfo && baseTypeInfo->getPreprocessed()) + throw TraverseSchema::RecursingElement; + + const DOMElement* child = attElem; + SchemaAttDef* attWildCard = 0; + Janitor janAttWildCard(0); + XercesAttGroupInfo* attGroupInfo = 0; + ValueVectorOf attGroupList(4, fGrammarPoolMemoryManager); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* childName = child->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_ATTRIBUTE)) { + if(attWildCard) + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::AnyAttributeBeforeAttribute); + + traverseAttributeDecl(child, typeInfo); + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_ATTRIBUTEGROUP)) { + if(attWildCard) + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::AnyAttributeBeforeAttribute); + + attGroupInfo = traverseAttributeGroupDecl(child, typeInfo); + if (attGroupInfo && !attGroupList.containsElement(attGroupInfo)) { + attGroupList.addElement(attGroupInfo); + } + } + else if (XMLString::equals(childName, SchemaSymbols::fgELT_ANYATTRIBUTE) ) { + if(attWildCard) + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAnyAttribute); + + attWildCard = traverseAnyAttribute(child); + janAttWildCard.reset(attWildCard); + } + else { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::InvalidChildInComplexType, childName); + } + } + + // ------------------------------------------------------------- + // Handle wild card/any attribute + // ------------------------------------------------------------- + int derivedBy = typeInfo->getDerivedBy(); + XMLSize_t attGroupListSize = attGroupList.size(); + + if (attGroupListSize) { + + SchemaAttDef* completeWildCard = 0; + Janitor janCompleteWildCard(0); + XMLAttDef::DefAttTypes defAttType = XMLAttDef::Default; + bool defAttTypeSet = false; + + for (XMLSize_t i=0; i < attGroupListSize; i++) { + + attGroupInfo = attGroupList.elementAt(i); + XMLSize_t anyAttCount = attGroupInfo->anyAttributeCount(); + + if (anyAttCount) { + + if (!defAttTypeSet) { + + defAttType = (attWildCard) ? attWildCard->getDefaultType() + : attGroupInfo->anyAttributeAt(0)->getDefaultType(); + defAttTypeSet = true; + } + + SchemaAttDef* attGroupWildCard = attGroupInfo->getCompleteWildCard(); + if (completeWildCard) { + attWildCardIntersection(completeWildCard, attGroupWildCard); + } + else { + completeWildCard = new (fGrammarPoolMemoryManager) SchemaAttDef(attGroupWildCard); + janCompleteWildCard.reset(completeWildCard); + } + } + + } + + if (completeWildCard) { + + if (attWildCard) { + attWildCardIntersection(attWildCard, completeWildCard); + } + else { + + attWildCard = completeWildCard; + janCompleteWildCard.orphan(); + janAttWildCard.reset(attWildCard); + } + + attWildCard->setDefaultType(defAttType); + } + } + + SchemaAttDef* baseAttWildCard = (baseTypeInfo) ? baseTypeInfo->getAttWildCard() : 0; + Janitor janBaseAttWildCard(0); + + if (derivedBy == SchemaSymbols::XSD_EXTENSION) { + + if (isBaseAnyType) { + + baseAttWildCard = new (fGrammarPoolMemoryManager) SchemaAttDef(XMLUni::fgZeroLenString, + XMLUni::fgZeroLenString, + fEmptyNamespaceURI, XMLAttDef::Any_Any, + XMLAttDef::ProcessContents_Lax, + fGrammarPoolMemoryManager); + janBaseAttWildCard.reset(baseAttWildCard); + } + + if (baseAttWildCard && attWildCard) { + + XMLAttDef::DefAttTypes saveDefType = attWildCard->getDefaultType(); + attWildCardUnion(attWildCard, baseAttWildCard); + attWildCard->setDefaultType(saveDefType); + } + } + + // ------------------------------------------------------------- + // insert wildcard attribute + // ------------------------------------------------------------- + if (attWildCard) { + + typeInfo->setAttWildCard(attWildCard); + janAttWildCard.orphan(); + + if (attWildCard->getType() == XMLAttDef::AttTypes_Unknown) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NotExpressibleWildCardIntersection); + } + } + else if (baseAttWildCard && derivedBy == SchemaSymbols::XSD_EXTENSION) { + + if (isBaseAnyType) { + + typeInfo->setAttWildCard(baseAttWildCard); + janBaseAttWildCard.orphan(); + } + else { + + SchemaAttDef* newWildCard = new (fGrammarPoolMemoryManager) SchemaAttDef(baseAttWildCard); + typeInfo->setAttWildCard(newWildCard); + } + } + + // ------------------------------------------------------------- + // Check attributes derivation OK + // ------------------------------------------------------------- + bool baseWithAttributes = (baseTypeInfo && baseTypeInfo->hasAttDefs()); + bool childWithAttributes = (typeInfo->hasAttDefs() || typeInfo->getAttWildCard()); + + if (derivedBy == SchemaSymbols::XSD_RESTRICTION && childWithAttributes) { + + if (!baseWithAttributes && !baseAttWildCard) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_1); + } + else { + checkAttDerivationOK(elem, baseTypeInfo, typeInfo); + } + } + + // ------------------------------------------------------------- + // merge in base type's attribute decls + // ------------------------------------------------------------- + if (baseTypeInfo && baseTypeInfo->hasAttDefs()) { + + SchemaAttDefList& baseAttList = (SchemaAttDefList&) + baseTypeInfo->getAttDefList(); + + for (XMLSize_t i=0; igetLocalPart(); + + // if found a duplicate, then skip the one from the base type + if (typeInfo->getAttDef(localPart, attName->getURI()) != 0) { + + if (derivedBy == SchemaSymbols::XSD_EXTENSION) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttInDerivation, localPart); + } + + continue; + } + + if (attDef.getDefaultType() != XMLAttDef::Prohibited) { + + SchemaAttDef* newAttDef = new (fGrammarPoolMemoryManager) SchemaAttDef(attName->getPrefix(), + attName->getLocalPart(), + attName->getURI(), + attDef.getValue(), + attDef.getType(), + attDef.getDefaultType(), + attDef.getEnumeration(), + fGrammarPoolMemoryManager); + + newAttDef->setDatatypeValidator(attDef.getDatatypeValidator()); + typeInfo->addAttDef(newAttDef); + + if (attDef.getBaseAttDecl()) + newAttDef->setBaseAttDecl(attDef.getBaseAttDecl()); + else + newAttDef->setBaseAttDecl(&attDef); + } + } + } +} + + +void TraverseSchema::defaultComplexTypeInfo(ComplexTypeInfo* const typeInfo) { + + if (typeInfo) { + + typeInfo->setDerivedBy(0); + typeInfo->setContentType(SchemaElementDecl::Any); + typeInfo->setDatatypeValidator(0); + typeInfo->setContentSpec(0); + typeInfo->setBaseComplexTypeInfo(0); + typeInfo->setBaseDatatypeValidator(0); + } +} + + +InputSource* TraverseSchema::resolveSchemaLocation(const XMLCh* const loc, + const XMLResourceIdentifier::ResourceIdentifierType resourceIdentitiferType, + const XMLCh* const nameSpace) { + + // ------------------------------------------------------------------ + // Create an input source + // ------------------------------------------------------------------ + InputSource* srcToFill = 0; + XMLCh* normalizedURI = 0; + if (loc) { + XMLString::removeChar(loc, 0xFFFF, fBuffer); + normalizedURI = fBuffer.getRawBuffer(); + } + + if (fEntityHandler){ + XMLResourceIdentifier resourceIdentifier(resourceIdentitiferType, + normalizedURI, nameSpace, 0, fSchemaInfo->getCurrentSchemaURL(), fLocator); + srcToFill = fEntityHandler->resolveEntity(&resourceIdentifier); + } + + // If they didn't create a source via the entity resolver, then we + // have to create one on our own if we have the schemaLocation (with + // the update resolveEntity accepting nameSpace, a schemImport could + // pass a null schemaLocation) + if (!srcToFill && loc) { + if (fScanner->getDisableDefaultEntityResolution()) + return 0; + + XMLURL urlTmp(fMemoryManager); + if ((!urlTmp.setURL(fSchemaInfo->getCurrentSchemaURL(), normalizedURI, urlTmp)) || + (urlTmp.isRelative())) + { + if (!fScanner->getStandardUriConformant()) + { + XMLCh* tempURI = XMLString::replicate(normalizedURI, fMemoryManager); + ArrayJanitor tempURIName(tempURI, fMemoryManager); + XMLUri::normalizeURI(tempURI, fBuffer); + + srcToFill = new (fMemoryManager) LocalFileInputSource + ( fSchemaInfo->getCurrentSchemaURL() + , fBuffer.getRawBuffer() + , fMemoryManager + ); + } + else + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + } + else + { + if (fScanner->getStandardUriConformant() && urlTmp.hasInvalidChar()) + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager); + srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager); + } + } + + return srcToFill; +} + + +void TraverseSchema::restoreSchemaInfo(SchemaInfo* const toRestore, + SchemaInfo::ListType const aListType, + const unsigned int saveScope) { + + + if (aListType == SchemaInfo::IMPORT) { // restore grammar info + + int targetNSURI = toRestore->getTargetNSURI(); + + fSchemaGrammar->setScopeCount (fScopeCount); + fSchemaGrammar->setAnonTypeCount (fAnonXSTypeCount); + + fSchemaGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(toRestore->getTargetNSURIString()); + fScopeCount = fSchemaGrammar->getScopeCount (); + fAnonXSTypeCount = fSchemaGrammar->getAnonTypeCount (); + + fTargetNSURI = targetNSURI; + fCurrentScope = saveScope; + fDatatypeRegistry = fSchemaGrammar->getDatatypeRegistry(); + fTargetNSURIString = fSchemaGrammar->getTargetNamespace(); + fGroupRegistry = fSchemaGrammar->getGroupInfoRegistry(); + fAttGroupRegistry = fSchemaGrammar->getAttGroupInfoRegistry(); + fAttributeDeclRegistry = fSchemaGrammar->getAttributeDeclRegistry(); + fComplexTypeRegistry = fSchemaGrammar->getComplexTypeRegistry(); + fValidSubstitutionGroups = fSchemaGrammar->getValidSubstitutionGroups(); + + } + + fSchemaInfo = toRestore; +} + + +bool +TraverseSchema::emptiableParticle(const ContentSpecNode* const specNode) { + + if (!fFullConstraintChecking || !specNode || (specNode->getMinTotalRange() == 0)) { + return true; + } + + return false; +} + +void TraverseSchema::checkFixedFacet(const DOMElement* const elem, + const XMLCh* const facetName, + const DatatypeValidator* const baseDV, + unsigned int& flags) +{ + const XMLCh* fixedFacet = getElementAttValue(elem, SchemaSymbols::fgATT_FIXED); + + if ((fixedFacet && *fixedFacet) && + (XMLString::equals(fixedFacet, SchemaSymbols::fgATTVAL_TRUE) + || XMLString::equals(fixedFacet, fgValueOne))) { + + if (XMLString::equals(SchemaSymbols::fgELT_LENGTH, facetName)) { + flags |= DatatypeValidator::FACET_LENGTH; + } + if (XMLString::equals(SchemaSymbols::fgELT_MINLENGTH, facetName)) { + flags |= DatatypeValidator::FACET_MINLENGTH; + } + else if (XMLString::equals(SchemaSymbols::fgELT_MAXLENGTH, facetName)) { + flags |= DatatypeValidator::FACET_MAXLENGTH; + } + else if (XMLString::equals(SchemaSymbols::fgELT_MAXEXCLUSIVE, facetName)) { + flags |= DatatypeValidator::FACET_MAXEXCLUSIVE; + } + else if (XMLString::equals(SchemaSymbols::fgELT_MAXINCLUSIVE, facetName)) { + flags |= DatatypeValidator::FACET_MAXINCLUSIVE; + } + else if (XMLString::equals(SchemaSymbols::fgELT_MINEXCLUSIVE, facetName)) { + flags |= DatatypeValidator::FACET_MINEXCLUSIVE; + } + else if (XMLString::equals(SchemaSymbols::fgELT_MININCLUSIVE, facetName)) { + flags |= DatatypeValidator::FACET_MININCLUSIVE; + } + else if (XMLString::equals(SchemaSymbols::fgELT_TOTALDIGITS, facetName)) { + flags |= DatatypeValidator::FACET_TOTALDIGITS; + } + else if (XMLString::equals(SchemaSymbols::fgELT_FRACTIONDIGITS, facetName)) { + flags |= DatatypeValidator::FACET_FRACTIONDIGITS; + } + else if ((XMLString::equals(SchemaSymbols::fgELT_WHITESPACE, facetName)) && + baseDV->getType() == DatatypeValidator::String) { + flags |= DatatypeValidator::FACET_WHITESPACE; + } + } +} + +void +TraverseSchema::buildValidSubstitutionListB(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + SchemaElementDecl* const subsElemDecl) { + + SchemaElementDecl* chainElemDecl = subsElemDecl->getSubstitutionGroupElem(); + + while (chainElemDecl) { + + int chainElemURI = chainElemDecl->getURI(); + XMLCh* chainElemName = chainElemDecl->getBaseName(); + ValueVectorOf* validSubsElements = + fValidSubstitutionGroups->get(chainElemName, chainElemURI); + + if (!validSubsElements) { + + if (fTargetNSURI == chainElemURI) { + break; // an error must have occured + } + + SchemaGrammar* aGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(fURIStringPool->getValueForId(chainElemURI)); + + if (!aGrammar) + break; + + validSubsElements = aGrammar->getValidSubstitutionGroups()->get(chainElemName, chainElemURI); + + if (!validSubsElements) { + break; + } + + validSubsElements = new (fGrammarPoolMemoryManager) ValueVectorOf(*validSubsElements); + fValidSubstitutionGroups->put((void*) chainElemName, chainElemURI, validSubsElements); + } + + if (validSubsElements->containsElement(elemDecl) || + !isSubstitutionGroupValid(elem, chainElemDecl, elemDecl->getComplexTypeInfo(), + elemDecl->getDatatypeValidator(), 0, false)) { + break; + } + + validSubsElements->addElement(elemDecl); + + // update related subs. info in case of circular import + BaseRefVectorEnumerator importingEnum = fSchemaInfo->getImportingListEnumerator(); + + while (importingEnum.hasMoreElements()) { + + const SchemaInfo& curRef = importingEnum.nextElement(); + SchemaGrammar* aGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(curRef.getTargetNSURIString()); + ValueVectorOf* subsElemList = + aGrammar->getValidSubstitutionGroups()->get(chainElemName, chainElemURI); + + if (subsElemList && !subsElemList->containsElement(elemDecl)) { + subsElemList->addElement(elemDecl); + } + } + + chainElemDecl = chainElemDecl->getSubstitutionGroupElem(); + } +} + +void +TraverseSchema::buildValidSubstitutionListF(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + SchemaElementDecl* const subsElemDecl) { + + int elemURI = elemDecl->getURI(); + XMLCh* elemName = elemDecl->getBaseName(); + ValueVectorOf* validSubsElements =fValidSubstitutionGroups->get(elemName, elemURI); + + if (validSubsElements) { + + int subsElemURI = subsElemDecl->getURI(); + XMLCh* subsElemName = subsElemDecl->getBaseName(); + ValueVectorOf* validSubs = fValidSubstitutionGroups->get(subsElemName, subsElemURI); + + if (!validSubs) { + + if (fTargetNSURI == subsElemURI) { + return; // an error must have occured + } + + SchemaGrammar* aGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(fURIStringPool->getValueForId(subsElemURI)); + + if (!aGrammar) + return; + + validSubs = aGrammar->getValidSubstitutionGroups()->get(subsElemName, subsElemURI); + + if (!validSubs) { + return; + } + + validSubs = new (fGrammarPoolMemoryManager) ValueVectorOf(*validSubs); + fValidSubstitutionGroups->put((void*) subsElemName, subsElemURI, validSubs); + } + + XMLSize_t elemSize = validSubsElements->size(); + for (XMLSize_t i=0; ielementAt(i); + + if (validSubs->containsElement(chainElem)) { + continue; + } + + if (isSubstitutionGroupValid(elem, subsElemDecl, chainElem->getComplexTypeInfo(), + chainElem->getDatatypeValidator(), 0, false)) { + validSubs->addElement(chainElem); + buildValidSubstitutionListB(elem, chainElem, subsElemDecl); + } + } + } +} + +void TraverseSchema::checkEnumerationRequiredNotation(const DOMElement* const elem, + const XMLCh* const name, + const XMLCh* const type) { + + const XMLCh* localPart = getLocalPart(type); + + if (XMLString::equals(localPart, XMLUni::fgNotationString)) { + const XMLCh* prefix = getPrefix(type); + const XMLCh* typeURI = resolvePrefixToURI(elem, prefix); + + if (XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoNotationType, name); + } + } +} + +XercesGroupInfo* TraverseSchema::processGroupRef(const DOMElement* const elem, + const XMLCh* const refName) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + DOMElement* content = checkContent(elem, XUtil::getFirstChildElement(elem), true); + Janitor janAnnot(fAnnotation); + if (content != 0) { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::NoContentForRef, SchemaSymbols::fgELT_GROUP); + } + + const XMLCh* prefix = getPrefix(refName); + const XMLCh* localPart = getLocalPart(refName); + const XMLCh* uriStr = resolvePrefixToURI(elem, prefix); + + fBuffer.set(uriStr); + fBuffer.append(chComma); + fBuffer.append(localPart); + + unsigned int nameIndex = fStringPool->addOrFind(fBuffer.getRawBuffer()); + + if (fCurrentGroupStack->containsElement(nameIndex)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoCircularDefinition, localPart); + return 0; + } + + XercesGroupInfo* groupInfo = 0; + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + unsigned int saveScope = fCurrentScope; + + //if from another target namespace + if (!XMLString::equals(uriStr, fTargetNSURIString)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uriStr); + return 0; + } + + Grammar* aGrammar = fGrammarResolver->getGrammar(uriStr); + + if (!aGrammar || aGrammar->getGrammarType() != Grammar::SchemaGrammarType) { + + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, uriStr); + return 0; + } + + groupInfo = ((SchemaGrammar*)aGrammar)->getGroupInfoRegistry()->get(fStringPool->getValueForId(nameIndex)); + + if (!groupInfo) { + + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(fURIStringPool->addOrFind(uriStr)); + + if (!impInfo || impInfo->getProcessed()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNotFound, + SchemaSymbols::fgELT_GROUP, uriStr, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + else { + groupInfo = fGroupRegistry->get(fStringPool->getValueForId(nameIndex)); + } + + if (!groupInfo) { + + DOMElement* groupElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_Group, + SchemaSymbols::fgELT_GROUP, localPart, &fSchemaInfo); + + if (groupElem != 0) { + + groupInfo = traverseGroupDecl(groupElem); + + // restore schema information + restoreSchemaInfo(saveInfo, infoType, saveScope); + + if (groupInfo && (fCurrentGroupInfo || infoType == SchemaInfo::IMPORT)) { + copyGroupElements(elem, groupInfo, fCurrentGroupInfo, + (infoType == SchemaInfo::IMPORT) ? fCurrentComplexType : 0); + } + + return groupInfo; + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNotFound, + SchemaSymbols::fgELT_GROUP, uriStr, localPart); + } + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + } + else { + copyGroupElements(elem, groupInfo, fCurrentGroupInfo, fCurrentComplexType); + } + + return groupInfo; +} + + +XercesAttGroupInfo* +TraverseSchema::processAttributeGroupRef(const DOMElement* const elem, + const XMLCh* const refName, + ComplexTypeInfo* const typeInfo) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + if (checkContent(elem, XUtil::getFirstChildElement(elem), true) != 0) { + reportSchemaError(elem ,XMLUni::fgValidityDomain, XMLValid::NoContentForRef, SchemaSymbols::fgELT_ATTRIBUTEGROUP); + } + + Janitor janAnnot(fAnnotation); + const XMLCh* prefix = getPrefix(refName); + const XMLCh* localPart = getLocalPart(refName); + const XMLCh* uriStr = resolvePrefixToURI(elem, prefix); + XercesAttGroupInfo* attGroupInfo = 0; + SchemaInfo* saveInfo = fSchemaInfo; + SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; + unsigned int saveScope = fCurrentScope; + + if (!XMLString::equals(uriStr, fTargetNSURIString)) { + + // Make sure that we have an explicit import statement. + // Clause 4 of Schema Representation Constraint: + // http://www.w3.org/TR/xmlschema-1/#src-resolve + unsigned int uriId = fURIStringPool->addOrFind(uriStr); + + if (!isImportingNS(uriId)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, uriStr); + return 0; + } + + attGroupInfo = traverseAttributeGroupDeclNS(elem, uriStr, localPart); + + if (!attGroupInfo) { + SchemaInfo* impInfo = fSchemaInfo->getImportInfo(fURIStringPool->addOrFind(uriStr)); + + if (!impInfo || impInfo->getProcessed()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNotFound, + SchemaSymbols::fgELT_ATTRIBUTEGROUP, uriStr, localPart); + return 0; + } + + infoType = SchemaInfo::IMPORT; + restoreSchemaInfo(impInfo, infoType); + } + } + else { + + attGroupInfo = fAttGroupRegistry->get(localPart); + } + + if (!attGroupInfo) { + + // traverse top level attributeGroup - if found + DOMElement* attGroupElem = fSchemaInfo->getTopLevelComponent(SchemaInfo::C_AttributeGroup, + SchemaSymbols::fgELT_ATTRIBUTEGROUP, localPart, &fSchemaInfo); + + if (attGroupElem != 0) { + + // circular attribute check + if (fDeclStack->containsElement(attGroupElem)) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NoCircularDefinition, refName); + return 0; + } + + attGroupInfo = traverseAttributeGroupDecl(attGroupElem, typeInfo, true); + + if (attGroupInfo && fCurrentAttGroupInfo) { + copyAttGroupAttributes(elem, attGroupInfo, fCurrentAttGroupInfo, 0); + } + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType, saveScope); + } + + return attGroupInfo; + } + else { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNotFound, + SchemaSymbols::fgELT_ATTRIBUTEGROUP, uriStr, localPart); + } + } + + if (attGroupInfo) { + copyAttGroupAttributes(elem, attGroupInfo, fCurrentAttGroupInfo, typeInfo); + } + + // restore schema information, if necessary + if (saveInfo != fSchemaInfo) { + restoreSchemaInfo(saveInfo, infoType); + } + + return attGroupInfo; +} + +void TraverseSchema::processElements(const DOMElement* const elem, + ComplexTypeInfo* const baseTypeInfo, + ComplexTypeInfo* const newTypeInfo) { + + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + XMLSize_t elemCount = baseTypeInfo->elementCount(); + + if (elemCount) { + + int newTypeScope = newTypeInfo->getScopeDefined(); + int schemaURI = fURIStringPool->addOrFind(SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + + for (XMLSize_t i=0; i < elemCount; i++) { + + SchemaGrammar* aGrammar = fSchemaGrammar; + SchemaElementDecl* elemDecl = baseTypeInfo->elementAt(i); + int elemURI = elemDecl->getURI(); + unsigned int elemScope = elemDecl->getEnclosingScope(); + + if (elemScope != Grammar::TOP_LEVEL_SCOPE) { + + if (elemURI != fTargetNSURI && elemURI != schemaURI && elemURI != fEmptyNamespaceURI) { + Grammar* aGrammar = fGrammarResolver->getGrammar(fURIStringPool->getValueForId(elemURI)); + + if (!aGrammar || aGrammar->getGrammarType() != Grammar::SchemaGrammarType) { + continue; // REVISIT - error message + } + } + + const XMLCh* localPart = elemDecl->getBaseName(); + const SchemaElementDecl* other = (SchemaElementDecl*) + aGrammar->getElemDecl(elemURI, localPart, 0, newTypeScope); + + if (other) { + + if (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() + || elemDecl->getDatatypeValidator() != other->getDatatypeValidator()) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateElementDeclaration, localPart); + } + + continue; + } + elemDecl->setEnclosingScope(newTypeScope); + ((SchemaGrammar*) aGrammar)->putGroupElemDecl(elemDecl); + elemDecl->setEnclosingScope(elemScope); + } + + newTypeInfo->addElement(elemDecl); + } + } +} + +void TraverseSchema::processElements(const DOMElement* const elem, + XercesGroupInfo* const fromGroup, + ComplexTypeInfo* const typeInfo) +{ + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + XMLSize_t elemCount = fromGroup->elementCount(); + int newScope = typeInfo->getScopeDefined(); + + for (XMLSize_t i = 0; i < elemCount; i++) { + + SchemaElementDecl* elemDecl = fromGroup->elementAt(i); + unsigned int elemScope = elemDecl->getEnclosingScope(); + + if (elemScope != Grammar::TOP_LEVEL_SCOPE) + { + int elemURI = elemDecl->getURI(); + const XMLCh* localPart = elemDecl->getBaseName(); + const SchemaElementDecl* other = (SchemaElementDecl*) + fSchemaGrammar->getElemDecl(elemURI, localPart, 0, newScope); + + if (other) + { + if (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() + || elemDecl->getDatatypeValidator() != other->getDatatypeValidator()) + { + reportSchemaError( + elem, XMLUni::fgXMLErrDomain + , XMLErrs::DuplicateElementDeclaration, localPart); + } + + continue; + } + + elemDecl->setEnclosingScope(newScope); + fSchemaGrammar->putGroupElemDecl(elemDecl); + elemDecl->setEnclosingScope(elemScope); + typeInfo->addElement(elemDecl); + } + } +} + + +void TraverseSchema::copyGroupElements(const DOMElement* const elem, + XercesGroupInfo* const fromGroup, + XercesGroupInfo* const toGroup, + ComplexTypeInfo* const typeInfo) { + + XMLSize_t elemCount = fromGroup->elementCount(); + int newScope = (typeInfo) ? typeInfo->getScopeDefined() : 0; + + if (typeInfo) + fromGroup->setCheckElementConsistency(false); + + for (XMLSize_t i = 0; i < elemCount; i++) { + + SchemaElementDecl* elemDecl = fromGroup->elementAt(i); + + if (typeInfo) { + + unsigned int elemScope = elemDecl->getEnclosingScope(); + + if (elemScope != Grammar::TOP_LEVEL_SCOPE) { + + int elemURI = elemDecl->getURI(); + const XMLCh* localPart = elemDecl->getBaseName(); + const SchemaElementDecl* other = (SchemaElementDecl*) + fSchemaGrammar->getElemDecl(elemURI, localPart, 0, newScope); + + if (other) { + + if (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() + || elemDecl->getDatatypeValidator() != other->getDatatypeValidator()) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateElementDeclaration, localPart); + } + + continue; + } + + elemDecl->setEnclosingScope(newScope); + fSchemaGrammar->putGroupElemDecl(elemDecl); + elemDecl->setEnclosingScope(elemScope); + } + + typeInfo->addElement(elemDecl); + } + + if (toGroup) { + toGroup->addElement(elemDecl); + } + } +} + +void TraverseSchema::copyAttGroupAttributes(const DOMElement* const elem, + XercesAttGroupInfo* const fromAttGroup, + XercesAttGroupInfo* const toAttGroup, + ComplexTypeInfo* const typeInfo) { + + XMLSize_t attCount = fromAttGroup->attributeCount(); + + for (XMLSize_t i=0; i < attCount; i++) { + + SchemaAttDef* attDef = fromAttGroup->attributeAt(i); + QName* attName = attDef->getAttName(); + const XMLCh* localPart = attName->getLocalPart(); + DatatypeValidator* attDV = attDef->getDatatypeValidator(); + + if (typeInfo) { + + if (typeInfo->getAttDef(localPart, attName->getURI())) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttribute, localPart); + continue; + } + + if (attDV && attDV->getType() == DatatypeValidator::ID) { + + if (typeInfo->containsAttWithTypeId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttDeclPropCorrect5, localPart); + continue; + } + + typeInfo->setAttWithTypeId(true); + } + + SchemaAttDef* clonedAttDef = new (fGrammarPoolMemoryManager) SchemaAttDef(attDef); + typeInfo->addAttDef(clonedAttDef); + + if (!clonedAttDef->getBaseAttDecl()) + clonedAttDef->setBaseAttDecl(attDef); + + if (toAttGroup) { + toAttGroup->addAttDef(attDef, true); + } + } + else { + + if (toAttGroup->containsAttribute(localPart, attName->getURI())) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DuplicateAttribute, localPart); + continue; + } + + if (attDV && attDV->getType() == DatatypeValidator::ID) { + + if (toAttGroup->containsTypeWithId()) { + + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::AttGrpPropCorrect3, localPart); + continue; + } + + toAttGroup->setTypeWithId(true); + } + + toAttGroup->addAttDef(attDef, true); + } + } + + if (toAttGroup) { + XMLSize_t anyAttCount = fromAttGroup->anyAttributeCount(); + + for (XMLSize_t j=0; j < anyAttCount; j++) { + toAttGroup->addAnyAttDef(fromAttGroup->anyAttributeAt(j), true); + } + } +} + +void +TraverseSchema::attWildCardIntersection(SchemaAttDef* const resultWildCard, + const SchemaAttDef* const compareWildCard) { + + XMLAttDef::AttTypes typeR = resultWildCard->getType(); + XMLAttDef::AttTypes typeC = compareWildCard->getType(); + + //If either O1 or O2 is any, then the other must be the value. + if (typeC == XMLAttDef::Any_Any || + typeR == XMLAttDef::AttTypes_Unknown) { + return; + } + + if (typeR == XMLAttDef::Any_Any || + typeC == XMLAttDef::AttTypes_Unknown) { + + resultWildCard->resetNamespaceList(); + copyWildCardData(compareWildCard, resultWildCard); + return; + } + + // If either O1 or O2 is a pair of not and a namespace name and the other + // is a set, then that set, minus the negated namespace name if it was in + // is the value + if ((typeC == XMLAttDef::Any_Other && typeR == XMLAttDef::Any_List) || + (typeR == XMLAttDef::Any_Other && typeC == XMLAttDef::Any_List)) { + + unsigned int compareURI = 0; + ValueVectorOf* nameURIList = 0; + + if (typeC == XMLAttDef::Any_List) { + nameURIList = compareWildCard->getNamespaceList(); + compareURI = resultWildCard->getAttName()->getURI(); + } + else { + nameURIList = resultWildCard->getNamespaceList(); + compareURI = compareWildCard->getAttName()->getURI(); + } + + XMLSize_t listSize = (nameURIList) ? nameURIList->size() : 0; + + if (listSize) { + + bool found = false; + ValueVectorOf tmpURIList(listSize, fGrammarPoolMemoryManager); + + for (XMLSize_t i=0; i < listSize; i++) { + + unsigned int nameURI = nameURIList->elementAt(i); + + if (nameURI != compareURI && + nameURI != (unsigned int) fEmptyNamespaceURI) { + tmpURIList.addElement(nameURI); + } + else { + found = true; + } + } + + if (found || typeC == XMLAttDef::Any_List) { + resultWildCard->setNamespaceList(&tmpURIList); + } + } + + if (typeC == XMLAttDef::Any_List) { + copyWildCardData(compareWildCard, resultWildCard); + } + + return; + } + + // If both O1 and O2 are sets, then the intersection of those sets must be + // the value. + if (typeR == XMLAttDef::Any_List && typeC == XMLAttDef::Any_List) { + + ValueVectorOf* uriListR = resultWildCard->getNamespaceList(); + ValueVectorOf* uriListC = compareWildCard->getNamespaceList(); + XMLSize_t listSize = (uriListC) ? uriListC->size() : 0; + + if (listSize) { + + ValueVectorOf tmpURIList(listSize, fGrammarPoolMemoryManager); + + for (XMLSize_t i=0; i < listSize; i++) { + + unsigned int uriName = uriListC->elementAt(i); + + if (uriListR && uriListR->containsElement(uriName)) { + tmpURIList.addElement(uriName); + } + } + + resultWildCard->setNamespaceList(&tmpURIList); + } + else { + resultWildCard->resetNamespaceList(); + } + + return; + } + + // If the two are negations of different namespace names, then: + // if one is a negation of absent, then result is negation of namespace + // else intersection is not expressible. + if (typeR == XMLAttDef::Any_Other && typeC == XMLAttDef::Any_Other) { + + QName* qnameR = resultWildCard->getAttName(); + + if (qnameR->getURI() != compareWildCard->getAttName()->getURI()) { + + if (qnameR->getURI() == (unsigned int)fEmptyNamespaceURI) { + qnameR->setURI(compareWildCard->getAttName()->getURI()); + } + else if (compareWildCard->getAttName()->getURI() != (unsigned int)fEmptyNamespaceURI) { + + qnameR->setURI(fEmptyNamespaceURI); + resultWildCard->setType(XMLAttDef::AttTypes_Unknown); + } + } + } +} + + +void +TraverseSchema::attWildCardUnion(SchemaAttDef* const resultWildCard, + const SchemaAttDef* const compareWildCard) { + + XMLAttDef::AttTypes typeR = resultWildCard->getType(); + XMLAttDef::AttTypes typeC = compareWildCard->getType(); + + //If either O1 or O2 is any, then the other must be the value. + if (typeR == XMLAttDef::Any_Any || + typeR == XMLAttDef::AttTypes_Unknown) { + return; + } + + if (typeC == XMLAttDef::Any_Any || + typeC == XMLAttDef::AttTypes_Unknown) { + + resultWildCard->resetNamespaceList(); + copyWildCardData(compareWildCard, resultWildCard); + return; + } + + // If both O1 and O2 are sets, then the union of those sets must be + // the value. + if (typeR == XMLAttDef::Any_List && typeC == XMLAttDef::Any_List) { + + ValueVectorOf* uriListR = resultWildCard->getNamespaceList(); + ValueVectorOf* uriListC = compareWildCard->getNamespaceList(); + XMLSize_t listSizeC = (uriListC) ? uriListC->size() : 0; + + if (listSizeC) { + + if (!uriListR || !uriListR->size()) { + + resultWildCard->setNamespaceList(uriListC); + return; + } + + ValueVectorOf tmpURIList(*uriListR); + + for (XMLSize_t i = 0; i < listSizeC; i++) { + + unsigned int uriName = uriListC->elementAt(i); + + if (!uriListR->containsElement(uriName)) { + tmpURIList.addElement(uriName); + } + } + + resultWildCard->setNamespaceList(&tmpURIList); + } + + return; + } + + // If the two are negations of different namespace names, then not and + // absent must be the value + if (typeR == XMLAttDef::Any_Other && typeC == XMLAttDef::Any_Other) { + + QName* qnameR = resultWildCard->getAttName(); + + if (qnameR->getURI() != compareWildCard->getAttName()->getURI()) { + + qnameR->setURI(fEmptyNamespaceURI); + resultWildCard->setType(XMLAttDef::Any_Other); + } + } + + // 5. If either O1 or O2 is a pair of not and a namespace name and the + // other is a set, then: + // 1. If the set includes both the negated namespace name and absent + // then any must be the value. + // 2. If the set includes the negated namespace name but not absent, + // then a pair of not and absent must be the value. + // 3. If the set includes absent but not the negated namespace name, + // then the union is not expressible. + // 4. If the set does not include either the negated namespace or + // absent, then whichever of O1 or O2 is a pair of not and a + // namespace name. + // + // 6. If either O1 or O2 is a pair of not and absent and the other is a + // set, then: + // 1. If the set includes absent then any must be the value. + // 2. If the set does not include absent, then a pair of not and + // absent. + if ((typeC == XMLAttDef::Any_Other && typeR == XMLAttDef::Any_List) || + (typeR == XMLAttDef::Any_Other && typeC == XMLAttDef::Any_List)) { + + ValueVectorOf* nameURIList = 0; + QName* attNameR = resultWildCard->getAttName(); + unsigned int compareURI = 0; + + if (typeC == XMLAttDef::Any_List) { + nameURIList = compareWildCard->getNamespaceList(); + compareURI = attNameR->getURI(); + } + else { + nameURIList = resultWildCard->getNamespaceList(); + compareURI = compareWildCard->getAttName()->getURI(); + } + + // 6. not and absent + if (compareURI == (unsigned int) fEmptyNamespaceURI) { + + if (nameURIList) { + + // 6.1 result is any + if (nameURIList->containsElement(compareURI)) { + + resultWildCard->setType(XMLAttDef::Any_Any); + attNameR->setURI(fEmptyNamespaceURI); + } + // 6.2 result is not and absent + else if (typeR == XMLAttDef::Any_List){ + + resultWildCard->setType(XMLAttDef::Any_Other); + attNameR->setURI(fEmptyNamespaceURI); + } + } + // 6.2 result is not and absent + else if (typeR == XMLAttDef::Any_List) { + + resultWildCard->setType(XMLAttDef::Any_Other); + attNameR->setURI(fEmptyNamespaceURI); + } + } + // 5. not and namespace + else { + + // 5.3 result is not expressible + if (!nameURIList) { + resultWildCard->setType(XMLAttDef::AttTypes_Unknown); + attNameR->setURI(fEmptyNamespaceURI); + } + else { + bool containsAbsent = + nameURIList->containsElement(fEmptyNamespaceURI); + bool containsNamespace = + nameURIList->containsElement(compareURI); + + // 5.1 result is any + if (containsAbsent && containsNamespace) { + + resultWildCard->setType(XMLAttDef::Any_Any); + attNameR->setURI(fEmptyNamespaceURI); + } + // 5.2 result is not and absent + else if (containsNamespace) { + + resultWildCard->setType(XMLAttDef::Any_Other); + attNameR->setURI(fEmptyNamespaceURI); + } + // 5.3 result is not expressible + else if (containsAbsent) { + + resultWildCard->setType(XMLAttDef::AttTypes_Unknown); + attNameR->setURI(fEmptyNamespaceURI); + } + // 5.4. whichever is not and namespace + else if (typeR == XMLAttDef::Any_List) { + + resultWildCard->setType(XMLAttDef::Any_Other); + attNameR->setURI(compareURI); + } + } + } + + resultWildCard->resetNamespaceList(); + } +} + + +void TraverseSchema::checkAttDerivationOK(const DOMElement* const elem, + const ComplexTypeInfo* const baseTypeInfo, + const ComplexTypeInfo* const childTypeInfo) { + + SchemaAttDefList& childAttList = (SchemaAttDefList&) childTypeInfo->getAttDefList(); + const SchemaAttDef* baseAttWildCard = baseTypeInfo->getAttWildCard(); + + for (XMLSize_t i=0; igetLocalPart(); + const SchemaAttDef* baseAttDef = baseTypeInfo->getAttDef(childLocalPart, childAttName->getURI()); + + if (baseAttDef) { + + XMLAttDef::DefAttTypes baseAttDefType = baseAttDef->getDefaultType(); + XMLAttDef::DefAttTypes childAttDefType = childAttDef.getDefaultType(); + + // Constraint 2.1.1 & 3 + check for prohibited base attribute + if (baseAttDefType == XMLAttDef::Prohibited + && childAttDefType != XMLAttDef::Prohibited) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_8, childLocalPart); + } + + if ((baseAttDefType & XMLAttDef::Required) + && !(childAttDefType & XMLAttDef::Required)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_2, childLocalPart); + } + + // if the attribute in the derived type is prohibited, and it didn't try to override a required attribute, + // it's ok and shouldn't be tested for data type or fixed value + if (childAttDefType == XMLAttDef::Prohibited) + continue; + + // Constraint 2.1.2 + DatatypeValidator* baseDV = baseAttDef->getDatatypeValidator(); + DatatypeValidator* childDV = childAttDef.getDatatypeValidator(); + if (!baseDV || !baseDV->isSubstitutableBy(childDV)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_3, childLocalPart); + } + + // Constraint 2.1.3 + if ((baseAttDefType & XMLAttDef::Fixed) && + (!(childAttDefType & XMLAttDef::Fixed) || + !XMLString::equals(baseAttDef->getValue(), childAttDef.getValue()))) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_4, childLocalPart); + } + } + // Constraint 2.2 + else if (!baseAttWildCard || + !wildcardAllowsNamespace(baseAttWildCard, childAttName->getURI())) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_5, childLocalPart); + } + } + + // Constraint 4 + const SchemaAttDef* childAttWildCard = childTypeInfo->getAttWildCard(); + + if (childAttWildCard) { + + if (!baseAttWildCard) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_6); + } + else if (!isWildCardSubset(baseAttWildCard, childAttWildCard)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_7); + } + else if (childAttWildCard->getDefaultType() < baseAttWildCard->getDefaultType()) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_9); + } + } +} + +void TraverseSchema::checkAttDerivationOK(const DOMElement* const elem, + const XercesAttGroupInfo* const baseAttGrpInfo, + const XercesAttGroupInfo* const childAttGrpInfo) { + + XMLSize_t baseAttCount = baseAttGrpInfo->attributeCount(); + XMLSize_t baseAnyAttCount = baseAttGrpInfo->anyAttributeCount(); + XMLSize_t childAttCount = childAttGrpInfo->attributeCount(); + XMLSize_t childAnyAttCount = childAttGrpInfo->anyAttributeCount(); + + if ((childAttCount || childAnyAttCount) && (!baseAttCount && !baseAnyAttCount)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_1); + } + + const SchemaAttDef* baseAttWildCard = (baseAnyAttCount) ? baseAttGrpInfo->anyAttributeAt(0) : 0; + + for (XMLSize_t i=0; iattributeAt(i); + QName* childAttName = childAttDef->getAttName(); + const XMLCh* childLocalPart = childAttName->getLocalPart(); + const SchemaAttDef* baseAttDef = baseAttGrpInfo->getAttDef(childLocalPart, childAttName->getURI()); + + if (baseAttDef) { + + XMLAttDef::DefAttTypes baseAttDefType = baseAttDef->getDefaultType(); + XMLAttDef::DefAttTypes childAttDefType = childAttDef->getDefaultType(); + + // Constraint 2.1.1 & 3 + check for prohibited base attribute + if (baseAttDefType == XMLAttDef::Prohibited + && childAttDefType != XMLAttDef::Prohibited) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_8, childLocalPart); + } + + if ((baseAttDefType & XMLAttDef::Required) + && !(childAttDefType & XMLAttDef::Required)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_2, childLocalPart); + } + + // if the attribute in the derived type is prohibited, and it didn't try to override a required attribute, + // it's ok and shouldn't be tested for data type or fixed value + if (childAttDefType == XMLAttDef::Prohibited) + continue; + + // Constraint 2.1.2 + DatatypeValidator* baseDV = baseAttDef->getDatatypeValidator(); + DatatypeValidator* childDV = childAttDef->getDatatypeValidator(); + if (!baseDV || !baseDV->isSubstitutableBy(childDV)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_3, childLocalPart); + } + + // Constraint 2.1.3 + if ((baseAttDefType & XMLAttDef::Fixed) && + (!(childAttDefType & XMLAttDef::Fixed) || + !XMLString::equals(baseAttDef->getValue(), childAttDef->getValue()))) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_4, childLocalPart); + } + } + // Constraint 2.2 + else if (!baseAttWildCard || + !wildcardAllowsNamespace(baseAttWildCard, childAttName->getURI())) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_5, childLocalPart); + } + } + + // Constraint 4 + const SchemaAttDef* childAttWildCard = (childAnyAttCount) ? childAttGrpInfo->anyAttributeAt(0) : 0; + + if (childAttWildCard) { + + if (!baseAttWildCard) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_6); + } + else if (!isWildCardSubset(baseAttWildCard, childAttWildCard)) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_7); + } + else if (childAttWildCard->getDefaultType() < baseAttWildCard->getDefaultType()) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BadAttDerivation_9); + } + } +} + +bool TraverseSchema::wildcardAllowsNamespace(const SchemaAttDef* const wildCard, + const unsigned int nameURI) { + + XMLAttDef::AttTypes wildCardType = wildCard->getType(); + + // The constraint must be any + if (wildCardType == XMLAttDef::Any_Any) { + return true; + } + + // All of the following must be true: + // 2.1 The constraint is a pair of not and a namespace name or ·absent + // 2.2 The value must not be identical to the ·namespace test·. + // 2.3 The value must not be ·absent·. + if (wildCardType == XMLAttDef::Any_Other && + ((int) nameURI) != fEmptyNamespaceURI && + wildCard->getAttName()->getURI() != nameURI) { + return true; + } + + // The constraint is a set, and the value is identical to one of the + // members of the set + if (wildCardType == XMLAttDef::Any_List) { + + ValueVectorOf* nameURIList = wildCard->getNamespaceList(); + + if (nameURIList->containsElement(nameURI)) { + return true; + } + } + + return false; +} + +bool TraverseSchema::isWildCardSubset(const SchemaAttDef* const baseAttWildCard, + const SchemaAttDef* const childAttWildCard) { + + XMLAttDef::AttTypes baseWildCardType = baseAttWildCard->getType(); + XMLAttDef::AttTypes childWildCardType = childAttWildCard->getType(); + + if (baseWildCardType == XMLAttDef::AttTypes_Unknown || + childWildCardType == XMLAttDef::AttTypes_Unknown) { + return false; + } + + // 1 super must be any. + if (baseWildCardType == XMLAttDef::Any_Any) { + return true; + } + + // 2 All of the following must be true: + // 2.1 sub must be a pair of not and a namespace name or ·absent·. + // 2.2 super must be a pair of not and the same value. + if (childWildCardType == XMLAttDef::Any_Other && baseWildCardType == XMLAttDef::Any_Other && + childAttWildCard->getAttName()->getURI() == baseAttWildCard->getAttName()->getURI()) { + return true; + } + + // 3 All of the following must be true: + // 3.1 sub must be a set whose members are either namespace names or ·absent·. + // 3.2 One of the following must be true: + // 3.2.1 super must be the same set or a superset thereof. + // 3.2.2 super must be a pair of not and a namespace name or ·absent· and + // that value must not be in sub's set. + if (childWildCardType == XMLAttDef::Any_List) { + + ValueVectorOf* childURIList = childAttWildCard->getNamespaceList(); + + if (baseWildCardType == XMLAttDef::Any_List) { + + ValueVectorOf* baseURIList = baseAttWildCard->getNamespaceList(); + XMLSize_t childListSize = (childURIList) ? childURIList->size() : 0; + + for (XMLSize_t i=0; icontainsElement(childURIList->elementAt(i))) { + return false; + } + } + + return true; + } + else if (baseWildCardType == XMLAttDef::Any_Other) { + if (!childURIList->containsElement(baseAttWildCard->getAttName()->getURI())) { + return true; + } + } + } + + return false; +} + +bool TraverseSchema::openRedefinedSchema(const DOMElement* const redefineElem) { + + if (fPreprocessedNodes->containsKey(redefineElem)) { + + restoreSchemaInfo(fPreprocessedNodes->get(redefineElem)); + return true; + } + + // ------------------------------------------------------------------ + // Get 'schemaLocation' attribute + // ------------------------------------------------------------------ + const XMLCh* schemaLocation = getElementAttValue(redefineElem, SchemaSymbols::fgATT_SCHEMALOCATION, DatatypeValidator::AnyURI); + + if (!schemaLocation || !*schemaLocation) { + reportSchemaError(redefineElem, XMLUni::fgXMLErrDomain, XMLErrs::DeclarationNoSchemaLocation, SchemaSymbols::fgELT_REDEFINE); + return false; + } + + // ------------------------------------------------------------------ + // Resolve schema location + // ------------------------------------------------------------------ + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) redefineElem)->getLineNo(), + ((XSDElementNSImpl*) redefineElem)->getColumnNo()); + InputSource* srcToFill = resolveSchemaLocation(schemaLocation, + XMLResourceIdentifier::SchemaRedefine); + Janitor janSrc(srcToFill); + + // Nothing to do + if (!srcToFill) { + return false; + } + + const XMLCh* includeURL = srcToFill->getSystemId(); + + if (XMLString::equals(includeURL, fSchemaInfo->getCurrentSchemaURL())) { + return false; + } + + SchemaInfo* redefSchemaInfo = fCachedSchemaInfoList->get(includeURL, fTargetNSURI); + + if (!redefSchemaInfo && fSchemaInfoList != fCachedSchemaInfoList) + redefSchemaInfo = fSchemaInfoList->get(includeURL, fTargetNSURI); + + if (redefSchemaInfo) { + + reportSchemaError(redefineElem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidRedefine, includeURL); + return false; + } + + // ------------------------------------------------------------------ + // Parse input source + // ------------------------------------------------------------------ + if (!fParser) + fParser = new (fGrammarPoolMemoryManager) XSDDOMParser(0,fGrammarPoolMemoryManager, 0); + + fParser->setValidationScheme(XercesDOMParser::Val_Never); + fParser->setDoNamespaces(true); + fParser->setUserEntityHandler(fEntityHandler); + fParser->setUserErrorReporter(fErrorReporter); + + // Should just issue warning if the schema is not found + bool flag = srcToFill->getIssueFatalErrorIfNotFound(); + srcToFill->setIssueFatalErrorIfNotFound(false); + + fParser->parse(*srcToFill) ; + + // Reset the InputSource + srcToFill->setIssueFatalErrorIfNotFound(flag); + + if (fParser->getSawFatal() && fScanner->getExitOnFirstFatal()) + reportSchemaError(redefineElem, XMLUni::fgXMLErrDomain, XMLErrs::SchemaScanFatalError); + + // ------------------------------------------------------------------ + // Get root element + // ------------------------------------------------------------------ + DOMDocument* document = fParser->getDocument(); + + if (!document) { + return false; + } + else { + + DOMElement* root = document->getDocumentElement(); + + if (root == 0) { + return false; + } + + const XMLCh* targetNSURIString = root->getAttribute(SchemaSymbols::fgATT_TARGETNAMESPACE); + + // check to see if targetNameSpace is right + if (*targetNSURIString + && !XMLString::equals(targetNSURIString,fTargetNSURIString)){ + reportSchemaError(root, XMLUni::fgXMLErrDomain, XMLErrs::RedefineNamespaceDifference, + schemaLocation, targetNSURIString); + return false; + } + + // if targetNamespace is empty, change it to redefin'g schema + // targetNamespace + if (!*targetNSURIString && root->getAttributeNode(XMLUni::fgXMLNSString) == 0 + && fTargetNSURI != fEmptyNamespaceURI) { + root->setAttribute(XMLUni::fgXMLNSString, fTargetNSURIString); + } + + // -------------------------------------------------------- + // Update schema information with redefined schema + // -------------------------------------------------------- + redefSchemaInfo = fSchemaInfo; + Janitor newSchemaInfo(new (fMemoryManager) SchemaInfo(0, 0, 0, fTargetNSURI, + fSchemaInfo->getNamespaceScope(), + includeURL, + fTargetNSURIString, root, + fScanner, + fGrammarPoolMemoryManager)); + fSchemaInfo = newSchemaInfo.get(); + + traverseSchemaHeader(root); + fSchemaInfoList->put((void*) fSchemaInfo->getCurrentSchemaURL(), fSchemaInfo->getTargetNSURI(), fSchemaInfo); + newSchemaInfo.release(); + redefSchemaInfo->addSchemaInfo(fSchemaInfo, SchemaInfo::INCLUDE); + fPreprocessedNodes->put((void*) redefineElem, fSchemaInfo); + } + + return true; +} + +void TraverseSchema::renameRedefinedComponents(const DOMElement* const redefineElem, + SchemaInfo* const redefiningSchemaInfo, + SchemaInfo* const redefinedSchemaInfo) { + + DOMElement* child = XUtil::getFirstChildElement(redefineElem); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* childName = child->getLocalName(); + + if (XMLString::equals(childName, SchemaSymbols::fgELT_ANNOTATION)) { + continue; + } + + // if component already redefined skip + const XMLCh* typeName = getElementAttValue(child, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(typeName); + + if (fRedefineComponents->containsKey(childName, fStringPool->addOrFind(fBuffer.getRawBuffer()))) { + continue; + } + + // Rename + const XMLCh* tmpChildName = fStringPool->getValueForId(fStringPool->addOrFind(childName)); + + if (validateRedefineNameChange(child, tmpChildName, typeName, 1, redefiningSchemaInfo)) { + fixRedefinedSchema(child, redefinedSchemaInfo, tmpChildName, typeName, 1); + } + else { + redefiningSchemaInfo->addFailedRedefine(child); + } + } +} + +bool TraverseSchema::validateRedefineNameChange(const DOMElement* const redefineChildElem, + const XMLCh* const redefineChildComponentName, + const XMLCh* const redefineChildTypeName, + const int redefineNameCounter, + SchemaInfo* const redefiningSchemaInfo) { + + const XMLCh* baseTypeName = 0; + unsigned int typeNameId = fStringPool->addOrFind(redefineChildTypeName); + + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(redefineChildTypeName); + + int fullTypeNameId = fStringPool->addOrFind(fBuffer.getRawBuffer()); + const XMLCh* typeNameStr = fStringPool->getValueForId(fullTypeNameId); + + restoreSchemaInfo(redefiningSchemaInfo); + + if (XMLString::equals(redefineChildComponentName,SchemaSymbols::fgELT_SIMPLETYPE)) { + + if (fDatatypeRegistry->getDatatypeValidator(typeNameStr)) { + return false; + } + + DOMElement* grandKid = XUtil::getFirstChildElement(redefineChildElem); + + if (grandKid && XMLString::equals(grandKid->getLocalName(), SchemaSymbols::fgELT_ANNOTATION)) { + grandKid = XUtil::getNextSiblingElement(grandKid); + } + + if (grandKid == 0) { + + reportSchemaError(redefineChildElem, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidSimpleType); + return false; + } + else if(!XMLString::equals(grandKid->getLocalName(), SchemaSymbols::fgELT_RESTRICTION)) { + + reportSchemaError(grandKid, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidSimpleType); + return false; + } + + baseTypeName = getElementAttValue(grandKid, SchemaSymbols::fgATT_BASE, DatatypeValidator::QName); + const XMLCh* prefix = getPrefix(baseTypeName); + const XMLCh* localPart = getLocalPart(baseTypeName); + const XMLCh* uriStr = resolvePrefixToURI(grandKid, prefix); + + if (fTargetNSURI != (int) fURIStringPool->addOrFind(uriStr) + || fStringPool->addOrFind(localPart) != typeNameId) { + reportSchemaError(grandKid, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidSimpleTypeBase); + return false; + } + + // now we have to do the renaming... + getRedefineNewTypeName(baseTypeName, redefineNameCounter, fBuffer); + grandKid->setAttribute(SchemaSymbols::fgATT_BASE, fBuffer.getRawBuffer()); + fRedefineComponents->put((void*) SchemaSymbols::fgELT_SIMPLETYPE, + fullTypeNameId, 0); + } + else if (XMLString::equals(redefineChildComponentName,SchemaSymbols::fgELT_COMPLEXTYPE)) { + + if (fComplexTypeRegistry->containsKey(typeNameStr)) { + return false; + } + + DOMElement* grandKid = XUtil::getFirstChildElement(redefineChildElem); + + if (grandKid && XMLString::equals(grandKid->getLocalName(), SchemaSymbols::fgELT_ANNOTATION)) { + grandKid = XUtil::getNextSiblingElement(grandKid); + } + + if (grandKid == 0) { + reportSchemaError(redefineChildElem, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidComplexType); + return false; + } else { + + // have to go one more level down; let another pass worry whether complexType is valid. + DOMElement* greatGrandKid = XUtil::getFirstChildElement(grandKid); + + if (greatGrandKid != 0 && + XMLString::equals(greatGrandKid->getLocalName(), SchemaSymbols::fgELT_ANNOTATION)) { + greatGrandKid = XUtil::getNextSiblingElement(greatGrandKid); + } + + if (greatGrandKid == 0) { + + reportSchemaError(grandKid, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidComplexType); + return false; + } else { + + const XMLCh* greatGrandKidName = greatGrandKid->getLocalName(); + + if (!XMLString::equals(greatGrandKidName, SchemaSymbols::fgELT_RESTRICTION) + && !XMLString::equals(greatGrandKidName, SchemaSymbols::fgELT_EXTENSION)) { + + reportSchemaError(greatGrandKid, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidComplexType); + return false; + } + + baseTypeName = getElementAttValue(greatGrandKid, SchemaSymbols::fgATT_BASE, DatatypeValidator::QName); + const XMLCh* prefix = getPrefix(baseTypeName); + const XMLCh* localPart = getLocalPart(baseTypeName); + const XMLCh* uriStr = resolvePrefixToURI(greatGrandKid, prefix); + + if (fTargetNSURI != (int) fURIStringPool->addOrFind(uriStr) + || fStringPool->addOrFind(localPart) != typeNameId) { + reportSchemaError(greatGrandKid, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidComplexTypeBase); + return false; + } + + // now we have to do the renaming... + getRedefineNewTypeName(baseTypeName, redefineNameCounter, fBuffer); + greatGrandKid->setAttribute(SchemaSymbols::fgATT_BASE, fBuffer.getRawBuffer()); + fRedefineComponents->put((void*) SchemaSymbols::fgELT_COMPLEXTYPE, + fullTypeNameId, 0); + } + } + } + else if (XMLString::equals(redefineChildComponentName, SchemaSymbols::fgELT_GROUP)) { + + if (fGroupRegistry->containsKey(typeNameStr)) { + return false; + } + + int groupRefCount = changeRedefineGroup(redefineChildElem, redefineChildComponentName, + redefineChildTypeName, redefineNameCounter); + + if (groupRefCount > 1) { + + reportSchemaError(redefineChildElem, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_GroupRefCount); + return false; + } + else if (groupRefCount == 0) { + // put a dummy value, default is null. + // when processing groups, we will check that table, if a value + // is found, we need to do a particle derivation check. + fRedefineComponents->put((void*) SchemaSymbols::fgELT_GROUP, + fullTypeNameId, fSchemaInfo->getCurrentSchemaURL()); + } + else { + fRedefineComponents->put((void*) SchemaSymbols::fgELT_GROUP, fullTypeNameId, 0); + } + } + else if (XMLString::equals(redefineChildComponentName, SchemaSymbols::fgELT_ATTRIBUTEGROUP)) { + + if (fAttGroupRegistry->containsKey(redefineChildTypeName)) { + return false; + } + + int attGroupRefCount = changeRedefineGroup(redefineChildElem, redefineChildComponentName, + redefineChildTypeName, redefineNameCounter); + + if (attGroupRefCount > 1) { + + reportSchemaError(redefineChildElem, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_AttGroupRefCount); + return false; + } + else if (attGroupRefCount == 0) { + // put a dummy value, default is null. + // when processing attributeGroups, we will check that table, if + // a value is found, we need to check for attribute derivation ok + // (by restriction) + fRedefineComponents->put((void*) SchemaSymbols::fgELT_ATTRIBUTEGROUP, + fullTypeNameId, fSchemaInfo->getCurrentSchemaURL()); + } + else { + fRedefineComponents->put((void*) SchemaSymbols::fgELT_ATTRIBUTEGROUP, fullTypeNameId, 0); + } + } + else { + reportSchemaError + ( + redefineChildElem + , XMLUni::fgXMLErrDomain + , XMLErrs::Redefine_InvalidChild + , redefineChildComponentName + ); + return false; + } + + return true; +} + +int TraverseSchema::changeRedefineGroup(const DOMElement* const redefineChildElem, + const XMLCh* const redefineChildComponentName, + const XMLCh* const redefineChildTypeName, + const int redefineNameCounter) { + int result = 0; + DOMElement* child = XUtil::getFirstChildElement(redefineChildElem); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + + if (XMLString::equals(name, SchemaSymbols::fgELT_ANNOTATION)) { + continue; + } + + if (!XMLString::equals(name, redefineChildComponentName)) { + result += changeRedefineGroup(child, redefineChildComponentName, redefineChildTypeName, redefineNameCounter); + } else { + const XMLCh* refName = getElementAttValue(child, SchemaSymbols::fgATT_REF, DatatypeValidator::QName); + + if (refName && *refName) { + + const XMLCh* prefix = getPrefix(refName); + const XMLCh* localPart = getLocalPart(refName); + const XMLCh* uriStr = resolvePrefixToURI(child, prefix); + + if (fTargetNSURI == (int) fURIStringPool->addOrFind(uriStr) + && fStringPool->addOrFind(localPart) == fStringPool->addOrFind(redefineChildTypeName)) { + + // now we have to do the renaming... + getRedefineNewTypeName(refName, redefineNameCounter, fBuffer); + child->setAttribute(SchemaSymbols::fgATT_REF, fBuffer.getRawBuffer()); + result++; + + if(XMLString::equals(redefineChildComponentName, SchemaSymbols::fgELT_GROUP)) { + + const XMLCh* minOccurs = getElementAttValue(child, SchemaSymbols::fgATT_MINOCCURS, DatatypeValidator::Decimal); + const XMLCh* maxOccurs = getElementAttValue(child, SchemaSymbols::fgATT_MAXOCCURS, DatatypeValidator::Decimal); + + if (((maxOccurs && *maxOccurs) && !XMLString::equals(maxOccurs, fgValueOne)) + || ((minOccurs && *minOccurs) && !XMLString::equals(minOccurs, fgValueOne))) { + reportSchemaError(child, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_InvalidGroupMinMax, redefineChildTypeName); + } + } + } + } // if ref was null some other stage of processing will flag the error + } + } + + return result; +} + + +void TraverseSchema::fixRedefinedSchema(const DOMElement* const elem, + SchemaInfo* const redefinedSchemaInfo, + const XMLCh* const redefineChildComponentName, + const XMLCh* const redefineChildTypeName, + const int redefineNameCounter) { + + bool foundIt = false; + DOMElement* child = XUtil::getFirstChildElement(redefinedSchemaInfo->getRoot()); + + restoreSchemaInfo(redefinedSchemaInfo); + + for (; child != 0; child = XUtil::getNextSiblingElement(child)) { + + const XMLCh* name = child->getLocalName(); + + if (XMLString::equals(name, redefineChildComponentName)) { + + const XMLCh* infoItemName = getElementAttValue(child, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + if(!XMLString::equals(infoItemName, redefineChildTypeName)) { + continue; + } + else { // found it! + + // now we have to do the renaming... + foundIt = true; + getRedefineNewTypeName(infoItemName, redefineNameCounter, fBuffer); + child->setAttribute(SchemaSymbols::fgATT_NAME, fBuffer.getRawBuffer()); + break; + } + } + else if (XMLString::equals(name, SchemaSymbols::fgELT_REDEFINE)) { // need to search the redefine decl... + + for (DOMElement* redefChild = XUtil::getFirstChildElement(child); + redefChild != 0; + redefChild = XUtil::getNextSiblingElement(redefChild)) { + + const XMLCh* redefName = redefChild->getLocalName(); + + if (XMLString::equals(redefName, redefineChildComponentName)) { + + const XMLCh* infoItemName = getElementAttValue(redefChild, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName); + + if(!XMLString::equals(infoItemName, redefineChildTypeName)) { + continue; + } + else { // found it! + + if (!openRedefinedSchema(child)) { + + redefinedSchemaInfo->addFailedRedefine(child); + return; + } + + foundIt = true; + + SchemaInfo* reRedefinedSchemaInfo = fSchemaInfo; + + if (validateRedefineNameChange(redefChild, redefineChildComponentName, redefineChildTypeName, redefineNameCounter + 1, redefinedSchemaInfo)) { + + fixRedefinedSchema(redefChild, reRedefinedSchemaInfo, redefineChildComponentName, redefineChildTypeName, redefineNameCounter + 1); + + // now we have to do the renaming... + getRedefineNewTypeName(infoItemName, redefineNameCounter, fBuffer); + const XMLCh* newInfoItemName = fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer())); + redefChild->setAttribute(SchemaSymbols::fgATT_NAME, newInfoItemName); + + // and we now know we will traverse this, so set fRedefineComponents appropriately... + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(newInfoItemName); + } + else { + + fixRedefinedSchema(redefChild, reRedefinedSchemaInfo, redefineChildComponentName, redefineChildTypeName, redefineNameCounter); + redefinedSchemaInfo->addFailedRedefine(redefChild); + + // and we now know we will traverse this, so set fRedefineComponents appropriately... + fBuffer.set(fTargetNSURIString); + fBuffer.append(chComma); + fBuffer.append(infoItemName); + } + + unsigned int infoItemNameId = fStringPool->addOrFind(fBuffer.getRawBuffer()); + + if (!fRedefineComponents->containsKey(redefineChildComponentName, infoItemNameId)) { + fRedefineComponents->put((void*) redefineChildComponentName, infoItemNameId, 0); + } + + break; + } + } + } //for + + if (foundIt) { + break; + } + } + } //for + + if(!foundIt) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::Redefine_DeclarationNotFound, redefineChildTypeName); + } +} + +bool TraverseSchema::isSubstitutionGroupCircular(SchemaElementDecl* const elemDecl, + SchemaElementDecl* const subsElemDecl) +{ + + if (elemDecl == subsElemDecl) + return true; + + SchemaElementDecl* tmpElemDecl = subsElemDecl->getSubstitutionGroupElem(); + + while (tmpElemDecl) + { + if (tmpElemDecl == elemDecl) + return true; + + tmpElemDecl = tmpElemDecl->getSubstitutionGroupElem(); + } + + return false; +} + +// --------------------------------------------------------------------------- +// TraverseSchema: Error reporting methods +// --------------------------------------------------------------------------- +void TraverseSchema::reportSchemaError(const XSDLocator* const aLocator, + const XMLCh* const msgDomain, + const int errorCode) { + + fXSDErrorReporter.emitError(errorCode, msgDomain, aLocator); +} + +void TraverseSchema::reportSchemaError(const XSDLocator* const aLocator, + const XMLCh* const msgDomain, + const int errorCode, + const XMLCh* const text1, + const XMLCh* const text2, + const XMLCh* const text3, + const XMLCh* const text4) { + + fXSDErrorReporter.emitError(errorCode, msgDomain, aLocator, text1, text2, text3, text4, fMemoryManager); +} + +void TraverseSchema::reportSchemaError(const DOMElement* const elem, + const XMLCh* const msgDomain, + const int errorCode) { + + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + + fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator); +} + +void TraverseSchema::reportSchemaError(const DOMElement* const elem, + const XMLCh* const msgDomain, + const int errorCode, + const XMLCh* const text1, + const XMLCh* const text2, + const XMLCh* const text3, + const XMLCh* const text4) { + + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + + fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator, text1, text2, text3, text4, fMemoryManager); +} + +void TraverseSchema::reportSchemaError(const DOMElement* const elem, + const XMLException& except) +{ + fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0, + ((XSDElementNSImpl*) elem)->getLineNo(), + ((XSDElementNSImpl*) elem)->getColumnNo()); + + fXSDErrorReporter.emitError(except, fLocator); +} +// --------------------------------------------------------------------------- +// TraverseSchema: Init/CleanUp methods +// --------------------------------------------------------------------------- +void TraverseSchema::init() { + + fXSDErrorReporter.setErrorReporter(fErrorReporter); + fXSDErrorReporter.setExitOnFirstFatal(fScanner->getExitOnFirstFatal()); + + fFullConstraintChecking = fScanner->getValidationSchemaFullChecking(); + + fDatatypeRegistry = fSchemaGrammar->getDatatypeRegistry(); + fStringPool = fGrammarResolver->getStringPool(); + fEmptyNamespaceURI = fScanner->getEmptyNamespaceId(); + fCurrentTypeNameStack = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + fCurrentGroupStack = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + + fGlobalDeclarations = (ValueVectorOf**) fMemoryManager->allocate + ( + ENUM_ELT_SIZE * sizeof(ValueVectorOf*) + );//new ValueVectorOf*[ENUM_ELT_SIZE]; + memset(fGlobalDeclarations, 0, ENUM_ELT_SIZE * sizeof(ValueVectorOf*)); + for(unsigned int i=0; i < ENUM_ELT_SIZE; i++) + fGlobalDeclarations[i] = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + + fNonXSAttList = new (fMemoryManager) ValueVectorOf(4, fMemoryManager); + fNotationRegistry = new (fMemoryManager) RefHash2KeysTableOf(13, (bool) false, fMemoryManager); + fPreprocessedNodes = new (fMemoryManager) RefHashTableOf + ( + 29 + , false + , fMemoryManager + ); + fLocator = new (fMemoryManager) XSDLocator(); + fDeclStack = new (fMemoryManager) ValueVectorOf(16, fMemoryManager); +} + +void TraverseSchema::cleanUp() { + + delete fCurrentTypeNameStack; + delete fCurrentGroupStack; + + if (fGlobalDeclarations) + { + for(unsigned int i=0; i < ENUM_ELT_SIZE; i++) + delete fGlobalDeclarations[i]; + fMemoryManager->deallocate(fGlobalDeclarations);//delete [] fGlobalDeclarations; + } + + delete fNonXSAttList; + delete fImportedNSList; + delete fNotationRegistry; + delete fRedefineComponents; + delete fIdentityConstraintNames; + delete fDeclStack; + delete fIC_ElementsNS; + delete fIC_NodeListNS; + delete fPreprocessedNodes; + delete fLocator; + delete fParser; +} + +void TraverseSchema::processElemDeclAttrs(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + const XMLCh*& valueConstraint, + bool isTopLevel) +{ + int elementMiscFlags = 0; + const XMLCh* fixedVal = getElementAttValue(elem, SchemaSymbols::fgATT_FIXED); + const XMLCh* nillable = getElementAttValue(elem, SchemaSymbols::fgATT_NILLABLE, DatatypeValidator::Boolean); + + // check constraint value + valueConstraint = getElementAttValue(elem, SchemaSymbols::fgATT_DEFAULT); + if (fixedVal) + { + elementMiscFlags |= SchemaSymbols::XSD_FIXED; + + // if both default and fixed, emit an error + if (valueConstraint) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::ElementWithFixedAndDefault, getElementAttValue(elem, SchemaSymbols::fgATT_NAME, DatatypeValidator::NCName)); + + // set constraint value to the fixed one + valueConstraint = fixedVal; + } + + // check nillable + if (nillable && *nillable) { + + if (XMLString::equals(nillable, SchemaSymbols::fgATTVAL_TRUE) + || XMLString::equals(nillable, fgValueOne)) { + elementMiscFlags |= SchemaSymbols::XSD_NILLABLE; + } + } + + if (isTopLevel) + { + const XMLCh* bAbstract = getElementAttValue(elem, SchemaSymbols::fgATT_ABSTRACT, DatatypeValidator::Boolean); + if (bAbstract && *bAbstract) { + + if (XMLString::equals(bAbstract, SchemaSymbols::fgATTVAL_TRUE) + || XMLString::equals(bAbstract, fgValueOne)) { + elementMiscFlags |= SchemaSymbols::XSD_ABSTRACT; + } + } + + elemDecl->setFinalSet(parseFinalSet(elem, EC_Final)); + } + + elemDecl->setBlockSet(parseBlockSet(elem, ES_Block)); + elemDecl->setMiscFlags(elementMiscFlags); +} + +void TraverseSchema::processElemDeclIC(DOMElement* const icElem, + SchemaElementDecl* const elemDecl) +{ + // key/keyref/unique processing + ValueVectorOf* icNodes = 0; + DOMElement* ic = icElem; + while (ic != 0) { + + if (XMLString::equals(ic->getLocalName(), SchemaSymbols::fgELT_KEY)) { + traverseKey(ic, elemDecl); + } + else if (XMLString::equals(ic->getLocalName(), SchemaSymbols::fgELT_UNIQUE)) { + traverseUnique(ic, elemDecl); + } + else { + + if (!icNodes) { + icNodes = new (fGrammarPoolMemoryManager) ValueVectorOf(8, fGrammarPoolMemoryManager); + } + + icNodes->addElement(ic); + } + + ic = XUtil::getNextSiblingElementNS( + ic, fgIdentityConstraints, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, 3); + } + + if (icNodes) { + + if (!fIC_ElementsNS) { + + fIC_ElementsNS = new (fMemoryManager) RefHashTableOf(13, fMemoryManager); + fIC_NodeListNS = new (fMemoryManager) RefHashTableOf, PtrHasher>(29, true, fMemoryManager); + } + + fIC_Elements = fIC_ElementsNS->get(fTargetNSURIString); + if (!fIC_Elements) { + fIC_Elements = new (fMemoryManager) ValueVectorOf(8, fMemoryManager); + fIC_ElementsNS->put((void*) fTargetNSURIString, fIC_Elements); + } + + fIC_NodeListNS->put(elemDecl, icNodes); + fIC_Elements->addElement(elemDecl); + } +} + +bool +TraverseSchema::checkElemDeclValueConstraint(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + const XMLCh* const valConstraint, + ComplexTypeInfo* const typeInfo, + DatatypeValidator* const validator) +{ + bool isValid = false; + if (validator) + { + if (validator->getType() == DatatypeValidator::ID) + reportSchemaError( + elem, XMLUni::fgXMLErrDomain, XMLErrs::ElemIDValueConstraint + , elemDecl->getBaseName(), valConstraint + ); + + try + { + const XMLCh* valueToCheck = valConstraint; + short wsFacet = validator->getWSFacet(); + if((wsFacet == DatatypeValidator::REPLACE && !XMLString::isWSReplaced(valueToCheck)) || + (wsFacet == DatatypeValidator::COLLAPSE && !XMLString::isWSCollapsed(valueToCheck))) + { + XMLCh* normalizedValue=XMLString::replicate(valueToCheck, fMemoryManager); + ArrayJanitor tempURIName(normalizedValue, fMemoryManager); + if(wsFacet == DatatypeValidator::REPLACE) + XMLString::replaceWS(normalizedValue, fMemoryManager); + else if(wsFacet == DatatypeValidator::COLLAPSE) + XMLString::collapseWS(normalizedValue, fMemoryManager); + valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(normalizedValue)); + } + + validator->validate(valueToCheck,0,fMemoryManager); + + XMLCh* canonical = (XMLCh*) validator->getCanonicalRepresentation(valueToCheck, fMemoryManager); + ArrayJanitor tempCanonical(canonical, fMemoryManager); + + if(!XMLString::equals(canonical, valueToCheck)) + { + validator->validate(canonical, 0, fMemoryManager); + valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(canonical)); + } + + elemDecl->setDefaultValue(valueToCheck); + + isValid = true; + } + catch(const XMLException& excep) + { + reportSchemaError(elem, excep); + } + catch(const OutOfMemoryException&) + { + throw; + } + catch(...) + { + reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DatatypeValidationFailure, valConstraint); + } + } + + if (typeInfo) + { + int contentSpecType = typeInfo->getContentType(); + + if (contentSpecType != SchemaElementDecl::Simple && + contentSpecType != SchemaElementDecl::Mixed_Simple && + contentSpecType != SchemaElementDecl::Mixed_Complex) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::NotSimpleOrMixedElement, elemDecl->getBaseName()); + + if (((contentSpecType == SchemaElementDecl::Mixed_Complex + || contentSpecType == SchemaElementDecl::Mixed_Simple) + && !emptiableParticle(typeInfo->getContentSpec()))) + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::EmptiableMixedContent, elemDecl->getBaseName()); + } + + return isValid; +} + +void TraverseSchema::processSubstitutionGroup(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + ComplexTypeInfo*& typeInfo, + DatatypeValidator*& validator, + const XMLCh* const subsElemQName) +{ + NamespaceScopeManager nsMgr(elem, fSchemaInfo, this); + + SchemaElementDecl* subsElemDecl = getGlobalElemDecl(elem, subsElemQName); + if (subsElemDecl) + { + if (isSubstitutionGroupCircular(elemDecl, subsElemDecl)) + { + reportSchemaError( + elem , XMLUni::fgXMLErrDomain , XMLErrs::CircularSubsGroup, elemDecl->getBaseName()); + } + else + { + // Check for substitution validity constraint + // Substitution allowed (block and blockDefault) && same type + if (isSubstitutionGroupValid(elem, subsElemDecl, typeInfo, validator, elemDecl->getBaseName())) + { + elemDecl->setSubstitutionGroupElem(subsElemDecl); + + // if type information is missing, use subsGroup one + if (!typeInfo && !validator) + { + typeInfo = subsElemDecl->getComplexTypeInfo(); + validator = subsElemDecl->getDatatypeValidator(); + + if (validator) + { + elemDecl->setDatatypeValidator(validator); + elemDecl->setModelType(SchemaElementDecl::Simple); + } + else if (typeInfo) + { + elemDecl->setComplexTypeInfo(typeInfo); + elemDecl->setModelType((SchemaElementDecl::ModelTypes)typeInfo->getContentType()); + } + } + + XMLCh* subsElemBaseName = subsElemDecl->getBaseName(); + int subsElemURI = subsElemDecl->getURI(); + ValueVectorOf* subsElements = + fValidSubstitutionGroups->get(subsElemBaseName, subsElemURI); + + if (!subsElements && fTargetNSURI != subsElemURI) + { + SchemaGrammar* aGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(fURIStringPool->getValueForId(subsElemURI)); + + if (aGrammar) + { + subsElements = aGrammar->getValidSubstitutionGroups()->get(subsElemBaseName, subsElemURI); + + if (subsElements) + { + subsElements = new (fGrammarPoolMemoryManager) ValueVectorOf(*subsElements); + fValidSubstitutionGroups->put(subsElemBaseName, subsElemURI, subsElements); + } + else if (fSchemaInfo->circularImportExist(subsElemURI)) + { + aGrammar->getValidSubstitutionGroups()->put( + subsElemBaseName, subsElemURI, new (fGrammarPoolMemoryManager) ValueVectorOf(8, fGrammarPoolMemoryManager)); + } + } + } + + if (!subsElements) + { + subsElements = new (fGrammarPoolMemoryManager) ValueVectorOf(8, fGrammarPoolMemoryManager); + fValidSubstitutionGroups->put(subsElemBaseName, subsElemURI, subsElements); + } + + subsElements->addElement(elemDecl); + + // update related subs. info in case of circular import + BaseRefVectorEnumerator importingEnum = fSchemaInfo->getImportingListEnumerator(); + + while (importingEnum.hasMoreElements()) + { + const SchemaInfo& curRef = importingEnum.nextElement(); + SchemaGrammar* aGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(curRef.getTargetNSURIString()); + ValueVectorOf* subsElemList = + aGrammar->getValidSubstitutionGroups()->get(subsElemBaseName, subsElemURI); + + if (subsElemList && !subsElemList->containsElement(elemDecl)) + subsElemList->addElement(elemDecl); + } + + buildValidSubstitutionListB(elem, elemDecl, subsElemDecl); + buildValidSubstitutionListF(elem, elemDecl, subsElemDecl); + } + } + } +} + +void TraverseSchema::processAttValue(const XMLCh* const attVal, + XMLBuffer& aBuf) +{ + // REVISIT-KN: assuming that attVal is not NULL + // + // normally, nothing will happen + const XMLCh* srcVal = attVal; + XMLCh nextCh = *srcVal; + while (nextCh) + { + if (nextCh <= chCloseAngle) { + switch (nextCh) { + case chDoubleQuote: + aBuf.append(chAmpersand); + aBuf.append(XMLUni::fgQuot); + aBuf.append(chSemiColon); + break; + case chSingleQuote: + aBuf.append(chAmpersand); + aBuf.append(XMLUni::fgApos); + aBuf.append(chSemiColon); + break; + case chCloseAngle: + aBuf.append(chAmpersand); + aBuf.append(XMLUni::fgGT); + aBuf.append(chSemiColon); + break; + case chOpenAngle: + aBuf.append(chAmpersand); + aBuf.append(XMLUni::fgLT); + aBuf.append(chSemiColon); + break; + case chAmpersand: + aBuf.append(chAmpersand); + aBuf.append(XMLUni::fgAmp); + aBuf.append(chSemiColon); + break; + default: + aBuf.append(nextCh); + break; + } // end switch + } + else + aBuf.append(nextCh); + + nextCh = *++srcVal; + } +} + +XSAnnotation* TraverseSchema::generateSyntheticAnnotation(const DOMElement* const elem + , ValueVectorOf* nonXSAttList) +{ + const XMLCh* prefix = elem->getPrefix(); + ValueHashTableOf* listOfURIs = new (fMemoryManager) ValueHashTableOf(29, fMemoryManager); + bool sawXMLNS = false; + + fBuffer.reset(); + fBuffer.append(chOpenAngle); + if (prefix) + { + fBuffer.append(prefix); + fBuffer.append(chColon); + } + fBuffer.append(SchemaSymbols::fgELT_ANNOTATION); + + // next is the nonXSAttList names & values + XMLSize_t nonXSAttSize = nonXSAttList->size(); + + for (XMLSize_t i=0; ielementAt(i); + + fBuffer.append(chSpace); + fBuffer.append(attNode->getNodeName()); + fBuffer.append(chEqual); + fBuffer.append(chDoubleQuote); + processAttValue(attNode->getNodeValue(), fBuffer); + fBuffer.append(chDoubleQuote); + } + + // next is the namespaces on the elem + DOMElement* currentElem = (DOMElement*) elem; + DOMNamedNodeMap* eltAttrs; + XMLSize_t attrCount; + do { + eltAttrs = currentElem->getAttributes(); + attrCount = eltAttrs->getLength(); + for (XMLSize_t j = 0; j < attrCount; j++) + { + DOMNode* attribute = eltAttrs->item(j); + const XMLCh* attName = attribute->getNodeName(); + + if (XMLString::startsWith(attName, XMLUni::fgXMLNSColonString)) + { + if (!listOfURIs->containsKey((void*) attName)) { + listOfURIs->put((void*) attName, 0); + fBuffer.append(chSpace); + fBuffer.append(attName); + fBuffer.append(chEqual); + fBuffer.append(chDoubleQuote); + processAttValue(attribute->getNodeValue(), fBuffer); + fBuffer.append(chDoubleQuote); + } + } + else if (!sawXMLNS && XMLString::equals(attName, XMLUni::fgXMLNSString)) + { + fBuffer.append(chSpace); + fBuffer.append(attName); + fBuffer.append(chEqual); + fBuffer.append(chDoubleQuote); + processAttValue(attribute->getNodeValue(), fBuffer); + fBuffer.append(chDoubleQuote); + sawXMLNS = true; + } + } + currentElem = (DOMElement*) currentElem->getParentNode(); + } + while (currentElem != fSchemaInfo->getRoot()->getParentNode()); + delete listOfURIs; + + fBuffer.append(chCloseAngle); + fBuffer.append(chLF); + fBuffer.append(chOpenAngle); + if (prefix) + { + fBuffer.append(prefix); + fBuffer.append(chColon); + } + fBuffer.append(SchemaSymbols::fgELT_DOCUMENTATION); + fBuffer.append(chCloseAngle); + fBuffer.append(fgSynthetic_Annotation); + fBuffer.append(chOpenAngle); + fBuffer.append(chForwardSlash); + if (prefix) + { + fBuffer.append(prefix); + fBuffer.append(chColon); + } + fBuffer.append(SchemaSymbols::fgELT_DOCUMENTATION); + fBuffer.append(chCloseAngle); + fBuffer.append(chLF); + fBuffer.append(chOpenAngle); + fBuffer.append(chForwardSlash); + if (prefix) + { + fBuffer.append(prefix); + fBuffer.append(chColon); + } + fBuffer.append(SchemaSymbols::fgELT_ANNOTATION); + fBuffer.append(chCloseAngle); + + XSAnnotation* annot = new (fGrammarPoolMemoryManager) XSAnnotation(fBuffer.getRawBuffer(), fGrammarPoolMemoryManager); + annot->setLineCol( ((XSDElementNSImpl*)elem)->getLineNo() + , ((XSDElementNSImpl*)elem)->getColumnNo() ); + annot->setSystemId(fSchemaInfo->getCurrentSchemaURL()); + return annot; +} + +class AnnotationErrorReporter : public XMLErrorReporter +{ +public: + AnnotationErrorReporter(XMLErrorReporter* chainedErrorReporter) + { + fErrorReporter = chainedErrorReporter; + setSystemIdAndPosition(NULL, 0, 0); + } + + void setSystemIdAndPosition(const XMLCh* systemId, XMLFileLoc line, XMLFileLoc column) + { + fSystemId=systemId; + fLine=line; + fColumn=column; + } + + virtual void error + ( + const unsigned int errCode + , const XMLCh* const errDomain + , const ErrTypes type + , const XMLCh* const errorText + , const XMLCh* const /*systemId*/ + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ) + { + if(fErrorReporter) + fErrorReporter->error(errCode, errDomain, type, errorText, fSystemId, publicId, fLine+lineNum-1, lineNum==1?fColumn+colNum:colNum); + } + + virtual void resetErrors() {} + +protected: + XMLErrorReporter* fErrorReporter; + const XMLCh* fSystemId; + XMLFileLoc fLine, fColumn; +}; + +void TraverseSchema::validateAnnotations() { + + MemoryManager *memMgr = fMemoryManager; + RefHashTableOfEnumerator xsAnnotationEnum = RefHashTableOfEnumerator (fSchemaGrammar->getAnnotations(), false, memMgr); + XSAnnotation& xsAnnot = xsAnnotationEnum.nextElement(); + XSAnnotation* nextAnnot; + + // create schema grammar + SchemaGrammar *grammar = new (memMgr) SchemaGrammar(memMgr); + grammar->setComplexTypeRegistry(new (memMgr) RefHashTableOf(29, memMgr)); + grammar->setGroupInfoRegistry(new (memMgr) RefHashTableOf(13, memMgr)); + grammar->setAttGroupInfoRegistry(new (memMgr) RefHashTableOf(13, memMgr)); + grammar->setAttributeDeclRegistry(new (memMgr) RefHashTableOf(29, memMgr)); + grammar->setValidSubstitutionGroups(new (memMgr) RefHash2KeysTableOf(29, memMgr)); + grammar->setTargetNamespace(SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) grammar->getGrammarDescription(); + gramDesc->setTargetNamespace(SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + + // setup components of annotation grammar + SchemaElementDecl* annotElemDecl = new (memMgr) SchemaElementDecl + ( + XMLUni::fgZeroLenString , SchemaSymbols::fgELT_ANNOTATION + , fURIStringPool->addOrFind(SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + , SchemaElementDecl::Mixed_Complex, Grammar::TOP_LEVEL_SCOPE , memMgr + ); + annotElemDecl->setCreateReason(XMLElementDecl::Declared); + grammar->putElemDecl(annotElemDecl); + + ComplexTypeInfo* complexType = new (memMgr) ComplexTypeInfo(memMgr); + complexType->setAnonymous(); + complexType->setContentType(SchemaElementDecl::Mixed_Complex); + annotElemDecl->setComplexTypeInfo(complexType); + + fBuffer.set(SchemaSymbols::fgURI_SCHEMAFORSCHEMA); + fBuffer.append(chComma); + fBuffer.append(chLatin_C); + fBuffer.append(chDigit_0); + const XMLCh* fullName = fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer())); + grammar->getComplexTypeRegistry()->put((void*) fullName, complexType); + complexType->setTypeName(fullName); + complexType->setAttWildCard + ( + new (memMgr) SchemaAttDef + ( + XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, + fEmptyNamespaceURI, XMLAttDef::Any_Any, + XMLAttDef::ProcessContents_Lax, memMgr + ) + ); + + SchemaElementDecl* appInfoElemDecl = new (memMgr) SchemaElementDecl + ( + XMLUni::fgZeroLenString , SchemaSymbols::fgELT_APPINFO + , fURIStringPool->addOrFind(SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + , SchemaElementDecl::Any, Grammar::TOP_LEVEL_SCOPE , memMgr + ); + + appInfoElemDecl->setCreateReason(XMLElementDecl::Declared); + appInfoElemDecl->setAttWildCard + ( + new (memMgr) SchemaAttDef + ( + XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, + fEmptyNamespaceURI, XMLAttDef::Any_Any, + XMLAttDef::ProcessContents_Lax, memMgr + ) + ); + grammar->putElemDecl(appInfoElemDecl); + complexType->addElement(appInfoElemDecl); + + SchemaElementDecl* docElemDecl = new (memMgr) SchemaElementDecl + ( + XMLUni::fgZeroLenString , SchemaSymbols::fgELT_DOCUMENTATION + , fURIStringPool->addOrFind(SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + , SchemaElementDecl::Any, Grammar::TOP_LEVEL_SCOPE , memMgr + ); + + docElemDecl->setCreateReason(XMLElementDecl::Declared); + docElemDecl->setAttWildCard + ( + new (memMgr) SchemaAttDef + ( + XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, + fEmptyNamespaceURI, XMLAttDef::Any_Any, + XMLAttDef::ProcessContents_Lax, memMgr + ) + ); + grammar->putElemDecl(docElemDecl); + complexType->addElement(docElemDecl); + + ContentSpecNode* left = new (memMgr) ContentSpecNode(appInfoElemDecl, memMgr); + ContentSpecNode* right = new (memMgr) ContentSpecNode(docElemDecl, memMgr); + ContentSpecNode* root = new (memMgr) ContentSpecNode(ContentSpecNode::ModelGroupChoice + , left + , right + , true + , true + , memMgr); + root->setMinOccurs(0); + root->setMaxOccurs(SchemaSymbols::XSD_UNBOUNDED); + complexType->setContentSpec(root); + + // create input source to scan + MemBufInputSource* memBufIS = new (memMgr) MemBufInputSource + ( + (const XMLByte*)xsAnnot.getAnnotationString() + , XMLString::stringLen(xsAnnot.getAnnotationString())*sizeof(XMLCh) + , SchemaSymbols::fgELT_ANNOTATION + , false + , memMgr + ); + Janitor janMemBuf(memBufIS); + memBufIS->setEncoding(XMLUni::fgXMLChEncodingString); + memBufIS->setCopyBufToStream(false); + + XSAXMLScanner *scanner = new (memMgr) XSAXMLScanner + ( + fGrammarResolver, fURIStringPool, grammar, memMgr + ); + Janitor janScanner(scanner); + + AnnotationErrorReporter annErrReporter(fErrorReporter); + scanner->setErrorReporter(&annErrReporter); + + XMLFileLoc line, col; + xsAnnot.getLineCol(line, col); + annErrReporter.setSystemIdAndPosition(xsAnnot.getSystemId(), line, col); + scanner->scanDocument(*memBufIS); + + nextAnnot = xsAnnot.getNext(); + + while (nextAnnot || xsAnnotationEnum.hasMoreElements()) + { + if (nextAnnot) { + memBufIS->resetMemBufInputSource((const XMLByte*)nextAnnot->getAnnotationString() + , XMLString::stringLen(nextAnnot->getAnnotationString())*sizeof(XMLCh)); + nextAnnot->getLineCol(line, col); + annErrReporter.setSystemIdAndPosition(nextAnnot->getSystemId(), line, col); + nextAnnot = nextAnnot->getNext(); + } + else { + XSAnnotation& xsAnnot = xsAnnotationEnum.nextElement(); + memBufIS->resetMemBufInputSource((const XMLByte*)xsAnnot.getAnnotationString() + , XMLString::stringLen(xsAnnot.getAnnotationString())*sizeof(XMLCh)); + xsAnnot.getLineCol(line, col); + annErrReporter.setSystemIdAndPosition(xsAnnot.getSystemId(), line, col); + nextAnnot = xsAnnot.getNext(); + } + scanner->scanDocument(*memBufIS); + } + +} + +const XMLCh* TraverseSchema::getElementAttValue(const DOMElement* const elem, + const XMLCh* const attName, + const DatatypeValidator::ValidatorType attType /* = UnKnown */) { + + DOMAttr* attNode = elem->getAttributeNode(attName); + + if (attNode == 0) { + return 0; + } + + const XMLCh* attValue = attNode->getValue(); + + if (attType < DatatypeValidator::ID) { + static bool bInitialized = false; + static short wsFacets[DatatypeValidator::ID] = {0}; + if(!bInitialized) + { + bInitialized=true; + DVHashTable* registry = DatatypeValidatorFactory::getBuiltInRegistry(); + wsFacets[DatatypeValidator::String] = registry->get(SchemaSymbols::fgDT_STRING)->getWSFacet(); + wsFacets[DatatypeValidator::AnyURI] = registry->get(SchemaSymbols::fgDT_ANYURI)->getWSFacet(); + wsFacets[DatatypeValidator::QName] = registry->get(SchemaSymbols::fgDT_QNAME)->getWSFacet(); + wsFacets[DatatypeValidator::Name] = registry->get(SchemaSymbols::fgDT_NAME)->getWSFacet(); + wsFacets[DatatypeValidator::NCName] = registry->get(SchemaSymbols::fgDT_NCNAME)->getWSFacet(); + wsFacets[DatatypeValidator::Boolean] = registry->get(SchemaSymbols::fgDT_BOOLEAN)->getWSFacet(); + wsFacets[DatatypeValidator::Float] = registry->get(SchemaSymbols::fgDT_FLOAT)->getWSFacet(); + wsFacets[DatatypeValidator::Double] = registry->get(SchemaSymbols::fgDT_DOUBLE)->getWSFacet(); + wsFacets[DatatypeValidator::Decimal] = registry->get(SchemaSymbols::fgDT_DECIMAL)->getWSFacet(); + wsFacets[DatatypeValidator::HexBinary] = registry->get(SchemaSymbols::fgDT_HEXBINARY)->getWSFacet(); + wsFacets[DatatypeValidator::Base64Binary]= registry->get(SchemaSymbols::fgDT_BASE64BINARY)->getWSFacet(); + wsFacets[DatatypeValidator::Duration] = registry->get(SchemaSymbols::fgDT_DURATION)->getWSFacet(); + wsFacets[DatatypeValidator::DateTime] = registry->get(SchemaSymbols::fgDT_DATETIME)->getWSFacet(); + wsFacets[DatatypeValidator::Date] = registry->get(SchemaSymbols::fgDT_DATE)->getWSFacet(); + wsFacets[DatatypeValidator::Time] = registry->get(SchemaSymbols::fgDT_TIME)->getWSFacet(); + wsFacets[DatatypeValidator::MonthDay] = registry->get(SchemaSymbols::fgDT_MONTHDAY)->getWSFacet(); + wsFacets[DatatypeValidator::YearMonth] = registry->get(SchemaSymbols::fgDT_YEARMONTH)->getWSFacet(); + wsFacets[DatatypeValidator::Year] = registry->get(SchemaSymbols::fgDT_YEAR)->getWSFacet(); + wsFacets[DatatypeValidator::Month] = registry->get(SchemaSymbols::fgDT_MONTH)->getWSFacet(); + wsFacets[DatatypeValidator::Day] = registry->get(SchemaSymbols::fgDT_DAY)->getWSFacet(); + } + short wsFacet = wsFacets[attType]; + if((wsFacet == DatatypeValidator::REPLACE && !XMLString::isWSReplaced(attValue)) || + (wsFacet == DatatypeValidator::COLLAPSE && !XMLString::isWSCollapsed(attValue))) + { + XMLCh* normalizedValue=XMLString::replicate(attValue, fMemoryManager); + ArrayJanitor tempName(normalizedValue, fMemoryManager); + if(wsFacet == DatatypeValidator::REPLACE) + XMLString::replaceWS(normalizedValue, fMemoryManager); + else if(wsFacet == DatatypeValidator::COLLAPSE) + XMLString::collapseWS(normalizedValue, fMemoryManager); + if (!*normalizedValue) + return XMLUni::fgZeroLenString; + return fStringPool->getValueForId(fStringPool->addOrFind(normalizedValue)); + } + } + + return attValue; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file TraverseSchema.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.hpp b/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.hpp new file mode 100644 index 000000000..9fad4345f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/TraverseSchema.hpp @@ -0,0 +1,925 @@ +/* + * 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: TraverseSchema.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_TRAVERSESCHEMA_HPP) +#define XERCESC_INCLUDE_GUARD_TRAVERSESCHEMA_HPP + +/** + * Instances of this class get delegated to Traverse the Schema and + * to populate the SchemaGrammar internal representation. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class GrammarResolver; +class XMLEntityHandler; +class XMLScanner; +class DatatypeValidator; +class DatatypeValidatorFactory; +class QName; +class ComplexTypeInfo; +class XMLAttDef; +class NamespaceScope; +class SchemaAttDef; +class InputSource; +class XercesGroupInfo; +class XercesAttGroupInfo; +class IdentityConstraint; +class XSDLocator; +class XSDDOMParser; +class XMLErrorReporter; + + +class VALIDATORS_EXPORT TraverseSchema : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors/Destructor + // ----------------------------------------------------------------------- + TraverseSchema + ( + DOMElement* const schemaRoot + , XMLStringPool* const uriStringPool + , SchemaGrammar* const schemaGrammar + , GrammarResolver* const grammarResolver + , RefHash2KeysTableOf* cachedSchemaInfoList + , RefHash2KeysTableOf* schemaInfoList + , XMLScanner* const xmlScanner + , const XMLCh* const schemaURL + , XMLEntityHandler* const entityHandler + , XMLErrorReporter* const errorReporter + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , bool multipleImport = false + ); + + ~TraverseSchema(); + +private: + // This enumeration is defined here for compatibility with the CodeWarrior + // compiler, which apparently doesn't like to accept default parameter + // arguments that it hasn't yet seen. The Not_All_Context argument is + // used in the declaration of checkMinMax, below. + // + // Flags indicate any special restrictions on minOccurs and maxOccurs + // relating to "all". + // Not_All_Context - not processing an + // All_Element - processing an in an + // Group_Ref_With_All - processing reference that contained + // All_Group - processing an group itself + enum + { + Not_All_Context = 0 + , All_Element = 1 + , Group_Ref_With_All = 2 + , All_Group = 4 + }; + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + TraverseSchema(const TraverseSchema&); + TraverseSchema& operator=(const TraverseSchema&); + + // ----------------------------------------------------------------------- + // Init/CleanUp methods + // ----------------------------------------------------------------------- + void init(); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Traversal methods + // ----------------------------------------------------------------------- + /** + * Traverse the Schema DOM tree + */ + void doTraverseSchema(const DOMElement* const schemaRoot); + void preprocessSchema(DOMElement* const schemaRoot, + const XMLCh* const schemaURL, + bool multipleImport = false); + void traverseSchemaHeader(const DOMElement* const schemaRoot); + XSAnnotation* traverseAnnotationDecl(const DOMElement* const childElem, + ValueVectorOf* const nonXSAttList, + const bool topLevel = false); + void traverseInclude(const DOMElement* const childElem); + void traverseImport(const DOMElement* const childElem); + void traverseRedefine(const DOMElement* const childElem); + void traverseAttributeDecl(const DOMElement* const childElem, + ComplexTypeInfo* const typeInfo, + const bool topLevel = false); + void traverseSimpleContentDecl(const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const DOMElement* const contentDecl, + ComplexTypeInfo* const typeInfo, + Janitor* const janAnnot); + void traverseComplexContentDecl(const XMLCh* const typeName, + const DOMElement* const contentDecl, + ComplexTypeInfo* const typeInfo, + const bool isMixed, + Janitor* const janAnnot); + DatatypeValidator* traverseSimpleTypeDecl(const DOMElement* const childElem, + const bool topLevel = true, + int baseRefContext = SchemaSymbols::XSD_EMPTYSET); + int traverseComplexTypeDecl(const DOMElement* const childElem, + const bool topLevel = true, + const XMLCh* const recursingTypeName = 0); + DatatypeValidator* traverseByList(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + Janitor* const janAnnot); + DatatypeValidator* traverseByRestriction(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + Janitor* const janAnnot); + DatatypeValidator* traverseByUnion(const DOMElement* const rootElem, + const DOMElement* const contentElem, + const XMLCh* const typeName, + const XMLCh* const qualifiedName, + const int finalSet, + int baseRefContext, + Janitor* const janAnnot); + SchemaElementDecl* traverseElementDecl(const DOMElement* const childElem, + const bool topLevel = false); + const XMLCh* traverseNotationDecl(const DOMElement* const childElem); + const XMLCh* traverseNotationDecl(const DOMElement* const childElem, + const XMLCh* const name, + const XMLCh* const uriStr); + ContentSpecNode* traverseChoiceSequence(const DOMElement* const elemDecl, + const int modelGroupType, + bool& hasChildren); + ContentSpecNode* traverseAny(const DOMElement* const anyDecl); + ContentSpecNode* traverseAll(const DOMElement* const allElem, + bool& hasChildren); + XercesGroupInfo* traverseGroupDecl(const DOMElement* const childElem, + const bool topLevel = true); + XercesAttGroupInfo* traverseAttributeGroupDecl(const DOMElement* const elem, + ComplexTypeInfo* const typeInfo, + const bool topLevel = false); + XercesAttGroupInfo* traverseAttributeGroupDeclNS(const DOMElement* const elem, + const XMLCh* const uriStr, + const XMLCh* const name); + SchemaAttDef* traverseAnyAttribute(const DOMElement* const elem); + void traverseKey(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl); + void traverseUnique(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl); + void traverseKeyRef(const DOMElement* const icElem, + SchemaElementDecl* const elemDecl); + bool traverseIdentityConstraint(IdentityConstraint* const ic, + const DOMElement* const icElem); + + // ----------------------------------------------------------------------- + // Error Reporting methods + // ----------------------------------------------------------------------- + void reportSchemaError(const XSDLocator* const aLocator, + const XMLCh* const msgDomain, + const int errorCode); + void reportSchemaError(const XSDLocator* const aLocator, + const XMLCh* const msgDomain, + const int errorCode, + const XMLCh* const text1, + const XMLCh* const text2 = 0, + const XMLCh* const text3 = 0, + const XMLCh* const text4 = 0); + void reportSchemaError(const DOMElement* const elem, + const XMLCh* const msgDomain, + const int errorCode); + void reportSchemaError(const DOMElement* const elem, + const XMLCh* const msgDomain, + const int errorCode, + const XMLCh* const text1, + const XMLCh* const text2 = 0, + const XMLCh* const text3 = 0, + const XMLCh* const text4 = 0); + void reportSchemaError(const DOMElement* const elem, + const XMLException& except); + + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + /** + * Keep track of the xs:import found + */ + bool isImportingNS(const int namespaceURI); + void addImportedNS(const int namespaceURI); + + /** + * Retrieved the Namespace mapping from the schema element + */ + bool retrieveNamespaceMapping(const DOMElement* const elem); + + /** + * Loop through the children, and traverse the corresponding schema type + * type declaration (simpleType, complexType, import, ....) + */ + void processChildren(const DOMElement* const root); + void preprocessChildren(const DOMElement* const root); + + void preprocessImport(const DOMElement* const elemNode); + void preprocessInclude(const DOMElement* const elemNode); + void preprocessRedefine(const DOMElement* const elemNode); + + /** + * Parameters: + * rootElem - top element for a given type declaration + * contentElem - content must be annotation? or some other simple content + * isEmpty: - true if (annotation?, smth_else), false if (annotation?) + * processAnnot - default is true, false if reprocessing a complex type + * since we have already processed the annotation. + * + * Check for Annotation if it is present, traverse it. If a sibling is + * found and it is not an annotation return it, otherwise return 0. + * Used by traverseSimpleTypeDecl. + */ + DOMElement* checkContent(const DOMElement* const rootElem, + DOMElement* const contentElem, + const bool isEmpty, bool processAnnot = true); + + /** + * Parameters: + * contentElem - content element to check + * + * Check for identity constraints content. + */ + const DOMElement* checkIdentityConstraintContent(const DOMElement* const contentElem); + + DatatypeValidator* getDatatypeValidator(const XMLCh* const uriStr, + const XMLCh* const localPartStr); + + /** + * Process simpleType content of a list|restriction|union + * Return a dataype validator if valid type, otherwise 0. + */ + DatatypeValidator* checkForSimpleTypeValidator(const DOMElement* const content, + int baseRefContext = SchemaSymbols::XSD_EMPTYSET); + + /** + * Process complexType content of an element + * Return a ComplexTypeInfo if valid type, otherwise 0. + */ + ComplexTypeInfo* checkForComplexTypeInfo(const DOMElement* const content); + + /** + * Return DatatypeValidator available for the baseTypeStr. + */ + DatatypeValidator* findDTValidator(const DOMElement* const elem, + const XMLCh* const derivedTypeName, + const XMLCh* const baseTypeName, + const int baseRefContext); + + const XMLCh* resolvePrefixToURI(const DOMElement* const elem, + const XMLCh* const prefix); + + /** + * Return the prefix for a given rawname string + * + * Function allocated, caller managed (facm) - pointer to be deleted by + * caller. + */ + const XMLCh* getPrefix(const XMLCh* const rawName); + + /** + * Return the local for a given rawname string + * + * caller allocated, caller managed (cacm) + */ + const XMLCh* getLocalPart(const XMLCh* const rawName); + + /** + * Process a 'ref' of an Element declaration + */ + SchemaElementDecl* processElementDeclRef(const DOMElement* const elem, + const XMLCh* const refName); + void processElemDeclAttrs(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + const XMLCh*& valConstraint, + bool isTopLevel = false); + void processElemDeclIC(DOMElement* const elem, + SchemaElementDecl* const elemDecl); + bool checkElemDeclValueConstraint(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + const XMLCh* const valConstraint, + ComplexTypeInfo* const typeInfo, + DatatypeValidator* const validator); + + /** + * Process a 'ref' of an Attribute declaration + */ + void processAttributeDeclRef(const DOMElement* const elem, + ComplexTypeInfo* const typeInfo, + const XMLCh* const refName, + const XMLCh* const useVal, + const XMLCh* const defaultVal, + const XMLCh* const fixedVal); + + /** + * Process a 'ref' on a group + */ + XercesGroupInfo* processGroupRef(const DOMElement* const elem, + const XMLCh* const refName); + + /** + * Process a 'ref' on a attributeGroup + */ + XercesAttGroupInfo* processAttributeGroupRef(const DOMElement* const elem, + const XMLCh* const refName, + ComplexTypeInfo* const typeInfo); + + /** + * Parse block & final items + */ + int parseBlockSet(const DOMElement* const elem, const int blockType, const bool isRoot = false); + int parseFinalSet(const DOMElement* const elem, const int finalType, const bool isRoot = false); + + /** + * Return true if a name is an identity constraint, otherwise false + */ + bool isIdentityConstraintName(const XMLCh* const constraintName); + + /** + * If 'typeStr' belongs to a different schema, return that schema URI, + * otherwise return 0; + */ + const XMLCh* checkTypeFromAnotherSchema(const DOMElement* const elem, + const XMLCh* const typeStr); + + /** + * Return the datatype validator for a given element type attribute if + * the type is a simple type + */ + DatatypeValidator* getElementTypeValidator(const DOMElement* const elem, + const XMLCh* const typeStr, + bool& noErrorDetected, + const XMLCh* const otherSchemaURI); + + /** + * Return the complexType info for a given element type attribute if + * the type is a complex type + */ + ComplexTypeInfo* getElementComplexTypeInfo(const DOMElement* const elem, + const XMLCh* const typeStr, + const XMLCh* const otherSchemaURI); + + /** + * Return global schema element declaration for a given element name + */ + SchemaElementDecl* getGlobalElemDecl(const DOMElement* const elem, + const XMLCh* const name); + + /** + * Check validity constraint of a substitutionGroup attribute in + * an element declaration + */ + bool isSubstitutionGroupValid(const DOMElement* const elem, + const SchemaElementDecl* const elemDecl, + const ComplexTypeInfo* const typeInfo, + const DatatypeValidator* const validator, + const XMLCh* const elemName, + const bool toEmit = true); + + bool isSubstitutionGroupCircular(SchemaElementDecl* const elemDecl, + SchemaElementDecl* const subsElemDecl); + + void processSubstitutionGroup(const DOMElement* const elem, + SchemaElementDecl* const elemDecl, + ComplexTypeInfo*& typeInfo, + DatatypeValidator*& validator, + const XMLCh* const subsElemQName); + + /** + * Create a 'SchemaElementDecl' object and add it to SchemaGrammar + */ + SchemaElementDecl* createSchemaElementDecl(const DOMElement* const elem, + const XMLCh* const name, + bool& isDuplicate, + const XMLCh*& valConstraint, + const bool topLevel); + + /** + * Return the value of a given attribute name from an element node + */ + const XMLCh* getElementAttValue(const DOMElement* const elem, + const XMLCh* const attName, + const DatatypeValidator::ValidatorType attType = DatatypeValidator::UnKnown); + + /* return minOccurs */ + int checkMinMax(ContentSpecNode* const specNode, + const DOMElement* const elem, + const int allContext = Not_All_Context); + + /** + * Process complex content for a complexType + */ + void processComplexContent(const DOMElement* const elem, + const XMLCh* const typeName, + const DOMElement* const childElem, + ComplexTypeInfo* const typeInfo, + const XMLCh* const baseLocalPart, + const bool isMixed, + const bool isBaseAnyType = false); + + /** + * Process "base" information for a complexType + */ + void processBaseTypeInfo(const DOMElement* const elem, + const XMLCh* const baseName, + const XMLCh* const localPart, + const XMLCh* const uriStr, + ComplexTypeInfo* const typeInfo); + + /** + * Check if base is from another schema + */ + bool isBaseFromAnotherSchema(const XMLCh* const baseURI); + + /** + * Get complexType infp from another schema + */ + ComplexTypeInfo* getTypeInfoFromNS(const DOMElement* const elem, + const XMLCh* const uriStr, + const XMLCh* const localPart); + + DatatypeValidator* + getAttrDatatypeValidatorNS(const DOMElement* const elem, + const XMLCh* localPart, + const XMLCh* typeURI); + + /** + * Returns true if a DOM Element is an attribute or attribute group + */ + bool isAttrOrAttrGroup(const DOMElement* const elem); + + /** + * Process attributes of a complex type + */ + void processAttributes(const DOMElement* const elem, + const DOMElement* const attElem, + ComplexTypeInfo* const typeInfo, + const bool isBaseAnyType = false); + + /** + * Generate a name for an anonymous type + */ + const XMLCh* genAnonTypeName(const XMLCh* const prefix); + + void defaultComplexTypeInfo(ComplexTypeInfo* const typeInfo); + + /** + * Resolve a schema location attribute value to an input source. + * Caller to delete the returned object. + */ + InputSource* resolveSchemaLocation + ( + const XMLCh* const loc + , const XMLResourceIdentifier::ResourceIdentifierType resourceIdentitiferType + , const XMLCh* const nameSpace=0 + ); + + void restoreSchemaInfo(SchemaInfo* const toRestore, + SchemaInfo::ListType const aListType = SchemaInfo::INCLUDE, + const unsigned int saveScope = Grammar::TOP_LEVEL_SCOPE); + void popCurrentTypeNameStack(); + + /** + * Check whether a mixed content is emptiable or not. + * Needed to validate element constraint values (defualt, fixed) + */ + bool emptiableParticle(const ContentSpecNode* const specNode); + + void checkFixedFacet(const DOMElement* const, const XMLCh* const, + const DatatypeValidator* const, unsigned int&); + void buildValidSubstitutionListF(const DOMElement* const elem, + SchemaElementDecl* const, + SchemaElementDecl* const); + void buildValidSubstitutionListB(const DOMElement* const elem, + SchemaElementDecl* const, + SchemaElementDecl* const); + + void checkEnumerationRequiredNotation(const DOMElement* const elem, + const XMLCh* const name, + const XMLCh* const typeStr); + + void processElements(const DOMElement* const elem, + ComplexTypeInfo* const baseTypeInfo, + ComplexTypeInfo* const newTypeInfo); + + void processElements(const DOMElement* const elem, + XercesGroupInfo* const fromGroup, + ComplexTypeInfo* const typeInfo); + + void copyGroupElements(const DOMElement* const elem, + XercesGroupInfo* const fromGroup, + XercesGroupInfo* const toGroup, + ComplexTypeInfo* const typeInfo); + + void copyAttGroupAttributes(const DOMElement* const elem, + XercesAttGroupInfo* const fromAttGroup, + XercesAttGroupInfo* const toAttGroup, + ComplexTypeInfo* const typeInfo); + + void checkForEmptyTargetNamespace(const DOMElement* const elem); + + /** + * Attribute wild card intersection. + * + * Note: + * The first parameter will be the result of the intersection, so + * we need to make sure that first parameter is a copy of the + * actual attribute definition we need to intersect with. + * + * What we need to wory about is: type, defaultType, namespace, + * and URI. All remaining data members should be the same. + */ + void attWildCardIntersection(SchemaAttDef* const resultWildCart, + const SchemaAttDef* const toCompareWildCard); + + /** + * Attribute wild card union. + * + * Note: + * The first parameter will be the result of the union, so + * we need to make sure that first parameter is a copy of the + * actual attribute definition we need to intersect with. + * + * What we need to wory about is: type, defaultType, namespace, + * and URI. All remaining data members should be the same. + */ + void attWildCardUnion(SchemaAttDef* const resultWildCart, + const SchemaAttDef* const toCompareWildCard); + + void copyWildCardData(const SchemaAttDef* const srcWildCard, + SchemaAttDef* const destWildCard); + + /** + * Check that the attributes of a type derived by restriction satisfy + * the constraints of derivation valid restriction + */ + void checkAttDerivationOK(const DOMElement* const elem, + const ComplexTypeInfo* const baseTypeInfo, + const ComplexTypeInfo* const childTypeInfo); + void checkAttDerivationOK(const DOMElement* const elem, + const XercesAttGroupInfo* const baseAttGrpInfo, + const XercesAttGroupInfo* const childAttGrpInfo); + + /** + * Check whether a namespace value is valid with respect to wildcard + * constraint + */ + bool wildcardAllowsNamespace(const SchemaAttDef* const baseAttWildCard, + const unsigned int nameURI); + + /** + * Check whether a namespace constraint is an intensional subset of + * another namespace constraint + */ + bool isWildCardSubset(const SchemaAttDef* const baseAttWildCard, + const SchemaAttDef* const childAttWildCard); + + bool openRedefinedSchema(const DOMElement* const redefineElem); + + /** + * The purpose of this method is twofold: + * 1. To find and appropriately modify all information items + * in redefinedSchema with names that are redefined by children of + * redefineElem. + * 2. To make sure the redefine element represented by + * redefineElem is valid as far as content goes and with regard to + * properly referencing components to be redefined. + * + * No traversing is done here! + * This method also takes actions to find and, if necessary, modify + * the names of elements in 's in the schema that's being + * redefined. + */ + void renameRedefinedComponents(const DOMElement* const redefineElem, + SchemaInfo* const redefiningSchemaInfo, + SchemaInfo* const redefinedSchemaInfo); + + /** + * This method returns true if the redefine component is valid, and if + * it was possible to revise it correctly. + */ + bool validateRedefineNameChange(const DOMElement* const redefineChildElem, + const XMLCh* const redefineChildElemName, + const XMLCh* const redefineChildDeclName, + const int redefineNameCounter, + SchemaInfo* const redefiningSchemaInfo); + + /** + * This function looks among the children of 'redefineChildElem' for a + * component of type 'redefineChildComponentName'. If it finds one, it + * evaluates whether its ref attribute contains a reference to + * 'refChildTypeName'. If it does, it returns 1 + the value returned by + * calls to itself on all other children. In all other cases it returns + * 0 plus the sum of the values returned by calls to itself on + * redefineChildElem's children. It also resets the value of ref so that + * it will refer to the renamed type from the schema being redefined. + */ + int changeRedefineGroup(const DOMElement* const redefineChildElem, + const XMLCh* const redefineChildComponentName, + const XMLCh* const redefineChildTypeName, + const int redefineNameCounter); + + /** This simple function looks for the first occurrence of a + * 'redefineChildTypeName' item in the redefined schema and appropriately + * changes the value of its name. If it turns out that what we're looking + * for is in a though, then we just rename it--and it's + * reference--to be the same. + */ + void fixRedefinedSchema(const DOMElement* const elem, + SchemaInfo* const redefinedSchemaInfo, + const XMLCh* const redefineChildComponentName, + const XMLCh* const redefineChildTypeName, + const int redefineNameCounter); + + void getRedefineNewTypeName(const XMLCh* const oldTypeName, + const int redefineCounter, + XMLBuffer& newTypeName); + + /** + * This purpose of this method is threefold: + * 1. To extract the schema information of included/redefined schema. + * 2. Rename redefined components. + * 3. Process components of included/redefined schemas + */ + void preprocessRedefineInclude(SchemaInfo* const currSchemaInfo); + + /** + * Update the list of valid substitution groups in the case of circular + * import. + */ + void updateCircularSubstitutionList(SchemaInfo* const aSchemaInfo); + + void processKeyRefFor(SchemaInfo* const aSchemaInfo, + ValueVectorOf* const infoList); + + void processAttValue(const XMLCh* const attVal, XMLBuffer& aBuf); + + // routine to generate synthetic annotations + XSAnnotation* generateSyntheticAnnotation(const DOMElement* const elem + , ValueVectorOf* nonXSAttList); + + // routine to validate annotations + void validateAnnotations(); + + // ----------------------------------------------------------------------- + // Private constants + // ----------------------------------------------------------------------- + enum + { + ES_Block + , C_Block + , S_Final + , EC_Final + , ECS_Final + }; + + enum ExceptionCodes + { + NoException = 0, + InvalidComplexTypeInfo = 1, + RecursingElement = 2 + }; + + enum + { + Elem_Def_Qualified = 1, + Attr_Def_Qualified = 2 + }; + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fFullConstraintChecking; + int fTargetNSURI; + int fEmptyNamespaceURI; + unsigned int fCurrentScope; + unsigned int fScopeCount; + unsigned int fAnonXSTypeCount; + XMLSize_t fCircularCheckIndex; + const XMLCh* fTargetNSURIString; + DatatypeValidatorFactory* fDatatypeRegistry; + GrammarResolver* fGrammarResolver; + SchemaGrammar* fSchemaGrammar; + XMLEntityHandler* fEntityHandler; + XMLErrorReporter* fErrorReporter; + XMLStringPool* fURIStringPool; + XMLStringPool* fStringPool; + XMLBuffer fBuffer; + XMLScanner* fScanner; + RefHashTableOf* fAttributeDeclRegistry; + RefHashTableOf* fComplexTypeRegistry; + RefHashTableOf* fGroupRegistry; + RefHashTableOf* fAttGroupRegistry; + RefHashTableOf* fIC_ElementsNS; + RefHashTableOf* fPreprocessedNodes; + SchemaInfo* fSchemaInfo; + XercesGroupInfo* fCurrentGroupInfo; + XercesAttGroupInfo* fCurrentAttGroupInfo; + ComplexTypeInfo* fCurrentComplexType; + ValueVectorOf* fCurrentTypeNameStack; + ValueVectorOf* fCurrentGroupStack; + ValueVectorOf* fIC_Elements; + ValueVectorOf* fDeclStack; + ValueVectorOf** fGlobalDeclarations; + ValueVectorOf* fNonXSAttList; + ValueVectorOf* fImportedNSList; + RefHashTableOf, PtrHasher>* fIC_NodeListNS; + RefHash2KeysTableOf* fNotationRegistry; + RefHash2KeysTableOf* fRedefineComponents; + RefHash2KeysTableOf* fIdentityConstraintNames; + RefHash2KeysTableOf* fValidSubstitutionGroups; + RefHash2KeysTableOf* fSchemaInfoList; + RefHash2KeysTableOf* fCachedSchemaInfoList; + XSDDOMParser* fParser; + XSDErrorReporter fXSDErrorReporter; + XSDLocator* fLocator; + MemoryManager* fMemoryManager; + MemoryManager* fGrammarPoolMemoryManager; + XSAnnotation* fAnnotation; + GeneralAttributeCheck fAttributeCheck; + + friend class GeneralAttributeCheck; + friend class NamespaceScopeManager; +}; + + +// --------------------------------------------------------------------------- +// TraverseSchema: Helper methods +// --------------------------------------------------------------------------- +inline const XMLCh* TraverseSchema::getPrefix(const XMLCh* const rawName) { + + int colonIndex = XMLString::indexOf(rawName, chColon); + + if (colonIndex == -1 || colonIndex == 0) { + return XMLUni::fgZeroLenString; + } + + fBuffer.set(rawName, colonIndex); + + return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer())); +} + +inline const XMLCh* TraverseSchema::getLocalPart(const XMLCh* const rawName) { + + int colonIndex = XMLString::indexOf(rawName, chColon); + XMLSize_t rawNameLen = XMLString::stringLen(rawName); + + if (XMLSize_t(colonIndex + 1) == rawNameLen) { + return XMLUni::fgZeroLenString; + } + + if (colonIndex == -1) { + fBuffer.set(rawName, rawNameLen); + } + else { + + fBuffer.set(rawName + colonIndex + 1, rawNameLen - colonIndex - 1); + } + + return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer())); +} + +inline void +TraverseSchema::checkForEmptyTargetNamespace(const DOMElement* const elem) { + + const XMLCh* targetNS = getElementAttValue(elem, SchemaSymbols::fgATT_TARGETNAMESPACE); + + if (targetNS && !*targetNS) { + reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidTargetNSValue); + } +} + +inline bool TraverseSchema::isBaseFromAnotherSchema(const XMLCh* const baseURI) +{ + if (!XMLString::equals(baseURI,fTargetNSURIString) + && !XMLString::equals(baseURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) + && (baseURI && *baseURI)) { + //REVISIT, !!!! a hack: for schema that has no + //target namespace, e.g. personal-schema.xml + return true; + } + + return false; +} + +inline bool TraverseSchema::isAttrOrAttrGroup(const DOMElement* const elem) { + + const XMLCh* elementName = elem->getLocalName(); + + if (XMLString::equals(elementName, SchemaSymbols::fgELT_ATTRIBUTE) || + XMLString::equals(elementName, SchemaSymbols::fgELT_ATTRIBUTEGROUP) || + XMLString::equals(elementName, SchemaSymbols::fgELT_ANYATTRIBUTE)) { + return true; + } + + return false; +} + +inline const XMLCh* TraverseSchema::genAnonTypeName(const XMLCh* const prefix) { + + XMLCh anonCountStr[16]; // a count of 15 digits should be enough + + XMLString::sizeToText(fAnonXSTypeCount++, anonCountStr, 15, 10, fMemoryManager); + fBuffer.set(prefix); + fBuffer.append(anonCountStr); + + return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer())); +} + +inline void TraverseSchema::popCurrentTypeNameStack() { + + XMLSize_t stackSize = fCurrentTypeNameStack->size(); + + if (stackSize != 0) { + fCurrentTypeNameStack->removeElementAt(stackSize - 1); + } +} + +inline void +TraverseSchema::copyWildCardData(const SchemaAttDef* const srcWildCard, + SchemaAttDef* const destWildCard) { + + destWildCard->getAttName()->setURI(srcWildCard->getAttName()->getURI()); + destWildCard->setType(srcWildCard->getType()); + destWildCard->setDefaultType(srcWildCard->getDefaultType()); +} + +inline void TraverseSchema::getRedefineNewTypeName(const XMLCh* const oldTypeName, + const int redefineCounter, + XMLBuffer& newTypeName) { + + newTypeName.set(oldTypeName); + + for (int i=0; i < redefineCounter; i++) { + newTypeName.append(SchemaSymbols::fgRedefIdentifier); + } +} + +inline bool TraverseSchema::isImportingNS(const int namespaceURI) { + + if (!fImportedNSList) + return false; + + return (fImportedNSList->containsElement(namespaceURI)); +} + +inline void TraverseSchema::addImportedNS(const int namespaceURI) { + + if (!fImportedNSList) { + fImportedNSList = new (fMemoryManager) ValueVectorOf(4, fMemoryManager); + } + + if (!fImportedNSList->containsElement(namespaceURI)) + fImportedNSList->addElement(namespaceURI); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file TraverseSchema.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp b/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp new file mode 100644 index 000000000..336927254 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp @@ -0,0 +1,235 @@ +/* + * 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: XMLSchemaDescriptionImpl.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XMLSchemaDescriptionImpl: constructor and destructor +// --------------------------------------------------------------------------- +XMLSchemaDescriptionImpl::XMLSchemaDescriptionImpl(const XMLCh* const targetNamespace + , MemoryManager* const memMgr) +:XMLSchemaDescription(memMgr) +,fContextType(CONTEXT_UNKNOWN) +,fNamespace(0) +,fLocationHints(0) +,fTriggeringComponent(0) +,fEnclosingElementName(0) +,fAttributes(0) +{ + if (targetNamespace) + fNamespace = XMLString::replicate(targetNamespace, memMgr); + + + fLocationHints = new (memMgr) RefArrayVectorOf(4, true, memMgr); + + /*** + fAttributes + ***/ +} + +XMLSchemaDescriptionImpl::~XMLSchemaDescriptionImpl() +{ + if (fNamespace) + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fNamespace); + + if (fLocationHints) + delete fLocationHints; + + if (fTriggeringComponent) + delete fTriggeringComponent; + + if (fEnclosingElementName) + delete fEnclosingElementName; + +} + +const XMLCh* XMLSchemaDescriptionImpl::getGrammarKey() const +{ + return getTargetNamespace(); +} + +XMLSchemaDescription::ContextType XMLSchemaDescriptionImpl::getContextType() const +{ + return fContextType; +} + +const XMLCh* XMLSchemaDescriptionImpl::getTargetNamespace() const +{ + return fNamespace; +} + +const RefArrayVectorOf* XMLSchemaDescriptionImpl::getLocationHints() const +{ + return fLocationHints; +} + +const QName* XMLSchemaDescriptionImpl::getTriggeringComponent() const +{ + return fTriggeringComponent; +} + +const QName* XMLSchemaDescriptionImpl::getEnclosingElementName() const +{ + return fEnclosingElementName; +} + +const XMLAttDef* XMLSchemaDescriptionImpl::getAttributes() const +{ + return fAttributes; +} + +void XMLSchemaDescriptionImpl::setContextType(ContextType type) +{ + fContextType = type; +} + +void XMLSchemaDescriptionImpl::setTargetNamespace(const XMLCh* const newNamespace) +{ + if (fNamespace) { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fNamespace); + fNamespace = 0; + } + + fNamespace = XMLString::replicate(newNamespace, XMLGrammarDescription::getMemoryManager()); +} + +void XMLSchemaDescriptionImpl::setLocationHints(const XMLCh* const hint) +{ + fLocationHints->addElement(XMLString::replicate(hint, XMLGrammarDescription::getMemoryManager())); +} + +void XMLSchemaDescriptionImpl::setTriggeringComponent(QName* const trigComponent) +{ + if ( fTriggeringComponent) { + delete fTriggeringComponent; + fTriggeringComponent = 0; + } + + fTriggeringComponent = new (trigComponent->getMemoryManager()) QName(*trigComponent); + +} + +void XMLSchemaDescriptionImpl::setEnclosingElementName(QName* const encElement) +{ + if (fEnclosingElementName) { + delete fEnclosingElementName; + fEnclosingElementName = 0; + } + + fEnclosingElementName = new (encElement->getMemoryManager()) QName(*encElement); + +} + +void XMLSchemaDescriptionImpl::setAttributes(XMLAttDef* const attDefs) +{ + // XMLAttDef is part of the grammar that this description refers to + // so we reference to it instead of adopting/owning/cloning. + fAttributes = attDefs; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XMLSchemaDescriptionImpl) + +void XMLSchemaDescriptionImpl::serialize(XSerializeEngine& serEng) +{ + XMLSchemaDescription::serialize(serEng); + + if (serEng.isStoring()) + { + serEng<<(int)fContextType; + serEng.writeString(fNamespace); + + /*** + * + * Serialize RefArrayVectorOf* fLocationHints; + * + ***/ + XTemplateSerializer::storeObject(fLocationHints, serEng); + + QName* tempQName = (QName*)fTriggeringComponent; + serEng<>i; + + fContextType = (ContextType)i; + + //the original fNamespace which came from the ctor needs deallocated + if (fNamespace) + { + XMLGrammarDescription::getMemoryManager()->deallocate((void*)fNamespace); + } + serEng.readString((XMLCh*&)fNamespace); + + /*** + * + * Deserialize RefArrayVectorOf fLocationHints + * + ***/ + XTemplateSerializer::loadObject(&fLocationHints, 4, true, serEng); + + QName* tempQName; + serEng>>tempQName; + fTriggeringComponent = tempQName; + + serEng>>tempQName; + fEnclosingElementName = tempQName; + + XMLAttDef* tempAttDef; + serEng>>tempAttDef; + fAttributes=tempAttDef; + + } + +} + +XMLSchemaDescriptionImpl::XMLSchemaDescriptionImpl(MemoryManager* const memMgr) +:XMLSchemaDescription(memMgr) +,fContextType(CONTEXT_UNKNOWN) +,fNamespace(0) +,fLocationHints(0) +,fTriggeringComponent(0) +,fEnclosingElementName(0) +,fAttributes(0) +{ +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp b/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp new file mode 100644 index 000000000..96b40c4a5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp @@ -0,0 +1,185 @@ +/* + * 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: XMLSchemaDescriptionImpl.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTIONIMPL_HPP) +#define XERCESC_INCLUDE_GUARD_XMLSCHEMADESCRIPTIONIMPL_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLAttDefs; + +class XMLPARSER_EXPORT XMLSchemaDescriptionImpl : public XMLSchemaDescription +{ +public : + // ----------------------------------------------------------------------- + /** @name constructor and destructor */ + // ----------------------------------------------------------------------- + //@{ + XMLSchemaDescriptionImpl( + const XMLCh* const targetNamespace + , MemoryManager* const memMgr + ); + + ~XMLSchemaDescriptionImpl(); + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of GrammarDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + /** + * getGrammarKey + * + */ + virtual const XMLCh* getGrammarKey() const; + //@} + + // ----------------------------------------------------------------------- + /** @name Implementation of SchemaDescription Interface */ + // ----------------------------------------------------------------------- + //@{ + + /** + * getContextType + * + */ + virtual ContextType getContextType() const; + + /** + * getTargetNamespace + * + */ + virtual const XMLCh* getTargetNamespace() const; + + /** + * getLocationHints + * + */ + virtual const RefArrayVectorOf* getLocationHints() const; + + /** + * getTriggeringComponent + * + */ + virtual const QName* getTriggeringComponent() const; + + /** + * getenclosingElementName + * + */ + virtual const QName* getEnclosingElementName() const; + + /** + * getAttributes + * + */ + virtual const XMLAttDef* getAttributes() const; + + /** + * setContextType + * + */ + virtual void setContextType(ContextType); + + /** + * setTargetNamespace + * + */ + virtual void setTargetNamespace(const XMLCh* const); + + /** + * setLocationHints + * + */ + virtual void setLocationHints(const XMLCh* const); + + /** + * setTriggeringComponent + * + */ + virtual void setTriggeringComponent(QName* const); + + /** + * getenclosingElementName + * + */ + virtual void setEnclosingElementName(QName* const); + + /** + * setAttributes + * + */ + virtual void setAttributes(XMLAttDef* const); + //@} + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XMLSchemaDescriptionImpl) + + XMLSchemaDescriptionImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); + +private : + // ----------------------------------------------------------------------- + /** name Unimplemented copy constructor and operator= */ + // ----------------------------------------------------------------------- + //@{ + XMLSchemaDescriptionImpl(const XMLSchemaDescriptionImpl& ); + XMLSchemaDescriptionImpl& operator=(const XMLSchemaDescriptionImpl& ); + //@} + + // ----------------------------------------------------------------------- + // Private data members + // + // All data member in this implementation are owned to out survive + // parser. Except for fNamespace which is replicated upon set, the + // rest shall be created by the embedded memoryManager. + // + // fContextType + // + // fNamespace owned + // + // fLocationHints owned + // + // fTriggeringComponent owned + // + // fEnclosingElementName owned + // + // fAttributes referenced + // + // ----------------------------------------------------------------------- + + XMLSchemaDescription::ContextType fContextType; + const XMLCh* fNamespace; + RefArrayVectorOf* fLocationHints; + const QName* fTriggeringComponent; + const QName* fEnclosingElementName; + const XMLAttDef* fAttributes; + +}; + + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.cpp b/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.cpp new file mode 100644 index 000000000..91d46cfc9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.cpp @@ -0,0 +1,524 @@ +/* + * 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: XSDDOMParser.cpp 729944 2008-12-29 17:03:32Z amassari $ + */ + + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSDDOMParser: Constructors and Destructor +// --------------------------------------------------------------------------- +XSDDOMParser::XSDDOMParser( XMLValidator* const valToAdopt + , MemoryManager* const manager + , XMLGrammarPool* const gramPool): + XercesDOMParser(valToAdopt, manager, gramPool) + , fSawFatal(false) + , fAnnotationDepth(-1) + , fInnerAnnotationDepth(-1) + , fDepth(-1) + , fUserErrorReporter(0) + , fUserEntityHandler(0) + , fURIs(0) + , fAnnotationBuf(1023, manager) + +{ + fURIs = new (manager) ValueVectorOf(16, manager); + fXSDErrorReporter.setErrorReporter(this); + setValidationScheme(XercesDOMParser::Val_Never); + setDoNamespaces(true); +} + + +XSDDOMParser::~XSDDOMParser() +{ + delete fURIs; +} + + +// --------------------------------------------------------------------------- +// XSDDOMParser: Helper methods +// --------------------------------------------------------------------------- +DOMElement* XSDDOMParser::createElementNSNode(const XMLCh *namespaceURI, + const XMLCh *qualifiedName) +{ + ReaderMgr::LastExtEntityInfo lastInfo; + ((ReaderMgr*) fScanner->getLocator())->getLastExtEntityInfo(lastInfo); + + return getDocument()->createElementNS(namespaceURI, qualifiedName, + lastInfo.lineNumber, lastInfo.colNumber); +} + + +void XSDDOMParser::startAnnotation( const XMLElementDecl& elemDecl + , const RefVectorOf& attrList + , const XMLSize_t attrCount) +{ + fAnnotationBuf.append(chOpenAngle); + fAnnotationBuf.append(elemDecl.getFullName()); + fAnnotationBuf.append(chSpace); + + // attributes are a bit of a pain. To get this right, we have to keep track + // of the namespaces we've seen declared, then examine the namespace context + // for other namespaces so that we can also include them. + // optimized for simplicity and the case that not many + // namespaces are declared on this annotation... + fURIs->removeAllElements(); + for (XMLSize_t i=0; i < attrCount; i++) { + + const XMLAttr* oneAttrib = attrList.elementAt(i); + const XMLCh* attrValue = oneAttrib->getValue(); + + if (XMLString::equals(oneAttrib->getName(), XMLUni::fgXMLNSString)) + fURIs->addElement(fScanner->getPrefixId(XMLUni::fgZeroLenString)); + else if (!XMLString::compareNString(oneAttrib->getQName(), XMLUni::fgXMLNSColonString, 6)) + fURIs->addElement(fScanner->getPrefixId(oneAttrib->getName())); + + fAnnotationBuf.append(oneAttrib->getQName()); + fAnnotationBuf.append(chEqual); + fAnnotationBuf.append(chDoubleQuote); + fAnnotationBuf.append(attrValue); + fAnnotationBuf.append(chDoubleQuote); + fAnnotationBuf.append(chSpace); + } + + // now we have to look through currently in-scope namespaces to see what + // wasn't declared here + ValueVectorOf* namespaceContext = fScanner->getNamespaceContext(); + for (XMLSize_t j=0; j < namespaceContext->size(); j++) + { + unsigned int prefId = namespaceContext->elementAt(j)->fPrefId; + + if (!fURIs->containsElement(prefId)) { + + const XMLCh* prefix = fScanner->getPrefixForId(prefId); + + if (XMLString::equals(prefix, XMLUni::fgZeroLenString)) { + fAnnotationBuf.append(XMLUni::fgXMLNSString); + } + else { + fAnnotationBuf.append(XMLUni::fgXMLNSColonString); + fAnnotationBuf.append(prefix); + } + + fAnnotationBuf.append(chEqual); + fAnnotationBuf.append(chDoubleQuote); + fAnnotationBuf.append(fScanner->getURIText(namespaceContext->elementAt(j)->fURIId)); + fAnnotationBuf.append(chDoubleQuote); + fAnnotationBuf.append(chSpace); + + fURIs->addElement(prefId); + } + } + + fAnnotationBuf.append(chCloseAngle); + fAnnotationBuf.append(chLF); +} + +void XSDDOMParser::startAnnotationElement( const XMLElementDecl& elemDecl + , const RefVectorOf& attrList + , const XMLSize_t attrCount) +{ + fAnnotationBuf.append(chOpenAngle); + fAnnotationBuf.append(elemDecl.getFullName()); + //fAnnotationBuf.append(chSpace); + + for(XMLSize_t i=0; i < attrCount; i++) { + + const XMLAttr* oneAttr = attrList.elementAt(i); + fAnnotationBuf.append(chSpace); + fAnnotationBuf.append(oneAttr ->getQName()); + fAnnotationBuf.append(chEqual); + fAnnotationBuf.append(chDoubleQuote); + fAnnotationBuf.append(oneAttr->getValue()); + fAnnotationBuf.append(chDoubleQuote); + } + + fAnnotationBuf.append(chCloseAngle); +} + +void XSDDOMParser::endAnnotationElement( const XMLElementDecl& elemDecl + , bool complete) +{ + if (complete) + { + fAnnotationBuf.append(chLF); + fAnnotationBuf.append(chOpenAngle); + fAnnotationBuf.append(chForwardSlash); + fAnnotationBuf.append(elemDecl.getFullName()); + fAnnotationBuf.append(chCloseAngle); + + // note that this is always called after endElement on 's + // child and before endElement on annotation. + // hence, we must make this the child of the current + // parent's only child. + DOMTextImpl *node = (DOMTextImpl *)fDocument->createTextNode(fAnnotationBuf.getRawBuffer()); + fCurrentNode->appendChild(node); + fAnnotationBuf.reset(); + } + else //capturing character calls + { + fAnnotationBuf.append(chOpenAngle); + fAnnotationBuf.append(chForwardSlash); + fAnnotationBuf.append(elemDecl.getFullName()); + fAnnotationBuf.append(chCloseAngle); + } +} + + +// --------------------------------------------------------------------------- +// XSDDOMParser: Setter methods +// --------------------------------------------------------------------------- +void XSDDOMParser::setUserErrorReporter(XMLErrorReporter* const errorReporter) +{ + fUserErrorReporter = errorReporter; + fScanner->setErrorReporter(this); +} + +void XSDDOMParser::setUserEntityHandler(XMLEntityHandler* const entityHandler) +{ + fUserEntityHandler = entityHandler; + fScanner->setEntityHandler(this); +} + + +// --------------------------------------------------------------------------- +// XSDDOMParser: Implementation of the XMLDocumentHandler interface +// --------------------------------------------------------------------------- +void XSDDOMParser::startElement( const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot) +{ + fDepth++; + + // while it is true that non-whitespace character data + // may only occur in appInfo or documentation + // elements, it's certainly legal for comments and PI's to + // occur as children of annotation; we need + // to account for these here. + if (fAnnotationDepth == -1) + { + if (XMLString::equals(elemDecl.getBaseName(), SchemaSymbols::fgELT_ANNOTATION) && + XMLString::equals(getURIText(urlId), SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) + { + + fAnnotationDepth = fDepth; + startAnnotation(elemDecl, attrList, attrCount); + } + } + else if (fDepth == fAnnotationDepth+1) + { + fInnerAnnotationDepth = fDepth; + startAnnotationElement(elemDecl, attrList, attrCount); + } + else + { + startAnnotationElement(elemDecl, attrList, attrCount); + if(isEmpty) + endElement(elemDecl, urlId, isRoot, elemPrefix); + // avoid falling through; don't call startElement in this case + return; + } + + DOMElement *elem; + if (urlId != fScanner->getEmptyNamespaceId()) //TagName has a prefix + { + if (elemPrefix && *elemPrefix) + { + XMLBufBid elemQName(&fBufMgr); + elemQName.set(elemPrefix); + elemQName.append(chColon); + elemQName.append(elemDecl.getBaseName()); + elem = createElementNSNode( + fScanner->getURIText(urlId), elemQName.getRawBuffer()); + } + else { + elem = createElementNSNode( + fScanner->getURIText(urlId), elemDecl.getBaseName()); + } + } + else { + elem = createElementNSNode(0, elemDecl.getBaseName()); + } + + DOMElementImpl *elemImpl = (DOMElementImpl *) elem; + for (XMLSize_t index = 0; index < attrCount; ++index) + { + const XMLAttr* oneAttrib = attrList.elementAt(index); + unsigned int attrURIId = oneAttrib->getURIId(); + const XMLCh* namespaceURI = 0; + + //for xmlns=... + if (XMLString::equals(oneAttrib->getName(), XMLUni::fgXMLNSString)) + attrURIId = fScanner->getXMLNSNamespaceId(); + + //TagName has a prefix + if (attrURIId != fScanner->getEmptyNamespaceId()) + namespaceURI = fScanner->getURIText(attrURIId); //get namespaceURI + + // revisit. Optimize to init the named node map to the + // right size up front. + DOMAttrImpl *attr = (DOMAttrImpl *) + fDocument->createAttributeNS(namespaceURI, oneAttrib->getQName()); + attr->setValue(oneAttrib -> getValue()); + DOMNode* remAttr = elemImpl->setAttributeNodeNS(attr); + if (remAttr) + remAttr->release(); + + // Attributes of type ID. If this is one, add it to the hashtable of IDs + // that is constructed for use by GetElementByID(). + if (oneAttrib->getType()==XMLAttDef::ID) + { + if (fDocument->fNodeIDMap == 0) + fDocument->fNodeIDMap = new (fDocument) DOMNodeIDMap(500, fDocument); + fDocument->fNodeIDMap->add(attr); + attr->fNode.isIdAttr(true); + } + + attr->setSpecified(oneAttrib->getSpecified()); + } + + // set up the default attributes + if (elemDecl.hasAttDefs()) + { + XMLAttDefList* defAttrs = &elemDecl.getAttDefList(); + XMLAttDef* attr = 0; + DOMAttrImpl * insertAttr = 0; + + for (XMLSize_t i=0; igetAttDefCount(); i++) + { + attr = &defAttrs->getAttDef(i); + + const XMLAttDef::DefAttTypes defType = attr->getDefaultType(); + if ((defType == XMLAttDef::Default) + || (defType == XMLAttDef::Fixed)) + { + // DOM Level 2 wants all namespace declaration attributes + // to be bound to "http://www.w3.org/2000/xmlns/" + // So as long as the XML parser doesn't do it, it needs to + // done here. + const XMLCh* qualifiedName = attr->getFullName(); + XMLBufBid bbPrefixQName(&fBufMgr); + XMLBuffer& prefixBuf = bbPrefixQName.getBuffer(); + int colonPos = -1; + unsigned int uriId = fScanner->resolveQName(qualifiedName, prefixBuf, ElemStack::Mode_Attribute, colonPos); + + const XMLCh* namespaceURI = 0; + if (XMLString::equals(qualifiedName, XMLUni::fgXMLNSString)) + uriId = fScanner->getXMLNSNamespaceId(); + + //TagName has a prefix + if (uriId != fScanner->getEmptyNamespaceId()) + namespaceURI = fScanner->getURIText(uriId); + + insertAttr = (DOMAttrImpl *) fDocument->createAttributeNS( + namespaceURI, qualifiedName); + + DOMAttr* remAttr = elemImpl->setDefaultAttributeNodeNS(insertAttr); + if (remAttr) + remAttr->release(); + + if (attr->getValue() != 0) + { + insertAttr->setValue(attr->getValue()); + insertAttr->setSpecified(false); + } + } + + insertAttr = 0; + attr->reset(); + } + } + + fCurrentParent->appendChild(elem); + fCurrentParent = elem; + fCurrentNode = elem; + fWithinElement = true; + + // If an empty element, do end right now (no endElement() will be called) + if (isEmpty) + endElement(elemDecl, urlId, isRoot, elemPrefix); +} + + + +void XSDDOMParser::endElement( const XMLElementDecl& elemDecl + , const unsigned int + , const bool + , const XMLCh* const) +{ + if(fAnnotationDepth > -1) + { + if (fInnerAnnotationDepth == fDepth) + { + fInnerAnnotationDepth = -1; + endAnnotationElement(elemDecl, false); + } + else if (fAnnotationDepth == fDepth) + { + fAnnotationDepth = -1; + endAnnotationElement(elemDecl, true); + } + else + { // inside a child of annotation + endAnnotationElement(elemDecl, false); + fDepth--; + return; + } + } + + fDepth--; + fCurrentNode = fCurrentParent; + fCurrentParent = fCurrentNode->getParentNode (); + + // If we've hit the end of content, clear the flag. + // + if (fCurrentParent == fDocument) + fWithinElement = false; +} + +void XSDDOMParser::docCharacters( const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection) +{ + // Ignore chars outside of content + if (!fWithinElement) + return; + + if (fInnerAnnotationDepth == -1) + { + if (!((ReaderMgr*) fScanner->getReaderMgr())->getCurrentReader()->isAllSpaces(chars, length)) + { + ReaderMgr::LastExtEntityInfo lastInfo; + fScanner->getReaderMgr()->getLastExtEntityInfo(lastInfo); + fXSLocator.setValues(lastInfo.systemId, lastInfo.publicId, lastInfo.lineNumber, lastInfo.colNumber); + fXSDErrorReporter.emitError(XMLValid::NonWSContent, XMLUni::fgValidityDomain, &fXSLocator); + } + } + // when it's within either of the 2 annotation subelements, characters are + // allowed and we need to store them. + else if (cdataSection == true) + { + fAnnotationBuf.append(XMLUni::fgCDataStart); + fAnnotationBuf.append(chars, length); + fAnnotationBuf.append(XMLUni::fgCDataEnd); + } + else + { + for(unsigned int i = 0; i < length; i++ ) + { + if(chars[i] == chAmpersand) + { + fAnnotationBuf.append(chAmpersand); + fAnnotationBuf.append(XMLUni::fgAmp); + fAnnotationBuf.append(chSemiColon); + } + else if (chars[i] == chOpenAngle) + { + fAnnotationBuf.append(chAmpersand); + fAnnotationBuf.append(XMLUni::fgLT); + fAnnotationBuf.append(chSemiColon); + } + else { + fAnnotationBuf.append(chars[i]); + } + } + } +} + +void XSDDOMParser::docComment(const XMLCh* const comment) +{ + if (fAnnotationDepth > -1) + { + fAnnotationBuf.append(XMLUni::fgCommentString); + fAnnotationBuf.append(comment); + fAnnotationBuf.append(chDash); + fAnnotationBuf.append(chDash); + fAnnotationBuf.append(chCloseAngle); + } +} + +void XSDDOMParser::startEntityReference(const XMLEntityDecl&) +{ +} + +void XSDDOMParser::endEntityReference(const XMLEntityDecl&) +{ +} + +void XSDDOMParser::ignorableWhitespace( const XMLCh* const chars + , const XMLSize_t length + , const bool) +{ + // Ignore chars before the root element + if (!fWithinElement || !fIncludeIgnorableWhitespace) + return; + + if (fAnnotationDepth > -1) + fAnnotationBuf.append(chars, length); +} + +// --------------------------------------------------------------------------- +// XSDDOMParser: Implementation of the XMLErrorReporter interface +// --------------------------------------------------------------------------- +void XSDDOMParser::error(const unsigned int code + , const XMLCh* const msgDomain + , const XMLErrorReporter::ErrTypes errType + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum) +{ + if (errType >= XMLErrorReporter::ErrType_Fatal) + fSawFatal = true; + + if (fUserErrorReporter) + fUserErrorReporter->error(code, msgDomain, errType, errorText, + systemId, publicId, lineNum, colNum); +} + +InputSource* +XSDDOMParser::resolveEntity(XMLResourceIdentifier* resourceIdentifier) +{ + if (fUserEntityHandler) + return fUserEntityHandler->resolveEntity(resourceIdentifier); + + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.hpp b/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.hpp new file mode 100644 index 000000000..70159b7d0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDDOMParser.hpp @@ -0,0 +1,322 @@ +/* + * 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: XSDDOMParser.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSDDOMPARSER_HPP) +#define XERCESC_INCLUDE_GUARD_XSDDOMPARSER_HPP + + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMElement; +class XMLValidator; + + +/** + * This class is used to parse schema documents into DOM trees + */ +class PARSERS_EXPORT XSDDOMParser : public XercesDOMParser +{ +public : + + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + /** @name Constructors and Destructor */ + //@{ + /** Construct a XSDDOMParser, with an optional validator + * + * Constructor with an instance of validator class to use for + * validation. If you don't provide a validator, a default one will + * be created for you in the scanner. + * + * @param gramPool Pointer to the grammar pool instance from + * external application. + * The parser does NOT own it. + * + * @param valToAdopt Pointer to the validator instance to use. The + * parser is responsible for freeing the memory. + */ + XSDDOMParser + ( + XMLValidator* const valToAdopt = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + , XMLGrammarPool* const gramPool = 0 + ); + + /** + * Destructor + */ + ~XSDDOMParser(); + + //@} + + // ----------------------------------------------------------------------- + // Implementation of the XMLDocumentHandler interface. + // ----------------------------------------------------------------------- + + /** @name Implementation of the XMLDocumentHandler interface. */ + //@{ + + /** Handle a start element event + * + * This method is used to report the start of an element. It is + * called at the end of the element, by which time all attributes + * specified are also parsed. A new DOM Element node is created + * along with as many attribute nodes as required. This new element + * is added appended as a child of the current node in the tree, and + * then replaces it as the current node (if the isEmpty flag is false.) + * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + * @param attrList A const reference to the object containing the + * list of attributes just scanned for this element. + * @param attrCount A count of number of attributes in the list + * specified by the parameter 'attrList'. + * @param isEmpty A flag indicating whether this is an empty element + * or not. If empty, then no endElement() call will + * be made. + * @param isRoot A flag indicating whether this element was the + * root element. + * @see DocumentHandler#startElement + */ + virtual void startElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , const bool isEmpty + , const bool isRoot + ); + + /** Handle and end of element event + * + * This method is used to indicate the end tag of an element. The + * DOM parser pops the current element off the top of the element + * stack, and make it the new current element. + * + * @param elemDecl A const reference to the object containing element + * declaration information. + * @param urlId An id referring to the namespace prefix, if + * namespaces setting is switched on. + * @param isRoot A flag indicating whether this element was the + * root element. + * @param elemPrefix A const pointer to a Unicode string containing + * the namespace prefix for this element. Applicable + * only when namespace processing is enabled. + */ + virtual void endElement + ( + const XMLElementDecl& elemDecl + , const unsigned int urlId + , const bool isRoot + , const XMLCh* const elemPrefix + ); + + /** Handle document character events + * + * This method is used to report all the characters scanned by the + * parser. This DOM implementation stores this data in the appropriate + * DOM node, creating one if necessary. + * + * @param chars A const pointer to a Unicode string representing the + * character data. + * @param length The length of the Unicode string returned in 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + */ + virtual void docCharacters + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + /** Handle a document comment event + * + * This method is used to report any comments scanned by the parser. + * A new comment node is created which stores this data. + * + * @param comment A const pointer to a null terminated Unicode + * string representing the comment text. + */ + virtual void docComment + ( + const XMLCh* const comment + ); + + /** Handle a start entity reference event + * + * This method is used to indicate the start of an entity reference. + * If the expand entity reference flag is true, then a new + * DOM Entity reference node is created. + * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void startEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** Handle and end of entity reference event + * + * This method is used to indicate that an end of an entity reference + * was just scanned. + * + * @param entDecl A const reference to the object containing the + * entity declaration information. + */ + virtual void endEntityReference + ( + const XMLEntityDecl& entDecl + ); + + /** Handle an ignorable whitespace vent + * + * This method is used to report all the whitespace characters, which + * are determined to be 'ignorable'. This distinction between characters + * is only made, if validation is enabled. + * + * Any whitespace before content is ignored. If the current node is + * already of type DOMNode::TEXT_NODE, then these whitespaces are + * appended, otherwise a new Text node is created which stores this + * data. Essentially all contiguous ignorable characters are collected + * in one node. + * + * @param chars A const pointer to a Unicode string representing the + * ignorable whitespace character data. + * @param length The length of the Unicode string 'chars'. + * @param cdataSection A flag indicating if the characters represent + * content from the CDATA section. + */ + virtual void ignorableWhitespace + ( + const XMLCh* const chars + , const XMLSize_t length + , const bool cdataSection + ); + + //@} + + // ----------------------------------------------------------------------- + // Get methods + // ----------------------------------------------------------------------- + bool getSawFatal() const; + + + // ----------------------------------------------------------------------- + // Set methods + // ----------------------------------------------------------------------- + void setUserErrorReporter(XMLErrorReporter* const errorReporter); + void setUserEntityHandler(XMLEntityHandler* const entityHandler); + + + // ----------------------------------------------------------------------- + // XMLErrorReporter interface + // ----------------------------------------------------------------------- + virtual void error + ( + const unsigned int errCode + , const XMLCh* const errDomain + , const ErrTypes type + , const XMLCh* const errorText + , const XMLCh* const systemId + , const XMLCh* const publicId + , const XMLFileLoc lineNum + , const XMLFileLoc colNum + ); + + // ----------------------------------------------------------------------- + // XMLEntityHandler interface + // ----------------------------------------------------------------------- + virtual InputSource* resolveEntity(XMLResourceIdentifier* resourceIdentifier); + +protected : + // ----------------------------------------------------------------------- + // Protected Helper methods + // ----------------------------------------------------------------------- + virtual DOMElement* createElementNSNode(const XMLCh *fNamespaceURI, + const XMLCh *qualifiedName); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XSDDOMParser(const XSDDOMParser&); + XSDDOMParser& operator=(const XSDDOMParser&); + + // ----------------------------------------------------------------------- + // Private Helper methods + // ----------------------------------------------------------------------- + void startAnnotation + ( + const XMLElementDecl& elemDecl + , const RefVectorOf& attrList + , const XMLSize_t attrCount + ); + void startAnnotationElement + ( + const XMLElementDecl& elemDecl + , const RefVectorOf& attrList + , const XMLSize_t attrCount + ); + void endAnnotationElement + ( + const XMLElementDecl& elemDecl + , bool complete + ); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fSawFatal; + int fAnnotationDepth; + int fInnerAnnotationDepth; + int fDepth; + XMLErrorReporter* fUserErrorReporter; + XMLEntityHandler* fUserEntityHandler; + ValueVectorOf* fURIs; + XMLBuffer fAnnotationBuf; + XSDErrorReporter fXSDErrorReporter; + XSDLocator fXSLocator; +}; + + +inline bool XSDDOMParser::getSawFatal() const +{ + return fSawFatal; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.cpp b/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.cpp new file mode 100644 index 000000000..7657dd016 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.cpp @@ -0,0 +1,179 @@ +/* + * 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. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local static data +// --------------------------------------------------------------------------- +static XMLMsgLoader* gErrMsgLoader = 0; +static XMLMsgLoader* gValidMsgLoader = 0; + +void XMLInitializer::initializeXSDErrorReporter() +{ + gErrMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLErrDomain); + + if (!gErrMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); + + gValidMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgValidityDomain); + + if (!gValidMsgLoader) + XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain); +} + +void XMLInitializer::terminateXSDErrorReporter() +{ + delete gErrMsgLoader; + gErrMsgLoader = 0; + + delete gValidMsgLoader; + gValidMsgLoader = 0; +} + +// --------------------------------------------------------------------------- +// XSDErrorReporter: Constructors and Destructor +// --------------------------------------------------------------------------- +XSDErrorReporter::XSDErrorReporter(XMLErrorReporter* const errorReporter) : + fExitOnFirstFatal(false) + , fErrorReporter(errorReporter) +{ + +} + + +// --------------------------------------------------------------------------- +// XSDErrorReporter: Error reporting +// --------------------------------------------------------------------------- +void XSDErrorReporter::emitError(const unsigned int toEmit, + const XMLCh* const msgDomain, + const Locator* const aLocator) +{ + // Bump the error count if it is not a warning +// if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) +// incrementErrorCount(); + + // + // Load the message into alocal and replace any tokens found in + // the text. + // + const XMLSize_t msgSize = 1023; + XMLCh errText[msgSize + 1]; + XMLMsgLoader* msgLoader = gErrMsgLoader; + XMLErrorReporter::ErrTypes errType = XMLErrs::errorType((XMLErrs::Codes) toEmit); + + if (XMLString::equals(msgDomain, XMLUni::fgValidityDomain)) { + + errType = XMLValid::errorType((XMLValid::Codes) toEmit); + msgLoader = gValidMsgLoader; + } + + if (!msgLoader->loadMsg(toEmit, errText, msgSize)) + { + // Should probably load a default message here + } + + if (fErrorReporter) + fErrorReporter->error(toEmit, msgDomain, errType, errText, aLocator->getSystemId(), + aLocator->getPublicId(), aLocator->getLineNumber(), + aLocator->getColumnNumber()); + + // Bail out if its fatal an we are to give up on the first fatal error + if (errType == XMLErrorReporter::ErrType_Fatal && fExitOnFirstFatal) + throw (XMLErrs::Codes) toEmit; +} + +void XSDErrorReporter::emitError(const unsigned int toEmit, + const XMLCh* const msgDomain, + const Locator* const aLocator, + const XMLCh* const text1, + const XMLCh* const text2, + const XMLCh* const text3, + const XMLCh* const text4, + MemoryManager* const manager) +{ + // Bump the error count if it is not a warning +// if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) +// incrementErrorCount(); + + // + // Load the message into alocal and replace any tokens found in + // the text. + // + const XMLSize_t maxChars = 2047; + XMLCh errText[maxChars + 1]; + XMLMsgLoader* msgLoader = gErrMsgLoader; + XMLErrorReporter::ErrTypes errType = XMLErrs::errorType((XMLErrs::Codes) toEmit); + + if (XMLString::equals(msgDomain, XMLUni::fgValidityDomain)) { + + errType = XMLValid::errorType((XMLValid::Codes) toEmit); + msgLoader = gValidMsgLoader; + } + + if (!msgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, manager)) + { + // Should probably load a default message here + } + + if (fErrorReporter) + fErrorReporter->error(toEmit, msgDomain, errType, errText, aLocator->getSystemId(), + aLocator->getPublicId(), aLocator->getLineNumber(), + aLocator->getColumnNumber()); + + // Bail out if its fatal an we are to give up on the first fatal error + if (errType == XMLErrorReporter::ErrType_Fatal && fExitOnFirstFatal) + throw (XMLErrs::Codes) toEmit; +} + +void XSDErrorReporter::emitError(const XMLException& except, + const Locator* const aLocator) +{ + const XMLCh* const errText = except.getMessage(); + const unsigned int toEmit = except.getCode(); + //Before the code was modified to call this routine it used to use + //the XMLErrs::DisplayErrorMessage error message, which is just {'0'} + //and that error message has errType of Error. So to be consistent + //with previous behaviour set the errType to be Error instead of + //getting the error type off of the exception. + //XMLErrorReporter::ErrTypes errType = XMLErrs::errorType((XMLErrs::Codes) toEmit); + XMLErrorReporter::ErrTypes errType = XMLErrorReporter::ErrType_Error; + + if (fErrorReporter) + fErrorReporter->error(toEmit, XMLUni::fgExceptDomain, errType, errText, aLocator->getSystemId(), + aLocator->getPublicId(), aLocator->getLineNumber(), + aLocator->getColumnNumber()); + + // Bail out if its fatal an we are to give up on the first fatal error + //if (errType == XMLErrorReporter::ErrType_Fatal && fExitOnFirstFatal) + // throw (XMLErrs::Codes) toEmit; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.hpp b/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.hpp new file mode 100644 index 000000000..b9c7746d5 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDErrorReporter.hpp @@ -0,0 +1,115 @@ +/* + * 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: XSDErrorReporter.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSDERRORREPORTER_HPP) +#define XERCESC_INCLUDE_GUARD_XSDERRORREPORTER_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class Locator; +class XMLErrorReporter; + + +/** + * This class reports schema errors + */ +class VALIDATORS_EXPORT XSDErrorReporter : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors are hidden, only the virtual destructor is exposed + // ----------------------------------------------------------------------- + XSDErrorReporter(XMLErrorReporter* const errorReporter = 0); + + virtual ~XSDErrorReporter() + { + } + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getExitOnFirstFatal() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setErrorReporter(XMLErrorReporter* const errorReporter); + void setExitOnFirstFatal(const bool newValue); + + // ----------------------------------------------------------------------- + // Report error methods + // ----------------------------------------------------------------------- + void emitError(const unsigned int toEmit, + const XMLCh* const msgDomain, + const Locator* const aLocator); + void emitError(const unsigned int toEmit, + const XMLCh* const msgDomain, + const Locator* const aLocator, + const XMLCh* const text1, + const XMLCh* const text2 = 0, + const XMLCh* const text3 = 0, + const XMLCh* const text4 = 0, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + void emitError(const XMLException& except, + const Locator* const aLocator); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and destructor + // ----------------------------------------------------------------------- + XSDErrorReporter(const XSDErrorReporter&); + XSDErrorReporter& operator=(const XSDErrorReporter&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fExitOnFirstFatal; + XMLErrorReporter* fErrorReporter; +}; + + +// --------------------------------------------------------------------------- +// XSDErrorReporter: Getter methods +// --------------------------------------------------------------------------- +inline bool XSDErrorReporter::getExitOnFirstFatal() const +{ + return fExitOnFirstFatal; +} + +// --------------------------------------------------------------------------- +// XSDErrorReporter: Setter methods +// --------------------------------------------------------------------------- +inline void XSDErrorReporter::setExitOnFirstFatal(const bool newValue) +{ + fExitOnFirstFatal = newValue; +} + +inline void XSDErrorReporter::setErrorReporter(XMLErrorReporter* const errorReporter) +{ + fErrorReporter = errorReporter; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.cpp b/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.cpp new file mode 100644 index 000000000..ee45a4f50 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.cpp @@ -0,0 +1,57 @@ +/* + * 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: XSDLocator.cpp 672273 2008-06-27 13:57:00Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XSDLocator: Constructors and Destructor +// --------------------------------------------------------------------------- +XSDLocator::XSDLocator() : + fLineNo(0) + , fColumnNo(0) + , fSystemId(0) + , fPublicId(0) +{ + +} + + +// --------------------------------------------------------------------------- +// XSDLocator: Setter methods +// --------------------------------------------------------------------------- +void XSDLocator::setValues(const XMLCh* const systemId, + const XMLCh* const publicId, + const XMLFileLoc lineNo, + const XMLFileLoc columnNo) +{ + fLineNo = lineNo; + fColumnNo = columnNo; + fSystemId = systemId; + fPublicId = publicId; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.hpp b/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.hpp new file mode 100644 index 000000000..0a21a36f2 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XSDLocator.hpp @@ -0,0 +1,141 @@ +/* + * 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: XSDLocator.hpp 672273 2008-06-27 13:57:00Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XSDLOCATOR_HPP) +#define XERCESC_INCLUDE_GUARD_XSDLOCATOR_HPP + +/** + * A Locator implementation + */ + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT XSDLocator: public XMemory, public Locator +{ +public: + + /** @name Constructors and Destructor */ + //@{ + /** Default constructor */ + XSDLocator(); + + /** Destructor */ + virtual ~XSDLocator() + { + } + + //@} + + /** @name The locator interface */ + //@{ + /** + * Return the public identifier for the current document event. + *

This will be the public identifier + * @return A string containing the public identifier, or + * null if none is available. + * @see #getSystemId + */ + virtual const XMLCh* getPublicId() const; + + /** + * Return the system identifier for the current document event. + * + *

If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.

+ * + * @return A string containing the system identifier, or null + * if none is available. + * @see #getPublicId + */ + virtual const XMLCh* getSystemId() const; + + /** + * Return the line number where the current document event ends. + * Note that this is the line position of the first character + * after the text associated with the document event. + * @return The line number, or 0 if none is available. + * @see #getColumnNumber + */ + virtual XMLFileLoc getLineNumber() const; + + /** + * Return the column number where the current document event ends. + * Note that this is the column number of the first + * character after the text associated with the document + * event. The first column in a line is position 1. + * @return The column number, or 0 if none is available. + * @see #getLineNumber + */ + virtual XMLFileLoc getColumnNumber() const; + //@} + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setValues(const XMLCh* const systemId, + const XMLCh* const publicId, + const XMLFileLoc lineNo, const XMLFileLoc columnNo); + +private : + // ----------------------------------------------------------------------- + // Unimplemented constructors and destructor + // ----------------------------------------------------------------------- + XSDLocator(const XSDLocator&); + XSDLocator& operator=(const XSDLocator&); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + XMLFileLoc fLineNo; + XMLFileLoc fColumnNo; + const XMLCh* fSystemId; + const XMLCh* fPublicId; +}; + +// --------------------------------------------------------------------------- +// XSDLocator: Getter methods +// --------------------------------------------------------------------------- +inline XMLFileLoc XSDLocator::getLineNumber() const +{ + return fLineNo; +} + +inline XMLFileLoc XSDLocator::getColumnNumber() const +{ + return fColumnNo; +} + +inline const XMLCh* XSDLocator::getPublicId() const +{ + return fPublicId; +} + +inline const XMLCh* XSDLocator::getSystemId() const +{ + return fSystemId; +} + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/XUtil.cpp b/project/jni/xerces/src/xercesc/validators/schema/XUtil.cpp new file mode 100644 index 000000000..bc6f4dc4c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XUtil.cpp @@ -0,0 +1,125 @@ +/* + * 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: XUtil.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// Finds and returns the first child element node. +DOMElement* XUtil::getFirstChildElement(const DOMNode* const parent) +{ + // search for node + DOMNode* child = parent->getFirstChild(); + + while (child != 0) + { + if (child->getNodeType() == DOMNode::ELEMENT_NODE) + return (DOMElement*)child; + + child = child->getNextSibling(); + } + + // not found + return 0; +} + +// Finds and returns the first child node with the given name. +DOMElement* XUtil::getFirstChildElementNS(const DOMNode* const parent + , const XMLCh** const elemNames + , const XMLCh* const uriStr + , unsigned int length) +{ + // search for node + DOMNode* child = parent->getFirstChild(); + while (child != 0) + { + if (child->getNodeType() == DOMNode::ELEMENT_NODE) + { + for (unsigned int i = 0; i < length; i++) + { + if (XMLString::equals(child->getNamespaceURI(), uriStr) && + XMLString::equals(child->getLocalName(), elemNames[i])) + return (DOMElement*)child; + } + } + child = child->getNextSibling(); + } + + // not found + return 0; +} + +// Finds and returns the last child element node. +DOMElement* XUtil::getNextSiblingElement(const DOMNode* const node) +{ + // search for node + DOMNode* sibling = node->getNextSibling(); + + while (sibling != 0) + { + if (sibling->getNodeType() == DOMNode::ELEMENT_NODE) + return (DOMElement*)sibling; + + sibling = sibling->getNextSibling(); + } + + // not found + return 0; +} + +// Finds and returns the next sibling element node with the give name. +DOMElement* XUtil::getNextSiblingElementNS(const DOMNode* const node + , const XMLCh** const elemNames + , const XMLCh* const uriStr + , unsigned int length) +{ + // search for node + DOMNode* sibling = node->getNextSibling(); + while (sibling != 0) + { + if (sibling->getNodeType() == DOMNode::ELEMENT_NODE) + { + for (unsigned int i = 0; i < length; i++) + { + if (XMLString::equals(sibling->getNamespaceURI(), uriStr) && + XMLString::equals(sibling->getLocalName(), elemNames[i])) + return (DOMElement*)sibling; + } + } + sibling = sibling->getNextSibling(); + } + + // not found + return 0; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XUtil.hpp b/project/jni/xerces/src/xercesc/validators/schema/XUtil.hpp new file mode 100644 index 000000000..1a5380c75 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XUtil.hpp @@ -0,0 +1,71 @@ +/* + * 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: XUtil.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XUTIL_HPP) +#define XERCESC_INCLUDE_GUARD_XUTIL_HPP + +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class DOMNode; +class DOMElement; + +/** + * Some useful utility methods. + */ +class VALIDATORS_EXPORT XUtil +{ +public: + + // Finds and returns the first child element node. + static DOMElement* getFirstChildElement(const DOMNode* const parent); + + // Finds and returns the first child node with the given qualifiedname. + static DOMElement* getFirstChildElementNS(const DOMNode* const parent + , const XMLCh** const elemNames + , const XMLCh* const uriStr + , unsigned int length); + + // Finds and returns the next sibling element node. + static DOMElement* getNextSiblingElement(const DOMNode* const node); + + static DOMElement* getNextSiblingElementNS(const DOMNode* const node + , const XMLCh** const elemNames + , const XMLCh* const uriStr + , unsigned int length); + +private: + // ----------------------------------------------------------------------- + // Constructors and Destructor + // ----------------------------------------------------------------------- + + // This class cannot be instantiated. + XUtil() {}; + ~XUtil() {}; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.cpp b/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.cpp new file mode 100644 index 000000000..ed2432a6a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.cpp @@ -0,0 +1,182 @@ +/* + * 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: XercesAttGroupInfo.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XercesAttGroupInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesAttGroupInfo::XercesAttGroupInfo(MemoryManager* const manager) + : fTypeWithId(false) + , fNameId(0) + , fNamespaceId(0) + , fAttributes(0) + , fAnyAttributes(0) + , fCompleteWildCard(0) + , fMemoryManager(manager) +{ + +} + +XercesAttGroupInfo::XercesAttGroupInfo(unsigned int attGroupNameId, + unsigned int attGroupNamespaceId, + MemoryManager* const manager) + : fTypeWithId(false) + , fNameId(attGroupNameId) + , fNamespaceId(attGroupNamespaceId) + , fAttributes(0) + , fAnyAttributes(0) + , fCompleteWildCard(0) + , fMemoryManager(manager) +{ + +} + +XercesAttGroupInfo::~XercesAttGroupInfo() +{ + delete fAttributes; + delete fAnyAttributes; + delete fCompleteWildCard; +} + +bool XercesAttGroupInfo::containsAttribute(const XMLCh* const name, + const unsigned int uri) { + + if (fAttributes) { + + XMLSize_t attCount = fAttributes->size(); + + if (attCount) { + + for (XMLSize_t i=0; i < attCount; i++) { + + QName* attName = fAttributes->elementAt(i)->getAttName(); + + if (attName->getURI() == uri && + XMLString::equals(attName->getLocalPart(),name)) { + return true; + } + } + } + } + + return false; +} + +// --------------------------------------------------------------------------- +// XercesAttGroupInfo: Getter methods +// --------------------------------------------------------------------------- +const SchemaAttDef* XercesAttGroupInfo::getAttDef(const XMLCh* const baseName, + const int uriId) const { + + // If no list, then return a null + if (!fAttributes) + return 0; + + XMLSize_t attSize = fAttributes->size(); + + for (XMLSize_t i=0; ielementAt(i); + QName* attName = attDef->getAttName(); + + if (uriId == (int) attName->getURI() && + XMLString::equals(baseName, attName->getLocalPart())) { + + return attDef; + } + } + + return 0; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesAttGroupInfo) + +void XercesAttGroupInfo::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<* fAttributes; + * + ***/ + XTemplateSerializer::storeObject(fAttributes, serEng); + + /*** + * + * Serialize RefVectorOf* fAnyAttributes; + * + ***/ + XTemplateSerializer::storeObject(fAnyAttributes, serEng); + + serEng<>fTypeWithId; + serEng>>fNameId; + serEng>>fNamespaceId; + + /*** + * + * Deserialize RefVectorOf* fAttributes; + * + ***/ + XTemplateSerializer::loadObject(&fAttributes, 4, true, serEng); + + /*** + * + * Deserialize RefVectorOf* fAnyAttributes; + * + ***/ + + XTemplateSerializer::loadObject(&fAnyAttributes, 2, true, serEng); + + serEng>>fCompleteWildCard; + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XercesAttGroupInfo.cpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.hpp b/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.hpp new file mode 100644 index 000000000..0c260cdff --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesAttGroupInfo.hpp @@ -0,0 +1,257 @@ +/* + * 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: XercesAttGroupInfo.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESATTGROUPINFO_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESATTGROUPINFO_HPP + + +/** + * The class act as a place holder to store attributeGroup information. + * + * The class is intended for internal use. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT XercesAttGroupInfo : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors/Destructor + // ----------------------------------------------------------------------- + XercesAttGroupInfo + ( + unsigned int attGroupNameId + , unsigned int attGroupNamespaceId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~XercesAttGroupInfo(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool containsTypeWithId() const; + XMLSize_t attributeCount() const; + XMLSize_t anyAttributeCount() const; + unsigned int getNameId() const; + unsigned int getNamespaceId() const; + SchemaAttDef* attributeAt(const XMLSize_t index); + const SchemaAttDef* attributeAt(const XMLSize_t index) const; + SchemaAttDef* anyAttributeAt(const XMLSize_t index); + const SchemaAttDef* anyAttributeAt(const XMLSize_t index) const; + SchemaAttDef* getCompleteWildCard() const; + const SchemaAttDef* getAttDef(const XMLCh* const baseName, + const int uriId) const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setTypeWithId(const bool other); + void addAttDef(SchemaAttDef* const toAdd, const bool toClone = false); + void addAnyAttDef(SchemaAttDef* const toAdd, const bool toClone = false); + void setCompleteWildCard(SchemaAttDef* const toSet); + + // ----------------------------------------------------------------------- + // Query methods + // ----------------------------------------------------------------------- + bool containsAttribute(const XMLCh* const name, const unsigned int uri); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesAttGroupInfo) + XercesAttGroupInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesAttGroupInfo(const XercesAttGroupInfo& elemInfo); + XercesAttGroupInfo& operator= (const XercesAttGroupInfo& other); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fTypeWithId; + unsigned int fNameId; + unsigned int fNamespaceId; + RefVectorOf* fAttributes; + RefVectorOf* fAnyAttributes; + SchemaAttDef* fCompleteWildCard; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XercesAttGroupInfo: Getter methods +// --------------------------------------------------------------------------- +inline bool XercesAttGroupInfo::containsTypeWithId() const { + + return fTypeWithId; +} + +inline XMLSize_t XercesAttGroupInfo::attributeCount() const { + + if (fAttributes) { + return fAttributes->size(); + } + + return 0; +} + +inline XMLSize_t XercesAttGroupInfo::anyAttributeCount() const { + + if (fAnyAttributes) { + return fAnyAttributes->size(); + } + + return 0; +} + +inline unsigned int XercesAttGroupInfo::getNameId() const +{ + return fNameId; +} + +inline unsigned int XercesAttGroupInfo::getNamespaceId() const +{ + return fNamespaceId; +} + +inline SchemaAttDef* +XercesAttGroupInfo::attributeAt(const XMLSize_t index) { + + if (fAttributes) { + return fAttributes->elementAt(index); + } + + return 0; +} + +inline const SchemaAttDef* +XercesAttGroupInfo::attributeAt(const XMLSize_t index) const { + + if (fAttributes) { + return fAttributes->elementAt(index); + } + + return 0; +} + +inline SchemaAttDef* +XercesAttGroupInfo::anyAttributeAt(const XMLSize_t index) { + + if (fAnyAttributes) { + return fAnyAttributes->elementAt(index); + } + + return 0; +} + +inline const SchemaAttDef* +XercesAttGroupInfo::anyAttributeAt(const XMLSize_t index) const { + + if (fAnyAttributes) { + return fAnyAttributes->elementAt(index); + } + + return 0; +} + +inline SchemaAttDef* +XercesAttGroupInfo::getCompleteWildCard() const { + + return fCompleteWildCard; +} + +// --------------------------------------------------------------------------- +// XercesAttGroupInfo: Setter methods +// --------------------------------------------------------------------------- +inline void XercesAttGroupInfo::setTypeWithId(const bool other) { + + fTypeWithId = other; +} + +inline void XercesAttGroupInfo::addAttDef(SchemaAttDef* const toAdd, + const bool toClone) { + + if (!fAttributes) { + fAttributes = new (fMemoryManager) RefVectorOf(4, true, fMemoryManager); + } + + if (toClone) { + SchemaAttDef* clonedAttDef = new (fMemoryManager) SchemaAttDef(toAdd); + + if (!clonedAttDef->getBaseAttDecl()) + clonedAttDef->setBaseAttDecl(toAdd); + + fAttributes->addElement(clonedAttDef); + } + else { + fAttributes->addElement(toAdd); + } +} + +inline void XercesAttGroupInfo::addAnyAttDef(SchemaAttDef* const toAdd, + const bool toClone) { + + if (!fAnyAttributes) { + fAnyAttributes = new (fMemoryManager) RefVectorOf(2, true, fMemoryManager); + } + + if (toClone) { + SchemaAttDef* clonedAttDef = new (fMemoryManager) SchemaAttDef(toAdd); + + if (!clonedAttDef->getBaseAttDecl()) + clonedAttDef->setBaseAttDecl(toAdd); + + fAnyAttributes->addElement(clonedAttDef); + } + else { + fAnyAttributes->addElement(toAdd); + } +} + +inline void +XercesAttGroupInfo::setCompleteWildCard(SchemaAttDef* const toSet) { + + if (fCompleteWildCard) { + delete fCompleteWildCard; + } + + fCompleteWildCard = toSet; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XercesAttGroupInfo.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.cpp b/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.cpp new file mode 100644 index 000000000..3934ef7d6 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.cpp @@ -0,0 +1,120 @@ +/* + * 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: XercesElementWildcard.cpp 671133 2008-06-24 11:22:29Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Local methods +// --------------------------------------------------------------------------- + +/** + * XercesElementWildcard is used to check whether two element declarations conflict + */ +/** + * Check whether two element declarations conflict + */ +bool XercesElementWildcard::conflict(SchemaGrammar* const pGrammar, + ContentSpecNode::NodeTypes type1, + QName* q1, + ContentSpecNode::NodeTypes type2, + QName* q2, + SubstitutionGroupComparator* comparator) +{ + if (type1 == ContentSpecNode::Leaf && + type2 == ContentSpecNode::Leaf) { + if (comparator->isEquivalentTo(q1, q2) || comparator->isEquivalentTo(q2, q1)) + return true; + } + else if (type1 == ContentSpecNode::Leaf) { + return uriInWildcard(pGrammar, q1, q2->getURI(), type2, comparator); + } + else if (type2 == ContentSpecNode::Leaf) { + return uriInWildcard(pGrammar, q2, q1->getURI(), type1, comparator); + } + else { + return wildcardIntersect(type1, q1->getURI(), type2, q2->getURI()); + } + return false; +} + +bool XercesElementWildcard::uriInWildcard(SchemaGrammar* const pGrammar, + QName* qname, + unsigned int wildcard, + ContentSpecNode::NodeTypes wtype, + SubstitutionGroupComparator* comparator) +{ + if ((wtype & 0x0f)== ContentSpecNode::Any) { + return true; + } + else if ((wtype & 0x0f)== ContentSpecNode::Any_NS) { + // substitution of "uri" satisfies "wtype:wildcard" + return comparator->isAllowedByWildcard(pGrammar, qname, wildcard, false); + } + else if ((wtype & 0x0f)== ContentSpecNode::Any_Other) { + // substitution of "uri" satisfies "wtype:wildcard" + return comparator->isAllowedByWildcard(pGrammar, qname, wildcard, true); + } + + return false; +} + +bool XercesElementWildcard::wildcardIntersect(ContentSpecNode::NodeTypes t1, + unsigned int w1, + ContentSpecNode::NodeTypes t2, + unsigned int w2) +{ + if (((t1 & 0x0f) == ContentSpecNode::Any) || + ((t2 & 0x0f) == ContentSpecNode::Any)) { + // if either one is "##any", then intersects + return true; + } + else if (((t1 & 0x0f) == ContentSpecNode::Any_NS) && + ((t2 & 0x0f) == ContentSpecNode::Any_NS)) { + // if both are "some_namespace" and equal, then intersects + return w1 == w2; + } + else if (((t1 & 0x0f) == ContentSpecNode::Any_Other) && + ((t2 & 0x0f) == ContentSpecNode::Any_Other)) { + // if both are "##other", then intersects + return true; + } + // Below we assume that empty string has id 1. + // + else if (((t1 & 0x0f) == ContentSpecNode::Any_NS) && + ((t2 & 0x0f) == ContentSpecNode::Any_Other)) + { + return w1 != w2 && w1 != 1; + } + else if (((t1 & 0x0f) == ContentSpecNode::Any_Other) && + ((t2 & 0x0f) == ContentSpecNode::Any_NS)) + { + return w1 != w2 && w2 != 1; + } + return false; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.hpp b/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.hpp new file mode 100644 index 000000000..cd5b61fab --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesElementWildcard.hpp @@ -0,0 +1,81 @@ +/* + * 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: XercesElementWildcard.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESELEMENTWILDCARD_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESELEMENTWILDCARD_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward declarations +// --------------------------------------------------------------------------- +class SchemaGrammar; + + +class VALIDATORS_EXPORT XercesElementWildcard +{ + +public : + + // ----------------------------------------------------------------------- + // Class static methods + // ----------------------------------------------------------------------- + /* + * check whether two elements are in conflict + */ + static bool conflict(SchemaGrammar* const pGrammar, + ContentSpecNode::NodeTypes type1, + QName* q1, + ContentSpecNode::NodeTypes type2, + QName* q2, + SubstitutionGroupComparator* comparator); + +private: + + // ----------------------------------------------------------------------- + // private helper methods + // ----------------------------------------------------------------------- + static bool uriInWildcard(SchemaGrammar* const pGrammar, + QName* qname, + unsigned int wildcard, + ContentSpecNode::NodeTypes wtype, + SubstitutionGroupComparator* comparator); + + static bool wildcardIntersect(ContentSpecNode::NodeTypes t1, + unsigned int w1, + ContentSpecNode::NodeTypes t2, + unsigned int w2); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesElementWildcard(); + ~XercesElementWildcard(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif // XERCESELEMENTWILDCARD_HPP + diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.cpp b/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.cpp new file mode 100644 index 000000000..7038c3393 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.cpp @@ -0,0 +1,141 @@ +/* + * 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: XercesGroupInfo.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// XercesGroupInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesGroupInfo::XercesGroupInfo(MemoryManager* const manager) + : fCheckElementConsistency(true) + , fScope(Grammar::TOP_LEVEL_SCOPE) + , fNameId(0) + , fNamespaceId(0) + , fContentSpec(0) + , fElements(0) + , fBaseGroup(0) + , fLocator(0) +{ + fElements = new (manager) RefVectorOf(4, false, manager); +} + +XercesGroupInfo::XercesGroupInfo(unsigned int groupNameId, + unsigned int groupNamespaceId, + MemoryManager* const manager) + : fCheckElementConsistency(true) + , fScope(Grammar::TOP_LEVEL_SCOPE) + , fNameId(groupNameId) + , fNamespaceId(groupNamespaceId) + , fContentSpec(0) + , fElements(0) + , fBaseGroup(0) + , fLocator(0) +{ + fElements = new (manager) RefVectorOf(4, false, manager); +} + + +XercesGroupInfo::~XercesGroupInfo() +{ + delete fElements; + delete fContentSpec; + delete fLocator; +} + + +// --------------------------------------------------------------------------- +// XercesGroupInfo: Constructors and Destructor +// --------------------------------------------------------------------------- +void XercesGroupInfo::setLocator(XSDLocator* const aLocator) { + + if (fLocator) + delete fLocator; + + fLocator = aLocator; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesGroupInfo) + +void XercesGroupInfo::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + serEng<* fElements; + * + ***/ + + XTemplateSerializer::storeObject(fElements, serEng); + + serEng<>fCheckElementConsistency; + serEng>>fScope; + serEng>>fNameId; + serEng>>fNamespaceId; + serEng>>fContentSpec; + + /*** + * + * Deserialize RefVectorOf* fElements; + * + ***/ + XTemplateSerializer::loadObject(&fElements, 4, false, serEng); + + serEng>>fBaseGroup; + + //don't serialize XSDLocator* fLocator; + fLocator = 0; + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XercesGroupInfo.cpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.hpp b/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.hpp new file mode 100644 index 000000000..1baa9b73f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/XercesGroupInfo.hpp @@ -0,0 +1,204 @@ +/* + * 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: XercesGroupInfo.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESGROUPINFO_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESGROUPINFO_HPP + + +/** + * The class act as a place holder to store group information. + * + * The class is intended for internal use. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class ContentSpecNode; +class XSDLocator; + + +class VALIDATORS_EXPORT XercesGroupInfo : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Public Constructors/Destructor + // ----------------------------------------------------------------------- + XercesGroupInfo + ( + unsigned int groupNameId + , unsigned int groupNamespaceId + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + ~XercesGroupInfo(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getCheckElementConsistency() const; + unsigned int getScope() const; + XMLSize_t elementCount() const; + ContentSpecNode* getContentSpec() const; + SchemaElementDecl* elementAt(const XMLSize_t index); + const SchemaElementDecl* elementAt(const XMLSize_t index) const; + XSDLocator* getLocator() const; + XercesGroupInfo* getBaseGroup() const; + unsigned int getNameId() const; + unsigned int getNamespaceId() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setScope(const unsigned int other); + void setContentSpec(ContentSpecNode* const other); + void addElement(SchemaElementDecl* const toAdd); + void setLocator(XSDLocator* const aLocator); + void setBaseGroup(XercesGroupInfo* const baseGroup); + void setCheckElementConsistency(const bool aValue); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesGroupInfo) + XercesGroupInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesGroupInfo(const XercesGroupInfo& elemInfo); + XercesGroupInfo& operator= (const XercesGroupInfo& other); + + // ----------------------------------------------------------------------- + // Private data members + // ----------------------------------------------------------------------- + bool fCheckElementConsistency; + unsigned int fScope; + unsigned int fNameId; + unsigned int fNamespaceId; + ContentSpecNode* fContentSpec; + RefVectorOf* fElements; + XercesGroupInfo* fBaseGroup; // redefine by restriction + XSDLocator* fLocator; +}; + +// --------------------------------------------------------------------------- +// XercesGroupInfo: Getter methods +// --------------------------------------------------------------------------- +inline unsigned int XercesGroupInfo::getScope() const { + + return fScope; +} + +inline XMLSize_t XercesGroupInfo::elementCount() const { + + return fElements->size(); +} + +inline ContentSpecNode* XercesGroupInfo::getContentSpec() const { + + return fContentSpec; +} + +inline SchemaElementDecl* +XercesGroupInfo::elementAt(const XMLSize_t index) { + + return fElements->elementAt(index); +} + +inline const SchemaElementDecl* +XercesGroupInfo::elementAt(const XMLSize_t index) const { + + return fElements->elementAt(index); +} + +inline XSDLocator* XercesGroupInfo::getLocator() const { + + return fLocator; +} + +inline XercesGroupInfo* XercesGroupInfo::getBaseGroup() const { + + return fBaseGroup; +} + +inline bool XercesGroupInfo::getCheckElementConsistency() const { + + return fCheckElementConsistency; +} + +inline unsigned int XercesGroupInfo::getNameId() const +{ + return fNameId; +} + +inline unsigned int XercesGroupInfo::getNamespaceId() const +{ + return fNamespaceId; +} + +// --------------------------------------------------------------------------- +// XercesGroupInfo: Setter methods +// ---------------------------------------------------------------------------} +inline void XercesGroupInfo::setScope(const unsigned int other) { + + fScope = other; +} + +inline void XercesGroupInfo::setContentSpec(ContentSpecNode* const other) { + + fContentSpec = other; +} + +inline void XercesGroupInfo::addElement(SchemaElementDecl* const elem) { + + if (!fElements->containsElement(elem)) + fElements->addElement(elem); +} + +inline void XercesGroupInfo::setBaseGroup(XercesGroupInfo* const baseGroup) { + + fBaseGroup = baseGroup; +} + +inline void XercesGroupInfo::setCheckElementConsistency(const bool aValue) { + + fCheckElementConsistency = aValue; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XercesGroupInfo.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.cpp new file mode 100644 index 000000000..4ef9d827f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.cpp @@ -0,0 +1,124 @@ +/* + * 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: FieldActivator.cpp 679340 2008-07-24 10:28:29Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// FieldActivator: Constructors and Destructor +// --------------------------------------------------------------------------- +FieldActivator::FieldActivator(ValueStoreCache* const valueStoreCache, + XPathMatcherStack* const matcherStack, + MemoryManager* const manager) + : fValueStoreCache(valueStoreCache) + , fMatcherStack(matcherStack) + , fMayMatch(0) + , fMemoryManager(manager) +{ + fMayMatch = new (manager) ValueHashTableOf(29, manager); +} + +FieldActivator::FieldActivator(const FieldActivator& other) + : XMemory(other) + , fValueStoreCache(other.fValueStoreCache) + , fMatcherStack(other.fMatcherStack) + , fMayMatch(0) + , fMemoryManager(other.fMemoryManager) +{ + fMayMatch = new (fMemoryManager) ValueHashTableOf(29, fMemoryManager); + ValueHashTableOfEnumerator mayMatchEnum(other.fMayMatch, false, fMemoryManager); + + // Build key set + while (mayMatchEnum.hasMoreElements()) + { + IC_Field* field = (IC_Field*) mayMatchEnum.nextElementKey(); + fMayMatch->put(field, other.fMayMatch->get(field)); + } +} + + +FieldActivator::~FieldActivator() +{ + delete fMayMatch; +} + +// --------------------------------------------------------------------------- +// FieldActivator: Operator methods +// --------------------------------------------------------------------------- +FieldActivator& FieldActivator::operator =(const FieldActivator& other) { + + if (this == &other) { + return *this; + } + + fValueStoreCache = other.fValueStoreCache; + fMatcherStack = other.fMatcherStack; + return *this; +} + +// --------------------------------------------------------------------------- +// FieldActivator: Operator methods +// --------------------------------------------------------------------------- +XPathMatcher* FieldActivator::activateField(IC_Field* const field, const int initialDepth) { + + ValueStore* valueStore = fValueStoreCache->getValueStoreFor(field, initialDepth); + XPathMatcher* matcher = field->createMatcher(this, valueStore, fMemoryManager); + + setMayMatch(field, true); + fMatcherStack->addMatcher(matcher); + matcher->startDocumentFragment(); + + return matcher; +} + +void FieldActivator::startValueScopeFor(const IdentityConstraint* const ic, + const int initialDepth) { + + XMLSize_t fieldCount = ic->getFieldCount(); + + for(XMLSize_t i=0; igetFieldAt(i); + ValueStore* valueStore = fValueStoreCache->getValueStoreFor(field, initialDepth); + + valueStore->startValueScope(); + } +} + +void FieldActivator::endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth) { + + ValueStore* valueStore = fValueStoreCache->getValueStoreFor(ic, initialDepth); + + valueStore->endValueScope(); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file FieldActivator.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.hpp new file mode 100644 index 000000000..6b1f0f794 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldActivator.hpp @@ -0,0 +1,141 @@ +/* + * 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: FieldActivator.hpp 679340 2008-07-24 10:28:29Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP) +#define XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP + +/** + * This class is responsible for activating fields within a specific scope; + * the caller merely requests the fields to be activated. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class IdentityConstraint; +class XPathMatcher; +class ValueStoreCache; +class IC_Field; +class XPathMatcherStack; + + +class VALIDATORS_EXPORT FieldActivator : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + FieldActivator(ValueStoreCache* const valueStoreCache, + XPathMatcherStack* const matcherStack, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + FieldActivator(const FieldActivator& other); + ~FieldActivator(); + + // ----------------------------------------------------------------------- + // Operator methods + // ----------------------------------------------------------------------- + FieldActivator& operator =(const FieldActivator& other); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + bool getMayMatch(IC_Field* const field); + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setValueStoreCache(ValueStoreCache* const other); + void setMatcherStack(XPathMatcherStack* const matcherStack); + void setMayMatch(IC_Field* const field, bool value); + + // ----------------------------------------------------------------------- + // Activation methods + // ----------------------------------------------------------------------- + /** + * Start the value scope for the specified identity constraint. This + * method is called when the selector matches in order to initialize + * the value store. + */ + void startValueScopeFor(const IdentityConstraint* const ic, const int initialDepth); + + /** + * Request to activate the specified field. This method returns the + * matcher for the field. + */ + XPathMatcher* activateField(IC_Field* const field, const int initialDepth); + + /** + * Ends the value scope for the specified identity constraint. + */ + void endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth); + +private: + // ----------------------------------------------------------------------- + // Data + // ----------------------------------------------------------------------- + ValueStoreCache* fValueStoreCache; + XPathMatcherStack* fMatcherStack; + ValueHashTableOf* fMayMatch; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// FieldActivator: Getter methods +// --------------------------------------------------------------------------- +inline bool FieldActivator::getMayMatch(IC_Field* const field) { + + return fMayMatch->get(field); +} + +// --------------------------------------------------------------------------- +// FieldActivator: Setter methods +// --------------------------------------------------------------------------- +inline void FieldActivator::setValueStoreCache(ValueStoreCache* const other) { + + fValueStoreCache = other; +} + +inline void +FieldActivator::setMatcherStack(XPathMatcherStack* const matcherStack) { + + fMatcherStack = matcherStack; +} + +inline void FieldActivator::setMayMatch(IC_Field* const field, bool value) { + + fMayMatch->put(field, value); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file FieldActivator.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.cpp new file mode 100644 index 000000000..6c1ee6e0e --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.cpp @@ -0,0 +1,127 @@ +/* + * 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: FieldValueMap.cpp 708224 2008-10-27 16:02:26Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// FieldValueMap: Constructors and Destructor +// --------------------------------------------------------------------------- +FieldValueMap::FieldValueMap(MemoryManager* const manager) + : fFields(0) + , fValidators(0) + , fValues(0) + , fMemoryManager(manager) +{ +} + +FieldValueMap::FieldValueMap(const FieldValueMap& other) + : XMemory(other) + , fFields(0) + , fValidators(0) + , fValues(0) + , fMemoryManager(other.fMemoryManager) +{ + if (other.fFields) { + CleanupType cleanup(this, &FieldValueMap::cleanUp); + + try { + + XMLSize_t valuesSize = other.fValues->size(); + + fFields = new (fMemoryManager) ValueVectorOf(*(other.fFields)); + fValidators = new (fMemoryManager) ValueVectorOf(*(other.fValidators)); + fValues = new (fMemoryManager) RefArrayVectorOf(other.fFields->curCapacity(), true, fMemoryManager); + + for (XMLSize_t i=0; iaddElement(XMLString::replicate(other.fValues->elementAt(i), fMemoryManager)); + } + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); + } +} + +FieldValueMap::~FieldValueMap() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// FieldValueMap: Private helper methods. +// --------------------------------------------------------------------------- +void FieldValueMap::cleanUp() +{ + delete fFields; + delete fValidators; + delete fValues; +} + +// --------------------------------------------------------------------------- +// FieldValueMap: Helper methods +// --------------------------------------------------------------------------- +bool FieldValueMap::indexOf(const IC_Field* const key, XMLSize_t& location) const { + + if (fFields) { + + XMLSize_t fieldSize = fFields->size(); + + for (XMLSize_t i=0; i < fieldSize; i++) { + if (fFields->elementAt(i) == key) { + location=i; + return true; + } + } + } + + return false; +} + +void FieldValueMap::clear() +{ + if(fFields) + fFields->removeAllElements(); + if(fValidators) + fValidators->removeAllElements(); + if(fValues) + fValues->removeAllElements(); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file FieldValueMap.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.hpp new file mode 100644 index 000000000..4b5563034 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/FieldValueMap.hpp @@ -0,0 +1,198 @@ +/* + * 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: FieldValueMap.hpp 708224 2008-10-27 16:02:26Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_FIELDVALUEMAP_HPP) +#define XERCESC_INCLUDE_GUARD_FIELDVALUEMAP_HPP + +/** + * This class maps values associated with fields of an identity constraint + * that have successfully matched some string in an instance document. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class IC_Field; +class DatatypeValidator; + + +class VALIDATORS_EXPORT FieldValueMap : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + FieldValueMap(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + FieldValueMap(const FieldValueMap& other); + ~FieldValueMap(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + DatatypeValidator* getDatatypeValidatorAt(const XMLSize_t index) const; + DatatypeValidator* getDatatypeValidatorFor(const IC_Field* const key) const; + XMLCh* getValueAt(const XMLSize_t index) const; + XMLCh* getValueFor(const IC_Field* const key) const; + IC_Field* keyAt(const XMLSize_t index) const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void put(IC_Field* const key, DatatypeValidator* const dv, + const XMLCh* const value); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + XMLSize_t size() const; + bool indexOf(const IC_Field* const key, XMLSize_t& location) const; + void clear(); + +private: + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Unimplemented operators + // ----------------------------------------------------------------------- + FieldValueMap& operator= (const FieldValueMap& other); + + // ----------------------------------------------------------------------- + // Data + // ----------------------------------------------------------------------- + ValueVectorOf* fFields; + ValueVectorOf* fValidators; + RefArrayVectorOf* fValues; + MemoryManager* fMemoryManager; +}; + + +// --------------------------------------------------------------------------- +// FieldValueMap: Getter methods +// --------------------------------------------------------------------------- +inline DatatypeValidator* +FieldValueMap::getDatatypeValidatorAt(const XMLSize_t index) const { + + if (fValidators) { + return fValidators->elementAt(index); + } + + return 0; +} + +inline DatatypeValidator* +FieldValueMap::getDatatypeValidatorFor(const IC_Field* const key) const { + + XMLSize_t location; + if (fValidators && indexOf(key, location)) { + return fValidators->elementAt(location); + } + + return 0; +} + +inline XMLCh* FieldValueMap::getValueAt(const XMLSize_t index) const { + + if (fValues) { + return fValues->elementAt(index); + } + + return 0; +} + +inline XMLCh* FieldValueMap::getValueFor(const IC_Field* const key) const { + + XMLSize_t location; + if (fValues && indexOf(key, location)) { + return fValues->elementAt(location); + } + + return 0; +} + +inline IC_Field* FieldValueMap::keyAt(const XMLSize_t index) const { + + if (fFields) { + return fFields->elementAt(index); + } + + return 0; +} + +// --------------------------------------------------------------------------- +// FieldValueMap: Helper methods +// --------------------------------------------------------------------------- +inline XMLSize_t FieldValueMap::size() const { + + if (fFields) { + return fFields->size(); + } + + return 0; +} + +// --------------------------------------------------------------------------- +// FieldValueMap: Setter methods +// --------------------------------------------------------------------------- +inline void FieldValueMap::put(IC_Field* const key, + DatatypeValidator* const dv, + const XMLCh* const value) { + + if (!fFields) { + fFields = new (fMemoryManager) ValueVectorOf(4, fMemoryManager); + fValidators = new (fMemoryManager) ValueVectorOf(4, fMemoryManager); + fValues = new (fMemoryManager) RefArrayVectorOf(4, true, fMemoryManager); + } + + XMLSize_t keyIndex; + bool bFound=indexOf(key, keyIndex); + + if (!bFound) { + + fFields->addElement(key); + fValidators->addElement(dv); + fValues->addElement(XMLString::replicate(value, fMemoryManager)); + } + else { + fValidators->setElementAt(dv, keyIndex); + fValues->setElementAt(XMLString::replicate(value, fMemoryManager), keyIndex); + } +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file FieldValueMap.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.cpp new file mode 100644 index 000000000..ef4829580 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.cpp @@ -0,0 +1,141 @@ +/* + * 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: IC_Field.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// FieldMatcher: Constructors and Destructor +// --------------------------------------------------------------------------- +FieldMatcher::FieldMatcher(XercesXPath* const xpath, + IC_Field* const aField, + ValueStore* const valueStore, + FieldActivator* const fieldActivator, + MemoryManager* const manager) + : XPathMatcher(xpath, (IdentityConstraint*) 0, manager) + , fValueStore(valueStore) + , fField(aField) + , fFieldActivator(fieldActivator) +{ +} + +// --------------------------------------------------------------------------- +// FieldMatcher: Match methods +// --------------------------------------------------------------------------- +void FieldMatcher::matched(const XMLCh* const content, + DatatypeValidator* const dv, + const bool isNil) { + + if(isNil) { + fValueStore->reportNilError(fField->getIdentityConstraint()); + } + + fValueStore->addValue(fFieldActivator, fField, dv, content); + + // once we've stored the value for this field, we set the mayMatch + // member to false so that, in the same scope, we don't match any more + // values (and throw an error instead). + fFieldActivator->setMayMatch(fField, false); +} + +// --------------------------------------------------------------------------- +// IC_Field: Constructors and Destructor +// --------------------------------------------------------------------------- +IC_Field::IC_Field(XercesXPath* const xpath, + IdentityConstraint* const identityConstraint) + : fXPath(xpath) + , fIdentityConstraint(identityConstraint) +{ +} + + +IC_Field::~IC_Field() +{ + delete fXPath; +} + +// --------------------------------------------------------------------------- +// IC_Field: operators +// --------------------------------------------------------------------------- +bool IC_Field::operator== (const IC_Field& other) const { + + return (*fXPath == *(other.fXPath)); +} + +bool IC_Field::operator!= (const IC_Field& other) const { + + return !operator==(other); +} + +// --------------------------------------------------------------------------- +// IC_Field: Factory methods +// --------------------------------------------------------------------------- +XPathMatcher* IC_Field::createMatcher(FieldActivator* const fieldActivator, + ValueStore* const valueStore, + MemoryManager* const manager) +{ + return new (manager) FieldMatcher(fXPath, this, valueStore, fieldActivator, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IC_Field) + +void IC_Field::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<>fXPath; + + fIdentityConstraint = IdentityConstraint::loadIC(serEng); + } + +} + +IC_Field::IC_Field(MemoryManager* const ) +:fXPath(0) +,fIdentityConstraint(0) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IC_Field.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.hpp new file mode 100644 index 000000000..299813006 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Field.hpp @@ -0,0 +1,152 @@ +/* + * 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: IC_Field.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IC_FIELD_HPP) +#define XERCESC_INCLUDE_GUARD_IC_FIELD_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class ValueStore; +class FieldActivator; + + +class VALIDATORS_EXPORT IC_Field : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IC_Field(XercesXPath* const xpath, + IdentityConstraint* const identityConstraint); + ~IC_Field(); + + // ----------------------------------------------------------------------- + // operators + // ----------------------------------------------------------------------- + bool operator== (const IC_Field& other) const; + bool operator!= (const IC_Field& other) const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XercesXPath* getXPath() const { return fXPath; } + IdentityConstraint* getIdentityConstraint() const { return fIdentityConstraint; } + + // ----------------------------------------------------------------------- + // Factory methods + // ----------------------------------------------------------------------- + XPathMatcher* createMatcher + ( + FieldActivator* const fieldActivator + , ValueStore* const valueStore + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IC_Field) + + IC_Field(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IC_Field(const IC_Field& other); + IC_Field& operator= (const IC_Field& other); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + XercesXPath* fXPath; + IdentityConstraint* fIdentityConstraint; +}; + + +class VALIDATORS_EXPORT FieldMatcher : public XPathMatcher +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + ~FieldMatcher() {} + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + ValueStore* getValueStore() const { return fValueStore; } + IC_Field* getField() const { return fField; } + + // ----------------------------------------------------------------------- + // Virtual methods + // ----------------------------------------------------------------------- + void matched(const XMLCh* const content, DatatypeValidator* const dv, + const bool isNil); + +private: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + FieldMatcher(XercesXPath* const anXPath, + IC_Field* const aField, + ValueStore* const valueStore, + FieldActivator* const fieldActivator, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + FieldMatcher(const FieldMatcher& other); + FieldMatcher& operator= (const FieldMatcher& other); + + // ----------------------------------------------------------------------- + // Friends + // ----------------------------------------------------------------------- + friend class IC_Field; + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + ValueStore* fValueStore; + IC_Field* fField; + FieldActivator* fFieldActivator; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IC_Field.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.cpp new file mode 100644 index 000000000..4cebd5074 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.cpp @@ -0,0 +1,67 @@ +/* + * 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: IC_Key.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// IC_Key: Constructors and Destructor +// --------------------------------------------------------------------------- +IC_Key::IC_Key(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + MemoryManager* const manager) +:IdentityConstraint(identityConstraintName, elemName, manager) +{ +} + + +IC_Key::~IC_Key() +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IC_Key) + +void IC_Key::serialize(XSerializeEngine& serEng) +{ + IdentityConstraint::serialize(serEng); + + //no data +} + +IC_Key::IC_Key(MemoryManager* const manager) +:IdentityConstraint(0, 0, manager) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IC_Key.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.hpp new file mode 100644 index 000000000..26c9f32a0 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Key.hpp @@ -0,0 +1,80 @@ +/* + * 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: IC_Key.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IC_KEY_HPP) +#define XERCESC_INCLUDE_GUARD_IC_KEY_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT IC_Key: public IdentityConstraint +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IC_Key(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~IC_Key(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + short getType() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IC_Key) + + IC_Key(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IC_Key(const IC_Key& other); + IC_Key& operator= (const IC_Key& other); +}; + + +// --------------------------------------------------------------------------- +// IC_Key: Getter methods +// --------------------------------------------------------------------------- +inline short IC_Key::getType() const { + + return IdentityConstraint::ICType_KEY; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IC_Key.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.cpp new file mode 100644 index 000000000..9f70f2d58 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.cpp @@ -0,0 +1,79 @@ +/* + * 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: IC_KeyRef.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// IC_KeyRef: Constructors and Destructor +// --------------------------------------------------------------------------- +IC_KeyRef::IC_KeyRef(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + IdentityConstraint* const icKey, + MemoryManager* const manager) + : IdentityConstraint(identityConstraintName, elemName, manager) + , fKey(icKey) +{ +} + + +IC_KeyRef::~IC_KeyRef() +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IC_KeyRef) + +void IC_KeyRef::serialize(XSerializeEngine& serEng) +{ + IdentityConstraint::serialize(serEng); + + if (serEng.isStoring()) + { + IdentityConstraint::storeIC(serEng, fKey); + } + else + { + fKey = IdentityConstraint::loadIC(serEng); + } + +} + +IC_KeyRef::IC_KeyRef(MemoryManager* const manager) +:IdentityConstraint(0, 0, manager) +,fKey(0) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IC_KeyRef.cpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.hpp new file mode 100644 index 000000000..7f30fb443 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_KeyRef.hpp @@ -0,0 +1,92 @@ +/* + * 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: IC_KeyRef.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IC_KEYREF_HPP) +#define XERCESC_INCLUDE_GUARD_IC_KEYREF_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT IC_KeyRef: public IdentityConstraint +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IC_KeyRef(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + IdentityConstraint* const icKey, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~IC_KeyRef(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + short getType() const; + IdentityConstraint* getKey() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IC_KeyRef) + + IC_KeyRef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IC_KeyRef(const IC_KeyRef& other); + IC_KeyRef& operator= (const IC_KeyRef& other); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + IdentityConstraint* fKey; +}; + + +// --------------------------------------------------------------------------- +// IC_KeyRef: Getter methods +// --------------------------------------------------------------------------- +inline short IC_KeyRef::getType() const { + + return IdentityConstraint::ICType_KEYREF; +} + +inline IdentityConstraint* IC_KeyRef::getKey() const { + + return fKey; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IC_KeyRef.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.cpp new file mode 100644 index 000000000..c09f164ff --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.cpp @@ -0,0 +1,178 @@ +/* + * 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: IC_Selector.cpp 803869 2009-08-13 12:56:21Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SelectorMatcher: Constructors and Destructor +// --------------------------------------------------------------------------- +SelectorMatcher::SelectorMatcher(XercesXPath* const xpath, + IC_Selector* const selector, + FieldActivator* const fieldActivator, + const int initialDepth, + MemoryManager* const manager) + : XPathMatcher(xpath, selector->getIdentityConstraint(), manager) + , fInitialDepth(initialDepth) + , fElementDepth(0) + , fMatchedDepth(-1) + , fSelector(selector) + , fFieldActivator(fieldActivator) +{ +} + +// --------------------------------------------------------------------------- +// FieldMatcher: XMLDocumentHandler methods +// --------------------------------------------------------------------------- +void SelectorMatcher::startDocumentFragment() { + + XPathMatcher::startDocumentFragment(); + fElementDepth = 0; + fMatchedDepth = -1; +} + +void SelectorMatcher::startElement(const XMLElementDecl& elemDecl, + const unsigned int urlId, + const XMLCh* const elemPrefix, + const RefVectorOf& attrList, + const XMLSize_t attrCount, + ValidationContext* validationContext /*=0*/) +{ + + XPathMatcher::startElement(elemDecl, urlId, elemPrefix, attrList, attrCount, validationContext); + fElementDepth++; + + // activate the fields, if selector is matched + unsigned char matched = isMatched(); + if ((fMatchedDepth == -1 && ((matched & XP_MATCHED) == XP_MATCHED)) + || ((matched & XP_MATCHED_D) == XP_MATCHED_D)) { + + IdentityConstraint* ic = fSelector->getIdentityConstraint(); + XMLSize_t count = ic->getFieldCount(); + + fMatchedDepth = fElementDepth; + fFieldActivator->startValueScopeFor(ic, fInitialDepth); + + for (XMLSize_t i = 0; i < count; i++) { + + XPathMatcher* matcher = fFieldActivator->activateField(ic->getFieldAt(i), fInitialDepth); + matcher->startElement(elemDecl, urlId, elemPrefix, attrList, attrCount, validationContext); + } + } +} + +void SelectorMatcher::endElement(const XMLElementDecl& elemDecl, + const XMLCh* const elemContent, + ValidationContext* validationContext /*=0*/, + DatatypeValidator* actualValidator /*=0*/) +{ + + XPathMatcher::endElement(elemDecl, elemContent, validationContext, actualValidator); + + if (fElementDepth-- == fMatchedDepth) { + + fMatchedDepth = -1; + fFieldActivator->endValueScopeFor(fSelector->getIdentityConstraint(), fInitialDepth); + } +} + +// --------------------------------------------------------------------------- +// IC_Selector: Constructors and Destructor +// --------------------------------------------------------------------------- +IC_Selector::IC_Selector(XercesXPath* const xpath, + IdentityConstraint* const identityConstraint) + : fXPath(xpath) + , fIdentityConstraint(identityConstraint) +{ +} + + +IC_Selector::~IC_Selector() +{ + delete fXPath; +} + +// --------------------------------------------------------------------------- +// IC_Selector: operators +// --------------------------------------------------------------------------- +bool IC_Selector::operator ==(const IC_Selector& other) const { + + return (*fXPath == *(other.fXPath)); +} + +bool IC_Selector::operator !=(const IC_Selector& other) const { + + return !operator==(other); +} + +// --------------------------------------------------------------------------- +// IC_Selector: Factory methods +// --------------------------------------------------------------------------- +XPathMatcher* IC_Selector::createMatcher(FieldActivator* const fieldActivator, + const int initialDepth, + MemoryManager* const manager) { + + return new (manager) SelectorMatcher(fXPath, this, fieldActivator, initialDepth, manager); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IC_Selector) + +void IC_Selector::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + serEng<>fXPath; + + fIdentityConstraint = IdentityConstraint::loadIC(serEng); + } + +} + +IC_Selector::IC_Selector(MemoryManager* const ) +:fXPath(0) +,fIdentityConstraint(0) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IC_Selector.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.hpp new file mode 100644 index 000000000..a4d242ff9 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Selector.hpp @@ -0,0 +1,155 @@ +/* + * 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: IC_Selector.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IC_SELECTOR_HPP) +#define XERCESC_INCLUDE_GUARD_IC_SELECTOR_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class FieldActivator; + + +class VALIDATORS_EXPORT IC_Selector : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IC_Selector(XercesXPath* const xpath, + IdentityConstraint* const identityConstraint); + ~IC_Selector(); + + // ----------------------------------------------------------------------- + // operators + // ----------------------------------------------------------------------- + bool operator== (const IC_Selector& other) const; + bool operator!= (const IC_Selector& other) const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XercesXPath* getXPath() const { return fXPath; } + IdentityConstraint* getIdentityConstraint() const { return fIdentityConstraint; } + + // ----------------------------------------------------------------------- + // Factory methods + // ----------------------------------------------------------------------- + XPathMatcher* createMatcher(FieldActivator* const fieldActivator, + const int initialDepth, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IC_Selector) + + IC_Selector(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IC_Selector(const IC_Selector& other); + IC_Selector& operator= (const IC_Selector& other); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + XercesXPath* fXPath; + IdentityConstraint* fIdentityConstraint; +}; + + +class VALIDATORS_EXPORT SelectorMatcher : public XPathMatcher +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + ~SelectorMatcher() {} + + int getInitialDepth() const { return fInitialDepth; } + + // ----------------------------------------------------------------------- + // XMLDocumentHandler methods + // ----------------------------------------------------------------------- + virtual void startDocumentFragment(); + virtual void startElement(const XMLElementDecl& elemDecl, + const unsigned int urlId, + const XMLCh* const elemPrefix, + const RefVectorOf& attrList, + const XMLSize_t attrCount, + ValidationContext* validationContext = 0); + virtual void endElement(const XMLElementDecl& elemDecl, + const XMLCh* const elemContent, + ValidationContext* validationContext = 0, + DatatypeValidator* actualValidator = 0); + +private: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + SelectorMatcher(XercesXPath* const anXPath, + IC_Selector* const selector, + FieldActivator* const fieldActivator, + const int initialDepth, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + SelectorMatcher(const SelectorMatcher& other); + SelectorMatcher& operator= (const SelectorMatcher& other); + + // ----------------------------------------------------------------------- + // Friends + // ----------------------------------------------------------------------- + friend class IC_Selector; + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + int fInitialDepth; + int fElementDepth; + int fMatchedDepth; + IC_Selector* fSelector; + FieldActivator* fFieldActivator; +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IC_Selector.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.cpp new file mode 100644 index 000000000..d23849909 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.cpp @@ -0,0 +1,68 @@ +/* + * 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: IC_Unique.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// IC_Unique: Constructors and Destructor +// --------------------------------------------------------------------------- +IC_Unique::IC_Unique(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + MemoryManager* const manager) + : IdentityConstraint(identityConstraintName, elemName, manager) +{ +} + + +IC_Unique::~IC_Unique() +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(IC_Unique) + +void IC_Unique::serialize(XSerializeEngine& serEng) +{ + IdentityConstraint::serialize(serEng); + + //no data +} + +IC_Unique::IC_Unique(MemoryManager* const manager) +:IdentityConstraint(0, 0, manager) +{ +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IC_Unique.cpp + */ + + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.hpp new file mode 100644 index 000000000..52ad029ae --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IC_Unique.hpp @@ -0,0 +1,84 @@ +/* + * 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: IC_Unique.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IC_UNIQUE_HPP) +#define XERCESC_INCLUDE_GUARD_IC_UNIQUE_HPP + + +/** + * Schema unique identity constraint + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT IC_Unique: public IdentityConstraint +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IC_Unique(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~IC_Unique(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + short getType() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IC_Unique) + + IC_Unique(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IC_Unique(const IC_Unique& other); + IC_Unique& operator= (const IC_Unique& other); +}; + + +// --------------------------------------------------------------------------- +// IC_Unique: Getter methods +// --------------------------------------------------------------------------- +inline short IC_Unique::getType() const { + + return IdentityConstraint::ICType_UNIQUE; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IC_Unique.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.cpp new file mode 100644 index 000000000..475aba39c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.cpp @@ -0,0 +1,226 @@ +/* + * 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: IdentityConstraint.cpp 676911 2008-07-15 13:27:32Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +//since we need to dynamically created each and every derivatives +//during deserialization by XSerializeEngine>>Derivative, we got +//to include all hpp +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// IdentityConstraint: Constructors and Destructor +// --------------------------------------------------------------------------- +IdentityConstraint::IdentityConstraint(const XMLCh* const identityConstraintName, + const XMLCh* const elemName, + MemoryManager* const manager) + : fIdentityConstraintName(0) + , fElemName(0) + , fSelector(0) + , fFields(0) + , fMemoryManager(manager) + , fNamespaceURI(-1) +{ + CleanupType cleanup(this, &IdentityConstraint::cleanUp); + + try { + fIdentityConstraintName = XMLString::replicate(identityConstraintName, fMemoryManager); + fElemName = XMLString::replicate(elemName, fMemoryManager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +IdentityConstraint::~IdentityConstraint() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// IdentityConstraint: operators +// --------------------------------------------------------------------------- +bool IdentityConstraint::operator ==(const IdentityConstraint& other) const { + + if (getType() != other.getType()) + return false; + + if (!XMLString::equals(fIdentityConstraintName, other.fIdentityConstraintName)) + return false; + + if (*fSelector != *(other.fSelector)) + return false; + + XMLSize_t fieldCount = fFields->size(); + + if (fieldCount != other.fFields->size()) + return false; + + for (XMLSize_t i = 0; i < fieldCount; i++) { + if (*(fFields->elementAt(i)) != *(other.fFields->elementAt(i))) + return false; + } + + return true; +} + +bool IdentityConstraint::operator !=(const IdentityConstraint& other) const { + + return !operator==(other); +} + +// --------------------------------------------------------------------------- +// IdentityConstraint: Setter methods +// --------------------------------------------------------------------------- +void IdentityConstraint::setSelector(IC_Selector* const selector) { + + if (fSelector) { + delete fSelector; + } + + fSelector = selector; +} + + +// --------------------------------------------------------------------------- +// IdentityConstraint: cleanUp methods +// --------------------------------------------------------------------------- +void IdentityConstraint::cleanUp() { + + fMemoryManager->deallocate(fIdentityConstraintName);//delete [] fIdentityConstraintName; + fMemoryManager->deallocate(fElemName);//delete [] fElemName; + delete fFields; + delete fSelector; +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_NOCREATE(IdentityConstraint) + +void IdentityConstraint::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng.writeString(fIdentityConstraintName); + serEng.writeString(fElemName); + + serEng<* fFields; + * + ***/ + XTemplateSerializer::storeObject(fFields, serEng); + + } + else + { + + serEng.readString(fIdentityConstraintName); + serEng.readString(fElemName); + + serEng>>fSelector; + serEng>>fNamespaceURI; + /*** + * + * Deserialize RefVectorOf* fFields; + * + ***/ + XTemplateSerializer::loadObject(&fFields, 4, true, serEng); + + } + +} + +void IdentityConstraint::storeIC(XSerializeEngine& serEng + , IdentityConstraint* const ic) +{ + if (ic) + { + serEng<<(int) ic->getType(); + serEng<>type; + + switch((ICType)type) + { + case ICType_UNIQUE: + IC_Unique* ic_unique; + serEng>>ic_unique; + return ic_unique; + case ICType_KEY: + IC_Key* ic_key; + serEng>>ic_key; + return ic_key; + case ICType_KEYREF: + IC_KeyRef* ic_keyref; + serEng>>ic_keyref; + return ic_keyref; + case ICType_UNKNOWN: + return 0; + default: //we treat this same as UnKnown + return 0; + } + +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IdentityConstraint.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.hpp new file mode 100644 index 000000000..b6c49b584 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraint.hpp @@ -0,0 +1,223 @@ +/* + * 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: IdentityConstraint.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HPP) +#define XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HPP + + +/** + * The class act as a base class for schema identity constraints. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class IC_Selector; + +class VALIDATORS_EXPORT IdentityConstraint : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + enum ICType { + ICType_UNIQUE = 0, + ICType_KEY = 1, + ICType_KEYREF = 2, + ICType_UNKNOWN + }; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + virtual ~IdentityConstraint(); + + // ----------------------------------------------------------------------- + // operators + // ----------------------------------------------------------------------- + bool operator== (const IdentityConstraint& other) const; + bool operator!= (const IdentityConstraint& other) const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + virtual short getType() const = 0; + XMLSize_t getFieldCount() const; + XMLCh* getIdentityConstraintName() const; + XMLCh* getElementName() const; + IC_Selector* getSelector() const; + int getNamespaceURI() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + void setSelector(IC_Selector* const selector); + void setNamespaceURI(int uri); + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + void addField(IC_Field* const field); + const IC_Field* getFieldAt(const XMLSize_t index) const; + IC_Field* getFieldAt(const XMLSize_t index); + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(IdentityConstraint) + + static void storeIC(XSerializeEngine& serEng + , IdentityConstraint* const ic); + + static IdentityConstraint* loadIC(XSerializeEngine& serEng); + +protected: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + IdentityConstraint(const XMLCh* const identityConstraintName, + const XMLCh* const elementName, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IdentityConstraint(const IdentityConstraint& other); + IdentityConstraint& operator= (const IdentityConstraint& other); + + // ----------------------------------------------------------------------- + // CleanUp methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Data members + // + // fIdentityConstraintName + // The identity constraint name + // + // fElemName + // The element name + // + // fSelector + // The selector information + // + // fFields + // The field(s) information + // ----------------------------------------------------------------------- + XMLCh* fIdentityConstraintName; + XMLCh* fElemName; + IC_Selector* fSelector; + RefVectorOf* fFields; + MemoryManager* fMemoryManager; + int fNamespaceURI; +}; + + +// --------------------------------------------------------------------------- +// IdentityConstraint: Getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t IdentityConstraint::getFieldCount() const { + + if (fFields) { + return fFields->size(); + } + + return 0; +} + +inline XMLCh* IdentityConstraint::getIdentityConstraintName() const { + + return fIdentityConstraintName; +} + +inline XMLCh* IdentityConstraint::getElementName() const { + + return fElemName; +} + +inline IC_Selector* IdentityConstraint::getSelector() const { + + return fSelector; +} + +inline int IdentityConstraint::getNamespaceURI() const +{ + return fNamespaceURI; +} + +// --------------------------------------------------------------------------- +// IdentityConstraint: Setter methods +// --------------------------------------------------------------------------- +inline void IdentityConstraint::setNamespaceURI(int uri) +{ + fNamespaceURI = uri; +} + +// --------------------------------------------------------------------------- +// IdentityConstraint: Access methods +// --------------------------------------------------------------------------- +inline void IdentityConstraint::addField(IC_Field* const field) { + + if (!fFields) { + fFields = new (fMemoryManager) RefVectorOf(4, true, fMemoryManager); + } + + fFields->addElement(field); +} + +inline const IC_Field* IdentityConstraint::getFieldAt(const XMLSize_t index) const { + + if (fFields) { + return (fFields->elementAt(index)); + } + + return 0; +} + +inline IC_Field* IdentityConstraint::getFieldAt(const XMLSize_t index) { + + if (fFields) { + return (fFields->elementAt(index)); + } + + return 0; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IdentityConstraint.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp new file mode 100644 index 000000000..ca7ecbc75 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.cpp @@ -0,0 +1,215 @@ +/* + * 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: IdentityConstraintHandler.cpp 803869 2009-08-13 12:56:21Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include "IdentityConstraintHandler.hpp" + +#include + +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// IdentityConstraintHandler: Constructors and Destructor +// --------------------------------------------------------------------------- +IdentityConstraintHandler::IdentityConstraintHandler(XMLScanner* const scanner + , MemoryManager* const manager) +: fScanner(scanner) +, fMemoryManager(manager) +, fMatcherStack(0) +, fValueStoreCache(0) +, fFieldActivator(0) +{ + CleanupType cleanup(this, &IdentityConstraintHandler::cleanUp); + + try { + + fMatcherStack = new (fMemoryManager) XPathMatcherStack(fMemoryManager); + fValueStoreCache = new (fMemoryManager) ValueStoreCache(fMemoryManager); + fFieldActivator = new (fMemoryManager) FieldActivator(fValueStoreCache, fMatcherStack, fMemoryManager); + + fValueStoreCache->setScanner(scanner); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +IdentityConstraintHandler::~IdentityConstraintHandler() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// IdentityConstraintHandler: methods +// --------------------------------------------------------------------------- +void IdentityConstraintHandler::deactivateContext( SchemaElementDecl* const elem + , const XMLCh* const content + , ValidationContext* validationContext /*=0*/ + , DatatypeValidator* actualValidator /*=0*/) +{ + + XMLSize_t oldCount = fMatcherStack->getMatcherCount(); + + if (oldCount || elem->getIdentityConstraintCount()) + { + + for (XMLSize_t i = oldCount; i > 0; i--) + { + XPathMatcher* matcher = fMatcherStack->getMatcherAt(i-1); + matcher->endElement(*(elem), content, validationContext, actualValidator); + } + + if (fMatcherStack->size() > 0) + { + fMatcherStack->popContext(); + } + + // handle everything *but* keyref's. + XMLSize_t newCount = fMatcherStack->getMatcherCount(); + + for (XMLSize_t j = oldCount; j > newCount; j--) + { + XPathMatcher* matcher = fMatcherStack->getMatcherAt(j-1); + IdentityConstraint* ic = matcher->getIdentityConstraint(); + + if (ic && (ic->getType() != IdentityConstraint::ICType_KEYREF)) + fValueStoreCache->transplant(ic, matcher->getInitialDepth()); + } + + // now handle keyref's... + for (XMLSize_t k = oldCount; k > newCount; k--) + { + XPathMatcher* matcher = fMatcherStack->getMatcherAt(k-1); + IdentityConstraint* ic = matcher->getIdentityConstraint(); + + if (ic && (ic->getType() == IdentityConstraint::ICType_KEYREF)) + { + ValueStore* values = fValueStoreCache->getValueStoreFor(ic, matcher->getInitialDepth()); + + if (values) { // nothing to do if nothing matched! + values->endDocumentFragment(fValueStoreCache); + } + } + } + + fValueStoreCache->endElement(); + + } +} + +void IdentityConstraintHandler::activateIdentityConstraint + ( + SchemaElementDecl* const elem + , int elemDepth + , const unsigned int uriId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , ValidationContext* validationContext /*=0*/) +{ + + XMLSize_t count = elem->getIdentityConstraintCount(); + + if (count || fMatcherStack->getMatcherCount()) + { + + fValueStoreCache->startElement(); + fMatcherStack->pushContext(); + fValueStoreCache->initValueStoresFor( elem, elemDepth); + + for (XMLSize_t i = 0; i < count; i++) + { + activateSelectorFor(elem->getIdentityConstraintAt(i), elemDepth); + } + + // call all active identity constraints + count = fMatcherStack->getMatcherCount(); + + for (XMLSize_t j = 0; j < count; j++) + { + XPathMatcher* matcher = fMatcherStack->getMatcherAt(j); + matcher->startElement(*elem, uriId, elemPrefix, attrList, attrCount, validationContext); + } + } +} + +void IdentityConstraintHandler::activateSelectorFor( IdentityConstraint* const ic + , const int initialDepth) +{ + + IC_Selector* selector = ic->getSelector(); + + if (!selector) + return; + + XPathMatcher* matcher = selector->createMatcher(fFieldActivator, initialDepth, fMemoryManager); + + fMatcherStack->addMatcher(matcher); + matcher->startDocumentFragment(); +} + +// --------------------------------------------------------------------------- +// IdentityConstraintHandler: Getter methods +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// IdentityConstraintHandler: cleanUp methods +// --------------------------------------------------------------------------- +void IdentityConstraintHandler::cleanUp() +{ + if (fMatcherStack) + delete fMatcherStack; + + if (fValueStoreCache) + delete fValueStoreCache; + + if (fFieldActivator) + delete fFieldActivator; + +} + +void IdentityConstraintHandler::reset() +{ + fValueStoreCache->startDocument(); + fMatcherStack->clear(); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file IdentityConstraintHandler.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.hpp new file mode 100644 index 000000000..f3cff4fcd --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/IdentityConstraintHandler.hpp @@ -0,0 +1,159 @@ +/* + * 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: IdentityConstraintHandler.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HANDLER_HPP) +#define XERCESC_INCLUDE_GUARD_IDENTITYCONSTRAINT_HANDLER_HPP + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- + +class XMLScanner; +class FieldActivator; +class MemoryManager; +class XMLElementDecl; + +class VALIDATORS_EXPORT IdentityConstraintHandler: public XMemory +{ +public: + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + virtual ~IdentityConstraintHandler(); + + IdentityConstraintHandler + ( + XMLScanner* const scanner + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + inline XMLSize_t getMatcherCount() const; + + // ----------------------------------------------------------------------- + // Setter methods + // ----------------------------------------------------------------------- + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + inline void endDocument(); + + void deactivateContext + ( + SchemaElementDecl* const elem + , const XMLCh* const content + , ValidationContext* validationContext = 0 + , DatatypeValidator* actualValidator = 0); + + void activateIdentityConstraint + ( + SchemaElementDecl* const elem + , int elemDepth + , const unsigned int uriId + , const XMLCh* const elemPrefix + , const RefVectorOf& attrList + , const XMLSize_t attrCount + , ValidationContext* validationContext = 0 ); + + void reset(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + IdentityConstraintHandler(const IdentityConstraintHandler& other); + IdentityConstraintHandler& operator= (const IdentityConstraintHandler& other); + + // ----------------------------------------------------------------------- + // CleanUp methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Helper + // ----------------------------------------------------------------------- + void activateSelectorFor( + IdentityConstraint* const ic + , const int initialDepth + ) ; + + // ----------------------------------------------------------------------- + // Data members + // + // fMatcherStack + // Stack of active XPath matchers for identity constraints. All + // active XPath matchers are notified of startElement, characters + // and endElement callbacks in order to perform their matches. + // + // fValueStoreCache + // Cache of value stores for identity constraint fields. + // + // fFieldActivator + // Activates fields within a certain scope when a selector matches + // its xpath. + // + // ----------------------------------------------------------------------- + XMLScanner* fScanner; + MemoryManager* fMemoryManager; + + XPathMatcherStack* fMatcherStack; + ValueStoreCache* fValueStoreCache; + FieldActivator* fFieldActivator; + +}; + + +// --------------------------------------------------------------------------- +// IdentityConstraintHandler: +// --------------------------------------------------------------------------- + +inline +void IdentityConstraintHandler::endDocument() +{ + fValueStoreCache->endDocument(); +} + +inline +XMLSize_t IdentityConstraintHandler::getMatcherCount() const +{ + return fMatcherStack->getMatcherCount(); +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file IdentityConstraintHandler.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.cpp new file mode 100644 index 000000000..cd3c86d5a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.cpp @@ -0,0 +1,352 @@ +/* + * 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: ValueStore.cpp 804209 2009-08-14 13:15:05Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// +// --------------------------------------------------------------------------- +// ICValueHasher: the hasher for identity constraints values +// --------------------------------------------------------------------------- +XMLSize_t ICValueHasher::getHashVal(const void* key, XMLSize_t mod) const +{ + const FieldValueMap* valueMap=(const FieldValueMap*)key; + XMLSize_t hashVal = 0; + + XMLSize_t size = valueMap->size(); + for (XMLSize_t j=0; jgetDatatypeValidatorAt(j); + while(dv && dv->getBaseValidator()) + dv = dv->getBaseValidator(); + const XMLCh* const val = valueMap->getValueAt(j); + const XMLCh* canonVal = (dv && val)?dv->getCanonicalRepresentation(val, fMemoryManager):0; + if(canonVal) + { + hashVal += XMLString::hash(canonVal, mod); + fMemoryManager->deallocate((void*)canonVal); + } + else if(val) + hashVal += XMLString::hash(val, mod); + } + + return hashVal % mod; +} + +bool ICValueHasher::equals(const void *const key1, const void *const key2) const +{ + const FieldValueMap* left=(const FieldValueMap*)key1; + const FieldValueMap* right=(const FieldValueMap*)key2; + + XMLSize_t lSize = left->size(); + XMLSize_t rSize = right->size(); + if (lSize == rSize) + { + bool matchFound = true; + + for (XMLSize_t j=0; jgetDatatypeValidatorAt(j), left->getValueAt(j), + right->getDatatypeValidatorAt(j), right->getValueAt(j))) { + matchFound = false; + break; + } + } + + if (matchFound) { // found it + return true; + } + } + return false; +} + +bool ICValueHasher::isDuplicateOf(DatatypeValidator* const dv1, const XMLCh* const val1, + DatatypeValidator* const dv2, const XMLCh* const val2) const +{ + + // if either validator's null, fall back on string comparison + if(!dv1 || !dv2) { + return (XMLString::equals(val1, val2)); + } + + bool val1IsEmpty = (val1==0 || *val1==0); + bool val2IsEmpty = (val2==0 || *val2==0); + + if (val1IsEmpty && val2IsEmpty) { + + if (dv1 == dv2) { + return true; + } + + return false; + } + + if (val1IsEmpty || val2IsEmpty) { + return false; + } + + // find the common ancestor, if there is one + DatatypeValidator* tempVal1 = dv1; + while(tempVal1) + { + DatatypeValidator* tempVal2 = dv2; + for(; tempVal2 != NULL && tempVal2 != tempVal1; tempVal2 = tempVal2->getBaseValidator()) ; + if (tempVal2) + return ((tempVal2->compare(val1, val2, fMemoryManager)) == 0); + tempVal1=tempVal1->getBaseValidator(); + } + + // if we're here it means the types weren't related. They are different: + return false; +} + +// --------------------------------------------------------------------------- +// ValueStore: Constructors and Destructor +// --------------------------------------------------------------------------- +ValueStore::ValueStore(IdentityConstraint* const ic, + XMLScanner* const scanner, + MemoryManager* const manager) + : fDoReportError(false) + , fValuesCount(0) + , fIdentityConstraint(ic) + , fValues(manager) + , fValueTuples(0) + , fScanner(scanner) + , fMemoryManager(manager) +{ + fDoReportError = (scanner && (scanner->getValidationScheme() == XMLScanner::Val_Always)); +} + + +ValueStore::~ValueStore() +{ + delete fValueTuples; +} + +// --------------------------------------------------------------------------- +// ValueStore: Helper methods +// --------------------------------------------------------------------------- +void ValueStore::addValue(FieldActivator* const fieldActivator, + IC_Field* const field, + DatatypeValidator* const dv, + const XMLCh* const value) { + + if (!fieldActivator->getMayMatch(field) && fDoReportError) { + fScanner->getValidator()->emitError(XMLValid::IC_FieldMultipleMatch); + } + + // do we even know this field? + XMLSize_t index; + bool bFound = fValues.indexOf(field, index); + + if (!bFound) { + + if (fDoReportError) { + fScanner->getValidator()->emitError(XMLValid::IC_UnknownField); + } + + return; + } + + // store value + if (!fValues.getDatatypeValidatorAt(index) && + !fValues.getValueAt(index)) { + fValuesCount++; + } + + fValues.put(field, dv, value); + + if (fValuesCount == fValues.size()) { + + // is this value as a group duplicated? + if (contains(&fValues)) { + duplicateValue(); + } + + // store values + if (!fValueTuples) { + fValueTuples = new (fMemoryManager) RefHashTableOf(107, true, ICValueHasher(fMemoryManager), fMemoryManager); + } + + FieldValueMap* pICItem = new (fMemoryManager) FieldValueMap(fValues); + fValueTuples->put(pICItem, pICItem); + } +} + +void ValueStore::append(const ValueStore* const other) { + + if (!other->fValueTuples) { + return; + } + + RefHashTableOfEnumerator iter(other->fValueTuples, false, fMemoryManager); + while(iter.hasMoreElements()) + { + FieldValueMap& valueMap = iter.nextElement(); + + if (!contains(&valueMap)) { + + if (!fValueTuples) { + fValueTuples = new (fMemoryManager) RefHashTableOf(107, true, ICValueHasher(fMemoryManager), fMemoryManager); + } + + FieldValueMap* pICItem = new (fMemoryManager) FieldValueMap(valueMap); + fValueTuples->put(pICItem, pICItem); + } + } +} + +void ValueStore::startValueScope() { + + fValuesCount = 0; + + XMLSize_t count = fIdentityConstraint->getFieldCount(); + + for (XMLSize_t i = 0; i < count; i++) { + fValues.put(fIdentityConstraint->getFieldAt(i), 0, 0); + } +} + +void ValueStore::endValueScope() { + + if (fValuesCount == 0) { + + if (fIdentityConstraint->getType() == IdentityConstraint::ICType_KEY && fDoReportError) { + fScanner->getValidator()->emitError(XMLValid::IC_AbsentKeyValue, + fIdentityConstraint->getElementName()); + } + + return; + } + + // do we have enough values? + if ((fValuesCount != fIdentityConstraint->getFieldCount()) && fDoReportError) { + + if(fIdentityConstraint->getType()==IdentityConstraint::ICType_KEY) + { + fScanner->getValidator()->emitError(XMLValid::IC_KeyNotEnoughValues, + fIdentityConstraint->getElementName(), fIdentityConstraint->getIdentityConstraintName()); + } + } +} + +bool ValueStore::contains(const FieldValueMap* const other) { + + if (fValueTuples) + return fValueTuples->get(other)!=0; + + return false; +} + +void ValueStore::clear() +{ + fValuesCount=0; + fValues.clear(); + if(fValueTuples) + fValueTuples->removeAll(); +} + +// --------------------------------------------------------------------------- +// ValueStore: Document handling methods +// --------------------------------------------------------------------------- +void ValueStore::endDocumentFragment(ValueStoreCache* const valueStoreCache) { + + if (fIdentityConstraint->getType() == IdentityConstraint::ICType_KEYREF) { + + // verify references + // get the key store corresponding (if it exists): + ValueStore* keyValueStore = valueStoreCache->getGlobalValueStoreFor(((IC_KeyRef*) fIdentityConstraint)->getKey()); + + if (!keyValueStore) { + + if (fDoReportError) { + fScanner->getValidator()->emitError(XMLValid::IC_KeyRefOutOfScope, + fIdentityConstraint->getIdentityConstraintName()); + } + + return; + } + + if(fValueTuples) + { + RefHashTableOfEnumerator iter(fValueTuples, false, fMemoryManager); + while(iter.hasMoreElements()) + { + FieldValueMap& valueMap = iter.nextElement(); + + if (!keyValueStore->contains(&valueMap) && fDoReportError) { + + fScanner->getValidator()->emitError(XMLValid::IC_KeyNotFound, + fIdentityConstraint->getElementName()); + } + } + } + } +} + +// --------------------------------------------------------------------------- +// ValueStore: Error reporting methods +// --------------------------------------------------------------------------- +void ValueStore::reportNilError(IdentityConstraint* const ic) { + + if (fDoReportError && ic->getType() == IdentityConstraint::ICType_KEY) { + fScanner->getValidator()->emitError(XMLValid::IC_KeyMatchesNillable, + ic->getElementName()); + } +} + +void ValueStore::duplicateValue() { + + if (fDoReportError) { + + switch (fIdentityConstraint->getType()) { + case IdentityConstraint::ICType_UNIQUE: + { + fScanner->getValidator()->emitError(XMLValid::IC_DuplicateUnique, + fIdentityConstraint->getElementName()); + break; + } + case IdentityConstraint::ICType_KEY: + { + fScanner->getValidator()->emitError(XMLValid::IC_DuplicateKey, + fIdentityConstraint->getElementName()); + break; + } + } + } +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ValueStore.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.hpp new file mode 100644 index 000000000..1d52c48db --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStore.hpp @@ -0,0 +1,146 @@ +/* + * 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: ValueStore.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUESTORE_HPP) +#define XERCESC_INCLUDE_GUARD_VALUESTORE_HPP + +/** + * This class stores values associated to an identity constraint. + * Each value stored corresponds to a field declared for the identity + * constraint. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class FieldActivator; +class IdentityConstraint; +class XMLScanner; +class ValueStoreCache; + +struct ICValueHasher +{ + ICValueHasher(MemoryManager* const manager) : fMemoryManager(manager) {} + + XMLSize_t getHashVal(const void* key, XMLSize_t mod) const; + bool equals(const void *const key1, const void *const key2) const; + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + /** + * Returns whether a field associated value + * is a duplicate of another associated value. + * It is a duplicate only if either of these conditions are true: + * - The Datatypes are the same or related by derivation and the values + * are in the same valuespace. + * - The datatypes are unrelated and the values are Stringwise identical. + */ + bool isDuplicateOf(DatatypeValidator* const dv1, const XMLCh* const val1, + DatatypeValidator* const dv2, const XMLCh* const val2) const; + + + MemoryManager* fMemoryManager; +}; + +class VALIDATORS_EXPORT ValueStore : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + ValueStore(IdentityConstraint* const ic, + XMLScanner* const scanner, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ValueStore(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + IdentityConstraint* getIdentityConstraint() const; + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void append(const ValueStore* const other); + void startValueScope(); + void endValueScope(); + void addValue(FieldActivator* const fieldActivator, + IC_Field* const field, + DatatypeValidator* const dv, + const XMLCh* const value); + bool contains(const FieldValueMap* const other); + void clear(); + + // ----------------------------------------------------------------------- + // Document handling methods + // ----------------------------------------------------------------------- + void endDocumentFragment(ValueStoreCache* const valueStoreCache); + + // ----------------------------------------------------------------------- + // Error reporting methods + // ----------------------------------------------------------------------- + void duplicateValue(); + void reportNilError(IdentityConstraint* const ic); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueStore(const ValueStore& other); + ValueStore& operator= (const ValueStore& other); + + // ----------------------------------------------------------------------- + // Data + // ----------------------------------------------------------------------- + bool fDoReportError; + XMLSize_t fValuesCount; + IdentityConstraint* fIdentityConstraint; + FieldValueMap fValues; + RefHashTableOf* fValueTuples; + XMLScanner* fScanner; // for error reporting - REVISIT + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// ValueStore: Getter methods +// --------------------------------------------------------------------------- +inline IdentityConstraint* +ValueStore::getIdentityConstraint() const { + return fIdentityConstraint; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ValueStore.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.cpp new file mode 100644 index 000000000..ee3258f97 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.cpp @@ -0,0 +1,184 @@ +/* + * 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: ValueStoreCache.cpp 708224 2008-10-27 16:02:26Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// ValueStoreCache: Constructors and Destructor +// --------------------------------------------------------------------------- +ValueStoreCache::ValueStoreCache(MemoryManager* const manager) + : fValueStores(0) + , fGlobalICMap(0) + , fIC2ValueStoreMap(0) + , fGlobalMapStack(0) + , fScanner(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &ValueStoreCache::cleanUp); + + try { + init(); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +ValueStoreCache::~ValueStoreCache() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// ValueStoreCache: Document handling methods +// --------------------------------------------------------------------------- +void ValueStoreCache::startDocument() { + + fIC2ValueStoreMap->removeAll(); + fGlobalICMap->removeAll(); + fValueStores->removeAllElements(); + fGlobalMapStack->removeAllElements(); +} + +void ValueStoreCache::startElement() { + + fGlobalMapStack->push(fGlobalICMap); + fGlobalICMap = new (fMemoryManager) RefHashTableOf + ( + 13 + , false + , fMemoryManager + ); +} + +void ValueStoreCache::endElement() { + + if (fGlobalMapStack->empty()) { + return; // must be an invalid doc! + } + + RefHashTableOf* oldMap = fGlobalMapStack->pop(); + RefHashTableOfEnumerator mapEnum(oldMap, false, fMemoryManager); +// Janitor > janMap(oldMap); + + while (mapEnum.hasMoreElements()) { + + ValueStore& oldVal = mapEnum.nextElement(); + IdentityConstraint* ic = oldVal.getIdentityConstraint(); + ValueStore* currVal = fGlobalICMap->get(ic); + + if (!currVal) { + fGlobalICMap->put(ic, &oldVal); + } + else { + currVal->append(&oldVal); + } + } + delete oldMap; +} + +// --------------------------------------------------------------------------- +// ValueStoreCache: Helper methods +// --------------------------------------------------------------------------- +void ValueStoreCache::cleanUp() { + + delete fIC2ValueStoreMap; + delete fGlobalICMap; + delete fGlobalMapStack; + delete fValueStores; +} + +void ValueStoreCache::init() { + + fValueStores = new (fMemoryManager) RefVectorOf(8, false, fMemoryManager); + fGlobalICMap = new (fMemoryManager) RefHashTableOf + ( + 13 + , false + , fMemoryManager + ); + fIC2ValueStoreMap = new (fMemoryManager) RefHash2KeysTableOf + ( + 13 + , true + , fMemoryManager + ); + fGlobalMapStack = new (fMemoryManager) RefStackOf >(8, true, fMemoryManager); +} + +void ValueStoreCache::initValueStoresFor(SchemaElementDecl* const elemDecl, + const int initialDepth) { + + // initialize value stores for unique fields + XMLSize_t icCount = elemDecl->getIdentityConstraintCount(); + + for (XMLSize_t i=0; igetIdentityConstraintAt(i); + ValueStore* valueStore=fIC2ValueStoreMap->get(ic, initialDepth); + if(valueStore==0) + { + valueStore = new (fMemoryManager) ValueStore(ic, fScanner, fMemoryManager); + fIC2ValueStoreMap->put(ic, initialDepth, valueStore); + } + else + valueStore->clear(); + fValueStores->addElement(valueStore); + } +} + +void ValueStoreCache::transplant(IdentityConstraint* const ic, const int initialDepth) { + + if (ic->getType() == IdentityConstraint::ICType_KEYREF) { + return; + } + + ValueStore* newVals = fIC2ValueStoreMap->get(ic, initialDepth); + ValueStore* currVals = fGlobalICMap->get(ic); + + if (currVals) { + currVals->append(newVals); + } else { + fGlobalICMap->put(ic, newVals); + } +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file ValueStoreCache.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.hpp new file mode 100644 index 000000000..91fa4bfcc --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/ValueStoreCache.hpp @@ -0,0 +1,172 @@ +/* + * 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: ValueStoreCache.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_VALUESTORECACHE_HPP) +#define XERCESC_INCLUDE_GUARD_VALUESTORECACHE_HPP + +/** + * This class is used to store the values for identity constraints. + * + * Sketch of algorithm: + * - When a constraint is first encountered, its values are stored in the + * (local) fIC2ValueStoreMap; + * - Once it is validated (i.e., when it goes out of scope), its values are + * merged into the fGlobalICMap; + * - As we encounter keyref's, we look at the global table to validate them. + * - Validation always occurs against the fGlobalIDConstraintMap (which + * comprises all the "eligible" id constraints). When an endelement is + * found, this Hashtable is merged with the one below in the stack. When a + * start tag is encountered, we create a new fGlobalICMap. + * i.e., the top of the fGlobalIDMapStack always contains the preceding + * siblings' eligible id constraints; the fGlobalICMap contains + * descendants+self. Keyrefs can only match descendants+self. + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class ValueStore; +class SchemaElementDecl; +class XMLScanner; + + +class VALIDATORS_EXPORT ValueStoreCache : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + ValueStoreCache(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~ValueStoreCache(); + + // ----------------------------------------------------------------------- + // Setter Methods + // ----------------------------------------------------------------------- + void setScanner(XMLScanner* const scanner); + + // ----------------------------------------------------------------------- + // Document Handling methods + // ----------------------------------------------------------------------- + void startDocument(); + void startElement(); + void endElement(); + void endDocument(); + + // ----------------------------------------------------------------------- + // Initialization methods + // ----------------------------------------------------------------------- + void initValueStoresFor(SchemaElementDecl* const elemDecl, const int initialDepth); + + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + ValueStore* getValueStoreFor(const IC_Field* const field, const int initialDepth); + ValueStore* getValueStoreFor(const IdentityConstraint* const ic, const int initialDepth); + ValueStore* getGlobalValueStoreFor(const IdentityConstraint* const ic); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + /** This method takes the contents of the (local) ValueStore associated + * with ic and moves them into the global hashtable, if ic is a + * or a . If it's a , then we leave it for later. + */ + void transplant(IdentityConstraint* const ic, const int initialDepth); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + ValueStoreCache(const ValueStoreCache& other); + ValueStoreCache& operator= (const ValueStoreCache& other); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void init(); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Data + // ----------------------------------------------------------------------- + RefVectorOf* fValueStores; + RefHashTableOf* fGlobalICMap; + RefHash2KeysTableOf* fIC2ValueStoreMap; + RefStackOf >* fGlobalMapStack; + XMLScanner* fScanner; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// ValueStoreCache: Access methods +// --------------------------------------------------------------------------- +inline void ValueStoreCache::setScanner(XMLScanner* const scanner) { + + fScanner = scanner; +} + +// --------------------------------------------------------------------------- +// ValueStoreCache: Access methods +// --------------------------------------------------------------------------- +inline ValueStore* +ValueStoreCache::getValueStoreFor(const IC_Field* const field, const int initialDepth) { + + return fIC2ValueStoreMap->get(field->getIdentityConstraint(), initialDepth); +} + +inline ValueStore* +ValueStoreCache::getValueStoreFor(const IdentityConstraint* const ic, const int initialDepth) { + + return fIC2ValueStoreMap->get(ic, initialDepth); +} + +inline ValueStore* +ValueStoreCache::getGlobalValueStoreFor(const IdentityConstraint* const ic) { + + return fGlobalICMap->get(ic); +} + +// --------------------------------------------------------------------------- +// ValueStoreCache: Document handling methods +// --------------------------------------------------------------------------- +inline void ValueStoreCache::endDocument() { +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file ValueStoreCache.hpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathException.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathException.hpp new file mode 100644 index 000000000..af59aa4ff --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathException.hpp @@ -0,0 +1,34 @@ +/* + * 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: XPathException.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XPATHEXCEPTION_HPP) +#define XERCESC_INCLUDE_GUARD_XPATHEXCEPTION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +MakeXMLException(XPathException, VALIDATORS_EXPORT) + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.cpp new file mode 100644 index 000000000..9e6bbbd97 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.cpp @@ -0,0 +1,413 @@ +/* + * 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: XPathMatcher.cpp 804234 2009-08-14 14:20:16Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// XPathMatcher: Constructors and Destructor +// --------------------------------------------------------------------------- +XPathMatcher::XPathMatcher( XercesXPath* const xpath + , MemoryManager* const manager) + : fLocationPathSize(0) + , fMatched(0) + , fNoMatchDepth(0) + , fCurrentStep(0) + , fStepIndexes(0) + , fLocationPaths(0) + , fIdentityConstraint(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XPathMatcher::cleanUp); + + try { + init(xpath); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +XPathMatcher::XPathMatcher(XercesXPath* const xpath, + IdentityConstraint* const ic, + MemoryManager* const manager) + : fLocationPathSize(0) + , fMatched(0) + , fNoMatchDepth(0) + , fCurrentStep(0) + , fStepIndexes(0) + , fLocationPaths(0) + , fIdentityConstraint(ic) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XPathMatcher::cleanUp); + + try { + init(xpath); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + + +XPathMatcher::~XPathMatcher() +{ + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XPathMatcher: Helper methods +// --------------------------------------------------------------------------- +void XPathMatcher::init(XercesXPath* const xpath) { + + if (xpath) { + + fLocationPaths = xpath->getLocationPaths(); + fLocationPathSize = (fLocationPaths ? fLocationPaths->size() : 0); + + if (fLocationPathSize) { + + fStepIndexes = new (fMemoryManager) RefVectorOf >(fLocationPathSize, true, fMemoryManager); + fCurrentStep = (XMLSize_t*) fMemoryManager->allocate + ( + fLocationPathSize * sizeof(XMLSize_t) + );//new int[fLocationPathSize]; + fNoMatchDepth = (XMLSize_t*) fMemoryManager->allocate + ( + fLocationPathSize * sizeof(XMLSize_t) + );//new int[fLocationPathSize]; + fMatched = (unsigned char*) fMemoryManager->allocate + ( + fLocationPathSize * sizeof(unsigned char) + );//new int[fLocationPathSize]; + + for(XMLSize_t i=0; i < fLocationPathSize; i++) { + fStepIndexes->addElement(new (fMemoryManager) ValueStackOf(8, fMemoryManager)); + } + } + } +} + + +// --------------------------------------------------------------------------- +// XPathMatcher: XMLDocumentHandler methods +// --------------------------------------------------------------------------- +void XPathMatcher::startDocumentFragment() { + + for(XMLSize_t i = 0; i < fLocationPathSize; i++) { + + fStepIndexes->elementAt(i)->removeAllElements(); + fCurrentStep[i] = 0; + fNoMatchDepth[i] = 0; + fMatched[i] = 0; + } +} + +void XPathMatcher::startElement(const XMLElementDecl& elemDecl, + const unsigned int urlId, + const XMLCh* const elemPrefix, + const RefVectorOf& attrList, + const XMLSize_t attrCount, + ValidationContext* validationContext /*=0*/) { + + for (XMLSize_t i = 0; i < fLocationPathSize; i++) { + + // push context + XMLSize_t startStep = fCurrentStep[i]; + fStepIndexes->elementAt(i)->push(startStep); + + // try next xpath, if not matching + if ((fMatched[i] & XP_MATCHED_D) == XP_MATCHED || fNoMatchDepth[i] > 0) { + fNoMatchDepth[i]++; + continue; + } + + if((fMatched[i] & XP_MATCHED_D) == XP_MATCHED_D) { + fMatched[i] = XP_MATCHED_DP; + } + + // consume self::node() steps + XercesLocationPath* locPath = fLocationPaths->elementAt(i); + XMLSize_t stepSize = locPath->getStepSize(); + + while (fCurrentStep[i] < stepSize && + locPath->getStep(fCurrentStep[i])->getAxisType() == XercesStep::AxisType_SELF) { + fCurrentStep[i]++; + } + + if (fCurrentStep[i] == stepSize) { + + fMatched[i] = XP_MATCHED; + continue; + } + + // now if the current step is a descendant step, we let the next + // step do its thing; if it fails, we reset ourselves + // to look at this step for next time we're called. + // so first consume all descendants: + XMLSize_t descendantStep = fCurrentStep[i]; + + while (fCurrentStep[i] < stepSize && + locPath->getStep(fCurrentStep[i])->getAxisType() == XercesStep::AxisType_DESCENDANT) { + fCurrentStep[i]++; + } + + bool sawDescendant = fCurrentStep[i] > descendantStep; + if (fCurrentStep[i] == stepSize) { + + fNoMatchDepth[i]++; + continue; + } + + // match child::... step, if haven't consumed any self::node() + if ((fCurrentStep[i] == startStep || fCurrentStep[i] > descendantStep) && + locPath->getStep(fCurrentStep[i])->getAxisType() == XercesStep::AxisType_CHILD) { + + XercesStep* step = locPath->getStep(fCurrentStep[i]); + XercesNodeTest* nodeTest = step->getNodeTest(); + + QName elemQName(elemPrefix, elemDecl.getElementName()->getLocalPart(), urlId, fMemoryManager); + if (!matches(nodeTest, &elemQName)) { + + if(fCurrentStep[i] > descendantStep) { + fCurrentStep[i] = descendantStep; + continue; + } + + fNoMatchDepth[i]++; + continue; + } + + fCurrentStep[i]++; + } + + if (fCurrentStep[i] == stepSize) { + + if (sawDescendant) { + + fCurrentStep[i] = descendantStep; + fMatched[i] = XP_MATCHED_D; + } + else { + fMatched[i] = XP_MATCHED; + } + + continue; + } + + // match attribute::... step + if (fCurrentStep[i] < stepSize && + locPath->getStep(fCurrentStep[i])->getAxisType() == XercesStep::AxisType_ATTRIBUTE) { + + if (attrCount) { + + XercesNodeTest* nodeTest = locPath->getStep(fCurrentStep[i])->getNodeTest(); + + for (XMLSize_t attrIndex = 0; attrIndex < attrCount; attrIndex++) { + + const XMLAttr* curDef = attrList.elementAt(attrIndex); + + if (matches(nodeTest, curDef->getAttName())) { + + fCurrentStep[i]++; + + if (fCurrentStep[i] == stepSize) { + + fMatched[i] = XP_MATCHED_A; + + SchemaAttDef* attDef = ((SchemaElementDecl&) elemDecl).getAttDef(curDef->getName(), curDef->getURIId()); + DatatypeValidator* dv = (attDef) ? attDef->getDatatypeValidator() : 0; + const XMLCh* value = curDef->getValue(); + // store QName using their Clark name + if(dv && dv->getType()==DatatypeValidator::QName) + { + int index=XMLString::indexOf(value, chColon); + if(index==-1) + matched(value, dv, false); + else + { + XMLBuffer buff(1023, fMemoryManager); + buff.append(chOpenCurly); + if(validationContext) + { + XMLCh* prefix=(XMLCh*)fMemoryManager->allocate((index+1)*sizeof(XMLCh)); + ArrayJanitor janPrefix(prefix, fMemoryManager); + XMLString::subString(prefix, value, 0, (XMLSize_t)index, fMemoryManager); + buff.append(validationContext->getURIForPrefix(prefix)); + } + buff.append(chCloseCurly); + buff.append(value+index+1); + matched(buff.getRawBuffer(), dv, false); + } + } + else + matched(value, dv, false); + } + break; + } + } + } + + if ((fMatched[i] & XP_MATCHED) != XP_MATCHED) { + + if(fCurrentStep[i] > descendantStep) { + + fCurrentStep[i] = descendantStep; + continue; + } + + fNoMatchDepth[i]++; + } + } + } +} + +void XPathMatcher::endElement(const XMLElementDecl& elemDecl, + const XMLCh* const elemContent, + ValidationContext* validationContext /*=0*/, + DatatypeValidator* actualValidator /*=0*/) { + + for(XMLSize_t i = 0; i < fLocationPathSize; i++) { + + // go back a step + fCurrentStep[i] = fStepIndexes->elementAt(i)->pop(); + + // don't do anything, if not matching + if (fNoMatchDepth[i] > 0) { + fNoMatchDepth[i]--; + } + // signal match, if appropriate + else { + + if (fMatched[i] == 0) + continue; + + if ((fMatched[i] & XP_MATCHED_A) == XP_MATCHED_A) { + fMatched[i] = 0; + continue; + } + + DatatypeValidator* dv = actualValidator?actualValidator:((SchemaElementDecl*) &elemDecl)->getDatatypeValidator(); + bool isNillable = (((SchemaElementDecl *) &elemDecl)->getMiscFlags() & SchemaSymbols::XSD_NILLABLE) != 0; + + // store QName using their Clark name + if(dv && dv->getType()==DatatypeValidator::QName) + { + int index=XMLString::indexOf(elemContent, chColon); + if(index==-1) + matched(elemContent, dv, isNillable); + else + { + XMLBuffer buff(1023, fMemoryManager); + buff.append(chOpenCurly); + if(validationContext) + { + XMLCh* prefix=(XMLCh*)fMemoryManager->allocate((index+1)*sizeof(XMLCh)); + ArrayJanitor janPrefix(prefix, fMemoryManager); + XMLString::subString(prefix, elemContent, 0, (XMLSize_t)index, fMemoryManager); + buff.append(validationContext->getURIForPrefix(prefix)); + } + buff.append(chCloseCurly); + buff.append(elemContent+index+1); + matched(buff.getRawBuffer(), dv, isNillable); + } + } + else + matched(elemContent, dv, isNillable); + fMatched[i] = 0; + } + } +} + + +// --------------------------------------------------------------------------- +// XPathMatcher: Match methods +// --------------------------------------------------------------------------- +unsigned char XPathMatcher::isMatched() { + + // xpath has been matched if any one of the members of the union have matched. + for (XMLSize_t i=0; i < fLocationPathSize; i++) { + if (((fMatched[i] & XP_MATCHED) == XP_MATCHED) + && ((fMatched[i] & XP_MATCHED_DP) != XP_MATCHED_DP)) + return fMatched[i]; + } + + return 0; +} + +void XPathMatcher::matched(const XMLCh* const, + DatatypeValidator* const, + const bool) { + return; +} + +bool XPathMatcher::matches(const XercesNodeTest* nodeTest, const QName* qName) +{ + if (nodeTest->getType() == XercesNodeTest::NodeType_QNAME) { + return (*nodeTest->getName())==(*qName); + } + if (nodeTest->getType() == XercesNodeTest::NodeType_NAMESPACE) { + return nodeTest->getName()->getURI() == qName->getURI(); + } + // NodeType_WILDCARD + return true; +} + +// --------------------------------------------------------------------------- +// XPathMatcher: Match methods +// --------------------------------------------------------------------------- +int XPathMatcher::getInitialDepth() const +{ + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, fMemoryManager); + return 0; // to make some compilers happy +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XPathMatcher.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.hpp new file mode 100644 index 000000000..dfdbd8a4b --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcher.hpp @@ -0,0 +1,182 @@ +/* + * 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: XPathMatcher.hpp 803869 2009-08-13 12:56:21Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XPATHMATCHER_HPP) +#define XERCESC_INCLUDE_GUARD_XPATHMATCHER_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declaration +// --------------------------------------------------------------------------- +class XMLElementDecl; +class XercesXPath; +class IdentityConstraint; +class DatatypeValidator; +class XMLStringPool; +class XercesLocationPath; +class XMLAttr; +class XercesNodeTest; +class QName; +class ValidationContext; + +class VALIDATORS_EXPORT XPathMatcher : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XPathMatcher(XercesXPath* const xpath, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XPathMatcher(XercesXPath* const xpath, + IdentityConstraint* const ic, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + virtual ~XPathMatcher(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + IdentityConstraint* getIdentityConstraint() const { return fIdentityConstraint; } + MemoryManager* getMemoryManager() const { return fMemoryManager; } + + // ----------------------------------------------------------------------- + // Match methods + // ----------------------------------------------------------------------- + /** + * Returns true if XPath has been matched. + */ + unsigned char isMatched(); + virtual int getInitialDepth() const; + + // ----------------------------------------------------------------------- + // XMLDocumentHandler methods + // ----------------------------------------------------------------------- + virtual void startDocumentFragment(); + virtual void startElement(const XMLElementDecl& elemDecl, + const unsigned int urlId, + const XMLCh* const elemPrefix, + const RefVectorOf& attrList, + const XMLSize_t attrCount, + ValidationContext* validationContext = 0); + virtual void endElement(const XMLElementDecl& elemDecl, + const XMLCh* const elemContent, + ValidationContext* validationContext = 0, + DatatypeValidator* actualValidator = 0); + + enum + { + XP_MATCHED = 1 // matched any way + , XP_MATCHED_A = 3 // matched on the attribute axis + , XP_MATCHED_D = 5 // matched on the descendant-or-self axixs + , XP_MATCHED_DP = 13 // matched some previous (ancestor) node on the + // descendant-or-self-axis, but not this node + }; + +protected: + + // ----------------------------------------------------------------------- + // Match methods + // ----------------------------------------------------------------------- + /** + * This method is called when the XPath handler matches the XPath + * expression. Subclasses can override this method to provide default + * handling upon a match. + */ + virtual void matched(const XMLCh* const content, + DatatypeValidator* const dv, const bool isNil); + + bool matches(const XercesNodeTest* nodeTest, const QName* qName); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XPathMatcher(const XPathMatcher&); + XPathMatcher& operator=(const XPathMatcher&); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void init(XercesXPath* const xpath); + void cleanUp(); + + // ----------------------------------------------------------------------- + // Data members + // + // fMatched + // Indicates whether XPath has been matched or not + // + // fNoMatchDepth + // Indicates whether matching is successful for the given xpath + // expression. + // + // fCurrentStep + // Stores current step. + // + // fStepIndexes + // Integer stack of step indexes. + // + // fLocationPaths + // fLocationPathSize + // XPath location path, and its size. + // + // fIdentityConstraint + // The identity constraint we're the matcher for. Only used for + // selectors. + // + // ----------------------------------------------------------------------- + XMLSize_t fLocationPathSize; + unsigned char* fMatched; + XMLSize_t* fNoMatchDepth; + XMLSize_t* fCurrentStep; + RefVectorOf >* fStepIndexes; + RefVectorOf* fLocationPaths; + IdentityConstraint* fIdentityConstraint; + MemoryManager* fMemoryManager; +}; + +// --------------------------------------------------------------------------- +// XPathMatcher: Helper methods +// --------------------------------------------------------------------------- +inline void XPathMatcher::cleanUp() { + + fMemoryManager->deallocate(fMatched);//delete [] fMatched; + fMemoryManager->deallocate(fNoMatchDepth);//delete [] fNoMatchDepth; + fMemoryManager->deallocate(fCurrentStep);//delete [] fCurrentStep; + delete fStepIndexes; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XPathMatcher.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp new file mode 100644 index 000000000..0b5d54665 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.cpp @@ -0,0 +1,86 @@ +/* + * 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: XPathMatcherStack.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// XPathMatherStack: Constructors and Destructor +// --------------------------------------------------------------------------- +XPathMatcherStack::XPathMatcherStack(MemoryManager* const manager) + : fMatchersCount(0) + , fContextStack(0) + , fMatchers(0) +{ + CleanupType cleanup(this, &XPathMatcherStack::cleanUp); + + try { + fContextStack = new (manager) ValueStackOf(8, manager); + fMatchers = new (manager) RefVectorOf(8, true, manager); + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XPathMatcherStack::~XPathMatcherStack() { + + cleanUp(); +} + +// --------------------------------------------------------------------------- +// XPathMatcherStack: Private helper methods. +// --------------------------------------------------------------------------- +void XPathMatcherStack::cleanUp() +{ + delete fContextStack; + delete fMatchers; +} + +// --------------------------------------------------------------------------- +// XPathMatherStack: Clear methods +// --------------------------------------------------------------------------- +void XPathMatcherStack::clear() { + + fContextStack->removeAllElements(); + fMatchers->removeAllElements(); + fMatchersCount = 0; +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XPathMatcherStack.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.hpp new file mode 100644 index 000000000..273b38a7c --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathMatcherStack.hpp @@ -0,0 +1,139 @@ +/* + * 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: XPathMatcherStack.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP) +#define XERCESC_INCLUDE_GUARD_XPATHMATCHERSTACK_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class VALIDATORS_EXPORT XPathMatcherStack : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XPathMatcherStack(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~XPathMatcherStack(); + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + XPathMatcher* getMatcherAt(const XMLSize_t index) const; + XMLSize_t getMatcherCount() const; + XMLSize_t size() const; + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + void addMatcher(XPathMatcher* const matcher); + + // ----------------------------------------------------------------------- + // Stack methods + // ----------------------------------------------------------------------- + void pushContext(); + void popContext(); + + // ----------------------------------------------------------------------- + // Reset methods + // ----------------------------------------------------------------------- + void clear(); + +private: + // ----------------------------------------------------------------------- + // Private helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XPathMatcherStack(const XPathMatcherStack& other); + XPathMatcherStack& operator= (const XPathMatcherStack& other); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + unsigned int fMatchersCount; + ValueStackOf* fContextStack; + RefVectorOf* fMatchers; +}; + +// --------------------------------------------------------------------------- +// XPathMatcherStack: Getter methods +// --------------------------------------------------------------------------- +inline XMLSize_t XPathMatcherStack::size() const { + + return fContextStack->size(); +} + +inline XMLSize_t XPathMatcherStack::getMatcherCount() const { + + return fMatchersCount; +} + +inline XPathMatcher* +XPathMatcherStack::getMatcherAt(const XMLSize_t index) const { + + return fMatchers->elementAt(index); +} + +// --------------------------------------------------------------------------- +// XPathMatcherStack: Stack methods +// --------------------------------------------------------------------------- +inline void XPathMatcherStack::pushContext() { + + fContextStack->push(fMatchersCount); +} + +inline void XPathMatcherStack::popContext() { + + fMatchersCount = fContextStack->pop(); +} + +// --------------------------------------------------------------------------- +// XPathMatcherStack: Access methods +// --------------------------------------------------------------------------- +inline void XPathMatcherStack::addMatcher(XPathMatcher* const matcher) { + + if (fMatchersCount == fMatchers->size()) { + + fMatchers->addElement(matcher); + fMatchersCount++; + } + else { + fMatchers->setElementAt(matcher, fMatchersCount++); + } +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XPathMatcherStack.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.cpp new file mode 100644 index 000000000..766b83470 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.cpp @@ -0,0 +1,161 @@ +/* + * 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: XPathSymbols.cpp 471747 2006-11-06 14:31:56Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// SchemaSymbols: Static data +// --------------------------------------------------------------------------- +const XMLCh XPathSymbols::fgSYMBOL_AND[] = +{ + chLatin_a, chLatin_n, chLatin_d, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_OR[] = +{ + chLatin_o, chLatin_r, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_MOD[] = +{ + chLatin_m, chLatin_o, chLatin_d, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_DIV[] = +{ + chLatin_d, chLatin_i, chLatin_v, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_COMMENT[] = +{ + chLatin_c, chLatin_o, chLatin_m, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_TEXT[] = +{ + chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_PI[] = +{ + chLatin_p, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, + chLatin_i, chLatin_n, chLatin_g, chDash, chLatin_i, chLatin_n, chLatin_s, chLatin_t, + chLatin_r, chLatin_u, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_NODE[] = +{ + chLatin_n, chLatin_o, chLatin_d, chLatin_e, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_ANCESTOR[] = +{ + chLatin_a, chLatin_n, chLatin_c, chLatin_e, chLatin_s, chLatin_t, chLatin_o, + chLatin_r, chNull +}; + + +const XMLCh XPathSymbols::fgSYMBOL_ANCESTOR_OR_SELF[] = +{ + chLatin_a, chLatin_n, chLatin_c, chLatin_e, chLatin_s, chLatin_t, chLatin_o, + chLatin_r, chDash, chLatin_o, chLatin_r, chDash, chLatin_s, chLatin_e, + chLatin_l, chLatin_f, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_ATTRIBUTE[] = +{ + chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, + chLatin_t, chLatin_e, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_CHILD[] = +{ + chLatin_c, chLatin_h, chLatin_i, chLatin_l, chLatin_d, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_DESCENDANT[] = +{ + chLatin_d, chLatin_e, chLatin_s, chLatin_c, chLatin_e, chLatin_n, chLatin_d, + chLatin_a, chLatin_n, chLatin_t, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_DESCENDANT_OR_SELF[] = +{ + chLatin_d, chLatin_e, chLatin_s, chLatin_c, chLatin_e, chLatin_n, chLatin_d, + chLatin_a, chLatin_n, chLatin_t, chDash, chLatin_o, chLatin_r, chDash, chLatin_s, + chLatin_e, chLatin_l, chLatin_f, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_FOLLOWING[] = +{ + chLatin_f, chLatin_o, chLatin_l, chLatin_l, chLatin_o, chLatin_w, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_FOLLOWING_SIBLING[] = +{ + chLatin_f, chLatin_o, chLatin_l, chLatin_l, chLatin_o, chLatin_w, chLatin_i, + chLatin_n, chLatin_g, chDash, chLatin_s, chLatin_i, chLatin_b, chLatin_l, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_NAMESPACE[] = +{ + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, + chLatin_c, chLatin_e, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_PARENT[] = +{ + chLatin_p, chLatin_a, chLatin_r, chLatin_e, chLatin_n, chLatin_t, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_PRECEDING[] = +{ + chLatin_p, chLatin_r, chLatin_e, chLatin_c, chLatin_e, chLatin_d, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_PRECEDING_SIBLING[] = +{ + chLatin_p, chLatin_r, chLatin_e, chLatin_c, chLatin_e, chLatin_d, chLatin_i, + chLatin_n, chLatin_g, chDash, chLatin_s, chLatin_i, chLatin_b, chLatin_l, chLatin_i, + chLatin_n, chLatin_g, chNull +}; + +const XMLCh XPathSymbols::fgSYMBOL_SELF[] = +{ + chLatin_s, chLatin_e, chLatin_l, chLatin_f, chNull +}; + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XPathSymbols.cpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.hpp new file mode 100644 index 000000000..78421867f --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XPathSymbols.hpp @@ -0,0 +1,75 @@ +/* + * 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: XPathSymbols.hpp 527149 2007-04-10 14:56:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XPATHSYMBOLS_HPP) +#define XERCESC_INCLUDE_GUARD_XPATHSYMBOLS_HPP + +#include + +XERCES_CPP_NAMESPACE_BEGIN + +/* + * Collection of symbols used to parse a Schema Grammar + */ + +class VALIDATORS_EXPORT XPathSymbols +{ +public : + // ----------------------------------------------------------------------- + // Constant data + // ----------------------------------------------------------------------- + static const XMLCh fgSYMBOL_AND[]; + static const XMLCh fgSYMBOL_OR[]; + static const XMLCh fgSYMBOL_MOD[]; + static const XMLCh fgSYMBOL_DIV[]; + static const XMLCh fgSYMBOL_COMMENT[]; + static const XMLCh fgSYMBOL_TEXT[]; + static const XMLCh fgSYMBOL_PI[]; + static const XMLCh fgSYMBOL_NODE[]; + static const XMLCh fgSYMBOL_ANCESTOR[]; + static const XMLCh fgSYMBOL_ANCESTOR_OR_SELF[]; + static const XMLCh fgSYMBOL_ATTRIBUTE[]; + static const XMLCh fgSYMBOL_CHILD[]; + static const XMLCh fgSYMBOL_DESCENDANT[]; + static const XMLCh fgSYMBOL_DESCENDANT_OR_SELF[]; + static const XMLCh fgSYMBOL_FOLLOWING[]; + static const XMLCh fgSYMBOL_FOLLOWING_SIBLING[]; + static const XMLCh fgSYMBOL_NAMESPACE[]; + static const XMLCh fgSYMBOL_PARENT[]; + static const XMLCh fgSYMBOL_PRECEDING[]; + static const XMLCh fgSYMBOL_PRECEDING_SIBLING[]; + static const XMLCh fgSYMBOL_SELF[]; + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XPathSymbols(); +}; + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XPathSymbols.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.cpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.cpp new file mode 100644 index 000000000..ec5508110 --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.cpp @@ -0,0 +1,1460 @@ +/* + * 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: XercesXPath.cpp 903997 2010-01-28 08:28:06Z borisk $ + */ + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +// --------------------------------------------------------------------------- +// Static data +// --------------------------------------------------------------------------- +const XMLByte XPathScanner::fASCIICharMap[128] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 3, 4, 1, 5, 1, 1, 4, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 1, 16, 17, 18, 1, + 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 1, 22, 1, 23, + 1, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 1, 24, 1, 1, 1 +}; + + +// --------------------------------------------------------------------------- +// XercesNodeTest: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesNodeTest::XercesNodeTest(const short aType, + MemoryManager* const manager) + : fType(aType) + , fName(new (manager) QName(manager)) +{ +} + +XercesNodeTest::XercesNodeTest(const QName* const qName) + : fType(NodeType_QNAME) + , fName(new (qName->getMemoryManager()) QName(*qName)) +{ +} + +XercesNodeTest::XercesNodeTest(const XMLCh* const prefix, + const unsigned int uriId, + MemoryManager* const manager) + : fType(NodeType_NAMESPACE) + , fName(new (manager) QName(manager)) +{ + fName->setURI(uriId); + fName->setPrefix(prefix); +} + +XercesNodeTest::XercesNodeTest(const XercesNodeTest& other) + : XSerializable(other) + , XMemory(other) + , fType(other.fType) + , fName(new ((other.fName)->getMemoryManager()) QName(*other.fName)) +{ +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesNodeTest) + +void XercesNodeTest::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<>fType; + serEng>>fName; + } +} + +XercesNodeTest::XercesNodeTest(MemoryManager* const) +:fType(NodeType_UNKNOWN) +,fName(0) +{ +} + +// --------------------------------------------------------------------------- +// XercesNodeTest: Operators +// --------------------------------------------------------------------------- +XercesNodeTest& XercesNodeTest::operator=(const XercesNodeTest& other) +{ + if (this == &other) + return *this; + + fType = other.fType; + fName->setValues(*(other.fName)); + return *this; +} + +bool XercesNodeTest::operator ==(const XercesNodeTest& other) const { + + if (this == &other) + return true; + + if (fType != other.fType) + return false; + + return (*fName == *(other.fName)); +} + + +bool XercesNodeTest::operator !=(const XercesNodeTest& other) const { + + return !operator==(other); +} + +// --------------------------------------------------------------------------- +// XercesStep: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesStep::XercesStep(const unsigned short axisType, XercesNodeTest* const nodeTest) + : fAxisType(axisType) + , fNodeTest(nodeTest) +{ +} + +XercesStep::XercesStep(const XercesStep& other) + : XSerializable(other) + , XMemory(other) + , fAxisType(other.fAxisType) + , fNodeTest(0) +{ + fNodeTest = new (other.fNodeTest->getName()->getMemoryManager()) XercesNodeTest(*(other.fNodeTest)); +} + + +// --------------------------------------------------------------------------- +// XercesStep: Operators +// --------------------------------------------------------------------------- +XercesStep& XercesStep::operator=(const XercesStep& other) +{ + if (this == &other) + return *this; + + fAxisType = other.fAxisType; + *fNodeTest = *(other.fNodeTest); + return *this; +} + +bool XercesStep::operator==(const XercesStep& other) const { + + if (this == &other) + return true; + + if (fAxisType != other.fAxisType) + return false; + + if (fAxisType == XercesStep::AxisType_CHILD || + fAxisType == XercesStep::AxisType_ATTRIBUTE) { + return (*fNodeTest == *(other.fNodeTest)); + } + + return true; +} + +bool XercesStep::operator!=(const XercesStep& other) const { + + return !operator==(other); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesStep) + +void XercesStep::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + serEng<<(int)fAxisType; + serEng<>i; + fAxisType = (unsigned short) i; + + serEng>>fNodeTest; + } +} + +XercesStep::XercesStep(MemoryManager* const) +:fAxisType(AxisType_UNKNOWN) +,fNodeTest(0) +{ +} + +// --------------------------------------------------------------------------- +// XercesLocationPath: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesLocationPath::XercesLocationPath(RefVectorOf* const steps) + : fSteps(steps) +{ +} + +// --------------------------------------------------------------------------- +// XercesLocationPath: Operators +// --------------------------------------------------------------------------- +bool XercesLocationPath::operator==(const XercesLocationPath& other) const { + + XMLSize_t stepsSize = fSteps->size(); + + if (stepsSize != other.fSteps->size()) + return false; + + for (XMLSize_t i=0; i < stepsSize; i++) { + if (*(fSteps->elementAt(i)) != *(other.fSteps->elementAt(i))) + return false; + } + + return true; +} + +bool XercesLocationPath::operator!=(const XercesLocationPath& other) const { + + return !operator==(other); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesLocationPath) + +void XercesLocationPath::serialize(XSerializeEngine& serEng) +{ + if (serEng.isStoring()) + { + /*** + * Serialize RefVectorOf* fSteps; + ***/ + XTemplateSerializer::storeObject(fSteps, serEng); + } + else + { + /*** + * Deserialize RefVectorOf* fSteps; + ***/ + XTemplateSerializer::loadObject(&fSteps, 8, true, serEng); + } +} + +XercesLocationPath::XercesLocationPath(MemoryManager* const) +:fSteps(0) +{ +} + +typedef JanitorMemFunCall CleanupType; + +// --------------------------------------------------------------------------- +// XercesPath: Constructors and Destructor +// --------------------------------------------------------------------------- +XercesXPath::XercesXPath(const XMLCh* const xpathExpr, + XMLStringPool* const stringPool, + XercesNamespaceResolver* const scopeContext, + const unsigned int emptyNamespaceId, + const bool isSelector, + MemoryManager* const manager) + : fEmptyNamespaceId(emptyNamespaceId) + , fExpression(0) + , fLocationPaths(0) + , fMemoryManager(manager) +{ + CleanupType cleanup(this, &XercesXPath::cleanUp); + + try + { + fExpression = XMLString::replicate(xpathExpr, fMemoryManager); + parseExpression(stringPool, scopeContext); + + if (isSelector) { + checkForSelectedAttributes(); + } + } + catch(const OutOfMemoryException&) + { + cleanup.release(); + + throw; + } + + cleanup.release(); +} + +XercesXPath::~XercesXPath() { + cleanUp(); +} + + +// --------------------------------------------------------------------------- +// XercesXPath: Operators +// --------------------------------------------------------------------------- +bool XercesXPath::operator==(const XercesXPath& other) const { + + XMLSize_t locPathSize = fLocationPaths->size(); + + if (locPathSize != other.fLocationPaths->size()) + return false; + + for (XMLSize_t i=0; i < locPathSize; i++) { + if (*(fLocationPaths->elementAt(i)) != *(other.fLocationPaths->elementAt(i))) + return false; + } + + return true; +} + +bool XercesXPath::operator!=(const XercesXPath& other) const { + + return !operator==(other); +} + +// --------------------------------------------------------------------------- +// XercesPath: Helper methods +// --------------------------------------------------------------------------- +void XercesXPath::cleanUp() { + + fMemoryManager->deallocate(fExpression);//delete [] fExpression; + delete fLocationPaths; +} + +void XercesXPath::checkForSelectedAttributes() { + + // verify that an attribute is not selected + XMLSize_t locSize = (fLocationPaths) ? fLocationPaths->size() : 0; + + for (XMLSize_t i = 0; i < locSize; i++) { + + XercesLocationPath* locPath = fLocationPaths->elementAt(i); + XMLSize_t stepSize = locPath->getStepSize(); + + if (stepSize) { + if (locPath->getStep(stepSize - 1)->getAxisType() == XercesStep::AxisType_ATTRIBUTE) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoAttrSelector, fMemoryManager); + } + } + } +} + +void XercesXPath::parseExpression(XMLStringPool* const stringPool, + XercesNamespaceResolver* const scopeContext) { + + XMLSize_t length = XMLString::stringLen(fExpression); + + if (!length) { + return; + } + + ValueVectorOf tokens(16, fMemoryManager); + XPathScannerForSchema scanner(stringPool); + if(!scanner.scanExpression(fExpression, 0, length, &tokens)) + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_TokenNotSupported, fMemoryManager); + + bool firstTokenOfLocationPath=true; + XMLSize_t tokenCount = tokens.size(); + RefVectorOf* stepsVector = new (fMemoryManager) RefVectorOf(16, true, fMemoryManager); + Janitor > janSteps(stepsVector); + + if (tokenCount) { + fLocationPaths = new (fMemoryManager) RefVectorOf(8, true, fMemoryManager); + } + + for (XMLSize_t i = 0; i < tokenCount; i++) { + + int aToken = tokens.elementAt(i); + bool isNamespace=false; + + switch (aToken) { + case XercesXPath::EXPRTOKEN_OPERATOR_UNION: + { + if (i == 0) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoUnionAtStart, fMemoryManager); + } + + XMLSize_t stepsSize = stepsVector->size(); + + if (stepsSize == 0) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoMultipleUnion, fMemoryManager); + } + + if(stepsVector->elementAt(0)->getAxisType()!=XercesStep::AxisType_SELF) + { + // prepend ./ + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_NODE, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_SELF, nodeTest); + stepsVector->insertElementAt(step, 0); + } + XercesLocationPath* newPath = new (fMemoryManager) XercesLocationPath(stepsVector); + janSteps.orphan(); + bool bFound=false; + for(XMLSize_t i=0;isize();i++) + if((*(fLocationPaths->elementAt(i)))==(*newPath)) + { + bFound=true; + break; + } + if(bFound) + delete newPath; + else + fLocationPaths->addElement(newPath); + stepsVector = new (fMemoryManager) RefVectorOf(16, true, fMemoryManager); + janSteps.reset(stepsVector); + firstTokenOfLocationPath = true; + } + break; + case XercesXPath::EXPRTOKEN_AXISNAME_ATTRIBUTE: + { + // consume "::" token and drop through + i++; + } + case XercesXPath::EXPRTOKEN_ATSIGN: + { + // consume QName token + if (i == tokenCount - 1) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_MissingAttr, fMemoryManager); + } + + aToken = tokens.elementAt(++i); + + if (aToken != XercesXPath::EXPRTOKEN_NAMETEST_QNAME + && aToken!= XercesXPath::EXPRTOKEN_NAMETEST_ANY + && aToken!= XercesXPath::EXPRTOKEN_NAMETEST_NAMESPACE) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_ExpectedToken1, fMemoryManager); + } + + bool isNamespaceAtt=false; + + switch (aToken) { + + case XercesXPath::EXPRTOKEN_NAMETEST_ANY: + { + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_WILDCARD, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_ATTRIBUTE, nodeTest); + stepsVector->addElement(step); + break; + } + case XercesXPath::EXPRTOKEN_NAMETEST_NAMESPACE: + { + isNamespaceAtt = true; + } + case XercesXPath::EXPRTOKEN_NAMETEST_QNAME: + { + aToken = tokens.elementAt(++i); + + const XMLCh* prefix = XMLUni::fgZeroLenString; + unsigned int uri = fEmptyNamespaceId; + + if (scopeContext && aToken != -1) { + + prefix = stringPool->getValueForId(aToken); + uri = scopeContext->getNamespaceForPrefix(prefix); + } + + if (aToken != -1 && scopeContext && uri == fEmptyNamespaceId) { + ThrowXMLwithMemMgr1(XPathException, XMLExcepts::XPath_PrefixNoURI, prefix, fMemoryManager); + } + + if (isNamespaceAtt) { + + // build step + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(prefix, uri, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_ATTRIBUTE, nodeTest); + stepsVector->addElement(step); + break; + } + + aToken = tokens.elementAt(++i); + + const XMLCh* localPart = stringPool->getValueForId(aToken); + QName aQName(prefix, localPart, uri, fMemoryManager); + + // build step + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(&aQName); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_ATTRIBUTE, nodeTest); + stepsVector->addElement(step); + break; + } + } + + firstTokenOfLocationPath=false; + break; + } + case XercesXPath::EXPRTOKEN_DOUBLE_COLON: + { + // should never have a bare double colon + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoDoubleColon, fMemoryManager); + } + case XercesXPath::EXPRTOKEN_AXISNAME_CHILD: + { + // consume "::" token and drop through + i++; + + if (i == tokenCount - 1) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_ExpectedStep1, fMemoryManager); + } + + firstTokenOfLocationPath=false; + break; + } + case XercesXPath::EXPRTOKEN_NAMETEST_ANY: + { + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_WILDCARD, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_CHILD, nodeTest); + stepsVector->addElement(step); + firstTokenOfLocationPath = false; + break; + } + case XercesXPath::EXPRTOKEN_NAMETEST_NAMESPACE: + { + isNamespace=true; + } + case XercesXPath::EXPRTOKEN_NAMETEST_QNAME: + { + // consume QName token + aToken = tokens.elementAt(++i); + + const XMLCh* prefix = XMLUni::fgZeroLenString; + unsigned int uri = fEmptyNamespaceId; + + if (scopeContext && aToken != -1) { + + prefix = stringPool->getValueForId(aToken); + uri = scopeContext->getNamespaceForPrefix(prefix); + } + + if (aToken != -1 && scopeContext && uri == fEmptyNamespaceId) { + ThrowXMLwithMemMgr1(XPathException, XMLExcepts::XPath_PrefixNoURI, prefix, fMemoryManager); + } + + if (isNamespace) { + + // build step + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(prefix, uri, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_CHILD, nodeTest); + stepsVector->addElement(step); + break; + } + + aToken = tokens.elementAt(++i); + const XMLCh* localPart = stringPool->getValueForId(aToken); + QName aQName(prefix, localPart, uri, fMemoryManager); + + // build step + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(&aQName); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_CHILD, nodeTest); + stepsVector->addElement(step); + firstTokenOfLocationPath = false; + break; + } + case XercesXPath::EXPRTOKEN_PERIOD: + { + // build step + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_NODE, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_SELF, nodeTest); + stepsVector->addElement(step); + + if (firstTokenOfLocationPath && i+1 < tokenCount) { + + aToken = tokens.elementAt(i+1); + + if (aToken == XercesXPath::EXPRTOKEN_OPERATOR_DOUBLE_SLASH){ + + if (++i == tokenCount - 1) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_ExpectedStep2, fMemoryManager); + } + + if (i+1 < tokenCount) { + + aToken = tokens.elementAt(i+1); + + if (aToken == XercesXPath::EXPRTOKEN_OPERATOR_SLASH) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoForwardSlash, fMemoryManager); + } + } + // build step + nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_NODE, fMemoryManager); + step = new (fMemoryManager) XercesStep(XercesStep::AxisType_DESCENDANT, nodeTest); + stepsVector->addElement(step); + } + } + firstTokenOfLocationPath=false; + break; + } + case XercesXPath::EXPRTOKEN_OPERATOR_DOUBLE_SLASH: + { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoDoubleForwardSlash, fMemoryManager); + } + case XercesXPath::EXPRTOKEN_OPERATOR_SLASH: + { + if (i == 0) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoForwardSlashAtStart, fMemoryManager); + } + + // keep on truckin' + if (firstTokenOfLocationPath) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoSelectionOfRoot, fMemoryManager); + } + + if (i == tokenCount - 1) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_ExpectedStep3, fMemoryManager); + } + + aToken = tokens.elementAt(i+1); + if(aToken == XercesXPath::EXPRTOKEN_OPERATOR_SLASH || aToken == XercesXPath::EXPRTOKEN_OPERATOR_DOUBLE_SLASH || aToken == XercesXPath::EXPRTOKEN_OPERATOR_UNION) + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_ExpectedStep3, fMemoryManager); + + firstTokenOfLocationPath=false; + break; + } + default: + firstTokenOfLocationPath=false; + } + } + + XMLSize_t stepsSize = stepsVector->size(); + + if (stepsSize == 0) { + if (!fLocationPaths || fLocationPaths->size() == 0) { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_EmptyExpr, fMemoryManager); + } + else { + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_NoUnionAtEnd, fMemoryManager); + } + } + + if(stepsVector->elementAt(0)->getAxisType()!=XercesStep::AxisType_SELF) + { + // prepend ./ + XercesNodeTest* nodeTest = new (fMemoryManager) XercesNodeTest(XercesNodeTest::NodeType_NODE, fMemoryManager); + XercesStep* step = new (fMemoryManager) XercesStep(XercesStep::AxisType_SELF, nodeTest); + stepsVector->insertElementAt(step, 0); + } + XercesLocationPath* newPath = new (fMemoryManager) XercesLocationPath(stepsVector); + janSteps.orphan(); + bool bFound=false; + for(XMLSize_t j=0;jsize();j++) + if((*(fLocationPaths->elementAt(j)))==(*newPath)) + { + bFound=true; + break; + } + if(bFound) + delete newPath; + else + fLocationPaths->addElement(newPath); +} + +/*** + * Support for Serialization/De-serialization + ***/ + +IMPL_XSERIALIZABLE_TOCREATE(XercesXPath) + +void XercesXPath::serialize(XSerializeEngine& serEng) +{ + + if (serEng.isStoring()) + { + serEng<* fLocationPaths; + ***/ + XTemplateSerializer::storeObject(fLocationPaths, serEng); + } + else + { + serEng>>fEmptyNamespaceId; + serEng.readString(fExpression); + + /*** + * Deserialize RefVectorOf* fLocationPaths; + ***/ + XTemplateSerializer::loadObject(&fLocationPaths, 8, true, serEng); + } +} + +XercesXPath::XercesXPath(MemoryManager* const manager) +:fEmptyNamespaceId(0) +,fExpression(0) +,fLocationPaths(0) +,fMemoryManager(manager) +{ +} + +// --------------------------------------------------------------------------- +// XPathScanner: Constructors and Destructor +// --------------------------------------------------------------------------- +XPathScanner::XPathScanner(XMLStringPool* const stringPool) + : fAndSymbol (0) + , fOrSymbol(0) + , fModSymbol(0) + , fDivSymbol(0) + , fCommentSymbol(0) + , fTextSymbol(0) + , fPISymbol(0) + , fNodeSymbol(0) + , fAncestorSymbol(0) + , fAncestorOrSelfSymbol(0) + , fAttributeSymbol(0) + , fChildSymbol(0) + , fDescendantSymbol(0) + , fDescendantOrSelfSymbol(0) + , fFollowingSymbol(0) + , fFollowingSiblingSymbol(0) + , fNamespaceSymbol(0) + , fParentSymbol(0) + , fPrecedingSymbol(0) + , fPrecedingSiblingSymbol(0) + , fSelfSymbol(0) + , fStringPool(stringPool) +{ + init(); +} + +// --------------------------------------------------------------------------- +// XPathScanner: Helper methods +// --------------------------------------------------------------------------- +void XPathScanner::init() { + + fAndSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_AND); + fOrSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_OR); + fModSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_MOD); + fDivSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_DIV); + fCommentSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_COMMENT); + fTextSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_TEXT); + fPISymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_PI); + fNodeSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_NODE); + fAncestorSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_ANCESTOR); + fAncestorOrSelfSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_ANCESTOR_OR_SELF); + fAttributeSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_ATTRIBUTE); + fChildSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_CHILD); + fDescendantSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_DESCENDANT); + fDescendantOrSelfSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_DESCENDANT_OR_SELF); + fFollowingSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_FOLLOWING); + fFollowingSiblingSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_FOLLOWING_SIBLING); + fNamespaceSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_NAMESPACE); + fParentSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_PARENT); + fPrecedingSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_PRECEDING); + fPrecedingSiblingSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_PRECEDING_SIBLING); + fSelfSymbol = fStringPool->addOrFind(XPathSymbols::fgSYMBOL_SELF); +} + + +// --------------------------------------------------------------------------- +// XPathScanner: Scan methods +// --------------------------------------------------------------------------- +bool XPathScanner::scanExpression(const XMLCh* const data, + XMLSize_t currentOffset, + const XMLSize_t endOffset, + ValueVectorOf* const tokens) { + + bool starIsMultiplyOperator = false; + XMLSize_t nameOffset = 0; + int nameHandle = -1; + int prefixHandle = -1; + XMLCh ch; + XMLBuffer dataBuffer(128, tokens->getMemoryManager()); + + while (currentOffset != endOffset) { + + ch = data[currentOffset]; + + while (XMLChar1_0::isWhitespace(ch)) { + + if (++currentOffset == endOffset) { + break; + } + + ch = data[currentOffset]; + } + + if (currentOffset == endOffset) { + break; + } + // + // [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' + // | NameTest | NodeType | Operator | FunctionName + // | AxisName | Literal | Number | VariableReference + // + XMLByte chartype = (ch >= 0x80) ? (XMLByte)CHARTYPE_NONASCII : fASCIICharMap[ch]; + + switch (chartype) { + case CHARTYPE_OPEN_PAREN: // '(' + addToken(tokens, XercesXPath::EXPRTOKEN_OPEN_PAREN); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_CLOSE_PAREN: // ')' + addToken(tokens, XercesXPath::EXPRTOKEN_CLOSE_PAREN); + starIsMultiplyOperator = true; + ++currentOffset; + break; + case CHARTYPE_OPEN_BRACKET: // '[' + addToken(tokens, XercesXPath::EXPRTOKEN_OPEN_BRACKET); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_CLOSE_BRACKET: // ']' + addToken(tokens, XercesXPath::EXPRTOKEN_CLOSE_BRACKET); + starIsMultiplyOperator = true; + ++currentOffset; + break; + // + // [30] Number ::= Digits ('.' Digits?)? | '.' Digits + // ^^^^^^^^^^ + // + case CHARTYPE_PERIOD: // '.', '..' or '.' Digits + if (currentOffset + 1 == endOffset) { + addToken(tokens, XercesXPath::EXPRTOKEN_PERIOD); + starIsMultiplyOperator = true; + currentOffset++; + break; + } + + ch = data[currentOffset + 1]; + + if (ch == chPeriod) { // '..' + addToken(tokens, XercesXPath::EXPRTOKEN_DOUBLE_PERIOD); + starIsMultiplyOperator = true; + currentOffset += 2; + } else if (ch >= chDigit_0 && ch <= chDigit_9) { + addToken(tokens, XercesXPath::EXPRTOKEN_NUMBER); + starIsMultiplyOperator = true; + currentOffset = scanNumber(data, endOffset, currentOffset, tokens); + } else if (ch == chForwardSlash) { + addToken(tokens, XercesXPath::EXPRTOKEN_PERIOD); + starIsMultiplyOperator = true; + currentOffset++; + } else if (ch == chPipe) { // '|' + addToken(tokens, XercesXPath::EXPRTOKEN_PERIOD); + starIsMultiplyOperator = true; + currentOffset++; + } else if (XMLChar1_0::isWhitespace(ch)) { + do { + if (++currentOffset == endOffset) + break; + + ch = data[currentOffset]; + } while (XMLChar1_0::isWhitespace(ch)); + + if (currentOffset == endOffset || ch == chPipe || ch == chForwardSlash) { + addToken(tokens, XercesXPath::EXPRTOKEN_PERIOD); + starIsMultiplyOperator = true; + break; + } + } else { + XMLCh str[2]= {ch, 0 }; + ThrowXMLwithMemMgr1(XPathException, XMLExcepts::XPath_InvalidChar, str, tokens->getMemoryManager()); + } + + break; + case CHARTYPE_ATSIGN: // '@' + addToken(tokens, XercesXPath::EXPRTOKEN_ATSIGN); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_COMMA: // ',' + addToken(tokens, XercesXPath::EXPRTOKEN_COMMA); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_COLON: // '::' + if (++currentOffset == endOffset) { + return false; // REVISIT + } + ch = data[currentOffset]; + + if (ch != chColon) { + return false; // REVISIT + } + addToken(tokens, XercesXPath::EXPRTOKEN_DOUBLE_COLON); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_SLASH: // '/' and '//' + if (++currentOffset == endOffset) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_SLASH); + starIsMultiplyOperator = false; + break; + } + + ch = data[currentOffset]; + + if (ch == chForwardSlash) { // '//' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_DOUBLE_SLASH); + starIsMultiplyOperator = false; + ++currentOffset; + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_SLASH); + starIsMultiplyOperator = false; + } + break; + case CHARTYPE_UNION: // '|' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_UNION); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_PLUS: // '+' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_PLUS); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_MINUS: // '-' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_MINUS); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_EQUAL: // '=' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_EQUAL); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_EXCLAMATION: // '!=' + if (++currentOffset == endOffset) { + return false; // REVISIT + } + + ch = data[currentOffset]; + + if (ch != chEqual) { + return false; // REVISIT + } + + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_NOT_EQUAL); + starIsMultiplyOperator = false; + ++currentOffset; + break; + case CHARTYPE_LESS: // '<' and '<=' + if (++currentOffset == endOffset) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_LESS); + starIsMultiplyOperator = false; + break; + } + + ch = data[currentOffset]; + + if (ch == chEqual) { // '<=' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_LESS_EQUAL); + starIsMultiplyOperator = false; + ++currentOffset; + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_LESS); + starIsMultiplyOperator = false; + } + break; + case CHARTYPE_GREATER: // '>' and '>=' + if (++currentOffset == endOffset) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_GREATER); + starIsMultiplyOperator = false; + break; + } + + ch = data[currentOffset]; + + if (ch == chEqual) { // '>=' + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_GREATER_EQUAL); + starIsMultiplyOperator = false; + ++currentOffset; + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_GREATER); + starIsMultiplyOperator = false; + } + break; + // + // [29] Literal ::= '"' [^"]* '"' | "'" [^']* "'" + // + case CHARTYPE_QUOTE: // '\"' or '\'' + { + XMLCh qchar = ch; + if (++currentOffset == endOffset) { + return false; // REVISIT + } + + ch = data[currentOffset]; + + XMLSize_t litOffset = currentOffset; + while (ch != qchar) { + if (++currentOffset == endOffset) { + return false; // REVISIT + } + + ch = data[currentOffset]; + } + + addToken(tokens, XercesXPath::EXPRTOKEN_LITERAL); + starIsMultiplyOperator = true; + + dataBuffer.set(data + litOffset, currentOffset - litOffset); + tokens->addElement(fStringPool->addOrFind(dataBuffer.getRawBuffer())); + ++currentOffset; + break; + } + // + // [30] Number ::= Digits ('.' Digits?)? | '.' Digits + // [31] Digits ::= [0-9]+ + // + case CHARTYPE_DIGIT: + addToken(tokens, XercesXPath::EXPRTOKEN_NUMBER); + starIsMultiplyOperator = true; + currentOffset = scanNumber(data, endOffset, currentOffset, tokens); + break; + // + // [36] VariableReference ::= '$' QName + // + case CHARTYPE_DOLLAR: + if (++currentOffset == endOffset) { + return false; // REVISIT + } + nameOffset = currentOffset; + currentOffset = scanNCName(data, endOffset, currentOffset); + + if (currentOffset == nameOffset) { + return false; // REVISIT + } + + if (currentOffset < endOffset) { + ch = data[currentOffset]; + } + else { + ch = 0; + } + + dataBuffer.set(data + nameOffset, currentOffset - nameOffset); + nameHandle = fStringPool->addOrFind(dataBuffer.getRawBuffer()); + prefixHandle = -1; + + if (ch == chColon) { + + prefixHandle = nameHandle; + if (++currentOffset == endOffset) { + return false; // REVISIT + } + nameOffset = currentOffset; + currentOffset = scanNCName(data, endOffset, currentOffset); + + if (currentOffset == nameOffset) { + return false; // REVISIT + } + + dataBuffer.set(data + nameOffset, currentOffset - nameOffset); + nameHandle = fStringPool->addOrFind(dataBuffer.getRawBuffer()); + } + addToken(tokens, XercesXPath::EXPRTOKEN_VARIABLE_REFERENCE); + starIsMultiplyOperator = true; + tokens->addElement(prefixHandle); + tokens->addElement(nameHandle); + break; + // + // [37] NameTest ::= '*' | NCName ':' '*' | QName + // [34] MultiplyOperator ::= '*' + // + case CHARTYPE_STAR: // '*' + // + // 3.7 Lexical Structure + // + // If there is a preceding token and the preceding token is not one of @, ::, (, [, , or + // an Operator, then a * must be recognized as a MultiplyOperator. + // + // Otherwise, the token must not be recognized as a MultiplyOperator. + // + if (starIsMultiplyOperator) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_MULT); + starIsMultiplyOperator = false; + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_NAMETEST_ANY); + starIsMultiplyOperator = true; + } + + ++currentOffset; + break; + // + // NCName, QName and non-terminals + // + case CHARTYPE_NONASCII: // possibly a valid non-ascii 'Letter' (BaseChar | Ideographic) + case CHARTYPE_LETTER: + case CHARTYPE_UNDERSCORE: + { + // + // 3.7 Lexical Structure + // + // If there is a preceding token and the preceding token is not one of @, ::, (, [, , or + // an Operator, then an NCName must be recognized as an OperatorName. + // + // If the character following an NCName (possibly after intervening ExprWhitespace) is (, + // then the token must be recognized as a NodeType or a FunctionName. + // + // If the two characters following an NCName (possibly after intervening ExprWhitespace) + // are ::, then the token must be recognized as an AxisName. + // + // Otherwise, the token must not be recognized as an OperatorName, a NodeType, a + // FunctionName, or an AxisName. + // + // [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' + // [38] NodeType ::= 'comment' | 'text' | 'processing-instruction' | 'node' + // [35] FunctionName ::= QName - NodeType + // [6] AxisName ::= (see above) + // + // [37] NameTest ::= '*' | NCName ':' '*' | QName + // [5] NCName ::= (Letter | '_') (NCNameChar)* + // [?] NCNameChar ::= Letter | Digit | '.' | '-' | '_' (ascii subset of 'NCNameChar') + // [?] QName ::= (NCName ':')? NCName + // [?] Letter ::= [A-Za-z] (ascii subset of 'Letter') + // [?] Digit ::= [0-9] (ascii subset of 'Digit') + // + nameOffset = currentOffset; + currentOffset = scanNCName(data, endOffset, currentOffset); + if (currentOffset == nameOffset) { + return false; // REVISIT + } + + if (currentOffset < endOffset) { + ch = data[currentOffset]; + } + else { + ch = 0; + } + + dataBuffer.set(data + nameOffset, currentOffset - nameOffset); + nameHandle = fStringPool->addOrFind(dataBuffer.getRawBuffer()); + + bool isNameTestNCName = false; + bool isAxisName = false; + prefixHandle = -1; + + if (ch == chColon) { + + if (++currentOffset == endOffset) { + return false; // REVISIT + } + + ch = data[currentOffset]; + + if (ch == chAsterisk) { + if (++currentOffset < endOffset) { + ch = data[currentOffset]; + } + + isNameTestNCName = true; + } else if (ch == chColon) { + if (++currentOffset < endOffset) { + ch = data[currentOffset]; + } + + isAxisName = true; + } else { + prefixHandle = nameHandle; + nameOffset = currentOffset; + currentOffset = scanNCName(data, endOffset, currentOffset); + if (currentOffset == nameOffset) { + return false; // REVISIT + } + if (currentOffset < endOffset) { + ch = data[currentOffset]; + } + else { + ch = 0; + } + + dataBuffer.set(data + nameOffset, currentOffset - nameOffset); + nameHandle = fStringPool->addOrFind(dataBuffer.getRawBuffer()); + } + } + // + // [39] ExprWhitespace ::= S + // + while (XMLChar1_0::isWhitespace(ch)) { + if (++currentOffset == endOffset) { + break; + } + ch = data[currentOffset]; + } + + // + // If there is a preceding token and the preceding token is not one of @, ::, (, [, , or + // an Operator, then an NCName must be recognized as an OperatorName. + // + if (starIsMultiplyOperator) { + if (nameHandle == fAndSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_AND); + starIsMultiplyOperator = false; + } else if (nameHandle == fOrSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_OR); + starIsMultiplyOperator = false; + } else if (nameHandle == fModSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_MOD); + starIsMultiplyOperator = false; + } else if (nameHandle == fDivSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_OPERATOR_DIV); + starIsMultiplyOperator = false; + } else { + return false; // REVISIT + } + + if (isNameTestNCName) { + return false; // REVISIT - NCName:* where an OperatorName is required + } else if (isAxisName) { + return false; // REVISIT - AxisName:: where an OperatorName is required + } + break; + } + // + // If the character following an NCName (possibly after intervening ExprWhitespace) is (, + // then the token must be recognized as a NodeType or a FunctionName. + // + if (ch == chOpenParen && !isNameTestNCName && !isAxisName) { + if (nameHandle == fCommentSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_NODETYPE_COMMENT); + } else if (nameHandle == fTextSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_NODETYPE_TEXT); + } else if (nameHandle == fPISymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_NODETYPE_PI); + } else if (nameHandle == fNodeSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_NODETYPE_NODE); + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_FUNCTION_NAME); + tokens->addElement(prefixHandle); + tokens->addElement(nameHandle); + } + addToken(tokens, XercesXPath::EXPRTOKEN_OPEN_PAREN); + starIsMultiplyOperator = false; + ++currentOffset; + break; + } + + // + // If the two characters following an NCName (possibly after intervening ExprWhitespace) + // are ::, then the token must be recognized as an AxisName. + // + if (isAxisName || + (ch == chColon && currentOffset + 1 < endOffset && + data[currentOffset + 1] == chColon)) { + + if (nameHandle == fAncestorSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_ANCESTOR); + } else if (nameHandle == fAncestorOrSelfSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_ANCESTOR_OR_SELF); + } else if (nameHandle == fAttributeSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_ATTRIBUTE); + } else if (nameHandle == fChildSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_CHILD); + } else if (nameHandle == fDescendantSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_DESCENDANT); + } else if (nameHandle == fDescendantOrSelfSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_DESCENDANT_OR_SELF); + } else if (nameHandle == fFollowingSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_FOLLOWING); + } else if (nameHandle == fFollowingSiblingSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_FOLLOWING_SIBLING); + } else if (nameHandle == fNamespaceSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_NAMESPACE); + } else if (nameHandle == fParentSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_PARENT); + } else if (nameHandle == fPrecedingSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_PRECEDING); + } else if (nameHandle == fPrecedingSiblingSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_PRECEDING_SIBLING); + } else if (nameHandle == fSelfSymbol) { + addToken(tokens, XercesXPath::EXPRTOKEN_AXISNAME_SELF); + } else { + return false; // REVISIT + } + + if (isNameTestNCName) { + return false; // REVISIT - "NCName:* ::" where "AxisName ::" is required + } + + addToken(tokens, XercesXPath::EXPRTOKEN_DOUBLE_COLON); + starIsMultiplyOperator = false; + if (!isAxisName) { + currentOffset += 2; + } + break; + } + // + // Otherwise, the token must not be recognized as an OperatorName, a NodeType, a + // FunctionName, or an AxisName. + // + if (isNameTestNCName) { + addToken(tokens, XercesXPath::EXPRTOKEN_NAMETEST_NAMESPACE); + tokens->addElement(nameHandle); + } else { + addToken(tokens, XercesXPath::EXPRTOKEN_NAMETEST_QNAME); + tokens->addElement(prefixHandle); + tokens->addElement(nameHandle); + } + + starIsMultiplyOperator = true; + break; + } + default: + { + XMLCh str[2]= {ch, 0 }; + ThrowXMLwithMemMgr1(XPathException, XMLExcepts::XPath_InvalidChar, str, tokens->getMemoryManager()); + break; + } + } + } + + return true; +} + + +XMLSize_t XPathScanner::scanNCName(const XMLCh* const data, + const XMLSize_t endOffset, + XMLSize_t currentOffset) { + + XMLCh ch = data[currentOffset]; + + if (!XMLChar1_0::isFirstNCNameChar(ch)) { + return currentOffset; + } + + while (++currentOffset < endOffset) { + + ch = data[currentOffset]; + + if (!XMLChar1_0::isNCNameChar(ch)) { + break; + } + } + + return currentOffset; +} + + +XMLSize_t XPathScanner::scanNumber(const XMLCh* const data, + const XMLSize_t endOffset, + XMLSize_t currentOffset, + ValueVectorOf* const tokens) { + + XMLCh ch = data[currentOffset]; + int whole = 0; + int part = 0; + + while (ch >= chDigit_0 && ch <= chDigit_9) { + + whole = (whole * 10) + (ch - chDigit_0); + + if (++currentOffset == endOffset) { + break; + } + + ch = data[currentOffset]; + } + + if (ch == chPeriod) { + + if (++currentOffset < endOffset) { + + ch = data[currentOffset]; + + while (ch >= chDigit_0 && ch <= chDigit_9) { + + part = (part * 10) + (ch - chDigit_0); + + if (++currentOffset == endOffset) { + break; + } + + ch = data[currentOffset]; + } + + if (part != 0) { + ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::XPath_FindSolution, tokens->getMemoryManager()); + } + } + } + + tokens->addElement(whole); + tokens->addElement(part); + + return currentOffset; +} + + +// --------------------------------------------------------------------------- +// XPathScannerForSchema: Constructors and Destructor +// --------------------------------------------------------------------------- +XPathScannerForSchema::XPathScannerForSchema(XMLStringPool* const stringPool) + : XPathScanner(stringPool) +{ +} + + +// --------------------------------------------------------------------------- +// XPathScannerForSchema: Helper methods +// --------------------------------------------------------------------------- +void XPathScannerForSchema::addToken(ValueVectorOf* const tokens, + const int aToken) { + + if (aToken == XercesXPath::EXPRTOKEN_ATSIGN || + aToken == XercesXPath::EXPRTOKEN_AXISNAME_ATTRIBUTE || + aToken == XercesXPath::EXPRTOKEN_AXISNAME_CHILD || + //token == XercesXPath::EXPRTOKEN_AXISNAME_SELF || + aToken == XercesXPath::EXPRTOKEN_DOUBLE_COLON || + aToken == XercesXPath::EXPRTOKEN_NAMETEST_QNAME || + //token == XercesXPath::EXPRTOKEN_NODETYPE_NODE || + aToken == XercesXPath::EXPRTOKEN_OPERATOR_SLASH || + aToken == XercesXPath::EXPRTOKEN_PERIOD || + aToken == XercesXPath::EXPRTOKEN_NAMETEST_ANY || + aToken == XercesXPath::EXPRTOKEN_NAMETEST_NAMESPACE || + aToken == XercesXPath::EXPRTOKEN_OPERATOR_DOUBLE_SLASH || + aToken == XercesXPath::EXPRTOKEN_OPERATOR_UNION) { + + tokens->addElement(aToken); + return; + } + + ThrowXMLwithMemMgr(XPathException, XMLExcepts::XPath_TokenNotSupported, tokens->getMemoryManager()); +} + +XERCES_CPP_NAMESPACE_END + +/** + * End of file XercesPath.cpp + */ diff --git a/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.hpp b/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.hpp new file mode 100644 index 000000000..d388da85a --- /dev/null +++ b/project/jni/xerces/src/xercesc/validators/schema/identity/XercesXPath.hpp @@ -0,0 +1,499 @@ +/* + * 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: XercesXPath.hpp 932887 2010-04-11 13:04:59Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XERCESXPATH_HPP) +#define XERCESC_INCLUDE_GUARD_XERCESXPATH_HPP + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +// --------------------------------------------------------------------------- +// Forward Declarations +// --------------------------------------------------------------------------- +class XMLStringPool; + +class VALIDATORS_EXPORT XercesNodeTest : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + enum NodeType { + NodeType_QNAME = 1, + NodeType_WILDCARD = 2, + NodeType_NODE = 3, + NodeType_NAMESPACE= 4, + NodeType_UNKNOWN + }; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XercesNodeTest(const short type, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XercesNodeTest(const QName* const qName); + XercesNodeTest(const XMLCh* const prefix, const unsigned int uriId, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + XercesNodeTest(const XercesNodeTest& other); + ~XercesNodeTest() { delete fName; } + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + XercesNodeTest& operator= (const XercesNodeTest& other); + bool operator== (const XercesNodeTest& other) const; + bool operator!= (const XercesNodeTest& other) const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + short getType() const { return fType; } + QName* getName() const { return fName; } + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesNodeTest) + + XercesNodeTest(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + short fType; + QName* fName; +}; + + +/** + * A location path step comprised of an axis and node test. + */ +class VALIDATORS_EXPORT XercesStep : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + enum AxisType { // Axis type + AxisType_CHILD = 1, + AxisType_ATTRIBUTE = 2, + AxisType_SELF = 3, + AxisType_DESCENDANT = 4, + AxisType_UNKNOWN + }; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XercesStep(const unsigned short axisType, XercesNodeTest* const nodeTest); + XercesStep(const XercesStep& other); + ~XercesStep() { delete fNodeTest; } + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + XercesStep& operator= (const XercesStep& other); + bool operator== (const XercesStep& other) const; + bool operator!= (const XercesStep& other) const; + + // ----------------------------------------------------------------------- + // Getter methods + // ----------------------------------------------------------------------- + unsigned short getAxisType() const { return fAxisType; } + XercesNodeTest* getNodeTest() const { return fNodeTest; } + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesStep) + + XercesStep(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + unsigned short fAxisType; + XercesNodeTest* fNodeTest; +}; + + +/** + * A location path representation for an XPath expression. + */ +class VALIDATORS_EXPORT XercesLocationPath : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XercesLocationPath(RefVectorOf* const steps); + ~XercesLocationPath() { delete fSteps; } + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + bool operator== (const XercesLocationPath& other) const; + bool operator!= (const XercesLocationPath& other) const; + + // ----------------------------------------------------------------------- + // Access methods + // ----------------------------------------------------------------------- + XMLSize_t getStepSize() const; + void addStep(XercesStep* const aStep); + XercesStep* getStep(const XMLSize_t index) const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesLocationPath) + + XercesLocationPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesLocationPath(const XercesLocationPath& other); + XercesLocationPath& operator= (const XercesLocationPath& other); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + RefVectorOf* fSteps; +}; + + +class VALIDATORS_EXPORT XercesXPath : public XSerializable, public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + /** + * [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' + * | NameTest | NodeType | Operator | FunctionName + * | AxisName | Literal | Number | VariableReference + */ + enum { + EXPRTOKEN_OPEN_PAREN = 0, + EXPRTOKEN_CLOSE_PAREN = 1, + EXPRTOKEN_OPEN_BRACKET = 2, + EXPRTOKEN_CLOSE_BRACKET = 3, + EXPRTOKEN_PERIOD = 4, + EXPRTOKEN_DOUBLE_PERIOD = 5, + EXPRTOKEN_ATSIGN = 6, + EXPRTOKEN_COMMA = 7, + EXPRTOKEN_DOUBLE_COLON = 8, + EXPRTOKEN_NAMETEST_ANY = 9, + EXPRTOKEN_NAMETEST_NAMESPACE = 10, + EXPRTOKEN_NAMETEST_QNAME = 11, + EXPRTOKEN_NODETYPE_COMMENT = 12, + EXPRTOKEN_NODETYPE_TEXT = 13, + EXPRTOKEN_NODETYPE_PI = 14, + EXPRTOKEN_NODETYPE_NODE = 15, + EXPRTOKEN_OPERATOR_AND = 16, + EXPRTOKEN_OPERATOR_OR = 17, + EXPRTOKEN_OPERATOR_MOD = 18, + EXPRTOKEN_OPERATOR_DIV = 19, + EXPRTOKEN_OPERATOR_MULT = 20, + EXPRTOKEN_OPERATOR_SLASH = 21, + EXPRTOKEN_OPERATOR_DOUBLE_SLASH = 22, + EXPRTOKEN_OPERATOR_UNION = 23, + EXPRTOKEN_OPERATOR_PLUS = 24, + EXPRTOKEN_OPERATOR_MINUS = 25, + EXPRTOKEN_OPERATOR_EQUAL = 26, + EXPRTOKEN_OPERATOR_NOT_EQUAL = 27, + EXPRTOKEN_OPERATOR_LESS = 28, + EXPRTOKEN_OPERATOR_LESS_EQUAL = 29, + EXPRTOKEN_OPERATOR_GREATER = 30, + EXPRTOKEN_OPERATOR_GREATER_EQUAL = 31, + EXPRTOKEN_FUNCTION_NAME = 32, + EXPRTOKEN_AXISNAME_ANCESTOR = 33, + EXPRTOKEN_AXISNAME_ANCESTOR_OR_SELF = 34, + EXPRTOKEN_AXISNAME_ATTRIBUTE = 35, + EXPRTOKEN_AXISNAME_CHILD = 36, + EXPRTOKEN_AXISNAME_DESCENDANT = 37, + EXPRTOKEN_AXISNAME_DESCENDANT_OR_SELF = 38, + EXPRTOKEN_AXISNAME_FOLLOWING = 39, + EXPRTOKEN_AXISNAME_FOLLOWING_SIBLING = 40, + EXPRTOKEN_AXISNAME_NAMESPACE = 41, + EXPRTOKEN_AXISNAME_PARENT = 42, + EXPRTOKEN_AXISNAME_PRECEDING = 43, + EXPRTOKEN_AXISNAME_PRECEDING_SIBLING = 44, + EXPRTOKEN_AXISNAME_SELF = 45, + EXPRTOKEN_LITERAL = 46, + EXPRTOKEN_NUMBER = 47, + EXPRTOKEN_VARIABLE_REFERENCE = 48 + }; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XercesXPath(const XMLCh* const xpathExpr, + XMLStringPool* const stringPool, + XercesNamespaceResolver* const scopeContext, + const unsigned int emptyNamespaceId, + const bool isSelector = false, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + ~XercesXPath(); + + // ----------------------------------------------------------------------- + // Operators + // ----------------------------------------------------------------------- + bool operator== (const XercesXPath& other) const; + bool operator!= (const XercesXPath& other) const; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + RefVectorOf* getLocationPaths() const; + + /*** + * Support for Serialization/De-serialization + ***/ + DECL_XSERIALIZABLE(XercesXPath) + + XercesXPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); + + XMLCh* getExpression(); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XercesXPath(const XercesXPath& other); + XercesXPath& operator= (const XercesXPath& other); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void cleanUp(); + void checkForSelectedAttributes(); + void parseExpression(XMLStringPool* const stringPool, + XercesNamespaceResolver* const scopeContext); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + unsigned int fEmptyNamespaceId; + XMLCh* fExpression; + RefVectorOf* fLocationPaths; + MemoryManager* fMemoryManager; +}; + + +class VALIDATORS_EXPORT XPathScanner : public XMemory +{ +public: + // ----------------------------------------------------------------------- + // Constants + // ----------------------------------------------------------------------- + enum { + CHARTYPE_INVALID = 0, // invalid XML character + CHARTYPE_OTHER = 1, // not special - one of "#%&;?\^`{}~" or DEL + CHARTYPE_WHITESPACE = 2, // one of "\t\n\r " (0x09, 0x0A, 0x0D, 0x20) + CHARTYPE_EXCLAMATION = 3, // '!' (0x21) + CHARTYPE_QUOTE = 4, // '\"' or '\'' (0x22 and 0x27) + CHARTYPE_DOLLAR = 5, // '$' (0x24) + CHARTYPE_OPEN_PAREN = 6, // '(' (0x28) + CHARTYPE_CLOSE_PAREN = 7, // ')' (0x29) + CHARTYPE_STAR = 8, // '*' (0x2A) + CHARTYPE_PLUS = 9, // '+' (0x2B) + CHARTYPE_COMMA = 10, // ',' (0x2C) + CHARTYPE_MINUS = 11, // '-' (0x2D) + CHARTYPE_PERIOD = 12, // '.' (0x2E) + CHARTYPE_SLASH = 13, // '/' (0x2F) + CHARTYPE_DIGIT = 14, // '0'-'9' (0x30 to 0x39) + CHARTYPE_COLON = 15, // ':' (0x3A) + CHARTYPE_LESS = 16, // '<' (0x3C) + CHARTYPE_EQUAL = 17, // '=' (0x3D) + CHARTYPE_GREATER = 18, // '>' (0x3E) + CHARTYPE_ATSIGN = 19, // '@' (0x40) + CHARTYPE_LETTER = 20, // 'A'-'Z' or 'a'-'z' (0x41 to 0x5A and 0x61 to 0x7A) + CHARTYPE_OPEN_BRACKET = 21, // '[' (0x5B) + CHARTYPE_CLOSE_BRACKET = 22, // ']' (0x5D) + CHARTYPE_UNDERSCORE = 23, // '_' (0x5F) + CHARTYPE_UNION = 24, // '|' (0x7C) + CHARTYPE_NONASCII = 25 // Non-ASCII Unicode codepoint (>= 0x80) + }; + + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XPathScanner(XMLStringPool* const stringPool); + virtual ~XPathScanner() {} + + // ----------------------------------------------------------------------- + // Scan methods + // ----------------------------------------------------------------------- + bool scanExpression(const XMLCh* const data, XMLSize_t currentOffset, + const XMLSize_t endOffset, ValueVectorOf* const tokens); + +protected: + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + /** + * This method adds the specified token to the token list. By default, + * this method allows all tokens. However, subclasses can can override + * this method in order to disallow certain tokens from being used in the + * scanned XPath expression. This is a convenient way of allowing only + * a subset of XPath. + */ + virtual void addToken(ValueVectorOf* const tokens, const int aToken); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XPathScanner(const XPathScanner& other); + XPathScanner& operator= (const XPathScanner& other); + + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void init(); + + // ----------------------------------------------------------------------- + // Scan methods + // ----------------------------------------------------------------------- + XMLSize_t scanNCName(const XMLCh* const data, const XMLSize_t endOffset, + XMLSize_t currentOffset); + XMLSize_t scanNumber(const XMLCh* const data, const XMLSize_t endOffset, + XMLSize_t currentOffset, ValueVectorOf* const tokens); + + // ----------------------------------------------------------------------- + // Data members + // ----------------------------------------------------------------------- + int fAndSymbol; + int fOrSymbol; + int fModSymbol; + int fDivSymbol; + int fCommentSymbol; + int fTextSymbol; + int fPISymbol; + int fNodeSymbol; + int fAncestorSymbol; + int fAncestorOrSelfSymbol; + int fAttributeSymbol; + int fChildSymbol; + int fDescendantSymbol; + int fDescendantOrSelfSymbol; + int fFollowingSymbol; + int fFollowingSiblingSymbol; + int fNamespaceSymbol; + int fParentSymbol; + int fPrecedingSymbol; + int fPrecedingSiblingSymbol; + int fSelfSymbol; + XMLStringPool* fStringPool; + + static const XMLByte fASCIICharMap[128]; +}; + + +class VALIDATORS_EXPORT XPathScannerForSchema: public XPathScanner +{ +public: + // ----------------------------------------------------------------------- + // Constructors/Destructor + // ----------------------------------------------------------------------- + XPathScannerForSchema(XMLStringPool* const stringPool); + ~XPathScannerForSchema() {} + +protected: + // ----------------------------------------------------------------------- + // Helper methods + // ----------------------------------------------------------------------- + void addToken(ValueVectorOf* const tokens, const int aToken); + +private: + // ----------------------------------------------------------------------- + // Unimplemented constructors and operators + // ----------------------------------------------------------------------- + XPathScannerForSchema(const XPathScannerForSchema& other); + XPathScannerForSchema& operator= (const XPathScannerForSchema& other); +}; + +// --------------------------------------------------------------------------- +// XercesLocationPath: Access methods +// --------------------------------------------------------------------------- +inline XMLSize_t XercesLocationPath::getStepSize() const { + + if (fSteps) + return fSteps->size(); + + return 0; +} + +inline void XercesLocationPath::addStep(XercesStep* const aStep) { + + fSteps->addElement(aStep); +} + +inline XercesStep* XercesLocationPath::getStep(const XMLSize_t index) const { + + if (fSteps) + return fSteps->elementAt(index); + + return 0; +} + +// --------------------------------------------------------------------------- +// XercesScanner: Helper methods +// --------------------------------------------------------------------------- +inline void XPathScanner::addToken(ValueVectorOf* const tokens, + const int aToken) { + tokens->addElement(aToken); +} + + +// --------------------------------------------------------------------------- +// XercesXPath: Getter methods +// --------------------------------------------------------------------------- +inline RefVectorOf* XercesXPath::getLocationPaths() const { + + return fLocationPaths; +} + +inline XMLCh* XercesXPath::getExpression() { + return fExpression; +} + +XERCES_CPP_NAMESPACE_END + +#endif + +/** + * End of file XercesPath.hpp + */ + diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp new file mode 100644 index 000000000..82583d2e3 --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.cpp @@ -0,0 +1,80 @@ +/* + * 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: XIncludeDOMDocumentProcessor.cpp 655706 2008-05-13 01:08:39Z amassari $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +DOMDocument * +XIncludeDOMDocumentProcessor::doXIncludeDOMProcess(const DOMDocument * const source, XMLErrorReporter *errorHandler, XMLEntityHandler* entityResolver /*=NULL*/){ + XIncludeUtils xiu(errorHandler); + + DOMImplementation* impl = source->getImplementation(); + DOMDocument *xincludedDocument = impl->createDocument(); + + try + { + /* set up the declaration etc of the output document to match the source */ + xincludedDocument->setDocumentURI( source->getDocumentURI()); + xincludedDocument->setXmlStandalone( source->getXmlStandalone()); + xincludedDocument->setXmlVersion( source->getXmlVersion()); + + /* copy entire source document into the xincluded document. Xincluded document can + then be modified in place */ + DOMNode *child = source->getFirstChild(); + for (; child != NULL; child = child->getNextSibling()){ + if (child->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE){ + /* I am simply ignoring these at the moment */ + continue; + } + DOMNode *newNode = xincludedDocument->importNode(child, true); + xincludedDocument->appendChild(newNode); + } + + DOMNode *docNode = xincludedDocument->getDocumentElement(); + /* parse and include the document node */ + xiu.parseDOMNodeDoingXInclude(docNode, xincludedDocument, entityResolver); + + xincludedDocument->normalizeDocument(); + } + catch(const XMLErrs::Codes) + { + xincludedDocument->release(); + return NULL; + } + catch(...) + { + xincludedDocument->release(); + throw; + } + + return xincludedDocument; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp new file mode 100644 index 000000000..1f304409b --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeDOMDocumentProcessor.hpp @@ -0,0 +1,58 @@ +/* + * 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: XIncludeDOMDocumentProcessor.hpp 655706 2008-05-13 01:08:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XINCLUDEDOMDOCUMENTPROCESSOR_HPP) +#define XERCESC_INCLUDE_GUARD_XINCLUDEDOMDOCUMENTPROCESSOR_HPP + +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLEntityHandler; + +/** + * Class for representing and manipulating the XMLCh * href's used + * by an xi:include element. + * + * This class is designed primarily for internal use. This class implements + * the functionality required to calculate relative hrefs and the base URI + * fixups required for performing XInclude functionality. + */ +class XINCLUDE_EXPORT XIncludeDOMDocumentProcessor +{ +public: + /** Walk the supplied DOMDocument performing all XInclude's as encountered. + * + * @param source A DOMDocument to parse, this document is not modified. + * @param errorHandled An errorHandler to call back in case of problems + * + * @return a newly created DOMDocument containing the parsed and actioned + * xinclude elements. + */ + DOMDocument *doXIncludeDOMProcess(const DOMDocument * const source, XMLErrorReporter *errorHandler, XMLEntityHandler* entityResolver=NULL); +}; + +XERCES_CPP_NAMESPACE_END + +#endif /* XINCLUDEDOMDOCUMENTPROCESSOR_HPP */ + diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.cpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.cpp new file mode 100644 index 000000000..1b078aca1 --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.cpp @@ -0,0 +1,141 @@ +/* + * 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: XIncludeLocation.cpp 932949 2010-04-11 17:40:33Z borisk $ + */ + + +// --------------------------------------------------------------------------- +// Includes +// --------------------------------------------------------------------------- +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +const XMLCh *allocate(const XMLCh *href){ + XMLCh *allocated; + XMLSize_t length = XMLString::stringLen(href); + allocated = (XMLCh*)XMLPlatformUtils::fgMemoryManager->allocate((length+1) * sizeof(XMLCh)); + XMLString::copyString(allocated, href); + XMLPlatformUtils::removeDotDotSlash(allocated); + + return allocated; +} + +void deallocate(void *ptr){ + if (ptr) + XMLPlatformUtils::fgMemoryManager->deallocate((void *)ptr); +} + +// --------------------------------------------------------------------------- +// Destructor and Constructor +// --------------------------------------------------------------------------- +XIncludeLocation::XIncludeLocation(const XMLCh *href){ + fHref = allocate(href); +} + +XIncludeLocation::~XIncludeLocation(){ + deallocate((void *)fHref); +} + +const XMLCh * +XIncludeLocation::prependPath(const XMLCh *baseToAdd){ + XMLCh *relativeHref = NULL; + if (fHref == NULL){ + return NULL; + } + + if (baseToAdd == NULL){ + return fHref; + } + + XMLPlatformUtils::removeDotDotSlash((XMLCh*)baseToAdd); + XMLSize_t baseLength = XMLString::stringLen(baseToAdd); + + int lastSlash = XMLString::lastIndexOf(baseToAdd, chForwardSlash); + if (lastSlash == -1){ + /* not found, try another platform */ + lastSlash = XMLString::lastIndexOf(baseToAdd, chBackSlash); + } + + // Skip the scheme (e.g., file://) if fHref has one. Ideally we + // should detect also if the URI is absolute. + // + const XMLCh* hrefPath = findEndOfProtocol (fHref); + XMLSize_t hrefPathLength = XMLString::stringLen(hrefPath); + + relativeHref = (XMLCh *)XMLPlatformUtils::fgMemoryManager->allocate((hrefPathLength + baseLength + 2) * sizeof(XMLCh)); + if (relativeHref == NULL){ + return NULL; + } + XMLString::copyNString(relativeHref, baseToAdd, lastSlash + 1); + relativeHref[lastSlash + 1] = chNull; + XMLString::catString(relativeHref, hrefPath); + + /* free the old reference */ + deallocate((void *)fHref); + + fHref = relativeHref; + return fHref; +} + +const XMLCh * +XIncludeLocation::findEndOfProtocol(const XMLCh *URI){ + if ( URI[0] == chLatin_f && + URI[1] == chLatin_i && + URI[2] == chLatin_l && + URI[3] == chLatin_e && + URI[4] == chColon && + URI[5] == chForwardSlash && + URI[6] == chForwardSlash && + URI[7] == chForwardSlash ) + { + return URI + 8; + } + + if ( URI[0] == chLatin_f && + URI[1] == chLatin_t && + URI[2] == chLatin_p && + URI[3] == chColon && + URI[4] == chForwardSlash && + URI[5] == chForwardSlash && + URI[6] == chForwardSlash ) + { + return URI + 7; + } + + if ( URI[0] == chLatin_h && + URI[1] == chLatin_t && + URI[2] == chLatin_t && + URI[3] == chLatin_p && + URI[4] == chColon && + URI[5] == chForwardSlash && + URI[6] == chForwardSlash && + URI[7] == chForwardSlash ) + { + return URI + 8; + } + + /* if method fails, simply return the URI and let the problem be detected + * and reported down the line (it may not have a protocol of course) */ + return URI; +} + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.hpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.hpp new file mode 100644 index 000000000..b3dc3318e --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeLocation.hpp @@ -0,0 +1,89 @@ +/* + * 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: XIncludeLocation.hpp 655706 2008-05-13 01:08:39Z amassari $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XINCLUDELOCATION_HPP) +#define XERCESC_INCLUDE_GUARD_XINCLUDELOCATION_HPP + +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + + +/** + * Class for representing and manipulating the XMLCh * href's used + * by an xi:include element. + * + * This class is designed primarily for internal use. This class implements + * the functionality required to calculate relative hrefs and the base URI + * fixups required for performing XInclude functionality. + */ +class XINCLUDE_EXPORT XIncludeLocation +{ +public: + /** Create an XIncludeLocation, primed with the supplied href + * + * @param href the initial URI value + * + * @return nothing + */ + XIncludeLocation(const XMLCh *href); + + /** Destructor + * + * @return nothing + */ + ~XIncludeLocation(); + + /** Prepend the supplied href to the current location and modify the current XIncludeLocation's + * internal href field + * + * @param toPrepend the path to prepend + * + * @return the resultant compound URI + */ + const XMLCh *prependPath(const XMLCh *toPrepend); + + /** Get the current XIncludeLocation's compound URI location + * + * @return the current URI + */ + const XMLCh *getLocation(){ + return fHref; + }; + + /** Get a pointer to the end of the protocol section of a URI + * + * @param URI a URI to strip the protocol from + * + * @return a pointer into the supplied URI immediately after the last character of the protocol section + * the pointer points to the first character after the protocol. + */ + static const XMLCh *findEndOfProtocol(const XMLCh *URI); + +private: + const XMLCh *fHref; +}; + +XERCES_CPP_NAMESPACE_END + +#endif /* XINCLUDELOCATION_HPP */ + diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.cpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.cpp new file mode 100644 index 000000000..4100a3183 --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.cpp @@ -0,0 +1,838 @@ +/* + * 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: XIncludeUtils.cpp 933212 2010-04-12 12:17:58Z amassari $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +XIncludeUtils::XIncludeUtils(XMLErrorReporter *errorReporter){ + fErrorReporter = errorReporter; + fIncludeHistoryHead = NULL; +} + +XIncludeUtils::~XIncludeUtils(){ + freeInclusionHistory(); +} + +// --------------------------------------------------------------------------- +// Generic function to parse a dom node performing any Xinclude's it ecounters, +// storing its results in parsedDocument, which is expected to be a real +// document. sourceNode is the current location in parsedDocument, and +// all xinclude manipulation is done in place (i.e. source is manipulated). +// --------------------------------------------------------------------------- +bool +XIncludeUtils::parseDOMNodeDoingXInclude(DOMNode *sourceNode, DOMDocument *parsedDocument, XMLEntityHandler* entityResolver){ + if (sourceNode) { + /* create the list of child elements here, since it gets changed during the parse */ + RefVectorOf children(10, false); + for (DOMNode *child = sourceNode->getFirstChild(); child != NULL; child = child->getNextSibling()){ + children.addElement(child); + } + + if (sourceNode->getNodeType() == DOMNode::ELEMENT_NODE){ + if (isXIIncludeDOMNode(sourceNode)){ + /* once we do an include on the source element, it is unsafe to do the include + on the children, since they will have been changed by the top level include */ + bool success = doDOMNodeXInclude(sourceNode, parsedDocument, entityResolver); + + //popFromCurrentInclusionHistoryStack(NULL); + /* return here as we do not want to fall through to the parsing of the children below + - they should have been replaced by the XInclude */ + return success; + } else if (isXIFallbackDOMNode(sourceNode)){ + /* This must be a fallback element that is not a child of an include element. + This is defined as a fatal error */ + XIncludeUtils::reportError(sourceNode, XMLErrs::XIncludeOrphanFallback, + NULL, parsedDocument->getDocumentURI()); + return false; + } + } + + /* to have got here, we must not have found an xinclude element in the current element, so + need to walk the entire child list parsing for each. An xinclude in a + node does not affect a peer, so we can simply parse each child in turn */ + for (XMLSize_t i = 0; i < children.size(); i++){ + parseDOMNodeDoingXInclude(children.elementAt(i), parsedDocument, entityResolver); + } + } + return false; +} + +// --------------------------------------------------------------------------- +// utility func to extract a DOMNodes Base attr value if present +// --------------------------------------------------------------------------- +static const XMLCh * +getBaseAttrValue(DOMNode *node){ + if (node->getNodeType() == DOMNode::ELEMENT_NODE){ + DOMElement *elem = (DOMElement *)node; + if(elem->hasAttributes()) { + /* get all the attributes of the node */ + DOMNamedNodeMap *pAttributes = elem->getAttributes(); + XMLSize_t nSize = pAttributes->getLength(); + for(XMLSize_t i=0;iitem(i); + /* get attribute name */ + if (XMLString::equals(pAttributeNode->getName(), XIncludeUtils::fgXIBaseAttrName)){ + /*if (namespace == XMLUni::fgXMLString){ + + }*/ + return pAttributeNode->getValue(); + } + } + } + } + return NULL; +} + +// --------------------------------------------------------------------------- +// This method assumes that currentNode is an xinclude element and parses +// it accordingly, acting on what it finds. +// --------------------------------------------------------------------------- +bool +XIncludeUtils::doDOMNodeXInclude(DOMNode *xincludeNode, DOMDocument *parsedDocument, XMLEntityHandler* entityResolver){ + bool modifiedNode = false; + /* the relevant attributes to look for */ + const XMLCh *href = NULL; + const XMLCh *parse = NULL; + const XMLCh *xpointer = NULL; + const XMLCh *encoding = NULL; + const XMLCh *accept = NULL; + const XMLCh *acceptlanguage = NULL; + DOMNode *includeParent = xincludeNode->getParentNode(); + + + if(xincludeNode->hasAttributes()) { + /* get all the attributes of the node */ + DOMNamedNodeMap *pAttributes = xincludeNode->getAttributes(); + XMLSize_t nSize = pAttributes->getLength(); + for(XMLSize_t i=0;iitem(i); + const XMLCh *attrName = pAttributeNode->getName(); + /* check each attribute against the potential useful names */ + if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeHREFAttrName)){ + href = pAttributeNode->getValue(); + } else if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeParseAttrName)){ + parse = pAttributeNode->getValue(); + } else if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeXPointerAttrName)){ + xpointer = pAttributeNode->getValue(); + } else if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeEncodingAttrName)){ + encoding = pAttributeNode->getValue(); + } else if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeAcceptAttrName)){ + accept = pAttributeNode->getValue(); + } else if (XMLString::equals(attrName, XIncludeUtils::fgXIIncludeAcceptLanguageAttrName)){ + acceptlanguage = pAttributeNode->getValue(); + } else { + /* if any other attribute is in the xi namespace, it's an error */ + const XMLCh *attrNamespaceURI = pAttributeNode->getNamespaceURI(); + if (attrNamespaceURI && XMLString::equals(attrNamespaceURI, XIncludeUtils::fgXIIIncludeNamespaceURI)){ + } else { + /* ignore - any other attribute is allowed according to spec, + and must be ignored */ + } + } + } + } + // 3.1 xi:include Element + // The children property of the xi:include element may include a single xi:fallback element; + // the appearance of more than one xi:fallback element, an xi:include element, + // or any other element from the XInclude namespace is a fatal error. + DOMNode *child; + DOMElement *fallback = NULL; + for (child = xincludeNode->getFirstChild(); child != 0; child=child->getNextSibling()){ + if(child->getNodeType()!=DOMNode::ELEMENT_NODE) + continue; + if ( isXIFallbackDOMNode(child) ){ + if (fallback != NULL){ + /* fatal error - there are more than one fallback children */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeMultipleFallbackElems, + parsedDocument->getDocumentURI(), parsedDocument->getDocumentURI()); + return false; + } + fallback = (DOMElement*)child; + } + else if(isXIIncludeDOMNode(child) || XMLString::equals(child->getNamespaceURI(), XIncludeUtils::fgXIIIncludeNamespaceURI)) { + /* fatal error - an xi element different from xi:fallback is a child of xi:include */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeDisallowedChild, + child->getNodeName(), parsedDocument->getDocumentURI()); + return false; + } + } + + if (href == NULL){ + /* this is an unrecoverable error until we have xpointer support - + if there is an xpointer, the current document is assumed + however, there is no xpointer support yet */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeNoHref, + NULL, parsedDocument->getDocumentURI()); + return false; + } + + /* set up the accept and accept-language values */ + if (accept != NULL){ + + } + + if (parse == NULL){ + /* use the default, as specified */ + parse = XIncludeUtils::fgXIIncludeParseAttrXMLValue; + } + + if (xpointer != NULL){ + /* not supported yet */ + /* Note that finding an xpointer attr along with parse="text" is a Fatal Error + * - http://www.w3.org/TR/xinclude/#include-location */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeXPointerNotSupported, + NULL, href); + return false; + } + + /* set up the href according to what has gone before */ + XIncludeLocation hrefLoc(href); + XIncludeLocation relativeLocation(href); + const XMLCh *includeBase = xincludeNode->getBaseURI(); + if (includeBase != NULL){ + hrefLoc.prependPath(includeBase); + } + + if (getBaseAttrValue(xincludeNode) != NULL){ + relativeLocation.prependPath(getBaseAttrValue(xincludeNode)); + } + + /* Take the relevant action - we need to retrieve the target as a whole before + we can know if it was successful or not, therefore the do* methods do + not modify the parsedDocument. Swapping the results in is left to the + caller (i.e. here) */ + DOMText *includedText = NULL; + DOMDocument *includedDoc = NULL; + if (XMLString::equals(parse, XIncludeUtils::fgXIIncludeParseAttrXMLValue)){ + /* including a XML element */ + includedDoc = doXIncludeXMLFileDOM(hrefLoc.getLocation(), relativeLocation.getLocation(), xincludeNode, parsedDocument, entityResolver); + } else if (XMLString::equals(parse, XIncludeUtils::fgXIIncludeParseAttrTextValue)){ + /* including a text value */ + includedText = doXIncludeTEXTFileDOM(hrefLoc.getLocation(), relativeLocation.getLocation(), encoding, xincludeNode, parsedDocument, entityResolver); + } else { + /* invalid parse attribute value - fatal error according to the specification */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeInvalidParseVal, + parse, parsedDocument->getDocumentURI()); + return false; + } + + RefVectorOf delayedProcessing(12,false); + if (includedDoc == NULL && includedText == NULL){ + /* there was an error - this is now a resource error + let's see if there is a fallback */ + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeIncludeFailedResourceError, + hrefLoc.getLocation(), parsedDocument->getDocumentURI()); + + if (includeParent == NULL){ + includeParent = parsedDocument; + } + + // we could be getting errors trying to insert elements at the root of the document, so we should use replaceChild; + // in order to handle multiple nodes, add them to a document fragment and use that to replace the original node + if (fallback){ + /* baseURI fixups - see http://www.w3.org/TR/xinclude/#base for details. */ + XMLUri parentURI(includeParent->getBaseURI()); + XMLUri includedURI(fallback->getBaseURI()); + + if (fallback->hasChildNodes()){ + DOMDocumentFragment* frag = parsedDocument->createDocumentFragment(); + DOMNode *child = fallback->getFirstChild(); + /* add the content of the fallback element, and remove the fallback elem itself */ + for ( ; child != NULL ; child=child->getNextSibling()){ + if (child->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE){ + continue; + } + DOMNode *newNode = parsedDocument->importNode(child, true); + /* if the paths differ we need to add a base attribute */ + if (newNode->getNodeType()==DOMNode::ELEMENT_NODE && !XMLString::equals(parentURI.getPath(), includedURI.getPath())){ + if (getBaseAttrValue(newNode) == NULL){ + /* need to calculate the proper path difference to get the relativePath */ + ((DOMElement*)newNode)->setAttribute(fgXIBaseAttrName, getBaseAttrValue(fallback->getParentNode())); + } else { + /* the included node has base of its own which takes precedence */ + XIncludeLocation xil(getBaseAttrValue(newNode)); + if (getBaseAttrValue(fallback->getParentNode()) != NULL){ + /* prepend any specific base modification of the xinclude node */ + xil.prependPath(getBaseAttrValue(fallback->getParentNode())); + } + ((DOMElement*)newNode)->setAttribute(fgXIBaseAttrName, xil.getLocation()); + } + } + DOMNode *newChild = frag->appendChild(newNode); + // don't process the node now, wait until it is placed in the final position + delayedProcessing.addElement(newChild); + //parseDOMNodeDoingXInclude(newChild, parsedDocument, entityResolver); + } + includeParent->replaceChild(frag, xincludeNode); + frag->release(); + + for(XMLSize_t i=0;iremoveChild(xincludeNode); + modifiedNode = true; + } + } else { + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeIncludeFailedNoFallback, + parsedDocument->getDocumentURI(), parsedDocument->getDocumentURI()); + return false; + } + } else { + if (includedDoc){ + /* record the successful include while we process the children */ + addDocumentURIToCurrentInclusionHistoryStack(hrefLoc.getLocation()); + + DOMDocumentFragment* frag = parsedDocument->createDocumentFragment(); + /* need to import the document prolog here */ + DOMNode *child = includedDoc->getFirstChild(); + for (; child != NULL; child = child->getNextSibling()) { + if (child->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) + continue; + // check for NOTATION or ENTITY clash + if(child->getNodeType()==DOMNode::ELEMENT_NODE && includedDoc->getDoctype()!=NULL) { + DOMNamedNodeMap *pAttributes = child->getAttributes(); + XMLSize_t nSize = pAttributes->getLength(); + for(XMLSize_t i=0;iitem(i); + const DOMTypeInfo * typeInfo=pAttributeNode->getSchemaTypeInfo(); + if(typeInfo && XMLString::equals(typeInfo->getTypeNamespace(), XMLUni::fgInfosetURIName)) { + if(XMLString::equals(typeInfo->getTypeName(), XMLUni::fgNotationString)) { + const XMLCh* notationName=pAttributeNode->getNodeValue(); + DOMNotation* notat=(DOMNotation*)includedDoc->getDoctype()->getNotations()->getNamedItem(notationName); + // ensure we have a DTD + if(parsedDocument->getDoctype()==NULL) + parsedDocument->insertBefore(parsedDocument->createDocumentType(parsedDocument->getDocumentElement()->getNodeName(), NULL,NULL), parsedDocument->getFirstChild()); + DOMNotation* myNotation=(DOMNotation*)parsedDocument->getDoctype()->getNotations()->getNamedItem(notationName); + if(myNotation==NULL) + { + // it's missing, add it + parsedDocument->getDoctype()->getNotations()->setNamedItem(parsedDocument->importNode(notat, true)); + } + else if(XMLString::equals(myNotation->getPublicId(), notat->getPublicId()) && + XMLString::equals(myNotation->getSystemId(), notat->getSystemId()) && + XMLString::equals(myNotation->getBaseURI(), notat->getBaseURI())) + { + // it's duplicate, ignore it + } + else + { + // it's a conflict, report it + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeConflictingNotation, + notationName, parsedDocument->getDocumentURI()); + } + } + else if(XMLString::equals(typeInfo->getTypeName(), XMLUni::fgEntityString)) { + const XMLCh* entityName=pAttributeNode->getNodeValue(); + DOMEntity* ent=(DOMEntity*)includedDoc->getDoctype()->getEntities()->getNamedItem(entityName); + // ensure we have a DTD + if(parsedDocument->getDoctype()==NULL) + parsedDocument->insertBefore(parsedDocument->createDocumentType(parsedDocument->getDocumentElement()->getNodeName(), NULL,NULL), parsedDocument->getFirstChild()); + DOMEntity* myEnt=(DOMEntity*)parsedDocument->getDoctype()->getEntities()->getNamedItem(entityName); + if(myEnt==NULL) + { + // it's missing, add it + parsedDocument->getDoctype()->getEntities()->setNamedItem(parsedDocument->importNode(ent, true)); + } + else if(XMLString::equals(myEnt->getPublicId(), ent->getPublicId()) && + XMLString::equals(myEnt->getSystemId(), ent->getSystemId()) && + XMLString::equals(myEnt->getBaseURI(), ent->getBaseURI())) + { + // it's duplicate, ignore it + } + else + { + // it's a conflict, report it + XIncludeUtils::reportError(xincludeNode, XMLErrs::XIncludeConflictingEntity, + entityName, parsedDocument->getDocumentURI()); + } + } + } + } + } + DOMNode *newNode = parsedDocument->importNode(child, true); + DOMNode *newChild = frag->appendChild(newNode); + // don't process the node now, wait until it is placed in the final position + delayedProcessing.addElement(newChild); + //parseDOMNodeDoingXInclude(newChild, parsedDocument, entityResolver); + } + includeParent->replaceChild(frag, xincludeNode); + frag->release(); + + for(XMLSize_t i=0;ireplaceChild(includedText, xincludeNode); + modifiedNode = true; + } + } + + if (includedDoc) + includedDoc->release(); + + return modifiedNode; +} + +DOMDocument * +XIncludeUtils::doXIncludeXMLFileDOM(const XMLCh *href, + const XMLCh *relativeHref, + DOMNode *includeNode, + DOMDocument *parsedDocument, + XMLEntityHandler* entityResolver){ + if (XIncludeUtils::isInCurrentInclusionHistoryStack(href)){ + /* including something back up the current history */ + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeCircularInclusionLoop, + href, href); + return NULL; + } + + if (XMLString::equals(href, parsedDocument->getBaseURI())){ + /* trying to include itself */ + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeCircularInclusionDocIncludesSelf, + href, href); + return NULL; + } + + /* Instantiate the DOM parser. */ + XercesDOMParser parser; + parser.setDoNamespaces(true); + /* don't want to recurse the xi processing here */ + parser.setDoXInclude(false); + /* create the schema info nodes, so that we can detect conflicting notations */ + parser.setCreateSchemaInfo(true); + XMLInternalErrorHandler xierrhandler; + parser.setErrorHandler(&xierrhandler); + + DOMDocument *includedNode = NULL; + try { + InputSource* is=NULL; + Janitor janIS(is); + if(entityResolver) { + XMLResourceIdentifier resIdentifier(XMLResourceIdentifier::ExternalEntity, + relativeHref, + NULL, + NULL, + includeNode->getBaseURI()); + is=entityResolver->resolveEntity(&resIdentifier); + janIS.reset(is); + } + if(janIS.get()!=NULL) + parser.parse(*janIS.get()); + else + parser.parse(href); + /* need to be able to release the parser but keep the document */ + if (!xierrhandler.getSawError() && !xierrhandler.getSawFatal()) + includedNode = parser.adoptDocument(); + } + catch (const XMLException& /*toCatch*/) + { + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeResourceErrorWarning, + href, href); + } + catch (const DOMException& /*toCatch*/) + { + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeResourceErrorWarning, + href, href); + } + catch (...) + { + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeResourceErrorWarning, + href, href); + } + + //addDocumentURIToCurrentInclusionHistoryStack(href); + + if(includedNode != NULL){ + /* baseURI fixups - see http://www.w3.org/TR/xinclude/#base for details. */ + DOMElement *topLevelElement = includedNode->getDocumentElement(); + if (topLevelElement && topLevelElement->getNodeType() == DOMNode::ELEMENT_NODE ){ + XMLUri parentURI(includeNode->getBaseURI()); + XMLUri includedURI(includedNode->getBaseURI()); + + /* if the paths differ we need to add a base attribute */ + if (!XMLString::equals(parentURI.getPath(), includedURI.getPath())){ + if (getBaseAttrValue(topLevelElement) == NULL){ + /* need to calculate the proper path difference to get the relativePath */ + topLevelElement->setAttribute(fgXIBaseAttrName, relativeHref); + } else { + /* the included node has base of its own which takes precedence */ + XIncludeLocation xil(getBaseAttrValue(topLevelElement)); + if (getBaseAttrValue(includeNode) != NULL){ + /* prepend any specific base modification of the xinclude node */ + xil.prependPath(getBaseAttrValue(includeNode)); + } + topLevelElement->setAttribute(fgXIBaseAttrName, xil.getLocation()); + } + } + } + } + return includedNode; +} + +DOMText * +XIncludeUtils::doXIncludeTEXTFileDOM(const XMLCh *href, + const XMLCh *relativeHref, + const XMLCh *encoding, + DOMNode *includeNode, + DOMDocument *parsedDocument, + XMLEntityHandler* entityResolver){ + if (encoding == NULL) + /* "UTF-8" is stipulated default by spec */ + encoding = XMLUni::fgUTF8EncodingString; + + XMLTransService::Codes failReason; + XMLTranscoder* transcoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor(encoding, failReason, 16*1024); + Janitor janTranscoder(transcoder); + if (failReason){ + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeCannotOpenFile, href, href); + return NULL; + } + + //addDocumentURIToCurrentInclusionHistoryStack(href); + + InputSource* is=NULL; + Janitor janIS(is); + if(entityResolver) { + XMLResourceIdentifier resIdentifier(XMLResourceIdentifier::ExternalEntity, + relativeHref, + NULL, + NULL, + includeNode->getBaseURI()); + is=entityResolver->resolveEntity(&resIdentifier); + janIS.reset(is); + } + if(janIS.get()==NULL) + janIS.reset(new URLInputSource(href)); + if(janIS.get()==NULL) { + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeCannotOpenFile, + href, href); + return NULL; + } + BinInputStream* stream=janIS.get()->makeStream(); + if(stream==NULL) { + XIncludeUtils::reportError(parsedDocument, XMLErrs::XIncludeCannotOpenFile, + href, href); + return NULL; + } + Janitor janStream(stream); + const XMLSize_t maxToRead=16*1024; + XMLByte* buffer=(XMLByte*)XMLPlatformUtils::fgMemoryManager->allocate(maxToRead * sizeof(XMLByte)); + if(buffer==NULL) + throw OutOfMemoryException(); + ArrayJanitor janBuffer(buffer, XMLPlatformUtils::fgMemoryManager); + XMLCh* xmlChars=(XMLCh*)XMLPlatformUtils::fgMemoryManager->allocate(maxToRead*2*sizeof(XMLCh)); + if(xmlChars==NULL) + throw OutOfMemoryException(); + ArrayJanitor janUniBuffer(xmlChars, XMLPlatformUtils::fgMemoryManager); + unsigned char *charSizes = (unsigned char *)XMLPlatformUtils::fgMemoryManager->allocate(maxToRead * sizeof(unsigned char)); + if(charSizes==NULL) + throw OutOfMemoryException(); + ArrayJanitor janCharSizes(charSizes, XMLPlatformUtils::fgMemoryManager); + + XMLSize_t nRead, nOffset=0; + XMLBuffer repository; + while((nRead=stream->readBytes(buffer+nOffset, maxToRead-nOffset))>0){ + XMLSize_t bytesEaten=0; + XMLSize_t nCount = transcoder->transcodeFrom(buffer, nRead, xmlChars, maxToRead*2, bytesEaten, charSizes); + repository.append(xmlChars, nCount); + if(bytesEatencreateTextNode(repository.getRawBuffer()); +} + +/*static*/ bool +XIncludeUtils::isXIIncludeDOMNode(DOMNode *node){ + const XMLCh *nodeName = node->getLocalName(); + const XMLCh *namespaceURI = node->getNamespaceURI(); + + return isXIIncludeElement(nodeName, namespaceURI); +} + +/*static*/ bool +XIncludeUtils::isXIFallbackDOMNode(DOMNode *node){ + const XMLCh *nodeName = node->getLocalName(); + const XMLCh *namespaceURI = node->getNamespaceURI(); + + return isXIFallbackElement(nodeName, namespaceURI); +} + +/*static*/ bool +XIncludeUtils::isXIIncludeElement(const XMLCh *name, const XMLCh *namespaceURI){ + if (namespaceURI == NULL || name == NULL){ + /* no namespaces not supported */ + return false; + } + if (XMLString::equals(name, fgXIIncludeQName) + && XMLString::equals(namespaceURI, fgXIIIncludeNamespaceURI)){ + return true; + } + return false; +} + +/*static*/ bool +XIncludeUtils::isXIFallbackElement(const XMLCh *name, const XMLCh *namespaceURI){ + if (namespaceURI == NULL || name == NULL){ + /* no namespaces not supported */ + return false; + } + if (XMLString::equals(name, fgXIFallbackQName) + && XMLString::equals(namespaceURI, fgXIIIncludeNamespaceURI)){ + return true; + } + return false; +} + +/* 4.1.1 */ +const XMLCh * +XIncludeUtils::getEscapedHRefAttrValue(const XMLCh * /*hrefAttrValue*/, bool & /*needsDeallocating*/){ + XMLCh *escapedAttr = NULL; + return escapedAttr; +} + +/* 4.1.2 */ +bool +XIncludeUtils::setContentNegotiation(const XMLCh * /*acceptAttrValue*/, const XMLCh * /*acceptLangAttrValue*/){ + return false; +} + +bool +XIncludeUtils::checkTextIsValidForInclude(XMLCh * /*includeChars*/){ + return false; +} + +// ======================================================== +// the stack utilities are slightly convoluted debug versions, they +// will be pared down for the release code +// ======================================================== +static XIncludeHistoryNode * +getTopOfCurrentInclusionHistoryStack(XIncludeHistoryNode *head){ + XIncludeHistoryNode *historyCursor = head; + if (historyCursor == NULL){ + return NULL; + } + while (historyCursor->next != NULL){ + historyCursor = historyCursor->next; + } + return historyCursor; +} + +bool +XIncludeUtils::addDocumentURIToCurrentInclusionHistoryStack(const XMLCh *URItoAdd){ + XIncludeHistoryNode *newNode = (XIncludeHistoryNode *)XMLPlatformUtils::fgMemoryManager->allocate(sizeof(XIncludeHistoryNode)); + if (newNode == NULL){ + return false; + } + newNode->URI = XMLString::replicate(URItoAdd); + newNode->next = NULL; + + if (fIncludeHistoryHead == NULL){ + fIncludeHistoryHead = newNode; + return true; + } + XIncludeHistoryNode *topNode = getTopOfCurrentInclusionHistoryStack(fIncludeHistoryHead); + topNode->next = newNode; + return true; +} + +bool +XIncludeUtils::isInCurrentInclusionHistoryStack(const XMLCh *toFind){ + XIncludeHistoryNode *historyCursor = fIncludeHistoryHead; + /* walk the list */ + while (historyCursor != NULL){ + if (XMLString::equals(toFind, historyCursor->URI)){ + return true; + } + historyCursor = historyCursor->next; + } + return false; +} + +XIncludeHistoryNode * +XIncludeUtils::popFromCurrentInclusionHistoryStack(const XMLCh * /*toPop*/){ + XIncludeHistoryNode *historyCursor = fIncludeHistoryHead; + XIncludeHistoryNode *penultimateCursor = historyCursor; + + if (fIncludeHistoryHead == NULL){ + return NULL; + } + + while (historyCursor->next != NULL){ + penultimateCursor = historyCursor; + historyCursor = historyCursor->next; + } + + if (historyCursor == fIncludeHistoryHead){ + fIncludeHistoryHead = NULL; + } else { + penultimateCursor->next = NULL; + } + + XMLString::release(&(historyCursor->URI)); + XMLPlatformUtils::fgMemoryManager->deallocate((void *)historyCursor); + return NULL; +} + +void +XIncludeUtils::freeInclusionHistory(){ + XIncludeHistoryNode *historyCursor = XIncludeUtils::fIncludeHistoryHead; + while (historyCursor != NULL){ + XIncludeHistoryNode *next = historyCursor->next; + XMLString::release(&(historyCursor->URI)); + XMLPlatformUtils::fgMemoryManager->deallocate((void *)historyCursor); + historyCursor = next; + } + XIncludeUtils::fIncludeHistoryHead = NULL; +} + +bool +XIncludeUtils::reportError(const DOMNode* const /*errorNode*/ + , XMLErrs::Codes errorType + , const XMLCh* const errorMsg + , const XMLCh * const href) +{ + bool toContinueProcess = true; /* default value for no error handler */ + + const XMLCh* const systemId = href; + const XMLCh* const publicId = href; + /* TODO - look these up somehow? */ + const XMLFileLoc lineNum = 0; + const XMLFileLoc colNum = 0; + + if (fErrorReporter) + { + // Load the message into a local for display + const XMLSize_t msgSize = 1023; + XMLCh errText[msgSize + 1]; + + /* TODO - investigate whether this is complete */ + XMLMsgLoader *errMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgXMLErrDomain); + if (errorMsg == NULL){ + if (errMsgLoader->loadMsg(errorType, errText, msgSize)) + { + // Probably should load a default msg here + } + } else { + if (errMsgLoader->loadMsg(errorType, errText, msgSize, errorMsg)) + { + // Probably should load a default msg here + } + } + + fErrorReporter->error(errorType + , XMLUni::fgXMLErrDomain //fgXMLErrDomain + , XMLErrs::errorType(errorType) + , errText + , systemId + , publicId + , lineNum + , colNum); + } + + if (XMLErrs::isFatal(errorType)) + fErrorCount++; + + return toContinueProcess; +} + +/* TODO - declared in this file for convenience, prob ought to be moved out to + util/XMLUni.cpp before releasing */ +const XMLCh XIncludeUtils::fgXIIncludeQName[] = +{ + chLatin_i, chLatin_n, chLatin_c, chLatin_l, chLatin_u, chLatin_d, chLatin_e, chNull +}; +const XMLCh XIncludeUtils::fgXIFallbackQName[] = +{ + chLatin_f, chLatin_a, chLatin_l, chLatin_l, chLatin_b, chLatin_a, chLatin_c, chLatin_k, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeHREFAttrName[] = +{ + chLatin_h, chLatin_r, chLatin_e, chLatin_f, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeParseAttrName[] = +{ + chLatin_p, chLatin_a, chLatin_r, chLatin_s, chLatin_e, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeXPointerAttrName[] = +{ + chLatin_x, chLatin_p, chLatin_o, chLatin_i, chLatin_n, chLatin_t, chLatin_e, chLatin_r, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeEncodingAttrName[] = +{ + chLatin_e, chLatin_n, chLatin_c, chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeAcceptAttrName[] = +{ + chLatin_a, chLatin_c, chLatin_c, chLatin_e, chLatin_p, chLatin_t, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeAcceptLanguageAttrName[] = +{ + chLatin_a, chLatin_c, chLatin_c, chLatin_e, chLatin_p, chLatin_t, chDash, chLatin_l, chLatin_a, + chLatin_n, chLatin_g, chLatin_u, chLatin_a, chLatin_g, chLatin_e, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeParseAttrXMLValue[] = +{ + chLatin_x, chLatin_m, chLatin_l, chNull +}; +const XMLCh XIncludeUtils::fgXIIncludeParseAttrTextValue[] = +{ + chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull +}; +const XMLCh XIncludeUtils::fgXIIIncludeNamespaceURI[] = +{ + /* http://www.w3.org/2001/XInclude */ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_w, chLatin_w, chLatin_w, chPeriod + , chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g + , chForwardSlash, chDigit_2, chDigit_0, chDigit_0, chDigit_1 + , chForwardSlash, chLatin_X, chLatin_I, chLatin_n, chLatin_c, chLatin_l + , chLatin_u, chLatin_d, chLatin_e, chNull +}; +const XMLCh XIncludeUtils::fgXIBaseAttrName[] = +{ + chLatin_x, chLatin_m, chLatin_l, chColon, chLatin_b, chLatin_a, chLatin_s, chLatin_e, chNull +}; + +XERCES_CPP_NAMESPACE_END diff --git a/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.hpp b/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.hpp new file mode 100644 index 000000000..8f5f24843 --- /dev/null +++ b/project/jni/xerces/src/xercesc/xinclude/XIncludeUtils.hpp @@ -0,0 +1,267 @@ +/* + * 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: XIncludeUtils.hpp 673949 2008-07-04 08:04:44Z borisk $ + */ + +#if !defined(XERCESC_INCLUDE_GUARD_XINCLUDEUTILS_HPP) +#define XERCESC_INCLUDE_GUARD_XINCLUDEUTILS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +XERCES_CPP_NAMESPACE_BEGIN + +class XMLEntityHandler; + +typedef struct XIncludeHistoryNode{ + XMLCh *URI; + struct XIncludeHistoryNode *next; +}XIncludeHistoryNode; + +/** + * Class implementing all the utility functions required by an XInclude parser. + * + * This class is designed primarily for internal use. This class implements + * utility methods to be called by an XInclude parser. It is intended to encapsulate + * the actual processing and recognition of XInclude components. + */ +class XINCLUDE_EXPORT XIncludeUtils +{ +private: + + /** Constructor + * + */ + XIncludeUtils(XMLErrorReporter *errorReporter); + + /** Destructor + * + */ + ~XIncludeUtils(); + + /** Parse the supplied XInclude element performing relevant XInclude functionality + * + * @param xincludeNode The XInclude node to parse and action + * @param parsedDocument The DOMDocument to which the results of the XInclude are to be added + * + * @return true if the XInclude processing was successful, false if not. Note that an + * XInclude that fails resulting in a successful fallback action would return true. + */ + bool doDOMNodeXInclude(DOMNode *xincludeNode, DOMDocument *parsedDocument, XMLEntityHandler* entityResolver); + + /** Parse an XInclude xml file into a DOMDocument node. + * + * @param href the location of the document to include + * @param relativeHref + * @param parsedDocument + * + * @return a newly created DOMDocument containing the parsed and actioned + * href, or NULL if the document could not be loaded. + */ + DOMDocument *doXIncludeXMLFileDOM(const XMLCh *href, + const XMLCh *relativeHref, + DOMNode *xincludeNode, + DOMDocument *parsedDocument, + XMLEntityHandler* entityResolver); + + /** Parse an XInclude text file into a DOMText node. + * + * @param href the location of the document to include + * @param relativeHref + * @param encoding + * @param parsedDocument + * + * @return a newly created DOMText containing the parsed and actioned + * href, or NULL if the document could not be loaded. + */ + DOMText *doXIncludeTEXTFileDOM(const XMLCh *href, + const XMLCh *relativeHref, + const XMLCh *encoding, + DOMNode *xincludeNode, + DOMDocument *parsedDocument, + XMLEntityHandler* entityResolver); + + /** Detect whether the supplied details are correct for an xi:include element + * + * @param name the element name + * @param namespaceURI the element namespace + * + * @return true if details are valid for an xi:include element, false + * if not. + */ + static bool isXIIncludeElement(const XMLCh *name, const XMLCh *namespaceURI); + + /** Detect whether the supplied details are correct for an xi:fallback element + * + * @param name the element name + * @param namespaceURI the element namespace + * + * @return true if details are valid for an xi:fallback element, false + * if not. + */ + static bool isXIFallbackElement(const XMLCh *name, const XMLCh *namespaceURI); + + /** Detect whether the supplied DOMNode is an xi:include element + * + * @param node The node to check + * + * @return true if node is an xi:include element, false + * if not. + */ + static bool isXIIncludeDOMNode(DOMNode *node); + + /** Detect whether the supplied DOMNode is an xi:fallback element + * + * @param node The DOMNode to check + * + * @return true if node is an xi:fallback element, false + * if not. + */ + static bool isXIFallbackDOMNode(DOMNode *node); + + /** Walk the content of the supplied source node, performing any xinclude actions + * that are encountered. + * + * @param source A DOMNode to parse, this node may be modified by the method + * @param parsedDocument the DOMDocument to which the parsed results are to be copied. + * + * @return true if XInclude behaviour was successfully performed on source, false if not. + */ + bool parseDOMNodeDoingXInclude(DOMNode *source, DOMDocument *parsedDocument, XMLEntityHandler* entityResolver); + + /** Parse the supplied URI and escape all characters as specified by + * the XINclusions specification. + * + * @param hrefAttrValue the href to parse and escape. + * @param needsDeallocating set to true if the return value needs deallocating + * by the caller after use, false if the value returned is the same as the + * hrefAttrValue passed in. + * + * @return an escaped version of hrefAttrValue or hrefAttrValue itself if + * hrefAttrValue contains only valid characters. + */ + /* 4.1.1 */ + const XMLCh *getEscapedHRefAttrValue(const XMLCh *hrefAttrValue, bool &needsDeallocating); + + /** Set the accept and accept-lang parameters on HTTP requests generated while + * XIncluding. + * + * @param acceptAttrValue + * @param acceptLangAttrValue + * + * @return true if the values were successfully added to the HTTP request, false + * if not. + */ + /* 4.1.2 */ + bool setContentNegotiation(const XMLCh *acceptAttrValue, const XMLCh *acceptLangAttrValue); + + /** Check the characters passed in are all valid characters for XInclusion + * as specified at http://www.w3.org/TR/xinclude/#text-included-items + * + * @param includeChars the characters to parse for validity + * + * @return true if the includeChars parameter contains only valid characters + * for inclusion, false if there are invalid characters in includeChars. + */ + bool checkTextIsValidForInclude(XMLCh *includeChars); + + /** Add the supplied parameter to the InclusionHistoryStack + * + * @param URItoAdd the URI to add to the InclusionHistoryStack/ + * + * @return true if the URI was added, false if a problem prevented + * the URI being added. + */ + bool addDocumentURIToCurrentInclusionHistoryStack(const XMLCh *URItoAdd); + + /** Check the XInclude InclusionHistoryStack to see if the supplied URI + * has already been included. This is used to ensure that circular inclusion + * chains are detected and that the inclusion mechanism does not get stuck in + * a loop. + * + * @param toFind the URI to look up. + * + * @return true if the toFind parameter is found in the InclusionHistortStack, + * false if the parameter is not in the stack or the stack is empty. + */ + bool isInCurrentInclusionHistoryStack(const XMLCh *toFind); + + /** Pop (i.e. remove and return) the top value from the InclusionHistoryStack + * + * @param toPop the value that is expected to be at the top of the stack, or + * NULL if no checking is required. + * + * @return the element at the top of the stack + */ + XIncludeHistoryNode * popFromCurrentInclusionHistoryStack(const XMLCh *toPop); + + /** Free the internal inclusion history list. + * + * @return nothing + */ + void freeInclusionHistory(); + + /** Construct and pass on an error description + * + * @param errorNode The DOMNode that was being parsed when the error occurred + * @param errorType The severity of the error + * @param errorMsg An optional message to include in the error report + * @param href The URI of the document being parsed. + * + * @return true if the errorHandler requests continuation of parsing despite error + * false if the errorHandler requests parsing end on encountering error, or it + * there is no error handler. + */ + bool reportError(const DOMNode* const errorNode + , XMLErrs::Codes errorType + , const XMLCh* const errorMsg + , const XMLCh* const href); + +public: + /* temporarily public to facilitate helper func getBaseAttrValue */ + static const XMLCh fgXIBaseAttrName[]; +private: + XIncludeHistoryNode *fIncludeHistoryHead; + XMLSize_t fErrorCount; + XMLErrorReporter *fErrorReporter; + static const XMLCh fgXIIncludeQName[]; + static const XMLCh fgXIFallbackQName[]; + static const XMLCh fgXIIncludeHREFAttrName[]; + static const XMLCh fgXIIncludeParseAttrName[]; + static const XMLCh fgXIIncludeParseAttrXMLValue[]; + static const XMLCh fgXIIncludeParseAttrTextValue[]; + static const XMLCh fgXIIncludeXPointerAttrName[]; + static const XMLCh fgXIIncludeEncodingAttrName[]; + static const XMLCh fgXIIncludeAcceptAttrName[]; + static const XMLCh fgXIIncludeAcceptLanguageAttrName[]; + static const XMLCh fgXIIIncludeNamespaceURI[]; + + friend class XIncludeDOMDocumentProcessor; + friend class AbstractDOMParser; +}; + +XERCES_CPP_NAMESPACE_END + +#endif diff --git a/project/jni/xerces/version.incl b/project/jni/xerces/version.incl new file mode 100644 index 000000000..9a42a27e6 --- /dev/null +++ b/project/jni/xerces/version.incl @@ -0,0 +1,22 @@ +# +# Copyright 1999-2004 The Apache Software Foundation. +# +# Licensed 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: version.incl 935350 2010-04-18 15:02:36Z borisk $ +# +VER=3_1_1 +INTERFACE_VER_D=3.1 +INTERFACE_VER_U=3_1